if ( aName.isNull() ) //Cancel
return;
- closeDoc(false);
onOpenDoc( aName );
if ( !study ) // new study will be create in THIS application
}
}
+bool LightApp_Application::canOpenDoc( const QString& )
+{
+ return true;
+}
+
/*!
SLOT: Opens new document.
\param aName - name of file
*/
bool LightApp_Application::onOpenDoc( const QString& aName )
{
+ if ( !canOpenDoc(aName)) {
+ bool showError = !property("open_study_from_command_line").isValid() ||
+ !property("open_study_from_command_line").toBool();
+
+ putInfo( tr("OPEN_DOCUMENT_PROBLEM") );
+ if ( showError )
+ SUIT_MessageBox::critical( desktop(), tr("ERR_ERROR"), tr("OPEN_DOCUMENT_PROBLEM"));
+
+ return false;
+ }
+
+ closeDoc(false);
+
if ( !checkExistingDoc() )
return false;
virtual void setActiveStudy( SUIT_Study* );
virtual void updateCommandsStatus();
+ virtual bool canOpenDoc( const QString& );
+
virtual void beforeCloseDoc( SUIT_Study* );
virtual void afterCloseDoc();
virtual void moduleAdded( CAM_Module* );
LightApp_Application::afterCloseDoc();
}
+bool SalomeApp_Application::canOpenDoc( const QString& url )
+{
+ _PTR(Study) aStudyDS = getStudy();
+ if ( aStudyDS )
+ return aStudyDS->CanOpen( url.toUtf8().data() );
+ return false;
+}
+
/*
Asks to close existing document.
*/