From: adv Date: Wed, 30 Nov 2011 13:02:29 +0000 (+0000) Subject: Load on start application HDF file given in command arguments. X-Git-Tag: CTH_V17a~8 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=7ea41bc0b63a9ef9b590b53b5115c62387455afa;p=modules%2Fgui.git Load on start application HDF file given in command arguments. --- diff --git a/src/SUIT/SUIT_Session.cxx b/src/SUIT/SUIT_Session.cxx index 2da346c8c..cf1b0e931 100755 --- a/src/SUIT/SUIT_Session.cxx +++ b/src/SUIT/SUIT_Session.cxx @@ -163,9 +163,41 @@ SUIT_Application* SUIT_Session::startApplication( const QString& name, int /*arg if ( !myBTimer ) { - myBTimer = (QTimer*)1; // block reation on creation of new application - restoreBackup(); - myBTimer = 0; + QString anHDFName; + QStringList anArgs = QCoreApplication::arguments(); + QStringList::const_iterator anArgsIt = anArgs.constBegin(); + for ( ; anArgsIt != anArgs.constEnd(); anArgsIt++ ) + { + QString anArg = *anArgsIt; + QFileInfo aFileInfo( anArg ); + if ( aFileInfo.exists() && aFileInfo.suffix().toLower() == "hdf" ) + { + anHDFName = anArg; + break; + } + } + + if ( !anHDFName.isEmpty() && app && app->useFile( anHDFName ) ) + { + //Remove backup folders if it exists + QDir tmpDir( QDir::tempPath() ); + + QString pref = getBPrefix(); + QFileInfoList aFolders = tmpDir.entryInfoList( QStringList() << QString( pref + "*" ), + QDir::Dirs ); + + QFileInfoList::const_iterator aFoldersIt = aFolders.constBegin(); + for ( ; aFoldersIt != aFolders.constEnd(); ++aFoldersIt ) + Qtx::rmDir( (*aFoldersIt).absoluteFilePath() ); + } + else + { + //Try to restore backup + myBTimer = (QTimer*)1; // block reaction on creation of new application + restoreBackup(); + myBTimer = 0; + } + createBTimer(); }