Salome HOME
Merge branch 'master' of newgeom:newgeom
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 11 Sep 2014 15:38:05 +0000 (19:38 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 11 Sep 2014 15:38:05 +0000 (19:38 +0400)
src/XGUI/XGUI_OperationMgr.cpp
src/XGUI/XGUI_Workshop.cpp

index aa836f4cf581ee939ea733150ef6030a6a9baa51..9b2902ecba69e614908d88253f97bdf88d7dbb4a 100644 (file)
@@ -141,9 +141,10 @@ bool XGUI_OperationMgr::canStopOperation()
     if (anOperation->isModified()) {
       int anAnswer = QMessageBox::question(
           qApp->activeWindow(), tr("Operation launch"),
-          tr("Previous operation is not finished and will be aborted"), QMessageBox::Ok,
+          tr("Previous operation is not finished, abort it?"),
+          QMessageBox::Abort | QMessageBox::Cancel,
           QMessageBox::Cancel);
-      return anAnswer == QMessageBox::Ok;
+      return anAnswer == QMessageBox::Abort;
     }
   }
   return true;
index 3abb08203abe924fd92b30479686dc1466bd79ed..8e8babd3b923b047629ac19c94f095f31e959137 100644 (file)
@@ -577,9 +577,11 @@ void XGUI_Workshop::onNew()
 //******************************************************
 void XGUI_Workshop::onOpen()
 {
+  if(!myOperationMgr->abortOperation())
+    return;
   //save current file before close if modified
-  SessionPtr aMgr = ModelAPI_Session::get();
-  if (aMgr->isModified()) {
+  SessionPtr aSession = ModelAPI_Session::get();
+  if (aSession->isModified()) {
     //TODO(sbh): re-launch the app?
     int anAnswer = QMessageBox::question(
         myMainWindow, tr("Save current file"),
@@ -590,7 +592,7 @@ void XGUI_Workshop::onOpen()
     } else if (anAnswer == QMessageBox::Cancel) {
       return;
     }
-    aMgr->moduleDocument()->close();
+    aSession->moduleDocument()->close();
     myCurrentDir = "";
   }
 
@@ -605,7 +607,7 @@ void XGUI_Workshop::onOpen()
     return;
   }
   QApplication::setOverrideCursor(Qt::WaitCursor);
-  aMgr->load(myCurrentDir.toLatin1().constData());
+  aSession->load(myCurrentDir.toLatin1().constData());
   myObjectBrowser->rebuildDataTree();
   displayAllResults();
   updateCommandStatus();
@@ -616,6 +618,8 @@ void XGUI_Workshop::onOpen()
 //******************************************************
 bool XGUI_Workshop::onSave()
 {
+  if(!myOperationMgr->abortOperation())
+    return false;
   if (myCurrentDir.isEmpty()) {
     return onSaveAs();
   }
@@ -629,6 +633,8 @@ bool XGUI_Workshop::onSave()
 //******************************************************
 bool XGUI_Workshop::onSaveAs()
 {
+  if(!myOperationMgr->abortOperation())
+    return false;
   QFileDialog dialog(mainWindow());
   dialog.setWindowTitle(tr("Select directory to save files..."));
   dialog.setFileMode(QFileDialog::Directory);