|
From: Tapio V. <aa...@us...> - 2011-01-07 12:42:53
|
Module: editor
Branch: master
Commit: a41fb8461a562fb23bb70e86797385eec11401bd
Author: Tapio Vierros <tap...@gm...>
Date: Fri Jan 7 13:47:58 2011 +0200
Proper exit menu action (with disabled save confirmation prompt).
---
editor.ui | 3 ---
editorapp.cc | 16 +++++++++++++++-
2 files changed, 15 insertions(+), 4 deletions(-)
diff --git a/editor.ui b/editor.ui
index ed20f14..e3c0bc9 100644
--- a/editor.ui
+++ b/editor.ui
@@ -10,9 +10,6 @@
<height>600</height>
</rect>
</property>
- <property name="contextMenuPolicy">
- <enum>Qt::DefaultContextMenu</enum>
- </property>
<property name="windowTitle">
<string>Editor</string>
</property>
diff --git a/editorapp.cc b/editorapp.cc
index 521bbc4..0dcbd94 100644
--- a/editorapp.cc
+++ b/editorapp.cc
@@ -38,5 +38,19 @@ void EditorApp::on_actionAbout_triggered()
void EditorApp::on_actionExit_triggered()
{
- exit(0); // Hack
+ // TODO: Check if a save prompt is in order
+ if (false) {
+ QMessageBox::StandardButton b = QMessageBox::question(this, "Unsaved changes",
+ "There are unsaved changes. Do you wish to save before quitting?",
+ QMessageBox::Yes | QMessageBox::No | QMessageBox::Cancel);
+ switch(b) {
+ case QMessageBox::Yes:
+ // TODO: Save
+ case QMessageBox::No:
+ close(); break;
+ default: break;
+ }
+ } else {
+ close();
+ }
}
|