From: jfa Date: Tue, 21 Aug 2007 11:35:20 +0000 (+0000) Subject: NPAL16628: Pb with KDE desktop and Salome. Force desktop activation. X-Git-Tag: T_13901 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=533450f17cc56451c44d49ef2befe9bacc045091;p=modules%2Fgui.git NPAL16628: Pb with KDE desktop and Salome. Force desktop activation. --- diff --git a/src/SUIT/SUIT_Application.cxx b/src/SUIT/SUIT_Application.cxx index 0be1fbf72..6fe96d3dc 100755 --- a/src/SUIT/SUIT_Application.cxx +++ b/src/SUIT/SUIT_Application.cxx @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -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)); + } } /*! diff --git a/src/SUIT/SUIT_Application.h b/src/SUIT/SUIT_Application.h index 8a8ac3968..72dc89363 100755 --- a/src/SUIT/SUIT_Application.h +++ b/src/SUIT/SUIT_Application.h @@ -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; //Registered(); } /*! diff --git a/src/SalomeApp/SalomeApp_Application.cxx b/src/SalomeApp/SalomeApp_Application.cxx index ff6383764..3bb85faa3 100644 --- a/src/SalomeApp/SalomeApp_Application.cxx +++ b/src/SalomeApp/SalomeApp_Application.cxx @@ -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( 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; diff --git a/src/SalomeApp/SalomeApp_Application.h b/src/SalomeApp/SalomeApp_Application.h index 893d53c1d..09ece677d 100644 --- a/src/SalomeApp/SalomeApp_Application.h +++ b/src/SalomeApp/SalomeApp_Application.h @@ -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();