summaryrefslogtreecommitdiffabout
path: root/kmicromail/accountitem.cpp
Unidiff
Diffstat (limited to 'kmicromail/accountitem.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kmicromail/accountitem.cpp12
1 files changed, 8 insertions, 4 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp
index 567de87..fcb2052 100644
--- a/kmicromail/accountitem.cpp
+++ b/kmicromail/accountitem.cpp
@@ -287,65 +287,67 @@ void NNTPviewItem::refresh()
287 } 287 }
288 delete folders; 288 delete folders;
289} 289}
290 290
291RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) 291RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail )
292{ 292{
293 293
294 return wrapper->fetchBody( mail ); 294 return wrapper->fetchBody( mail );
295} 295}
296 296
297QPopupMenu * NNTPviewItem::getContextMenu() 297QPopupMenu * NNTPviewItem::getContextMenu()
298{ 298{
299 QPopupMenu *m = new QPopupMenu(0); 299 QPopupMenu *m = new QPopupMenu(0);
300 if (m) 300 if (m)
301 { 301 {
302 if (!account->getOffline()) 302 if (!account->getOffline())
303 { 303 {
304 m->insertItem(i18n("Disconnect"),0); 304 m->insertItem(i18n("Disconnect"),0);
305 m->insertItem(i18n("Set offline"),1); 305 m->insertItem(i18n("Set offline"),1);
306 //m->insertItem(i18n("(Un-)Subscribe groups"),2); 306 //m->insertItem(i18n("(Un-)Subscribe groups"),2);
307 } 307 }
308 else 308 else
309 { 309 {
310 m->insertItem(i18n("Set online"),1); 310 m->insertItem(i18n("Set online"),1);
311 } 311 }
312 } 312 }
313 return m; 313 return m;
314} 314}
315 315
316void NNTPviewItem::subscribeGroups() 316void NNTPviewItem::subscribeGroups()
317{ 317{
318 NNTPGroupsDlg dlg(account); 318 NNTPGroupsDlg dlg(account);
319#ifndef DESKTOP_VERSION
319 dlg.showMaximized(); 320 dlg.showMaximized();
321#endif
320 if ( dlg.exec()== QDialog::Accepted ){ 322 if ( dlg.exec()== QDialog::Accepted ){
321 refresh(); 323 refresh();
322 } 324 }
323} 325}
324 326
325void NNTPviewItem::disconnect() 327void NNTPviewItem::disconnect()
326{ 328{
327 QListViewItem *child = firstChild(); 329 QListViewItem *child = firstChild();
328 while ( child ) 330 while ( child )
329 { 331 {
330 QListViewItem *tmp = child; 332 QListViewItem *tmp = child;
331 child = child->nextSibling(); 333 child = child->nextSibling();
332 delete tmp; 334 delete tmp;
333 } 335 }
334 wrapper->logout(); 336 wrapper->logout();
335} 337}
336 338
337void NNTPviewItem::setOnOffline() 339void NNTPviewItem::setOnOffline()
338{ 340{
339 if (!account->getOffline()) 341 if (!account->getOffline())
340 { 342 {
341 disconnect(); 343 disconnect();
342 } 344 }
343 account->setOffline(!account->getOffline()); 345 account->setOffline(!account->getOffline());
344 account->save(); 346 account->save();
345 //FIXME 347 //FIXME
346 SETPIX(PIXMAP_POP3FOLDER); 348 SETPIX(PIXMAP_POP3FOLDER);
347 refresh(); 349 refresh();
348} 350}
349 351
350void NNTPviewItem::contextMenuSelected(int which) 352void NNTPviewItem::contextMenuSelected(int which)
351{ 353{
@@ -510,65 +512,67 @@ void IMAPviewItem::refreshFolders(bool force)
510 } 512 }
511 delete folders; 513 delete folders;
512} 514}
513 515
514QPopupMenu * IMAPviewItem::getContextMenu() 516QPopupMenu * IMAPviewItem::getContextMenu()
515{ 517{
516 QPopupMenu *m = new QPopupMenu(0); 518 QPopupMenu *m = new QPopupMenu(0);
517 if (m) 519 if (m)
518 { 520 {
519 if (!account->getOffline()) 521 if (!account->getOffline())
520 { 522 {
521 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); 523 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
522 m->insertItem(i18n("Refresh folder list"),0); 524 m->insertItem(i18n("Refresh folder list"),0);
523 m->insertItem(i18n("Create new folder"),1); 525 m->insertItem(i18n("Create new folder"),1);
524 m->insertSeparator(); 526 m->insertSeparator();
525 m->insertItem(i18n("Disconnect"),2); 527 m->insertItem(i18n("Disconnect"),2);
526 m->insertItem(i18n("Set offline"),3); 528 m->insertItem(i18n("Set offline"),3);
527 m->insertSeparator(); 529 m->insertSeparator();
528 } 530 }
529 else 531 else
530 { 532 {
531 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); 533 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
532 m->insertItem(i18n("Set online"),3); 534 m->insertItem(i18n("Set online"),3);
533 } 535 }
534 } 536 }
535 return m; 537 return m;
536} 538}
537 539
538void IMAPviewItem::createNewFolder() 540void IMAPviewItem::createNewFolder()
539{ 541{
540 Newmdirdlg ndirdlg; 542 Newmdirdlg ndirdlg;
541 543
542 ndirdlg.showMaximized(); 544#ifndef DESKTOP_VERSION
545 //ndirdlg.showMaximized();
546#endif
543 if ( ndirdlg.exec() ) 547 if ( ndirdlg.exec() )
544 { 548 {
545 QString ndir = ndirdlg.Newdir(); 549 QString ndir = ndirdlg.Newdir();
546 bool makesubs = ndirdlg.subpossible(); 550 bool makesubs = ndirdlg.subpossible();
547 QString delemiter = "/"; 551 QString delemiter = "/";
548 IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); 552 IMAPfolderItem*item = (IMAPfolderItem*)firstChild();
549 if (item) 553 if (item)
550 { 554 {
551 delemiter = item->Delemiter(); 555 delemiter = item->Delemiter();
552 } 556 }
553 if (wrapper->createMbox(ndir,0,delemiter,makesubs)) 557 if (wrapper->createMbox(ndir,0,delemiter,makesubs))
554 { 558 {
555 refreshFolders(true); 559 refreshFolders(true);
556 } 560 }
557 } 561 }
558} 562}
559 563
560void IMAPviewItem::contextMenuSelected(int id) 564void IMAPviewItem::contextMenuSelected(int id)
561{ 565{
562 566
563 switch (id) 567 switch (id)
564 { 568 {
565 case 0: 569 case 0:
566 refreshFolders(true); 570 refreshFolders(true);
567 break; 571 break;
568 case 1: 572 case 1:
569 createNewFolder(); 573 createNewFolder();
570 break; 574 break;
571 case 2: 575 case 2:
572 removeChilds(); 576 removeChilds();
573 wrapper->logout(); 577 wrapper->logout();
574 break; 578 break;
@@ -664,65 +668,65 @@ void IMAPfolderItem::refresh(QValueList<RecMailP>&target)
664RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) 668RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail)
665{ 669{
666 return imap->getWrapper()->fetchBody(aMail); 670 return imap->getWrapper()->fetchBody(aMail);
667} 671}
668 672
669QPopupMenu * IMAPfolderItem::getContextMenu() 673QPopupMenu * IMAPfolderItem::getContextMenu()
670{ 674{
671 QPopupMenu *m = new QPopupMenu(0); 675 QPopupMenu *m = new QPopupMenu(0);
672 if (m) 676 if (m)
673 { 677 {
674 if (folder->may_select()) 678 if (folder->may_select())
675 { 679 {
676 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); 680 m->insertItem(i18n("Get new messages"),GET_NEW_MAILS);
677 m->insertItem(i18n("Refresh header list"),0); 681 m->insertItem(i18n("Refresh header list"),0);
678 m->insertItem(i18n("Move/Copie all mails"),4); 682 m->insertItem(i18n("Move/Copie all mails"),4);
679 m->insertItem(i18n("Delete all mails"),1); 683 m->insertItem(i18n("Delete all mails"),1);
680 } 684 }
681 if (folder->no_inferior()==false) 685 if (folder->no_inferior()==false)
682 { 686 {
683 m->insertItem(i18n("Create new subfolder"),2); 687 m->insertItem(i18n("Create new subfolder"),2);
684 } 688 }
685 if (folder->getDisplayName().lower()!="inbox") 689 if (folder->getDisplayName().lower()!="inbox")
686 { 690 {
687 m->insertItem(i18n("Delete folder"),3); 691 m->insertItem(i18n("Delete folder"),3);
688 } 692 }
689 } 693 }
690 return m; 694 return m;
691} 695}
692 696
693void IMAPfolderItem::createNewFolder() 697void IMAPfolderItem::createNewFolder()
694{ 698{
695 Newmdirdlg ndirdlg; 699 Newmdirdlg ndirdlg;
696 ndirdlg.showMaximized(); 700 //ndirdlg.showMaximized();
697 if ( ndirdlg.exec() ) 701 if ( ndirdlg.exec() )
698 { 702 {
699 QString ndir = ndirdlg.Newdir(); 703 QString ndir = ndirdlg.Newdir();
700 bool makesubs = ndirdlg.subpossible(); 704 bool makesubs = ndirdlg.subpossible();
701 QString delemiter = Delemiter(); 705 QString delemiter = Delemiter();
702 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) 706 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
703 { 707 {
704 imap->refreshFolders(true); 708 imap->refreshFolders(true);
705 } 709 }
706 } 710 }
707} 711}
708 712
709void IMAPfolderItem::deleteFolder() 713void IMAPfolderItem::deleteFolder()
710{ 714{
711 int yesno = QMessageBox::warning(0,i18n("Delete folder"), 715 int yesno = QMessageBox::warning(0,i18n("Delete folder"),
712 i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), 716 i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()),
713 i18n("Yes"), 717 i18n("Yes"),
714 i18n("No"),QString::null,1,1); 718 i18n("No"),QString::null,1,1);
715 719
716 if (yesno == 0) 720 if (yesno == 0)
717 { 721 {
718 if (imap->getWrapper()->deleteMbox(folder)) 722 if (imap->getWrapper()->deleteMbox(folder))
719 { 723 {
720 QListView*v=listView(); 724 QListView*v=listView();
721 IMAPviewItem * box = imap; 725 IMAPviewItem * box = imap;
722 /* be carefull - after that this object is destroyd so don't use 726 /* be carefull - after that this object is destroyd so don't use
723 * any member of it after that call!!*/ 727 * any member of it after that call!!*/
724 imap->refreshFolders(true); 728 imap->refreshFolders(true);
725 if (v) 729 if (v)
726 { 730 {
727 v->setSelected(box,true); 731 v->setSelected(box,true);
728 } 732 }
@@ -840,65 +844,65 @@ void MHviewItem::refresh(bool force)
840 } 844 }
841 else 845 else
842 { 846 {
843 item = new MHfolderItem( (*it), this , item ); 847 item = new MHfolderItem( (*it), this , item );
844 } 848 }
845 item->setSelectable((*it)->may_select()); 849 item->setSelectable((*it)->may_select());
846 } 850 }
847 delete folders; 851 delete folders;
848} 852}
849 853
850RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 854RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
851{ 855{
852 856
853 return wrapper->fetchBody( mail ); 857 return wrapper->fetchBody( mail );
854} 858}
855 859
856QPopupMenu * MHviewItem::getContextMenu() 860QPopupMenu * MHviewItem::getContextMenu()
857{ 861{
858 QPopupMenu *m = new QPopupMenu(0); 862 QPopupMenu *m = new QPopupMenu(0);
859 if (m) 863 if (m)
860 { 864 {
861 m->insertItem(i18n("Refresh folder list"),0); 865 m->insertItem(i18n("Refresh folder list"),0);
862 m->insertItem(i18n("Create new folder"),1); 866 m->insertItem(i18n("Create new folder"),1);
863 m->insertItem(i18n("Delete all mails"),2); 867 m->insertItem(i18n("Delete all mails"),2);
864 m->insertItem(i18n("Move/Copie all mails"),3); 868 m->insertItem(i18n("Move/Copie all mails"),3);
865 } 869 }
866 return m; 870 return m;
867} 871}
868 872
869void MHviewItem::createFolder() 873void MHviewItem::createFolder()
870{ 874{
871 Newmdirdlg ndirdlg(0,0,true); 875 Newmdirdlg ndirdlg(0,0,true);
872 ndirdlg.showMaximized(); 876 //ndirdlg.showMaximized();
873 if ( ndirdlg.exec() ) 877 if ( ndirdlg.exec() )
874 { 878 {
875 QString ndir = ndirdlg.Newdir(); 879 QString ndir = ndirdlg.Newdir();
876 if (wrapper->createMbox(ndir)) 880 if (wrapper->createMbox(ndir))
877 { 881 {
878 refresh(true); 882 refresh(true);
879 } 883 }
880 } 884 }
881} 885}
882 886
883void MHviewItem::downloadMails() 887void MHviewItem::downloadMails()
884{ 888{
885 AccountView*bl = accountView(); 889 AccountView*bl = accountView();
886 if (!bl) return; 890 if (!bl) return;
887 bl->downloadMails(folder,getWrapper()); 891 bl->downloadMails(folder,getWrapper());
888} 892}
889 893
890QStringList MHviewItem::subFolders() 894QStringList MHviewItem::subFolders()
891{ 895{
892 return currentFolders; 896 return currentFolders;
893} 897}
894 898
895void MHviewItem::contextMenuSelected(int which) 899void MHviewItem::contextMenuSelected(int which)
896{ 900{
897 switch (which) 901 switch (which)
898 { 902 {
899 case 0: 903 case 0:
900 refresh(true); 904 refresh(true);
901 break; 905 break;
902 case 1: 906 case 1:
903 createFolder(); 907 createFolder();
904 break; 908 break;
@@ -992,65 +996,65 @@ void MHfolderItem::deleteFolder()
992 mbox->refresh(true); 996 mbox->refresh(true);
993 if (v) 997 if (v)
994 { 998 {
995 v->setSelected(box,true); 999 v->setSelected(box,true);
996 } 1000 }
997 } 1001 }
998 } 1002 }
999} 1003}
1000 1004
1001QPopupMenu * MHfolderItem::getContextMenu() 1005QPopupMenu * MHfolderItem::getContextMenu()
1002{ 1006{
1003 QPopupMenu *m = new QPopupMenu(0); 1007 QPopupMenu *m = new QPopupMenu(0);
1004 if (m) 1008 if (m)
1005 { 1009 {
1006 m->insertItem(i18n("Move/Copie all mails"),2); 1010 m->insertItem(i18n("Move/Copie all mails"),2);
1007 m->insertItem(i18n("Delete all mails"),0); 1011 m->insertItem(i18n("Delete all mails"),0);
1008 m->insertItem(i18n("Create new subfolder"),3); 1012 m->insertItem(i18n("Create new subfolder"),3);
1009 m->insertItem(i18n("Delete folder"),1); 1013 m->insertItem(i18n("Delete folder"),1);
1010 } 1014 }
1011 return m; 1015 return m;
1012} 1016}
1013 1017
1014void MHfolderItem::downloadMails() 1018void MHfolderItem::downloadMails()
1015{ 1019{
1016 AccountView*bl = mbox->accountView(); 1020 AccountView*bl = mbox->accountView();
1017 if (!bl) return; 1021 if (!bl) return;
1018 bl->downloadMails(folder,mbox->getWrapper()); 1022 bl->downloadMails(folder,mbox->getWrapper());
1019} 1023}
1020 1024
1021void MHfolderItem::createFolder() 1025void MHfolderItem::createFolder()
1022{ 1026{
1023 Newmdirdlg ndirdlg(0,0,true); 1027 Newmdirdlg ndirdlg(0,0,true);
1024 ndirdlg.showMaximized(); 1028 //ndirdlg.showMaximized();
1025 if (ndirdlg.exec() ) 1029 if (ndirdlg.exec() )
1026 { 1030 {
1027 QString ndir = ndirdlg.Newdir(); 1031 QString ndir = ndirdlg.Newdir();
1028 if (mbox->getWrapper()->createMbox(ndir,folder)) 1032 if (mbox->getWrapper()->createMbox(ndir,folder))
1029 { 1033 {
1030 QListView*v=listView(); 1034 QListView*v=listView();
1031 MHviewItem * box = mbox; 1035 MHviewItem * box = mbox;
1032 /* be carefull - after that this object is destroyd so don't use 1036 /* be carefull - after that this object is destroyd so don't use
1033 * any member of it after that call!!*/ 1037 * any member of it after that call!!*/
1034 mbox->refresh(true); 1038 mbox->refresh(true);
1035 if (v) 1039 if (v)
1036 { 1040 {
1037 v->setSelected(box,true); 1041 v->setSelected(box,true);
1038 } 1042 }
1039 } 1043 }
1040 } 1044 }
1041} 1045}
1042 1046
1043void MHfolderItem::contextMenuSelected(int which) 1047void MHfolderItem::contextMenuSelected(int which)
1044{ 1048{
1045 switch(which) 1049 switch(which)
1046 { 1050 {
1047 case 0: 1051 case 0:
1048 deleteAllMail(mbox->getWrapper(),folder); 1052 deleteAllMail(mbox->getWrapper(),folder);
1049 break; 1053 break;
1050 case 1: 1054 case 1:
1051 deleteFolder(); 1055 deleteFolder();
1052 break; 1056 break;
1053 case 2: 1057 case 2:
1054 downloadMails(); 1058 downloadMails();
1055 break; 1059 break;
1056 case 3: 1060 case 3: