summaryrefslogtreecommitdiff
authoralwin <alwin>2004-10-25 22:32:23 (UTC)
committer alwin <alwin>2004-10-25 22:32:23 (UTC)
commitef34b8716b06f2225d7cf76e22a7a72cf5b689df (patch) (side-by-side diff)
treeb39ae352592b034fb9c825f7b7507882feba55b7
parentf3e72852d40bdf7c664f60390ce3cc7485bd8410 (diff)
downloadopie-ef34b8716b06f2225d7cf76e22a7a72cf5b689df.zip
opie-ef34b8716b06f2225d7cf76e22a7a72cf5b689df.tar.gz
opie-ef34b8716b06f2225d7cf76e22a7a72cf5b689df.tar.bz2
helper class added
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/libmailwrapper/libmailwrapper.pro6
-rw-r--r--noncore/net/mail/libmailwrapper/mailstatics.cpp29
-rw-r--r--noncore/net/mail/libmailwrapper/mailstatics.h19
3 files changed, 52 insertions, 2 deletions
diff --git a/noncore/net/mail/libmailwrapper/libmailwrapper.pro b/noncore/net/mail/libmailwrapper/libmailwrapper.pro
index befadd7..dd9efcb 100644
--- a/noncore/net/mail/libmailwrapper/libmailwrapper.pro
+++ b/noncore/net/mail/libmailwrapper/libmailwrapper.pro
@@ -13,13 +13,14 @@ HEADERS = mailwrapper.h \
logindialog.h \
sendmailprogress.h \
statusmail.h \
mhwrapper.h \
nntpwrapper.h \
generatemail.h \
- storemail.h
+ storemail.h \
+ mailstatics.h
SOURCES = imapwrapper.cpp \
mailwrapper.cpp \
mailtypes.cpp \
pop3wrapper.cpp \
abstractmail.cpp \
@@ -30,13 +31,14 @@ SOURCES = imapwrapper.cpp \
logindialog.cpp \
sendmailprogress.cpp \
statusmail.cpp \
mhwrapper.cpp \
nntpwrapper.cpp \
generatemail.cpp \
- storemail.cpp
+ storemail.cpp \
+ mailstatics.cpp
INTERFACES = logindialogui.ui \
sendmailprogressui.ui
INCLUDEPATH += $(OPIEDIR)/include
LIBS += -lqpe -letpan -lssl -lcrypto
diff --git a/noncore/net/mail/libmailwrapper/mailstatics.cpp b/noncore/net/mail/libmailwrapper/mailstatics.cpp
new file mode 100644
index 0000000..4878dc9
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/mailstatics.cpp
@@ -0,0 +1,29 @@
+#include "mailstatics.h"
+#include <libetpan/libetpan.h>
+#include <qpe/timestring.h>
+
+QString MailStatics::parseDateTime(const mailimf_date_time *date )
+{
+ if (!date) return "";
+ QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec));
+ QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" ";
+ timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" ";
+ timestring.sprintf(timestring+" %+05i",date->dt_zone);
+ return timestring;
+}
+
+QString MailStatics::parseDateTime(const char*date)
+{
+ mailimf_date_time * date_time;
+ QString d = "";
+ size_t cur_tok = 0;
+ if (!date) return d;
+ int r = mailimf_date_time_parse(date,strlen(date),&cur_tok,&date_time);
+ if (r==MAILIMF_NO_ERROR) {
+ d = parseDateTime(date_time);
+ }
+ if (date_time) {
+ mailimf_date_time_free(date_time);
+ }
+ return d;
+} \ No newline at end of file
diff --git a/noncore/net/mail/libmailwrapper/mailstatics.h b/noncore/net/mail/libmailwrapper/mailstatics.h
new file mode 100644
index 0000000..841d14d
--- a/dev/null
+++ b/noncore/net/mail/libmailwrapper/mailstatics.h
@@ -0,0 +1,19 @@
+#ifndef __MAIL_STATICS_H
+#define __MAIL_STATICS_H
+
+#include <qdatetime.h>
+#include <qstring.h>
+
+struct mailimf_date_time;
+
+class MailStatics
+{
+protected:
+ static QString parseDateTime(const mailimf_date_time * date);
+ static QString parseDateTime(const char*date);
+ MailStatics(){};
+ virtual ~MailStatics(){};
+public:
+};
+
+#endif