Author: jkupec Date: Mon Nov 17 23:29:53 2008 New Revision: 11699 URL: http://svn.opensuse.org/viewcvs/zypp?rev=11699&view=rev Log: - comments and ident Modified: trunk/libzypp/zypp/ui/Selectable.h trunk/libzypp/zypp/ui/SelectableImpl.h Modified: trunk/libzypp/zypp/ui/Selectable.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/Selectable.h?rev=... ============================================================================== --- trunk/libzypp/zypp/ui/Selectable.h (original) +++ trunk/libzypp/zypp/ui/Selectable.h Mon Nov 17 23:29:53 2008 @@ -119,8 +119,16 @@ /** The last Installed object. */ PoolItem installedObj() const; - /** Best among available objects. - * The user selected candiate, or a default. + /** + * Returns one of available objects, specifically either the user + * selected candidate or a default. + * + * Default is either the first available object which has the same arch + * as one of the installed objects, or the first available object + * (if none of available arch matches the arch of the installed objects), + * or empty. + * + * \return a PoolItem according to the describe criteria. */ PoolItem candidateObj() const; @@ -156,7 +164,13 @@ /** \overload */ PoolItem setCandidate( ResObject::constPtr newCandidate_r, ResStatus::TransactByValue causer_r = ResStatus::USER ); - /** Best among all objects. */ + /** + * The object whose summary to show in the UIs. + * + * \return the \ref candidateObj(), if not empty, or the first of installed + * objects or an empty \ref PoolItem. + * \see candidateObj() + */ PoolItem theObj() const; //////////////////////////////////////////////////////////////////////// Modified: trunk/libzypp/zypp/ui/SelectableImpl.h URL: http://svn.opensuse.org/viewcvs/zypp/trunk/libzypp/zypp/ui/SelectableImpl.h?... ============================================================================== --- trunk/libzypp/zypp/ui/SelectableImpl.h (original) +++ trunk/libzypp/zypp/ui/SelectableImpl.h Mon Nov 17 23:29:53 2008 @@ -212,23 +212,25 @@ PoolItem defaultCandidate() const { if ( !installedEmpty() ) + { + // prefer the installed objects arch. + //! \todo FIXME this is semi-random(?); should rather look for such installed + //! object's arch which best matches the system arch + for ( installed_const_iterator iit = installedBegin(); + iit != installedEnd(); ++iit ) { - // prefer the installed objects arch. - for ( installed_const_iterator iit = installedBegin(); - iit != installedEnd(); ++iit ) + for ( available_const_iterator it = availableBegin(); + it != availableEnd(); ++it ) { - for ( available_const_iterator it = availableBegin(); - it != availableEnd(); ++it ) - { - if ( (*iit)->arch() == (*it)->arch() ) - { - return (*it); - } - } + if ( (*iit)->arch() == (*it)->arch() ) + { + return (*it); + } } } + } if ( _availableItems.empty() ) - return PoolItem(); + return PoolItem(); return *_availableItems.begin(); } @@ -250,6 +252,7 @@ const std::string _name; InstalledItemSet _installedItems; AvailableItemSet _availableItems; + //! The object selected by setCandidateObj() method. PoolItem _candidate; }; /////////////////////////////////////////////////////////////////// @@ -275,7 +278,7 @@ if ( obj.installedEmpty() ) str << endl << " "; dumpRange( str << " (A " << obj.availableSize() << ") ", obj.availableBegin(), obj.availableEnd() ) << endl; - + return str; } ///////////////////////////////////////////////////////////////// -- To unsubscribe, e-mail: zypp-commit+unsubscribe@opensuse.org For additional commands, e-mail: zypp-commit+help@opensuse.org