[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

kdenonbeta/kdedebian/kapture



CVS commit by mornfall: 

Fix sort order in acqprogress. Yay, we are getting there =).


  M +1 -2      TODO   1.23
  M +12 -11    libkapture/acqprogress.cpp   1.13
  M +2 -2      libkapture/acqprogress.h   1.9


--- kdenonbeta/kdedebian/kapture/TODO  #1.22:1.23
@@ -71,6 +71,5 @@
 ::: 0.3 (prealfa) :::
 
-  FINISH ACQPROGRESS IMPL IN LIBKAPTURE [done: 50%]
-  
+  FINISH ACQPROGRESS IMPL IN LIBKAPTURE [done: 60%]
 
   IMPLEMENT PACKAGEMANAGER (PM) INTERFACE [done: 50%]

--- kdenonbeta/kdedebian/kapture/libkapture/acqprogress.cpp  #1.12:1.13
@@ -45,4 +45,5 @@ kapture::AcqStatus::Item::Item (QListVie
     setText (2, SizeToStr (item . Owner -> FileSize) . c_str () + QString ("B"));
     setText (3, item . Description . c_str ());
+    // cerr << "create: id = " << item . Owner -> ID << ", myId = " << m_item . Owner -> ID << endl;
     if (hit)
         setText (0, "Hit");
@@ -73,11 +74,11 @@ kapture::AcqStatus::Item::~Item ()
 // AcqStatus::Item::compare - item comparison                       /* {{{ */
 // ---------------------------------------------------------------------
-int kapture::AcqStatus::Item::compare (QListViewItem *i, int col, bool ascend)
+int kapture::AcqStatus::Item::compare (QListViewItem *i, int col, bool ascend) const
 {
-    int id = ((Item *) i) -> m_id;
-    //if (ascend)
-        return (m_id <= id) - (m_id >= id);
-    //else
-    //    return (m_id <= id) - (m_id >= id)
+    int id1 = m_item . Owner -> ID;
+    int id2 = ((Item *) i) -> m_item . Owner -> ID;
+    // cerr << "compare: descr1 = " << m_item . Description << ", descr2 = " << ((Item *) i) -> m_item . Description << endl;
+    // cerr << "compare: id1 = " << id1 << ", id2 = " << id2 << endl;
+    return (id1 >= id2) - (id1 <= id2);
 }
                                                                     /* }}} */
@@ -162,9 +163,9 @@ void kapture::AcqStatus::Item::paintCell
 kapture::AcqStatus::Item *kapture::AcqStatus::findItem (pkgAcquire::ItemDesc &Itm)
 {
-    cerr << "find item: ID = "
+    /* cerr << "find item: ID = "
         << Itm . Owner -> ID
         << "; result = "
         << (void *)m_items [Itm . Owner -> ID]
-        << endl;
+        << endl; */
     return m_items [Itm . Owner -> ID];
 }
@@ -180,5 +181,5 @@ kapture::AcqStatus::AcqStatus(QWidget *p
     addColumn ("Size");
     addColumn ("Description");
-    // setSorting( -1, false );
+    setSorting (1);
     setColumnWidth (0, 120);
     setColumnWidth (1, 180);
@@ -214,7 +215,7 @@ void kapture::AcqStatus::Start()
 void kapture::AcqStatus::IMSHit(pkgAcquire::ItemDesc &Itm)
 {
+    Itm . Owner -> ID = ID ++;
     Item *i = new Item (this, Itm, true);
     i -> setProgress (100);
-    ID ++;
     m_items . push_back (i);
     Update = true; // XXX what?

--- kdenonbeta/kdedebian/kapture/libkapture/acqprogress.h  #1.8:1.9
@@ -42,5 +42,5 @@ namespace kapture {
                             int column, int width, int alignment);
                     virtual ~Item ();
-                    virtual int compare (QListViewItem *i, int col, bool ascend);
+                    virtual int compare (QListViewItem *i, int col, bool ascend) const;
                     virtual void pulse (pkgAcquire::Worker *);
             };




Reply to: