X-Git-Url: http://git.maemo.org/git/?p=impuzzle;a=blobdiff_plain;f=src%2Fmainwindow.cpp;h=bb6ac1b1975ed8fb9d6a6a119dbfae08c2c07b44;hp=e2b2b192956d9548d0010b8ed20b97edf1a8e72b;hb=624b98e3fdcba3cbaa1595166205a2367613c07d;hpb=79ce16073d2c39d9973ffdddfbae8a94439dbd43 diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index e2b2b19..bb6ac1b 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -26,6 +26,8 @@ #include #include #include +#include +#include #include @@ -122,3 +124,18 @@ void MainWindow::enableSaving() saveAction_->setEnabled(true); } } + +void MainWindow::closeEvent(QCloseEvent *event) +{ + if(saveAction_->isEnabled()) { + int answer = QMessageBox::question(this, tr("Save game status?"), + tr("Saved status will be automatically loaded when you start the application next time"), + QMessageBox::Yes, QMessageBox::No); + + if(answer == QMessageBox::Yes) { + GameView::instance()->saveGame(); + } + } + + event->accept(); +}