mirror of
https://github.com/sqlitebrowser/sqlitebrowser.git
synced 2026-01-20 02:50:46 -06:00
MainWindow: Make it possible to cancel closing of database file
When closing the database, either by using the menu item or by closing the window, the user is asked whether the changes he made shall be saved or not. Add a third button to this message box which makes it possible to cancel the action.
This commit is contained in:
@@ -373,7 +373,9 @@ void MainWindow::resetBrowser()
|
||||
|
||||
void MainWindow::fileClose()
|
||||
{
|
||||
db.close();
|
||||
if(!db.close())
|
||||
return;
|
||||
|
||||
setWindowTitle(QApplication::applicationName());
|
||||
resetBrowser();
|
||||
populateStructure();
|
||||
@@ -401,13 +403,17 @@ void MainWindow::fileClose()
|
||||
|
||||
void MainWindow::closeEvent( QCloseEvent* event )
|
||||
{
|
||||
db.close();
|
||||
PreferencesDialog::setSettingsValue("MainWindow", "geometry", saveGeometry());
|
||||
PreferencesDialog::setSettingsValue("MainWindow", "windowState", saveState());
|
||||
PreferencesDialog::setSettingsValue("SQLLogDock", "Log", ui->comboLogSubmittedBy->currentText());
|
||||
PreferencesDialog::setSettingsValue("PlotDock", "splitterSize", ui->splitterForPlot->saveState());
|
||||
clearCompleterModelsFields();
|
||||
QMainWindow::closeEvent(event);
|
||||
if(db.close())
|
||||
{
|
||||
PreferencesDialog::setSettingsValue("MainWindow", "geometry", saveGeometry());
|
||||
PreferencesDialog::setSettingsValue("MainWindow", "windowState", saveState());
|
||||
PreferencesDialog::setSettingsValue("SQLLogDock", "Log", ui->comboLogSubmittedBy->currentText());
|
||||
PreferencesDialog::setSettingsValue("PlotDock", "splitterSize", ui->splitterForPlot->saveState());
|
||||
clearCompleterModelsFields();
|
||||
QMainWindow::closeEvent(event);
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
}
|
||||
|
||||
void MainWindow::addRecord()
|
||||
|
||||
Reference in New Issue
Block a user