diff options
Diffstat (limited to 'kshowmail/showlistviewitem.cpp')
-rw-r--r-- | kshowmail/showlistviewitem.cpp | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/kshowmail/showlistviewitem.cpp b/kshowmail/showlistviewitem.cpp new file mode 100644 index 0000000..e95ce94 --- /dev/null +++ b/kshowmail/showlistviewitem.cpp @@ -0,0 +1,114 @@ +/*************************************************************************** + showlistviewitem.cpp - description + ------------------- + begin : Son Apr 21 2002 + copyright : (C) 2002 by Eggert Ehmke + email : eggert.ehmke@berlin.de + ***************************************************************************/ + +/*************************************************************************** + * * + * This program is free software; you can redistribute it and/or modify * + * it under the terms of the GNU General Public License as published by * + * the Free Software Foundation; either version 2 of the License, or * + * (at your option) any later version. * + * * + ***************************************************************************/ + +#include "showlistviewitem.h" + +ShowListViewItem::ShowListViewItem (QListView * parent, + ShowListViewItem* after): +QListViewItem (parent, after) +{} + +ShowListViewItem::ShowListViewItem( QListView * parent ) : + QListViewItem( parent ) +{ +} + +ShowListViewItem::~ShowListViewItem() +{} + +QString ShowListViewItem::key (int column, bool /*ascending*/) const +{ + switch (column) + { + case _colNumber: + return text (_colAccount) + text (_colNumber); + case _colDate: + return m_time; + default: + return text (column); + } +} + +/** + * reimplement compare to solve bug #856005 + * standard compare is locale dependant + */ +int ShowListViewItem::compare( QListViewItem *i, int col, + bool ascending ) const +{ + if( col == _colNumber ) + { + return text( _colNumber ).toInt() - i->text( _colNumber ).toInt(); + } + else if( col == _colSize ) + { + return text( _colSize ).toInt() - i->text( _colSize ).toInt(); + } + else + return key( col, ascending ).compare( i->key( col, ascending) ); +} + +void ShowListViewItem::setNumber (const QString& number) +{ + setText (_colNumber, number); +} + +void ShowListViewItem::setAccount(const QString& account) +{ + setText (_colAccount, account); +} + +void ShowListViewItem::setFrom(const QString& from) +{ + setText (_colFrom, from); +} + +void ShowListViewItem::setTo(const QString& to) +{ + setText (_colTo, to); +} + +void ShowListViewItem::setSubject(const QString& subject) +{ + setText (_colSubject, subject); +} + +void ShowListViewItem::setDate(const QString& date) +{ + setText (_colDate, date); +} + +void ShowListViewItem::setSize(const QString& size) +{ + setText (_colSize, size); +} + +void ShowListViewItem::setContent(const QString& content) +{ + setText (_colContent, content); +} + +void ShowListViewItem::setState(const QString& state) +{ + setText (_colState, state); +} + +void ShowListViewItem::setTime (const QString& time) +{ + m_time = time; +} + |