]> SALOME platform Git repositories - modules/gui.git/commitdiff
Salome HOME
NPAL16628: Pb with KDE desktop and Salome. Force desktop activation. T_13901
authorjfa <jfa@opencascade.com>
Tue, 21 Aug 2007 11:35:20 +0000 (11:35 +0000)
committerjfa <jfa@opencascade.com>
Tue, 21 Aug 2007 11:35:20 +0000 (11:35 +0000)
src/SUIT/SUIT_Application.cxx
src/SUIT/SUIT_Application.h
src/SUIT/SUIT_Session.cxx
src/SalomeApp/SalomeApp_Application.cxx
src/SalomeApp/SalomeApp_Application.h

index 0be1fbf72466f6f8efac9e75a6268a8b8aa22dbf..6fe96d3dcda657038beb4e9b8ae258f20e26cdea 100755 (executable)
@@ -25,6 +25,7 @@
 #include <qlabel.h>
 #include <qtimer.h>
 #include <qstatusbar.h>
+#include <qapplication.h>
 
 #include <QtxAction.h>
 #include <QtxActionMenuMgr.h>
@@ -37,8 +38,7 @@ SUIT_Application::SUIT_Application()
   : QObject( 0 ),
     myStudy( 0 ),
     myDesktop( 0 ),
-    myStatusLabel( 0 ),
-    myIsInitiallyRegistered( false )
+    myStatusLabel( 0 )
 {
 }
 
@@ -222,8 +222,10 @@ void SUIT_Application::setDesktop( SUIT_Desktop* desk )
 
   delete myDesktop;
   myDesktop = desk;
-  if ( myDesktop )
+  if ( myDesktop ) {
     connect( myDesktop, SIGNAL( activated() ), this, SLOT( onDesktopActivated() ) );
+    QApplication::postEvent(myDesktop, new QEvent(QEvent::WindowActivate));
+  }
 }
 
 /*!
index 8a8ac396814e0ee912c63e9ea02f6823904c78e0..72dc89363a4efe379f4923c74c642723fcbe7a11 100755 (executable)
@@ -104,9 +104,6 @@ public:
   //! Invokes application-specific "Select Directory" dialog and returns the selected directory name.
   virtual QString getDirectory( const QString& initial, const QString& caption, QWidget* parent ) = 0;
 
-  //! Perform required actions on the application, just registed in the session
-  virtual void Registered() { myIsInitiallyRegistered = true; };
-
 signals:
   void                  applicationClosed( SUIT_Application* );
   void                  activated( SUIT_Application* );
@@ -157,9 +154,6 @@ protected:
 protected slots:
   virtual void          onDesktopActivated();
 
-protected:
-  bool        myIsInitiallyRegistered; //<! false before the first application registration in the session
-
 private:
   SUIT_Study*           myStudy;
   SUIT_Desktop*         myDesktop;
index 1d6ce09f76ced1d93b1b8e1d254c9534240031f0..0e641f236e41676d82ed75884eeaa4537c973079 100755 (executable)
@@ -325,8 +325,6 @@ SUIT_ResourceMgr* SUIT_Session::createResourceMgr( const QString& appName ) cons
 void SUIT_Session::onApplicationActivated( SUIT_Application* app ) 
 {
   myActiveApp = app;
-  if (app)
-    app->Registered();
 }
 
 /*!
index ff63837648b36ad5cf79d1c5f7ebbc0c727aecd3..3bb85faa3dc02eb88787ce22e79b9ff03ab77af1 100644 (file)
@@ -159,72 +159,6 @@ void SalomeApp_Application::start()
   if ( isFirst ) {
     isFirst = false;
 
-    /*
-    QString hdffile;
-    QStringList pyfiles;
-
-    for (int i = 1; i < qApp->argc(); i++) {
-      QRegExp rxs ("--study-hdf=(.+)");
-      if ( rxs.search( QString(qApp->argv()[i]) ) >= 0 && rxs.capturedTexts().count() > 1 ) {
-       QString file = rxs.capturedTexts()[1];
-        QFileInfo fi ( file );
-        QString extension = fi.extension( false ).lower();
-        if ( extension == "hdf" && fi.exists() )
-          hdffile = fi.absFilePath();
-      }
-      else {
-        QRegExp rxp ("--pyscript=(.+)");
-        if ( rxp.search( QString(qApp->argv()[i]) ) >= 0 && rxp.capturedTexts().count() > 1 ) {
-          QStringList files = QStringList::split(",",rxp.capturedTexts()[1],false);
-          pyfiles += files;
-        }
-      }
-    }
-
-    if ( !hdffile.isEmpty() )       // open hdf file given as parameter
-      onOpenDoc( hdffile );
-    else if ( pyfiles.count() > 0 ) // create new study
-      onNewDoc();
-
-    // import/execute python scripts
-    if ( pyfiles.count() > 0 && activeStudy() ) {
-      SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( activeStudy() );
-      if ( appStudy ) {
-       _PTR(Study) aStudy = appStudy->studyDS();
-       if ( !aStudy->GetProperties()->IsLocked() ) {
-          for (uint j = 0; j < pyfiles.count(); j++ ) {
-            QFileInfo fi ( pyfiles[j] );
-           PythonConsole* pyConsole = pythonConsole();
-           if ( pyConsole ) {
-              QString extension = fi.extension( false ).lower();
-              if ( extension == "py" && fi.exists() ) {
-                // execute python script
-                QString command = QString( "execfile(\"%1\")" ).arg( fi.absFilePath() );
-                pyConsole->exec( command );
-              }
-              else {
-                // import python module
-                QString command = QString( "import %1" ).arg( pyfiles[j] );
-                //QString command = QString( "import %1" ).arg( fi.baseName( true ) );
-                pyConsole->exec( command );
-              }
-            }
-          }
-       }
-      }
-    }
-    */
-  }
-}
-
-/*!Just registered in the session*/
-void SalomeApp_Application::Registered()
-{
-  if (!myIsInitiallyRegistered)
-  {
-    myIsInitiallyRegistered = true;
-
-    // execute python scripts
     QString hdffile;
     QStringList pyfiles;
 
index 893d53c1dd884bbeba8782bc1619a508a76de918..09ece677d64a0f4906e35435e86f622d0e87ed3c 100644 (file)
@@ -94,8 +94,6 @@ public:
   SUIT_ViewManager*                   newViewManager(const QString&);
   void                                updateSavePointDataObjects( SalomeApp_Study* );
 
-  virtual void Registered();
-
 public slots:
   virtual bool                        onOpenDoc( const QString& );
   virtual void                        onLoadDoc();