Diffstat (limited to 'kmicromail/mailistviewitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index b92b0cf..484a635 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -32,111 +32,114 @@ void MailListViewItem::showEntry() | |||
32 | fsort.sprintf( "%.2f", s ); | 32 | fsort.sprintf( "%.2f", s ); |
33 | QString fsize = QString::number( s, 'f', 2 ); | 33 | QString fsize = QString::number( s, 'f', 2 ); |
34 | // 1.23 | 34 | // 1.23 |
35 | // 11.23 | 35 | // 11.23 |
36 | // 111.23 | 36 | // 111.23 |
37 | // 999.23 maxlen | 37 | // 999.23 maxlen |
38 | switch(fsize.length() ) { | 38 | switch(fsize.length() ) { |
39 | case 4: | 39 | case 4: |
40 | fsort = "00" + fsize ; | 40 | fsort = "00" + fsize ; |
41 | break; | 41 | break; |
42 | case 5: | 42 | case 5: |
43 | fsort = "0" + fsize ; | 43 | fsort = "0" + fsize ; |
44 | break; | 44 | break; |
45 | default: | 45 | default: |
46 | fsort = fsize ; | 46 | fsort = fsize ; |
47 | break; | 47 | break; |
48 | 48 | ||
49 | } | 49 | } |
50 | if ( w == 0 ) { | 50 | if ( w == 0 ) { |
51 | setText(3, fsize + "kB" ); | 51 | setText(3, fsize + "kB" ); |
52 | mKeyMap.insert(3, "k" + fsort); | 52 | mKeyMap.insert(3, "k" + fsort); |
53 | //setText(3, "kB" + fsort ); // test only | 53 | //setText(3, "kB" + fsort ); // test only |
54 | } else { | 54 | } else { |
55 | //setText(3, fsize + "MB"); | 55 | //setText(3, fsize + "MB"); |
56 | mKeyMap.insert(4, "M" +fsort ); | 56 | mKeyMap.insert(3, "M" +fsort ); |
57 | } | 57 | } |
58 | setText(1,mail_data->getSubject()); | 58 | setText(1,mail_data->getSubject()); |
59 | setText(2,mail_data->getFrom()); | 59 | setText(2,mail_data->getFrom()); |
60 | 60 | #if 0 | |
61 | QString date = mail_data->getDate(); | 61 | QString date = mail_data->getDate(); |
62 | 62 | ||
63 | int kom = date.find( ",")+2; | 63 | int kom = date.find( ",")+2; |
64 | if ( kom == 1 ) | 64 | if ( kom == 1 ) |
65 | kom = 0; | 65 | kom = 0; |
66 | if ( date.mid(kom,1) == " ") | 66 | if ( date.mid(kom,1) == " ") |
67 | ++kom; | 67 | ++kom; |
68 | if ( date.mid(kom+1,1) == " " ) | 68 | if ( date.mid(kom+1,1) == " " ) |
69 | date = "0" + date.mid( kom ); | 69 | date = "0" + date.mid( kom ); |
70 | else if ( kom ) | 70 | else if ( kom ) |
71 | date = date.mid( kom ); | 71 | date = date.mid( kom ); |
72 | if ( kom || date.mid(2,1 ) == " ") { | 72 | if ( kom || date.mid(2,1 ) == " ") { |
73 | QString mon = date.mid(3,3); | 73 | QString mon = date.mid(3,3); |
74 | QString so = 00; | 74 | QString so = 00; |
75 | if ( mon == "Jan" ) | 75 | if ( mon == "Jan" ) |
76 | so = "01"; | 76 | so = "01"; |
77 | else if ( mon == "Feb" ) | 77 | else if ( mon == "Feb" ) |
78 | so = "02"; | 78 | so = "02"; |
79 | else if ( mon == "Mar" ) | 79 | else if ( mon == "Mar" ) |
80 | so = "03"; | 80 | so = "03"; |
81 | else if ( mon == "Apr" ) | 81 | else if ( mon == "Apr" ) |
82 | so = "04"; | 82 | so = "04"; |
83 | else if ( mon == "May" ) | 83 | else if ( mon == "May" ) |
84 | so = "05"; | 84 | so = "05"; |
85 | else if ( mon == "Jun" ) | 85 | else if ( mon == "Jun" ) |
86 | so = "06"; | 86 | so = "06"; |
87 | else if ( mon == "Jul" ) | 87 | else if ( mon == "Jul" ) |
88 | so = "07"; | 88 | so = "07"; |
89 | else if ( mon == "Aug" ) | 89 | else if ( mon == "Aug" ) |
90 | so = "08"; | 90 | so = "08"; |
91 | else if ( mon == "Sep" ) | 91 | else if ( mon == "Sep" ) |
92 | so = "09"; | 92 | so = "09"; |
93 | else if ( mon == "Oct" ) | 93 | else if ( mon == "Oct" ) |
94 | so = "10"; | 94 | so = "10"; |
95 | else if ( mon == "Nov" ) | 95 | else if ( mon == "Nov" ) |
96 | so = "11"; | 96 | so = "11"; |
97 | else if ( mon == "Dec" ) | 97 | else if ( mon == "Dec" ) |
98 | so = "12"; | 98 | so = "12"; |
99 | date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); | 99 | date = date.mid(7,4)+so+date.left(2)+date.mid(12,14); |
100 | } | 100 | } |
101 | //qDebug("insert Date %s ", date.latin1()); | ||
101 | // if ( date.left(1) != "1" || date.left(1) != "2" ) | 102 | // if ( date.left(1) != "1" || date.left(1) != "2" ) |
102 | // date = date.mid(5); | 103 | // date = date.mid(5); |
103 | mKeyMap.insert(4,date); | 104 | mKeyMap.insert(4,date); |
105 | #endif | ||
106 | mKeyMap.insert(4,mail_data->getIsoDate()); | ||
104 | setText(4,mail_data->getDate()); | 107 | setText(4,mail_data->getDate()); |
105 | } | 108 | } |
106 | 109 | ||
107 | void MailListViewItem::storeData(const RecMailP&data) | 110 | void MailListViewItem::storeData(const RecMailP&data) |
108 | { | 111 | { |
109 | mail_data = data; | 112 | mail_data = data; |
110 | } | 113 | } |
111 | void MailListViewItem::setSortKey(int column,const QString &key) | 114 | void MailListViewItem::setSortKey(int column,const QString &key) |
112 | { | 115 | { |
113 | mKeyMap.insert(column,key); | 116 | mKeyMap.insert(column,key); |
114 | } | 117 | } |
115 | QString MailListViewItem::key(int column, bool) const | 118 | QString MailListViewItem::key(int column, bool) const |
116 | { | 119 | { |
117 | // to make is fast, we use here special cases | 120 | // to make is fast, we use here special cases |
118 | if ( column == 3 || column == 4 ) { | 121 | if ( column == 3 || column == 4 ) { |
119 | return *mKeyMap.find(column); | 122 | return *mKeyMap.find(column); |
120 | } | 123 | } |
121 | if ( column == 1 ) { | 124 | if ( column == 1 ) { |
122 | if ( text(1).left(4).lower() == "re: " ) | 125 | if ( text(1).left(4).lower() == "re: " ) |
123 | return text(1).mid(4); | 126 | return text(1).mid(4); |
124 | 127 | ||
125 | } | 128 | } |
126 | return text(column); | 129 | return text(column); |
127 | /* | 130 | /* |
128 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); | 131 | QMap<int,QString>::ConstIterator it = mKeyMap.find(column); |
129 | if (it == mKeyMap.end()) return text(column); | 132 | if (it == mKeyMap.end()) return text(column); |
130 | else return *it; | 133 | else return *it; |
131 | */ | 134 | */ |
132 | } | 135 | } |
133 | 136 | ||
134 | const RecMailP& MailListViewItem::data()const | 137 | const RecMailP& MailListViewItem::data()const |
135 | { | 138 | { |
136 | return mail_data; | 139 | return mail_data; |
137 | } | 140 | } |
138 | 141 | ||
139 | MAILLIB::ATYPE MailListViewItem::wrapperType() | 142 | MAILLIB::ATYPE MailListViewItem::wrapperType() |
140 | { | 143 | { |
141 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; | 144 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; |
142 | return mail_data->Wrapper()->getType(); | 145 | return mail_data->Wrapper()->getType(); |