author | alwin <alwin> | 2003-12-13 20:39:07 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-13 20:39:07 (UTC) |
commit | 85444223acfafd9d7955032b2cbdad3279ba27ad (patch) (unidiff) | |
tree | 444063490a58ffc7ca085219827a577ad6213442 | |
parent | d161cb46c21ae6a9e9f74dc60fb6ac6ac8e62f1b (diff) | |
download | opie-85444223acfafd9d7955032b2cbdad3279ba27ad.zip opie-85444223acfafd9d7955032b2cbdad3279ba27ad.tar.gz opie-85444223acfafd9d7955032b2cbdad3279ba27ad.tar.bz2 |
imap/pop3 wrapper uses base virtual class so we can forward the pointer
independend of its later use.
ToDo: find a more general interface for it
-rw-r--r-- | noncore/net/mail/abstractmail.cpp | 13 | ||||
-rw-r--r-- | noncore/net/mail/abstractmail.h | 30 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 16 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 15 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/imapwrapper.h | 17 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.cpp | 13 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/abstractmail.h | 30 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.cpp | 5 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/imapwrapper.h | 17 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.cpp | 21 | ||||
-rw-r--r-- | noncore/net/mail/libmailwrapper/pop3wrapper.h | 11 | ||||
-rw-r--r-- | noncore/net/mail/mail.pro | 6 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 1 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.h | 4 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.cpp | 21 | ||||
-rw-r--r-- | noncore/net/mail/pop3wrapper.h | 11 |
17 files changed, 180 insertions, 56 deletions
diff --git a/noncore/net/mail/abstractmail.cpp b/noncore/net/mail/abstractmail.cpp new file mode 100644 index 0000000..7380c31 --- a/dev/null +++ b/noncore/net/mail/abstractmail.cpp | |||
@@ -0,0 +1,13 @@ | |||
1 | #include "abstractmail.h" | ||
2 | #include "imapwrapper.h" | ||
3 | #include "pop3wrapper.h" | ||
4 | |||
5 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | ||
6 | { | ||
7 | return new IMAPwrapper(a); | ||
8 | } | ||
9 | |||
10 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | ||
11 | { | ||
12 | return new POP3wrapper(a); | ||
13 | } | ||
diff --git a/noncore/net/mail/abstractmail.h b/noncore/net/mail/abstractmail.h new file mode 100644 index 0000000..bc8938f --- a/dev/null +++ b/noncore/net/mail/abstractmail.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef __abstract_mail_ | ||
2 | #define __abstract_mail_ | ||
3 | |||
4 | #include <qobject.h> | ||
5 | #include "settings.h" | ||
6 | |||
7 | class RecMail; | ||
8 | class RecBody; | ||
9 | class RecPart; | ||
10 | class IMAPwrapper; | ||
11 | class POP3wrapper; | ||
12 | class Folder; | ||
13 | |||
14 | class AbstractMail:public QObject | ||
15 | { | ||
16 | Q_OBJECT | ||
17 | public: | ||
18 | AbstractMail(){}; | ||
19 | virtual ~AbstractMail(){} | ||
20 | virtual QList<Folder>* listFolders()=0; | ||
21 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; | ||
22 | virtual RecBody fetchBody(const RecMail&mail)=0; | ||
23 | virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false)=0; | ||
24 | virtual QString fetchPart(const RecMail&mail,const RecPart&part)=0; | ||
25 | |||
26 | static AbstractMail* getWrapper(IMAPaccount *a); | ||
27 | static AbstractMail* getWrapper(POP3account *a); | ||
28 | }; | ||
29 | |||
30 | #endif | ||
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index c7b1eeb..1069b9f 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,7 +1,5 @@ | |||
1 | #include "accountview.h" | 1 | #include "accountview.h" |
2 | #include "imapwrapper.h" | ||
3 | #include "pop3wrapper.h" | ||
4 | #include "mailtypes.h" | 2 | #include "mailtypes.h" |
5 | #include "defines.h" | 3 | #include "defines.h" |
6 | 4 | ||
7 | 5 | ||
@@ -12,9 +10,9 @@ | |||
12 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) | 10 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) |
13 | : AccountViewItem( parent ) | 11 | : AccountViewItem( parent ) |
14 | { | 12 | { |
15 | account = a; | 13 | account = a; |
16 | wrapper = new POP3wrapper( account ); | 14 | wrapper = AbstractMail::getWrapper( account ); |
17 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 15 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
18 | setText( 0, account->getAccountName() ); | 16 | setText( 0, account->getAccountName() ); |
19 | } | 17 | } |
20 | 18 | ||
@@ -25,9 +23,9 @@ POP3viewItem::~POP3viewItem() | |||
25 | 23 | ||
26 | void POP3viewItem::refresh( QList<RecMail> &target ) | 24 | void POP3viewItem::refresh( QList<RecMail> &target ) |
27 | { | 25 | { |
28 | qDebug( "POP3: refresh" ); | 26 | qDebug( "POP3: refresh" ); |
29 | wrapper->listMessages( target ); | 27 | wrapper->listMessages("INBOX", target ); |
30 | } | 28 | } |
31 | 29 | ||
32 | 30 | ||
33 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) | 31 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) |
@@ -43,9 +41,9 @@ RecBody POP3viewItem::fetchBody( const RecMail &mail ) | |||
43 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) | 41 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) |
44 | : AccountViewItem( parent ) | 42 | : AccountViewItem( parent ) |
45 | { | 43 | { |
46 | account = a; | 44 | account = a; |
47 | wrapper = new IMAPwrapper( account ); | 45 | wrapper = AbstractMail::getWrapper( account ); |
48 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 46 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
49 | setText( 0, account->getAccountName() ); | 47 | setText( 0, account->getAccountName() ); |
50 | setOpen( true ); | 48 | setOpen( true ); |
51 | } | 49 | } |
@@ -54,25 +52,25 @@ IMAPviewItem::~IMAPviewItem() | |||
54 | { | 52 | { |
55 | delete wrapper; | 53 | delete wrapper; |
56 | } | 54 | } |
57 | 55 | ||
58 | IMAPwrapper *IMAPviewItem::getWrapper() | 56 | AbstractMail *IMAPviewItem::getWrapper() |
59 | { | 57 | { |
60 | return wrapper; | 58 | return wrapper; |
61 | } | 59 | } |
62 | 60 | ||
63 | void IMAPviewItem::refresh(QList<RecMail>&) | 61 | void IMAPviewItem::refresh(QList<RecMail>&) |
64 | { | 62 | { |
65 | QList<IMAPFolder> *folders = wrapper->listFolders(); | 63 | QList<Folder> *folders = wrapper->listFolders(); |
66 | 64 | ||
67 | QListViewItem *child = firstChild(); | 65 | QListViewItem *child = firstChild(); |
68 | while ( child ) { | 66 | while ( child ) { |
69 | QListViewItem *tmp = child; | 67 | QListViewItem *tmp = child; |
70 | child = child->nextSibling(); | 68 | child = child->nextSibling(); |
71 | delete tmp; | 69 | delete tmp; |
72 | } | 70 | } |
73 | 71 | ||
74 | IMAPFolder *it; | 72 | Folder *it; |
75 | for ( it = folders->first(); it; it = folders->next() ) { | 73 | for ( it = folders->first(); it; it = folders->next() ) { |
76 | (void) new IMAPfolderItem( it, this ); | 74 | (void) new IMAPfolderItem( it, this ); |
77 | } | 75 | } |
78 | } | 76 | } |
@@ -86,9 +84,9 @@ IMAPfolderItem::~IMAPfolderItem() | |||
86 | { | 84 | { |
87 | delete folder; | 85 | delete folder; |
88 | } | 86 | } |
89 | 87 | ||
90 | IMAPfolderItem::IMAPfolderItem( IMAPFolder *folderInit, IMAPviewItem *parent ) | 88 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent ) |
91 | : AccountViewItem( parent ) | 89 | : AccountViewItem( parent ) |
92 | { | 90 | { |
93 | folder = folderInit; | 91 | folder = folderInit; |
94 | imap = parent; | 92 | imap = parent; |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 4cac673..83d49af 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -5,10 +5,10 @@ | |||
5 | #include <qlist.h> | 5 | #include <qlist.h> |
6 | 6 | ||
7 | #include "settings.h" | 7 | #include "settings.h" |
8 | #include "mailwrapper.h" | 8 | #include "mailwrapper.h" |
9 | #include "abstractmail.h" | ||
9 | 10 | ||
10 | class IMAPwrapper; | ||
11 | class POP3wrapper; | 11 | class POP3wrapper; |
12 | class RecMail; | 12 | class RecMail; |
13 | class RecBody; | 13 | class RecBody; |
14 | 14 | ||
@@ -32,9 +32,9 @@ public: | |||
32 | virtual RecBody fetchBody( const RecMail &mail ); | 32 | virtual RecBody fetchBody( const RecMail &mail ); |
33 | 33 | ||
34 | private: | 34 | private: |
35 | POP3account *account; | 35 | POP3account *account; |
36 | POP3wrapper *wrapper; | 36 | AbstractMail *wrapper; |
37 | 37 | ||
38 | }; | 38 | }; |
39 | 39 | ||
40 | class IMAPviewItem : public AccountViewItem | 40 | class IMAPviewItem : public AccountViewItem |
@@ -44,27 +44,24 @@ public: | |||
44 | IMAPviewItem( IMAPaccount *a, QListView *parent ); | 44 | IMAPviewItem( IMAPaccount *a, QListView *parent ); |
45 | ~IMAPviewItem(); | 45 | ~IMAPviewItem(); |
46 | virtual void refresh(QList<RecMail>&); | 46 | virtual void refresh(QList<RecMail>&); |
47 | virtual RecBody fetchBody(const RecMail&); | 47 | virtual RecBody fetchBody(const RecMail&); |
48 | IMAPwrapper *getWrapper(); | 48 | AbstractMail *getWrapper(); |
49 | |||
50 | private: | 49 | private: |
51 | IMAPaccount *account; | 50 | IMAPaccount *account; |
52 | IMAPwrapper *wrapper; | 51 | AbstractMail *wrapper; |
53 | |||
54 | }; | 52 | }; |
55 | 53 | ||
56 | class IMAPfolderItem : public AccountViewItem | 54 | class IMAPfolderItem : public AccountViewItem |
57 | { | 55 | { |
58 | 56 | ||
59 | public: | 57 | public: |
60 | IMAPfolderItem( IMAPFolder *folder, IMAPviewItem *parent ); | 58 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent ); |
61 | ~IMAPfolderItem(); | 59 | ~IMAPfolderItem(); |
62 | virtual void refresh(QList<RecMail>&); | 60 | virtual void refresh(QList<RecMail>&); |
63 | virtual RecBody fetchBody(const RecMail&); | 61 | virtual RecBody fetchBody(const RecMail&); |
64 | |||
65 | private: | 62 | private: |
66 | IMAPFolder *folder; | 63 | Folder *folder; |
67 | IMAPviewItem *imap; | 64 | IMAPviewItem *imap; |
68 | 65 | ||
69 | }; | 66 | }; |
70 | 67 | ||
diff --git a/noncore/net/mail/imapwrapper.cpp b/noncore/net/mail/imapwrapper.cpp index 48e476b..e5eb335 100644 --- a/noncore/net/mail/imapwrapper.cpp +++ b/noncore/net/mail/imapwrapper.cpp | |||
@@ -5,8 +5,9 @@ | |||
5 | #include "mailtypes.h" | 5 | #include "mailtypes.h" |
6 | #include <libetpan/mailimap.h> | 6 | #include <libetpan/mailimap.h> |
7 | 7 | ||
8 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 8 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
9 | : AbstractMail() | ||
9 | { | 10 | { |
10 | account = a; | 11 | account = a; |
11 | m_imap = 0; | 12 | m_imap = 0; |
12 | } | 13 | } |
@@ -138,16 +139,16 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
138 | } | 139 | } |
139 | mailimap_fetch_list_free(result); | 140 | mailimap_fetch_list_free(result); |
140 | } | 141 | } |
141 | 142 | ||
142 | QList<IMAPFolder>* IMAPwrapper::listFolders() | 143 | QList<Folder>* IMAPwrapper::listFolders() |
143 | { | 144 | { |
144 | const char *path, *mask; | 145 | const char *path, *mask; |
145 | int err = MAILIMAP_NO_ERROR; | 146 | int err = MAILIMAP_NO_ERROR; |
146 | clist *result; | 147 | clist *result; |
147 | clistcell *current; | 148 | clistcell *current; |
148 | 149 | ||
149 | QList<IMAPFolder> * folders = new QList<IMAPFolder>(); | 150 | QList<Folder> * folders = new QList<Folder>(); |
150 | folders->setAutoDelete( true ); | 151 | folders->setAutoDelete( true ); |
151 | login(); | 152 | login(); |
152 | if (!m_imap) { | 153 | if (!m_imap) { |
153 | return folders; | 154 | return folders; |
diff --git a/noncore/net/mail/imapwrapper.h b/noncore/net/mail/imapwrapper.h index 95de215..f88457a 100644 --- a/noncore/net/mail/imapwrapper.h +++ b/noncore/net/mail/imapwrapper.h | |||
@@ -2,8 +2,9 @@ | |||
2 | #define __IMAPWRAPPER | 2 | #define __IMAPWRAPPER |
3 | 3 | ||
4 | #include <qlist.h> | 4 | #include <qlist.h> |
5 | #include "mailwrapper.h" | 5 | #include "mailwrapper.h" |
6 | #include "abstractmail.h" | ||
6 | 7 | ||
7 | struct mailimap; | 8 | struct mailimap; |
8 | struct mailimap_body_type_1part; | 9 | struct mailimap_body_type_1part; |
9 | struct mailimap_body_type_text; | 10 | struct mailimap_body_type_text; |
@@ -11,24 +12,20 @@ struct mailimap_body_type_basic; | |||
11 | struct mailimap_body_type_msg; | 12 | struct mailimap_body_type_msg; |
12 | struct mailimap_body_type_mpart; | 13 | struct mailimap_body_type_mpart; |
13 | struct mailimap_body_fields; | 14 | struct mailimap_body_fields; |
14 | struct mailimap_msg_att; | 15 | struct mailimap_msg_att; |
15 | class RecMail; | ||
16 | class RecBody; | ||
17 | class RecPart; | ||
18 | 16 | ||
19 | class IMAPwrapper : public QObject | 17 | class IMAPwrapper : public AbstractMail |
20 | { | 18 | { |
21 | Q_OBJECT | 19 | Q_OBJECT |
22 | |||
23 | public: | 20 | public: |
24 | IMAPwrapper( IMAPaccount *a ); | 21 | IMAPwrapper( IMAPaccount *a ); |
25 | virtual ~IMAPwrapper(); | 22 | virtual ~IMAPwrapper(); |
26 | QList<IMAPFolder>* listFolders(); | 23 | virtual QList<Folder>* listFolders(); |
27 | void listMessages(const QString & mailbox,QList<RecMail>&target ); | 24 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); |
28 | RecBody fetchBody(const RecMail&mail); | 25 | virtual RecBody fetchBody(const RecMail&mail); |
29 | QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false); | 26 | virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false); |
30 | QString fetchPart(const RecMail&mail,const RecPart&part); | 27 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); |
31 | static void imap_progress( size_t current, size_t maximum ); | 28 | static void imap_progress( size_t current, size_t maximum ); |
32 | 29 | ||
33 | protected: | 30 | protected: |
34 | RecMail*parse_list_result(mailimap_msg_att*); | 31 | RecMail*parse_list_result(mailimap_msg_att*); |
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.cpp b/noncore/net/mail/libmailwrapper/abstractmail.cpp new file mode 100644 index 0000000..7380c31 --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/abstractmail.cpp | |||
@@ -0,0 +1,13 @@ | |||
1 | #include "abstractmail.h" | ||
2 | #include "imapwrapper.h" | ||
3 | #include "pop3wrapper.h" | ||
4 | |||
5 | AbstractMail* AbstractMail::getWrapper(IMAPaccount *a) | ||
6 | { | ||
7 | return new IMAPwrapper(a); | ||
8 | } | ||
9 | |||
10 | AbstractMail* AbstractMail::getWrapper(POP3account *a) | ||
11 | { | ||
12 | return new POP3wrapper(a); | ||
13 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/abstractmail.h b/noncore/net/mail/libmailwrapper/abstractmail.h new file mode 100644 index 0000000..bc8938f --- a/dev/null +++ b/noncore/net/mail/libmailwrapper/abstractmail.h | |||
@@ -0,0 +1,30 @@ | |||
1 | #ifndef __abstract_mail_ | ||
2 | #define __abstract_mail_ | ||
3 | |||
4 | #include <qobject.h> | ||
5 | #include "settings.h" | ||
6 | |||
7 | class RecMail; | ||
8 | class RecBody; | ||
9 | class RecPart; | ||
10 | class IMAPwrapper; | ||
11 | class POP3wrapper; | ||
12 | class Folder; | ||
13 | |||
14 | class AbstractMail:public QObject | ||
15 | { | ||
16 | Q_OBJECT | ||
17 | public: | ||
18 | AbstractMail(){}; | ||
19 | virtual ~AbstractMail(){} | ||
20 | virtual QList<Folder>* listFolders()=0; | ||
21 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target )=0; | ||
22 | virtual RecBody fetchBody(const RecMail&mail)=0; | ||
23 | virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false)=0; | ||
24 | virtual QString fetchPart(const RecMail&mail,const RecPart&part)=0; | ||
25 | |||
26 | static AbstractMail* getWrapper(IMAPaccount *a); | ||
27 | static AbstractMail* getWrapper(POP3account *a); | ||
28 | }; | ||
29 | |||
30 | #endif | ||
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.cpp b/noncore/net/mail/libmailwrapper/imapwrapper.cpp index 48e476b..e5eb335 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.cpp +++ b/noncore/net/mail/libmailwrapper/imapwrapper.cpp | |||
@@ -5,8 +5,9 @@ | |||
5 | #include "mailtypes.h" | 5 | #include "mailtypes.h" |
6 | #include <libetpan/mailimap.h> | 6 | #include <libetpan/mailimap.h> |
7 | 7 | ||
8 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) | 8 | IMAPwrapper::IMAPwrapper( IMAPaccount *a ) |
9 | : AbstractMail() | ||
9 | { | 10 | { |
10 | account = a; | 11 | account = a; |
11 | m_imap = 0; | 12 | m_imap = 0; |
12 | } | 13 | } |
@@ -138,16 +139,16 @@ void IMAPwrapper::listMessages(const QString&mailbox,QList<RecMail> &target ) | |||
138 | } | 139 | } |
139 | mailimap_fetch_list_free(result); | 140 | mailimap_fetch_list_free(result); |
140 | } | 141 | } |
141 | 142 | ||
142 | QList<IMAPFolder>* IMAPwrapper::listFolders() | 143 | QList<Folder>* IMAPwrapper::listFolders() |
143 | { | 144 | { |
144 | const char *path, *mask; | 145 | const char *path, *mask; |
145 | int err = MAILIMAP_NO_ERROR; | 146 | int err = MAILIMAP_NO_ERROR; |
146 | clist *result; | 147 | clist *result; |
147 | clistcell *current; | 148 | clistcell *current; |
148 | 149 | ||
149 | QList<IMAPFolder> * folders = new QList<IMAPFolder>(); | 150 | QList<Folder> * folders = new QList<Folder>(); |
150 | folders->setAutoDelete( true ); | 151 | folders->setAutoDelete( true ); |
151 | login(); | 152 | login(); |
152 | if (!m_imap) { | 153 | if (!m_imap) { |
153 | return folders; | 154 | return folders; |
diff --git a/noncore/net/mail/libmailwrapper/imapwrapper.h b/noncore/net/mail/libmailwrapper/imapwrapper.h index 95de215..f88457a 100644 --- a/noncore/net/mail/libmailwrapper/imapwrapper.h +++ b/noncore/net/mail/libmailwrapper/imapwrapper.h | |||
@@ -2,8 +2,9 @@ | |||
2 | #define __IMAPWRAPPER | 2 | #define __IMAPWRAPPER |
3 | 3 | ||
4 | #include <qlist.h> | 4 | #include <qlist.h> |
5 | #include "mailwrapper.h" | 5 | #include "mailwrapper.h" |
6 | #include "abstractmail.h" | ||
6 | 7 | ||
7 | struct mailimap; | 8 | struct mailimap; |
8 | struct mailimap_body_type_1part; | 9 | struct mailimap_body_type_1part; |
9 | struct mailimap_body_type_text; | 10 | struct mailimap_body_type_text; |
@@ -11,24 +12,20 @@ struct mailimap_body_type_basic; | |||
11 | struct mailimap_body_type_msg; | 12 | struct mailimap_body_type_msg; |
12 | struct mailimap_body_type_mpart; | 13 | struct mailimap_body_type_mpart; |
13 | struct mailimap_body_fields; | 14 | struct mailimap_body_fields; |
14 | struct mailimap_msg_att; | 15 | struct mailimap_msg_att; |
15 | class RecMail; | ||
16 | class RecBody; | ||
17 | class RecPart; | ||
18 | 16 | ||
19 | class IMAPwrapper : public QObject | 17 | class IMAPwrapper : public AbstractMail |
20 | { | 18 | { |
21 | Q_OBJECT | 19 | Q_OBJECT |
22 | |||
23 | public: | 20 | public: |
24 | IMAPwrapper( IMAPaccount *a ); | 21 | IMAPwrapper( IMAPaccount *a ); |
25 | virtual ~IMAPwrapper(); | 22 | virtual ~IMAPwrapper(); |
26 | QList<IMAPFolder>* listFolders(); | 23 | virtual QList<Folder>* listFolders(); |
27 | void listMessages(const QString & mailbox,QList<RecMail>&target ); | 24 | virtual void listMessages(const QString & mailbox,QList<RecMail>&target ); |
28 | RecBody fetchBody(const RecMail&mail); | 25 | virtual RecBody fetchBody(const RecMail&mail); |
29 | QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false); | 26 | virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false); |
30 | QString fetchPart(const RecMail&mail,const RecPart&part); | 27 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); |
31 | static void imap_progress( size_t current, size_t maximum ); | 28 | static void imap_progress( size_t current, size_t maximum ); |
32 | 29 | ||
33 | protected: | 30 | protected: |
34 | RecMail*parse_list_result(mailimap_msg_att*); | 31 | RecMail*parse_list_result(mailimap_msg_att*); |
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp index abb5a42..49c3b7a 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.cpp +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.cpp | |||
@@ -58,9 +58,9 @@ RecBody POP3wrapper::parseBody( const char *message ) | |||
58 | 58 | ||
59 | return body; | 59 | return body; |
60 | } | 60 | } |
61 | 61 | ||
62 | void POP3wrapper::listMessages( QList<RecMail> &target ) | 62 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) |
63 | { | 63 | { |
64 | int err = MAILPOP3_NO_ERROR; | 64 | int err = MAILPOP3_NO_ERROR; |
65 | char *header; | 65 | char *header; |
66 | size_t length; | 66 | size_t length; |
@@ -267,4 +267,23 @@ void POP3wrapper::logout() | |||
267 | mailpop3_free( m_pop3 ); | 267 | mailpop3_free( m_pop3 ); |
268 | m_pop3 = NULL; | 268 | m_pop3 = NULL; |
269 | } | 269 | } |
270 | 270 | ||
271 | |||
272 | QList<Folder>* POP3wrapper::listFolders() | ||
273 | { | ||
274 | QList<Folder> * folders = new QList<Folder>(); | ||
275 | folders->setAutoDelete( true ); | ||
276 | Folder*inb=new Folder("INBOX"); | ||
277 | folders->append(inb); | ||
278 | return folders; | ||
279 | } | ||
280 | |||
281 | QString POP3wrapper::fetchPart(const RecMail&,const QValueList<int>&,bool) | ||
282 | { | ||
283 | return ""; | ||
284 | } | ||
285 | |||
286 | QString POP3wrapper::fetchPart(const RecMail&,const RecPart&) | ||
287 | { | ||
288 | return ""; | ||
289 | } | ||
diff --git a/noncore/net/mail/libmailwrapper/pop3wrapper.h b/noncore/net/mail/libmailwrapper/pop3wrapper.h index 995bed0..3b24564 100644 --- a/noncore/net/mail/libmailwrapper/pop3wrapper.h +++ b/noncore/net/mail/libmailwrapper/pop3wrapper.h | |||
@@ -1,21 +1,27 @@ | |||
1 | #ifndef __POP3WRAPPER | 1 | #ifndef __POP3WRAPPER |
2 | #define __POP3WRAPPER | 2 | #define __POP3WRAPPER |
3 | 3 | ||
4 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
5 | #include "abstractmail.h" | ||
5 | 6 | ||
6 | class RecMail; | 7 | class RecMail; |
7 | class RecBody; | 8 | class RecBody; |
8 | struct mailpop3; | 9 | struct mailpop3; |
9 | 10 | ||
10 | class POP3wrapper : public QObject | 11 | class POP3wrapper : public AbstractMail |
11 | { | 12 | { |
12 | Q_OBJECT | 13 | Q_OBJECT |
13 | 14 | ||
14 | public: | 15 | public: |
15 | POP3wrapper( POP3account *a ); | 16 | POP3wrapper( POP3account *a ); |
16 | virtual ~POP3wrapper(); | 17 | virtual ~POP3wrapper(); |
17 | void listMessages( QList<RecMail> &target ); | 18 | /* mailbox will be ignored */ |
19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | ||
20 | virtual QList<Folder>* listFolders(); | ||
21 | virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false); | ||
22 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); | ||
23 | |||
18 | RecBody fetchBody( const RecMail &mail ); | 24 | RecBody fetchBody( const RecMail &mail ); |
19 | static void pop3_progress( size_t current, size_t maximum ); | 25 | static void pop3_progress( size_t current, size_t maximum ); |
20 | 26 | ||
21 | protected: | 27 | protected: |
@@ -31,8 +37,7 @@ private: | |||
31 | QString parseAddressList( mailimf_address_list *list ); | 37 | QString parseAddressList( mailimf_address_list *list ); |
32 | QString parseDateTime( mailimf_date_time *date ); | 38 | QString parseDateTime( mailimf_date_time *date ); |
33 | POP3account *account; | 39 | POP3account *account; |
34 | mailpop3 *m_pop3; | 40 | mailpop3 *m_pop3; |
35 | |||
36 | }; | 41 | }; |
37 | 42 | ||
38 | #endif | 43 | #endif |
diff --git a/noncore/net/mail/mail.pro b/noncore/net/mail/mail.pro index 0e7cff6..e7519c6 100644 --- a/noncore/net/mail/mail.pro +++ b/noncore/net/mail/mail.pro | |||
@@ -13,9 +13,10 @@ HEADERS = defines.h \ | |||
13 | opiemail.h \ | 13 | opiemail.h \ |
14 | imapwrapper.h \ | 14 | imapwrapper.h \ |
15 | mailtypes.h \ | 15 | mailtypes.h \ |
16 | mailistviewitem.h \ | 16 | mailistviewitem.h \ |
17 | pop3wrapper.h | 17 | pop3wrapper.h \ |
18 | abstractmail.h | ||
18 | 19 | ||
19 | SOURCES = main.cpp \ | 20 | SOURCES = main.cpp \ |
20 | opiemail.cpp \ | 21 | opiemail.cpp \ |
21 | mainwindow.cpp \ | 22 | mainwindow.cpp \ |
@@ -29,9 +30,10 @@ SOURCES = main.cpp \ | |||
29 | viewmail.cpp \ | 30 | viewmail.cpp \ |
30 | viewmailbase.cpp \ | 31 | viewmailbase.cpp \ |
31 | settings.cpp \ | 32 | settings.cpp \ |
32 | mailtypes.cpp \ | 33 | mailtypes.cpp \ |
33 | pop3wrapper.cpp | 34 | pop3wrapper.cpp \ |
35 | abstractmail.cpp | ||
34 | 36 | ||
35 | INTERFACES = editaccountsui.ui \ | 37 | INTERFACES = editaccountsui.ui \ |
36 | selectmailtypeui.ui \ | 38 | selectmailtypeui.ui \ |
37 | imapconfigui.ui \ | 39 | imapconfigui.ui \ |
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index 74bce5a..6c1cda0 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h | |||
@@ -17,9 +17,8 @@ class MainWindow : public QMainWindow | |||
17 | Q_OBJECT | 17 | Q_OBJECT |
18 | 18 | ||
19 | public: | 19 | public: |
20 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 20 | MainWindow( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
21 | static QString appName() { return QString::fromLatin1("opiemail"); } | ||
22 | 21 | ||
23 | public slots: | 22 | public slots: |
24 | void slotAdjustColumns(); | 23 | void slotAdjustColumns(); |
25 | 24 | ||
diff --git a/noncore/net/mail/opiemail.h b/noncore/net/mail/opiemail.h index dcab47c..7bcd818 100644 --- a/noncore/net/mail/opiemail.h +++ b/noncore/net/mail/opiemail.h | |||
@@ -9,11 +9,9 @@ class OpieMail : public MainWindow | |||
9 | Q_OBJECT | 9 | Q_OBJECT |
10 | 10 | ||
11 | public: | 11 | public: |
12 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 12 | OpieMail( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
13 | 13 | static QString appName() { return QString::fromLatin1("opiemail"); } | |
14 | static QString appName() { return QString::fromLatin1("opiemail"); } | ||
15 | |||
16 | protected slots: | 14 | protected slots: |
17 | void slotComposeMail(); | 15 | void slotComposeMail(); |
18 | void slotSendQueued(); | 16 | void slotSendQueued(); |
19 | void slotSearchMails(); | 17 | void slotSearchMails(); |
diff --git a/noncore/net/mail/pop3wrapper.cpp b/noncore/net/mail/pop3wrapper.cpp index abb5a42..49c3b7a 100644 --- a/noncore/net/mail/pop3wrapper.cpp +++ b/noncore/net/mail/pop3wrapper.cpp | |||
@@ -58,9 +58,9 @@ RecBody POP3wrapper::parseBody( const char *message ) | |||
58 | 58 | ||
59 | return body; | 59 | return body; |
60 | } | 60 | } |
61 | 61 | ||
62 | void POP3wrapper::listMessages( QList<RecMail> &target ) | 62 | void POP3wrapper::listMessages(const QString &, QList<RecMail> &target ) |
63 | { | 63 | { |
64 | int err = MAILPOP3_NO_ERROR; | 64 | int err = MAILPOP3_NO_ERROR; |
65 | char *header; | 65 | char *header; |
66 | size_t length; | 66 | size_t length; |
@@ -267,4 +267,23 @@ void POP3wrapper::logout() | |||
267 | mailpop3_free( m_pop3 ); | 267 | mailpop3_free( m_pop3 ); |
268 | m_pop3 = NULL; | 268 | m_pop3 = NULL; |
269 | } | 269 | } |
270 | 270 | ||
271 | |||
272 | QList<Folder>* POP3wrapper::listFolders() | ||
273 | { | ||
274 | QList<Folder> * folders = new QList<Folder>(); | ||
275 | folders->setAutoDelete( true ); | ||
276 | Folder*inb=new Folder("INBOX"); | ||
277 | folders->append(inb); | ||
278 | return folders; | ||
279 | } | ||
280 | |||
281 | QString POP3wrapper::fetchPart(const RecMail&,const QValueList<int>&,bool) | ||
282 | { | ||
283 | return ""; | ||
284 | } | ||
285 | |||
286 | QString POP3wrapper::fetchPart(const RecMail&,const RecPart&) | ||
287 | { | ||
288 | return ""; | ||
289 | } | ||
diff --git a/noncore/net/mail/pop3wrapper.h b/noncore/net/mail/pop3wrapper.h index 995bed0..3b24564 100644 --- a/noncore/net/mail/pop3wrapper.h +++ b/noncore/net/mail/pop3wrapper.h | |||
@@ -1,21 +1,27 @@ | |||
1 | #ifndef __POP3WRAPPER | 1 | #ifndef __POP3WRAPPER |
2 | #define __POP3WRAPPER | 2 | #define __POP3WRAPPER |
3 | 3 | ||
4 | #include "mailwrapper.h" | 4 | #include "mailwrapper.h" |
5 | #include "abstractmail.h" | ||
5 | 6 | ||
6 | class RecMail; | 7 | class RecMail; |
7 | class RecBody; | 8 | class RecBody; |
8 | struct mailpop3; | 9 | struct mailpop3; |
9 | 10 | ||
10 | class POP3wrapper : public QObject | 11 | class POP3wrapper : public AbstractMail |
11 | { | 12 | { |
12 | Q_OBJECT | 13 | Q_OBJECT |
13 | 14 | ||
14 | public: | 15 | public: |
15 | POP3wrapper( POP3account *a ); | 16 | POP3wrapper( POP3account *a ); |
16 | virtual ~POP3wrapper(); | 17 | virtual ~POP3wrapper(); |
17 | void listMessages( QList<RecMail> &target ); | 18 | /* mailbox will be ignored */ |
19 | virtual void listMessages(const QString & mailbox, QList<RecMail> &target ); | ||
20 | virtual QList<Folder>* listFolders(); | ||
21 | virtual QString fetchPart(const RecMail&mail,const QValueList<int>&path,bool internal_call=false); | ||
22 | virtual QString fetchPart(const RecMail&mail,const RecPart&part); | ||
23 | |||
18 | RecBody fetchBody( const RecMail &mail ); | 24 | RecBody fetchBody( const RecMail &mail ); |
19 | static void pop3_progress( size_t current, size_t maximum ); | 25 | static void pop3_progress( size_t current, size_t maximum ); |
20 | 26 | ||
21 | protected: | 27 | protected: |
@@ -31,8 +37,7 @@ private: | |||
31 | QString parseAddressList( mailimf_address_list *list ); | 37 | QString parseAddressList( mailimf_address_list *list ); |
32 | QString parseDateTime( mailimf_date_time *date ); | 38 | QString parseDateTime( mailimf_date_time *date ); |
33 | POP3account *account; | 39 | POP3account *account; |
34 | mailpop3 *m_pop3; | 40 | mailpop3 *m_pop3; |
35 | |||
36 | }; | 41 | }; |
37 | 42 | ||
38 | #endif | 43 | #endif |