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()
96 SUIT_Study* study = activeStudy();
99 study->closeDocument();
107 SUIT_Application::closeApplication();
110 /*!Event on closing desktop*/
111 void STD_Application::onDesktopClosing( SUIT_Desktop*, QCloseEvent* e )
113 if ( SUIT_Session::session()->applications().count() < 2 )
119 if ( !isPossibleToClose() )
128 /*!Create actions, menus and tools*/
129 void STD_Application::createActions()
131 SUIT_Desktop* desk = desktop();
132 SUIT_ResourceMgr* resMgr = resourceMgr();
133 if ( !desk || !resMgr )
138 createAction( FileNewId, tr( "TOT_DESK_FILE_NEW" ),
139 resMgr->loadPixmap( "STD", tr( "ICON_FILE_NEW" ) ),
140 tr( "MEN_DESK_FILE_NEW" ), tr( "PRP_DESK_FILE_NEW" ),
141 CTRL+Key_N, desk, false, this, SLOT( onNewDoc() ) );
143 createAction( FileOpenId, tr( "TOT_DESK_FILE_OPEN" ),
144 resMgr->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ),
145 tr( "MEN_DESK_FILE_OPEN" ), tr( "PRP_DESK_FILE_OPEN" ),
146 CTRL+Key_O, desk, false, this, SLOT( onOpenDoc() ) );
148 createAction( FileCloseId, tr( "TOT_DESK_FILE_CLOSE" ),
149 resMgr->loadPixmap( "STD", tr( "ICON_FILE_CLOSE" ) ),
150 tr( "MEN_DESK_FILE_CLOSE" ), tr( "PRP_DESK_FILE_CLOSE" ),
151 CTRL+Key_W, desk, false, this, SLOT( onCloseDoc() ) );
153 createAction( FileExitId, tr( "TOT_DESK_FILE_EXIT" ), QIconSet(),
154 tr( "MEN_DESK_FILE_EXIT" ), tr( "PRP_DESK_FILE_EXIT" ),
155 CTRL+Key_Q, desk, false, this, SLOT( onExit() ) );
157 createAction( FileSaveId, tr( "TOT_DESK_FILE_SAVE" ),
158 resMgr->loadPixmap( "STD", tr( "ICON_FILE_SAVE" ) ),
159 tr( "MEN_DESK_FILE_SAVE" ), tr( "PRP_DESK_FILE_SAVE" ),
160 CTRL+Key_S, desk, false, this, SLOT( onSaveDoc() ) );
162 createAction( FileSaveAsId, tr( "TOT_DESK_FILE_SAVEAS" ), QIconSet(),
163 tr( "MEN_DESK_FILE_SAVEAS" ), tr( "PRP_DESK_FILE_SAVEAS" ),
164 CTRL+Key_A, desk, false, this, SLOT( onSaveAsDoc() ) );
166 createAction( EditCopyId, tr( "TOT_DESK_EDIT_COPY" ),
167 resMgr->loadPixmap( "STD", tr( "ICON_EDIT_COPY" ) ),
168 tr( "MEN_DESK_EDIT_COPY" ), tr( "PRP_DESK_EDIT_COPY" ),
169 CTRL+Key_C, desk, false, this, SLOT( onCopy() ) );
171 createAction( EditPasteId, tr( "TOT_DESK_EDIT_PASTE" ),
172 resMgr->loadPixmap( "STD", tr( "ICON_EDIT_PASTE" ) ),
173 tr( "MEN_DESK_EDIT_PASTE" ), tr( "PRP_DESK_EDIT_PASTE" ),
174 CTRL+Key_V, desk, false, this, SLOT( onPaste() ) );
176 QAction* a = createAction( ViewStatusBarId, tr( "TOT_DESK_VIEW_STATUSBAR" ),
177 QIconSet(), tr( "MEN_DESK_VIEW_STATUSBAR" ),
178 tr( "PRP_DESK_VIEW_STATUSBAR" ), SHIFT+Key_S, desk, true );
179 a->setOn( desk->statusBar()->isVisibleTo( desk ) );
180 connect( a, SIGNAL( toggled( bool ) ), this, SLOT( onViewStatusBar( bool ) ) );
182 createAction( NewWindowId, tr( "TOT_DESK_NEWWINDOW" ), QIconSet(),
183 tr( "MEN_DESK_NEWWINDOW" ), tr( "PRP_DESK_NEWWINDOW" ), 0, desk );
185 createAction( HelpAboutId, tr( "TOT_DESK_HELP_ABOUT" ), QIconSet(),
186 tr( "MEN_DESK_HELP_ABOUT" ), tr( "PRP_DESK_HELP_ABOUT" ),
187 SHIFT+Key_A, desk, false, this, SLOT( onHelpAbout() ) );
189 //SRN: BugID IPAL9021, add an action "Load"
190 createAction( FileLoadId, tr( "TOT_DESK_FILE_LOAD" ),
191 resMgr->loadPixmap( "STD", tr( "ICON_FILE_OPEN" ) ),
192 tr( "MEN_DESK_FILE_LOAD" ), tr( "PRP_DESK_FILE_LOAD" ),
193 CTRL+Key_L, desk, false, this, SLOT( onLoadDoc() ) );
194 //SRN: BugID IPAL9021: End
196 QtxDockAction* da = new QtxDockAction( tr( "TOT_DOCK_WINDOWS" ), tr( "MEN_DOCK_WINDOWS" ), desk );
197 registerAction( ViewWindowsId, da );
198 da->setAutoPlace( false );
202 int fileMenu = createMenu( tr( "MEN_DESK_FILE" ), -1, MenuFileId, 0 );
203 int editMenu = createMenu( tr( "MEN_DESK_EDIT" ), -1, MenuEditId, 10 );
204 int viewMenu = createMenu( tr( "MEN_DESK_VIEW" ), -1, MenuViewId, 10 );
205 int helpMenu = createMenu( tr( "MEN_DESK_HELP" ), -1, MenuHelpId, 1000 );
209 createMenu( FileNewId, fileMenu, 0 );
210 createMenu( FileOpenId, fileMenu, 0 );
211 createMenu( FileLoadId, fileMenu, 0 ); //SRN: BugID IPAL9021, add a menu item "Load"
212 createMenu( FileCloseId, fileMenu, 0 );
213 createMenu( separator(), fileMenu, -1, 0 );
214 createMenu( FileSaveId, fileMenu, 0 );
215 createMenu( FileSaveAsId, fileMenu, 0 );
216 createMenu( separator(), fileMenu, -1, 0 );
218 createMenu( separator(), fileMenu );
219 createMenu( FileExitId, fileMenu );
221 createMenu( EditCopyId, editMenu );
222 createMenu( EditPasteId, editMenu );
223 createMenu( separator(), editMenu );
225 createMenu( ViewWindowsId, viewMenu );
226 createMenu( ViewStatusBarId, viewMenu );
227 createMenu( separator(), viewMenu );
229 createMenu( HelpAboutId, helpMenu );
230 createMenu( separator(), helpMenu );
234 int stdTBar = createTool( tr( "INF_DESK_TOOLBAR_STANDARD" ) );
238 createTool( FileNewId, stdTBar );
239 createTool( FileOpenId, stdTBar );
240 createTool( FileSaveId, stdTBar );
241 createTool( FileCloseId, stdTBar );
242 createTool( separator(), stdTBar );
243 createTool( EditCopyId, stdTBar );
244 createTool( EditPasteId, stdTBar );
247 /*!Opens new application*/
248 void STD_Application::onNewDoc()
250 QApplication::setOverrideCursor( Qt::waitCursor );
252 if ( !activeStudy() )
255 activeStudy()->createDocument();
256 studyCreated( activeStudy() );
260 SUIT_Application* aApp = startApplication( 0, 0 );
261 if ( aApp->inherits( "STD_Application" ) )
262 ((STD_Application*)aApp)->onNewDoc();
265 aApp->createEmptyStudy();
266 aApp->activeStudy()->createDocument();
270 QApplication::restoreOverrideCursor();
273 /*!Put file name from file dialog to onOpenDoc(const QString&) function*/
274 void STD_Application::onOpenDoc()
276 // It is preferrable to use OS-specific file dialog box here !!!
277 QString aName = getFileName( true, QString::null, getFileFilter(), QString::null, 0 );
278 if ( aName.isNull() )
284 /*! \retval true, if document was opened successful, else false.*/
285 bool STD_Application::onOpenDoc( const QString& aName )
287 QApplication::setOverrideCursor( Qt::waitCursor );
290 if ( !activeStudy() )
292 // if no study - open in current desktop
293 res = useFile( aName );
297 // if study exists - open in new desktop. Check: is the same file is opened?
298 SUIT_Session* aSession = SUIT_Session::session();
299 QPtrList<SUIT_Application> aAppList = aSession->applications();
300 bool isAlreadyOpen = false;
301 SUIT_Application* aApp = 0;
302 for ( QPtrListIterator<SUIT_Application> it( aAppList ); it.current() && !isAlreadyOpen; ++it )
305 if ( aApp->activeStudy()->studyName() == aName )
306 isAlreadyOpen = true;
308 if ( !isAlreadyOpen )
310 aApp = startApplication( 0, 0 );
312 res = aApp->useFile( aName );
314 aApp->closeApplication();
317 aApp->desktop()->setActiveWindow();
320 QApplication::restoreOverrideCursor();
325 /*! called on loading the existent study */
326 void STD_Application::onLoadDoc()
330 /*! \retval true, if document was loaded successful, else false.*/
331 bool STD_Application::onLoadDoc( const QString& aName )
334 if ( !activeStudy() )
336 // if no study - load in current desktop
337 res = useStudy( aName );
341 // if study exists - load in new desktop. Check: is the same file is loaded?
342 SUIT_Session* aSession = SUIT_Session::session();
343 QPtrList<SUIT_Application> aAppList = aSession->applications();
344 bool isAlreadyOpen = false;
345 SUIT_Application* aApp = 0;
346 for ( QPtrListIterator<SUIT_Application> it( aAppList ); it.current() && !isAlreadyOpen; ++it )
349 if ( aApp->activeStudy()->studyName() == aName )
350 isAlreadyOpen = true;
352 if ( !isAlreadyOpen )
354 aApp = startApplication( 0, 0 );
356 res = aApp->useStudy( aName );
359 aApp->desktop()->setActiveWindow();
364 /*!Virtual function. Not implemented here.*/
365 void STD_Application::beforeCloseDoc( SUIT_Study* )
369 /*!Virtual function. Not implemented here.*/
370 void STD_Application::afterCloseDoc()
374 /*!Close document, if it's possible.*/
375 void STD_Application::onCloseDoc( bool ask )
377 if ( ask && !isPossibleToClose() )
380 SUIT_Study* study = activeStudy();
382 beforeCloseDoc( study );
385 study->closeDocument(myClosePermanently);
393 QPtrList<SUIT_Application> apps = SUIT_Session::session()->applications();
394 for ( unsigned i = 0; i < apps.count(); i++ )
395 aNbStudies += apps.at( i )->getNbStudies();
397 // STV: aNbStudies - number of currently existing studies (exclude currently closed)
398 // STV: aNbStudies should be compared with 0.
406 updateDesktopTitle();
407 updateCommandsStatus();
416 /*!Check the application on closing.
417 * \retval true if possible, else false
419 bool STD_Application::isPossibleToClose()
421 myClosePermanently = true; //SRN: BugID: IPAL9021
424 activeStudy()->abortAllOperations();
425 if ( activeStudy()->isModified() )
427 QString sName = activeStudy()->studyName().stripWhiteSpace();
428 QString msg = sName.isEmpty() ? tr( "INF_DOC_MODIFIED" ) : tr ( "INF_DOCUMENT_MODIFIED" ).arg( sName );
430 //SRN: BugID: IPAL9021: Begin
431 STD_CloseDlg dlg(desktop());
435 if ( activeStudy()->isSaved() )
437 else if ( !onSaveAsDoc() )
443 myClosePermanently = false;
449 //SRN: BugID: IPAL9021: End
455 /*!Save document if all ok, else error message.*/
456 void STD_Application::onSaveDoc()
458 if ( !activeStudy() )
462 if ( activeStudy()->isSaved() )
464 putInfo( tr( "INF_DOC_SAVING" ) + activeStudy()->studyName() );
466 QApplication::setOverrideCursor( Qt::waitCursor );
468 isOk = activeStudy()->saveDocument();
470 QApplication::restoreOverrideCursor();
475 SUIT_MessageBox::error1( desktop(), tr( "TIT_FILE_SAVEAS" ),
476 tr( "MSG_CANT_SAVE" ).arg( activeStudy()->studyName() ), tr( "BUT_OK" ) );
479 putInfo( tr( "INF_DOC_SAVED" ).arg( "" ) );
483 studySaved( activeStudy() );
488 /*! \retval TRUE, if doument saved successful, else FALSE.*/
489 bool STD_Application::onSaveAsDoc()
491 SUIT_Study* study = activeStudy();
498 QString aName = getFileName( false, study->studyName(), getFileFilter(), QString::null, 0 );
499 if ( aName.isNull() )
502 QApplication::setOverrideCursor( Qt::waitCursor );
504 putInfo( tr( "INF_DOC_SAVING" ) + aName );
505 isOk = study->saveDocumentAs( aName );
507 putInfo( isOk ? tr( "INF_DOC_SAVED" ).arg( aName ) : "" );
509 QApplication::restoreOverrideCursor();
512 SUIT_MessageBox::error1( desktop(), tr( "ERROR" ),
513 tr( "INF_DOC_SAVING_FAILS" ).arg( aName ), tr( "BUT_OK" ) );
516 studySaved( activeStudy() );
521 /*!Closing session.*/
522 void STD_Application::onExit()
524 int aAnswer = SUIT_MessageBox::info2( desktop(), tr( "INF_DESK_EXIT" ), tr( "QUE_DESK_EXIT" ),
525 tr( "BUT_OK" ), tr( "BUT_CANCEL" ), 1, 2, 2 );
527 SUIT_Session::session()->closeSession();
530 /*!Virtual slot. Not implemented here.*/
531 void STD_Application::onCopy()
535 /*!Virtual slot. Not implemented here.*/
536 void STD_Application::onPaste()
540 /*!Sets \a theEnable for menu manager and for tool manager.*/
541 void STD_Application::setEditEnabled( bool theEnable )
543 myEditEnabled = theEnable;
545 QtxActionMenuMgr* mMgr = desktop()->menuMgr();
546 QtxActionToolMgr* tMgr = desktop()->toolMgr();
548 for ( int i = EditCopyId; i <= EditPasteId; i++ )
550 mMgr->setShown( mMgr->actionId(action(i)), myEditEnabled );
551 tMgr->setShown( tMgr->actionId(action(i)), myEditEnabled );
555 /*!\retval true, if document opened successful, else false.*/
556 bool STD_Application::useFile(const QString& theFileName)
558 bool res = SUIT_Application::useFile( theFileName );
561 studyOpened( activeStudy() );
566 /*!Update desktop title.*/
567 void STD_Application::updateDesktopTitle()
569 QString aTitle = applicationName();
570 QString aVer = applicationVersion();
571 if ( !aVer.isEmpty() )
572 aTitle += QString( " " ) + aVer;
576 QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
577 if ( !sName.isEmpty() )
578 aTitle += QString( " - [%1]" ).arg( sName );
581 desktop()->setCaption( aTitle );
584 /*!Update commands status.*/
585 void STD_Application::updateCommandsStatus()
587 bool aHasStudy = activeStudy() != 0;
588 bool aIsNeedToSave = false;
590 aIsNeedToSave = !activeStudy()->isSaved() || activeStudy()->isModified();
592 if ( action( FileSaveId ) )
593 action( FileSaveId )->setEnabled( aIsNeedToSave );
594 if ( action( FileSaveAsId ) )
595 action( FileSaveAsId )->setEnabled( aHasStudy );
596 if ( action( FileCloseId ) )
597 action( FileCloseId )->setEnabled( aHasStudy );
598 if ( action( NewWindowId ) )
599 action( NewWindowId )->setEnabled( aHasStudy );
602 /*!\retval SUIT_ViewManager by viewer manager type name.*/
603 SUIT_ViewManager* STD_Application::viewManager( const QString& vmType ) const
605 SUIT_ViewManager* vm = 0;
606 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current() && !vm; ++it )
608 if ( it.current()->getType() == vmType )
614 /*! \param vmType - input view manager type name
615 * \param lst - output list of view managers with types \a vmType.
617 void STD_Application::viewManagers( const QString& vmType, ViewManagerList& lst ) const
619 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current(); ++it )
620 if ( it.current()->getType() == vmType )
621 lst.append( it.current() );
624 /*!\param lst - output list of all view managers.*/
625 void STD_Application::viewManagers( ViewManagerList& lst ) const
627 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current(); ++it )
628 lst.append( it.current() );
631 /*!\retval ViewManagerList - const list of all view managers.*/
632 ViewManagerList STD_Application::viewManagers() const
639 /*!\retval SUIT_ViewManager - return pointer to active view manager.*/
640 SUIT_ViewManager* STD_Application::activeViewManager() const
642 return myActiveViewMgr;
645 /*!Add view manager to view managers list, if it not already there.*/
646 void STD_Application::addViewManager( SUIT_ViewManager* vm )
651 if ( !containsViewManager( vm ) )
653 myViewMgrs.append( vm );
654 connect( vm, SIGNAL( activated( SUIT_ViewManager* ) ),
655 this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
656 vm->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
658 emit viewManagerAdded( vm );
661 if ( !activeViewManager() && myViewMgrs.count() == 1 )
662 setActiveViewManager( vm );
666 /*!Remove view manager from view managers list.*/
667 void STD_Application::removeViewManager( SUIT_ViewManager* vm )
674 emit viewManagerRemoved( vm );
676 vm->disconnectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
678 myViewMgrs.removeRef( vm );
680 if ( myActiveViewMgr == vm )
684 /*!Remove all view managers from view managers list.*/
685 void STD_Application::clearViewManagers()
690 for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it )
691 removeViewManager( it.current() );
694 /*!\retval TRUE, if view manager \a vm, already in view manager list (\a myViewMgrs).*/
695 bool STD_Application::containsViewManager( SUIT_ViewManager* vm ) const
697 return myViewMgrs.contains( vm ) > 0;
700 /*!Private slot, sets active manager to \vm, if \vm in view managers list.*/
701 void STD_Application::onViewManagerActivated( SUIT_ViewManager* vm )
703 setActiveViewManager( vm );
706 /*!Sets status bar show, if \on = true, else status bar hide.*/
707 void STD_Application::onViewStatusBar( bool on )
710 desktop()->statusBar()->show();
712 desktop()->statusBar()->hide();
715 /*!Call SUIT_MessageBox::info1(...) with about information.*/
716 void STD_Application::onHelpAbout()
718 SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" );
721 /*!Create empty study. \n
722 * Create new view manager and adding it to view managers list.
724 void STD_Application::createEmptyStudy()
726 SUIT_Application::createEmptyStudy();
728 SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(), desktop(), new SUIT_ViewModel() );
730 addViewManager( vm );
733 /*!Sets active manager to \vm, if \vm in view managers list.*/
734 void STD_Application::setActiveViewManager( SUIT_ViewManager* vm )
736 if ( !containsViewManager( vm ) )
739 myActiveViewMgr = vm;
740 emit viewManagerActivated( vm );
744 void STD_Application::onConnectPopupRequest( SUIT_PopupClient* client, QContextMenuEvent* e )
746 QtxPopupMenu* popup = new QtxPopupMenu();
747 // fill popup by own items
749 contextMenuPopup( client->popupClientType(), popup, title );
750 popup->setTitleText( title );
752 popup->insertSeparator();
753 // add items from popup client
754 client->contextMenuPopup( popup );
756 SUIT_Tools::simplifySeparators( popup );
758 if ( popup->count() )
759 popup->exec( e->globalPos() );
765 /*!\retval QString - return file name from dialog.*/
766 QString STD_Application::getFileName( bool open, const QString& initial, const QString& filters,
767 const QString& caption, QWidget* parent )
773 return QFileDialog::getOpenFileName( initial, filters, parent, 0, caption );
779 QString anOldPath = initial;
784 // It is preferrable to use OS-specific file dialog box here !!!
785 aName = QFileDialog::getSaveFileName( anOldPath, filters, parent, 0, caption, &aUsedFilter );
787 if ( aName.isNull() )
791 int aEnd = aUsedFilter.findRev( ')' );
792 int aStart = aUsedFilter.findRev( '(', aEnd );
793 QString wcStr = aUsedFilter.mid( aStart + 1, aEnd - aStart - 1 );
797 QRegExp rx( "[\b\\*]*\\.([\\w]+)" );
798 while ( ( idx = rx.search( wcStr, idx ) ) != -1 )
800 extList.append( rx.cap( 1 ) );
801 idx += rx.matchedLength();
804 if ( !extList.isEmpty() && !extList.contains( QFileInfo( aName ).extension() ) )
805 aName += QString( ".%1" ).arg( extList.first() );
807 if ( QFileInfo( aName ).exists() )
809 int aAnswer = SUIT_MessageBox::warn3( desktop(), tr( "TIT_FILE_SAVEAS" ),
810 tr( "MSG_FILE_EXISTS" ).arg( aName ),
811 tr( "BUT_YES" ), tr( "BUT_NO" ), tr( "BUT_CANCEL" ), 1, 2, 3, 1 );
814 aName = QString::null;
817 else if ( aAnswer == 2 ) // not save to this file
818 anOldPath = aName; // not to return to the same initial dir at each "while" step
819 else // overwrite the existing file
830 /*!\retval QString - return directory name from dialog.*/
831 QString STD_Application::getDirectory( const QString& initial, const QString& caption, QWidget* parent )
835 return QFileDialog::getExistingDirectory( initial, parent, 0, caption, true );
838 void STD_Application::setDesktop( SUIT_Desktop* desk )
840 SUIT_Desktop* prev = desktop();
842 SUIT_Application::setDesktop( desk );
844 if ( prev != desk && desk )
845 connect( desk, SIGNAL( closing( SUIT_Desktop*, QCloseEvent* ) ),
846 this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) );
850 Allow to load preferences before the desktop will be shown.
852 void STD_Application::loadPreferences()
857 Allow to save preferences before the application will be closed.
859 void STD_Application::savePreferences()
863 void STD_Application::studyCreated( SUIT_Study* )
865 updateDesktopTitle();
866 updateCommandsStatus();
869 void STD_Application::studyOpened( SUIT_Study* )
871 updateDesktopTitle();
872 updateCommandsStatus();
875 void STD_Application::studySaved( SUIT_Study* )
877 updateDesktopTitle();
878 updateCommandsStatus();