summaryrefslogtreecommitdiffabout
path: root/kmicromail/libmailwrapper/genericwrapper.cpp
Side-by-side diff
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
@@ -26,9 +26,9 @@ Genericwrapper::~Genericwrapper()
mailstorage_free(m_storage);
}
cleanMimeCache();
}
-QString Genericwrapper::parseDateTime( mailimf_date_time *date )
+const QDateTime Genericwrapper::parseDateTime( mailimf_date_time *date )
{
static bool init = false ;
if ( ! init ) {
KConfig kon ( locateLocal( "config", "korganizerrc" ) );
@@ -50,17 +50,25 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
}
QDate da (date->dt_year,date->dt_month, date->dt_day );
QTime ti ( date->dt_hour, date->dt_min, date->dt_sec );
QDateTime dt ( da ,ti );
+ int addsec = -date->dt_zone*36;
+ //qDebug("adsec1 %d ",addsec );
+ dt = dt.addSecs( addsec );
int off = KGlobal::locale()->localTimeOffset( dt );
- //dt = dt.addSecs( off*60 );
+ //qDebug("adsec2 %d ",off*60 );
+
+ dt = dt.addSecs( off*60 );
+ return dt;
+#if 0
QString ret;
- if ( da == QDate::currentDate () )
- ret = KGlobal::locale()->formatTime( ti,true);
+ if ( dt.date() == QDate::currentDate () )
+ ret = KGlobal::locale()->formatTime( dt.time(),true);
else {
ret = KGlobal::locale()->formatDateTime( dt,true,true);
}
+#endif
#if 0
if ( off < 0 )
ret += " -";
else
@@ -78,9 +86,9 @@ QString Genericwrapper::parseDateTime( mailimf_date_time *date )
return QString( tmp );
#endif
- return ret;
+ //return ret;
}
void Genericwrapper::fillSingleBody(RecPartP&target,mailmessage*,mailmime*mime)
{
@@ -494,13 +502,20 @@ void Genericwrapper::parseList(QValueList<Opie::Core::OSmartPointer<RecMail> > &
mail->setCC( parseAddressList( single_fields.fld_cc->cc_addr_list ) );
if (single_fields.fld_bcc)
mail->setBcc( parseAddressList( single_fields.fld_bcc->bcc_addr_list ) );
if (single_fields.fld_orig_date) {
- mail->setDate( parseDateTime( single_fields.fld_orig_date->dt_date_time ) );
- char tmp[23];
- struct mailimf_date_time* date = single_fields.fld_orig_date->dt_date_time;
- snprintf( tmp, 23, "%04i-%02i-%02i %02i:%02i:%02i %05i",
- date->dt_year,date->dt_month, date->dt_day, date->dt_hour, date->dt_min, date->dt_sec, date->dt_zone );
+ QDateTime dt = Genericwrapper::parseDateTime( single_fields.fld_orig_date->dt_date_time );
+ QString ret;
+ if ( dt.date() == QDate::currentDate () )
+ ret = KGlobal::locale()->formatTime( dt.time(),true);
+ else {
+ ret = KGlobal::locale()->formatDateTime( dt,true,true);
+ }
+ mail->setDate( ret );
+ char tmp[20];
+ snprintf( tmp, 20, "%04i-%02i-%02i %02i:%02i:%02i",
+ dt.date().year(),dt.date().month(), dt.date().day(), dt.time().hour(), dt.time().minute(), dt.time().second() );
+ //qDebug(" iso %s ", tmp);
mail->setIsoDate( QString( tmp ) );
}
// crashes when accessing pop3 account?
if (single_fields.fld_message_id) {