As suggested by user, use file name when call save as.

This commit is contained in:
Roman Telezhynskyi 2021-06-22 16:48:37 +03:00
parent 5eaff85a60
commit 8cc9a221c6
2 changed files with 13 additions and 1 deletions

View File

@ -897,6 +897,11 @@ bool TMainWindow::FileSaveAs()
usedNotExistedDir = directory.mkpath(QChar('.'));
}
if (not curFile.isEmpty())
{
fName = StrippedName(curFile);
}
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"), dir + QChar('/') + fName, filters, nullptr,
VAbstractApplication::VApp()->NativeFileDialog());

View File

@ -3137,8 +3137,15 @@ bool MainWindow::on_actionSaveAs_triggered()
usedNotExistedDir = directory.mkpath(QChar('.'));
}
QString newFileName = tr("pattern") + QLatin1String(".val");
if(not VAbstractValApplication::VApp()->GetPatternPath().isEmpty())
{
newFileName = StrippedName(VAbstractValApplication::VApp()->GetPatternPath());
}
QString fileName = QFileDialog::getSaveFileName(this, tr("Save as"),
dir + QLatin1String("/") + tr("pattern") + QLatin1String(".val"),
dir + QLatin1String("/") + newFileName,
filters, nullptr, VAbstractApplication::VApp()->NativeFileDialog());
auto RemoveTempDir = qScopeGuard([usedNotExistedDir, dir]()