: QObject(),
myResMgr( 0 ),
myHandler( 0 ),
-myActiveApp( 0 )
+myActiveApp( 0 ),
+myExitStatus( FROM_GUI )
{
SUIT_ASSERT( !mySession )
return 0;
}
- myAppLibs.insert( appName, libHandle );
+ if (!myAppLibs.contains(appName) || !myAppLibs[appName]) // jfa 22.06.2005
+ myAppLibs.insert( appName, libHandle );
APP_CREATE_FUNC crtInst = 0;
myResMgr->loadLanguage();
}
- SUIT_Application* anApp = crtInst( args, argv );
+ //jfa 22.06.2005:SUIT_Application* anApp = crtInst( args, argv );
+ SUIT_Application* anApp = crtInst();
if ( !anApp )
{
SUIT_MessageBox::warn1(0, tr( "Error" ), tr( "Can not find function %1. %2").arg( APP_CREATE_NAME ).arg( lastError() ), tr( "Ok" ) );
myActiveApp = 0;
if ( myAppList.isEmpty() )
- qApp->quit();
+ {
+ printf( "Calling QApplication::exit() with exit code = %d\n", myExitStatus );
+ qApp->exit( myExitStatus );
+ }
}
/*!
Destroys session by closing all applications.
*/
-void SUIT_Session::closeSession()
+void SUIT_Session::closeSession( int mode )
{
while ( !myAppList.isEmpty() )
{
SUIT_Application* app = myAppList.getFirst();
- if ( !app->isPossibleToClose() )
+ if ( mode == ASK && !app->isPossibleToClose() )
return;
+ else if ( mode == SAVE )
+ {
+ SUIT_Study* study = app->activeStudy();
+ if ( study->isModified() && study->isSaved() )
+ study->saveDocument();
+ }
+ else if ( mode == DONT_SAVE )
+ {
+ myExitStatus = FROM_CORBA_SESSION;
+ //....
+ }
app->closeApplication();
}