Salome HOME
PR: quadtree
[modules/hydro.git] / src / HYDROGUI / HYDROGUI_GeoreferencementOp.cxx
index 50eb1cad4695421d2b0b130e729faf04f4938535..d7b389e6bd0f3fee6e3287ec754888ee5302f01d 100644 (file)
@@ -152,12 +152,23 @@ void HYDROGUI_GeoreferencementOp::onModeActivated( const int theActualMode )
                                            SUIT_MessageBox::Yes) == SUIT_MessageBox::Yes;
   }
   // Store modifications if needed
-  if ( isToStore && !store( anErrorMsg ) ) {
-    anErrorMsg.append( "\n" + tr( "INPUT_VALID_DATA" ) );
-    SUIT_MessageBox::critical( module()->getApp()->desktop(),
-                               tr( "INSUFFICIENT_INPUT_DATA" ),
-                               anErrorMsg );
-    return;
+  if ( isToStore )
+  {
+    startDocOperation();
+    if ( !store( anErrorMsg ) )
+    {
+      abortDocOperation();
+
+      anErrorMsg.append( "\n" + tr( "INPUT_VALID_DATA" ) );
+      SUIT_MessageBox::critical( module()->getApp()->desktop(),
+                                 tr( "INSUFFICIENT_INPUT_DATA" ),
+                                 anErrorMsg );
+      return;
+    }
+    else
+    {
+      commitDocOperation();
+    }
   }
 
   aPanel->setMode( theActualMode );
@@ -250,7 +261,6 @@ bool HYDROGUI_GeoreferencementOp::store( QString& theErrorMsg )
   }
 
   aModule->update( UF_Model | UF_OCCViewer | UF_OCC_Forced );
-  commitDocOperation(); // TODO: analyze the consequences
 
   return true;
 }