1 // Copyright (C) 2005 OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License.
8 // This library is distributed in the hope that it will be useful
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/
19 #include "STD_Application.h"
21 #include "STD_MDIDesktop.h"
23 #include "STD_CloseDlg.h"
25 #include <SUIT_Tools.h>
26 #include <SUIT_Desktop.h>
27 #include <SUIT_Session.h>
28 #include <SUIT_ViewModel.h>
29 #include <SUIT_Operation.h>
30 #include <SUIT_MessageBox.h>
31 #include <SUIT_ResourceMgr.h>
33 #include <QtxDockAction.h>
34 #include <QtxActionMenuMgr.h>
35 #include <QtxActionToolMgr.h>
36 #include <QtxPopupMenu.h>
40 #include <qpopupmenu.h>
41 #include <qstatusbar.h>
42 #include <qfiledialog.h>
43 #include <qapplication.h>
47 /*!Create and return new instance of STD_Application*/
48 extern "C" STD_EXPORT SUIT_Application* createApplication()
50 return new STD_Application();
54 STD_Application::STD_Application()
56 myEditEnabled( true ),
59 STD_MDIDesktop* desk = new STD_MDIDesktop();
65 STD_Application::~STD_Application()
69 /*! \retval QString "StdApplication"*/
70 QString STD_Application::applicationName() const
72 return QString( "StdApplication" );
75 /*!Start STD_Application*/
76 void STD_Application::start()
81 updateCommandsStatus();
82 setEditEnabled( myEditEnabled );
86 SUIT_Application::start();
92 void STD_Application::closeApplication()
97 SUIT_Application::closeApplication();
100 /*!Event on closing desktop*/
101 void STD_Application::onDesktopClosing( SUIT_Desktop*, QCloseEvent* e )
103 if ( SUIT_Session::session()->applications().count() < 2 )
109 if ( !isPossibleToClose() )
115 SUIT_Study* study = activeStudy();
118 study->closeDocument();
130 /*!Create actions, menus and tools*/
131 void STD_Application::createActions()
133 SUIT_Desktop* desk = desktop();
134 SUIT_ResourceMgr* resMgr = resourceMgr();
135 if ( !desk || !resMgr )
140 createAction( FileNewId, tr( "TOT_DESK_FILE_NEW" ),
141 resMgr->loadPixmap( "STD", tr( "ICON_FILE_NEW" ) ),
142 tr( "MEN_DESK_FILE_NEW" ), tr( "PRP_DESK_FILE_NEW" ),
143 CTRL+Key_N, desk, false, this, SLOT( onNewDoc() ) );
145 createAction( FileOpenId, tr( "TOT_DESK_FILE_OPEN" ),
146 resMgr->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ),
147 tr( "MEN_DESK_FILE_OPEN" ), tr( "PRP_DESK_FILE_OPEN" ),
148 CTRL+Key_O, desk, false, this, SLOT( onOpenDoc() ) );
150 createAction( FileCloseId, tr( "TOT_DESK_FILE_CLOSE" ),
151 resMgr->loadPixmap( "STD", tr( "ICON_FILE_CLOSE" ) ),
152 tr( "MEN_DESK_FILE_CLOSE" ), tr( "PRP_DESK_FILE_CLOSE" ),
153 CTRL+Key_W, desk, false, this, SLOT( onCloseDoc() ) );
155 createAction( FileExitId, tr( "TOT_DESK_FILE_EXIT" ), QIconSet(),
156 tr( "MEN_DESK_FILE_EXIT" ), tr( "PRP_DESK_FILE_EXIT" ),
157 CTRL+Key_Q, desk, false, this, SLOT( onExit() ) );
159 createAction( FileSaveId, tr( "TOT_DESK_FILE_SAVE" ),
160 resMgr->loadPixmap( "STD", tr( "ICON_FILE_SAVE" ) ),
161 tr( "MEN_DESK_FILE_SAVE" ), tr( "PRP_DESK_FILE_SAVE" ),
162 CTRL+Key_S, desk, false, this, SLOT( onSaveDoc() ) );
164 createAction( FileSaveAsId, tr( "TOT_DESK_FILE_SAVEAS" ), QIconSet(),
165 tr( "MEN_DESK_FILE_SAVEAS" ), tr( "PRP_DESK_FILE_SAVEAS" ),
166 CTRL+Key_A, desk, false, this, SLOT( onSaveAsDoc() ) );
168 createAction( EditCopyId, tr( "TOT_DESK_EDIT_COPY" ),
169 resMgr->loadPixmap( "STD", tr( "ICON_EDIT_COPY" ) ),
170 tr( "MEN_DESK_EDIT_COPY" ), tr( "PRP_DESK_EDIT_COPY" ),
171 CTRL+Key_C, desk, false, this, SLOT( onCopy() ) );
173 createAction( EditPasteId, tr( "TOT_DESK_EDIT_PASTE" ),
174 resMgr->loadPixmap( "STD", tr( "ICON_EDIT_PASTE" ) ),
175 tr( "MEN_DESK_EDIT_PASTE" ), tr( "PRP_DESK_EDIT_PASTE" ),
176 CTRL+Key_V, desk, false, this, SLOT( onPaste() ) );
178 QAction* a = createAction( ViewStatusBarId, tr( "TOT_DESK_VIEW_STATUSBAR" ),
179 QIconSet(), tr( "MEN_DESK_VIEW_STATUSBAR" ),
180 tr( "PRP_DESK_VIEW_STATUSBAR" ), SHIFT+Key_S, desk, true );
181 a->setOn( desk->statusBar()->isVisibleTo( desk ) );
182 connect( a, SIGNAL( toggled( bool ) ), this, SLOT( onViewStatusBar( bool ) ) );
184 createAction( NewWindowId, tr( "TOT_DESK_NEWWINDOW" ), QIconSet(),
185 tr( "MEN_DESK_NEWWINDOW" ), tr( "PRP_DESK_NEWWINDOW" ), 0, desk );
187 createAction( HelpAboutId, tr( "TOT_DESK_HELP_ABOUT" ), QIconSet(),
188 tr( "MEN_DESK_HELP_ABOUT" ), tr( "PRP_DESK_HELP_ABOUT" ),
189 SHIFT+Key_A, desk, false, this, SLOT( onHelpAbout() ) );
191 //SRN: BugID IPAL9021, add an action "Load"
192 createAction( FileLoadId, tr( "TOT_DESK_FILE_LOAD" ),
193 resMgr->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ),
194 tr( "MEN_DESK_FILE_LOAD" ), tr( "PRP_DESK_FILE_LOAD" ),
195 CTRL+Key_L, desk, false, this, SLOT( onLoadDoc() ) );
196 //SRN: BugID IPAL9021: End
198 QtxDockAction* da = new QtxDockAction( tr( "TOT_DOCK_WINDOWS" ), tr( "MEN_DOCK_WINDOWS" ), desk );
199 registerAction( ViewWindowsId, da );
200 da->setAutoPlace( false );
204 int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1, -1, 0 );
205 int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, -1, 10 );
206 int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1, -1, 10 );
207 int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, -1, 1000 );
211 createMenu( FileNewId, fileMenu, 0 );
212 createMenu( FileOpenId, fileMenu, 0 );
213 createMenu( FileLoadId, fileMenu, 0 ); //SRN: BugID IPAL9021, add a menu item "Load"
214 createMenu( FileCloseId, fileMenu, 0 );
215 createMenu( separator(), fileMenu, -1, 0 );
216 createMenu( FileSaveId, fileMenu, 0 );
217 createMenu( FileSaveAsId, fileMenu, 0 );
218 createMenu( separator(), fileMenu, -1, 0 );
220 createMenu( separator(), fileMenu );
221 createMenu( FileExitId, fileMenu );
223 createMenu( EditCopyId, editMenu );
224 createMenu( EditPasteId, editMenu );
225 createMenu( separator(), editMenu );
227 createMenu( ViewWindowsId, viewMenu );
228 createMenu( ViewStatusBarId, viewMenu );
229 createMenu( separator(), viewMenu );
231 createMenu( HelpAboutId, helpMenu );
232 createMenu( separator(), helpMenu );
236 int stdTBar = createTool( tr( "INF_DESK_TOOLBAR_STANDARD" ) );
240 createTool( FileNewId, stdTBar );
241 createTool( FileOpenId, stdTBar );
242 createTool( FileSaveId, stdTBar );
243 createTool( FileCloseId, stdTBar );
244 createTool( separator(), stdTBar );
245 createTool( EditCopyId, stdTBar );
246 createTool( EditPasteId, stdTBar );
249 /*!Opens new application*/
250 void STD_Application::onNewDoc()
252 QApplication::setOverrideCursor( Qt::waitCursor );
254 if ( !activeStudy() )
257 activeStudy()->createDocument();
258 studyCreated( activeStudy() );
262 SUIT_Application* aApp = startApplication( 0, 0 );
263 if ( aApp->inherits( "STD_Application" ) )
264 ((STD_Application*)aApp)->onNewDoc();
267 aApp->createEmptyStudy();
268 aApp->activeStudy()->createDocument();
272 QApplication::restoreOverrideCursor();
275 /*!Put file name from file dialog to onOpenDoc(const QString&) function*/
276 void STD_Application::onOpenDoc()
278 // It is preferrable to use OS-specific file dialog box here !!!
279 QString aName = getFileName( true, QString::null, getFileFilter(), QString::null, 0 );
280 if ( aName.isNull() )
286 /*! \retval true, if document was opened successful, else false.*/
287 bool STD_Application::onOpenDoc( const QString& aName )
289 QApplication::setOverrideCursor( Qt::waitCursor );
292 if ( !activeStudy() )
294 // if no study - open in current desktop
295 res = useFile( aName );
299 // if study exists - open in new desktop. Check: is the same file is opened?
300 SUIT_Session* aSession = SUIT_Session::session();
301 QPtrList<SUIT_Application> aAppList = aSession->applications();
302 bool isAlreadyOpen = false;
303 SUIT_Application* aApp = 0;
304 for ( QPtrListIterator<SUIT_Application> it( aAppList ); it.current() && !isAlreadyOpen; ++it )
307 if ( aApp->activeStudy()->studyName() == aName )
308 isAlreadyOpen = true;
310 if ( !isAlreadyOpen )
312 aApp = startApplication( 0, 0 );
314 res = aApp->useFile( aName );
316 aApp->closeApplication();
319 aApp->desktop()->setActiveWindow();
322 QApplication::restoreOverrideCursor();
327 /*! called on loading the existent study */
328 void STD_Application::onLoadDoc()
332 /*! \retval true, if document was loaded successful, else false.*/
333 bool STD_Application::onLoadDoc( const QString& aName )
336 if ( !activeStudy() )
338 // if no study - load in current desktop
339 res = useStudy( aName );
343 // if study exists - load in new desktop. Check: is the same file is loaded?
344 SUIT_Session* aSession = SUIT_Session::session();
345 QPtrList<SUIT_Application> aAppList = aSession->applications();
346 bool isAlreadyOpen = false;
347 SUIT_Application* aApp = 0;
348 for ( QPtrListIterator<SUIT_Application> it( aAppList ); it.current() && !isAlreadyOpen; ++it )
351 if ( aApp->activeStudy()->studyName() == aName )
352 isAlreadyOpen = true;
354 if ( !isAlreadyOpen )
356 aApp = startApplication( 0, 0 );
358 res = aApp->useStudy( aName );
361 aApp->desktop()->setActiveWindow();
366 /*!Virtual function. Not implemented here.*/
367 void STD_Application::beforeCloseDoc( SUIT_Study* )
371 /*!Virtual function. Not implemented here.*/
372 void STD_Application::afterCloseDoc()
376 /*!Close document, if it's possible.*/
377 void STD_Application::onCloseDoc( bool ask )
379 if ( ask && !isPossibleToClose() )
382 SUIT_Study* study = activeStudy();
384 beforeCloseDoc( study );
387 study->closeDocument(myClosePermanently);
395 QPtrList<SUIT_Application> apps = SUIT_Session::session()->applications();
396 for ( unsigned i = 0; i < apps.count(); i++ )
397 aNbStudies += apps.at( i )->getNbStudies();
399 // STV: aNbStudies - number of currently existing studies (exclude currently closed)
400 // STV: aNbStudies should be compared with 0.
408 updateDesktopTitle();
409 updateCommandsStatus();
418 /*!Check the application on closing.
419 * \retval true if possible, else false
421 bool STD_Application::isPossibleToClose()
423 myClosePermanently = true; //SRN: BugID: IPAL9021
426 activeStudy()->abortAllOperations();
427 if ( activeStudy()->isModified() )
429 QString sName = activeStudy()->studyName().stripWhiteSpace();
430 QString msg = sName.isEmpty() ? tr( "INF_DOC_MODIFIED" ) : tr ( "INF_DOCUMENT_MODIFIED" ).arg( sName );
432 //SRN: BugID: IPAL9021: Begin
433 STD_CloseDlg dlg(desktop());
437 if ( activeStudy()->isSaved() )
439 else if ( !onSaveAsDoc() )
445 myClosePermanently = false;
451 //SRN: BugID: IPAL9021: End
457 /*!Save document if all ok, else error message.*/
458 void STD_Application::onSaveDoc()
460 if ( !activeStudy() )
464 if ( activeStudy()->isSaved() )
466 putInfo( tr( "INF_DOC_SAVING" ) + activeStudy()->studyName() );
468 QApplication::setOverrideCursor( Qt::waitCursor );
470 isOk = activeStudy()->saveDocument();
472 QApplication::restoreOverrideCursor();
477 SUIT_MessageBox::error1( desktop(), tr( "TIT_FILE_SAVEAS" ),
478 tr( "MSG_CANT_SAVE" ).arg( activeStudy()->studyName() ), tr( "BUT_OK" ) );
481 putInfo( tr( "INF_DOC_SAVED" ).arg( "" ) );
485 studySaved( activeStudy() );
490 /*! \retval TRUE, if doument saved successful, else FALSE.*/
491 bool STD_Application::onSaveAsDoc()
493 SUIT_Study* study = activeStudy();
500 QString aName = getFileName( false, study->studyName(), getFileFilter(), QString::null, 0 );
501 if ( aName.isNull() )
504 QApplication::setOverrideCursor( Qt::waitCursor );
506 putInfo( tr( "INF_DOC_SAVING" ) + aName );
507 isOk = study->saveDocumentAs( aName );
509 putInfo( isOk ? tr( "INF_DOC_SAVED" ).arg( aName ) : "" );
511 QApplication::restoreOverrideCursor();
514 SUIT_MessageBox::error1( desktop(), tr( "ERROR" ),
515 tr( "INF_DOC_SAVING_FAILS" ).arg( aName ), tr( "BUT_OK" ) );
518 studySaved( activeStudy() );
523 /*!Closing session.*/
524 void STD_Application::onExit()
526 int aAnswer = SUIT_MessageBox::info2( desktop(), tr( "INF_DESK_EXIT" ), tr( "QUE_DESK_EXIT" ),
527 tr( "BUT_OK" ), tr( "BUT_CANCEL" ), 1, 2, 2 );
529 SUIT_Session::session()->closeSession();
532 /*!Virtual slot. Not implemented here.*/
533 void STD_Application::onCopy()
537 /*!Virtual slot. Not implemented here.*/
538 void STD_Application::onPaste()
542 /*!Sets \a theEnable for menu manager and for tool manager.*/
543 void STD_Application::setEditEnabled( bool theEnable )
545 myEditEnabled = theEnable;
547 QtxActionMenuMgr* mMgr = desktop()->menuMgr();
548 QtxActionToolMgr* tMgr = desktop()->toolMgr();
550 for ( int i = EditCopyId; i <= EditPasteId; i++ )
552 mMgr->setShown( i, myEditEnabled );
553 tMgr->setShown( i, myEditEnabled );
557 /*!\retval true, if document opened successful, else false.*/
558 bool STD_Application::useFile(const QString& theFileName)
560 bool res = SUIT_Application::useFile( theFileName );
563 studyOpened( activeStudy() );
568 /*!Update desktop title.*/
569 void STD_Application::updateDesktopTitle()
571 QString aTitle = applicationName();
572 QString aVer = applicationVersion();
573 if ( !aVer.isEmpty() )
574 aTitle += QString( " " ) + aVer;
578 QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
579 if ( !sName.isEmpty() )
580 aTitle += QString( " - [%1]" ).arg( sName );
583 desktop()->setCaption( aTitle );
586 /*!Update commands status.*/
587 void STD_Application::updateCommandsStatus()
589 bool aHasStudy = activeStudy() != 0;
590 bool aIsNeedToSave = false;
592 aIsNeedToSave = !activeStudy()->isSaved() || activeStudy()->isModified();
594 if ( action( FileSaveId ) )
595 action( FileSaveId )->setEnabled( aIsNeedToSave );
596 if ( action( FileSaveAsId ) )
597 action( FileSaveAsId )->setEnabled( aHasStudy );
598 if ( action( FileCloseId ) )
599 action( FileCloseId )->setEnabled( aHasStudy );
600 if ( action( NewWindowId ) )
601 action( NewWindowId )->setEnabled( aHasStudy );
604 /*!\retval SUIT_ViewManager by viewer manager type name.*/
605 SUIT_ViewManager* STD_Application::viewManager( const QString& vmType ) const
607 SUIT_ViewManager* vm = 0;
608 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current() && !vm; ++it )
610 if ( it.current()->getType() == vmType )
616 /*! \param vmType - input view manager type name
617 * \param lst - output list of view managers with types \a vmType.
619 void STD_Application::viewManagers( const QString& vmType, ViewManagerList& lst ) const
621 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current(); ++it )
622 if ( it.current()->getType() == vmType )
623 lst.append( it.current() );
626 /*!\param lst - output list of all view managers.*/
627 void STD_Application::viewManagers( ViewManagerList& lst ) const
629 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current(); ++it )
630 lst.append( it.current() );
633 /*!\retval ViewManagerList - const list of all view managers.*/
634 ViewManagerList STD_Application::viewManagers() const
641 /*!\retval SUIT_ViewManager - return pointer to active view manager.*/
642 SUIT_ViewManager* STD_Application::activeViewManager() const
644 return myActiveViewMgr;
647 /*!Add view manager to view managers list, if it not already there.*/
648 void STD_Application::addViewManager( SUIT_ViewManager* vm )
653 if ( !containsViewManager( vm ) )
655 myViewMgrs.append( vm );
656 connect( vm, SIGNAL( activated( SUIT_ViewManager* ) ),
657 this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
658 vm->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
660 emit viewManagerAdded( vm );
663 if ( !activeViewManager() && myViewMgrs.count() == 1 )
664 setActiveViewManager( vm );
668 /*!Remove view manager from view managers list.*/
669 void STD_Application::removeViewManager( SUIT_ViewManager* vm )
676 emit viewManagerRemoved( vm );
678 vm->disconnectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
680 myViewMgrs.removeRef( vm );
682 if ( myActiveViewMgr == vm )
686 /*!Remove all view managers from view managers list.*/
687 void STD_Application::clearViewManagers()
692 for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it )
693 removeViewManager( it.current() );
696 /*!\retval TRUE, if view manager \a vm, already in view manager list (\a myViewMgrs).*/
697 bool STD_Application::containsViewManager( SUIT_ViewManager* vm ) const
699 return myViewMgrs.contains( vm ) > 0;
702 /*!Private slot, sets active manager to \vm, if \vm in view managers list.*/
703 void STD_Application::onViewManagerActivated( SUIT_ViewManager* vm )
705 setActiveViewManager( vm );
708 /*!Sets status bar show, if \on = true, else status bar hide.*/
709 void STD_Application::onViewStatusBar( bool on )
712 desktop()->statusBar()->show();
714 desktop()->statusBar()->hide();
717 /*!Call SUIT_MessageBox::info1(...) with about information.*/
718 void STD_Application::onHelpAbout()
720 SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" );
723 /*!Create empty study. \n
724 * Create new view manager and adding it to view managers list.
726 void STD_Application::createEmptyStudy()
728 SUIT_Application::createEmptyStudy();
730 SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(), desktop(), new SUIT_ViewModel() );
732 addViewManager( vm );
735 /*!Sets active manager to \vm, if \vm in view managers list.*/
736 void STD_Application::setActiveViewManager( SUIT_ViewManager* vm )
738 if ( !containsViewManager( vm ) )
741 myActiveViewMgr = vm;
742 emit viewManagerActivated( vm );
746 void STD_Application::onConnectPopupRequest( SUIT_PopupClient* client, QContextMenuEvent* e )
748 QtxPopupMenu* popup = new QtxPopupMenu();
749 // fill popup by own items
751 contextMenuPopup( client->popupClientType(), popup, title );
752 popup->setTitleText( title );
754 popup->insertSeparator();
755 // add items from popup client
756 client->contextMenuPopup( popup );
758 SUIT_Tools::simplifySeparators( popup );
760 if ( popup->count() )
761 popup->exec( e->globalPos() );
767 /*!\retval QString - return file name from dialog.*/
768 QString STD_Application::getFileName( bool open, const QString& initial, const QString& filters,
769 const QString& caption, QWidget* parent )
775 return QFileDialog::getOpenFileName( initial, filters, parent, 0, caption );
781 QString anOldPath = initial;
786 // It is preferrable to use OS-specific file dialog box here !!!
787 aName = QFileDialog::getSaveFileName( anOldPath, filters, parent, 0, caption, &aUsedFilter );
789 if ( aName.isNull() )
793 int aEnd = aUsedFilter.findRev( ')' );
794 int aStart = aUsedFilter.findRev( '(', aEnd );
795 QString wcStr = aUsedFilter.mid( aStart + 1, aEnd - aStart - 1 );
799 QRegExp rx( "[\b\\*]*\\.([\\w]+)" );
800 while ( ( idx = rx.search( wcStr, idx ) ) != -1 )
802 extList.append( rx.cap( 1 ) );
803 idx += rx.matchedLength();
806 if ( !extList.isEmpty() && !extList.contains( QFileInfo( aName ).extension() ) )
807 aName += QString( ".%1" ).arg( extList.first() );
809 if ( QFileInfo( aName ).exists() )
811 int aAnswer = SUIT_MessageBox::warn3( desktop(), tr( "TIT_FILE_SAVEAS" ),
812 tr( "MSG_FILE_EXISTS" ).arg( aName ),
813 tr( "BUT_YES" ), tr( "BUT_NO" ), tr( "BUT_CANCEL" ), 1, 2, 3, 1 );
816 aName = QString::null;
819 else if ( aAnswer == 2 ) // not save to this file
820 anOldPath = aName; // not to return to the same initial dir at each "while" step
821 else // overwrite the existing file
832 /*!\retval QString - return directory name from dialog.*/
833 QString STD_Application::getDirectory( const QString& initial, const QString& caption, QWidget* parent )
837 return QFileDialog::getExistingDirectory( initial, parent, 0, caption, true );
840 void STD_Application::setDesktop( SUIT_Desktop* desk )
842 SUIT_Desktop* prev = desktop();
844 SUIT_Application::setDesktop( desk );
846 if ( prev != desk && desk )
847 connect( desk, SIGNAL( closing( SUIT_Desktop*, QCloseEvent* ) ),
848 this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) );
852 Allow to load preferences before the desktop will be shown.
854 void STD_Application::loadPreferences()
859 Allow to save preferences before the application will be closed.
861 void STD_Application::savePreferences()
865 void STD_Application::studyCreated( SUIT_Study* )
867 updateDesktopTitle();
868 updateCommandsStatus();
871 void STD_Application::studyOpened( SUIT_Study* )
873 updateDesktopTitle();
874 updateCommandsStatus();
877 void STD_Application::studySaved( SUIT_Study* )
879 updateDesktopTitle();
880 updateCommandsStatus();