Author: jreidinger Date: Tue Jun 3 15:39:52 2008 New Revision: 10331 URL: http://svn.opensuse.org/viewcvs/zypp?rev=10331&view=rev Log: allow aborting progress during removing packages. (bnc #389238) Modified: trunk/libzypp/zypp/target/TargetCallbackReceiver.cc trunk/libzypp/zypp/target/TargetCallbackReceiver.h trunk/libzypp/zypp/target/TargetImpl.cc Modified: trunk/libzypp/zypp/target/TargetCallbackReceiver.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetCallbackReceiver.cc?rev=10331&r1=10330&r2=10331&view=diff ============================================================================== --- trunk/libzypp/zypp/target/TargetCallbackReceiver.cc (original) +++ trunk/libzypp/zypp/target/TargetCallbackReceiver.cc Tue Jun 3 15:39:52 2008 @@ -105,6 +105,7 @@ RpmRemovePackageReceiver::RpmRemovePackageReceiver (Resolvable::constPtr res) : callback::ReceiveReportrpm::RpmRemoveReport () , _resolvable (res) + , _abort(false) { } @@ -132,7 +133,8 @@ */ bool RpmRemovePackageReceiver::progress( unsigned percent ) { - return _report->progress( percent, _resolvable ); + _abort = ! _report->progress( percent, _resolvable ); + return _abort; } rpm::RpmRemoveReport::Action Modified: trunk/libzypp/zypp/target/TargetCallbackReceiver.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetCallbackReceiver.h?rev=10331&r1=10330&r2=10331&view=diff ============================================================================== --- trunk/libzypp/zypp/target/TargetCallbackReceiver.h (original) +++ trunk/libzypp/zypp/target/TargetCallbackReceiver.h Tue Jun 3 15:39:52 2008 @@ -67,6 +67,8 @@ { callback::SendReport rpm::RemoveResolvableReport _report; Resolvable::constPtr _resolvable; + bool _abort; + public: @@ -86,6 +88,11 @@ */ virtual bool progress( unsigned percent ); + /** + * Returns true if removing is aborted during progress + */ + bool aborted() const { return _abort; } + /** inform user about a problem */ virtual rpm::RpmRemoveReport::Action problem( Exception & excpt_r ); Modified: trunk/libzypp/zypp/target/TargetImpl.cc URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/target/TargetImpl.cc?rev=10331&r1=10330&r2=10331&view=diff ============================================================================== --- trunk/libzypp/zypp/target/TargetImpl.cc (original) +++ trunk/libzypp/zypp/target/TargetImpl.cc Tue Jun 3 15:39:52 2008 @@ -700,6 +700,15 @@ try { rpm().removePackage( p, flags ); + + if ( progress.aborted() ) + { + WAR << "commit aborted by the user" << endl; + progress.disconnect(); + success = false; + abort = true; + break; + } } catch (Exception & excpt_r) { @@ -811,7 +820,7 @@ } if ( abort ) - ZYPP_THROW( TargetAbortedException( N_("Installation has been aborted as directed.") ) ); + ZYPP_THROW( TargetAbortedException( N_("Installation/Removing has been aborted as directed.") ) ); return remaining; } -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org