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 );
/*!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*/
public slots:
virtual void onNewDoc();
+ virtual bool onNewDoc( const QString& );
+
virtual void onCloseDoc( bool ask = true );
virtual void onSaveDoc();
virtual bool onSaveAsDoc();
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;
}
/*!
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& );