-rw-r--r-- | kmicromail/accountitem.h | 212 |
1 files changed, 212 insertions, 0 deletions
diff --git a/kmicromail/accountitem.h b/kmicromail/accountitem.h new file mode 100644 index 0000000..f125eeb --- a/dev/null +++ b/kmicromail/accountitem.h | |||
@@ -0,0 +1,212 @@ | |||
1 | #ifndef __ACCOUNT_ITEM | ||
2 | #define __ACCOUNT_ITEM | ||
3 | |||
4 | #include <qlistview.h> | ||
5 | #include <qlist.h> | ||
6 | #include <opie2/osmartpointer.h> | ||
7 | |||
8 | class POP3wrapper; | ||
9 | class RecMail; | ||
10 | class RecBody; | ||
11 | class QPopupMenu; | ||
12 | class Selectstore; | ||
13 | class AccountView; | ||
14 | class POP3account; | ||
15 | class NNTPaccount; | ||
16 | class IMAPaccount; | ||
17 | class AbstractMail; | ||
18 | class Folder; | ||
19 | |||
20 | #define RECBODYP Opie::Core::OSmartPointer<RecBody> | ||
21 | |||
22 | class AccountViewItem : public QListViewItem | ||
23 | { | ||
24 | |||
25 | public: | ||
26 | AccountViewItem( AccountView *parent ); | ||
27 | AccountViewItem( QListViewItem *parent); | ||
28 | AccountViewItem( QListViewItem *parent , QListViewItem*after ); | ||
29 | AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ); | ||
30 | |||
31 | virtual ~AccountViewItem(); | ||
32 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&)=0; | ||
33 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&)=0; | ||
34 | virtual QPopupMenu * getContextMenu(){return 0;}; | ||
35 | virtual void contextMenuSelected(int){} | ||
36 | virtual AccountView*accountView(); | ||
37 | virtual bool matchName(const QString&name)const; | ||
38 | virtual bool isDraftfolder(); | ||
39 | |||
40 | protected: | ||
41 | AccountViewItem*findSubItem(const QString&path,AccountViewItem*start=0); | ||
42 | virtual void init(); | ||
43 | virtual void removeChilds(); | ||
44 | virtual void deleteAllMail(AbstractMail*wrapper,const Opie::Core::OSmartPointer<Folder>&f); | ||
45 | static const QString contextName; | ||
46 | AccountView*m_Backlink; | ||
47 | Opie::Core::OSmartPointer<Folder> folder; | ||
48 | }; | ||
49 | |||
50 | class POP3viewItem : public AccountViewItem | ||
51 | { | ||
52 | |||
53 | public: | ||
54 | POP3viewItem( POP3account *a, AccountView *parent ); | ||
55 | virtual ~POP3viewItem(); | ||
56 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | ||
57 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | ||
58 | AbstractMail *getWrapper(); | ||
59 | virtual QPopupMenu * getContextMenu(); | ||
60 | virtual void contextMenuSelected(int); | ||
61 | |||
62 | protected: | ||
63 | POP3account *account; | ||
64 | virtual void refresh(); | ||
65 | AbstractMail *wrapper; | ||
66 | void disconnect(); | ||
67 | void setOnOffline(); | ||
68 | }; | ||
69 | |||
70 | class POP3folderItem : public AccountViewItem | ||
71 | { | ||
72 | |||
73 | public: | ||
74 | POP3folderItem( const Opie::Core::OSmartPointer<Folder>&folder, POP3viewItem *parent , QListViewItem*after ); | ||
75 | virtual ~POP3folderItem(); | ||
76 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | ||
77 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | ||
78 | virtual QPopupMenu * getContextMenu(); | ||
79 | virtual void contextMenuSelected(int); | ||
80 | |||
81 | protected: | ||
82 | void downloadMails(); | ||
83 | POP3viewItem *pop3; | ||
84 | }; | ||
85 | |||
86 | |||
87 | class NNTPviewItem : public AccountViewItem | ||
88 | { | ||
89 | |||
90 | public: | ||
91 | NNTPviewItem( NNTPaccount *a, AccountView *parent ); | ||
92 | virtual ~NNTPviewItem(); | ||
93 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | ||
94 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | ||
95 | AbstractMail *getWrapper(); | ||
96 | virtual QPopupMenu * getContextMenu(); | ||
97 | virtual void contextMenuSelected(int); | ||
98 | |||
99 | protected: | ||
100 | NNTPaccount *account; | ||
101 | virtual void refresh(); | ||
102 | AbstractMail *wrapper; | ||
103 | void disconnect(); | ||
104 | void setOnOffline(); | ||
105 | void subscribeGroups(); | ||
106 | }; | ||
107 | |||
108 | class NNTPfolderItem : public AccountViewItem | ||
109 | { | ||
110 | |||
111 | public: | ||
112 | NNTPfolderItem(const Opie::Core::OSmartPointer<Folder>&folder, NNTPviewItem *parent , QListViewItem*after ); | ||
113 | virtual ~NNTPfolderItem(); | ||
114 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | ||
115 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | ||
116 | virtual QPopupMenu * getContextMenu(); | ||
117 | virtual void contextMenuSelected(int); | ||
118 | |||
119 | protected: | ||
120 | void downloadMails(); | ||
121 | NNTPviewItem *nntp; | ||
122 | }; | ||
123 | |||
124 | |||
125 | |||
126 | class IMAPviewItem : public AccountViewItem | ||
127 | { | ||
128 | friend class IMAPfolderItem; | ||
129 | public: | ||
130 | IMAPviewItem( IMAPaccount *a, AccountView *parent ); | ||
131 | virtual ~IMAPviewItem(); | ||
132 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | ||
133 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | ||
134 | AbstractMail *getWrapper(); | ||
135 | virtual QPopupMenu * getContextMenu(); | ||
136 | virtual void contextMenuSelected(int); | ||
137 | const QStringList&subFolders(); | ||
138 | virtual void refreshFolders(bool force=false); | ||
139 | bool offline(); | ||
140 | |||
141 | protected: | ||
142 | virtual void createNewFolder(); | ||
143 | IMAPaccount *account; | ||
144 | AbstractMail *wrapper; | ||
145 | QStringList currentFolders; | ||
146 | }; | ||
147 | |||
148 | class IMAPfolderItem : public AccountViewItem | ||
149 | { | ||
150 | |||
151 | public: | ||
152 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPviewItem *parent , QListViewItem*after ); | ||
153 | IMAPfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | ||
154 | virtual ~IMAPfolderItem(); | ||
155 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | ||
156 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | ||
157 | virtual QPopupMenu * getContextMenu(); | ||
158 | virtual void contextMenuSelected(int); | ||
159 | virtual const QString& Delemiter()const; | ||
160 | protected: | ||
161 | virtual void createNewFolder(); | ||
162 | virtual void deleteFolder(); | ||
163 | virtual void downloadMails(); | ||
164 | IMAPviewItem *imap; | ||
165 | }; | ||
166 | |||
167 | class MHviewItem : public AccountViewItem | ||
168 | { | ||
169 | friend class MHfolderItem; | ||
170 | |||
171 | public: | ||
172 | MHviewItem( const QString&aMboxPath, AccountView *parent ); | ||
173 | virtual ~MHviewItem(); | ||
174 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&target ); | ||
175 | virtual RECBODYP fetchBody( const Opie::Core::OSmartPointer<RecMail> &mail ); | ||
176 | AbstractMail *getWrapper(); | ||
177 | virtual QPopupMenu * getContextMenu(); | ||
178 | virtual void contextMenuSelected(int); | ||
179 | QStringList subFolders(); | ||
180 | virtual void refresh(bool force=false); | ||
181 | |||
182 | protected: | ||
183 | void downloadMails(); | ||
184 | virtual void createFolder(); | ||
185 | QString m_Path; | ||
186 | AbstractMail *wrapper; | ||
187 | QStringList currentFolders; | ||
188 | }; | ||
189 | |||
190 | class MHfolderItem : public AccountViewItem | ||
191 | { | ||
192 | |||
193 | public: | ||
194 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHviewItem *parent , QListViewItem*after ); | ||
195 | MHfolderItem( const Opie::Core::OSmartPointer<Folder>&folder, MHfolderItem *parent, QListViewItem*after, MHviewItem*master); | ||
196 | virtual ~MHfolderItem(); | ||
197 | virtual void refresh(QValueList<Opie::Core::OSmartPointer<RecMail> >&); | ||
198 | virtual RECBODYP fetchBody(const Opie::Core::OSmartPointer<RecMail>&); | ||
199 | virtual QPopupMenu * getContextMenu(); | ||
200 | virtual void contextMenuSelected(int); | ||
201 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; | ||
202 | virtual bool isDraftfolder(); | ||
203 | |||
204 | protected: | ||
205 | void downloadMails(); | ||
206 | virtual void createFolder(); | ||
207 | virtual void deleteFolder(); | ||
208 | void initName(); | ||
209 | MHviewItem *mbox; | ||
210 | }; | ||
211 | |||
212 | #endif | ||