#1401 Ask user to save modified project before project close

This commit is contained in:
Magne Sjaastad
2017-04-20 08:07:47 +02:00
parent 82b6e4b8f2
commit d7d80bc53e
8 changed files with 99 additions and 14 deletions

View File

@@ -122,18 +122,24 @@ void RiuRecentFileActionProvider::slotOpenRecentFile()
QAction* action = qobject_cast<QAction *>(sender());
if (action)
{
QString filename = action->data().toString();
bool loadingSucceded = RiaApplication::instance()->openFile(filename);
QString fileName = action->data().toString();
RiaApplication* app = RiaApplication::instance();
if (RiaApplication::hasValidProjectFileExtension(fileName))
{
if (!app->askUserToSaveModifiedProject()) return;
}
bool loadingSucceded = RiaApplication::instance()->openFile(fileName);
if (loadingSucceded)
{
addFileName(filename);
addFileName(fileName);
}
else
{
QMessageBox::warning(NULL, "File open", "Failed to import file located at\n" + filename);
QMessageBox::warning(NULL, "File open", "Failed to import file located at\n" + fileName);
removeFileName(filename);
removeFileName(fileName);
}
}
}