mirror of
https://github.com/subsurface/subsurface.git
synced 2024-11-30 22:20:21 +00:00
Make edit / dive add in progress check more consistent
We need to check for this whenever we do something that directly or
indirectly closes the data file. Previously we were missing the straight
"quit". Also, we should consistently check for both editing or dive
addition. And lastly, we should use consistent language with commit
0e9cd09442
("Make editing message consistent with button labels").
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
5945c18c8a
commit
e289881db9
1 changed files with 13 additions and 6 deletions
|
@ -98,8 +98,9 @@ void MainWindow::on_actionNew_triggered()
|
|||
|
||||
void MainWindow::on_actionOpen_triggered()
|
||||
{
|
||||
if (ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before opening a new file." );
|
||||
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||
ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or cancel the current dive edit before opening a new file." );
|
||||
return;
|
||||
}
|
||||
QString filename = QFileDialog::getOpenFileName(this, tr("Open File"), lastUsedDir(), filter());
|
||||
|
@ -134,8 +135,9 @@ void MainWindow::cleanUpEmpty()
|
|||
|
||||
void MainWindow::on_actionClose_triggered()
|
||||
{
|
||||
if (ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before closing the file." );
|
||||
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||
ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or cancel the current dive edit before closing the file." );
|
||||
return;
|
||||
}
|
||||
if (unsaved_changes() && (askSaveChanges() == FALSE))
|
||||
|
@ -214,7 +216,7 @@ void MainWindow::on_actionDivePlanner_triggered()
|
|||
{
|
||||
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||
ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before trying to plan a dive." );
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or cancel the current dive edit before trying to plan a dive." );
|
||||
return;
|
||||
}
|
||||
disableDcShortcuts();
|
||||
|
@ -239,6 +241,11 @@ void MainWindow::on_actionPreferences_triggered()
|
|||
|
||||
void MainWindow::on_actionQuit_triggered()
|
||||
{
|
||||
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||
ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or cancel the current dive edit before closing the file." );
|
||||
return;
|
||||
}
|
||||
if (unsaved_changes() && (askSaveChanges() == FALSE))
|
||||
return;
|
||||
writeSettings();
|
||||
|
@ -272,7 +279,7 @@ void MainWindow::on_actionAddDive_triggered()
|
|||
{
|
||||
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||
ui.InfoWidget->isEditing()) {
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before trying to add a dive." );
|
||||
QMessageBox::warning(this, tr("Warning"), "Please save or cancel the current dive edit before trying to add a dive." );
|
||||
return;
|
||||
}
|
||||
dive_list()->rememberSelection();
|
||||
|
|
Loading…
Reference in a new issue