Diffstat (limited to 'kmicromail/mailistviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 5119744..15fa148 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -1,93 +1,94 @@ | |||
1 | // CHANGED 2004-08-06 Lutz Rogowski | 1 | // CHANGED 2004-08-06 Lutz Rogowski |
2 | #include "mailistviewitem.h" | 2 | #include "mailistviewitem.h" |
3 | #include <libmailwrapper/abstractmail.h> | 3 | #include <libmailwrapper/abstractmail.h> |
4 | #include <qtextstream.h> | 4 | #include <qtextstream.h> |
5 | #include <kiconloader.h> | 5 | #include <kiconloader.h> |
6 | #include "koprefs.h" | 6 | #include "koprefs.h" |
7 | //#include <qpe/resource.h> | 7 | //#include <qpe/resource.h> |
8 | 8 | ||
9 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 9 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
10 | :QListViewItem(parent,item),mail_data() | 10 | :KListViewItem(parent,item),mail_data() |
11 | { | 11 | { |
12 | } | 12 | } |
13 | 13 | ||
14 | void MailListViewItem::showEntry() | 14 | void MailListViewItem::showEntry() |
15 | { | 15 | { |
16 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { | 16 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { |
17 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); | 17 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); |
18 | mKeyMap.insert(0, "r" ); | 18 | mKeyMap.insert(0, "r" ); |
19 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { | 19 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { |
20 | /* I think it looks nicer if there are not such a log of icons but only on mails | 20 | /* I think it looks nicer if there are not such a log of icons but only on mails |
21 | replied or new - Alwin*/ | 21 | replied or new - Alwin*/ |
22 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); | 22 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); |
23 | mKeyMap.insert(0, "s" ); | 23 | mKeyMap.insert(0, "s" ); |
24 | } else { | 24 | } else { |
25 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); | 25 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); |
26 | mKeyMap.insert(0, "u" ); | 26 | mKeyMap.insert(0, "u" ); |
27 | } | 27 | } |
28 | QString fsize = mail_data->MsgsizeString(); | 28 | QString fsize = mail_data->MsgsizeString(); |
29 | // 1.23 | 29 | // 1.23 |
30 | // 11.23 | 30 | // 11.23 |
31 | // 111.23 | 31 | // 111.23 |
32 | // 999.23 maxlen | 32 | // 999.23 maxlen |
33 | QString fsort; | 33 | QString fsort; |
34 | switch(fsize.length() ) { | 34 | switch(fsize.length() ) { |
35 | case 6: | 35 | case 6: |
36 | fsort = "00" + fsize ; | 36 | fsort = "00" + fsize ; |
37 | break; | 37 | break; |
38 | case 7: | 38 | case 7: |
39 | fsort = "0" + fsize ; | 39 | fsort = "0" + fsize ; |
40 | break; | 40 | break; |
41 | default: | 41 | default: |
42 | fsort = fsize ; | 42 | fsort = fsize ; |
43 | break; | 43 | break; |
44 | 44 | ||
45 | } | 45 | } |
46 | |||
46 | setText(3, fsize ); | 47 | setText(3, fsize ); |
47 | //qDebug("fsize *%s* ",fsize.latin1() ); | 48 | //qDebug("fsize *%s* ",fsize.latin1() ); |
48 | //qDebug("fsort *%s* ",fsort.latin1() ); | 49 | //qDebug("fsort *%s* ",fsort.latin1() ); |
49 | if ( fsize.right(2) == "kB" ) { | 50 | if ( fsize.right(2) == "kB" ) { |
50 | mKeyMap.insert(3, "k" + fsort); | 51 | mKeyMap.insert(3, "k" + fsort); |
51 | } else { | 52 | } else { |
52 | mKeyMap.insert(3, "M" +fsort ); | 53 | mKeyMap.insert(3, "M" +fsort ); |
53 | } | 54 | } |
54 | setText(1,mail_data->getSubject()); | 55 | setText(1,mail_data->getSubject()); |
55 | setText(2,mail_data->getFrom()); | 56 | setText(2,mail_data->getFrom()); |
56 | mKeyMap.insert(4,mail_data->getIsoDate()); | 57 | mKeyMap.insert(4,mail_data->getIsoDate()); |
57 | setText(4,mail_data->getDate()); | 58 | setText(4,mail_data->getDate()); |
58 | if ( KOPrefs::instance()->mShowToField ) | 59 | if ( KOPrefs::instance()->mShowToField ) |
59 | setText(5,mail_data->To()[0]); | 60 | setText(5,mail_data->To()[0]); |
60 | } | 61 | } |
61 | 62 | ||
62 | void MailListViewItem::storeData(const RecMailP&data) | 63 | void MailListViewItem::storeData(const RecMailP&data) |
63 | { | 64 | { |
64 | mail_data = data; | 65 | mail_data = data; |
65 | } | 66 | } |
66 | void MailListViewItem::setSortKey(int column,const QString &key) | 67 | void MailListViewItem::setSortKey(int column,const QString &key) |
67 | { | 68 | { |
68 | mKeyMap.insert(column,key); | 69 | mKeyMap.insert(column,key); |
69 | } | 70 | } |
70 | QString MailListViewItem::key(int column, bool) const | 71 | QString MailListViewItem::key(int column, bool) const |
71 | { | 72 | { |
72 | // to make is fast, we use here special cases | 73 | // to make is fast, we use here special cases |
73 | if ( column == 3 || column == 4 || column == 0) { | 74 | if ( column == 3 || column == 4 || column == 0) { |
74 | return *mKeyMap.find(column); | 75 | return *mKeyMap.find(column); |
75 | } | 76 | } |
76 | if ( column == 1 ) { | 77 | if ( column == 1 ) { |
77 | if ( text(1).left(4).lower() == "re: " ) | 78 | if ( text(1).left(4).lower() == "re: " ) |
78 | return text(1).mid(4); | 79 | return text(1).mid(4); |
79 | 80 | ||
80 | } | 81 | } |
81 | return text(column); | 82 | return text(column); |
82 | /* | 83 | /* |
83 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 84 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
84 | if (it == mKeyMap.end()) return text(column); | 85 | if (it == mKeyMap.end()) return text(column); |
85 | else return *it; | 86 | else return *it; |
86 | */ | 87 | */ |
87 | } | 88 | } |
88 | 89 | ||
89 | const RecMailP& MailListViewItem::data()const | 90 | const RecMailP& MailListViewItem::data()const |
90 | { | 91 | { |
91 | return mail_data; | 92 | return mail_data; |
92 | } | 93 | } |
93 | 94 | ||