-rw-r--r-- | noncore/net/mail/accountview.cpp | 40 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 6 |
2 files changed, 32 insertions, 14 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index bc13336..71a0d74 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,283 +1,295 @@ | |||
1 | #include "accountview.h" | 1 | #include "accountview.h" |
2 | #include "mailtypes.h" | 2 | #include "mailtypes.h" |
3 | #include "defines.h" | 3 | #include "defines.h" |
4 | 4 | ||
5 | 5 | ||
6 | /** | 6 | /** |
7 | * POP3 Account stuff | 7 | * POP3 Account stuff |
8 | */ | 8 | */ |
9 | 9 | ||
10 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) | 10 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) |
11 | : AccountViewItem( parent ) | 11 | : AccountViewItem( parent ) |
12 | { | 12 | { |
13 | account = a; | 13 | account = a; |
14 | wrapper = AbstractMail::getWrapper( account ); | 14 | wrapper = AbstractMail::getWrapper( account ); |
15 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 15 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
16 | setText( 0, account->getAccountName() ); | 16 | setText( 0, account->getAccountName() ); |
17 | setOpen( true ); | 17 | setOpen( true ); |
18 | } | 18 | } |
19 | 19 | ||
20 | POP3viewItem::~POP3viewItem() | 20 | POP3viewItem::~POP3viewItem() |
21 | { | 21 | { |
22 | delete wrapper; | 22 | delete wrapper; |
23 | } | 23 | } |
24 | 24 | ||
25 | AbstractMail *POP3viewItem::getWrapper() | 25 | AbstractMail *POP3viewItem::getWrapper() |
26 | { | 26 | { |
27 | return wrapper; | 27 | return wrapper; |
28 | } | 28 | } |
29 | 29 | ||
30 | void POP3viewItem::refresh( QList<RecMail> & ) | 30 | void POP3viewItem::refresh( QList<RecMail> & ) |
31 | { | 31 | { |
32 | QList<Folder> *folders = wrapper->listFolders(); | 32 | QList<Folder> *folders = wrapper->listFolders(); |
33 | QListViewItem *child = firstChild(); | 33 | QListViewItem *child = firstChild(); |
34 | while ( child ) { | 34 | while ( child ) { |
35 | QListViewItem *tmp = child; | 35 | QListViewItem *tmp = child; |
36 | child = child->nextSibling(); | 36 | child = child->nextSibling(); |
37 | delete tmp; | 37 | delete tmp; |
38 | } | 38 | } |
39 | Folder *it; | 39 | Folder *it; |
40 | QListViewItem*item = 0; | 40 | QListViewItem*item = 0; |
41 | for ( it = folders->first(); it; it = folders->next() ) { | 41 | for ( it = folders->first(); it; it = folders->next() ) { |
42 | item = new POP3folderItem( it, this , item ); | 42 | item = new POP3folderItem( it, this , item ); |
43 | item->setSelectable(it->may_select()); | 43 | item->setSelectable(it->may_select()); |
44 | } | 44 | } |
45 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 45 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
46 | folders->setAutoDelete(false); | 46 | folders->setAutoDelete(false); |
47 | delete folders; | 47 | delete folders; |
48 | } | 48 | } |
49 | 49 | ||
50 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) | 50 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) |
51 | { | 51 | { |
52 | qDebug( "POP3 fetchBody" ); | 52 | qDebug( "POP3 fetchBody" ); |
53 | return wrapper->fetchBody( mail ); | 53 | return wrapper->fetchBody( mail ); |
54 | } | 54 | } |
55 | 55 | ||
56 | POP3folderItem::~POP3folderItem() | 56 | POP3folderItem::~POP3folderItem() |
57 | { | 57 | { |
58 | delete folder; | 58 | delete folder; |
59 | } | 59 | } |
60 | 60 | ||
61 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) | 61 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) |
62 | : AccountViewItem( parent,after ) | 62 | : AccountViewItem( parent,after ) |
63 | { | 63 | { |
64 | folder = folderInit; | 64 | folder = folderInit; |
65 | pop3 = parent; | 65 | pop3 = parent; |
66 | if (folder->getDisplayName().lower()!="inbox") { | 66 | if (folder->getDisplayName().lower()!="inbox") { |
67 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 67 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
68 | } else { | 68 | } else { |
69 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 69 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
70 | } | 70 | } |
71 | setText( 0, folder->getDisplayName() ); | 71 | setText( 0, folder->getDisplayName() ); |
72 | } | 72 | } |
73 | 73 | ||
74 | void POP3folderItem::refresh(QList<RecMail>&target) | 74 | void POP3folderItem::refresh(QList<RecMail>&target) |
75 | { | 75 | { |
76 | if (folder->may_select()) | 76 | if (folder->may_select()) |
77 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 77 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
78 | } | 78 | } |
79 | 79 | ||
80 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) | 80 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) |
81 | { | 81 | { |
82 | return pop3->getWrapper()->fetchBody(aMail); | 82 | return pop3->getWrapper()->fetchBody(aMail); |
83 | } | 83 | } |
84 | 84 | ||
85 | /** | 85 | /** |
86 | * IMAP Account stuff | 86 | * IMAP Account stuff |
87 | */ | 87 | */ |
88 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) | 88 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) |
89 | : AccountViewItem( parent ) | 89 | : AccountViewItem( parent ) |
90 | { | 90 | { |
91 | account = a; | 91 | account = a; |
92 | wrapper = AbstractMail::getWrapper( account ); | 92 | wrapper = AbstractMail::getWrapper( account ); |
93 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 93 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
94 | setText( 0, account->getAccountName() ); | 94 | setText( 0, account->getAccountName() ); |
95 | setOpen( true ); | 95 | setOpen( true ); |
96 | } | 96 | } |
97 | 97 | ||
98 | IMAPviewItem::~IMAPviewItem() | 98 | IMAPviewItem::~IMAPviewItem() |
99 | { | 99 | { |
100 | delete wrapper; | 100 | delete wrapper; |
101 | } | 101 | } |
102 | 102 | ||
103 | AbstractMail *IMAPviewItem::getWrapper() | 103 | AbstractMail *IMAPviewItem::getWrapper() |
104 | { | 104 | { |
105 | return wrapper; | 105 | return wrapper; |
106 | } | 106 | } |
107 | 107 | ||
108 | IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) | ||
109 | { | ||
110 | IMAPfolderItem*pitem,*sitem; | ||
111 | if (!start) pitem = (IMAPfolderItem*)firstChild(); | ||
112 | else pitem = (IMAPfolderItem*)start->firstChild(); | ||
113 | while (pitem) { | ||
114 | if (pitem->matchName(path)) { | ||
115 | break; | ||
116 | } | ||
117 | if (pitem->childCount()>0) { | ||
118 | sitem = findSubItem(path,pitem); | ||
119 | if (sitem) { | ||
120 | pitem = sitem; | ||
121 | break; | ||
122 | } | ||
123 | } | ||
124 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | ||
125 | } | ||
126 | return pitem; | ||
127 | } | ||
128 | |||
108 | void IMAPviewItem::refresh(QList<RecMail>&) | 129 | void IMAPviewItem::refresh(QList<RecMail>&) |
109 | { | 130 | { |
110 | if (childCount()>0) return; | 131 | if (childCount()>0) return; |
111 | QList<Folder> *folders = wrapper->listFolders(); | 132 | QList<Folder> *folders = wrapper->listFolders(); |
112 | 133 | ||
113 | QListViewItem *child = firstChild(); | 134 | QListViewItem *child = firstChild(); |
114 | while ( child ) { | 135 | while ( child ) { |
115 | QListViewItem *tmp = child; | 136 | QListViewItem *tmp = child; |
116 | child = child->nextSibling(); | 137 | child = child->nextSibling(); |
117 | delete tmp; | 138 | delete tmp; |
118 | } | 139 | } |
119 | 140 | ||
120 | Folder *it; | 141 | Folder *it; |
121 | QListViewItem*item = 0; | 142 | QListViewItem*item = 0; |
122 | QListViewItem*titem = 0; | 143 | QListViewItem*titem = 0; |
123 | QListViewItem*inboxitem = 0; | ||
124 | QString fname,del,search; | 144 | QString fname,del,search; |
125 | int pos; | 145 | int pos; |
126 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 146 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
127 | folders->setAutoDelete(false); | 147 | folders->setAutoDelete(false); |
128 | 148 | ||
129 | for ( it = folders->first(); it; it = folders->next() ) { | 149 | for ( it = folders->first(); it; it = folders->next() ) { |
130 | if (it->getDisplayName().lower()=="inbox") { | 150 | if (it->getDisplayName().lower()=="inbox") { |
131 | inboxitem = new IMAPfolderItem( it, this , item ); | 151 | item = new IMAPfolderItem( it, this , item ); |
132 | folders->remove(it); | 152 | folders->remove(it); |
133 | qDebug("inbox found"); | 153 | qDebug("inbox found"); |
134 | break; | 154 | break; |
135 | } | 155 | } |
136 | } | 156 | } |
137 | |||
138 | for ( it = folders->first(); it; it = folders->next() ) { | 157 | for ( it = folders->first(); it; it = folders->next() ) { |
139 | fname = it->getDisplayName(); | 158 | fname = it->getDisplayName(); |
140 | pos = fname.findRev(it->Separator()); | 159 | pos = fname.findRev(it->Separator()); |
141 | if (pos != -1) { | 160 | if (pos != -1) { |
142 | fname = fname.left(pos); | 161 | fname = fname.left(pos); |
143 | qDebug(fname); | ||
144 | } | ||
145 | IMAPfolderItem*pitem = (IMAPfolderItem*)firstChild(); | ||
146 | while (pitem) { | ||
147 | if (pitem->matchName(fname)) { | ||
148 | break; | ||
149 | } | ||
150 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | ||
151 | } | 162 | } |
163 | IMAPfolderItem*pitem = findSubItem(fname); | ||
152 | if (pitem) { | 164 | if (pitem) { |
153 | titem = item; | 165 | titem = item; |
154 | item = new IMAPfolderItem(it,pitem,item,this); | 166 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
155 | item->setSelectable(it->may_select()); | 167 | item->setSelectable(it->may_select()); |
156 | /* setup the short name */ | 168 | /* setup the short name */ |
157 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | 169 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); |
158 | item = titem; | 170 | item = titem; |
159 | } else { | 171 | } else { |
160 | item = new IMAPfolderItem( it, this , (inboxitem?inboxitem:item) ); | 172 | item = new IMAPfolderItem( it, this , item ); |
161 | item->setSelectable(it->may_select()); | 173 | item->setSelectable(it->may_select()); |
162 | } | 174 | } |
163 | } | 175 | } |
164 | delete folders; | 176 | delete folders; |
165 | } | 177 | } |
166 | 178 | ||
167 | RecBody IMAPviewItem::fetchBody(const RecMail&) | 179 | RecBody IMAPviewItem::fetchBody(const RecMail&) |
168 | { | 180 | { |
169 | return RecBody(); | 181 | return RecBody(); |
170 | } | 182 | } |
171 | 183 | ||
172 | IMAPfolderItem::~IMAPfolderItem() | 184 | IMAPfolderItem::~IMAPfolderItem() |
173 | { | 185 | { |
174 | delete folder; | 186 | delete folder; |
175 | } | 187 | } |
176 | 188 | ||
177 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 189 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
178 | : AccountViewItem( parent ) | 190 | : AccountViewItem( parent , after ) |
179 | { | 191 | { |
180 | folder = folderInit; | 192 | folder = folderInit; |
181 | imap = parent; | 193 | imap = parent; |
182 | if (folder->getDisplayName().lower()!="inbox") { | 194 | if (folder->getDisplayName().lower()!="inbox") { |
183 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 195 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
184 | } else { | 196 | } else { |
185 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 197 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
186 | } | 198 | } |
187 | setText( 0, folder->getDisplayName() ); | 199 | setText( 0, folder->getDisplayName() ); |
188 | } | 200 | } |
189 | 201 | ||
190 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 202 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
191 | : AccountViewItem( parent,after ) | 203 | : AccountViewItem( parent,after ) |
192 | { | 204 | { |
193 | folder = folderInit; | 205 | folder = folderInit; |
194 | imap = master; | 206 | imap = master; |
195 | if (folder->getDisplayName().lower()!="inbox") { | 207 | if (folder->getDisplayName().lower()!="inbox") { |
196 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 208 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
197 | } else { | 209 | } else { |
198 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 210 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
199 | } | 211 | } |
200 | setText( 0, folder->getDisplayName() ); | 212 | setText( 0, folder->getDisplayName() ); |
201 | } | 213 | } |
202 | 214 | ||
203 | bool IMAPfolderItem::matchName(const QString&name)const | 215 | bool IMAPfolderItem::matchName(const QString&name)const |
204 | { | 216 | { |
205 | return folder->getDisplayName()==name; | 217 | return folder->getDisplayName()==name; |
206 | } | 218 | } |
207 | 219 | ||
208 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 220 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
209 | { | 221 | { |
210 | if (folder->may_select()) | 222 | if (folder->may_select()) |
211 | imap->getWrapper()->listMessages( folder->getName(),target ); | 223 | imap->getWrapper()->listMessages( folder->getName(),target ); |
212 | } | 224 | } |
213 | 225 | ||
214 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 226 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
215 | { | 227 | { |
216 | return imap->getWrapper()->fetchBody(aMail); | 228 | return imap->getWrapper()->fetchBody(aMail); |
217 | } | 229 | } |
218 | 230 | ||
219 | /** | 231 | /** |
220 | * Generic stuff | 232 | * Generic stuff |
221 | */ | 233 | */ |
222 | 234 | ||
223 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 235 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
224 | : QListView( parent, name, flags ) | 236 | : QListView( parent, name, flags ) |
225 | { | 237 | { |
226 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), | 238 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), |
227 | SLOT( refresh( QListViewItem * ) ) ); | 239 | SLOT( refresh( QListViewItem * ) ) ); |
228 | setSorting(0); | 240 | setSorting(0); |
229 | } | 241 | } |
230 | 242 | ||
231 | void AccountView::populate( QList<Account> list ) | 243 | void AccountView::populate( QList<Account> list ) |
232 | { | 244 | { |
233 | clear(); | 245 | clear(); |
234 | 246 | ||
235 | Account *it; | 247 | Account *it; |
236 | for ( it = list.first(); it; it = list.next() ) { | 248 | for ( it = list.first(); it; it = list.next() ) { |
237 | if ( it->getType().compare( "IMAP" ) == 0 ) { | 249 | if ( it->getType().compare( "IMAP" ) == 0 ) { |
238 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 250 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
239 | qDebug( "added IMAP " + imap->getAccountName() ); | 251 | qDebug( "added IMAP " + imap->getAccountName() ); |
240 | (void) new IMAPviewItem( imap, this ); | 252 | (void) new IMAPviewItem( imap, this ); |
241 | } else if ( it->getType().compare( "POP3" ) == 0 ) { | 253 | } else if ( it->getType().compare( "POP3" ) == 0 ) { |
242 | POP3account *pop3 = static_cast<POP3account *>(it); | 254 | POP3account *pop3 = static_cast<POP3account *>(it); |
243 | qDebug( "added POP3 " + pop3->getAccountName() ); | 255 | qDebug( "added POP3 " + pop3->getAccountName() ); |
244 | (void) new POP3viewItem( pop3, this ); | 256 | (void) new POP3viewItem( pop3, this ); |
245 | } | 257 | } |
246 | } | 258 | } |
247 | } | 259 | } |
248 | 260 | ||
249 | void AccountView::refresh(QListViewItem *item) { | 261 | void AccountView::refresh(QListViewItem *item) { |
250 | 262 | ||
251 | qDebug("AccountView refresh..."); | 263 | qDebug("AccountView refresh..."); |
252 | if ( item ) { | 264 | if ( item ) { |
253 | m_currentItem = item; | 265 | m_currentItem = item; |
254 | QList<RecMail> headerlist; | 266 | QList<RecMail> headerlist; |
255 | headerlist.setAutoDelete(true); | 267 | headerlist.setAutoDelete(true); |
256 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 268 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
257 | view->refresh(headerlist); | 269 | view->refresh(headerlist); |
258 | emit refreshMailview(&headerlist); | 270 | emit refreshMailview(&headerlist); |
259 | } | 271 | } |
260 | } | 272 | } |
261 | 273 | ||
262 | void AccountView::refreshCurrent() | 274 | void AccountView::refreshCurrent() |
263 | { | 275 | { |
264 | if ( !m_currentItem ) return; | 276 | if ( !m_currentItem ) return; |
265 | QList<RecMail> headerlist; | 277 | QList<RecMail> headerlist; |
266 | headerlist.setAutoDelete(true); | 278 | headerlist.setAutoDelete(true); |
267 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 279 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
268 | view->refresh(headerlist); | 280 | view->refresh(headerlist); |
269 | emit refreshMailview(&headerlist); | 281 | emit refreshMailview(&headerlist); |
270 | } | 282 | } |
271 | 283 | ||
272 | void AccountView::refreshAll() | 284 | void AccountView::refreshAll() |
273 | { | 285 | { |
274 | 286 | ||
275 | } | 287 | } |
276 | 288 | ||
277 | RecBody AccountView::fetchBody(const RecMail&aMail) | 289 | RecBody AccountView::fetchBody(const RecMail&aMail) |
278 | { | 290 | { |
279 | QListViewItem*item = selectedItem (); | 291 | QListViewItem*item = selectedItem (); |
280 | if (!item) return RecBody(); | 292 | if (!item) return RecBody(); |
281 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 293 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
282 | return view->fetchBody(aMail); | 294 | return view->fetchBody(aMail); |
283 | } | 295 | } |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index a57935f..64abed9 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -1,104 +1,110 @@ | |||
1 | #ifndef ACCOUNTVIEW_H | 1 | #ifndef ACCOUNTVIEW_H |
2 | #define ACCOUNTVIEW_H | 2 | #define ACCOUNTVIEW_H |
3 | 3 | ||
4 | #include <qlistview.h> | 4 | #include <qlistview.h> |
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 | #include "abstractmail.h" |
10 | 10 | ||
11 | class POP3wrapper; | 11 | class POP3wrapper; |
12 | class RecMail; | 12 | class RecMail; |
13 | class RecBody; | 13 | class RecBody; |
14 | 14 | ||
15 | class AccountViewItem : public QListViewItem | 15 | class AccountViewItem : public QListViewItem |
16 | { | 16 | { |
17 | 17 | ||
18 | public: | 18 | public: |
19 | AccountViewItem( QListView *parent ) : QListViewItem( parent ) {} | 19 | AccountViewItem( QListView *parent ) : QListViewItem( parent ) {} |
20 | AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {} | 20 | AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {} |
21 | AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {} | 21 | AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {} |
22 | virtual void refresh(QList<RecMail>&)=0; | 22 | virtual void refresh(QList<RecMail>&)=0; |
23 | virtual RecBody fetchBody(const RecMail&)=0; | 23 | virtual RecBody fetchBody(const RecMail&)=0; |
24 | }; | 24 | }; |
25 | 25 | ||
26 | class POP3viewItem : public AccountViewItem | 26 | class POP3viewItem : public AccountViewItem |
27 | { | 27 | { |
28 | 28 | ||
29 | public: | 29 | public: |
30 | POP3viewItem( POP3account *a, QListView *parent ); | 30 | POP3viewItem( POP3account *a, QListView *parent ); |
31 | ~POP3viewItem(); | 31 | ~POP3viewItem(); |
32 | virtual void refresh( QList<RecMail> &target ); | 32 | virtual void refresh( QList<RecMail> &target ); |
33 | virtual RecBody fetchBody( const RecMail &mail ); | 33 | virtual RecBody fetchBody( const RecMail &mail ); |
34 | AbstractMail *getWrapper(); | 34 | AbstractMail *getWrapper(); |
35 | private: | 35 | private: |
36 | POP3account *account; | 36 | POP3account *account; |
37 | AbstractMail *wrapper; | 37 | AbstractMail *wrapper; |
38 | 38 | ||
39 | }; | 39 | }; |
40 | 40 | ||
41 | class POP3folderItem : public AccountViewItem | 41 | class POP3folderItem : public AccountViewItem |
42 | { | 42 | { |
43 | 43 | ||
44 | public: | 44 | public: |
45 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); | 45 | POP3folderItem( Folder *folder, POP3viewItem *parent , QListViewItem*after ); |
46 | ~POP3folderItem(); | 46 | ~POP3folderItem(); |
47 | virtual void refresh(QList<RecMail>&); | 47 | virtual void refresh(QList<RecMail>&); |
48 | virtual RecBody fetchBody(const RecMail&); | 48 | virtual RecBody fetchBody(const RecMail&); |
49 | private: | 49 | private: |
50 | Folder *folder; | 50 | Folder *folder; |
51 | POP3viewItem *pop3; | 51 | POP3viewItem *pop3; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | class IMAPfolderItem; | ||
55 | |||
54 | class IMAPviewItem : public AccountViewItem | 56 | class IMAPviewItem : public AccountViewItem |
55 | { | 57 | { |
56 | 58 | ||
57 | public: | 59 | public: |
58 | IMAPviewItem( IMAPaccount *a, QListView *parent ); | 60 | IMAPviewItem( IMAPaccount *a, QListView *parent ); |
59 | ~IMAPviewItem(); | 61 | ~IMAPviewItem(); |
60 | virtual void refresh(QList<RecMail>&); | 62 | virtual void refresh(QList<RecMail>&); |
61 | virtual RecBody fetchBody(const RecMail&); | 63 | virtual RecBody fetchBody(const RecMail&); |
62 | AbstractMail *getWrapper(); | 64 | AbstractMail *getWrapper(); |
65 | |||
66 | protected: | ||
67 | IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); | ||
68 | |||
63 | private: | 69 | private: |
64 | IMAPaccount *account; | 70 | IMAPaccount *account; |
65 | AbstractMail *wrapper; | 71 | AbstractMail *wrapper; |
66 | }; | 72 | }; |
67 | 73 | ||
68 | class IMAPfolderItem : public AccountViewItem | 74 | class IMAPfolderItem : public AccountViewItem |
69 | { | 75 | { |
70 | 76 | ||
71 | public: | 77 | public: |
72 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); | 78 | IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); |
73 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); | 79 | IMAPfolderItem( Folder *folder, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ); |
74 | ~IMAPfolderItem(); | 80 | ~IMAPfolderItem(); |
75 | virtual void refresh(QList<RecMail>&); | 81 | virtual void refresh(QList<RecMail>&); |
76 | virtual RecBody fetchBody(const RecMail&); | 82 | virtual RecBody fetchBody(const RecMail&); |
77 | bool matchName(const QString&name)const; | 83 | bool matchName(const QString&name)const; |
78 | private: | 84 | private: |
79 | Folder *folder; | 85 | Folder *folder; |
80 | IMAPviewItem *imap; | 86 | IMAPviewItem *imap; |
81 | }; | 87 | }; |
82 | 88 | ||
83 | class AccountView : public QListView | 89 | class AccountView : public QListView |
84 | { | 90 | { |
85 | Q_OBJECT | 91 | Q_OBJECT |
86 | 92 | ||
87 | public: | 93 | public: |
88 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); | 94 | AccountView( QWidget *parent = 0, const char *name = 0, WFlags flags = 0 ); |
89 | void populate( QList<Account> list ); | 95 | void populate( QList<Account> list ); |
90 | RecBody fetchBody(const RecMail&aMail); | 96 | RecBody fetchBody(const RecMail&aMail); |
91 | 97 | ||
92 | public slots: | 98 | public slots: |
93 | void refreshAll(); | 99 | void refreshAll(); |
94 | void refresh(QListViewItem *item); | 100 | void refresh(QListViewItem *item); |
95 | void refreshCurrent(); | 101 | void refreshCurrent(); |
96 | 102 | ||
97 | signals: | 103 | signals: |
98 | void refreshMailview(QList<RecMail>*); | 104 | void refreshMailview(QList<RecMail>*); |
99 | 105 | ||
100 | private: | 106 | private: |
101 | QListViewItem* m_currentItem; | 107 | QListViewItem* m_currentItem; |
102 | }; | 108 | }; |
103 | 109 | ||
104 | #endif | 110 | #endif |