author | alwin <alwin> | 2004-10-25 22:32:23 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-10-25 22:32:23 (UTC) |
commit | ef34b8716b06f2225d7cf76e22a7a72cf5b689df (patch) (unidiff) | |
tree | b39ae352592b034fb9c825f7b7507882feba55b7 | |
parent | f3e72852d40bdf7c664f60390ce3cc7485bd8410 (diff) | |
download | opie-ef34b8716b06f2225d7cf76e22a7a72cf5b689df.zip opie-ef34b8716b06f2225d7cf76e22a7a72cf5b689df.tar.gz opie-ef34b8716b06f2225d7cf76e22a7a72cf5b689df.tar.bz2 |
helper class added
-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 | |||
@@ -16,7 +16,8 @@ HEADERS = mailwrapper.h \ | |||
16 | mhwrapper.h \ | 16 | mhwrapper.h \ |
17 | nntpwrapper.h \ | 17 | nntpwrapper.h \ |
18 | generatemail.h \ | 18 | generatemail.h \ |
19 | storemail.h | 19 | storemail.h \ |
20 | mailstatics.h | ||
20 | 21 | ||
21 | SOURCES = imapwrapper.cpp \ | 22 | SOURCES = imapwrapper.cpp \ |
22 | mailwrapper.cpp \ | 23 | mailwrapper.cpp \ |
@@ -33,7 +34,8 @@ SOURCES = imapwrapper.cpp \ | |||
33 | mhwrapper.cpp \ | 34 | mhwrapper.cpp \ |
34 | nntpwrapper.cpp \ | 35 | nntpwrapper.cpp \ |
35 | generatemail.cpp \ | 36 | generatemail.cpp \ |
36 | storemail.cpp | 37 | storemail.cpp \ |
38 | mailstatics.cpp | ||
37 | 39 | ||
38 | INTERFACES = logindialogui.ui \ | 40 | INTERFACES = logindialogui.ui \ |
39 | sendmailprogressui.ui | 41 | sendmailprogressui.ui |
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 @@ | |||
1 | #include "mailstatics.h" | ||
2 | #include <libetpan/libetpan.h> | ||
3 | #include <qpe/timestring.h> | ||
4 | |||
5 | QString MailStatics::parseDateTime(const mailimf_date_time *date ) | ||
6 | { | ||
7 | if (!date) return ""; | ||
8 | QDateTime da(QDate(date->dt_year,date->dt_month,date->dt_day),QTime(date->dt_hour,date->dt_min,date->dt_sec)); | ||
9 | QString timestring = TimeString::numberDateString(QDate(date->dt_year,date->dt_month,date->dt_day))+" "; | ||
10 | timestring+=TimeString::timeString(QTime(date->dt_hour,date->dt_min,date->dt_sec))+" "; | ||
11 | timestring.sprintf(timestring+" %+05i",date->dt_zone); | ||
12 | return timestring; | ||
13 | } | ||
14 | |||
15 | QString MailStatics::parseDateTime(const char*date) | ||
16 | { | ||
17 | mailimf_date_time * date_time; | ||
18 | QString d = ""; | ||
19 | size_t cur_tok = 0; | ||
20 | if (!date) return d; | ||
21 | int r = mailimf_date_time_parse(date,strlen(date),&cur_tok,&date_time); | ||
22 | if (r==MAILIMF_NO_ERROR) { | ||
23 | d = parseDateTime(date_time); | ||
24 | } | ||
25 | if (date_time) { | ||
26 | mailimf_date_time_free(date_time); | ||
27 | } | ||
28 | return d; | ||
29 | } \ 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 @@ | |||
1 | #ifndef __MAIL_STATICS_H | ||
2 | #define __MAIL_STATICS_H | ||
3 | |||
4 | #include <qdatetime.h> | ||
5 | #include <qstring.h> | ||
6 | |||
7 | struct mailimf_date_time; | ||
8 | |||
9 | class MailStatics | ||
10 | { | ||
11 | protected: | ||
12 | static QString parseDateTime(const mailimf_date_time * date); | ||
13 | static QString parseDateTime(const char*date); | ||
14 | MailStatics(){}; | ||
15 | virtual ~MailStatics(){}; | ||
16 | public: | ||
17 | }; | ||
18 | |||
19 | #endif | ||