-rw-r--r-- | noncore/net/mail/libmailwrapper/libmailwrapper.pro | 6 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailstatics.cpp | 29 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/mailstatics.h | 19 |
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 @@ -11,34 +11,36 @@ HEADERS = mailwrapper.h \ mboxwrapper.h \ settings.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 \ smtpwrapper.cpp \ genericwrapper.cpp \ mboxwrapper.cpp \ settings.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 contains( $(CONFIG_TARGET_MACOSX), y ){ 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 |