mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Don't close the active file or start "add dive" while editing a dive
Seems rather obvious to me - the language in the warning doesn't sound very smooth, though. Fixes #246 Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e5308c068f
commit
0c833ef03b
1 changed files with 14 additions and 4 deletions
|
@ -99,6 +99,10 @@ void MainWindow::on_actionNew_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionOpen_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." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
QString filename = QFileDialog::getOpenFileName(this, tr("Open File"), lastUsedDir(), filter());
|
QString filename = QFileDialog::getOpenFileName(this, tr("Open File"), lastUsedDir(), filter());
|
||||||
if (filename.isEmpty())
|
if (filename.isEmpty())
|
||||||
return;
|
return;
|
||||||
|
@ -131,6 +135,10 @@ void MainWindow::cleanUpEmpty()
|
||||||
|
|
||||||
void MainWindow::on_actionClose_triggered()
|
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." );
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (unsaved_changes() && (askSaveChanges() == FALSE))
|
if (unsaved_changes() && (askSaveChanges() == FALSE))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -204,8 +212,9 @@ void MainWindow::enableDcShortcuts()
|
||||||
|
|
||||||
void MainWindow::on_actionDivePlanner_triggered()
|
void MainWindow::on_actionDivePlanner_triggered()
|
||||||
{
|
{
|
||||||
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING){
|
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||||
QMessageBox::warning(this, tr("Warning"), "First finish the current edition before trying to do another." );
|
ui.InfoWidget->isEditing()) {
|
||||||
|
QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before trying to plan a dive." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
disableDcShortcuts();
|
disableDcShortcuts();
|
||||||
|
@ -261,8 +270,9 @@ void MainWindow::on_actionEditDeviceNames_triggered()
|
||||||
|
|
||||||
void MainWindow::on_actionAddDive_triggered()
|
void MainWindow::on_actionAddDive_triggered()
|
||||||
{
|
{
|
||||||
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING){
|
if(DivePlannerPointsModel::instance()->currentMode() != DivePlannerPointsModel::NOTHING ||
|
||||||
QMessageBox::warning(this, tr("Warning"), "First finish the current edition before trying to do another." );
|
ui.InfoWidget->isEditing()) {
|
||||||
|
QMessageBox::warning(this, tr("Warning"), "Please save or undo the current dive edit before trying to add a dive." );
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dive_list()->rememberSelection();
|
dive_list()->rememberSelection();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue