Ask whether to recover session after unexpected exit

Instead of always loading the last auto-saved session (which might end
up in an endless cycle if recover.mmp is faulty or causes a crash) ask
the user whether to do so.
This commit is contained in:
Tobias Doerffel
2011-04-06 18:29:08 +02:00
parent d98acff3bb
commit babf3edff8

View File

@@ -34,6 +34,7 @@
#include <QtGui/QApplication>
#include <QtGui/QBitmap>
#include <QtGui/QDesktopWidget>
#include <QtGui/QMessageBox>
#include <QtGui/QPainter>
#include <QtGui/QSplashScreen>
@@ -417,7 +418,11 @@ int main( int argc, char * * argv )
// recover a file?
QString recoveryFile = QDir(configManager::inst()->workingDir()).absoluteFilePath("recover.mmp");
if( QFileInfo(recoveryFile).exists() )
if( QFileInfo(recoveryFile).exists() &&
QMessageBox::question( engine::mainWindow(), MainWindow::tr( "Project recovery" ),
MainWindow::tr( "It looks like the last session did not end properly. "
"Do you want to recover the project of this session?" ),
QMessageBox::Yes | QMessageBox::No ) == QMessageBox::Yes )
{
file_to_load = recoveryFile;
}