Bug 82022

Summary: Allow sorting on date, title etc
Product: [Applications] akregator Reporter: Stian Haklev <shaklev>
Component: generalAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: wishlist CC: adam.rykala, marco.montagnana
Priority: NOR    
Version: 1.0-beta1   
Target Milestone: ---   
Platform: unspecified   
OS: Linux   
Latest Commit: Version Fixed In:

Description Stian Haklev 2004-05-22 21:27:31 UTC
Version:           1.0-beta1 (using KDE KDE 3.2.2)
OS:                Linux

Not much more to add. The date time should be listed in the article view, and the title and date field should be clickable to sort by it (as in all modern UIs).
Comment 1 Sashmit Bhaduri 2004-05-23 00:47:27 UTC
I agree.. defaults should be article title and date, with the capability of showing author, catagory, etc.., like juk. 
Comment 2 Sashmit Bhaduri 2004-08-27 02:08:48 UTC
*** Bug 88183 has been marked as a duplicate of this bug. ***
Comment 3 Sashmit Bhaduri 2004-10-14 22:15:17 UTC
*** Bug 84315 has been marked as a duplicate of this bug. ***
Comment 4 George Staikos 2004-12-02 07:48:50 UTC
Anyone object to me making the columns sortable, defaulting to sorting by date with the most recent at the top?
Comment 5 George Staikos 2004-12-02 16:33:34 UTC
CVS commit by staikos: 

add proper sorting support (clicking on columns)
FEATURE: 82022


  M +15 -15    articlelist.cpp   1.27
  M +1 -1      articlelist.h   1.19


--- kdenonbeta/akregator/src/articlelist.cpp  #1.26:1.27
@@ -52,18 +52,4 @@ ArticleListItem::~ArticleListItem()
 }
 
-/*
-int ArticleListItem::compare( QListViewItem *i, int col, bool ascending ) const
-{
-    ArticleListItem *item = static_cast<ArticleListItem *>(i);
-    if (!item) return 0;
-
-    if ( item->d->article.pubDate().isValid() && d->article.pubDate().isValid() )
-    {
-        int diff = d->article.pubDate().secsTo( item->d->article.pubDate() );
-        return ascending ? diff : -diff;
-    }
-
-    return 0;
-}*/
 
 MyArticle& ArticleListItem::article()
@@ -93,4 +79,16 @@ void ArticleListItem::paintCell ( QPaint
 
 
+int ArticleListItem::compare(QListViewItem *i, int col, bool ascending) const {
+    if (col == 1) {
+        ArticleListItem *item = dynamic_cast<ArticleListItem *>(i);
+        if (item && item->d->article.pubDate().isValid() && d->article.pubDate().isValid()) {
+            return ascending ?
+                    item->d->article.pubDate().secsTo(d->article.pubDate()) :
+                    -d->article.pubDate().secsTo(item->d->article.pubDate());
+        }
+    }
+    return KListViewItem::compare(i, col, ascending);
+}
+
 /* ==================================================================================== */
 
@@ -108,5 +106,7 @@ ArticleList::ArticleList(QWidget *parent
     setAcceptDrops(false); // FIXME before we implement dragging between archived feeds??
     setFullWidth(false);
-    setSorting(-1); // do not sort in the listview, Feed will take care of sorting
+    //setSorting(-1); // do not sort in the listview, Feed will take care of sorting
+    setSorting(1, false);
+    setShowSortIndicator(true);
     setDragAutoScroll(true);
     setDropHighlighter(false);

--- kdenonbeta/akregator/src/articlelist.h  #1.18:1.19
@@ -30,5 +30,5 @@ namespace Akregator
             Feed *feed();
             void paintCell ( QPainter * p, const QColorGroup & cg, int column, int width, int align );
-            
+            virtual int compare(QListViewItem *i, int col, bool ascending) const;
         private:
             struct Private;


Comment 6 squan 2004-12-02 20:31:18 UTC
Great!

I supposed that it could not so much work because the QListView has inbuilt sorting capability  :)

Will this be part of a 1.0_beta9?
Or do I have to access CVS now?