author | zautrix <zautrix> | 2004-09-16 23:05:56 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-16 23:05:56 (UTC) |
commit | af411746b1480e7b331ea7d163f39d2507cf7264 (patch) (unidiff) | |
tree | bc839893f0bd002a34368987bdda3e71aad630c4 /kmicromail/libmailwrapper/imapwrapper.cpp | |
parent | b44edfb21be0eee91c4f47401e3fe6ff37e4c16c (diff) | |
download | kdepimpi-af411746b1480e7b331ea7d163f39d2507cf7264.zip kdepimpi-af411746b1480e7b331ea7d163f39d2507cf7264.tar.gz kdepimpi-af411746b1480e7b331ea7d163f39d2507cf7264.tar.bz2 |
Fixed timezone problems in ompi
Diffstat (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kmicromail/libmailwrapper/imapwrapper.cpp | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/kmicromail/libmailwrapper/imapwrapper.cpp b/kmicromail/libmailwrapper/imapwrapper.cpp index d79df4f..b0dd1b8 100644 --- a/kmicromail/libmailwrapper/imapwrapper.cpp +++ b/kmicromail/libmailwrapper/imapwrapper.cpp | |||
@@ -1,34 +1,35 @@ | |||
1 | // CHANGED 2004-09-31 Lutz Rogowski | 1 | // CHANGED 2004-09-31 Lutz Rogowski |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <libetpan/libetpan.h> | 3 | #include <libetpan/libetpan.h> |
4 | #include <qpe/global.h> | 4 | #include <qpe/global.h> |
5 | #include <qapplication.h> | 5 | #include <qapplication.h> |
6 | #include "imapwrapper.h" | 6 | #include "imapwrapper.h" |
7 | #include "mailtypes.h" | 7 | #include "mailtypes.h" |
8 | #include "logindialog.h" | 8 | #include "logindialog.h" |
9 | #include <qprogressbar.h> | 9 | #include <qprogressbar.h> |
10 | #include "genericwrapper.h" | 10 | #include "genericwrapper.h" |
11 | #include <kglobal.h> | ||
11 | 12 | ||
12 | using namespace Opie::Core; | 13 | using namespace Opie::Core; |
13 | int IMAPwrapper::mMax = 0; | 14 | int IMAPwrapper::mMax = 0; |
14 | int IMAPwrapper::mCurrent = 0; | 15 | int IMAPwrapper::mCurrent = 0; |
15 | 16 | ||
16 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 17 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
17 | : AbstractMail() | 18 | : AbstractMail() |
18 | { | 19 | { |
19 | account = a; | 20 | account = a; |
20 | m_imap = 0; | 21 | m_imap = 0; |
21 | m_Lastmbox = ""; | 22 | m_Lastmbox = ""; |
22 | mCurrent = 0; | 23 | mCurrent = 0; |
23 | mMax = 0; | 24 | mMax = 0; |
24 | } | 25 | } |
25 | 26 | ||
26 | IMAPwrapper::~IMAPwrapper() | 27 | IMAPwrapper::~IMAPwrapper() |
27 | { | 28 | { |
28 | logout(); | 29 | logout(); |
29 | } | 30 | } |
30 | 31 | ||
31 | /* to avoid to often select statements in loops etc. | 32 | /* to avoid to often select statements in loops etc. |
32 | we trust that we are logged in and connection is established!*/ | 33 | we trust that we are logged in and connection is established!*/ |
33 | int IMAPwrapper::selectMbox(const QString&mbox) | 34 | int IMAPwrapper::selectMbox(const QString&mbox) |
34 | { | 35 | { |
@@ -444,52 +445,60 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att) | |||
444 | break; | 445 | break; |
445 | default: | 446 | default: |
446 | break; | 447 | break; |
447 | } | 448 | } |
448 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { | 449 | } else if (cflag->fl_type==MAILIMAP_FLAG_FETCH_RECENT) { |
449 | mFlags.setBit(FLAG_RECENT); | 450 | mFlags.setBit(FLAG_RECENT); |
450 | } | 451 | } |
451 | } | 452 | } |
452 | continue; | 453 | continue; |
453 | } | 454 | } |
454 | if ( item->att_data.att_static == NULL ) | 455 | if ( item->att_data.att_static == NULL ) |
455 | continue; | 456 | continue; |
456 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { | 457 | if (item->att_data.att_static->att_type==MAILIMAP_MSG_ATT_ENVELOPE) { |
457 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; | 458 | mailimap_envelope * head = item->att_data.att_static->att_data.att_env; |
458 | if ( head == NULL ) | 459 | if ( head == NULL ) |
459 | continue; | 460 | continue; |
460 | if ( head->env_date != NULL ) { | 461 | if ( head->env_date != NULL ) { |
461 | m->setDate(head->env_date); | 462 | m->setDate(head->env_date); |
462 | struct mailimf_date_time result; | 463 | struct mailimf_date_time result; |
463 | struct mailimf_date_time* date = &result; | 464 | struct mailimf_date_time* date = &result; |
464 | struct mailimf_date_time **re = &date; | 465 | struct mailimf_date_time **re = &date; |
465 | size_t length = m->getDate().length(); | 466 | size_t length = m->getDate().length(); |
466 | size_t index = 0; | 467 | size_t index = 0; |
467 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { | 468 | if ( mailimf_date_time_parse(head->env_date, length,&index, re ) == MAILIMF_NO_ERROR ) { |
468 | m->setDate( Genericwrapper::parseDateTime( date ) ); | 469 | QDateTime dt = Genericwrapper::parseDateTime( date ); |
469 | char tmp[23]; | 470 | QString ret; |
470 | snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", | 471 | if ( dt.date() == QDate::currentDate () ) |
471 | date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); | 472 | ret = KGlobal::locale()->formatTime( dt.time(),true); |
473 | else { | ||
474 | ret = KGlobal::locale()->formatDateTime( dt,true,true); | ||
475 | } | ||
476 | m->setDate( ret ); | ||
477 | char tmp[20]; | ||
478 | snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i", | ||
479 | dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() ); | ||
480 | //qDebug("%d iso %s %s ", date->dt_zone, tmp, head->env_date); | ||
472 | m->setIsoDate( QString( tmp ) ); | 481 | m->setIsoDate( QString( tmp ) ); |
473 | } else { | 482 | } else { |
474 | m->setIsoDate(head->env_date); | 483 | m->setIsoDate(head->env_date); |
475 | } | 484 | } |
476 | } | 485 | } |
477 | if ( head->env_subject != NULL ) | 486 | if ( head->env_subject != NULL ) |
478 | m->setSubject(convert_String((const char*)head->env_subject)); | 487 | m->setSubject(convert_String((const char*)head->env_subject)); |
479 | //m->setSubject(head->env_subject); | 488 | //m->setSubject(head->env_subject); |
480 | if (head->env_from!=NULL) { | 489 | if (head->env_from!=NULL) { |
481 | addresslist = address_list_to_stringlist(head->env_from->frm_list); | 490 | addresslist = address_list_to_stringlist(head->env_from->frm_list); |
482 | if (addresslist.count()) { | 491 | if (addresslist.count()) { |
483 | m->setFrom(addresslist.first()); | 492 | m->setFrom(addresslist.first()); |
484 | } | 493 | } |
485 | } | 494 | } |
486 | if (head->env_to!=NULL) { | 495 | if (head->env_to!=NULL) { |
487 | addresslist = address_list_to_stringlist(head->env_to->to_list); | 496 | addresslist = address_list_to_stringlist(head->env_to->to_list); |
488 | m->setTo(addresslist); | 497 | m->setTo(addresslist); |
489 | } | 498 | } |
490 | if (head->env_cc!=NULL) { | 499 | if (head->env_cc!=NULL) { |
491 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); | 500 | addresslist = address_list_to_stringlist(head->env_cc->cc_list); |
492 | m->setCC(addresslist); | 501 | m->setCC(addresslist); |
493 | } | 502 | } |
494 | if (head->env_bcc!=NULL) { | 503 | if (head->env_bcc!=NULL) { |
495 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); | 504 | addresslist = address_list_to_stringlist(head->env_bcc->bcc_list); |