From e4e8edfe0d54fb4337b9b4f18cdc6ab084779c9e Mon Sep 17 00:00:00 2001 From: mzn Date: Wed, 6 Dec 2006 15:00:32 +0000 Subject: [PATCH] Fix for bug PAL14104(Impossible to restore GUI state). --- src/LightApp/LightApp_Application.cxx | 15 +++++++++++++++ src/LightApp/LightApp_Application.h | 5 ++++- src/LightApp/LightApp_OBSelector.cxx | 10 +++++++++- src/SalomeApp/SalomeApp_Application.cxx | 8 ++++++++ src/SalomeApp/SalomeApp_Application.h | 4 +++- 5 files changed, 39 insertions(+), 3 deletions(-) diff --git a/src/LightApp/LightApp_Application.cxx b/src/LightApp/LightApp_Application.cxx index 828b7aa3b..db0e8c70c 100644 --- a/src/LightApp/LightApp_Application.cxx +++ b/src/LightApp/LightApp_Application.cxx @@ -42,6 +42,7 @@ #include "LightApp_OBSelector.h" #include "LightApp_SelectionMgr.h" +#include "LightApp_DataObject.h" #include #include @@ -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; +} diff --git a/src/LightApp/LightApp_Application.h b/src/LightApp/LightApp_Application.h index cf4a27b80..edfff5177 100644 --- a/src/LightApp/LightApp_Application.h +++ b/src/LightApp/LightApp_Application.h @@ -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(); diff --git a/src/LightApp/LightApp_OBSelector.cxx b/src/LightApp/LightApp_OBSelector.cxx index dd2e65f05..94864d715 100644 --- a/src/LightApp/LightApp_OBSelector.cxx +++ b/src/LightApp/LightApp_OBSelector.cxx @@ -20,9 +20,11 @@ #include "LightApp_DataOwner.h" #include "LightApp_DataObject.h" +#include "LightApp_Application.h" #include +#include #include #include @@ -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( 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( 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 diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index 2efdc44c1..85b8697e5 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -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; +} diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index f4c8df810..507c872ff 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -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* ); -- 2.39.2