Skip to content

Commit

Permalink
Refs #4282: just indentation/code reuse fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Janik Zikovsky committed Jan 9, 2012
1 parent 67abb2b commit 4d8f90a
Showing 1 changed file with 36 additions and 37 deletions.
73 changes: 36 additions & 37 deletions Code/Mantid/MantidPlot/src/MdiSubWindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -151,44 +151,43 @@ bool MdiSubWindow::close()
*/
void MdiSubWindow::closeEvent( QCloseEvent *e )
{
if (d_confirm_close){
switch( QMessageBox::information(this, tr("MantidPlot"),
tr("Do you want to hide or delete") + "<p><b>'" + objectName() + "'</b> ?",
tr("Delete"), tr("Hide"), tr("Cancel"), 0, 2)){
case 0:
if (widget()->close())
{
e->accept();
emit closedWindow(this);
}
else
{
QMessageBox::critical(parentWidget(),"MantidPlot - Error", "Window cannot be closed");
e->ignore();
}
break;

case 1:
e->ignore();
emit hiddenWindow(this);
break;

case 2:
e->ignore();
break;
}
} else {
if (widget()->close())
{
e->accept();
emit closedWindow(this);
}
else
{
QMessageBox::critical(parentWidget(),"MantidPlot - Error", "Window cannot be closed");
e->ignore();
}
// Default result = do close.
int result = 0;

// If you need to confirm the close, ask the user
if (d_confirm_close)
{
result = QMessageBox::information(this, tr("MantidPlot"),
tr("Do you want to hide or delete") + "<p><b>'" + objectName() + "'</b> ?",
tr("Delete"), tr("Hide"), tr("Cancel"), 0, 2);
}

switch(result)
{
case 0:
if (widget()->close())
{
e->accept();
emit closedWindow(this);
// Continue; the mdi window should close (?)
}
else
{
QMessageBox::critical(parentWidget(),"MantidPlot - Error", "Window cannot be closed");
e->ignore();
}
break;

case 1:
e->ignore();
emit hiddenWindow(this);
break;

case 2:
e->ignore();
break;
}

}

QString MdiSubWindow::aspect()
Expand Down

0 comments on commit 4d8f90a

Please sign in to comment.