- QAD_StudyFrame* aStudyFrame = createGraph();
- SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>
- (aStudyFrame->getRightFrame()->getViewFrame());
- if(aViewFrame) {
- main = new SUPERVGUI_Main(aViewFrame, desktop, aGraph);
- registerGraph(f, main);
- study->showFrame(aStudyFrame);
- }
+bool SUPERVGUI::createDataflow( const NEW_DF_MODE mode ) {
+ Trace("SUPERVGUI::createDataflow, mode = " << mode );
+
+ // asv : 27.01.05 : fix for PAL7823 : if the study is locked - warn the user and return.
+ SALOMEDS::Study_var aStudy = study->getStudyDocument();
+ if ( aStudy->GetProperties()->IsLocked() ) {
+ QMessageBox::warning(QAD_Application::getDesktop(), tr("WRN_WARNING"), tr("WRN_STUDY_LOCKED"));
+ return false;
+ }
+
+ SUPERV::Graph_var aGraph;
+
+ QString f; // file name. declared here because may be used below in error msg construction..
+ if ( mode == Import || mode == Modify ) { // 0. import or modify existing dataflow - select XML file
+ QString title = QString( "TLT_CREATE_DF_%1" ).arg( mode );
+ f = QAD_FileDlg::getFileName( QAD_Application::getDesktop(), "", "*.xml", tr( title ), true );
+ if ( f.isEmpty() ) // pressed Cancel in file select dialog
+ return false;
+
+ // check if study already contains a graph imported from the same file
+ if ( isContains( study, f ) ) {
+ if ( QMessageBox::warning( QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_GRAPH_DISPLAYED").arg(f),
+ QMessageBox::Yes, QMessageBox::No) == QMessageBox::No )
+ return false;