Mailinglist Archive: zypp-commit (185 mails)

< Previous Next >
[zypp-commit] r10873 - in /trunk/libzypp: package/libzypp.changes zypp/ui/Selectable.cc zypp/ui/Selectable.h zypp/ui/SelectableImpl.cc zypp/ui/SelectableImpl.h
  • From: mlandres@xxxxxxxxxxxxxxxx
  • Date: Fri, 15 Aug 2008 13:39:10 -0000
  • Message-id: <20080815133910.981252DF0C@xxxxxxxxxxxxxxxx>
Author: mlandres
Date: Fri Aug 15 15:39:10 2008
New Revision: 10873

URL: http://svn.opensuse.org/viewcvs/zypp?rev=10873&view=rev
Log:
- Fixes to Selectable doing staus manipulation on non-USER level.

Modified:
trunk/libzypp/package/libzypp.changes
trunk/libzypp/zypp/ui/Selectable.cc
trunk/libzypp/zypp/ui/Selectable.h
trunk/libzypp/zypp/ui/SelectableImpl.cc
trunk/libzypp/zypp/ui/SelectableImpl.h

Modified: trunk/libzypp/package/libzypp.changes
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/package/libzypp.changes?rev=10873&r1=10872&r2=10873&view=diff
==============================================================================
--- trunk/libzypp/package/libzypp.changes (original)
+++ trunk/libzypp/package/libzypp.changes Fri Aug 15 15:39:10 2008
@@ -1,4 +1,10 @@
-------------------------------------------------------------------
+Fri Aug 15 15:30:32 CEST 2008 - ma@xxxxxxx
+
+- Fixes to Selectable doing staus manipulation on non-USER level.
+- revision 10873
+
+-------------------------------------------------------------------
Fri Aug 15 14:23:02 CEST 2008 - ma@xxxxxxx

- Add method ZYpp::getTarget that returns the Target or a NULL pointer,

Modified: trunk/libzypp/zypp/ui/Selectable.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/Selectable.cc?rev=10873&r1=10872&r2=10873&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/Selectable.cc (original)
+++ trunk/libzypp/zypp/ui/Selectable.cc Fri Aug 15 15:39:10 2008
@@ -73,8 +73,11 @@
PoolItem Selectable::candidateObj() const
{ return _pimpl->candidateObj(); }

- PoolItem Selectable::setCandidate( ResObject::constPtr byUser_r )
- { return _pimpl->setCandidate( byUser_r ); }
+ PoolItem Selectable::setCandidate( const PoolItem & newCandidate_r,
ResStatus::TransactByValue causer_r )
+ { return _pimpl->setCandidate( newCandidate_r, causer_r ); }
+
+ PoolItem Selectable::setCandidate( ResObject::constPtr newCandidate_r,
ResStatus::TransactByValue causer_r )
+ { return _pimpl->setCandidate( PoolItem( newCandidate_r ), causer_r ); }

PoolItem Selectable::theObj() const
{ return _pimpl->theObj(); }

Modified: trunk/libzypp/zypp/ui/Selectable.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/Selectable.h?rev=10873&r1=10872&r2=10873&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/Selectable.h (original)
+++ trunk/libzypp/zypp/ui/Selectable.h Fri Aug 15 15:39:10 2008
@@ -128,8 +128,13 @@
* \return The new candidate, or NULL if choice was invalid
* (NULL or not among availableObjs). An invalid choice
* selects the default candidate.
- */
- PoolItem setCandidate( ResObject::constPtr byUser_r );
+ * In case the causer is not \c ResStatus::USER the operation
+ * may also fail if there are insufficient permissions to change
+ * a transacting candidate.
+ */
+ PoolItem setCandidate( const PoolItem & newCandidate_r,
ResStatus::TransactByValue causer_r = ResStatus::USER );
+ /** \overload */
+ PoolItem setCandidate( ResObject::constPtr newCandidate_r,
ResStatus::TransactByValue causer_r = ResStatus::USER );

/** Best among all objects. */
PoolItem theObj() const;

Modified: trunk/libzypp/zypp/ui/SelectableImpl.cc
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/SelectableImpl.cc?rev=10873&r1=10872&r2=10873&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/SelectableImpl.cc (original)
+++ trunk/libzypp/zypp/ui/SelectableImpl.cc Fri Aug 15 15:39:10 2008
@@ -283,35 +283,44 @@
return false;
}

- PoolItem Selectable::Impl::setCandidate( ResObject::constPtr byUser_r )
+ PoolItem Selectable::Impl::setCandidate( const PoolItem & newCandidate_r,
ResStatus::TransactByValue causer_r )
{
- _candidate = PoolItem();
+ PoolItem newCandidate;

- if ( byUser_r ) // must be in available list
+ if ( newCandidate_r ) // must be in available list
+ {
+ for_( it, availableBegin(), availableEnd() )
{
- for ( available_const_iterator it = availableBegin();
- it != availableEnd(); ++it )
- {
- if ( it->resolvable() == byUser_r )
- {
- _candidate = *it;
- break;
- }
- }
+ if ( *it == newCandidate_r )
+ {
+ newCandidate = *it;
+ break;
+ }
}
+ }

- if ( _candidate )
+ if ( newCandidate )
+ {
+ PoolItem trans( transactingCandidate() );
+ if ( trans && trans != newCandidate )
{
- PoolItem trans( transactingCandidate() );
- if ( trans && trans != _candidate )
- {
- // adjust transact to the new cancidate
- trans.status().setTransact( false, ResStatus::USER );
- _candidate.status().setTransact( true, ResStatus::USER );
- }
+ // adjust transact to the new cancidate
+ if ( trans.status().maySetTransact( false, causer_r )
+ && newCandidate.status().maySetTransact( true, causer_r ) )
+ {
+ trans.status().setTransact( false, causer_r );
+ newCandidate.status().setTransact( true, causer_r );
+ }
+ else
+ {
+ // No permission to change a transacting candidate.
+ // Leave _candidate untouched and return NULL.
+ return PoolItem();
+ }
}
+ }

- return _candidate;
+ return _candidate = newCandidate;
}

ResStatus::TransactByValue Selectable::Impl::modifiedBy() const

Modified: trunk/libzypp/zypp/ui/SelectableImpl.h
URL:
http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/SelectableImpl.h?rev=10873&r1=10872&r2=10873&view=diff
==============================================================================
--- trunk/libzypp/zypp/ui/SelectableImpl.h (original)
+++ trunk/libzypp/zypp/ui/SelectableImpl.h Fri Aug 15 15:39:10 2008
@@ -68,7 +68,6 @@
else
_availableItems.insert( *it );
}
- setCandidate( NULL );
}

public:
@@ -117,7 +116,7 @@
* \return The new userCandidate or NULL if choice was invalid
* (not among availableObjs).
*/
- PoolItem setCandidate( ResObject::constPtr byUser_r );
+ PoolItem setCandidate( const PoolItem & newCandidate_r,
ResStatus::TransactByValue causer_r );

/** Best among all objects. */
PoolItem theObj() const

--
To unsubscribe, e-mail: zypp-commit+unsubscribe@xxxxxxxxxxxx
For additional commands, e-mail: zypp-commit+help@xxxxxxxxxxxx

< Previous Next >
This Thread
  • No further messages