Skip to content

Commit

Permalink
try one last time to properly handle open
Browse files Browse the repository at this point in the history
  • Loading branch information
kevinhendricks committed Feb 9, 2020
1 parent 0a20476 commit 5489ab7
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
8 changes: 6 additions & 2 deletions MainWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1492,7 +1492,7 @@ void MainWindow::Open()
modified = true;
}
}
if (modified) if (MaybeSaveDialogSaysProceed())
if (MaybeSaveDialogSaysProceed(modified))
#endif
{
const QMap<QString, QString> load_filters = MainWindow::GetLoadFiltersMap();
Expand Down Expand Up @@ -1813,11 +1813,15 @@ void MainWindow::sizeMenuIcons() {
}
}

bool MainWindow::MaybeSaveDialogSaysProceed()
bool MainWindow::MaybeSaveDialogSaysProceed(bool modified)
{
// allow processing of any outstanding events
qApp->processEvents();

// since if nothing is modified you can not discard anything (as it is already saved)
// and since you do not need to save anything (nothing can be lost)
if (!modified) return true;

QMessageBox::StandardButton button_pressed;
button_pressed = QMessageBox::warning(this,
tr("PageEdit"),
Expand Down
2 changes: 1 addition & 1 deletion MainWindow.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ public slots:
void resizeEvent(QResizeEvent * event);
void moveEvent(QMoveEvent *event);
void closeEvent(QCloseEvent * event);
bool MaybeSaveDialogSaysProceed();
bool MaybeSaveDialogSaysProceed(bool modified);
QString GetCleanHtml();
QString GetSource();
QString GetHTMLToPaste(const QString & hmtl_snippet);
Expand Down

0 comments on commit 5489ab7

Please sign in to comment.