author | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2004-04-04 13:54:40 (UTC) |
commit | 16cf79e90b5217f8d4bfce2a0fa817ae4b73db36 (patch) (unidiff) | |
tree | 0701eae15aa606a0211a2fccfde0eafdac69357c /noncore/net/mail/accountitem.cpp | |
parent | 8d2d2664e5f544b8292806e617deb7a0e4170dc0 (diff) | |
download | opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.zip opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.gz opie-16cf79e90b5217f8d4bfce2a0fa817ae4b73db36.tar.bz2 |
convert to Opie Debugging Framework
Diffstat (limited to 'noncore/net/mail/accountitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountitem.cpp | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 54d2da2..ae28313 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -33,97 +33,97 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | |||
33 | } | 33 | } |
34 | else | 34 | else |
35 | { | 35 | { |
36 | setPixmap( 0, PIXMAP_OFFLINE ); | 36 | setPixmap( 0, PIXMAP_OFFLINE ); |
37 | } | 37 | } |
38 | #endif | 38 | #endif |
39 | setText( 0, account->getAccountName() ); | 39 | setText( 0, account->getAccountName() ); |
40 | setOpen( true ); | 40 | setOpen( true ); |
41 | } | 41 | } |
42 | 42 | ||
43 | POP3viewItem::~POP3viewItem() | 43 | POP3viewItem::~POP3viewItem() |
44 | { | 44 | { |
45 | delete wrapper; | 45 | delete wrapper; |
46 | } | 46 | } |
47 | 47 | ||
48 | AbstractMail *POP3viewItem::getWrapper() | 48 | AbstractMail *POP3viewItem::getWrapper() |
49 | { | 49 | { |
50 | return wrapper; | 50 | return wrapper; |
51 | } | 51 | } |
52 | 52 | ||
53 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) | 53 | void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) |
54 | { | 54 | { |
55 | refresh(); | 55 | refresh(); |
56 | } | 56 | } |
57 | 57 | ||
58 | void POP3viewItem::refresh() | 58 | void POP3viewItem::refresh() |
59 | { | 59 | { |
60 | if (account->getOffline()) return; | 60 | if (account->getOffline()) return; |
61 | QValueList<FolderP> *folders = wrapper->listFolders(); | 61 | QValueList<FolderP> *folders = wrapper->listFolders(); |
62 | QListViewItem *child = firstChild(); | 62 | QListViewItem *child = firstChild(); |
63 | while ( child ) | 63 | while ( child ) |
64 | { | 64 | { |
65 | QListViewItem *tmp = child; | 65 | QListViewItem *tmp = child; |
66 | child = child->nextSibling(); | 66 | child = child->nextSibling(); |
67 | delete tmp; | 67 | delete tmp; |
68 | } | 68 | } |
69 | QValueList<FolderP>::ConstIterator it; | 69 | QValueList<FolderP>::ConstIterator it; |
70 | QListViewItem*item = 0; | 70 | QListViewItem*item = 0; |
71 | for ( it = folders->begin(); it!=folders->end(); ++it) | 71 | for ( it = folders->begin(); it!=folders->end(); ++it) |
72 | { | 72 | { |
73 | item = new POP3folderItem( (*it), this , item ); | 73 | item = new POP3folderItem( (*it), this , item ); |
74 | item->setSelectable( (*it)->may_select()); | 74 | item->setSelectable( (*it)->may_select()); |
75 | } | 75 | } |
76 | delete folders; | 76 | delete folders; |
77 | } | 77 | } |
78 | 78 | ||
79 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 79 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
80 | { | 80 | { |
81 | qDebug( "POP3 fetchBody" ); | 81 | odebug << "POP3 fetchBody" << oendl; |
82 | return wrapper->fetchBody( mail ); | 82 | return wrapper->fetchBody( mail ); |
83 | } | 83 | } |
84 | 84 | ||
85 | QPopupMenu * POP3viewItem::getContextMenu() | 85 | QPopupMenu * POP3viewItem::getContextMenu() |
86 | { | 86 | { |
87 | QPopupMenu *m = new QPopupMenu(0); | 87 | QPopupMenu *m = new QPopupMenu(0); |
88 | if (m) | 88 | if (m) |
89 | { | 89 | { |
90 | if (!account->getOffline()) | 90 | if (!account->getOffline()) |
91 | { | 91 | { |
92 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 92 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
93 | m->insertItem(QObject::tr("Set offline",contextName),1); | 93 | m->insertItem(QObject::tr("Set offline",contextName),1); |
94 | } | 94 | } |
95 | else | 95 | else |
96 | { | 96 | { |
97 | m->insertItem(QObject::tr("Set online",contextName),1); | 97 | m->insertItem(QObject::tr("Set online",contextName),1); |
98 | } | 98 | } |
99 | } | 99 | } |
100 | return m; | 100 | return m; |
101 | } | 101 | } |
102 | 102 | ||
103 | void POP3viewItem::disconnect() | 103 | void POP3viewItem::disconnect() |
104 | { | 104 | { |
105 | QListViewItem *child = firstChild(); | 105 | QListViewItem *child = firstChild(); |
106 | while ( child ) | 106 | while ( child ) |
107 | { | 107 | { |
108 | QListViewItem *tmp = child; | 108 | QListViewItem *tmp = child; |
109 | child = child->nextSibling(); | 109 | child = child->nextSibling(); |
110 | delete tmp; | 110 | delete tmp; |
111 | } | 111 | } |
112 | wrapper->logout(); | 112 | wrapper->logout(); |
113 | } | 113 | } |
114 | 114 | ||
115 | void POP3viewItem::setOnOffline() | 115 | void POP3viewItem::setOnOffline() |
116 | { | 116 | { |
117 | if (!account->getOffline()) | 117 | if (!account->getOffline()) |
118 | { | 118 | { |
119 | disconnect(); | 119 | disconnect(); |
120 | } | 120 | } |
121 | account->setOffline(!account->getOffline()); | 121 | account->setOffline(!account->getOffline()); |
122 | account->save(); | 122 | account->save(); |
123 | SETPIX(PIXMAP_POP3FOLDER); | 123 | SETPIX(PIXMAP_POP3FOLDER); |
124 | refresh(); | 124 | refresh(); |
125 | } | 125 | } |
126 | 126 | ||
127 | void POP3viewItem::contextMenuSelected(int which) | 127 | void POP3viewItem::contextMenuSelected(int which) |
128 | { | 128 | { |
129 | switch (which) | 129 | switch (which) |
@@ -224,97 +224,97 @@ NNTPviewItem::NNTPviewItem( NNTPaccount *a, AccountView *parent ) | |||
224 | else | 224 | else |
225 | { | 225 | { |
226 | setPixmap( 0, PIXMAP_OFFLINE ); | 226 | setPixmap( 0, PIXMAP_OFFLINE ); |
227 | } | 227 | } |
228 | #endif | 228 | #endif |
229 | setText( 0, account->getAccountName() ); | 229 | setText( 0, account->getAccountName() ); |
230 | setOpen( true ); | 230 | setOpen( true ); |
231 | } | 231 | } |
232 | 232 | ||
233 | NNTPviewItem::~NNTPviewItem() | 233 | NNTPviewItem::~NNTPviewItem() |
234 | { | 234 | { |
235 | delete wrapper; | 235 | delete wrapper; |
236 | } | 236 | } |
237 | 237 | ||
238 | AbstractMail *NNTPviewItem::getWrapper() | 238 | AbstractMail *NNTPviewItem::getWrapper() |
239 | { | 239 | { |
240 | return wrapper; | 240 | return wrapper; |
241 | } | 241 | } |
242 | 242 | ||
243 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) | 243 | void NNTPviewItem::refresh( QValueList<RecMailP> & ) |
244 | { | 244 | { |
245 | refresh(); | 245 | refresh(); |
246 | } | 246 | } |
247 | 247 | ||
248 | void NNTPviewItem::refresh() | 248 | void NNTPviewItem::refresh() |
249 | { | 249 | { |
250 | if (account->getOffline()) return; | 250 | if (account->getOffline()) return; |
251 | QValueList<FolderP> *folders = wrapper->listFolders(); | 251 | QValueList<FolderP> *folders = wrapper->listFolders(); |
252 | 252 | ||
253 | QListViewItem *child = firstChild(); | 253 | QListViewItem *child = firstChild(); |
254 | while ( child ) | 254 | while ( child ) |
255 | { | 255 | { |
256 | QListViewItem *tmp = child; | 256 | QListViewItem *tmp = child; |
257 | child = child->nextSibling(); | 257 | child = child->nextSibling(); |
258 | delete tmp; | 258 | delete tmp; |
259 | } | 259 | } |
260 | QValueList<FolderP>::ConstIterator it; | 260 | QValueList<FolderP>::ConstIterator it; |
261 | QListViewItem*item = 0; | 261 | QListViewItem*item = 0; |
262 | for ( it = folders->begin(); it!=folders->end(); ++it) | 262 | for ( it = folders->begin(); it!=folders->end(); ++it) |
263 | { | 263 | { |
264 | item = new NNTPfolderItem( (*it), this , item ); | 264 | item = new NNTPfolderItem( (*it), this , item ); |
265 | item->setSelectable( (*it)->may_select()); | 265 | item->setSelectable( (*it)->may_select()); |
266 | } | 266 | } |
267 | delete folders; | 267 | delete folders; |
268 | } | 268 | } |
269 | 269 | ||
270 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 270 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
271 | { | 271 | { |
272 | qDebug( "NNTP fetchBody" ); | 272 | odebug << "NNTP fetchBody" << oendl; |
273 | return wrapper->fetchBody( mail ); | 273 | return wrapper->fetchBody( mail ); |
274 | } | 274 | } |
275 | 275 | ||
276 | QPopupMenu * NNTPviewItem::getContextMenu() | 276 | QPopupMenu * NNTPviewItem::getContextMenu() |
277 | { | 277 | { |
278 | QPopupMenu *m = new QPopupMenu(0); | 278 | QPopupMenu *m = new QPopupMenu(0); |
279 | if (m) | 279 | if (m) |
280 | { | 280 | { |
281 | if (!account->getOffline()) | 281 | if (!account->getOffline()) |
282 | { | 282 | { |
283 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 283 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
284 | m->insertItem(QObject::tr("Set offline",contextName),1); | 284 | m->insertItem(QObject::tr("Set offline",contextName),1); |
285 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); | 285 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); |
286 | } | 286 | } |
287 | else | 287 | else |
288 | { | 288 | { |
289 | m->insertItem(QObject::tr("Set online",contextName),1); | 289 | m->insertItem(QObject::tr("Set online",contextName),1); |
290 | } | 290 | } |
291 | } | 291 | } |
292 | return m; | 292 | return m; |
293 | } | 293 | } |
294 | 294 | ||
295 | void NNTPviewItem::subscribeGroups() | 295 | void NNTPviewItem::subscribeGroups() |
296 | { | 296 | { |
297 | NNTPGroupsDlg dlg(account); | 297 | NNTPGroupsDlg dlg(account); |
298 | if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){ | 298 | if (QPEApplication::execDialog(&dlg)== QDialog::Accepted ){ |
299 | refresh(); | 299 | refresh(); |
300 | } | 300 | } |
301 | } | 301 | } |
302 | 302 | ||
303 | void NNTPviewItem::disconnect() | 303 | void NNTPviewItem::disconnect() |
304 | { | 304 | { |
305 | QListViewItem *child = firstChild(); | 305 | QListViewItem *child = firstChild(); |
306 | while ( child ) | 306 | while ( child ) |
307 | { | 307 | { |
308 | QListViewItem *tmp = child; | 308 | QListViewItem *tmp = child; |
309 | child = child->nextSibling(); | 309 | child = child->nextSibling(); |
310 | delete tmp; | 310 | delete tmp; |
311 | } | 311 | } |
312 | wrapper->logout(); | 312 | wrapper->logout(); |
313 | } | 313 | } |
314 | 314 | ||
315 | void NNTPviewItem::setOnOffline() | 315 | void NNTPviewItem::setOnOffline() |
316 | { | 316 | { |
317 | if (!account->getOffline()) | 317 | if (!account->getOffline()) |
318 | { | 318 | { |
319 | disconnect(); | 319 | disconnect(); |
320 | } | 320 | } |
@@ -415,170 +415,170 @@ IMAPviewItem::IMAPviewItem( IMAPaccount *a, AccountView *parent ) | |||
415 | account = a; | 415 | account = a; |
416 | wrapper = AbstractMail::getWrapper( account ); | 416 | wrapper = AbstractMail::getWrapper( account ); |
417 | SETPIX(PIXMAP_IMAPFOLDER); | 417 | SETPIX(PIXMAP_IMAPFOLDER); |
418 | setText( 0, account->getAccountName() ); | 418 | setText( 0, account->getAccountName() ); |
419 | setOpen( true ); | 419 | setOpen( true ); |
420 | } | 420 | } |
421 | 421 | ||
422 | IMAPviewItem::~IMAPviewItem() | 422 | IMAPviewItem::~IMAPviewItem() |
423 | { | 423 | { |
424 | delete wrapper; | 424 | delete wrapper; |
425 | } | 425 | } |
426 | 426 | ||
427 | AbstractMail *IMAPviewItem::getWrapper() | 427 | AbstractMail *IMAPviewItem::getWrapper() |
428 | { | 428 | { |
429 | return wrapper; | 429 | return wrapper; |
430 | } | 430 | } |
431 | 431 | ||
432 | void IMAPviewItem::refresh(QValueList<RecMailP>&) | 432 | void IMAPviewItem::refresh(QValueList<RecMailP>&) |
433 | { | 433 | { |
434 | refreshFolders(false); | 434 | refreshFolders(false); |
435 | } | 435 | } |
436 | 436 | ||
437 | const QStringList&IMAPviewItem::subFolders() | 437 | const QStringList&IMAPviewItem::subFolders() |
438 | { | 438 | { |
439 | return currentFolders; | 439 | return currentFolders; |
440 | } | 440 | } |
441 | 441 | ||
442 | void IMAPviewItem::refreshFolders(bool force) | 442 | void IMAPviewItem::refreshFolders(bool force) |
443 | { | 443 | { |
444 | if (childCount()>0 && force==false) return; | 444 | if (childCount()>0 && force==false) return; |
445 | if (account->getOffline()) return; | 445 | if (account->getOffline()) return; |
446 | 446 | ||
447 | removeChilds(); | 447 | removeChilds(); |
448 | currentFolders.clear(); | 448 | currentFolders.clear(); |
449 | QValueList<FolderP> * folders = wrapper->listFolders(); | 449 | QValueList<FolderP> * folders = wrapper->listFolders(); |
450 | 450 | ||
451 | QValueList<FolderP>::Iterator it; | 451 | QValueList<FolderP>::Iterator it; |
452 | QListViewItem*item = 0; | 452 | QListViewItem*item = 0; |
453 | QListViewItem*titem = 0; | 453 | QListViewItem*titem = 0; |
454 | QString fname,del,search; | 454 | QString fname,del,search; |
455 | int pos; | 455 | int pos; |
456 | 456 | ||
457 | for ( it = folders->begin(); it!=folders->end(); ++it) | 457 | for ( it = folders->begin(); it!=folders->end(); ++it) |
458 | { | 458 | { |
459 | if ((*it)->getDisplayName().lower()=="inbox") | 459 | if ((*it)->getDisplayName().lower()=="inbox") |
460 | { | 460 | { |
461 | item = new IMAPfolderItem( (*it), this , item ); | 461 | item = new IMAPfolderItem( (*it), this , item ); |
462 | folders->remove(it); | 462 | folders->remove(it); |
463 | qDebug("inbox found"); | 463 | odebug << "inbox found" << oendl; |
464 | break; | 464 | break; |
465 | } | 465 | } |
466 | } | 466 | } |
467 | for ( it = folders->begin(); it!=folders->end(); ++it) | 467 | for ( it = folders->begin(); it!=folders->end(); ++it) |
468 | { | 468 | { |
469 | fname = (*it)->getDisplayName(); | 469 | fname = (*it)->getDisplayName(); |
470 | currentFolders.append((*it)->getName()); | 470 | currentFolders.append((*it)->getName()); |
471 | pos = fname.findRev((*it)->Separator()); | 471 | pos = fname.findRev((*it)->Separator()); |
472 | if (pos != -1) | 472 | if (pos != -1) |
473 | { | 473 | { |
474 | fname = fname.left(pos); | 474 | fname = fname.left(pos); |
475 | } | 475 | } |
476 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 476 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
477 | if (pitem) | 477 | if (pitem) |
478 | { | 478 | { |
479 | titem = item; | 479 | titem = item; |
480 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); | 480 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); |
481 | /* setup the short name */ | 481 | /* setup the short name */ |
482 | item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); | 482 | item->setText(0,(*it)->getDisplayName().right((*it)->getDisplayName().length()-pos-1)); |
483 | item = titem; | 483 | item = titem; |
484 | } | 484 | } |
485 | else | 485 | else |
486 | { | 486 | { |
487 | item = new IMAPfolderItem( (*it), this , item ); | 487 | item = new IMAPfolderItem( (*it), this , item ); |
488 | } | 488 | } |
489 | } | 489 | } |
490 | delete folders; | 490 | delete folders; |
491 | } | 491 | } |
492 | 492 | ||
493 | QPopupMenu * IMAPviewItem::getContextMenu() | 493 | QPopupMenu * IMAPviewItem::getContextMenu() |
494 | { | 494 | { |
495 | QPopupMenu *m = new QPopupMenu(0); | 495 | QPopupMenu *m = new QPopupMenu(0); |
496 | if (m) | 496 | if (m) |
497 | { | 497 | { |
498 | if (!account->getOffline()) | 498 | if (!account->getOffline()) |
499 | { | 499 | { |
500 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 500 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
501 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 501 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
502 | m->insertSeparator(); | 502 | m->insertSeparator(); |
503 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 503 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
504 | m->insertItem(QObject::tr("Set offline",contextName),3); | 504 | m->insertItem(QObject::tr("Set offline",contextName),3); |
505 | } | 505 | } |
506 | else | 506 | else |
507 | { | 507 | { |
508 | m->insertItem(QObject::tr("Set online",contextName),3); | 508 | m->insertItem(QObject::tr("Set online",contextName),3); |
509 | } | 509 | } |
510 | } | 510 | } |
511 | return m; | 511 | return m; |
512 | } | 512 | } |
513 | 513 | ||
514 | void IMAPviewItem::createNewFolder() | 514 | void IMAPviewItem::createNewFolder() |
515 | { | 515 | { |
516 | Newmdirdlg ndirdlg; | 516 | Newmdirdlg ndirdlg; |
517 | if ( QPEApplication::execDialog( &ndirdlg )) | 517 | if ( QPEApplication::execDialog( &ndirdlg )) |
518 | { | 518 | { |
519 | QString ndir = ndirdlg.Newdir(); | 519 | QString ndir = ndirdlg.Newdir(); |
520 | bool makesubs = ndirdlg.subpossible(); | 520 | bool makesubs = ndirdlg.subpossible(); |
521 | QString delemiter = "/"; | 521 | QString delemiter = "/"; |
522 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 522 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
523 | if (item) | 523 | if (item) |
524 | { | 524 | { |
525 | delemiter = item->Delemiter(); | 525 | delemiter = item->Delemiter(); |
526 | } | 526 | } |
527 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 527 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
528 | { | 528 | { |
529 | refreshFolders(true); | 529 | refreshFolders(true); |
530 | } | 530 | } |
531 | } | 531 | } |
532 | } | 532 | } |
533 | 533 | ||
534 | void IMAPviewItem::contextMenuSelected(int id) | 534 | void IMAPviewItem::contextMenuSelected(int id) |
535 | { | 535 | { |
536 | qDebug("Id selected: %i",id); | 536 | odebug << "Id selected: " << id << "" << oendl; |
537 | switch (id) | 537 | switch (id) |
538 | { | 538 | { |
539 | case 0: | 539 | case 0: |
540 | refreshFolders(true); | 540 | refreshFolders(true); |
541 | break; | 541 | break; |
542 | case 1: | 542 | case 1: |
543 | createNewFolder(); | 543 | createNewFolder(); |
544 | break; | 544 | break; |
545 | case 2: | 545 | case 2: |
546 | removeChilds(); | 546 | removeChilds(); |
547 | wrapper->logout(); | 547 | wrapper->logout(); |
548 | break; | 548 | break; |
549 | case 3: | 549 | case 3: |
550 | if (account->getOffline()==false) | 550 | if (account->getOffline()==false) |
551 | { | 551 | { |
552 | removeChilds(); | 552 | removeChilds(); |
553 | wrapper->logout(); | 553 | wrapper->logout(); |
554 | } | 554 | } |
555 | account->setOffline(!account->getOffline()); | 555 | account->setOffline(!account->getOffline()); |
556 | account->save(); | 556 | account->save(); |
557 | SETPIX(PIXMAP_IMAPFOLDER); | 557 | SETPIX(PIXMAP_IMAPFOLDER); |
558 | refreshFolders(false); | 558 | refreshFolders(false); |
559 | break; | 559 | break; |
560 | default: | 560 | default: |
561 | break; | 561 | break; |
562 | } | 562 | } |
563 | } | 563 | } |
564 | 564 | ||
565 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) | 565 | RECBODYP IMAPviewItem::fetchBody(const RecMailP&) |
566 | { | 566 | { |
567 | return new RecBody(); | 567 | return new RecBody(); |
568 | } | 568 | } |
569 | 569 | ||
570 | bool IMAPviewItem::offline() | 570 | bool IMAPviewItem::offline() |
571 | { | 571 | { |
572 | return account->getOffline(); | 572 | return account->getOffline(); |
573 | } | 573 | } |
574 | 574 | ||
575 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) | 575 | IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) |
576 | : AccountViewItem( folderInit, parent , after ) | 576 | : AccountViewItem( folderInit, parent , after ) |
577 | { | 577 | { |
578 | imap = parent; | 578 | imap = parent; |
579 | if (folder->getDisplayName().lower()!="inbox") | 579 | if (folder->getDisplayName().lower()!="inbox") |
580 | { | 580 | { |
581 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 581 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
582 | } | 582 | } |
583 | else | 583 | else |
584 | { | 584 | { |
@@ -626,124 +626,124 @@ RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | |||
626 | { | 626 | { |
627 | return imap->getWrapper()->fetchBody(aMail); | 627 | return imap->getWrapper()->fetchBody(aMail); |
628 | } | 628 | } |
629 | 629 | ||
630 | QPopupMenu * IMAPfolderItem::getContextMenu() | 630 | QPopupMenu * IMAPfolderItem::getContextMenu() |
631 | { | 631 | { |
632 | QPopupMenu *m = new QPopupMenu(0); | 632 | QPopupMenu *m = new QPopupMenu(0); |
633 | if (m) | 633 | if (m) |
634 | { | 634 | { |
635 | if (folder->may_select()) | 635 | if (folder->may_select()) |
636 | { | 636 | { |
637 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 637 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
638 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 638 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
639 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 639 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
640 | } | 640 | } |
641 | if (folder->no_inferior()==false) | 641 | if (folder->no_inferior()==false) |
642 | { | 642 | { |
643 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 643 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
644 | } | 644 | } |
645 | if (folder->getDisplayName().lower()!="inbox") | 645 | if (folder->getDisplayName().lower()!="inbox") |
646 | { | 646 | { |
647 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 647 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
648 | } | 648 | } |
649 | } | 649 | } |
650 | return m; | 650 | return m; |
651 | } | 651 | } |
652 | 652 | ||
653 | void IMAPfolderItem::createNewFolder() | 653 | void IMAPfolderItem::createNewFolder() |
654 | { | 654 | { |
655 | Newmdirdlg ndirdlg; | 655 | Newmdirdlg ndirdlg; |
656 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 656 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
657 | { | 657 | { |
658 | QString ndir = ndirdlg.Newdir(); | 658 | QString ndir = ndirdlg.Newdir(); |
659 | bool makesubs = ndirdlg.subpossible(); | 659 | bool makesubs = ndirdlg.subpossible(); |
660 | QString delemiter = Delemiter(); | 660 | QString delemiter = Delemiter(); |
661 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 661 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
662 | { | 662 | { |
663 | imap->refreshFolders(true); | 663 | imap->refreshFolders(true); |
664 | } | 664 | } |
665 | } | 665 | } |
666 | } | 666 | } |
667 | 667 | ||
668 | void IMAPfolderItem::deleteFolder() | 668 | void IMAPfolderItem::deleteFolder() |
669 | { | 669 | { |
670 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 670 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
671 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 671 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
672 | QObject::tr("Yes",contextName), | 672 | QObject::tr("Yes",contextName), |
673 | QObject::tr("No",contextName),QString::null,1,1); | 673 | QObject::tr("No",contextName),QString::null,1,1); |
674 | qDebug("Auswahl: %i",yesno); | 674 | odebug << "Auswahl: " << yesno << "" << oendl; |
675 | if (yesno == 0) | 675 | if (yesno == 0) |
676 | { | 676 | { |
677 | if (imap->getWrapper()->deleteMbox(folder)) | 677 | if (imap->getWrapper()->deleteMbox(folder)) |
678 | { | 678 | { |
679 | QListView*v=listView(); | 679 | QListView*v=listView(); |
680 | IMAPviewItem * box = imap; | 680 | IMAPviewItem * box = imap; |
681 | /* be carefull - after that this object is destroyd so don't use | 681 | /* be carefull - after that this object is destroyd so don't use |
682 | * any member of it after that call!!*/ | 682 | * any member of it after that call!!*/ |
683 | imap->refreshFolders(true); | 683 | imap->refreshFolders(true); |
684 | if (v) | 684 | if (v) |
685 | { | 685 | { |
686 | v->setSelected(box,true); | 686 | v->setSelected(box,true); |
687 | } | 687 | } |
688 | } | 688 | } |
689 | } | 689 | } |
690 | } | 690 | } |
691 | 691 | ||
692 | void IMAPfolderItem::downloadMails() | 692 | void IMAPfolderItem::downloadMails() |
693 | { | 693 | { |
694 | AccountView*bl = imap->accountView(); | 694 | AccountView*bl = imap->accountView(); |
695 | if (!bl) return; | 695 | if (!bl) return; |
696 | bl->downloadMails(folder,imap->getWrapper()); | 696 | bl->downloadMails(folder,imap->getWrapper()); |
697 | } | 697 | } |
698 | 698 | ||
699 | void IMAPfolderItem::contextMenuSelected(int id) | 699 | void IMAPfolderItem::contextMenuSelected(int id) |
700 | { | 700 | { |
701 | qDebug("Selected id: %i",id); | 701 | odebug << "Selected id: " << id << "" << oendl; |
702 | AccountView * view = (AccountView*)listView(); | 702 | AccountView * view = (AccountView*)listView(); |
703 | switch(id) | 703 | switch(id) |
704 | { | 704 | { |
705 | case 0: | 705 | case 0: |
706 | view->refreshCurrent(); | 706 | view->refreshCurrent(); |
707 | break; | 707 | break; |
708 | case 1: | 708 | case 1: |
709 | deleteAllMail(imap->getWrapper(),folder); | 709 | deleteAllMail(imap->getWrapper(),folder); |
710 | break; | 710 | break; |
711 | case 2: | 711 | case 2: |
712 | createNewFolder(); | 712 | createNewFolder(); |
713 | break; | 713 | break; |
714 | case 3: | 714 | case 3: |
715 | deleteFolder(); | 715 | deleteFolder(); |
716 | break; | 716 | break; |
717 | case 4: | 717 | case 4: |
718 | downloadMails(); | 718 | downloadMails(); |
719 | break; | 719 | break; |
720 | default: | 720 | default: |
721 | break; | 721 | break; |
722 | } | 722 | } |
723 | } | 723 | } |
724 | 724 | ||
725 | /** | 725 | /** |
726 | * MH Account stuff | 726 | * MH Account stuff |
727 | */ | 727 | */ |
728 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and | 728 | /* MH is a little bit different - the top folder can contains messages other than in IMAP and |
729 | POP3 and MBOX */ | 729 | POP3 and MBOX */ |
730 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) | 730 | MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) |
731 | : AccountViewItem( parent ) | 731 | : AccountViewItem( parent ) |
732 | { | 732 | { |
733 | m_Path = aPath; | 733 | m_Path = aPath; |
734 | /* be carefull - the space within settext is wanted - thats why the string twice */ | 734 | /* be carefull - the space within settext is wanted - thats why the string twice */ |
735 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); | 735 | wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); |
736 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 736 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
737 | setText( 0, " Local Folders" ); | 737 | setText( 0, " Local Folders" ); |
738 | setOpen( true ); | 738 | setOpen( true ); |
739 | folder = 0; | 739 | folder = 0; |
740 | } | 740 | } |
741 | 741 | ||
742 | MHviewItem::~MHviewItem() | 742 | MHviewItem::~MHviewItem() |
743 | { | 743 | { |
744 | delete wrapper; | 744 | delete wrapper; |
745 | } | 745 | } |
746 | 746 | ||
747 | AbstractMail *MHviewItem::getWrapper() | 747 | AbstractMail *MHviewItem::getWrapper() |
748 | { | 748 | { |
749 | return wrapper; | 749 | return wrapper; |
@@ -757,97 +757,97 @@ void MHviewItem::refresh( QValueList<RecMailP> & target) | |||
757 | 757 | ||
758 | void MHviewItem::refresh(bool force) | 758 | void MHviewItem::refresh(bool force) |
759 | { | 759 | { |
760 | if (childCount()>0 && force==false) return; | 760 | if (childCount()>0 && force==false) return; |
761 | removeChilds(); | 761 | removeChilds(); |
762 | currentFolders.clear(); | 762 | currentFolders.clear(); |
763 | QValueList<FolderP> *folders = wrapper->listFolders(); | 763 | QValueList<FolderP> *folders = wrapper->listFolders(); |
764 | QValueList<FolderP>::ConstIterator it; | 764 | QValueList<FolderP>::ConstIterator it; |
765 | MHfolderItem*item = 0; | 765 | MHfolderItem*item = 0; |
766 | MHfolderItem*pmaster = 0; | 766 | MHfolderItem*pmaster = 0; |
767 | QString fname = ""; | 767 | QString fname = ""; |
768 | int pos; | 768 | int pos; |
769 | for ( it = folders->begin(); it!=folders->end(); ++it) | 769 | for ( it = folders->begin(); it!=folders->end(); ++it) |
770 | { | 770 | { |
771 | fname = (*it)->getDisplayName(); | 771 | fname = (*it)->getDisplayName(); |
772 | /* this folder itself */ | 772 | /* this folder itself */ |
773 | if (fname=="/") | 773 | if (fname=="/") |
774 | { | 774 | { |
775 | currentFolders.append(fname); | 775 | currentFolders.append(fname); |
776 | folder = (*it); | 776 | folder = (*it); |
777 | continue; | 777 | continue; |
778 | } | 778 | } |
779 | currentFolders.append(fname); | 779 | currentFolders.append(fname); |
780 | pos = fname.findRev("/"); | 780 | pos = fname.findRev("/"); |
781 | if (pos > 0) | 781 | if (pos > 0) |
782 | { | 782 | { |
783 | fname = fname.left(pos); | 783 | fname = fname.left(pos); |
784 | pmaster = (MHfolderItem*)findSubItem(fname); | 784 | pmaster = (MHfolderItem*)findSubItem(fname); |
785 | } | 785 | } |
786 | else | 786 | else |
787 | { | 787 | { |
788 | pmaster = 0; | 788 | pmaster = 0; |
789 | } | 789 | } |
790 | if (pmaster) | 790 | if (pmaster) |
791 | { | 791 | { |
792 | item = new MHfolderItem( (*it), pmaster, item, this ); | 792 | item = new MHfolderItem( (*it), pmaster, item, this ); |
793 | } | 793 | } |
794 | else | 794 | else |
795 | { | 795 | { |
796 | item = new MHfolderItem( (*it), this , item ); | 796 | item = new MHfolderItem( (*it), this , item ); |
797 | } | 797 | } |
798 | item->setSelectable((*it)->may_select()); | 798 | item->setSelectable((*it)->may_select()); |
799 | } | 799 | } |
800 | delete folders; | 800 | delete folders; |
801 | } | 801 | } |
802 | 802 | ||
803 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 803 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
804 | { | 804 | { |
805 | qDebug( "MH fetchBody" ); | 805 | odebug << "MH fetchBody" << oendl; |
806 | return wrapper->fetchBody( mail ); | 806 | return wrapper->fetchBody( mail ); |
807 | } | 807 | } |
808 | 808 | ||
809 | QPopupMenu * MHviewItem::getContextMenu() | 809 | QPopupMenu * MHviewItem::getContextMenu() |
810 | { | 810 | { |
811 | QPopupMenu *m = new QPopupMenu(0); | 811 | QPopupMenu *m = new QPopupMenu(0); |
812 | if (m) | 812 | if (m) |
813 | { | 813 | { |
814 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 814 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
815 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 815 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
816 | m->insertItem(QObject::tr("Delete all mails",contextName),2); | 816 | m->insertItem(QObject::tr("Delete all mails",contextName),2); |
817 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); | 817 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); |
818 | } | 818 | } |
819 | return m; | 819 | return m; |
820 | } | 820 | } |
821 | 821 | ||
822 | void MHviewItem::createFolder() | 822 | void MHviewItem::createFolder() |
823 | { | 823 | { |
824 | Newmdirdlg ndirdlg(0,0,true); | 824 | Newmdirdlg ndirdlg(0,0,true); |
825 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 825 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
826 | { | 826 | { |
827 | QString ndir = ndirdlg.Newdir(); | 827 | QString ndir = ndirdlg.Newdir(); |
828 | if (wrapper->createMbox(ndir)) | 828 | if (wrapper->createMbox(ndir)) |
829 | { | 829 | { |
830 | refresh(true); | 830 | refresh(true); |
831 | } | 831 | } |
832 | } | 832 | } |
833 | } | 833 | } |
834 | 834 | ||
835 | void MHviewItem::downloadMails() | 835 | void MHviewItem::downloadMails() |
836 | { | 836 | { |
837 | AccountView*bl = accountView(); | 837 | AccountView*bl = accountView(); |
838 | if (!bl) return; | 838 | if (!bl) return; |
839 | bl->downloadMails(folder,getWrapper()); | 839 | bl->downloadMails(folder,getWrapper()); |
840 | } | 840 | } |
841 | 841 | ||
842 | QStringList MHviewItem::subFolders() | 842 | QStringList MHviewItem::subFolders() |
843 | { | 843 | { |
844 | return currentFolders; | 844 | return currentFolders; |
845 | } | 845 | } |
846 | 846 | ||
847 | void MHviewItem::contextMenuSelected(int which) | 847 | void MHviewItem::contextMenuSelected(int which) |
848 | { | 848 | { |
849 | switch (which) | 849 | switch (which) |
850 | { | 850 | { |
851 | case 0: | 851 | case 0: |
852 | refresh(true); | 852 | refresh(true); |
853 | break; | 853 | break; |
@@ -887,97 +887,97 @@ void MHfolderItem::initName() | |||
887 | { | 887 | { |
888 | QString bName = folder->getDisplayName(); | 888 | QString bName = folder->getDisplayName(); |
889 | if (bName.startsWith("/")&&bName.length()>1) | 889 | if (bName.startsWith("/")&&bName.length()>1) |
890 | { | 890 | { |
891 | bName.replace(0,1,""); | 891 | bName.replace(0,1,""); |
892 | } | 892 | } |
893 | int pos = bName.findRev("/"); | 893 | int pos = bName.findRev("/"); |
894 | if (pos > 0) | 894 | if (pos > 0) |
895 | { | 895 | { |
896 | bName.replace(0,pos+1,""); | 896 | bName.replace(0,pos+1,""); |
897 | } | 897 | } |
898 | if (bName.lower() == "outgoing") | 898 | if (bName.lower() == "outgoing") |
899 | { | 899 | { |
900 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 900 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
901 | } | 901 | } |
902 | else if (bName.lower() == "inbox") | 902 | else if (bName.lower() == "inbox") |
903 | { | 903 | { |
904 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 904 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
905 | } else if (bName.lower() == "drafts") { | 905 | } else if (bName.lower() == "drafts") { |
906 | setPixmap(0, Resource::loadPixmap("inline/edit")); | 906 | setPixmap(0, Resource::loadPixmap("inline/edit")); |
907 | } else { | 907 | } else { |
908 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 908 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
909 | } | 909 | } |
910 | setText( 0, bName ); | 910 | setText( 0, bName ); |
911 | } | 911 | } |
912 | 912 | ||
913 | const FolderP&MHfolderItem::getFolder()const | 913 | const FolderP&MHfolderItem::getFolder()const |
914 | { | 914 | { |
915 | return folder; | 915 | return folder; |
916 | } | 916 | } |
917 | 917 | ||
918 | void MHfolderItem::refresh(QValueList<RecMailP>&target) | 918 | void MHfolderItem::refresh(QValueList<RecMailP>&target) |
919 | { | 919 | { |
920 | if (folder->may_select()) | 920 | if (folder->may_select()) |
921 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 921 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
922 | } | 922 | } |
923 | 923 | ||
924 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) | 924 | RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) |
925 | { | 925 | { |
926 | return mbox->getWrapper()->fetchBody(aMail); | 926 | return mbox->getWrapper()->fetchBody(aMail); |
927 | } | 927 | } |
928 | 928 | ||
929 | void MHfolderItem::deleteFolder() | 929 | void MHfolderItem::deleteFolder() |
930 | { | 930 | { |
931 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 931 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
932 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 932 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
933 | QObject::tr("Yes",contextName), | 933 | QObject::tr("Yes",contextName), |
934 | QObject::tr("No",contextName),QString::null,1,1); | 934 | QObject::tr("No",contextName),QString::null,1,1); |
935 | qDebug("Auswahl: %i",yesno); | 935 | odebug << "Auswahl: " << yesno << "" << oendl; |
936 | if (yesno == 0) | 936 | if (yesno == 0) |
937 | { | 937 | { |
938 | if (mbox->getWrapper()->deleteMbox(folder)) | 938 | if (mbox->getWrapper()->deleteMbox(folder)) |
939 | { | 939 | { |
940 | QListView*v=listView(); | 940 | QListView*v=listView(); |
941 | MHviewItem * box = mbox; | 941 | MHviewItem * box = mbox; |
942 | /* be carefull - after that this object is destroyd so don't use | 942 | /* be carefull - after that this object is destroyd so don't use |
943 | * any member of it after that call!!*/ | 943 | * any member of it after that call!!*/ |
944 | mbox->refresh(true); | 944 | mbox->refresh(true); |
945 | if (v) | 945 | if (v) |
946 | { | 946 | { |
947 | v->setSelected(box,true); | 947 | v->setSelected(box,true); |
948 | } | 948 | } |
949 | } | 949 | } |
950 | } | 950 | } |
951 | } | 951 | } |
952 | 952 | ||
953 | QPopupMenu * MHfolderItem::getContextMenu() | 953 | QPopupMenu * MHfolderItem::getContextMenu() |
954 | { | 954 | { |
955 | QPopupMenu *m = new QPopupMenu(0); | 955 | QPopupMenu *m = new QPopupMenu(0); |
956 | if (m) | 956 | if (m) |
957 | { | 957 | { |
958 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 958 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
959 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | 959 | m->insertItem(QObject::tr("Delete all mails",contextName),0); |
960 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); | 960 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); |
961 | m->insertItem(QObject::tr("Delete folder",contextName),1); | 961 | m->insertItem(QObject::tr("Delete folder",contextName),1); |
962 | } | 962 | } |
963 | return m; | 963 | return m; |
964 | } | 964 | } |
965 | 965 | ||
966 | void MHfolderItem::downloadMails() | 966 | void MHfolderItem::downloadMails() |
967 | { | 967 | { |
968 | AccountView*bl = mbox->accountView(); | 968 | AccountView*bl = mbox->accountView(); |
969 | if (!bl) return; | 969 | if (!bl) return; |
970 | bl->downloadMails(folder,mbox->getWrapper()); | 970 | bl->downloadMails(folder,mbox->getWrapper()); |
971 | } | 971 | } |
972 | 972 | ||
973 | void MHfolderItem::createFolder() | 973 | void MHfolderItem::createFolder() |
974 | { | 974 | { |
975 | Newmdirdlg ndirdlg(0,0,true); | 975 | Newmdirdlg ndirdlg(0,0,true); |
976 | if ( QPEApplication::execDialog( &ndirdlg ) ) | 976 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
977 | { | 977 | { |
978 | QString ndir = ndirdlg.Newdir(); | 978 | QString ndir = ndirdlg.Newdir(); |
979 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 979 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
980 | { | 980 | { |
981 | QListView*v=listView(); | 981 | QListView*v=listView(); |
982 | MHviewItem * box = mbox; | 982 | MHviewItem * box = mbox; |
983 | /* be carefull - after that this object is destroyd so don't use | 983 | /* be carefull - after that this object is destroyd so don't use |
@@ -1029,97 +1029,97 @@ AccountViewItem::AccountViewItem( AccountView *parent ) | |||
1029 | { | 1029 | { |
1030 | init(); | 1030 | init(); |
1031 | m_Backlink = parent; | 1031 | m_Backlink = parent; |
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | AccountViewItem::AccountViewItem( QListViewItem *parent) | 1034 | AccountViewItem::AccountViewItem( QListViewItem *parent) |
1035 | : QListViewItem( parent),folder(0) | 1035 | : QListViewItem( parent),folder(0) |
1036 | { | 1036 | { |
1037 | init(); | 1037 | init(); |
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) | 1040 | AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) |
1041 | :QListViewItem( parent,after ),folder(0) | 1041 | :QListViewItem( parent,after ),folder(0) |
1042 | { | 1042 | { |
1043 | init(); | 1043 | init(); |
1044 | } | 1044 | } |
1045 | 1045 | ||
1046 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) | 1046 | AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) |
1047 | :QListViewItem( parent,after ),folder(folderInit) | 1047 | :QListViewItem( parent,after ),folder(folderInit) |
1048 | { | 1048 | { |
1049 | init(); | 1049 | init(); |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | void AccountViewItem::init() | 1052 | void AccountViewItem::init() |
1053 | { | 1053 | { |
1054 | m_Backlink = 0; | 1054 | m_Backlink = 0; |
1055 | } | 1055 | } |
1056 | 1056 | ||
1057 | AccountViewItem::~AccountViewItem() | 1057 | AccountViewItem::~AccountViewItem() |
1058 | { | 1058 | { |
1059 | folder = 0; | 1059 | folder = 0; |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | AccountView*AccountViewItem::accountView() | 1062 | AccountView*AccountViewItem::accountView() |
1063 | { | 1063 | { |
1064 | return m_Backlink; | 1064 | return m_Backlink; |
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) | 1067 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) |
1068 | { | 1068 | { |
1069 | if (!wrapper) return; | 1069 | if (!wrapper) return; |
1070 | QString fname=""; | 1070 | QString fname=""; |
1071 | if (folder) fname = folder->getDisplayName(); | 1071 | if (folder) fname = folder->getDisplayName(); |
1072 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 1072 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
1073 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 1073 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
1074 | arg(fname), | 1074 | arg(fname), |
1075 | QObject::tr("Yes",contextName), | 1075 | QObject::tr("Yes",contextName), |
1076 | QObject::tr("No",contextName),QString::null,1,1); | 1076 | QObject::tr("No",contextName),QString::null,1,1); |
1077 | qDebug("Auswahl: %i",yesno); | 1077 | odebug << "Auswahl: " << yesno << "" << oendl; |
1078 | if (yesno == 0) | 1078 | if (yesno == 0) |
1079 | { | 1079 | { |
1080 | if (wrapper->deleteAllMail(folder)) | 1080 | if (wrapper->deleteAllMail(folder)) |
1081 | { | 1081 | { |
1082 | AccountView * view = (AccountView*)listView(); | 1082 | AccountView * view = (AccountView*)listView(); |
1083 | if (view) view->refreshCurrent(); | 1083 | if (view) view->refreshCurrent(); |
1084 | } | 1084 | } |
1085 | } | 1085 | } |
1086 | } | 1086 | } |
1087 | 1087 | ||
1088 | void AccountViewItem::removeChilds() | 1088 | void AccountViewItem::removeChilds() |
1089 | { | 1089 | { |
1090 | QListViewItem *child = firstChild(); | 1090 | QListViewItem *child = firstChild(); |
1091 | while ( child ) | 1091 | while ( child ) |
1092 | { | 1092 | { |
1093 | QListViewItem *tmp = child; | 1093 | QListViewItem *tmp = child; |
1094 | child = child->nextSibling(); | 1094 | child = child->nextSibling(); |
1095 | delete tmp; | 1095 | delete tmp; |
1096 | } | 1096 | } |
1097 | } | 1097 | } |
1098 | 1098 | ||
1099 | bool AccountViewItem::matchName(const QString&name)const | 1099 | bool AccountViewItem::matchName(const QString&name)const |
1100 | { | 1100 | { |
1101 | if (!folder) return false; | 1101 | if (!folder) return false; |
1102 | return folder->getDisplayName()==name; | 1102 | return folder->getDisplayName()==name; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | 1105 | ||
1106 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) | 1106 | AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) |
1107 | { | 1107 | { |
1108 | AccountViewItem*pitem,*sitem; | 1108 | AccountViewItem*pitem,*sitem; |
1109 | if (!start) pitem = (AccountViewItem*)firstChild(); | 1109 | if (!start) pitem = (AccountViewItem*)firstChild(); |
1110 | else pitem = (AccountViewItem*)start->firstChild(); | 1110 | else pitem = (AccountViewItem*)start->firstChild(); |
1111 | while (pitem) | 1111 | while (pitem) |
1112 | { | 1112 | { |
1113 | if (pitem->matchName(path)) | 1113 | if (pitem->matchName(path)) |
1114 | { | 1114 | { |
1115 | break; | 1115 | break; |
1116 | } | 1116 | } |
1117 | if (pitem->childCount()>0) | 1117 | if (pitem->childCount()>0) |
1118 | { | 1118 | { |
1119 | sitem = findSubItem(path,pitem); | 1119 | sitem = findSubItem(path,pitem); |
1120 | if (sitem) | 1120 | if (sitem) |
1121 | { | 1121 | { |
1122 | pitem = sitem; | 1122 | pitem = sitem; |
1123 | break; | 1123 | break; |
1124 | } | 1124 | } |
1125 | } | 1125 | } |