Selectable: Sort multiple installed items by (Arch, Edition, install time).
authorMichael Andres <ma@suse.de>
Wed, 28 Oct 2009 14:27:35 +0000 (15:27 +0100)
committerMichael Andres <ma@suse.de>
Wed, 28 Oct 2009 14:27:35 +0000 (15:27 +0100)
zypp/ui/SelectableTraits.h

index c940289..b994bf7 100644 (file)
@@ -66,7 +66,10 @@ namespace zypp
       };
 
       /** Oder on InstalledItemSet.
-       * Newer install time at the beginning of the set.
+       * \li best Arch
+       * \li best Edition
+       * \li newer install time
+       * \li ResObject::constPtr as fallback.
       */
       struct IOrder : public std::binary_function<PoolItem,PoolItem,bool>
       {
@@ -76,6 +79,12 @@ namespace zypp
         //
         bool operator()( const PoolItem & lhs, const PoolItem & rhs ) const
         {
+          int res = lhs->arch().compare( rhs->arch() );
+          if ( res )
+            return res > 0;
+          res = lhs->edition().compare( rhs->edition() );
+          if ( res )
+            return res > 0;
           Date ldate = lhs->installtime();
           Date rdate = rhs->installtime();
           if ( ldate != rdate )