Salome HOME
projects
/
modules
/
gui.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge remote branch 'origin/V7_dev'
[modules/gui.git]
/
src
/
STD
/
STD_Application.cxx
diff --git
a/src/STD/STD_Application.cxx
b/src/STD/STD_Application.cxx
index 51354196a3206ef9b134cf0a9dca08ab68e1e18e..ff308b7d78cb620f6f5186a717cef3b1fe4d3fc2 100755
(executable)
--- a/
src/STD/STD_Application.cxx
+++ b/
src/STD/STD_Application.cxx
@@
-1,4
+1,4
@@
-// Copyright (C) 2007-201
4
CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-201
6
CEA/DEN, EDF R&D, OPEN CASCADE
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
//
// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@
-111,7
+111,7
@@
void STD_Application::closeApplication()
beforeCloseDoc( study );
study->closeDocument();
beforeCloseDoc( study );
study->closeDocument();
-
+ emit appClosed();
setActiveStudy( 0 );
delete study;
setActiveStudy( 0 );
delete study;
@@
-321,9
+321,12
@@
void STD_Application::onOpenDoc()
onOpenDoc( aName );
}
onOpenDoc( aName );
}
-/*! \retval
true, if document was opened successful, else
false.*/
+/*! \retval
\c true, if document was opened successful, else \c
false.*/
bool STD_Application::onOpenDoc( const QString& aName )
{
bool STD_Application::onOpenDoc( const QString& aName )
{
+ if ( !abortAllOperations() )
+ return false;
+
QApplication::setOverrideCursor( Qt::WaitCursor );
bool res = openAction( openChoice( aName ), aName );
QApplication::setOverrideCursor( Qt::WaitCursor );
bool res = openAction( openChoice( aName ), aName );
@@
-356,8
+359,6
@@
bool STD_Application::onReopenDoc()
// update views / windows / status bar / title
clearViewManagers();
setActiveStudy( 0 );
// update views / windows / status bar / title
clearViewManagers();
setActiveStudy( 0 );
- updateDesktopTitle();
- updateCommandsStatus();
// delete study
delete study;
// delete study
delete study;
@@
-366,13
+367,21
@@
bool STD_Application::onReopenDoc()
// post closing actions
afterCloseDoc();
// post closing actions
afterCloseDoc();
+ int aNbStudies = 0;
+ QList<SUIT_Application*> apps = SUIT_Session::session()->applications();
+ for ( int i = 0; i < apps.count(); i++ )
+ aNbStudies += apps.at( i )->getNbStudies();
+
// reload study from the file
res = useFile( studyName ) && activeStudy();
// if reloading is failed, close the desktop
// reload study from the file
res = useFile( studyName ) && activeStudy();
// if reloading is failed, close the desktop
- if ( !res ) {
- setDesktop( 0 );
+ if ( aNbStudies && !res )
closeApplication();
closeApplication();
+ else
+ {
+ updateDesktopTitle();
+ updateCommandsStatus();
}
}
return res;
}
}
return res;
@@
-409,6
+418,8
@@
bool STD_Application::closeDoc( bool ask )
bool STD_Application::closeActiveDoc( bool permanently )
{
SUIT_Study* study = activeStudy();
bool STD_Application::closeActiveDoc( bool permanently )
{
SUIT_Study* study = activeStudy();
+ if ( !study ) // no active study
+ return true;
beforeCloseDoc( study );
beforeCloseDoc( study );
@@
-446,7
+457,7
@@
bool STD_Application::closeActiveDoc( bool permanently )
}
/*!Check the application on closing.
}
/*!Check the application on closing.
- * \retval
true if possible, else
false
+ * \retval
\c true if possible, else \c
false
*/
bool STD_Application::isPossibleToClose( bool& closePermanently )
{
*/
bool STD_Application::isPossibleToClose( bool& closePermanently )
{
@@
-556,6
+567,9
@@
void STD_Application::onSaveDoc()
if ( !activeStudy() )
return;
if ( !activeStudy() )
return;
+ if ( !abortAllOperations() )
+ return;
+
bool isOk = false;
if ( activeStudy()->isSaved() )
{
bool isOk = false;
if ( activeStudy()->isSaved() )
{
@@
-584,13
+598,16
@@
void STD_Application::onSaveDoc()
onSaveAsDoc();
}
onSaveAsDoc();
}
-/*! \retval
TRUE, if doument saved successful, else FALSE
.*/
+/*! \retval
\c true, if document saved successfully, else \c false
.*/
bool STD_Application::onSaveAsDoc()
{
SUIT_Study* study = activeStudy();
if ( !study )
return false;
bool STD_Application::onSaveAsDoc()
{
SUIT_Study* study = activeStudy();
if ( !study )
return false;
+ if ( !abortAllOperations() )
+ return false;
+
bool isOk = false;
while ( !isOk )
{
bool isOk = false;
while ( !isOk )
{
@@
-652,7
+669,7
@@
void STD_Application::setEditEnabled( bool theEnable )
}
}
}
}
-/*!\retval
true, if document opened successful, else
false.*/
+/*!\retval
\c true, if document opened successfully, else \c
false.*/
bool STD_Application::useFile(const QString& theFileName)
{
bool res = SUIT_Application::useFile( theFileName );
bool STD_Application::useFile(const QString& theFileName)
{
bool res = SUIT_Application::useFile( theFileName );
@@
-802,7
+819,7
@@
void STD_Application::clearViewManagers()
}
}
}
}
-/*!\retval
TRUE
, if view manager \a vm, already in view manager list (\a myViewMgrs).*/
+/*!\retval
\c true
, if view manager \a vm, already in view manager list (\a myViewMgrs).*/
bool STD_Application::containsViewManager( SUIT_ViewManager* vm ) const
{
return myViewMgrs.contains( vm );
bool STD_Application::containsViewManager( SUIT_ViewManager* vm ) const
{
return myViewMgrs.contains( vm );
@@
-814,7
+831,7
@@
void STD_Application::onViewManagerActivated( SUIT_ViewManager* vm )
setActiveViewManager( vm );
}
setActiveViewManager( vm );
}
-/*!S
ets status bar show, if \on = true, else status bar hide
.*/
+/*!S
hows status bar, if on is \c true, else hides status bar
.*/
void STD_Application::onViewStatusBar( bool on )
{
if ( on )
void STD_Application::onViewStatusBar( bool on )
{
if ( on )
@@
-1005,3
+1022,11
@@
int STD_Application::viewManagerId( const SUIT_ViewManager* theManager) const
return myViewMgrs.indexOf(const_cast<SUIT_ViewManager*>(theManager));
}
return myViewMgrs.indexOf(const_cast<SUIT_ViewManager*>(theManager));
}
+/*!
+ \brief Abort active operations if there are any
+ \return \c false if some operation cannot be aborted
+*/
+bool STD_Application::abortAllOperations()
+{
+ return true;
+}