Skip to content

Commit

Permalink
Handle exception throws on script save cancel
Browse files Browse the repository at this point in the history
Catches SaveCanceledException thrown when user cancels saving from the
save as dialogue
Refs #8513
  • Loading branch information
DanNixon committed Jul 14, 2014
1 parent b3c0cca commit a7b27f7
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions Code/Mantid/MantidPlot/src/ScriptFileInterpreter.cpp
Expand Up @@ -50,15 +50,24 @@ void ScriptFileInterpreter::prepareToClose()
QPushButton *saveAsButton = msgBox.addButton("Save As...", QMessageBox::AcceptRole);
msgBox.addButton(QMessageBox::Discard);
int ret = msgBox.exec();
if( msgBox.clickedButton() == saveAsButton )
{
m_editor->saveAs();
}
else if( ret == QMessageBox::Save )

try
{
m_editor->saveToCurrentFile();
if( msgBox.clickedButton() == saveAsButton )
{
m_editor->saveAs();saveAs
}
else if( ret == QMessageBox::Save )
{
m_editor->saveToCurrentFile();
}
else
{
m_editor->setModified(false);
}
}
else
//Catch cancelling save dialogue
catch( ScriptEditor::SaveCancelledException sce )
{
m_editor->setModified(false);
}
Expand Down

0 comments on commit a7b27f7

Please sign in to comment.