Summary: | wrong date sort order in `find messages' window | ||
---|---|---|---|
Product: | [Unmaintained] kmail | Reporter: | tim blechmann <tim> |
Component: | search | Assignee: | kdepim bugs <kdepim-bugs> |
Status: | RESOLVED FIXED | ||
Severity: | normal | CC: | csights, fischer, gartrog, montel |
Priority: | NOR | ||
Version: | 1.13.5 | ||
Target Milestone: | --- | ||
Platform: | Ubuntu | ||
OS: | Linux | ||
Latest Commit: | Version Fixed In: | ||
Sentry Crash Report: |
Description
tim blechmann
2010-09-13 23:40:37 UTC
I can confirm this bug. KMail 1.13.5, KDE 4.5.2 I can confirm this bug. KMail 1.13.5, KDE 4.4.5 The problem is that the list widget uses a lexicographical comparison by default. To solve this issue, instead of using QTreeWidgetItem objects to represent search results, a new class has to derived here which re-implements the sorting function (more specifically, how two entries are compared). My idea would be as follows (not compiled, not tested, may not work at all!): const int ColumnDate=2; class MatchListViewItem : public QTreeWidgetItem { private: MatchListView *parent; public: MatchListViewItem(MatchListView *p) : QTreeWidgetItem(p), parent(p) { // empty }; bool operator<( const QTreeWidgetItem & other ) const { switch(parent->sortColumn()) { case ColumnDate: return QDate::fromString(text(ColumnDate)).operator<(QDate::fromString(other.text(ColumnDate))); default: return QTreeWidgetItem::operator<(other); } } }; In function SearchWindow::slotAddMsg, use this class instead of QTreeWidgetItem when adding more results. Maybe I'll test and refine this code later today... (In reply to comment #3) > The problem is that the list widget uses a lexicographical comparison by > default. To solve this issue, instead of using QTreeWidgetItem objects to > represent search results, a new class has to derived here which re-implements > the sorting function (more specifically, how two entries are compared). > [...] > In function SearchWindow::slotAddMsg, use this class instead of QTreeWidgetItem > when adding more results. > Maybe I'll test and refine this code later today... My simple code above would not work, as the date strings are localized and not easy to compare. A better implementation would be to use nice model/view approach which has already been implemented in trunk and 4.5beta1 (not tested myself, yet). Therefore I propose to close this bug as soon as Kontact / KMail 4.5 becomes stable. Maybe mark this bug until then as WONTFIX? I fixed this bug yesterday I close it |