Also added "Save copy as"
This prompts for a new filename but it keeps remembering the previous name.
This commit is contained in:
parent
69ac154b07
commit
6c268bd774
3 changed files with 28 additions and 6 deletions
|
|
@ -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)
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -77,6 +77,7 @@ private:
|
|||
bool continueWithoutSaving();
|
||||
void closeEvent(QCloseEvent *event);
|
||||
void showEvent(QShowEvent *event);
|
||||
QString promptUserForSaveSqlFilename();
|
||||
void saveSqlTo(const QString &filename);
|
||||
private slots:
|
||||
|
||||
|
|
@ -102,6 +103,7 @@ private slots:
|
|||
void on_actionExplain_Analyze_triggered();
|
||||
void on_actionCancel_triggered();
|
||||
void on_actionSave_SQL_as_triggered();
|
||||
void on_actionSave_copy_of_SQL_as_triggered();
|
||||
};
|
||||
|
||||
#endif // MAINWINDOW_H
|
||||
|
|
|
|||
|
|
@ -223,6 +223,7 @@
|
|||
<addaction name="actionLoad_SQL"/>
|
||||
<addaction name="actionSave_SQL"/>
|
||||
<addaction name="actionSave_SQL_as"/>
|
||||
<addaction name="actionSave_copy_of_SQL_as"/>
|
||||
<addaction name="actionExport_data"/>
|
||||
<addaction name="separator"/>
|
||||
<addaction name="actionClose"/>
|
||||
|
|
@ -338,6 +339,11 @@
|
|||
<string>Save SQL as</string>
|
||||
</property>
|
||||
</action>
|
||||
<action name="actionSave_copy_of_SQL_as">
|
||||
<property name="text">
|
||||
<string>Save copy of SQL as</string>
|
||||
</property>
|
||||
</action>
|
||||
</widget>
|
||||
<layoutdefault spacing="6" margin="11"/>
|
||||
<resources>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue