Summary: | Allow sorting on date, title etc | ||
---|---|---|---|
Product: | [Applications] akregator | Reporter: | Stian Haklev <shaklev> |
Component: | general | Assignee: | 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
I agree.. defaults should be article title and date, with the capability of showing author, catagory, etc.., like juk. *** Bug 88183 has been marked as a duplicate of this bug. *** *** Bug 84315 has been marked as a duplicate of this bug. *** Anyone object to me making the columns sortable, defaulting to sorting by date with the most recent at the top? 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; 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? |