delete myDesktop;
myDesktop = desk;
+ connect( myDesktop, SIGNAL( activated() ),
+ this, SLOT( onDesktopActivated() ) );
}
SUIT_Study* SUIT_Application::createNewStudy()
{
return QtxActionMgr::separator();
}
+
+void SUIT_Application::onDesktopActivated()
+{
+ emit activated( this );
+}
signals:
void applicationClosed( SUIT_Application* );
+ void activated( SUIT_Application* );
protected:
SUIT_Application* startApplication( int, char** ) const;
const QString&, const int, QObject* = 0,
const bool = false, QObject* = 0, const char* = 0 );
+private slots:
+ void onDesktopActivated();
+
private:
SUIT_Study* myStudy;
SUIT_Desktop* myDesktop;
SUIT_Session::SUIT_Session()
: QObject(),
myResMgr( 0 ),
-myHandler( 0 )
+myHandler( 0 ),
+myActiveApp( 0 )
{
SUIT_ASSERT( !mySession )
connect( anApp, SIGNAL( applicationClosed( SUIT_Application* ) ),
this, SLOT( onApplicationClosed( SUIT_Application* ) ) );
+ connect( anApp, SIGNAL( activated( SUIT_Application* ) ),
+ this, SLOT( onApplicationActivated( SUIT_Application* ) ) );
myAppList.append( anApp );
*/
SUIT_Application* SUIT_Session::activeApplication() const
{
+ /*
if ( myAppList.count() == 1 )
return myAppList.getFirst();
return 0;
return study->application();
+ */
+ return myActiveApp;
}
/*!
emit applicationClosed( theApp );
myAppList.remove( theApp );
+ if ( theApp == myActiveApp )
+ myActiveApp = 0;
if ( myAppList.isEmpty() )
qApp->quit();
{
return new SUIT_ResourceMgr( appName );
}
+
+/*!
+ Slot, called on activation of some application's desktop
+*/
+void SUIT_Session::onApplicationActivated( SUIT_Application* app )
+{
+ myActiveApp = app;
+}
private slots:
void onApplicationClosed( SUIT_Application* );
+ void onApplicationActivated( SUIT_Application* );
private:
typedef QPtrList<SUIT_Application> AppList;
SUIT_ResourceMgr* myResMgr;
AppList myAppList;
AppLibMap myAppLibs;
+ SUIT_Application* myActiveApp;
SUIT_ExceptionHandler* myHandler;
static SUIT_Session* mySession;