SalomeApp_Study::SalomeApp_Study( SUIT_Application* app )
: CAM_Study( app )
-{}
-
+{
+}
SalomeApp_Study::~SalomeApp_Study()
{
- closeDocument();
}
int SalomeApp_Study::id() const
MESSAGE( "openDocument" );
// initialize myStudyDS, read HDF file
- _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( newStudyName().latin1() ) );
+ QString aName = newStudyName();
+ _PTR(Study) study ( SalomeApp_Application::studyMgr()->NewStudy( aName.latin1() ) );
if ( !study )
return;
setStudyDS( study );
+ setStudyName( aName );
// create myRoot
setRoot( new SalomeApp_RootObject( this ) );
if ( aComponent->ComponentDataType() == "Interface Applicative" )
continue; // skip the magic "Interface Applicative" component
-
+
SalomeApp_DataModel::BuildTree( aComponent, root(), this );
}
// TODO: potentially unsafe call, since base study's openDocument() might try to access the file directly - to be improved
+ //bool res = true;
bool res = CAM_Study::openDocument( theStudyName );
- emit opened( this );
+ //emit opened( this );
- return res;
+ return res;
}
//=======================================================================
for ( ; aModel; aModel = (SalomeApp_DataModel*)list.next() )
aModel->saveAs( theFileName, this );
- bool res = CAM_Study::saveDocumentAs( theFileName );
-
// save SALOMEDS document
bool isMultiFile = false, isAscii = false;// TODO: This information should be taken from preferences afterwards!
- isAscii ? SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
- SalomeApp_Application::studyMgr()->SaveAs ( theFileName.latin1(), studyDS(), isMultiFile );
+ /* bool res = */isAscii ? SalomeApp_Application::studyMgr()->SaveAsASCII( theFileName.latin1(), studyDS(), isMultiFile ) :
+ SalomeApp_Application::studyMgr()->SaveAs ( theFileName.latin1(), studyDS(), isMultiFile );
- emit saved( this );
+ bool res = res && CAM_Study::saveDocumentAs( theFileName );
+
+ if ( res )
+ emit saved( this );
return res;
}
emit closed( this );
// close SALOMEDS document
- SalomeApp_Application::studyMgr()->Close( studyDS() );
- SALOMEDSClient_Study* aStudy = NULL;
- setStudyDS( _PTR(Study)(aStudy) );
+ _PTR(Study) studyPtr = studyDS();
+ if ( studyPtr )
+ {
+ SalomeApp_Application::studyMgr()->Close( studyPtr );
+ SALOMEDSClient_Study* aStudy = 0;
+ setStudyDS( _PTR(Study)(aStudy) );
+ }
CAM_Study::closeDocument();
}
aComp = aBuilder->NewComponent(dm->module()->name());
// Set default engine IOR
- aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR());
+ aBuilder->DefineComponentInstance(aComp, SalomeApp_Application::defaultEngineIOR().latin1());
}
}
}