From 8cc9a221c6399045cae1bf88f22798d8cc10b53e Mon Sep 17 00:00:00 2001 From: Roman Telezhynskyi Date: Tue, 22 Jun 2021 16:48:37 +0300 Subject: [PATCH] As suggested by user, use file name when call save as. --- src/app/tape/tmainwindow.cpp | 5 +++++ src/app/valentina/mainwindow.cpp | 9 ++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/app/tape/tmainwindow.cpp b/src/app/tape/tmainwindow.cpp index e93e86962..bd01e631e 100644 --- a/src/app/tape/tmainwindow.cpp +++ b/src/app/tape/tmainwindow.cpp @@ -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()); diff --git a/src/app/valentina/mainwindow.cpp b/src/app/valentina/mainwindow.cpp index 5083b153e..86febb45b 100644 --- a/src/app/valentina/mainwindow.cpp +++ b/src/app/valentina/mainwindow.cpp @@ -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]()