-rw-r--r-- | noncore/net/mail/libmailwrapper/genericwrapper.cpp | 10 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailstatics.cpp | 25 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailstatics.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.cpp | 28 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailtypes.h | 11 | ||||
-rw-r--r-- | noncore/net/mail/mailistviewitem.cpp | 20 | ||||
-rw-r--r-- | noncore/net/mail/mailistviewitem.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 17 | ||||
-rw-r--r-- | noncore/net/mail/viewmail.cpp | 6 |
10 files changed, 81 insertions, 46 deletions
diff --git a/noncore/net/mail/libmailwrapper/genericwrapper.cpp b/noncore/net/mail/libmailwrapper/genericwrapper.cpp index 703235d..0ac842d 100644 --- a/noncore/net/mail/libmailwrapper/genericwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/genericwrapper.cpp | |||
@@ -379,17 +379,17 @@ QStringList Genericwrapper::parseInreplies(mailimf_in_reply_to * in_replies) | |||
379 | res.append(h); | 379 | res.append(h); |
380 | } | 380 | } |
381 | } | 381 | } |
382 | return res; | 382 | return res; |
383 | } | 383 | } |
384 | 384 | ||
385 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) | 385 | void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &target,mailsession*session,const QString&mailbox,bool mbox_as_to) |
386 | { | 386 | { |
387 | int r; | 387 | int r,toffset; |
388 | mailmessage_list * env_list = 0; | 388 | mailmessage_list * env_list = 0; |
389 | r = mailsession_get_messages_list(session,&env_list); | 389 | r = mailsession_get_messages_list(session,&env_list); |
390 | if (r != MAIL_NO_ERROR) { | 390 | if (r != MAIL_NO_ERROR) { |
391 | odebug << "Error message list" << oendl; | 391 | odebug << "Error message list" << oendl; |
392 | return; | 392 | return; |
393 | } | 393 | } |
394 | r = mailsession_get_envelopes_list(session, env_list); | 394 | r = mailsession_get_envelopes_list(session, env_list); |
395 | if (r != MAIL_NO_ERROR) { | 395 | if (r != MAIL_NO_ERROR) { |
@@ -432,23 +432,23 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > & | |||
432 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); | 432 | mail->setTo( parseAddressList( single_fields.fld_to->to_addr_list ) ); |
433 | } else { | 433 | } else { |
434 | mail->setTo(mailbox); | 434 | mail->setTo(mailbox); |
435 | } | 435 | } |
436 | if (single_fields.fld_cc) | 436 | if (single_fields.fld_cc) |
437 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); | 437 | mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) ); |
438 | if (single_fields.fld_bcc) | 438 | if (single_fields.fld_bcc) |
439 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); | 439 | mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); |
440 | if (single_fields.fld_orig_date) | 440 | if (single_fields.fld_orig_date) { |
441 | mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); | 441 | QDateTime d = parseDateTime( single_fields.fld_orig_date->dt_date_time,toffset); |
442 | // crashes when accessing pop3 account? | 442 | mail->setDate( d,toffset ); |
443 | } | ||
443 | if (single_fields.fld_message_id && single_fields.fld_message_id->mid_value) { | 444 | if (single_fields.fld_message_id && single_fields.fld_message_id->mid_value) { |
444 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); | 445 | mail->setMsgid(QString(single_fields.fld_message_id->mid_value)); |
445 | } | 446 | } |
446 | |||
447 | if (single_fields.fld_reply_to) { | 447 | if (single_fields.fld_reply_to) { |
448 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); | 448 | QStringList t = parseAddressList(single_fields.fld_reply_to->rt_addr_list); |
449 | if (t.count()>0) { | 449 | if (t.count()>0) { |
450 | mail->setReplyto(t[0]); | 450 | mail->setReplyto(t[0]); |
451 | } | 451 | } |
452 | } | 452 | } |
453 | #if 0 | 453 | #if 0 |
454 | refs = single_fields.fld_references; | 454 | refs = single_fields.fld_references; |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 56efa0b..8e5212b 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -367,17 +367,17 @@ QValueList<Opie::Core::OSmartPointer<Folder> >* IMAPwrapper::listFolders() | |||
367 | 367 | ||
368 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | 368 | RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) |
369 | { | 369 | { |
370 | RecMail * m = 0; | 370 | RecMail * m = 0; |
371 | mailimap_msg_att_item *item=0; | 371 | mailimap_msg_att_item *item=0; |
372 | clistcell *current,*c,*cf; | 372 | clistcell *current,*c,*cf; |
373 | mailimap_msg_att_dynamic*flist; | 373 | mailimap_msg_att_dynamic*flist; |
374 | mailimap_flag_fetch*cflag; | 374 | mailimap_flag_fetch*cflag; |
375 | int size; | 375 | int size,toffset; |
376 | QBitArray mFlags(7); | 376 | QBitArray mFlags(7); |
377 | QStringList addresslist; | 377 | QStringList addresslist; |
378 | 378 | ||
379 | if (!m_att) { | 379 | if (!m_att) { |
380 | return m; | 380 | return m; |
381 | } | 381 | } |
382 | size = 0; | 382 | size = 0; |
383 | m = new RecMail(); | 383 | m = new RecMail(); |
@@ -419,17 +419,18 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
419 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | 419 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { |
420 | mFlags.setBit(FLAG_RECENT); | 420 | mFlags.setBit(FLAG_RECENT); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | continue; | 423 | continue; |
424 | } | 424 | } |
425 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 425 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
426 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 426 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
427 | m->setDate(parseDateTime(head->env_date)); | 427 | QDateTime d = parseDateTime(head->env_date,toffset); |
428 | m->setDate(d,toffset); | ||
428 | m->setSubject(convert_String((const char*)head->env_subject)); | 429 | m->setSubject(convert_String((const char*)head->env_subject)); |
429 | if (head->env_from!=NULL) { | 430 | if (head->env_from!=NULL) { |
430 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 431 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
431 | if (addresslist.count()) { | 432 | if (addresslist.count()) { |
432 | m->setFrom(addresslist.first()); | 433 | m->setFrom(addresslist.first()); |
433 | } | 434 | } |
434 | } | 435 | } |
435 | if (head->env_to!=NULL) { | 436 | if (head->env_to!=NULL) { |
diff --git a/noncore/net/mail/libmailwrapper/mailstatics.cpp b/noncore/net/mail/libmailwrapper/mailstatics.cpp index 4878dc9..033ec28 100644 --- a/noncore/net/mail/libmailwrapper/mailstatics.cpp +++ b/noncore/net/mail/libmailwrapper/mailstatics.cpp | |||
@@ -1,29 +1,30 @@ | |||
1 | #include "mailstatics.h" | 1 | #include "mailstatics.h" |
2 | #include <libetpan/libetpan.h> | 2 | #include <libetpan/libetpan.h> |
3 | #include <qpe/timestring.h> | 3 | //#include <qpe/timestring.h> |
4 | 4 | ||
5 | QString MailStatics::parseDateTime(const mailimf_date_time *date ) | 5 | QDateTime MailStatics::parseDateTime(const mailimf_date_time *date,int&offset ) |
6 | { | 6 | { |
7 | if (!date) return ""; | 7 | offset = 0; |
8 | if (!date) { | ||
9 | return QDateTime(); | ||
10 | } | ||
8 | QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec)); | 11 | QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec)); |
9 | QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" "; | 12 | offset = date->dt_zone; |
10 | timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" "; | 13 | return da; |
11 | timestring.sprintf(timestring+" %+05i",date->dt_zone); | ||
12 | return timestring; | ||
13 | } | 14 | } |
14 | 15 | ||
15 | QString MailStatics::parseDateTime(const char*date) | 16 | QDateTime MailStatics::parseDateTime(const char*date,int&offset) |
16 | { | 17 | { |
17 | mailimf_date_time * date_time; | 18 | mailimf_date_time * date_time=0; |
18 | QString d = ""; | 19 | QDateTime d; |
19 | size_t cur_tok = 0; | 20 | size_t cur_tok = 0; |
20 | if (!date) return d; | 21 | if (!date) return d; |
21 | int r = mailimf_date_time_parse(date,strlen(date),&cur_tok,&date_time); | 22 | int r = mailimf_date_time_parse(date,strlen(date),&cur_tok,&date_time); |
22 | if (r==MAILIMF_NO_ERROR) { | 23 | if (r==MAILIMF_NO_ERROR) { |
23 | d = parseDateTime(date_time); | 24 | d = parseDateTime(date_time,offset); |
24 | } | 25 | } |
25 | if (date_time) { | 26 | if (date_time) { |
26 | mailimf_date_time_free(date_time); | 27 | mailimf_date_time_free(date_time); |
27 | } | 28 | } |
28 | return d; | 29 | return d; |
29 | } \ No newline at end of file | 30 | } |
diff --git a/noncore/net/mail/libmailwrapper/mailstatics.h b/noncore/net/mail/libmailwrapper/mailstatics.h index 841d14d..c714ead 100644 --- a/noncore/net/mail/libmailwrapper/mailstatics.h +++ b/noncore/net/mail/libmailwrapper/mailstatics.h | |||
@@ -4,16 +4,16 @@ | |||
4 | #include <qdatetime.h> | 4 | #include <qdatetime.h> |
5 | #include <qstring.h> | 5 | #include <qstring.h> |
6 | 6 | ||
7 | struct mailimf_date_time; | 7 | struct mailimf_date_time; |
8 | 8 | ||
9 | class MailStatics | 9 | class MailStatics |
10 | { | 10 | { |
11 | protected: | 11 | protected: |
12 | static QString parseDateTime(const mailimf_date_time * date); | 12 | static QDateTime parseDateTime(const mailimf_date_time * date,int&offset); |
13 | static QString parseDateTime(const char*date); | 13 | static QDateTime parseDateTime(const char*date,int&offset); |
14 | MailStatics(){}; | 14 | MailStatics(){}; |
15 | virtual ~MailStatics(){}; | 15 | virtual ~MailStatics(){}; |
16 | public: | 16 | public: |
17 | }; | 17 | }; |
18 | 18 | ||
19 | #endif | 19 | #endif |
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.cpp b/noncore/net/mail/libmailwrapper/mailtypes.cpp index d4395a2..b009b75 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.cpp +++ b/noncore/net/mail/libmailwrapper/mailtypes.cpp | |||
@@ -1,37 +1,39 @@ | |||
1 | #include "mailtypes.h" | 1 | #include "mailtypes.h" |
2 | 2 | ||
3 | #include <opie2/odebug.h> | 3 | #include <opie2/odebug.h> |
4 | #include <qpe/timestring.h> | ||
4 | 5 | ||
5 | #include <stdlib.h> | 6 | #include <stdlib.h> |
6 | 7 | ||
7 | using namespace Opie::Core; | 8 | using namespace Opie::Core; |
8 | RecMail::RecMail() | 9 | RecMail::RecMail() |
9 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7) | 10 | :Opie::Core::ORefCount(),subject(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_size(0),msg_flags(7),maildate(),date("") |
10 | { | 11 | { |
11 | init(); | 12 | init(); |
12 | } | 13 | } |
13 | 14 | ||
14 | RecMail::RecMail(const RecMail&old) | 15 | RecMail::RecMail(const RecMail&old) |
15 | :Opie::Core::ORefCount(),subject(""),date(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7) | 16 | :Opie::Core::ORefCount(),subject(""),from(""),mbox(""),msg_id(""),msg_number(0),msg_flags(7),maildate(),date("") |
16 | { | 17 | { |
17 | init(); | 18 | init(); |
18 | copy_old(old); | 19 | copy_old(old); |
19 | odebug << "Copy constructor RecMail" << oendl; | 20 | odebug << "Copy constructor RecMail" << oendl; |
20 | } | 21 | } |
21 | 22 | ||
22 | RecMail::~RecMail() | 23 | RecMail::~RecMail() |
23 | { | 24 | { |
24 | wrapper = 0; | 25 | wrapper = 0; |
25 | } | 26 | } |
26 | 27 | ||
27 | void RecMail::copy_old(const RecMail&old) | 28 | void RecMail::copy_old(const RecMail&old) |
28 | { | 29 | { |
29 | subject = old.subject; | 30 | subject = old.subject; |
31 | maildate = old.maildate; | ||
30 | date = old.date; | 32 | date = old.date; |
31 | mbox = old.mbox; | 33 | mbox = old.mbox; |
32 | msg_id = old.msg_id; | 34 | msg_id = old.msg_id; |
33 | msg_size = old.msg_size; | 35 | msg_size = old.msg_size; |
34 | msg_number = old.msg_number; | 36 | msg_number = old.msg_number; |
35 | from = old.from; | 37 | from = old.from; |
36 | msg_flags = old.msg_flags; | 38 | msg_flags = old.msg_flags; |
37 | to = old.to; | 39 | to = old.to; |
@@ -48,16 +50,27 @@ void RecMail::init() | |||
48 | to.clear(); | 50 | to.clear(); |
49 | cc.clear(); | 51 | cc.clear(); |
50 | bcc.clear(); | 52 | bcc.clear(); |
51 | in_reply_to.clear(); | 53 | in_reply_to.clear(); |
52 | references.clear(); | 54 | references.clear(); |
53 | wrapper = 0; | 55 | wrapper = 0; |
54 | } | 56 | } |
55 | 57 | ||
58 | void RecMail::setDate( const QDateTime&a,int offset) | ||
59 | { | ||
60 | QString timestring = TimeString::numberDateString(a.date())+" "; | ||
61 | timestring+=TimeString::timeString(a.time()); | ||
62 | if (offset > 0) { | ||
63 | timestring.sprintf(timestring+" %+05i",offset); | ||
64 | } | ||
65 | date = timestring; | ||
66 | maildate = a; | ||
67 | } | ||
68 | |||
56 | void RecMail::setWrapper(AbstractMail*awrapper) | 69 | void RecMail::setWrapper(AbstractMail*awrapper) |
57 | { | 70 | { |
58 | wrapper = awrapper; | 71 | wrapper = awrapper; |
59 | } | 72 | } |
60 | 73 | ||
61 | AbstractMail* RecMail::Wrapper() | 74 | AbstractMail* RecMail::Wrapper() |
62 | { | 75 | { |
63 | return wrapper; | 76 | return wrapper; |
@@ -129,17 +142,17 @@ RecPart::RecPart(const RecPart&old) | |||
129 | m_subtype = old.m_subtype; | 142 | m_subtype = old.m_subtype; |
130 | m_identifier = old.m_identifier; | 143 | m_identifier = old.m_identifier; |
131 | m_encoding = old.m_encoding; | 144 | m_encoding = old.m_encoding; |
132 | m_description = old.m_description; | 145 | m_description = old.m_description; |
133 | m_lines = old.m_lines; | 146 | m_lines = old.m_lines; |
134 | m_size = old.m_size; | 147 | m_size = old.m_size; |
135 | m_Parameters = old.m_Parameters; | 148 | m_Parameters = old.m_Parameters; |
136 | m_poslist = old.m_poslist; | 149 | m_poslist = old.m_poslist; |
137 | odebug << "RecPart copy constructor" << oendl; | 150 | odebug << "RecPart copy constructor" << oendl; |
138 | } | 151 | } |
139 | 152 | ||
140 | RecPart::~RecPart() | 153 | RecPart::~RecPart() |
141 | { | 154 | { |
142 | } | 155 | } |
143 | 156 | ||
144 | void RecPart::setSize(unsigned int size) | 157 | void RecPart::setSize(unsigned int size) |
145 | { | 158 | { |
@@ -253,17 +266,17 @@ RecBody::RecBody() | |||
253 | } | 266 | } |
254 | 267 | ||
255 | RecBody::RecBody(const RecBody&old) | 268 | RecBody::RecBody(const RecBody&old) |
256 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) | 269 | :Opie::Core::ORefCount(),m_BodyText(),m_PartsList(),m_description(new RecPart()) |
257 | { | 270 | { |
258 | m_BodyText = old.m_BodyText; | 271 | m_BodyText = old.m_BodyText; |
259 | m_PartsList = old.m_PartsList; | 272 | m_PartsList = old.m_PartsList; |
260 | m_description = old.m_description; | 273 | m_description = old.m_description; |
261 | odebug << "Recbody copy constructor" << oendl; | 274 | odebug << "Recbody copy constructor" << oendl; |
262 | } | 275 | } |
263 | 276 | ||
264 | RecBody::~RecBody() | 277 | RecBody::~RecBody() |
265 | { | 278 | { |
266 | } | 279 | } |
267 | 280 | ||
268 | void RecBody::setBodytext(const QString&bodyText) | 281 | void RecBody::setBodytext(const QString&bodyText) |
269 | { | 282 | { |
@@ -318,24 +331,24 @@ encodedString::encodedString(char*nContent,unsigned int nSize) | |||
318 | init(); | 331 | init(); |
319 | setContent(nContent,nSize); | 332 | setContent(nContent,nSize); |
320 | } | 333 | } |
321 | 334 | ||
322 | encodedString::encodedString(const encodedString&old) | 335 | encodedString::encodedString(const encodedString&old) |
323 | { | 336 | { |
324 | init(); | 337 | init(); |
325 | copy_old(old); | 338 | copy_old(old); |
326 | odebug << "encodedeString: copy constructor!" << oendl; | 339 | odebug << "encodedeString: copy constructor!" << oendl; |
327 | } | 340 | } |
328 | 341 | ||
329 | encodedString& encodedString::operator=(const encodedString&old) | 342 | encodedString& encodedString::operator=(const encodedString&old) |
330 | { | 343 | { |
331 | init(); | 344 | init(); |
332 | copy_old(old); | 345 | copy_old(old); |
333 | odebug << "encodedString: assign operator!" << oendl; | 346 | odebug << "encodedString: assign operator!" << oendl; |
334 | return *this; | 347 | return *this; |
335 | } | 348 | } |
336 | 349 | ||
337 | encodedString::~encodedString() | 350 | encodedString::~encodedString() |
338 | { | 351 | { |
339 | clean(); | 352 | clean(); |
340 | } | 353 | } |
341 | 354 | ||
@@ -391,9 +404,8 @@ void encodedString::setContent(char*nContent,int nSize) | |||
391 | 404 | ||
392 | folderStat&folderStat::operator=(const folderStat&old) | 405 | folderStat&folderStat::operator=(const folderStat&old) |
393 | { | 406 | { |
394 | message_count = old.message_count; | 407 | message_count = old.message_count; |
395 | message_unseen = old.message_unseen; | 408 | message_unseen = old.message_unseen; |
396 | message_recent = old.message_recent; | 409 | message_recent = old.message_recent; |
397 | return *this; | 410 | return *this; |
398 | } | 411 | } |
399 | |||
diff --git a/noncore/net/mail/libmailwrapper/mailtypes.h b/noncore/net/mail/libmailwrapper/mailtypes.h index c317880..272514c 100644 --- a/noncore/net/mail/libmailwrapper/mailtypes.h +++ b/noncore/net/mail/libmailwrapper/mailtypes.h | |||
@@ -10,16 +10,17 @@ | |||
10 | 10 | ||
11 | #include <opie2/osmartpointer.h> | 11 | #include <opie2/osmartpointer.h> |
12 | 12 | ||
13 | #include <qbitarray.h> | 13 | #include <qbitarray.h> |
14 | #include <qstring.h> | 14 | #include <qstring.h> |
15 | #include <qstringlist.h> | 15 | #include <qstringlist.h> |
16 | #include <qmap.h> | 16 | #include <qmap.h> |
17 | #include <qvaluelist.h> | 17 | #include <qvaluelist.h> |
18 | #include <qdatetime.h> | ||
18 | 19 | ||
19 | class AbstractMail; | 20 | class AbstractMail; |
20 | /* a class to describe mails in a mailbox */ | 21 | /* a class to describe mails in a mailbox */ |
21 | /* Attention! | 22 | /* Attention! |
22 | From programmers point of view it would make sense to | 23 | From programmers point of view it would make sense to |
23 | store the mail body into this class, too. | 24 | store the mail body into this class, too. |
24 | But: not from the point of view of the device. | 25 | But: not from the point of view of the device. |
25 | Mailbodies can be real large. So we request them when | 26 | Mailbodies can be real large. So we request them when |
@@ -33,18 +34,16 @@ class RecMail:public Opie::Core::ORefCount | |||
33 | { | 34 | { |
34 | public: | 35 | public: |
35 | RecMail(); | 36 | RecMail(); |
36 | RecMail(const RecMail&old); | 37 | RecMail(const RecMail&old); |
37 | virtual ~RecMail(); | 38 | virtual ~RecMail(); |
38 | 39 | ||
39 | const unsigned int getNumber()const{return msg_number;} | 40 | const unsigned int getNumber()const{return msg_number;} |
40 | void setNumber(unsigned int number){msg_number=number;} | 41 | void setNumber(unsigned int number){msg_number=number;} |
41 | const QString&getDate()const{ return date; } | ||
42 | void setDate( const QString&a ) { date = a; } | ||
43 | const QString&getFrom()const{ return from; } | 42 | const QString&getFrom()const{ return from; } |
44 | void setFrom( const QString&a ) { from = a; } | 43 | void setFrom( const QString&a ) { from = a; } |
45 | const QString&getSubject()const { return subject; } | 44 | const QString&getSubject()const { return subject; } |
46 | void setSubject( const QString&s ) { subject = s; } | 45 | void setSubject( const QString&s ) { subject = s; } |
47 | const QString&getMbox()const{return mbox;} | 46 | const QString&getMbox()const{return mbox;} |
48 | void setMbox(const QString&box){mbox = box;} | 47 | void setMbox(const QString&box){mbox = box;} |
49 | void setMsgid(const QString&id){msg_id=id;} | 48 | void setMsgid(const QString&id){msg_id=id;} |
50 | const QString&Msgid()const{return msg_id;} | 49 | const QString&Msgid()const{return msg_id;} |
@@ -66,24 +65,30 @@ public: | |||
66 | const QStringList&References()const; | 65 | const QStringList&References()const; |
67 | 66 | ||
68 | const QBitArray&getFlags()const{return msg_flags;} | 67 | const QBitArray&getFlags()const{return msg_flags;} |
69 | void setFlags(const QBitArray&flags){msg_flags = flags;} | 68 | void setFlags(const QBitArray&flags){msg_flags = flags;} |
70 | 69 | ||
71 | void setWrapper(AbstractMail*wrapper); | 70 | void setWrapper(AbstractMail*wrapper); |
72 | AbstractMail* Wrapper(); | 71 | AbstractMail* Wrapper(); |
73 | 72 | ||
73 | const QDateTime&getDate()const{ return maildate; } | ||
74 | const QString&getStringDate()const{return date;} | ||
75 | void setDate( const QDateTime&a,int offset=0 ); | ||
76 | |||
74 | protected: | 77 | protected: |
75 | QString subject,date,from,mbox,msg_id,replyto; | 78 | QString subject,from,mbox,msg_id,replyto; |
76 | unsigned int msg_number,msg_size; | 79 | unsigned int msg_number,msg_size; |
77 | QBitArray msg_flags; | 80 | QBitArray msg_flags; |
78 | QStringList to,cc,bcc,in_reply_to,references; | 81 | QStringList to,cc,bcc,in_reply_to,references; |
79 | AbstractMail*wrapper; | 82 | AbstractMail*wrapper; |
80 | void init(); | 83 | void init(); |
81 | void copy_old(const RecMail&old); | 84 | void copy_old(const RecMail&old); |
85 | QDateTime maildate; | ||
86 | QString date; | ||
82 | }; | 87 | }; |
83 | 88 | ||
84 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; | 89 | typedef Opie::Core::OSmartPointer<RecMail> RecMailP; |
85 | typedef QMap<QString,QString> part_plist_t; | 90 | typedef QMap<QString,QString> part_plist_t; |
86 | 91 | ||
87 | class RecPart:public Opie::Core::ORefCount | 92 | class RecPart:public Opie::Core::ORefCount |
88 | { | 93 | { |
89 | protected: | 94 | protected: |
diff --git a/noncore/net/mail/mailistviewitem.cpp b/noncore/net/mail/mailistviewitem.cpp index 0b926da..d3a0723 100644 --- a/noncore/net/mail/mailistviewitem.cpp +++ b/noncore/net/mail/mailistviewitem.cpp | |||
@@ -1,24 +1,25 @@ | |||
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 <qpe/resource.h> | 4 | #include <qpe/resource.h> |
5 | #include <qpe/timestring.h> | ||
5 | 6 | ||
6 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) | 7 | MailListViewItem::MailListViewItem(QListView * parent, MailListViewItem * item ) |
7 | :QListViewItem(parent,item),mail_data() | 8 | :QListViewItem(parent,item),mail_data() |
8 | { | 9 | { |
9 | } | 10 | } |
10 | 11 | ||
11 | void MailListViewItem::showEntry() | 12 | void MailListViewItem::showEntry() |
12 | { | 13 | { |
13 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { | 14 | if ( mail_data->getFlags().testBit( FLAG_ANSWERED ) == true) { |
14 | setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); | 15 | setPixmap( 0, Resource::loadPixmap( "mail/kmmsgreplied") ); |
15 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { | 16 | } else if ( mail_data->getFlags().testBit( FLAG_SEEN ) == true ) { |
16 | /* 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 lot of icons but only on mails |
17 | replied or new - Alwin*/ | 18 | replied or new - Alwin*/ |
18 | //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); | 19 | //setPixmap( 0, Resource::loadPixmap( "mail/kmmsgunseen") ); |
19 | } else { | 20 | } else { |
20 | setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); | 21 | setPixmap( 0, Resource::loadPixmap( "mail/kmmsgnew") ); |
21 | } | 22 | } |
22 | double s = mail_data->Msgsize(); | 23 | double s = mail_data->Msgsize(); |
23 | int w; | 24 | int w; |
24 | w=0; | 25 | w=0; |
@@ -43,21 +44,34 @@ void MailListViewItem::showEntry() | |||
43 | } | 44 | } |
44 | 45 | ||
45 | { | 46 | { |
46 | QTextOStream o(&fsize); | 47 | QTextOStream o(&fsize); |
47 | if (w>0) o.precision(2); else o.precision(0); | 48 | if (w>0) o.precision(2); else o.precision(0); |
48 | o.setf(QTextStream::fixed); | 49 | o.setf(QTextStream::fixed); |
49 | o << s << " " << q << "Byte"; | 50 | o << s << " " << q << "Byte"; |
50 | } | 51 | } |
51 | |||
52 | setText(1,mail_data->getSubject()); | 52 | setText(1,mail_data->getSubject()); |
53 | setText(2,mail_data->getFrom()); | 53 | setText(2,mail_data->getFrom()); |
54 | setText(3,fsize); | 54 | setText(3,fsize); |
55 | setText(4,mail_data->getDate()); | 55 | setText(4,mail_data->getStringDate()); |
56 | } | ||
57 | |||
58 | QString MailListViewItem::key(int col,bool) const | ||
59 | { | ||
60 | QString temp; | ||
61 | if (col == 4) { | ||
62 | temp.sprintf( "%08d",QDateTime().secsTo(mail_data->getDate())); | ||
63 | return temp; | ||
64 | } | ||
65 | if (col == 3) { | ||
66 | temp.sprintf( "%020d",mail_data->Msgsize()); | ||
67 | return temp; | ||
68 | } | ||
69 | return text(col); | ||
56 | } | 70 | } |
57 | 71 | ||
58 | void MailListViewItem::storeData(const RecMailP&data) | 72 | void MailListViewItem::storeData(const RecMailP&data) |
59 | { | 73 | { |
60 | mail_data = data; | 74 | mail_data = data; |
61 | } | 75 | } |
62 | 76 | ||
63 | const RecMailP& MailListViewItem::data()const | 77 | const RecMailP& MailListViewItem::data()const |
diff --git a/noncore/net/mail/mailistviewitem.h b/noncore/net/mail/mailistviewitem.h index d953d83..ce64ca9 100644 --- a/noncore/net/mail/mailistviewitem.h +++ b/noncore/net/mail/mailistviewitem.h | |||
@@ -11,13 +11,14 @@ public: | |||
11 | MailListViewItem(QListView * parent, MailListViewItem * after ); | 11 | MailListViewItem(QListView * parent, MailListViewItem * after ); |
12 | virtual ~MailListViewItem(){} | 12 | virtual ~MailListViewItem(){} |
13 | 13 | ||
14 | void storeData(const RecMailP&data); | 14 | void storeData(const RecMailP&data); |
15 | const RecMailP&data()const; | 15 | const RecMailP&data()const; |
16 | void showEntry(); | 16 | void showEntry(); |
17 | MAILLIB::ATYPE wrapperType(); | 17 | MAILLIB::ATYPE wrapperType(); |
18 | 18 | ||
19 | virtual QString key(int col,bool) const; | ||
19 | protected: | 20 | protected: |
20 | RecMailP mail_data; | 21 | RecMailP mail_data; |
21 | }; | 22 | }; |
22 | 23 | ||
23 | #endif | 24 | #endif |
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 6252fc2..c115b32 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -98,17 +98,18 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
98 | 98 | ||
99 | mailView = new QListView( view ); | 99 | mailView = new QListView( view ); |
100 | mailView->addColumn( "" ); | 100 | mailView->addColumn( "" ); |
101 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); | 101 | mailView->addColumn( tr( "Subject" ),QListView::Manual ); |
102 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); | 102 | mailView->addColumn( tr( "Sender" ),QListView::Manual ); |
103 | mailView->addColumn( tr( "Size" ),QListView::Manual); | 103 | mailView->addColumn( tr( "Size" ),QListView::Manual); |
104 | mailView->addColumn( tr( "Date" )); | 104 | mailView->addColumn( tr( "Date" )); |
105 | mailView->setAllColumnsShowFocus(true); | 105 | mailView->setAllColumnsShowFocus(true); |
106 | mailView->setSorting(-1); | 106 | mailView->setShowSortIndicator(true); |
107 | mailView->setSorting(4,false); | ||
107 | 108 | ||
108 | statusWidget = new StatusWidget( wrapperBox ); | 109 | statusWidget = new StatusWidget( wrapperBox ); |
109 | statusWidget->hide(); | 110 | statusWidget->hide(); |
110 | 111 | ||
111 | layout->addWidget( mailView ); | 112 | layout->addWidget( mailView ); |
112 | layout->setStretchFactor( folderView, 1 ); | 113 | layout->setStretchFactor( folderView, 1 ); |
113 | layout->setStretchFactor( mailView, 2 ); | 114 | layout->setStretchFactor( mailView, 2 ); |
114 | 115 | ||
@@ -138,17 +139,17 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
138 | } | 139 | } |
139 | 140 | ||
140 | MainWindow::~MainWindow() | 141 | MainWindow::~MainWindow() |
141 | { | 142 | { |
142 | } | 143 | } |
143 | 144 | ||
144 | void MainWindow::appMessage(const QCString &, const QByteArray &) | 145 | void MainWindow::appMessage(const QCString &, const QByteArray &) |
145 | { | 146 | { |
146 | odebug << "appMessage not reached" << oendl; | 147 | odebug << "appMessage not reached" << oendl; |
147 | } | 148 | } |
148 | 149 | ||
149 | void MainWindow::slotAdjustLayout() { | 150 | void MainWindow::slotAdjustLayout() { |
150 | 151 | ||
151 | QWidget *d = QApplication::desktop(); | 152 | QWidget *d = QApplication::desktop(); |
152 | 153 | ||
153 | if ( d->width() < d->height() ) { | 154 | if ( d->width() < d->height() ) { |
154 | layout->setDirection( QBoxLayout::TopToBottom ); | 155 | layout->setDirection( QBoxLayout::TopToBottom ); |
@@ -172,42 +173,42 @@ void MainWindow::slotAdjustColumns() | |||
172 | } | 173 | } |
173 | 174 | ||
174 | void MainWindow::slotEditSettings() | 175 | void MainWindow::slotEditSettings() |
175 | { | 176 | { |
176 | } | 177 | } |
177 | 178 | ||
178 | void MainWindow::slotShowFolders( bool ) | 179 | void MainWindow::slotShowFolders( bool ) |
179 | { | 180 | { |
180 | odebug << "slotShowFolders not reached" << oendl; | 181 | odebug << "slotShowFolders not reached" << oendl; |
181 | } | 182 | } |
182 | 183 | ||
183 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) | 184 | void MainWindow::refreshMailView(const QValueList<RecMailP>&) |
184 | { | 185 | { |
185 | odebug << "refreshMailView not reached" << oendl; | 186 | odebug << "refreshMailView not reached" << oendl; |
186 | } | 187 | } |
187 | 188 | ||
188 | void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) | 189 | void MainWindow::mailLeftClicked(int, QListViewItem *,const QPoint&,int ) |
189 | { | 190 | { |
190 | odebug << "mailLeftClicked not reached" << oendl; | 191 | odebug << "mailLeftClicked not reached" << oendl; |
191 | } | 192 | } |
192 | 193 | ||
193 | void MainWindow::displayMail() | 194 | void MainWindow::displayMail() |
194 | { | 195 | { |
195 | odebug << "displayMail not reached" << oendl; | 196 | odebug << "displayMail not reached" << oendl; |
196 | } | 197 | } |
197 | 198 | ||
198 | void MainWindow::slotDeleteMail() | 199 | void MainWindow::slotDeleteMail() |
199 | { | 200 | { |
200 | odebug << "deleteMail not reached" << oendl; | 201 | odebug << "deleteMail not reached" << oendl; |
201 | } | 202 | } |
202 | 203 | ||
203 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) | 204 | void MainWindow::mailHold(int, QListViewItem *,const QPoint&,int ) |
204 | { | 205 | { |
205 | odebug << "mailHold not reached" << oendl; | 206 | odebug << "mailHold not reached" << oendl; |
206 | } | 207 | } |
207 | 208 | ||
208 | void MainWindow::slotSendQueued() | 209 | void MainWindow::slotSendQueued() |
209 | { | 210 | { |
210 | } | 211 | } |
211 | 212 | ||
212 | void MainWindow::slotEditAccounts() | 213 | void MainWindow::slotEditAccounts() |
213 | { | 214 | { |
diff --git a/noncore/net/mail/viewmail.cpp b/noncore/net/mail/viewmail.cpp index ce694d5..d5f9b7f 100644 --- a/noncore/net/mail/viewmail.cpp +++ b/noncore/net/mail/viewmail.cpp | |||
@@ -139,17 +139,17 @@ void ViewMail::setBody(const RecBodyP&body ) | |||
139 | 139 | ||
140 | for (unsigned int i = 0; i < body->Parts().count();++i) | 140 | for (unsigned int i = 0; i < body->Parts().count();++i) |
141 | { | 141 | { |
142 | filename = ""; | 142 | filename = ""; |
143 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); | 143 | type = body->Parts()[i]->Type()+"/"+body->Parts()[i]->Subtype(); |
144 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); | 144 | part_plist_t::ConstIterator it = body->Parts()[i]->Parameters().begin(); |
145 | for (;it!=body->Parts()[i]->Parameters().end();++it) | 145 | for (;it!=body->Parts()[i]->Parameters().end();++it) |
146 | { | 146 | { |
147 | odebug << it.key() << oendl; | 147 | odebug << it.key() << oendl; |
148 | if (it.key().lower()=="name") | 148 | if (it.key().lower()=="name") |
149 | { | 149 | { |
150 | filename=it.data(); | 150 | filename=it.data(); |
151 | } | 151 | } |
152 | } | 152 | } |
153 | s = body->Parts()[i]->Size(); | 153 | s = body->Parts()[i]->Size(); |
154 | w = 0; | 154 | w = 0; |
155 | while (s>1024) | 155 | while (s>1024) |
@@ -242,17 +242,17 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
242 | output.writeBlock(content->Content(),content->Length()); | 242 | output.writeBlock(content->Content(),content->Length()); |
243 | output.close(); | 243 | output.close(); |
244 | delete content; | 244 | delete content; |
245 | } | 245 | } |
246 | } | 246 | } |
247 | } | 247 | } |
248 | break ; | 248 | break ; |
249 | 249 | ||
250 | case 2: | 250 | case 2: |
251 | { | 251 | { |
252 | QString tmpfile = "/tmp/opiemail-image"; | 252 | QString tmpfile = "/tmp/opiemail-image"; |
253 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); | 253 | encodedString*content = m_recMail->Wrapper()->fetchDecodedPart( m_recMail, m_body->Parts()[ ( ( AttachItem* )item )->Partnumber() ] ); |
254 | if (content) { | 254 | if (content) { |
255 | QFile output(tmpfile); | 255 | QFile output(tmpfile); |
256 | output.open(IO_WriteOnly); | 256 | output.open(IO_WriteOnly); |
257 | output.writeBlock(content->Content(),content->Length()); | 257 | output.writeBlock(content->Content(),content->Length()); |
258 | output.close(); | 258 | output.close(); |
@@ -284,17 +284,17 @@ void ViewMail::slotItemClicked( QListViewItem * item , const QPoint & point, int | |||
284 | 284 | ||
285 | void ViewMail::setMail(const RecMailP&mail ) | 285 | void ViewMail::setMail(const RecMailP&mail ) |
286 | { | 286 | { |
287 | 287 | ||
288 | m_recMail = mail; | 288 | m_recMail = mail; |
289 | 289 | ||
290 | m_mail[0] = mail->getFrom(); | 290 | m_mail[0] = mail->getFrom(); |
291 | m_mail[1] = mail->getSubject(); | 291 | m_mail[1] = mail->getSubject(); |
292 | m_mail[3] = mail->getDate(); | 292 | m_mail[3] = mail->getStringDate(); |
293 | m_mail[4] = mail->Msgid(); | 293 | m_mail[4] = mail->Msgid(); |
294 | 294 | ||
295 | m_mail2[0] = mail->To(); | 295 | m_mail2[0] = mail->To(); |
296 | m_mail2[1] = mail->CC(); | 296 | m_mail2[1] = mail->CC(); |
297 | m_mail2[2] = mail->Bcc(); | 297 | m_mail2[2] = mail->Bcc(); |
298 | 298 | ||
299 | setText(); | 299 | setText(); |
300 | } | 300 | } |