[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    PATCH: KNode - KNHdrViewItem
From:       Scott Wheeler <scott () slackorama ! net>
Date:       2002-07-09 0:30:35
[Download RAW message or body]

Sorting for articles has been broken in KNode for a couple of days.  I looked 
at the CVS logs and this happened when KNLVItemBase switched its base class 
from KListViewItem to KFolderTreeItem (from libkdenetwork).  

However, it appears that KFolderTreeItem is primarily intended to be used on 
the list of folders on the left and as such the compare() function is 
overridden to sort that list.  This really messed up the sorting of messages.

I'm not sure this is the "right" fix, but what I did was to override compare() 
in KNHdrViewItem (a subclass of KNLVItemBase) to restore the default 
QListViewItem behavior (which was being used before, and in fact works).

Ok, quiz, who followed all of the QListViewItem subclasses? :-)

Anyway, I'll commit this tomorrow if noone objects.

-Scott
["knhdrviewitem.patch" (text/x-diff)]

Index: knhdrviewitem.cpp
===================================================================
RCS file: /home/kde/kdenetwork/knode/knhdrviewitem.cpp,v
retrieving revision 1.24
diff -u -3 -p -r1.24 knhdrviewitem.cpp
--- knhdrviewitem.cpp	2002/03/11 17:47:40	1.24
+++ knhdrviewitem.cpp	2002/07/09 00:22:03
@@ -52,6 +52,11 @@ QString KNHdrViewItem::key(int col, bool
   return text(col);
 }
 
+int KNHdrViewItem::compare(QListViewItem *i, int col, bool ascending) const
+{
+  return key(col, ascending).localeAwareCompare(i->key(col, ascending));
+}
+
 
 QDragObject* KNHdrViewItem::dragObject()
 {
Index: knhdrviewitem.h
===================================================================
RCS file: /home/kde/kdenetwork/knode/knhdrviewitem.h,v
retrieving revision 1.12
diff -u -3 -p -r1.12 knhdrviewitem.h
--- knhdrviewitem.h	2002/03/11 17:47:40	1.12
+++ knhdrviewitem.h	2002/07/09 00:22:03
@@ -33,6 +33,7 @@ class KNHdrViewItem : public KNLVItemBas
     ~KNHdrViewItem();
 
     QString key(int, bool) const;
+    virtual int compare(QListViewItem *i, int col, bool ascending) const;
 
     // DND
     virtual QDragObject* dragObject();


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic