summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/genericwrapper.cpp
Unidiff
Diffstat (limited to 'kmicromail/libmailwrapper/genericwrapper.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/libmailwrapper/genericwrapper.cpp35
1 files changed, 25 insertions, 10 deletions
diff --git a/kmicromail/libmailwrapper/genericwrapper.cpp b/kmicromail/libmailwrapper/genericwrapper.cpp
index c3a1627..d99c6a3 100644
--- a/kmicromail/libmailwrapper/genericwrapper.cpp
+++ b/kmicromail/libmailwrapper/genericwrapper.cpp
@@ -27,7 +27,7 @@ Genericwrapper::~Genericwrapper()
27 } 27 }
28 cleanMimeCache(); 28 cleanMimeCache();
29} 29}
30QString Genericwrapper::parseDateTime( mailimf_date_time *date ) 30const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date )
31{ 31{
32 static bool init = false ; 32 static bool init = false ;
33 if ( ! init ) { 33 if ( ! init ) {
@@ -51,15 +51,23 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
51 QDate da (date->dt_year,date->dt_month, date->dt_day ); 51 QDate da (date->dt_year,date->dt_month, date->dt_day );
52 QTime ti ( date->dt_hour, date->dt_min, date->dt_sec ); 52 QTime ti ( date->dt_hour, date->dt_min, date->dt_sec );
53 QDateTime dt ( da ,ti ); 53 QDateTime dt ( da ,ti );
54 int addsec = -date->dt_zone*36;
55 //qDebug("adsec1 %d ",addsec );
56 dt = dt.addSecs( addsec );
54 int off = KGlobal::locale()->localTimeOffset( dt ); 57 int off = KGlobal::locale()->localTimeOffset( dt );
55 //dt = dt.addSecs( off*60 ); 58 //qDebug("adsec2 %d ",off*60 );
59
60 dt = dt.addSecs( off*60 );
61 return dt;
62#if 0
56 QString ret; 63 QString ret;
57 if ( da == QDate::currentDate () ) 64 if ( dt.date() == QDate::currentDate () )
58 ret = KGlobal::locale()->formatTime( ti,true); 65 ret = KGlobal::locale()->formatTime( dt.time(),true);
59 66
60 else { 67 else {
61 ret = KGlobal::locale()->formatDateTime( dt,true,true); 68 ret = KGlobal::locale()->formatDateTime( dt,true,true);
62 } 69 }
70#endif
63#if 0 71#if 0
64 if ( off < 0 ) 72 if ( off < 0 )
65 ret += " -"; 73 ret += " -";
@@ -79,7 +87,7 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
79 87
80 return QString( tmp ); 88 return QString( tmp );
81#endif 89#endif
82 return ret; 90 //return ret;
83} 91}
84 92
85void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime) 93void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime)
@@ -495,11 +503,18 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &
495 if (single_fields.fld_bcc) 503 if (single_fields.fld_bcc)
496 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) ); 504 mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
497 if (single_fields.fld_orig_date) { 505 if (single_fields.fld_orig_date) {
498 mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) ); 506 QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time );
499 char tmp[23]; 507 QString ret;
500 struct mailimf_date_time* date = single_fields.fld_orig_date->dt_date_time; 508 if ( dt.date() == QDate::currentDate () )
501 snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i", 509 ret = KGlobal::locale()->formatTime( dt.time(),true);
502 date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone ); 510 else {
511 ret = KGlobal::locale()->formatDateTime( dt,true,true);
512 }
513 mail->setDate( ret );
514 char tmp[20];
515 snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i",
516 dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() );
517 //qDebug(" iso %s ", tmp);
503 mail->setIsoDate( QString( tmp ) ); 518 mail->setIsoDate( QString( tmp ) );
504 } 519 }
505 // crashes when accessing pop3 account? 520 // crashes when accessing pop3 account?