From 9071732e25455fb2f193d90d9b590ad25b8f8791 Mon Sep 17 00:00:00 2001 From: stv Date: Thu, 12 Apr 2007 11:03:31 +0000 Subject: [PATCH] no message --- src/SUIT/SUIT_Operation.cxx | 32 ++++++++++++++++++++++++++++---- src/SUIT/SUIT_Operation.h | 8 +++++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/src/SUIT/SUIT_Operation.cxx b/src/SUIT/SUIT_Operation.cxx index 658ff2017..12b654cd6 100755 --- a/src/SUIT/SUIT_Operation.cxx +++ b/src/SUIT/SUIT_Operation.cxx @@ -299,6 +299,14 @@ void SUIT_Operation::startOperation() */ void SUIT_Operation::stopOperation() { + if ( myChildOperations.isEmpty() ) + return; + + OpList lst = myChildOperations; + for ( QPtrListIterator it( lst ); it.current(); ++it ) + it.current()->abort(); + + myChildOperations.clear(); } /*! @@ -414,14 +422,18 @@ void SUIT_Operation::start( SUIT_Operation* op, const bool check ) { if ( !op ) return; - + + if ( myChildOperations.contains( op ) ) + return; + + myChildOperations.append( op ); + connect( op, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) ); + connect( op, SIGNAL( stopped( SUIT_Operation* ) ), this, SLOT( onStopped( SUIT_Operation* ) ) ); + if ( study() ) study()->start( op, check ); else - { - connect( this, SIGNAL( stopped( SUIT_Operation* ) ), op, SLOT( abort() ) ); op->start(); - } } /*! @@ -489,3 +501,15 @@ bool SUIT_Operation::hasTransaction() const return study()->hasTransaction(); } + +void SUIT_Operation::onDestroyed( QObject* obj ) +{ + myChildOperations.remove( (SUIT_Operation*)obj ); +} + +void SUIT_Operation::onStopped( SUIT_Operation* op ) +{ + myChildOperations.remove( op ); + disconnect( op, SIGNAL( destroyed( QObject* ) ), this, SLOT( onDestroyed( QObject* ) ) ); + disconnect( op, SIGNAL( stopped( SUIT_Operation* ) ), this, SLOT( onStopped( SUIT_Operation* ) ) ); +} diff --git a/src/SUIT/SUIT_Operation.h b/src/SUIT/SUIT_Operation.h index 4f1b617b9..7b3549718 100755 --- a/src/SUIT/SUIT_Operation.h +++ b/src/SUIT/SUIT_Operation.h @@ -135,6 +135,10 @@ public slots: void resume(); void suspend(); +private slots: + void onDestroyed( QObject* ); + void onStopped( SUIT_Operation* ); + protected: virtual bool isReadyToStart() const; @@ -158,7 +162,8 @@ protected: void start( SUIT_Operation*, const bool = false ); private: - typedef QGuardedPtr StudyPtr; + typedef QGuardedPtr StudyPtr; + typedef QPtrList OpList; private: SUIT_Application* myApp; //!< application for this operation @@ -166,6 +171,7 @@ private: StudyPtr myStudy; //!< study for this operation OperationState myState; //!< Operation state ExecStatus myExecStatus; //!< Execution status + OpList myChildOperations; friend class SUIT_Study; }; -- 2.39.2