From: stv Date: Wed, 21 Feb 2007 11:49:31 +0000 (+0000) Subject: *** empty log message *** X-Git-Tag: For_HDF~27 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=4ee2c5e0607328669324be81ea27da4526337321;p=modules%2Fgui.git *** empty log message *** --- diff --git a/src/Qtx/QtxWorkstack.cxx b/src/Qtx/QtxWorkstack.cxx index 263f2e699..2bdc0325b 100644 --- a/src/Qtx/QtxWorkstack.cxx +++ b/src/Qtx/QtxWorkstack.cxx @@ -1984,7 +1984,9 @@ void QtxWorkstackArea::updateCurrent() setBlocked( *it, true ); } - myStack->setCurrentWidget( child( widget( myBar->tabId( myBar->currentIndex() ) ) ) ); + QWidget* cur = child( widget( myBar->tabId( myBar->currentIndex() ) ) ); + if ( cur ) + myStack->setCurrentWidget( cur ); for ( QWidgetList::iterator itr = myList.begin(); itr != myList.end(); ++itr ) setBlocked( *itr, map.contains( *itr ) ? map[*itr] : false ); diff --git a/src/STD/STD_Application.cxx b/src/STD/STD_Application.cxx index 0739226ef..2ec191bc2 100755 --- a/src/STD/STD_Application.cxx +++ b/src/STD/STD_Application.cxx @@ -244,28 +244,45 @@ void STD_Application::createActions() /*!Opens new application*/ void STD_Application::onNewDoc() +{ + onNewDoc( QString() ); +} + +/*!Opens new application*/ +bool STD_Application::onNewDoc( const QString& name ) { QApplication::setOverrideCursor( Qt::WaitCursor ); + bool res = true; if ( !activeStudy() ) { createEmptyStudy(); - activeStudy()->createDocument(); - studyCreated( activeStudy() ); + res = activeStudy()->createDocument( name ); + if ( res ) + studyCreated( activeStudy() ); + else + { + delete activeStudy(); + setActiveStudy( 0 ); + } } else { SUIT_Application* aApp = startApplication( 0, 0 ); if ( aApp->inherits( "STD_Application" ) ) - ((STD_Application*)aApp)->onNewDoc(); + res = ((STD_Application*)aApp)->onNewDoc( name ); else { aApp->createEmptyStudy(); - aApp->activeStudy()->createDocument(); + res = aApp->activeStudy()->createDocument( name ); } + if ( !res ) + aApp->closeApplication(); } QApplication::restoreOverrideCursor(); + + return res; } /*!Put file name from file dialog to onOpenDoc(const QString&) function*/ diff --git a/src/STD/STD_Application.h b/src/STD/STD_Application.h index 3de1db384..d9fcce5d7 100755 --- a/src/STD/STD_Application.h +++ b/src/STD/STD_Application.h @@ -99,6 +99,8 @@ signals: public slots: virtual void onNewDoc(); + virtual bool onNewDoc( const QString& ); + virtual void onCloseDoc( bool ask = true ); virtual void onSaveDoc(); virtual bool onSaveAsDoc(); diff --git a/src/SUIT/SUIT_Study.cxx b/src/SUIT/SUIT_Study.cxx index ea2d59830..2115e1005 100755 --- a/src/SUIT/SUIT_Study.cxx +++ b/src/SUIT/SUIT_Study.cxx @@ -118,8 +118,9 @@ void SUIT_Study::closeDocument(bool permanently) Custom document initialization to be performed \n within onNewDoc() handler can be put here */ -void SUIT_Study::createDocument() +bool SUIT_Study::createDocument( const QString& ) { + return true; } /*! diff --git a/src/SUIT/SUIT_Study.h b/src/SUIT/SUIT_Study.h index 604ba97bb..aab1f4c22 100755 --- a/src/SUIT/SUIT_Study.h +++ b/src/SUIT/SUIT_Study.h @@ -51,9 +51,9 @@ public: virtual bool isSaved() const; virtual bool isModified() const; - virtual void createDocument(); virtual void closeDocument( bool = true ); virtual bool openDocument( const QString& ); + virtual bool createDocument( const QString& ); bool saveDocument(); virtual bool saveDocumentAs( const QString& );