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/ or email : webmaster.salome@opencascade.com
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 // displaying a message box as SUIT_Validator in case file can't be written (the most frequent case)
476 SUIT_MessageBox::error1( desktop(),
478 tr( "ERR_PERMISSION_DENIED" ).arg( activeStudy()->studyName() ),
482 putInfo( tr( "INF_DOC_SAVED" ).arg( "" ) );
486 studySaved( activeStudy() );
491 /*! \retval TRUE, if doument saved successful, else FALSE.*/
492 bool STD_Application::onSaveAsDoc()
494 SUIT_Study* study = activeStudy();
501 QString aName = getFileName( false, study->studyName(), getFileFilter(), QString::null, 0 );
502 if ( aName.isNull() )
505 QApplication::setOverrideCursor( Qt::waitCursor );
507 putInfo( tr( "INF_DOC_SAVING" ) + aName );
508 isOk = study->saveDocumentAs( aName );
510 putInfo( isOk ? tr( "INF_DOC_SAVED" ).arg( aName ) : "" );
512 QApplication::restoreOverrideCursor();
515 SUIT_MessageBox::error1( desktop(), tr( "ERROR" ),
516 tr( "INF_DOC_SAVING_FAILS" ).arg( aName ),
520 studySaved( activeStudy() );
525 /*!Closing session.*/
526 void STD_Application::onExit()
528 int aAnswer = SUIT_MessageBox::info2( desktop(), tr( "INF_DESK_EXIT" ), tr( "QUE_DESK_EXIT" ),
529 tr( "BUT_OK" ), tr( "BUT_CANCEL" ), 1, 2, 2 );
531 SUIT_Session::session()->closeSession();
534 /*!Virtual slot. Not implemented here.*/
535 void STD_Application::onCopy()
539 /*!Virtual slot. Not implemented here.*/
540 void STD_Application::onPaste()
544 /*!Sets \a theEnable for menu manager and for tool manager.*/
545 void STD_Application::setEditEnabled( bool theEnable )
547 myEditEnabled = theEnable;
549 QtxActionMenuMgr* mMgr = desktop()->menuMgr();
550 QtxActionToolMgr* tMgr = desktop()->toolMgr();
552 for ( int i = EditCopyId; i <= EditPasteId; i++ )
554 mMgr->setShown( mMgr->actionId(action(i)), myEditEnabled );
555 tMgr->setShown( tMgr->actionId(action(i)), myEditEnabled );
559 /*!\retval true, if document opened successful, else false.*/
560 bool STD_Application::useFile(const QString& theFileName)
562 bool res = SUIT_Application::useFile( theFileName );
565 studyOpened( activeStudy() );
570 /*!Update desktop title.*/
571 void STD_Application::updateDesktopTitle()
573 QString aTitle = applicationName();
574 QString aVer = applicationVersion();
575 if ( !aVer.isEmpty() )
576 aTitle += QString( " " ) + aVer;
580 QString sName = SUIT_Tools::file( activeStudy()->studyName().stripWhiteSpace(), false );
581 if ( !sName.isEmpty() )
582 aTitle += QString( " - [%1]" ).arg( sName );
585 desktop()->setCaption( aTitle );
588 /*!Update commands status.*/
589 void STD_Application::updateCommandsStatus()
591 bool aHasStudy = activeStudy() != 0;
592 bool aIsNeedToSave = false;
594 aIsNeedToSave = !activeStudy()->isSaved() || activeStudy()->isModified();
596 if ( action( FileSaveId ) )
597 action( FileSaveId )->setEnabled( aIsNeedToSave );
598 if ( action( FileSaveAsId ) )
599 action( FileSaveAsId )->setEnabled( aHasStudy );
600 if ( action( FileCloseId ) )
601 action( FileCloseId )->setEnabled( aHasStudy );
602 if ( action( NewWindowId ) )
603 action( NewWindowId )->setEnabled( aHasStudy );
606 /*!\retval SUIT_ViewManager by viewer manager type name.*/
607 SUIT_ViewManager* STD_Application::viewManager( const QString& vmType ) const
609 SUIT_ViewManager* vm = 0;
610 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current() && !vm; ++it )
612 if ( it.current()->getType() == vmType )
618 /*! \param vmType - input view manager type name
619 * \param lst - output list of view managers with types \a vmType.
621 void STD_Application::viewManagers( const QString& vmType, ViewManagerList& lst ) const
623 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current(); ++it )
624 if ( it.current()->getType() == vmType )
625 lst.append( it.current() );
628 /*!\param lst - output list of all view managers.*/
629 void STD_Application::viewManagers( ViewManagerList& lst ) const
631 for ( QPtrListIterator<SUIT_ViewManager> it( myViewMgrs ); it.current(); ++it )
632 lst.append( it.current() );
635 /*!\retval ViewManagerList - const list of all view managers.*/
636 ViewManagerList STD_Application::viewManagers() const
643 /*!\retval SUIT_ViewManager - return pointer to active view manager.*/
644 SUIT_ViewManager* STD_Application::activeViewManager() const
646 return myActiveViewMgr;
649 /*!Add view manager to view managers list, if it not already there.*/
650 void STD_Application::addViewManager( SUIT_ViewManager* vm )
655 if ( !containsViewManager( vm ) )
657 myViewMgrs.append( vm );
658 connect( vm, SIGNAL( activated( SUIT_ViewManager* ) ),
659 this, SLOT( onViewManagerActivated( SUIT_ViewManager* ) ) );
660 vm->connectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
662 emit viewManagerAdded( vm );
665 if ( !activeViewManager() && myViewMgrs.count() == 1 )
666 setActiveViewManager( vm );
670 /*!Remove view manager from view managers list.*/
671 void STD_Application::removeViewManager( SUIT_ViewManager* vm )
678 emit viewManagerRemoved( vm );
680 vm->disconnectPopupRequest( this, SLOT( onConnectPopupRequest( SUIT_PopupClient*, QContextMenuEvent* ) ) );
682 myViewMgrs.removeRef( vm );
684 if ( myActiveViewMgr == vm )
688 /*!Remove all view managers from view managers list.*/
689 void STD_Application::clearViewManagers()
694 for ( QPtrListIterator<SUIT_ViewManager> it( lst ); it.current(); ++it )
695 removeViewManager( it.current() );
698 /*!\retval TRUE, if view manager \a vm, already in view manager list (\a myViewMgrs).*/
699 bool STD_Application::containsViewManager( SUIT_ViewManager* vm ) const
701 return myViewMgrs.contains( vm ) > 0;
704 /*!Private slot, sets active manager to \vm, if \vm in view managers list.*/
705 void STD_Application::onViewManagerActivated( SUIT_ViewManager* vm )
707 setActiveViewManager( vm );
710 /*!Sets status bar show, if \on = true, else status bar hide.*/
711 void STD_Application::onViewStatusBar( bool on )
714 desktop()->statusBar()->show();
716 desktop()->statusBar()->hide();
719 /*!Call SUIT_MessageBox::info1(...) with about information.*/
720 void STD_Application::onHelpAbout()
722 SUIT_MessageBox::info1( desktop(), tr( "About" ), tr( "ABOUT_INFO" ), "&OK" );
725 /*!Create empty study. \n
726 * Create new view manager and adding it to view managers list.
728 void STD_Application::createEmptyStudy()
730 SUIT_Application::createEmptyStudy();
732 SUIT_ViewManager* vm = new SUIT_ViewManager( activeStudy(), desktop(), new SUIT_ViewModel() );
734 addViewManager( vm );
737 /*!Sets active manager to \vm, if \vm in view managers list.*/
738 void STD_Application::setActiveViewManager( SUIT_ViewManager* vm )
740 if ( !containsViewManager( vm ) )
743 myActiveViewMgr = vm;
744 emit viewManagerActivated( vm );
748 void STD_Application::onConnectPopupRequest( SUIT_PopupClient* client, QContextMenuEvent* e )
750 QtxPopupMenu* popup = new QtxPopupMenu();
751 // fill popup by own items
753 contextMenuPopup( client->popupClientType(), popup, title );
754 popup->setTitleText( title );
756 popup->insertSeparator();
757 // add items from popup client
758 client->contextMenuPopup( popup );
760 SUIT_Tools::simplifySeparators( popup );
762 if ( popup->count() )
763 popup->exec( e->globalPos() );
769 /*!\retval QString - return file name from dialog.*/
770 QString STD_Application::getFileName( bool open, const QString& initial, const QString& filters,
771 const QString& caption, QWidget* parent )
777 return QFileDialog::getOpenFileName( initial, filters, parent, 0, caption );
783 QString anOldPath = initial;
788 // It is preferrable to use OS-specific file dialog box here !!!
789 aName = QFileDialog::getSaveFileName( anOldPath, filters, parent, 0, caption, &aUsedFilter );
791 if ( aName.isNull() )
795 int aEnd = aUsedFilter.findRev( ')' );
796 int aStart = aUsedFilter.findRev( '(', aEnd );
797 QString wcStr = aUsedFilter.mid( aStart + 1, aEnd - aStart - 1 );
801 QRegExp rx( "[\b\\*]*\\.([\\w]+)" );
802 while ( ( idx = rx.search( wcStr, idx ) ) != -1 )
804 extList.append( rx.cap( 1 ) );
805 idx += rx.matchedLength();
808 if ( !extList.isEmpty() && !extList.contains( QFileInfo( aName ).extension() ) )
809 aName += QString( ".%1" ).arg( extList.first() );
811 if ( QFileInfo( aName ).exists() )
813 int aAnswer = SUIT_MessageBox::warn3( desktop(), tr( "TIT_FILE_SAVEAS" ),
814 tr( "MSG_FILE_EXISTS" ).arg( aName ),
815 tr( "BUT_YES" ), tr( "BUT_NO" ), tr( "BUT_CANCEL" ), 1, 2, 3, 1 );
818 aName = QString::null;
821 else if ( aAnswer == 2 ) // not save to this file
822 anOldPath = aName; // not to return to the same initial dir at each "while" step
823 else // overwrite the existing file
834 /*!\retval QString - return directory name from dialog.*/
835 QString STD_Application::getDirectory( const QString& initial, const QString& caption, QWidget* parent )
839 return QFileDialog::getExistingDirectory( initial, parent, 0, caption, true );
844 \param desk - new desktop
846 void STD_Application::setDesktop( SUIT_Desktop* desk )
848 SUIT_Desktop* prev = desktop();
850 SUIT_Application::setDesktop( desk );
852 if ( prev != desk && desk )
853 connect( desk, SIGNAL( closing( SUIT_Desktop*, QCloseEvent* ) ),
854 this, SLOT( onDesktopClosing( SUIT_Desktop*, QCloseEvent* ) ) );
858 Allow to load preferences before the desktop will be shown.
860 void STD_Application::loadPreferences()
865 Allow to save preferences before the application will be closed.
867 void STD_Application::savePreferences()
872 Custom activity after study is created
873 Updates desktop and actions
875 void STD_Application::studyCreated( SUIT_Study* )
877 updateDesktopTitle();
878 updateCommandsStatus();
882 Custom activity after study is opened
883 Updates desktop and actions
885 void STD_Application::studyOpened( SUIT_Study* )
887 updateDesktopTitle();
888 updateCommandsStatus();
892 Custom activity after study is opened
893 Updates desktop and actions
895 void STD_Application::studySaved( SUIT_Study* )
897 updateDesktopTitle();
898 updateCommandsStatus();