author | zautrix <zautrix> | 2004-09-16 20:39:34 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-16 20:39:34 (UTC) |
commit | b44edfb21be0eee91c4f47401e3fe6ff37e4c16c (patch) (unidiff) | |
tree | a17655e0e679f67498d9fee6f6a532e9c0f0e9e5 /kmicromail/accountitem.cpp | |
parent | b6bfa63deb15a2600d46a8c68c231f068da1444a (diff) | |
download | kdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.zip kdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.tar.gz kdepimpi-b44edfb21be0eee91c4f47401e3fe6ff37e4c16c.tar.bz2 |
better newsgroup handling
-rw-r--r-- | kmicromail/accountitem.cpp | 21 |
1 files changed, 16 insertions, 5 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 12d047a..7795055 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -1,315 +1,319 @@ | |||
1 | 1 | ||
2 | #include "accountitem.h" | 2 | #include "accountitem.h" |
3 | #include "accountview.h" | 3 | #include "accountview.h" |
4 | #include "newmaildir.h" | 4 | #include "newmaildir.h" |
5 | #include "nntpgroupsdlg.h" | 5 | #include "nntpgroupsdlg.h" |
6 | #include "defines.h" | 6 | #include "defines.h" |
7 | 7 | ||
8 | #include <libmailwrapper/mailtypes.h> | 8 | #include <libmailwrapper/mailtypes.h> |
9 | #include <libmailwrapper/abstractmail.h> | 9 | #include <libmailwrapper/abstractmail.h> |
10 | #include <libmailwrapper/mailwrapper.h> | 10 | #include <libmailwrapper/mailwrapper.h> |
11 | /* OPIE */ | 11 | /* OPIE */ |
12 | //#include <qpe/qpeapplication.h> | 12 | //#include <qpe/qpeapplication.h> |
13 | 13 | ||
14 | /* QT */ | 14 | /* QT */ |
15 | #include <qpopupmenu.h> | 15 | #include <qpopupmenu.h> |
16 | #include <qmessagebox.h> | 16 | #include <qmessagebox.h> |
17 | #include <kiconloader.h> | 17 | #include <kiconloader.h> |
18 | 18 | ||
19 | #define GET_NEW_MAILS 101 | 19 | #define GET_NEW_MAILS 101 |
20 | 20 | ||
21 | using namespace Opie::Core; | 21 | using namespace Opie::Core; |
22 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | 22 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} |
23 | /** | 23 | /** |
24 | * POP3 Account stuff | 24 | * POP3 Account stuff |
25 | */ | 25 | */ |
26 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | 26 | POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) |
27 | : AccountViewItem( parent ) | 27 | : AccountViewItem( parent ) |
28 | { | 28 | { |
29 | account = a; | 29 | account = a; |
30 | wrapper = AbstractMail::getWrapper( account ); | 30 | wrapper = AbstractMail::getWrapper( account ); |
31 | SETPIX(PIXMAP_POP3FOLDER); | 31 | SETPIX(PIXMAP_POP3FOLDER); |
32 | #if 0 | 32 | #if 0 |
33 | if (!account->getOffline()) | 33 | if (!account->getOffline()) |
34 | { | 34 | { |
35 | setPixmap( 0, ); | 35 | setPixmap( 0, ); |
36 | } | 36 | } |
37 | else | 37 | else |
38 | { | 38 | { |
39 | setPixmap( 0, PIXMAP_OFFLINE ); | 39 | setPixmap( 0, PIXMAP_OFFLINE ); |
40 | } | 40 | } |
41 | #endif | 41 | #endif |
42 | setText( 0, account->getAccountName() ); | 42 | setText( 0, account->getAccountName() ); |
43 | setOpen( true ); | 43 | setOpen( true ); |
44 | } | 44 | } |
45 | 45 | ||
46 | POP3viewItem::~POP3viewItem() | 46 | POP3viewItem::~POP3viewItem() |
47 | { | 47 | { |
48 | delete wrapper; | 48 | delete wrapper; |
49 | } | 49 | } |
50 | 50 | ||
51 | AbstractMail *POP3viewItem::getWrapper() | 51 | AbstractMail *POP3viewItem::getWrapper() |
52 | { | 52 | { |
53 | return wrapper; | 53 | return wrapper; |
54 | } | 54 | } |
55 | 55 | ||
56 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) | 56 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) |
57 | { | 57 | { |
58 | refresh(); | 58 | refresh(); |
59 | } | 59 | } |
60 | 60 | ||
61 | void POP3viewItem::refresh() | 61 | void POP3viewItem::refresh() |
62 | { | 62 | { |
63 | if (account->getOffline()) return; | 63 | if (account->getOffline()) return; |
64 | QValueList<FolderP> *folders = wrapper->listFolders(); | 64 | QValueList<FolderP> *folders = wrapper->listFolders(); |
65 | QListViewItem *child = firstChild(); | 65 | QListViewItem *child = firstChild(); |
66 | while ( child ) | 66 | while ( child ) |
67 | { | 67 | { |
68 | QListViewItem *tmp = child; | 68 | QListViewItem *tmp = child; |
69 | child = child->nextSibling(); | 69 | child = child->nextSibling(); |
70 | delete tmp; | 70 | delete tmp; |
71 | } | 71 | } |
72 | QValueList<FolderP>::ConstIterator it; | 72 | QValueList<FolderP>::ConstIterator it; |
73 | QListViewItem*item = 0; | 73 | QListViewItem*item = 0; |
74 | for ( it = folders->begin(); it!=folders->end(); ++it) | 74 | for ( it = folders->begin(); it!=folders->end(); ++it) |
75 | { | 75 | { |
76 | item = new POP3folderItem( (*it), this , item ); | 76 | item = new POP3folderItem( (*it), this , item ); |
77 | item->setSelectable( (*it)->may_select()); | 77 | item->setSelectable( (*it)->may_select()); |
78 | } | 78 | } |
79 | delete folders; | 79 | delete folders; |
80 | } | 80 | } |
81 | 81 | ||
82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 82 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
83 | { | 83 | { |
84 | 84 | ||
85 | return wrapper->fetchBody( mail ); | 85 | return wrapper->fetchBody( mail ); |
86 | } | 86 | } |
87 | 87 | ||
88 | QPopupMenu * POP3viewItem::getContextMenu() | 88 | QPopupMenu * POP3viewItem::getContextMenu() |
89 | { | 89 | { |
90 | QPopupMenu *m = new QPopupMenu(0); | 90 | QPopupMenu *m = new QPopupMenu(0); |
91 | if (m) | 91 | if (m) |
92 | { | 92 | { |
93 | if (!account->getOffline()) | 93 | if (!account->getOffline()) |
94 | { | 94 | { |
95 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
95 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 96 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
96 | m->insertItem(QObject::tr("Set offline",contextName),1); | 97 | m->insertItem(QObject::tr("Set offline",contextName),1); |
97 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
98 | } | 98 | } |
99 | else | 99 | else |
100 | { | 100 | { |
101 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
102 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 101 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
102 | m->insertItem(QObject::tr("Set online",contextName),1); | ||
103 | } | 103 | } |
104 | } | 104 | } |
105 | return m; | 105 | return m; |
106 | } | 106 | } |
107 | 107 | ||
108 | void POP3viewItem::disconnect() | 108 | void POP3viewItem::disconnect() |
109 | { | 109 | { |
110 | QListViewItem *child = firstChild(); | 110 | QListViewItem *child = firstChild(); |
111 | while ( child ) | 111 | while ( child ) |
112 | { | 112 | { |
113 | QListViewItem *tmp = child; | 113 | QListViewItem *tmp = child; |
114 | child = child->nextSibling(); | 114 | child = child->nextSibling(); |
115 | delete tmp; | 115 | delete tmp; |
116 | } | 116 | } |
117 | wrapper->logout(); | 117 | wrapper->logout(); |
118 | } | 118 | } |
119 | 119 | ||
120 | void POP3viewItem::setOnOffline() | 120 | void POP3viewItem::setOnOffline() |
121 | { | 121 | { |
122 | if (!account->getOffline()) | 122 | if (!account->getOffline()) |
123 | { | 123 | { |
124 | disconnect(); | 124 | disconnect(); |
125 | } | 125 | } |
126 | account->setOffline(!account->getOffline()); | 126 | account->setOffline(!account->getOffline()); |
127 | account->save(); | 127 | account->save(); |
128 | SETPIX(PIXMAP_POP3FOLDER); | 128 | SETPIX(PIXMAP_POP3FOLDER); |
129 | refresh(); | 129 | refresh(); |
130 | } | 130 | } |
131 | 131 | ||
132 | void POP3viewItem::contextMenuSelected(int which) | 132 | void POP3viewItem::contextMenuSelected(int which) |
133 | { | 133 | { |
134 | switch (which) | 134 | switch (which) |
135 | { | 135 | { |
136 | case 0: | 136 | case 0: |
137 | disconnect(); | 137 | disconnect(); |
138 | break; | 138 | break; |
139 | case 1: | 139 | case 1: |
140 | setOnOffline(); | 140 | setOnOffline(); |
141 | break; | 141 | break; |
142 | case GET_NEW_MAILS: // daunlood | 142 | case GET_NEW_MAILS: // daunlood |
143 | if (account->getOffline()) | 143 | if (account->getOffline()) |
144 | setOnOffline(); | 144 | setOnOffline(); |
145 | AccountView*bl = accountView(); | 145 | AccountView*bl = accountView(); |
146 | if (!bl) return; | 146 | if (!bl) return; |
147 | AccountViewItem* in = findSubItem( "inbox" , 0); | 147 | AccountViewItem* in = findSubItem( "inbox" , 0); |
148 | if ( ! in ) | 148 | if ( ! in ) |
149 | return; | 149 | return; |
150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); | 150 | bl->downloadMailsInbox(in->getFolder() ,getWrapper()); |
151 | setOnOffline(); | 151 | setOnOffline(); |
152 | break; | 152 | break; |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
156 | POP3folderItem::~POP3folderItem() | 156 | POP3folderItem::~POP3folderItem() |
157 | {} | 157 | {} |
158 | 158 | ||
159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) | 159 | POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) |
160 | : AccountViewItem(folderInit,parent,after ) | 160 | : AccountViewItem(folderInit,parent,after ) |
161 | { | 161 | { |
162 | pop3 = parent; | 162 | pop3 = parent; |
163 | if (folder->getDisplayName().lower()!="inbox") | 163 | if (folder->getDisplayName().lower()!="inbox") |
164 | { | 164 | { |
165 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 165 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
166 | } | 166 | } |
167 | else | 167 | else |
168 | { | 168 | { |
169 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 169 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
170 | } | 170 | } |
171 | setText( 0, folder->getDisplayName() ); | 171 | setText( 0, folder->getDisplayName() ); |
172 | } | 172 | } |
173 | 173 | ||
174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) | 174 | void POP3folderItem::refresh(QValueList<RecMailP>&target) |
175 | { | 175 | { |
176 | if (folder->may_select()) | 176 | if (folder->may_select()) |
177 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 177 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
178 | } | 178 | } |
179 | 179 | ||
180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) | 180 | RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) |
181 | { | 181 | { |
182 | return pop3->getWrapper()->fetchBody(aMail); | 182 | return pop3->getWrapper()->fetchBody(aMail); |
183 | } | 183 | } |
184 | 184 | ||
185 | QPopupMenu * POP3folderItem::getContextMenu() | 185 | QPopupMenu * POP3folderItem::getContextMenu() |
186 | { | 186 | { |
187 | QPopupMenu *m = new QPopupMenu(0); | 187 | QPopupMenu *m = new QPopupMenu(0); |
188 | if (m) | 188 | if (m) |
189 | { | 189 | { |
190 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
190 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 191 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
191 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 192 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
192 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 193 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
193 | } | 194 | } |
194 | return m; | 195 | return m; |
195 | } | 196 | } |
196 | 197 | ||
197 | void POP3folderItem::downloadMails() | 198 | void POP3folderItem::downloadMails() |
198 | { | 199 | { |
199 | AccountView*bl = pop3->accountView(); | 200 | AccountView*bl = pop3->accountView(); |
200 | if (!bl) return; | 201 | if (!bl) return; |
201 | bl->downloadMails(folder,pop3->getWrapper()); | 202 | bl->downloadMails(folder,pop3->getWrapper()); |
202 | } | 203 | } |
203 | 204 | ||
204 | void POP3folderItem::contextMenuSelected(int which) | 205 | void POP3folderItem::contextMenuSelected(int which) |
205 | { | 206 | { |
206 | AccountView * view = (AccountView*)listView(); | 207 | AccountView * view = (AccountView*)listView(); |
207 | switch (which) | 208 | switch (which) |
208 | { | 209 | { |
209 | case 0: | 210 | case 0: |
210 | /* must be 'cause pop3 lists are cached */ | 211 | /* must be 'cause pop3 lists are cached */ |
211 | pop3->getWrapper()->logout(); | 212 | pop3->getWrapper()->logout(); |
212 | view->refreshCurrent(); | 213 | view->refreshCurrent(); |
213 | break; | 214 | break; |
214 | case 1: | 215 | case 1: |
215 | deleteAllMail(pop3->getWrapper(),folder); | 216 | deleteAllMail(pop3->getWrapper(),folder); |
216 | break; | 217 | break; |
217 | case 2: | 218 | case 2: |
218 | downloadMails(); | 219 | downloadMails(); |
219 | break; | 220 | break; |
221 | case GET_NEW_MAILS: // daunlood | ||
222 | view->downloadMailsInbox(getFolder() ,pop3->getWrapper()); | ||
223 | break; | ||
220 | default: | 224 | default: |
221 | break; | 225 | break; |
222 | } | 226 | } |
223 | } | 227 | } |
224 | 228 | ||
225 | /** | 229 | /** |
226 | * NNTP Account stuff | 230 | * NNTP Account stuff |
227 | */ | 231 | */ |
228 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | 232 | NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) |
229 | : AccountViewItem( parent ) | 233 | : AccountViewItem( parent ) |
230 | { | 234 | { |
231 | account = a; | 235 | account = a; |
232 | wrapper = AbstractMail::getWrapper( account ); | 236 | wrapper = AbstractMail::getWrapper( account ); |
233 | //FIXME | 237 | //FIXME |
234 | SETPIX(PIXMAP_POP3FOLDER); | 238 | SETPIX(PIXMAP_POP3FOLDER); |
235 | #if 0 | 239 | #if 0 |
236 | if (!account->getOffline()) | 240 | if (!account->getOffline()) |
237 | { | 241 | { |
238 | setPixmap( 0, ); | 242 | setPixmap( 0, ); |
239 | } | 243 | } |
240 | else | 244 | else |
241 | { | 245 | { |
242 | setPixmap( 0, PIXMAP_OFFLINE ); | 246 | setPixmap( 0, PIXMAP_OFFLINE ); |
243 | } | 247 | } |
244 | #endif | 248 | #endif |
245 | setText( 0, account->getAccountName() ); | 249 | setText( 0, account->getAccountName() ); |
246 | setOpen( true ); | 250 | setOpen( true ); |
247 | } | 251 | } |
248 | 252 | ||
249 | NNTPviewItem::~NNTPviewItem() | 253 | NNTPviewItem::~NNTPviewItem() |
250 | { | 254 | { |
251 | delete wrapper; | 255 | delete wrapper; |
252 | } | 256 | } |
253 | 257 | ||
254 | AbstractMail *NNTPviewItem::getWrapper() | 258 | AbstractMail *NNTPviewItem::getWrapper() |
255 | { | 259 | { |
256 | return wrapper; | 260 | return wrapper; |
257 | } | 261 | } |
258 | 262 | ||
259 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 263 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) |
260 | { | 264 | { |
261 | refresh(); | 265 | refresh(); |
262 | } | 266 | } |
263 | 267 | ||
264 | void NNTPviewItem::refresh() | 268 | void NNTPviewItem::refresh() |
265 | { | 269 | { |
266 | if (account->getOffline()) return; | 270 | if (account->getOffline()) return; |
267 | QValueList<FolderP> *folders = wrapper->listFolders(); | 271 | QValueList<FolderP> *folders = wrapper->listFolders(); |
268 | 272 | ||
269 | QListViewItem *child = firstChild(); | 273 | QListViewItem *child = firstChild(); |
270 | while ( child ) | 274 | while ( child ) |
271 | { | 275 | { |
272 | QListViewItem *tmp = child; | 276 | QListViewItem *tmp = child; |
273 | child = child->nextSibling(); | 277 | child = child->nextSibling(); |
274 | delete tmp; | 278 | delete tmp; |
275 | } | 279 | } |
276 | QValueList<FolderP>::ConstIterator it; | 280 | QValueList<FolderP>::ConstIterator it; |
277 | QListViewItem*item = 0; | 281 | QListViewItem*item = 0; |
278 | for ( it = folders->begin(); it!=folders->end(); ++it) | 282 | for ( it = folders->begin(); it!=folders->end(); ++it) |
279 | { | 283 | { |
280 | item = new NNTPfolderItem( (*it), this , item ); | 284 | item = new NNTPfolderItem( (*it), this , item ); |
281 | item->setSelectable( (*it)->may_select()); | 285 | item->setSelectable( (*it)->may_select()); |
282 | } | 286 | } |
283 | delete folders; | 287 | delete folders; |
284 | } | 288 | } |
285 | 289 | ||
286 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 290 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
287 | { | 291 | { |
288 | 292 | ||
289 | return wrapper->fetchBody( mail ); | 293 | return wrapper->fetchBody( mail ); |
290 | } | 294 | } |
291 | 295 | ||
292 | QPopupMenu * NNTPviewItem::getContextMenu() | 296 | QPopupMenu * NNTPviewItem::getContextMenu() |
293 | { | 297 | { |
294 | QPopupMenu *m = new QPopupMenu(0); | 298 | QPopupMenu *m = new QPopupMenu(0); |
295 | if (m) | 299 | if (m) |
296 | { | 300 | { |
297 | if (!account->getOffline()) | 301 | if (!account->getOffline()) |
298 | { | 302 | { |
299 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 303 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
300 | m->insertItem(QObject::tr("Set offline",contextName),1); | 304 | m->insertItem(QObject::tr("Set offline",contextName),1); |
301 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); | 305 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); |
302 | } | 306 | } |
303 | else | 307 | else |
304 | { | 308 | { |
305 | m->insertItem(QObject::tr("Set online",contextName),1); | 309 | m->insertItem(QObject::tr("Set online",contextName),1); |
306 | } | 310 | } |
307 | } | 311 | } |
308 | return m; | 312 | return m; |
309 | } | 313 | } |
310 | 314 | ||
311 | void NNTPviewItem::subscribeGroups() | 315 | void NNTPviewItem::subscribeGroups() |
312 | { | 316 | { |
313 | NNTPGroupsDlg dlg(account); | 317 | NNTPGroupsDlg dlg(account); |
314 | dlg.showMaximized(); | 318 | dlg.showMaximized(); |
315 | if ( dlg.exec()== QDialog::Accepted ){ | 319 | if ( dlg.exec()== QDialog::Accepted ){ |
@@ -420,432 +424,439 @@ void NNTPfolderItem::contextMenuSelected(int which) | |||
420 | break; | 424 | break; |
421 | default: | 425 | default: |
422 | break; | 426 | break; |
423 | } | 427 | } |
424 | } | 428 | } |
425 | 429 | ||
426 | /** | 430 | /** |
427 | * IMAP Account stuff | 431 | * IMAP Account stuff |
428 | */ | 432 | */ |
429 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | 433 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) |
430 | : AccountViewItem( parent ) | 434 | : AccountViewItem( parent ) |
431 | { | 435 | { |
432 | account = a; | 436 | account = a; |
433 | wrapper = AbstractMail::getWrapper( account ); | 437 | wrapper = AbstractMail::getWrapper( account ); |
434 | SETPIX(PIXMAP_IMAPFOLDER); | 438 | SETPIX(PIXMAP_IMAPFOLDER); |
435 | setText( 0, account->getAccountName() ); | 439 | setText( 0, account->getAccountName() ); |
436 | setOpen( true ); | 440 | setOpen( true ); |
437 | } | 441 | } |
438 | 442 | ||
439 | IMAPviewItem::~IMAPviewItem() | 443 | IMAPviewItem::~IMAPviewItem() |
440 | { | 444 | { |
441 | delete wrapper; | 445 | delete wrapper; |
442 | } | 446 | } |
443 | 447 | ||
444 | AbstractMail *IMAPviewItem::getWrapper() | 448 | AbstractMail *IMAPviewItem::getWrapper() |
445 | { | 449 | { |
446 | return wrapper; | 450 | return wrapper; |
447 | } | 451 | } |
448 | 452 | ||
449 | void IMAPviewItem::refresh(QValueList<RecMailP>&) | 453 | void IMAPviewItem::refresh(QValueList<RecMailP>&) |
450 | { | 454 | { |
451 | refreshFolders(false); | 455 | refreshFolders(false); |
452 | } | 456 | } |
453 | 457 | ||
454 | const QStringList&IMAPviewItem::subFolders() | 458 | const QStringList&IMAPviewItem::subFolders() |
455 | { | 459 | { |
456 | return currentFolders; | 460 | return currentFolders; |
457 | } | 461 | } |
458 | 462 | ||
459 | void IMAPviewItem::refreshFolders(bool force) | 463 | void IMAPviewItem::refreshFolders(bool force) |
460 | { | 464 | { |
461 | if (childCount()>0 && force==false) return; | 465 | if (childCount()>0 && force==false) return; |
462 | if (account->getOffline()) return; | 466 | if (account->getOffline()) return; |
463 | 467 | ||
464 | removeChilds(); | 468 | removeChilds(); |
465 | currentFolders.clear(); | 469 | currentFolders.clear(); |
466 | QValueList<FolderP> * folders = wrapper->listFolders(); | 470 | QValueList<FolderP> * folders = wrapper->listFolders(); |
467 | 471 | ||
468 | QValueList<FolderP>::Iterator it; | 472 | QValueList<FolderP>::Iterator it; |
469 | QListViewItem*item = 0; | 473 | QListViewItem*item = 0; |
470 | QListViewItem*titem = 0; | 474 | QListViewItem*titem = 0; |
471 | QString fname,del,search; | 475 | QString fname,del,search; |
472 | int pos; | 476 | int pos; |
473 | 477 | ||
474 | for ( it = folders->begin(); it!=folders->end(); ++it) | 478 | for ( it = folders->begin(); it!=folders->end(); ++it) |
475 | { | 479 | { |
476 | if ((*it)->getDisplayName().lower()=="inbox") | 480 | if ((*it)->getDisplayName().lower()=="inbox") |
477 | { | 481 | { |
478 | item = new IMAPfolderItem( (*it), this , item ); | 482 | item = new IMAPfolderItem( (*it), this , item ); |
479 | folders->remove(it); | 483 | folders->remove(it); |
480 | break; | 484 | break; |
481 | } | 485 | } |
482 | } | 486 | } |
483 | for ( it = folders->begin(); it!=folders->end(); ++it) | 487 | for ( it = folders->begin(); it!=folders->end(); ++it) |
484 | { | 488 | { |
485 | fname = (*it)->getDisplayName(); | 489 | fname = (*it)->getDisplayName(); |
486 | currentFolders.append((*it)->getName()); | 490 | currentFolders.append((*it)->getName()); |
487 | pos = fname.findRev((*it)->Separator()); | 491 | pos = fname.findRev((*it)->Separator()); |
488 | if (pos != -1) | 492 | if (pos != -1) |
489 | { | 493 | { |
490 | fname = fname.left(pos); | 494 | fname = fname.left(pos); |
491 | } | 495 | } |
492 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 496 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
493 | if (pitem) | 497 | if (pitem) |
494 | { | 498 | { |
495 | titem = item; | 499 | titem = item; |
496 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); | 500 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); |
497 | /* setup the short name */ | 501 | /* setup the short name */ |
498 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); | 502 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); |
499 | item = titem; | 503 | item = titem; |
500 | } | 504 | } |
501 | else | 505 | else |
502 | { | 506 | { |
503 | item = new IMAPfolderItem( (*it), this , item ); | 507 | item = new IMAPfolderItem( (*it), this , item ); |
504 | } | 508 | } |
505 | } | 509 | } |
506 | delete folders; | 510 | delete folders; |
507 | } | 511 | } |
508 | 512 | ||
509 | QPopupMenu * IMAPviewItem::getContextMenu() | 513 | QPopupMenu * IMAPviewItem::getContextMenu() |
510 | { | 514 | { |
511 | QPopupMenu *m = new QPopupMenu(0); | 515 | QPopupMenu *m = new QPopupMenu(0); |
512 | if (m) | 516 | if (m) |
513 | { | 517 | { |
514 | if (!account->getOffline()) | 518 | if (!account->getOffline()) |
515 | { | 519 | { |
520 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
516 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 521 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
517 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 522 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
518 | m->insertSeparator(); | 523 | m->insertSeparator(); |
519 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 524 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
520 | m->insertItem(QObject::tr("Set offline",contextName),3); | 525 | m->insertItem(QObject::tr("Set offline",contextName),3); |
521 | m->insertSeparator(); | 526 | m->insertSeparator(); |
522 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
523 | } | 527 | } |
524 | else | 528 | else |
525 | { | 529 | { |
526 | m->insertItem(QObject::tr("Set online",contextName),3); | ||
527 | m->insertSeparator(); | ||
528 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | 530 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); |
531 | m->insertItem(QObject::tr("Set online",contextName),3); | ||
529 | } | 532 | } |
530 | } | 533 | } |
531 | return m; | 534 | return m; |
532 | } | 535 | } |
533 | 536 | ||
534 | void IMAPviewItem::createNewFolder() | 537 | void IMAPviewItem::createNewFolder() |
535 | { | 538 | { |
536 | Newmdirdlg ndirdlg; | 539 | Newmdirdlg ndirdlg; |
537 | 540 | ||
538 | ndirdlg.showMaximized(); | 541 | ndirdlg.showMaximized(); |
539 | if ( ndirdlg.exec() ) | 542 | if ( ndirdlg.exec() ) |
540 | { | 543 | { |
541 | QString ndir = ndirdlg.Newdir(); | 544 | QString ndir = ndirdlg.Newdir(); |
542 | bool makesubs = ndirdlg.subpossible(); | 545 | bool makesubs = ndirdlg.subpossible(); |
543 | QString delemiter = "/"; | 546 | QString delemiter = "/"; |
544 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 547 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
545 | if (item) | 548 | if (item) |
546 | { | 549 | { |
547 | delemiter = item->Delemiter(); | 550 | delemiter = item->Delemiter(); |
548 | } | 551 | } |
549 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 552 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
550 | { | 553 | { |
551 | refreshFolders(true); | 554 | refreshFolders(true); |
552 | } | 555 | } |
553 | } | 556 | } |
554 | } | 557 | } |
555 | 558 | ||
556 | void IMAPviewItem::contextMenuSelected(int id) | 559 | void IMAPviewItem::contextMenuSelected(int id) |
557 | { | 560 | { |
558 | 561 | ||
559 | switch (id) | 562 | switch (id) |
560 | { | 563 | { |
561 | case 0: | 564 | case 0: |
562 | refreshFolders(true); | 565 | refreshFolders(true); |
563 | break; | 566 | break; |
564 | case 1: | 567 | case 1: |
565 | createNewFolder(); | 568 | createNewFolder(); |
566 | break; | 569 | break; |
567 | case 2: | 570 | case 2: |
568 | removeChilds(); | 571 | removeChilds(); |
569 | wrapper->logout(); | 572 | wrapper->logout(); |
570 | break; | 573 | break; |
571 | case 3: | 574 | case 3: |
572 | if (account->getOffline()==false) | 575 | if (account->getOffline()==false) |
573 | { | 576 | { |
574 | removeChilds(); | 577 | removeChilds(); |
575 | wrapper->logout(); | 578 | wrapper->logout(); |
576 | } | 579 | } |
577 | account->setOffline(!account->getOffline()); | 580 | account->setOffline(!account->getOffline()); |
578 | account->save(); | 581 | account->save(); |
579 | SETPIX(PIXMAP_IMAPFOLDER); | 582 | SETPIX(PIXMAP_IMAPFOLDER); |
580 | refreshFolders(false); | 583 | refreshFolders(false); |
581 | break; | 584 | break; |
582 | case GET_NEW_MAILS: // daunlood | 585 | case GET_NEW_MAILS: // daunlood |
583 | { | 586 | { |
584 | if (account->getOffline()) { | 587 | if (account->getOffline()) { |
585 | contextMenuSelected( 3 ); | 588 | contextMenuSelected( 3 ); |
586 | } | 589 | } |
587 | AccountView*bl = accountView(); | 590 | AccountView*bl = accountView(); |
588 | if (!bl) return; | 591 | if (!bl) return; |
589 | AccountViewItem* in = findSubItem( "inbox" , 0); | 592 | AccountViewItem* in = findSubItem( "inbox" , 0); |
590 | if ( ! in ) | 593 | if ( ! in ) |
591 | return; | 594 | return; |
592 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); | 595 | bl->downloadMailsInbox(in->getFolder(),getWrapper()); |
593 | } | 596 | } |
594 | break; | 597 | break; |
595 | default: | 598 | default: |
596 | break; | 599 | break; |
597 | } | 600 | } |
598 | } | 601 | } |
599 | 602 | ||
600 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 603 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
601 | { | 604 | { |
602 | return new RecBody(); | 605 | return new RecBody(); |
603 | } | 606 | } |
604 | 607 | ||
605 | bool IMAPviewItem::offline() | 608 | bool IMAPviewItem::offline() |
606 | { | 609 | { |
607 | return account->getOffline(); | 610 | return account->getOffline(); |
608 | } | 611 | } |
609 | 612 | ||
610 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) | 613 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) |
611 | : AccountViewItem( folderInit, parent , after ) | 614 | : AccountViewItem( folderInit, parent , after ) |
612 | { | 615 | { |
613 | imap = parent; | 616 | imap = parent; |
614 | if (folder->getDisplayName().lower()!="inbox") | 617 | if (folder->getDisplayName().lower()!="inbox") |
615 | { | 618 | { |
616 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 619 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
617 | } | 620 | } |
618 | else | 621 | else |
619 | { | 622 | { |
620 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 623 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
621 | } | 624 | } |
622 | setText( 0, folder->getDisplayName() ); | 625 | setText( 0, folder->getDisplayName() ); |
623 | } | 626 | } |
624 | 627 | ||
625 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 628 | IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
626 | : AccountViewItem(folderInit, parent,after ) | 629 | : AccountViewItem(folderInit, parent,after ) |
627 | { | 630 | { |
628 | imap = master; | 631 | imap = master; |
629 | if (folder->getDisplayName().lower()!="inbox") | 632 | if (folder->getDisplayName().lower()!="inbox") |
630 | { | 633 | { |
631 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 634 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
632 | } | 635 | } |
633 | else | 636 | else |
634 | { | 637 | { |
635 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 638 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
636 | } | 639 | } |
637 | setText( 0, folder->getDisplayName() ); | 640 | setText( 0, folder->getDisplayName() ); |
638 | } | 641 | } |
639 | 642 | ||
640 | IMAPfolderItem::~IMAPfolderItem() | 643 | IMAPfolderItem::~IMAPfolderItem() |
641 | {} | 644 | {} |
642 | 645 | ||
643 | const QString& IMAPfolderItem::Delemiter()const | 646 | const QString& IMAPfolderItem::Delemiter()const |
644 | { | 647 | { |
645 | return folder->Separator(); | 648 | return folder->Separator(); |
646 | } | 649 | } |
647 | 650 | ||
648 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | 651 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) |
649 | { | 652 | { |
650 | if (folder->may_select()) | 653 | if (folder->may_select()) |
651 | { | 654 | { |
652 | imap->getWrapper()->listMessages( folder->getName(),target ); | 655 | imap->getWrapper()->listMessages( folder->getName(),target ); |
653 | } | 656 | } |
654 | else | 657 | else |
655 | { | 658 | { |
656 | target.clear(); | 659 | target.clear(); |
657 | } | 660 | } |
658 | } | 661 | } |
659 | 662 | ||
660 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 663 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
661 | { | 664 | { |
662 | return imap->getWrapper()->fetchBody(aMail); | 665 | return imap->getWrapper()->fetchBody(aMail); |
663 | } | 666 | } |
664 | 667 | ||
665 | QPopupMenu * IMAPfolderItem::getContextMenu() | 668 | QPopupMenu * IMAPfolderItem::getContextMenu() |
666 | { | 669 | { |
667 | QPopupMenu *m = new QPopupMenu(0); | 670 | QPopupMenu *m = new QPopupMenu(0); |
668 | if (m) | 671 | if (m) |
669 | { | 672 | { |
670 | if (folder->may_select()) | 673 | if (folder->may_select()) |
671 | { | 674 | { |
675 | m->insertItem(QObject::tr("Get new messages",contextName),GET_NEW_MAILS); | ||
672 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 676 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
673 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 677 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
674 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 678 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
675 | } | 679 | } |
676 | if (folder->no_inferior()==false) | 680 | if (folder->no_inferior()==false) |
677 | { | 681 | { |
678 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 682 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
679 | } | 683 | } |
680 | if (folder->getDisplayName().lower()!="inbox") | 684 | if (folder->getDisplayName().lower()!="inbox") |
681 | { | 685 | { |
682 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 686 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
683 | } | 687 | } |
684 | } | 688 | } |
685 | return m; | 689 | return m; |
686 | } | 690 | } |
687 | 691 | ||
688 | void IMAPfolderItem::createNewFolder() | 692 | void IMAPfolderItem::createNewFolder() |
689 | { | 693 | { |
690 | Newmdirdlg ndirdlg; | 694 | Newmdirdlg ndirdlg; |
691 | ndirdlg.showMaximized(); | 695 | ndirdlg.showMaximized(); |
692 | if ( ndirdlg.exec() ) | 696 | if ( ndirdlg.exec() ) |
693 | { | 697 | { |
694 | QString ndir = ndirdlg.Newdir(); | 698 | QString ndir = ndirdlg.Newdir(); |
695 | bool makesubs = ndirdlg.subpossible(); | 699 | bool makesubs = ndirdlg.subpossible(); |
696 | QString delemiter = Delemiter(); | 700 | QString delemiter = Delemiter(); |
697 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 701 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
698 | { | 702 | { |
699 | imap->refreshFolders(true); | 703 | imap->refreshFolders(true); |
700 | } | 704 | } |
701 | } | 705 | } |
702 | } | 706 | } |
703 | 707 | ||
704 | void IMAPfolderItem::deleteFolder() | 708 | void IMAPfolderItem::deleteFolder() |
705 | { | 709 | { |
706 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 710 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
707 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 711 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
708 | QObject::tr("Yes",contextName), | 712 | QObject::tr("Yes",contextName), |
709 | QObject::tr("No",contextName),QString::null,1,1); | 713 | QObject::tr("No",contextName),QString::null,1,1); |
710 | 714 | ||
711 | if (yesno == 0) | 715 | if (yesno == 0) |
712 | { | 716 | { |
713 | if (imap->getWrapper()->deleteMbox(folder)) | 717 | if (imap->getWrapper()->deleteMbox(folder)) |
714 | { | 718 | { |
715 | QListView*v=listView(); | 719 | QListView*v=listView(); |
716 | IMAPviewItem * box = imap; | 720 | IMAPviewItem * box = imap; |
717 | /* be carefull - after that this object is destroyd so don't use | 721 | /* be carefull - after that this object is destroyd so don't use |
718 | * any member of it after that call!!*/ | 722 | * any member of it after that call!!*/ |
719 | imap->refreshFolders(true); | 723 | imap->refreshFolders(true); |
720 | if (v) | 724 | if (v) |
721 | { | 725 | { |
722 | v->setSelected(box,true); | 726 | v->setSelected(box,true); |
723 | } | 727 | } |
724 | } | 728 | } |
725 | } | 729 | } |
726 | } | 730 | } |
727 | 731 | ||
728 | void IMAPfolderItem::downloadMails() | 732 | void IMAPfolderItem::downloadMails() |
729 | { | 733 | { |
730 | AccountView*bl = imap->accountView(); | 734 | AccountView*bl = imap->accountView(); |
731 | if (!bl) return; | 735 | if (!bl) return; |
732 | bl->downloadMails(folder,imap->getWrapper()); | 736 | bl->downloadMails(folder,imap->getWrapper()); |
733 | } | 737 | } |
734 | 738 | ||
735 | void IMAPfolderItem::contextMenuSelected(int id) | 739 | void IMAPfolderItem::contextMenuSelected(int id) |
736 | { | 740 | { |
737 | 741 | ||
738 | AccountView * view = (AccountView*)listView(); | 742 | AccountView * view = (AccountView*)listView(); |
739 | switch(id) | 743 | switch(id) |
740 | { | 744 | { |
741 | case 0: | 745 | case 0: |
742 | view->refreshCurrent(); | 746 | view->refreshCurrent(); |
743 | break; | 747 | break; |
744 | case 1: | 748 | case 1: |
745 | deleteAllMail(imap->getWrapper(),folder); | 749 | deleteAllMail(imap->getWrapper(),folder); |
746 | break; | 750 | break; |
747 | case 2: | 751 | case 2: |
748 | createNewFolder(); | 752 | createNewFolder(); |
749 | break; | 753 | break; |
750 | case 3: | 754 | case 3: |
751 | deleteFolder(); | 755 | deleteFolder(); |
752 | break; | 756 | break; |
753 | case 4: | 757 | case 4: |
754 | downloadMails(); | 758 | downloadMails(); |
755 | break; | 759 | break; |
760 | case GET_NEW_MAILS: // daunlood | ||
761 | { | ||
762 | AccountView*bl = accountView(); | ||
763 | if (!bl) return; | ||
764 | bl->downloadMailsInbox(getFolder(),imap->getWrapper()); | ||
765 | } | ||
766 | break; | ||
756 | default: | 767 | default: |
757 | break; | 768 | break; |
758 | } | 769 | } |
759 | } | 770 | } |
760 | 771 | ||
761 | /** | 772 | /** |
762 | * MH Account stuff | 773 | * MH Account stuff |
763 | */ | 774 | */ |
764 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 775 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
765 | POP3 and MBOX */ | 776 | POP3 and MBOX */ |
766 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 777 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
767 | : AccountViewItem( parent ) | 778 | : AccountViewItem( parent ) |
768 | { | 779 | { |
769 | m_Path = aPath; | 780 | m_Path = aPath; |
770 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 781 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
771 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 782 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
772 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 783 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
773 | setText( 0, " Local Folders" ); | 784 | setText( 0, " Local Folders" ); |
774 | setOpen( true ); | 785 | setOpen( true ); |
775 | folder = 0; | 786 | folder = 0; |
776 | } | 787 | } |
777 | 788 | ||
778 | MHviewItem::~MHviewItem() | 789 | MHviewItem::~MHviewItem() |
779 | { | 790 | { |
780 | delete wrapper; | 791 | delete wrapper; |
781 | } | 792 | } |
782 | 793 | ||
783 | AbstractMail *MHviewItem::getWrapper() | 794 | AbstractMail *MHviewItem::getWrapper() |
784 | { | 795 | { |
785 | return wrapper; | 796 | return wrapper; |
786 | } | 797 | } |
787 | 798 | ||
788 | void MHviewItem::refresh( QValueList<RecMailP> & target) | 799 | void MHviewItem::refresh( QValueList<RecMailP> & target) |
789 | { | 800 | { |
790 | refresh(false); | 801 | refresh(false); |
791 | getWrapper()->listMessages( "",target ); | 802 | getWrapper()->listMessages( "",target ); |
792 | } | 803 | } |
793 | 804 | ||
794 | void MHviewItem::refresh(bool force) | 805 | void MHviewItem::refresh(bool force) |
795 | { | 806 | { |
796 | if (childCount()>0 && force==false) return; | 807 | if (childCount()>0 && force==false) return; |
797 | removeChilds(); | 808 | removeChilds(); |
798 | currentFolders.clear(); | 809 | currentFolders.clear(); |
799 | QValueList<FolderP> *folders = wrapper->listFolders(); | 810 | QValueList<FolderP> *folders = wrapper->listFolders(); |
800 | QValueList<FolderP>::ConstIterator it; | 811 | QValueList<FolderP>::ConstIterator it; |
801 | MHfolderItem*item = 0; | 812 | MHfolderItem*item = 0; |
802 | MHfolderItem*pmaster = 0; | 813 | MHfolderItem*pmaster = 0; |
803 | QString fname = ""; | 814 | QString fname = ""; |
804 | int pos; | 815 | int pos; |
805 | for ( it = folders->begin(); it!=folders->end(); ++it) | 816 | for ( it = folders->begin(); it!=folders->end(); ++it) |
806 | { | 817 | { |
807 | fname = (*it)->getDisplayName(); | 818 | fname = (*it)->getDisplayName(); |
808 | /* this folder itself */ | 819 | /* this folder itself */ |
809 | if (fname=="/") | 820 | if (fname=="/") |
810 | { | 821 | { |
811 | currentFolders.append(fname); | 822 | currentFolders.append(fname); |
812 | folder = (*it); | 823 | folder = (*it); |
813 | continue; | 824 | continue; |
814 | } | 825 | } |
815 | currentFolders.append(fname); | 826 | currentFolders.append(fname); |
816 | pos = fname.findRev("/"); | 827 | pos = fname.findRev("/"); |
817 | if (pos > 0) | 828 | if (pos > 0) |
818 | { | 829 | { |
819 | fname = fname.left(pos); | 830 | fname = fname.left(pos); |
820 | pmaster = (MHfolderItem*)findSubItem(fname); | 831 | pmaster = (MHfolderItem*)findSubItem(fname); |
821 | } | 832 | } |
822 | else | 833 | else |
823 | { | 834 | { |
824 | pmaster = 0; | 835 | pmaster = 0; |
825 | } | 836 | } |
826 | if (pmaster) | 837 | if (pmaster) |
827 | { | 838 | { |
828 | item = new MHfolderItem( (*it), pmaster, item, this ); | 839 | item = new MHfolderItem( (*it), pmaster, item, this ); |
829 | } | 840 | } |
830 | else | 841 | else |
831 | { | 842 | { |
832 | item = new MHfolderItem( (*it), this , item ); | 843 | item = new MHfolderItem( (*it), this , item ); |
833 | } | 844 | } |
834 | item->setSelectable((*it)->may_select()); | 845 | item->setSelectable((*it)->may_select()); |
835 | } | 846 | } |
836 | delete folders; | 847 | delete folders; |
837 | } | 848 | } |
838 | 849 | ||
839 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 850 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
840 | { | 851 | { |
841 | 852 | ||
842 | return wrapper->fetchBody( mail ); | 853 | return wrapper->fetchBody( mail ); |
843 | } | 854 | } |
844 | 855 | ||
845 | QPopupMenu * MHviewItem::getContextMenu() | 856 | QPopupMenu * MHviewItem::getContextMenu() |
846 | { | 857 | { |
847 | QPopupMenu *m = new QPopupMenu(0); | 858 | QPopupMenu *m = new QPopupMenu(0); |
848 | if (m) | 859 | if (m) |
849 | { | 860 | { |
850 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 861 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
851 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 862 | m->insertItem(QObject::tr("Create new folder",contextName),1); |