]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
Fix for bug PAL14104(Impossible to restore GUI state). V3_2_4pre1
authormzn <mzn@opencascade.com>
Wed, 6 Dec 2006 15:00:32 +0000 (15:00 +0000)
committermzn <mzn@opencascade.com>
Wed, 6 Dec 2006 15:00:32 +0000 (15:00 +0000)
src/LightApp/LightApp_Application.cxx
src/LightApp/LightApp_Application.h
src/LightApp/LightApp_OBSelector.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h

index 828b7aa3b15eb6702e5436abbf6b44e73b941f49..db0e8c70cce4ef1e0f9566a97698a023aff73d35 100644 (file)
@@ -42,6 +42,7 @@
 
 #include "LightApp_OBSelector.h"
 #include "LightApp_SelectionMgr.h"
+#include "LightApp_DataObject.h"
 
 #include <CAM_Module.h>
 #include <CAM_DataModel.h>
@@ -2470,3 +2471,17 @@ bool LightApp_Application::event( QEvent* e )
   }
   return CAM_Application::event( e );
 }
+
+/*! Check data object */
+bool LightApp_Application::checkDataObject(LightApp_DataObject* theObj)
+{
+  if (theObj)
+    {
+      bool isSuitable =        !theObj->entry().isEmpty() && 
+                       !theObj->componentDataType().isEmpty() && 
+                       !theObj->name().isEmpty();
+      return isSuitable;
+    }
+
+  return false;
+}
index cf4a27b80368998c03e377c639b983ace89d5cbb..edfff517785774d16ea730dc411868432c33ed18 100644 (file)
@@ -40,6 +40,7 @@ class STD_Application;
 class LightApp_WidgetContainer;
 class LightApp_Preferences;
 class LightApp_SelectionMgr;
+class LightApp_DataObject;
 class SUIT_Study;
 class SUIT_Accel;
 class CAM_Module;
@@ -150,6 +151,8 @@ public:
   static int                          studyId();
 
   virtual bool                        event( QEvent* );
+  
+  virtual bool                        checkDataObject( LightApp_DataObject* theObj );
 
 signals:
   void                                studyOpened();
@@ -191,7 +194,7 @@ protected:
   virtual void                        preferencesChanged( const QString&, const QString& );
   virtual void                        savePreferences();
   virtual void                        updateDesktopTitle();
-
+  
 protected slots:
   virtual void                        onDesktopActivated();
 
index dd2e65f05d8705e064f13a301c8f92346c69f114..94864d715d2fced163a6348f6c6ae424f7eb4952 100644 (file)
 
 #include "LightApp_DataOwner.h"
 #include "LightApp_DataObject.h"
+#include "LightApp_Application.h"
 
 #include <OB_Browser.h>
 
+#include <SUIT_Session.h>
 #include <SUIT_DataObjectIterator.h>
 #include <qdatetime.h>
 
@@ -61,6 +63,12 @@ OB_Browser* LightApp_OBSelector::browser() const
 void LightApp_OBSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const
 {
   if (mySelectedList.count() == 0 ) {
+    SUIT_Session* session = SUIT_Session::session();
+    SUIT_Application* sapp = session ? session->activeApplication() : 0;
+    LightApp_Application* app = dynamic_cast<LightApp_Application*>( sapp );
+    if( !app )
+      return;
+
     if ( !myBrowser )
       return;
     DataObjectList objlist;
@@ -69,7 +77,7 @@ void LightApp_OBSelector::getSelection( SUIT_DataOwnerPtrList& theList ) const
     for ( DataObjectListIterator it( objlist ); it.current(); ++it )
     {
       LightApp_DataObject* obj = dynamic_cast<LightApp_DataObject*>( it.current() );
-      if ( obj && !obj->entry().isEmpty() && !obj->componentDataType().isEmpty() && !obj->name().isEmpty() )
+      if ( obj && app->checkDataObject(obj) )
       {
 #ifndef DISABLE_SALOMEOBJECT
         Handle(SALOME_InteractiveObject) aSObj = new SALOME_InteractiveObject
index 2efdc44c1c6efd947bed8c4bec1239a916b63817..85b8697e5a5ca358c16d9fdedab2293096b24a36 100644 (file)
@@ -1221,3 +1221,11 @@ void SalomeApp_Application::updateSavePointDataObjects( SalomeApp_Study* study )
     delete it.data();
 }
 
+/*! Check data object */
+bool SalomeApp_Application::checkDataObject(LightApp_DataObject* theObj)
+{
+  if (theObj)
+    return true;
+
+  return false;
+}
index f4c8df810da5d2cffae7b46b375abf798329b438..507c872fffa4b0fc78fc0771a717aaff64409ab0 100644 (file)
@@ -83,6 +83,8 @@ public:
 
   virtual void                        contextMenuPopup( const QString&, QPopupMenu*, QString& );
 
+  virtual bool                        checkDataObject(LightApp_DataObject* theObj);
+
   static CORBA::ORB_var               orb();
   static SALOMEDSClient_StudyManager* studyMgr();
   static SALOME_NamingService*        namingService();
@@ -115,7 +117,7 @@ protected:
 
   virtual void                        createPreferences( LightApp_Preferences* );
   virtual void                        updateDesktopTitle();
-
+  
 private slots:
   void                                onDeleteInvalidReferences();
   void                                onDblClick( QListViewItem* );