summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/imapwrapper.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/imapwrapper.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/imapwrapper.cpp17
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,22 +1,23 @@
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
12using namespace Opie::Core; 13using namespace Opie::Core;
13int IMAPwrapper::mMax = 0; 14int IMAPwrapper::mMax = 0;
14int IMAPwrapper::mCurrent = 0; 15int IMAPwrapper::mCurrent = 0;
15 16
16IMAPwrapper::IMAPwrapper( IMAPaccount *a ) 17IMAPwrapper::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;
@@ -456,28 +457,36 @@ RecMail*IMAPwrapper::parse_list_result(mailimap_msg_att* m_att)
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());