summaryrefslogtreecommitdiffabout
path: root/kmicromail/accountitem.cpp
Unidiff
Diffstat (limited to 'kmicromail/accountitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp128
1 files changed, 65 insertions, 63 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 985a762..9b1ea2f 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -7,18 +7,20 @@
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 <q3popupmenu.h>
16#include <qmessagebox.h> 16#include <qmessagebox.h>
17//Added by qt3to4:
18#include <Q3ValueList>
17#include <kiconloader.h> 19#include <kiconloader.h>
18#include <klocale.h> 20#include <klocale.h>
19 21
20#define GET_NEW_MAILS 101 22#define GET_NEW_MAILS 101
21 23
22using namespace Opie::Core; 24using namespace Opie::Core;
23#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} 25#define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );}
24/** 26/**
@@ -49,51 +51,51 @@ POP3viewItem::~POP3viewItem()
49 delete wrapper; 51 delete wrapper;
50} 52}
51 53
52AbstractMail *POP3viewItem::getWrapper() 54AbstractMail *POP3viewItem::getWrapper()
53{ 55{
54 return wrapper; 56 return wrapper;
55} 57}
56 58
57void POP3viewItem::refresh(QValueList<Opie::Core::OSmartPointer<RecMail> > & ) 59void POP3viewItem::refresh(Q3ValueList<Opie::Core::OSmartPointer<RecMail> > & )
58{ 60{
59 refresh(); 61 refresh();
60} 62}
61 63
62void POP3viewItem::refresh() 64void POP3viewItem::refresh()
63{ 65{
64 if (account->getOffline()) return; 66 if (account->getOffline()) return;
65 QValueList<FolderP> *folders = wrapper->listFolders(); 67 Q3ValueList<FolderP> *folders = wrapper->listFolders();
66 QListViewItem *child = firstChild(); 68 Q3ListViewItem *child = firstChild();
67 while ( child ) 69 while ( child )
68 { 70 {
69 QListViewItem *tmp = child; 71 Q3ListViewItem *tmp = child;
70 child = child->nextSibling(); 72 child = child->nextSibling();
71 delete tmp; 73 delete tmp;
72 } 74 }
73 QValueList<FolderP>::ConstIterator it; 75 Q3ValueList<FolderP>::ConstIterator it;
74 QListViewItem*item = 0; 76 Q3ListViewItem*item = 0;
75 for ( it = folders->begin(); it!=folders->end(); ++it) 77 for ( it = folders->begin(); it!=folders->end(); ++it)
76 { 78 {
77 item = new POP3folderItem( (*it), this , item ); 79 item = new POP3folderItem( (*it), this , item );
78 item->setSelectable( (*it)->may_select()); 80 item->setSelectable( (*it)->may_select());
79 } 81 }
80 delete folders; 82 delete folders;
81} 83}
82 84
83RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) 85RECBODYP POP3viewItem::fetchBody( const RecMailP &mail )
84{ 86{
85 87
86 return wrapper->fetchBody( mail ); 88 return wrapper->fetchBody( mail );
87} 89}
88 90
89QPopupMenu * POP3viewItem::getContextMenu() 91Q3PopupMenu * POP3viewItem::getContextMenu()
90{ 92{
91 QPopupMenu *m = new QPopupMenu(0); 93 Q3PopupMenu *m = new Q3PopupMenu(0);
92 if (m) 94 if (m)
93 { 95 {
94 if (!account->getOffline()) 96 if (!account->getOffline())
95 { 97 {
96 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); 98 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
97 m->insertItem(i18n("Disconnect"),0); 99 m->insertItem(i18n("Disconnect"),0);
98 m->insertItem(i18n("Set offline"),1); 100 m->insertItem(i18n("Set offline"),1);
99 } 101 }
@@ -103,20 +105,20 @@ QPopupMenu * POP3viewItem::getContextMenu()
103 m->insertItem(i18n("Set online"),1); 105 m->insertItem(i18n("Set online"),1);
104 } 106 }
105 } 107 }
106 return m; 108 return m;
107} 109}
108 110
109void POP3viewItem::disconnect() 111void POP3viewItem::disconnect()
110{ 112{
111 QListViewItem *child = firstChild(); 113 Q3ListViewItem *child = firstChild();
112 while ( child ) 114 while ( child )
113 { 115 {
114 QListViewItem *tmp = child; 116 Q3ListViewItem *tmp = child;
115 child = child->nextSibling(); 117 child = child->nextSibling();
116 delete tmp; 118 delete tmp;
117 } 119 }
118 wrapper->logout(); 120 wrapper->logout();
119} 121}
120 122
121void POP3viewItem::setOnOffline() 123void POP3viewItem::setOnOffline()
122{ 124{
@@ -152,45 +154,45 @@ void POP3viewItem::contextMenuSelected(int which)
152 setOnOffline(); 154 setOnOffline();
153 break; 155 break;
154 } 156 }
155} 157}
156 158
157POP3folderItem::~POP3folderItem() 159POP3folderItem::~POP3folderItem()
158{} 160{}
159 161
160POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , QListViewItem*after ) 162POP3folderItem::POP3folderItem( const FolderP&folderInit, POP3viewItem *parent , Q3ListViewItem*after )
161 : AccountViewItem(folderInit,parent,after ) 163 : AccountViewItem(folderInit,parent,after )
162{ 164{
163 pop3 = parent; 165 pop3 = parent;
164 if (folder->getDisplayName().lower()!="inbox") 166 if (folder->getDisplayName().lower()!="inbox")
165 { 167 {
166 setPixmap( 0, PIXMAP_POP3FOLDER ); 168 setPixmap( 0, PIXMAP_POP3FOLDER );
167 } 169 }
168 else 170 else
169 { 171 {
170 setPixmap( 0, PIXMAP_INBOXFOLDER); 172 setPixmap( 0, PIXMAP_INBOXFOLDER);
171 } 173 }
172 setText( 0, folder->getDisplayName() ); 174 setText( 0, folder->getDisplayName() );
173} 175}
174 176
175void POP3folderItem::refresh(QValueList<RecMailP>&target) 177void POP3folderItem::refresh(Q3ValueList<RecMailP>&target)
176{ 178{
177 if (folder->may_select()) 179 if (folder->may_select())
178 pop3->getWrapper()->listMessages( folder->getName(),target ); 180 pop3->getWrapper()->listMessages( folder->getName(),target );
179} 181}
180 182
181RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail) 183RECBODYP POP3folderItem::fetchBody(const RecMailP&aMail)
182{ 184{
183 return pop3->getWrapper()->fetchBody(aMail); 185 return pop3->getWrapper()->fetchBody(aMail);
184} 186}
185 187
186QPopupMenu * POP3folderItem::getContextMenu() 188Q3PopupMenu * POP3folderItem::getContextMenu()
187{ 189{
188 QPopupMenu *m = new QPopupMenu(0); 190 Q3PopupMenu *m = new Q3PopupMenu(0);
189 if (m) 191 if (m)
190 { 192 {
191 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); 193 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
192 m->insertItem(i18n("Refresh header list"),0); 194 m->insertItem(i18n("Refresh header list"),0);
193 m->insertItem(i18n("Delete all mails"),1); 195 m->insertItem(i18n("Delete all mails"),1);
194 m->insertItem(i18n("Move/Copie all mails"),2); 196 m->insertItem(i18n("Move/Copie all mails"),2);
195 } 197 }
196 return m; 198 return m;
@@ -256,52 +258,52 @@ NNTPviewItem::~NNTPviewItem()
256 delete wrapper; 258 delete wrapper;
257} 259}
258 260
259AbstractMail *NNTPviewItem::getWrapper() 261AbstractMail *NNTPviewItem::getWrapper()
260{ 262{
261 return wrapper; 263 return wrapper;
262} 264}
263 265
264void NNTPviewItem::refresh( QValueList<RecMailP> & ) 266void NNTPviewItem::refresh( Q3ValueList<RecMailP> & )
265{ 267{
266 refresh(); 268 refresh();
267} 269}
268 270
269void NNTPviewItem::refresh() 271void NNTPviewItem::refresh()
270{ 272{
271 if (account->getOffline()) return; 273 if (account->getOffline()) return;
272 QValueList<FolderP> *folders = wrapper->listFolders(); 274 Q3ValueList<FolderP> *folders = wrapper->listFolders();
273 275
274 QListViewItem *child = firstChild(); 276 Q3ListViewItem *child = firstChild();
275 while ( child ) 277 while ( child )
276 { 278 {
277 QListViewItem *tmp = child; 279 Q3ListViewItem *tmp = child;
278 child = child->nextSibling(); 280 child = child->nextSibling();
279 delete tmp; 281 delete tmp;
280 } 282 }
281 QValueList<FolderP>::ConstIterator it; 283 Q3ValueList<FolderP>::ConstIterator it;
282 QListViewItem*item = 0; 284 Q3ListViewItem*item = 0;
283 for ( it = folders->begin(); it!=folders->end(); ++it) 285 for ( it = folders->begin(); it!=folders->end(); ++it)
284 { 286 {
285 item = new NNTPfolderItem( (*it), this , item ); 287 item = new NNTPfolderItem( (*it), this , item );
286 item->setSelectable( (*it)->may_select()); 288 item->setSelectable( (*it)->may_select());
287 } 289 }
288 delete folders; 290 delete folders;
289} 291}
290 292
291RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) 293RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
292{ 294{
293 295
294 return wrapper->fetchBody( mail ); 296 return wrapper->fetchBody( mail );
295} 297}
296 298
297QPopupMenu * NNTPviewItem::getContextMenu() 299Q3PopupMenu * NNTPviewItem::getContextMenu()
298{ 300{
299 QPopupMenu *m = new QPopupMenu(0); 301 Q3PopupMenu *m = new Q3PopupMenu(0);
300 if (m) 302 if (m)
301 { 303 {
302 if (!account->getOffline()) 304 if (!account->getOffline())
303 { 305 {
304 m->insertItem(i18n("Disconnect"),0); 306 m->insertItem(i18n("Disconnect"),0);
305 m->insertItem(i18n("Set offline"),1); 307 m->insertItem(i18n("Set offline"),1);
306 //m->insertItem(i18n("(Un-)Subscribe groups"),2); 308 //m->insertItem(i18n("(Un-)Subscribe groups"),2);
307 } 309 }
@@ -321,20 +323,20 @@ void NNTPviewItem::subscribeGroups()
321#endif 323#endif
322 if ( dlg.exec()== QDialog::Accepted ){ 324 if ( dlg.exec()== QDialog::Accepted ){
323 refresh(); 325 refresh();
324 } 326 }
325} 327}
326 328
327void NNTPviewItem::disconnect() 329void NNTPviewItem::disconnect()
328{ 330{
329 QListViewItem *child = firstChild(); 331 Q3ListViewItem *child = firstChild();
330 while ( child ) 332 while ( child )
331 { 333 {
332 QListViewItem *tmp = child; 334 Q3ListViewItem *tmp = child;
333 child = child->nextSibling(); 335 child = child->nextSibling();
334 delete tmp; 336 delete tmp;
335 } 337 }
336 wrapper->logout(); 338 wrapper->logout();
337} 339}
338 340
339void NNTPviewItem::setOnOffline() 341void NNTPviewItem::setOnOffline()
340{ 342{
@@ -363,45 +365,45 @@ void NNTPviewItem::contextMenuSelected(int which)
363 subscribeGroups(); 365 subscribeGroups();
364 break; 366 break;
365 } 367 }
366} 368}
367 369
368NNTPfolderItem::~NNTPfolderItem() 370NNTPfolderItem::~NNTPfolderItem()
369{} 371{}
370 372
371NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , QListViewItem*after ) 373NNTPfolderItem::NNTPfolderItem( const FolderP &folderInit, NNTPviewItem *parent , Q3ListViewItem*after )
372 : AccountViewItem( folderInit, parent,after ) 374 : AccountViewItem( folderInit, parent,after )
373{ 375{
374 nntp = parent; 376 nntp = parent;
375 if (folder->getDisplayName().lower()!="inbox") 377 if (folder->getDisplayName().lower()!="inbox")
376 { 378 {
377 setPixmap( 0, PIXMAP_POP3FOLDER ); 379 setPixmap( 0, PIXMAP_POP3FOLDER );
378 } 380 }
379 else 381 else
380 { 382 {
381 setPixmap( 0, PIXMAP_INBOXFOLDER); 383 setPixmap( 0, PIXMAP_INBOXFOLDER);
382 } 384 }
383 setText( 0, folder->getDisplayName() ); 385 setText( 0, folder->getDisplayName() );
384} 386}
385 387
386void NNTPfolderItem::refresh(QValueList<RecMailP>&target) 388void NNTPfolderItem::refresh(Q3ValueList<RecMailP>&target)
387{ 389{
388 if (folder->may_select()) 390 if (folder->may_select())
389 nntp->getWrapper()->listMessages( folder->getName(),target ); 391 nntp->getWrapper()->listMessages( folder->getName(),target );
390} 392}
391 393
392RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail) 394RECBODYP NNTPfolderItem::fetchBody(const RecMailP&aMail)
393{ 395{
394 return nntp->getWrapper()->fetchBody(aMail); 396 return nntp->getWrapper()->fetchBody(aMail);
395} 397}
396 398
397QPopupMenu * NNTPfolderItem::getContextMenu() 399Q3PopupMenu * NNTPfolderItem::getContextMenu()
398{ 400{
399 QPopupMenu *m = new QPopupMenu(0); 401 Q3PopupMenu *m = new Q3PopupMenu(0);
400 if (m) 402 if (m)
401 { 403 {
402 m->insertItem(i18n("Refresh header list"),0); 404 m->insertItem(i18n("Refresh header list"),0);
403 m->insertItem(i18n("Copy all postings"),1); 405 m->insertItem(i18n("Copy all postings"),1);
404 } 406 }
405 return m; 407 return m;
406} 408}
407 409
@@ -448,38 +450,38 @@ IMAPviewItem::~IMAPviewItem()
448 delete wrapper; 450 delete wrapper;
449} 451}
450 452
451AbstractMail *IMAPviewItem::getWrapper() 453AbstractMail *IMAPviewItem::getWrapper()
452{ 454{
453 return wrapper; 455 return wrapper;
454} 456}
455 457
456void IMAPviewItem::refresh(QValueList<RecMailP>&) 458void IMAPviewItem::refresh(Q3ValueList<RecMailP>&)
457{ 459{
458 refreshFolders(false); 460 refreshFolders(false);
459} 461}
460 462
461const QStringList&IMAPviewItem::subFolders() 463const QStringList&IMAPviewItem::subFolders()
462{ 464{
463 return currentFolders; 465 return currentFolders;
464} 466}
465 467
466void IMAPviewItem::refreshFolders(bool force) 468void IMAPviewItem::refreshFolders(bool force)
467{ 469{
468 if (childCount()>0 && force==false) return; 470 if (childCount()>0 && force==false) return;
469 if (account->getOffline()) return; 471 if (account->getOffline()) return;
470 472
471 removeChilds(); 473 removeChilds();
472 currentFolders.clear(); 474 currentFolders.clear();
473 QValueList<FolderP> * folders = wrapper->listFolders(); 475 Q3ValueList<FolderP> * folders = wrapper->listFolders();
474 476
475 QValueList<FolderP>::Iterator it; 477 Q3ValueList<FolderP>::Iterator it;
476 QListViewItem*item = 0; 478 Q3ListViewItem*item = 0;
477 QListViewItem*titem = 0; 479 Q3ListViewItem*titem = 0;
478 QString fname,del,search; 480 QString fname,del,search;
479 int pos; 481 int pos;
480 482
481 for ( it = folders->begin(); it!=folders->end(); ++it) 483 for ( it = folders->begin(); it!=folders->end(); ++it)
482 { 484 {
483 if ((*it)->getDisplayName().lower()=="inbox") 485 if ((*it)->getDisplayName().lower()=="inbox")
484 { 486 {
485 item = new IMAPfolderItem( (*it), this , item ); 487 item = new IMAPfolderItem( (*it), this , item );
@@ -508,19 +510,19 @@ void IMAPviewItem::refreshFolders(bool force)
508 else 510 else
509 { 511 {
510 item = new IMAPfolderItem( (*it), this , item ); 512 item = new IMAPfolderItem( (*it), this , item );
511 } 513 }
512 } 514 }
513 delete folders; 515 delete folders;
514} 516}
515 517
516QPopupMenu * IMAPviewItem::getContextMenu() 518Q3PopupMenu * IMAPviewItem::getContextMenu()
517{ 519{
518 QPopupMenu *m = new QPopupMenu(0); 520 Q3PopupMenu *m = new Q3PopupMenu(0);
519 if (m) 521 if (m)
520 { 522 {
521 if (!account->getOffline()) 523 if (!account->getOffline())
522 { 524 {
523 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); 525 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
524 m->insertItem(i18n("Refresh folder list"),0); 526 m->insertItem(i18n("Refresh folder list"),0);
525 m->insertItem(i18n("Create new folder"),1); 527 m->insertItem(i18n("Create new folder"),1);
526 m->insertSeparator(); 528 m->insertSeparator();
@@ -610,32 +612,32 @@ RECBODYP IMAPviewItem::fetchBody(const RecMailP&)
610 return new RecBody(); 612 return new RecBody();
611} 613}
612 614
613bool IMAPviewItem::offline() 615bool IMAPviewItem::offline()
614{ 616{
615 return account->getOffline(); 617 return account->getOffline();
616} 618}
617 619
618IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , QListViewItem*after ) 620IMAPfolderItem::IMAPfolderItem( const FolderP& folderInit, IMAPviewItem *parent , Q3ListViewItem*after )
619 : AccountViewItem( folderInit, parent , after ) 621 : AccountViewItem( folderInit, parent , after )
620{ 622{
621 imap = parent; 623 imap = parent;
622 if (folder->getDisplayName().lower()!="inbox") 624 if (folder->getDisplayName().lower()!="inbox")
623 { 625 {
624 setPixmap( 0, PIXMAP_IMAPFOLDER ); 626 setPixmap( 0, PIXMAP_IMAPFOLDER );
625 } 627 }
626 else 628 else
627 { 629 {
628 setPixmap( 0, PIXMAP_INBOXFOLDER); 630 setPixmap( 0, PIXMAP_INBOXFOLDER);
629 } 631 }
630 setText( 0, folder->getDisplayName() ); 632 setText( 0, folder->getDisplayName() );
631} 633}
632 634
633IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) 635IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent , Q3ListViewItem*after, IMAPviewItem *master )
634 : AccountViewItem(folderInit, parent,after ) 636 : AccountViewItem(folderInit, parent,after )
635{ 637{
636 imap = master; 638 imap = master;
637 if (folder->getDisplayName().lower()!="inbox") 639 if (folder->getDisplayName().lower()!="inbox")
638 { 640 {
639 setPixmap( 0, PIXMAP_IMAPFOLDER ); 641 setPixmap( 0, PIXMAP_IMAPFOLDER );
640 } 642 }
641 else 643 else
@@ -648,36 +650,36 @@ IMAPfolderItem::IMAPfolderItem(const FolderP &folderInit, IMAPfolderItem *parent
648IMAPfolderItem::~IMAPfolderItem() 650IMAPfolderItem::~IMAPfolderItem()
649{} 651{}
650 652
651const QString& IMAPfolderItem::Delemiter()const 653const QString& IMAPfolderItem::Delemiter()const
652{ 654{
653 return folder->Separator(); 655 return folder->Separator();
654} 656}
655 657
656void IMAPfolderItem::refresh(QValueList<RecMailP>&target) 658void IMAPfolderItem::refresh(Q3ValueList<RecMailP>&target)
657{ 659{
658 if (folder->may_select()) 660 if (folder->may_select())
659 { 661 {
660 imap->getWrapper()->listMessages( folder->getName(),target ); 662 imap->getWrapper()->listMessages( folder->getName(),target );
661 } 663 }
662 else 664 else
663 { 665 {
664 target.clear(); 666 target.clear();
665 } 667 }
666} 668}
667 669
668RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) 670RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
669{ 671{
670 return imap->getWrapper()->fetchBody(aMail); 672 return imap->getWrapper()->fetchBody(aMail);
671} 673}
672 674
673QPopupMenu * IMAPfolderItem::getContextMenu() 675Q3PopupMenu * IMAPfolderItem::getContextMenu()
674{ 676{
675 QPopupMenu *m = new QPopupMenu(0); 677 Q3PopupMenu *m = new Q3PopupMenu(0);
676 if (m) 678 if (m)
677 { 679 {
678 if (folder->may_select()) 680 if (folder->may_select())
679 { 681 {
680 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); 682 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
681 m->insertItem(i18n("Refresh header list"),0); 683 m->insertItem(i18n("Refresh header list"),0);
682 m->insertItem(i18n("Move/Copie all mails"),4); 684 m->insertItem(i18n("Move/Copie all mails"),4);
683 m->insertItem(i18n("Delete all mails"),1); 685 m->insertItem(i18n("Delete all mails"),1);
@@ -716,17 +718,17 @@ void IMAPfolderItem::deleteFolder()
716 i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), 718 i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()),
717 i18n("Yes"), 719 i18n("Yes"),
718 i18n("No"),QString::null,1,1); 720 i18n("No"),QString::null,1,1);
719 721
720 if (yesno == 0) 722 if (yesno == 0)
721 { 723 {
722 if (imap->getWrapper()->deleteMbox(folder)) 724 if (imap->getWrapper()->deleteMbox(folder))
723 { 725 {
724 QListView*v=listView(); 726 Q3ListView*v=listView();
725 IMAPviewItem * box = imap; 727 IMAPviewItem * box = imap;
726 /* be carefull - after that this object is destroyd so don't use 728 /* be carefull - after that this object is destroyd so don't use
727 * any member of it after that call!!*/ 729 * any member of it after that call!!*/
728 imap->refreshFolders(true); 730 imap->refreshFolders(true);
729 if (v) 731 if (v)
730 { 732 {
731 v->setSelected(box,true); 733 v->setSelected(box,true);
732 } 734 }
@@ -795,29 +797,29 @@ MHviewItem::~MHviewItem()
795 delete wrapper; 797 delete wrapper;
796} 798}
797 799
798AbstractMail *MHviewItem::getWrapper() 800AbstractMail *MHviewItem::getWrapper()
799{ 801{
800 return wrapper; 802 return wrapper;
801} 803}
802 804
803void MHviewItem::refresh( QValueList<RecMailP> & target) 805void MHviewItem::refresh( Q3ValueList<RecMailP> & target)
804{ 806{
805 refresh(false); 807 refresh(false);
806 getWrapper()->listMessages( "",target ); 808 getWrapper()->listMessages( "",target );
807} 809}
808 810
809void MHviewItem::refresh(bool force) 811void MHviewItem::refresh(bool force)
810{ 812{
811 if (childCount()>0 && force==false) return; 813 if (childCount()>0 && force==false) return;
812 removeChilds(); 814 removeChilds();
813 currentFolders.clear(); 815 currentFolders.clear();
814 QValueList<FolderP> *folders = wrapper->listFolders(); 816 Q3ValueList<FolderP> *folders = wrapper->listFolders();
815 QValueList<FolderP>::ConstIterator it; 817 Q3ValueList<FolderP>::ConstIterator it;
816 MHfolderItem*item = 0; 818 MHfolderItem*item = 0;
817 MHfolderItem*pmaster = 0; 819 MHfolderItem*pmaster = 0;
818 QString fname = ""; 820 QString fname = "";
819 int pos; 821 int pos;
820 for ( it = folders->begin(); it!=folders->end(); ++it) 822 for ( it = folders->begin(); it!=folders->end(); ++it)
821 { 823 {
822 fname = (*it)->getDisplayName(); 824 fname = (*it)->getDisplayName();
823 /* this folder itself */ 825 /* this folder itself */
@@ -852,19 +854,19 @@ void MHviewItem::refresh(bool force)
852} 854}
853 855
854RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 856RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
855{ 857{
856 858
857 return wrapper->fetchBody( mail ); 859 return wrapper->fetchBody( mail );
858} 860}
859 861
860QPopupMenu * MHviewItem::getContextMenu() 862Q3PopupMenu * MHviewItem::getContextMenu()
861{ 863{
862 QPopupMenu *m = new QPopupMenu(0); 864 Q3PopupMenu *m = new Q3PopupMenu(0);
863 if (m) 865 if (m)
864 { 866 {
865 m->insertItem(i18n("Refresh folder list"),0); 867 m->insertItem(i18n("Refresh folder list"),0);
866 m->insertItem(i18n("Create new folder"),1); 868 m->insertItem(i18n("Create new folder"),1);
867 m->insertItem(i18n("Delete all mails"),2); 869 m->insertItem(i18n("Delete all mails"),2);
868 m->insertItem(i18n("Move/Copie all mails"),3); 870 m->insertItem(i18n("Move/Copie all mails"),3);
869 } 871 }
870 return m; 872 return m;
@@ -915,24 +917,24 @@ void MHviewItem::contextMenuSelected(int which)
915 default: 917 default:
916 break; 918 break;
917 } 919 }
918} 920}
919 921
920MHfolderItem::~MHfolderItem() 922MHfolderItem::~MHfolderItem()
921{} 923{}
922 924
923MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) 925MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , Q3ListViewItem*after )
924 : AccountViewItem(folderInit, parent,after ) 926 : AccountViewItem(folderInit, parent,after )
925{ 927{
926 mbox = parent; 928 mbox = parent;
927 initName(); 929 initName();
928} 930}
929 931
930MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) 932MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, Q3ListViewItem*after, MHviewItem*master)
931 : AccountViewItem(folderInit, parent,after ) 933 : AccountViewItem(folderInit, parent,after )
932{ 934{
933 folder = folderInit; 935 folder = folderInit;
934 mbox = master; 936 mbox = master;
935 initName(); 937 initName();
936} 938}
937 939
938void MHfolderItem::initName() 940void MHfolderItem::initName()
@@ -962,17 +964,17 @@ void MHfolderItem::initName()
962 setText( 0, bName ); 964 setText( 0, bName );
963} 965}
964 966
965const FolderP&MHfolderItem::getFolder()const 967const FolderP&MHfolderItem::getFolder()const
966{ 968{
967 return folder; 969 return folder;
968} 970}
969 971
970void MHfolderItem::refresh(QValueList<RecMailP>&target) 972void MHfolderItem::refresh(Q3ValueList<RecMailP>&target)
971{ 973{
972 if (folder->may_select()) 974 if (folder->may_select())
973 mbox->getWrapper()->listMessages( folder->getName(),target ); 975 mbox->getWrapper()->listMessages( folder->getName(),target );
974} 976}
975 977
976RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) 978RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
977{ 979{
978 return mbox->getWrapper()->fetchBody(aMail); 980 return mbox->getWrapper()->fetchBody(aMail);
@@ -984,32 +986,32 @@ void MHfolderItem::deleteFolder()
984 i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), 986 i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()),
985 i18n("Yes"), 987 i18n("Yes"),
986 i18n("No"),QString::null,1,1); 988 i18n("No"),QString::null,1,1);
987 989
988 if (yesno == 0) 990 if (yesno == 0)
989 { 991 {
990 if (mbox->getWrapper()->deleteMbox(folder)) 992 if (mbox->getWrapper()->deleteMbox(folder))
991 { 993 {
992 QListView*v=listView(); 994 Q3ListView*v=listView();
993 MHviewItem * box = mbox; 995 MHviewItem * box = mbox;
994 /* be carefull - after that this object is destroyd so don't use 996 /* be carefull - after that this object is destroyd so don't use
995 * any member of it after that call!!*/ 997 * any member of it after that call!!*/
996 mbox->refresh(true); 998 mbox->refresh(true);
997 if (v) 999 if (v)
998 { 1000 {
999 v->setSelected(box,true); 1001 v->setSelected(box,true);
1000 } 1002 }
1001 } 1003 }
1002 } 1004 }
1003} 1005}
1004 1006
1005QPopupMenu * MHfolderItem::getContextMenu() 1007Q3PopupMenu * MHfolderItem::getContextMenu()
1006{ 1008{
1007 QPopupMenu *m = new QPopupMenu(0); 1009 Q3PopupMenu *m = new Q3PopupMenu(0);
1008 if (m) 1010 if (m)
1009 { 1011 {
1010 m->insertItem(i18n("Move/Copie all mails"),2); 1012 m->insertItem(i18n("Move/Copie all mails"),2);
1011 m->insertItem(i18n("Delete all mails"),0); 1013 m->insertItem(i18n("Delete all mails"),0);
1012 m->insertItem(i18n("Create new subfolder"),3); 1014 m->insertItem(i18n("Create new subfolder"),3);
1013 m->insertItem(i18n("Delete folder"),1); 1015 m->insertItem(i18n("Delete folder"),1);
1014 } 1016 }
1015 return m; 1017 return m;
@@ -1026,17 +1028,17 @@ void MHfolderItem::createFolder()
1026{ 1028{
1027 Newmdirdlg ndirdlg(0,0,true); 1029 Newmdirdlg ndirdlg(0,0,true);
1028 //ndirdlg.showMaximized(); 1030 //ndirdlg.showMaximized();
1029 if (ndirdlg.exec() ) 1031 if (ndirdlg.exec() )
1030 { 1032 {
1031 QString ndir = ndirdlg.Newdir(); 1033 QString ndir = ndirdlg.Newdir();
1032 if (mbox->getWrapper()->createMbox(ndir,folder)) 1034 if (mbox->getWrapper()->createMbox(ndir,folder))
1033 { 1035 {
1034 QListView*v=listView(); 1036 Q3ListView*v=listView();
1035 MHviewItem * box = mbox; 1037 MHviewItem * box = mbox;
1036 /* be carefull - after that this object is destroyd so don't use 1038 /* be carefull - after that this object is destroyd so don't use
1037 * any member of it after that call!!*/ 1039 * any member of it after that call!!*/
1038 mbox->refresh(true); 1040 mbox->refresh(true);
1039 if (v) 1041 if (v)
1040 { 1042 {
1041 v->setSelected(box,true); 1043 v->setSelected(box,true);
1042 } 1044 }
@@ -1073,36 +1075,36 @@ bool MHfolderItem::isDraftfolder()
1073 1075
1074/** 1076/**
1075 * Generic stuff 1077 * Generic stuff
1076 */ 1078 */
1077 1079
1078const QString AccountViewItem::contextName="AccountViewItem"; 1080const QString AccountViewItem::contextName="AccountViewItem";
1079 1081
1080AccountViewItem::AccountViewItem( AccountView *parent ) 1082AccountViewItem::AccountViewItem( AccountView *parent )
1081 : QListViewItem( parent ) 1083 : Q3ListViewItem( parent )
1082{ 1084{
1083 init(); 1085 init();
1084 m_Backlink = parent; 1086 m_Backlink = parent;
1085} 1087}
1086 1088
1087AccountViewItem::AccountViewItem( QListViewItem *parent) 1089AccountViewItem::AccountViewItem( Q3ListViewItem *parent)
1088 : QListViewItem( parent),folder(0) 1090 : Q3ListViewItem( parent),folder(0)
1089{ 1091{
1090 init(); 1092 init();
1091} 1093}
1092 1094
1093AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) 1095AccountViewItem::AccountViewItem( Q3ListViewItem *parent , Q3ListViewItem*after )
1094 :QListViewItem( parent,after ),folder(0) 1096 :Q3ListViewItem( parent,after ),folder(0)
1095{ 1097{
1096 init(); 1098 init();
1097} 1099}
1098 1100
1099AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) 1101AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,Q3ListViewItem *parent , Q3ListViewItem*after )
1100 :QListViewItem( parent,after ),folder(folderInit) 1102 :Q3ListViewItem( parent,after ),folder(folderInit)
1101{ 1103{
1102 init(); 1104 init();
1103} 1105}
1104 1106
1105void AccountViewItem::init() 1107void AccountViewItem::init()
1106{ 1108{
1107 m_Backlink = 0; 1109 m_Backlink = 0;
1108} 1110}
@@ -1135,20 +1137,20 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
1135 AccountView * view = (AccountView*)listView(); 1137 AccountView * view = (AccountView*)listView();
1136 if (view) view->refreshCurrent(); 1138 if (view) view->refreshCurrent();
1137 } 1139 }
1138 } 1140 }
1139} 1141}
1140 1142
1141void AccountViewItem::removeChilds() 1143void AccountViewItem::removeChilds()
1142{ 1144{
1143 QListViewItem *child = firstChild(); 1145 Q3ListViewItem *child = firstChild();
1144 while ( child ) 1146 while ( child )
1145 { 1147 {
1146 QListViewItem *tmp = child; 1148 Q3ListViewItem *tmp = child;
1147 child = child->nextSibling(); 1149 child = child->nextSibling();
1148 delete tmp; 1150 delete tmp;
1149 } 1151 }
1150} 1152}
1151 1153
1152bool AccountViewItem::matchName(const QString&name)const 1154bool AccountViewItem::matchName(const QString&name)const
1153{ 1155{
1154 if (!folder) return false; 1156 if (!folder) return false;