Also added "Save copy as"

This prompts for a new filename but it keeps remembering the previous name.
This commit is contained in:
Eelke Klein 2017-01-21 08:19:47 +01:00
parent 69ac154b07
commit 6c268bd774
3 changed files with 28 additions and 6 deletions

View file

@ -521,14 +521,26 @@ void MainWindow::on_actionSave_SQL_triggered()
}
}
void MainWindow::on_actionSave_SQL_as_triggered()
QString MainWindow::promptUserForSaveSqlFilename()
{
QString home_dir = QStandardPaths::locate(QStandardPaths::HomeLocation, "", QStandardPaths::LocateDirectory);
QString file_name = QFileDialog::getSaveFileName(this,
tr("Save query"), home_dir, tr("SQL file (*.sql)"));
if ( ! file_name.isEmpty()) {
saveSqlTo(file_name);
m_fileName = file_name;
return QFileDialog::getSaveFileName(this, tr("Save query"), home_dir, tr("SQL file (*.sql)"));
}
void MainWindow::on_actionSave_SQL_as_triggered()
{
QString filename = promptUserForSaveSqlFilename();
if (!filename.isEmpty()) {
saveSqlTo(filename);
m_fileName = filename;
}
}
void MainWindow::on_actionSave_copy_of_SQL_as_triggered()
{
QString filename = promptUserForSaveSqlFilename();
if (!filename.isEmpty()) {
saveSqlTo(filename);
}
}
@ -620,3 +632,5 @@ void MainWindow::showEvent(QShowEvent *event)
}