Fixed bug with path to destination folder. Now the app will check each change

of path. If path after closing the dialog doesn't exist the app will try to
create a path.

--HG--
branch : release
This commit is contained in:
Roman Telezhynskyi 2016-08-15 16:37:44 +03:00
parent fffb8e99e6
commit ba36ab3c71
2 changed files with 16 additions and 2 deletions

View File

@ -219,9 +219,13 @@ void DialogSaveLayout::ShowExample()
//---------------------------------------------------------------------------------------------------------------------
void DialogSaveLayout::Browse()
{
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"), QDir::homePath(),
const QString dir = QFileDialog::getExistingDirectory(this, tr("Select folder"),
qApp->ValentinaSettings()->GetPathLayout(),
QFileDialog::ShowDirsOnly | QFileDialog::DontResolveSymlinks);
ui->lineEditPath->setText(dir);
if (not dir.isEmpty())
{// If paths equal the signal will not be called, we will do this manually
dir == ui->lineEditPath->text() ? PathChanged(dir) : ui->lineEditPath->setText(dir);
}
}
//---------------------------------------------------------------------------------------------------------------------

View File

@ -213,6 +213,16 @@ void MainWindowsNoGUI::ExportLayout(const DialogSaveLayout &dialog)
suf.replace(".", "");
const QString path = dialog.Path();
QDir dir(path);
dir.setPath(path);
if (not dir.exists(path))
{
if (not dir.mkpath(path))
{
qCritical() << tr("Can't create path");
return;
}
}
qApp->ValentinaSettings()->SetPathLayout(path);
const QString mask = dialog.FileName();