author | zautrix <zautrix> | 2004-07-03 17:56:43 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-07-03 17:56:43 (UTC) |
commit | 5e6a0e28ecc7c4bf1eb7ad8637c99e1689623ed5 (patch) (unidiff) | |
tree | 9305757fd40e54bf695c67014739d2cbfe785842 /kmicromail | |
parent | 160c17bf54944df96c2c67f7c3d14882163bdbf7 (diff) | |
download | kdepimpi-5e6a0e28ecc7c4bf1eb7ad8637c99e1689623ed5.zip kdepimpi-5e6a0e28ecc7c4bf1eb7ad8637c99e1689623ed5.tar.gz kdepimpi-5e6a0e28ecc7c4bf1eb7ad8637c99e1689623ed5.tar.bz2 |
bugfix of date in listview
-rw-r--r-- | kmicromail/mailistviewitem.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kmicromail/mailistviewitem.cpp b/kmicromail/mailistviewitem.cpp index 6073da6..b9b4cd9 100644 --- a/kmicromail/mailistviewitem.cpp +++ b/kmicromail/mailistviewitem.cpp | |||
@@ -1,115 +1,115 @@ | |||
1 | #include "mailistviewitem.h" | 1 | #include "mailistviewitem.h" |
2 | #include <libmailwrapper/abstractmail.h> | 2 | #include <libmailwrapper/abstractmail.h> |
3 | #include <qtextstream.h> | 3 | #include <qtextstream.h> |
4 | #include <kiconloader.h> | 4 | #include <kiconloader.h> |
5 | //#include <qpe/resource.h> | 5 | //#include <qpe/resource.h> |
6 | 6 | ||
7 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 7 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
8 | :QListViewItem(parent,item),mail_data() | 8 | :QListViewItem(parent,item),mail_data() |
9 | { | 9 | { |
10 | } | 10 | } |
11 | 11 | ||
12 | void MailListViewItem::showEntry() | 12 | void MailListViewItem::showEntry() |
13 | { | 13 | { |
14 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { | 14 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { |
15 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); | 15 | setPixmap( 0, SmallIcon ( "kmmsgreplied") ); |
16 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { | 16 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { |
17 | /* I think it looks nicer if there are not such a log of icons but only on mails | 17 | /* I think it looks nicer if there are not such a log of icons but only on mails |
18 | replied or new - Alwin*/ | 18 | replied or new - Alwin*/ |
19 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); | 19 | //setPixmap( 0,SmallIcon ("kmmsgunseen") ); |
20 | } else { | 20 | } else { |
21 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); | 21 | setPixmap( 0,SmallIcon ( "kmmsgnew") ); |
22 | } | 22 | } |
23 | double s = mail_data->Msgsize(); | 23 | double s = mail_data->Msgsize(); |
24 | int w; | 24 | int w; |
25 | w=0; | 25 | w=0; |
26 | 26 | ||
27 | while (s>1024) { | 27 | while (s>1024) { |
28 | s/=1024; | 28 | s/=1024; |
29 | ++w; | 29 | ++w; |
30 | if (w>=2) break; | 30 | if (w>=2) break; |
31 | } | 31 | } |
32 | 32 | ||
33 | QString q=""; | 33 | QString q=""; |
34 | QString fsize=""; | 34 | QString fsize=""; |
35 | switch(w) { | 35 | switch(w) { |
36 | case 1: | 36 | case 1: |
37 | q="k"; | 37 | q="k"; |
38 | break; | 38 | break; |
39 | case 2: | 39 | case 2: |
40 | q="M"; | 40 | q="M"; |
41 | break; | 41 | break; |
42 | default: | 42 | default: |
43 | break; | 43 | break; |
44 | } | 44 | } |
45 | 45 | ||
46 | { | 46 | { |
47 | QTextOStream o(&fsize); | 47 | QTextOStream o(&fsize); |
48 | if (w>0) o.precision(2); else o.precision(0); | 48 | if (w>0) o.precision(2); else o.precision(0); |
49 | o.setf(QTextStream::fixed); | 49 | o.setf(QTextStream::fixed); |
50 | o << s << " " << q << "Byte"; | 50 | o << s << " " << q << "Byte"; |
51 | } | 51 | } |
52 | 52 | ||
53 | setText(1,mail_data->getSubject()); | 53 | setText(1,mail_data->getSubject()); |
54 | setText(2,mail_data->getFrom()); | 54 | setText(2,mail_data->getFrom()); |
55 | setText(3,fsize); | 55 | setText(3,fsize); |
56 | QString date = mail_data->getDate(); | 56 | QString date = mail_data->getDate(); |
57 | 57 | ||
58 | int kom = date.find( ",")+2; | 58 | int kom = date.find( ",")+2; |
59 | if ( kom == 1 ) | 59 | if ( kom == 1 ) |
60 | kom = 0; | 60 | kom = 0; |
61 | if ( date.mid(kom,1) == " ") | 61 | if ( date.mid(kom,1) == " ") |
62 | ++kom; | 62 | ++kom; |
63 | if ( date.mid(kom+1,1) == " " ) | 63 | if ( date.mid(kom+1,1) == " " ) |
64 | date = "0" + date.mid( kom ); | 64 | date = "0" + date.mid( kom ); |
65 | else if ( kom ) | 65 | else if ( kom ) |
66 | date = date.mid( kom ); | 66 | date = date.mid( kom ); |
67 | if ( kom || date.mid(2,1 ) == " ") { | 67 | if ( kom || date.mid(2,1 ) == " ") { |
68 | QString mon = date.mid(3,3); | 68 | QString mon = date.mid(3,3); |
69 | QString so = 00; | 69 | QString so = 00; |
70 | if ( mon == "Jan" ) | 70 | if ( mon == "Jan" ) |
71 | so = "01"; | 71 | so = "01"; |
72 | else if ( mon == "Feb" ) | 72 | else if ( mon == "Feb" ) |
73 | so = "02"; | 73 | so = "02"; |
74 | else if ( mon == "Mar" ) | 74 | else if ( mon == "Mar" ) |
75 | so = "03"; | 75 | so = "03"; |
76 | else if ( mon == "Apr" ) | 76 | else if ( mon == "Apr" ) |
77 | so = "04"; | 77 | so = "04"; |
78 | else if ( mon == "May" ) | 78 | else if ( mon == "May" ) |
79 | so = "05"; | 79 | so = "05"; |
80 | else if ( mon == "Jun" ) | 80 | else if ( mon == "Jun" ) |
81 | so = "06"; | 81 | so = "06"; |
82 | else if ( mon == "Jul" ) | 82 | else if ( mon == "Jul" ) |
83 | so = "07"; | 83 | so = "07"; |
84 | else if ( mon == "Aug" ) | 84 | else if ( mon == "Aug" ) |
85 | so = "08"; | 85 | so = "08"; |
86 | else if ( mon == "Sep" ) | 86 | else if ( mon == "Sep" ) |
87 | so = "09"; | 87 | so = "09"; |
88 | else if ( mon == "Oct" ) | 88 | else if ( mon == "Oct" ) |
89 | so = "10"; | 89 | so = "10"; |
90 | else if ( mon == "Nov" ) | 90 | else if ( mon == "Nov" ) |
91 | so = "11"; | 91 | so = "11"; |
92 | else if ( mon == "Dec" ) | 92 | else if ( mon == "Dec" ) |
93 | so = "12"; | 93 | so = "12"; |
94 | date = date.mid(7,4)+"-"+so+"-"+date.left(2)+"-"+date.mid(12); | 94 | date = date.mid(7,4)+"-"+so+"-"+date.left(2)+" "+date.mid(12,14); |
95 | } | 95 | } |
96 | // if ( date.left(1) != "1" || date.left(1) != "2" ) | 96 | // if ( date.left(1) != "1" || date.left(1) != "2" ) |
97 | // date = date.mid(5); | 97 | // date = date.mid(5); |
98 | setText(4,date); | 98 | setText(4,date); |
99 | } | 99 | } |
100 | 100 | ||
101 | void MailListViewItem::storeData(const RecMailP&data) | 101 | void MailListViewItem::storeData(const RecMailP&data) |
102 | { | 102 | { |
103 | mail_data = data; | 103 | mail_data = data; |
104 | } | 104 | } |
105 | 105 | ||
106 | const RecMailP& MailListViewItem::data()const | 106 | const RecMailP& MailListViewItem::data()const |
107 | { | 107 | { |
108 | return mail_data; | 108 | return mail_data; |
109 | } | 109 | } |
110 | 110 | ||
111 | MAILLIB::ATYPE MailListViewItem::wrapperType() | 111 | MAILLIB::ATYPE MailListViewItem::wrapperType() |
112 | { | 112 | { |
113 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; | 113 | if (!mail_data->Wrapper()) return MAILLIB::A_UNDEFINED; |
114 | return mail_data->Wrapper()->getType(); | 114 | return mail_data->Wrapper()->getType(); |
115 | } | 115 | } |