summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/net/mail/accountitem.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp
index 4869df8..10db2c6 100644
--- a/noncore/net/mail/accountitem.cpp
+++ b/noncore/net/mail/accountitem.cpp
@@ -662,491 +662,491 @@ void IMAPfolderItem::createNewFolder()
662 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) 662 if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs))
663 { 663 {
664 imap->refreshFolders(true); 664 imap->refreshFolders(true);
665 } 665 }
666 } 666 }
667} 667}
668 668
669void IMAPfolderItem::deleteFolder() 669void IMAPfolderItem::deleteFolder()
670{ 670{
671 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 671 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
672 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 672 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
673 QObject::tr("Yes",contextName), 673 QObject::tr("Yes",contextName),
674 QObject::tr("No",contextName),QString::null,1,1); 674 QObject::tr("No",contextName),QString::null,1,1);
675 odebug << "Auswahl: " << yesno << "" << oendl; 675 odebug << "Auswahl: " << yesno << "" << oendl;
676 if (yesno == 0) 676 if (yesno == 0)
677 { 677 {
678 if (imap->getWrapper()->deleteMbox(folder)) 678 if (imap->getWrapper()->deleteMbox(folder))
679 { 679 {
680 QListView*v=listView(); 680 QListView*v=listView();
681 IMAPviewItem * box = imap; 681 IMAPviewItem * box = imap;
682 /* be carefull - after that this object is destroyd so don't use 682 /* be carefull - after that this object is destroyd so don't use
683 * any member of it after that call!!*/ 683 * any member of it after that call!!*/
684 imap->refreshFolders(true); 684 imap->refreshFolders(true);
685 if (v) 685 if (v)
686 { 686 {
687 v->setSelected(box,true); 687 v->setSelected(box,true);
688 } 688 }
689 } 689 }
690 } 690 }
691} 691}
692 692
693void IMAPfolderItem::downloadMails() 693void IMAPfolderItem::downloadMails()
694{ 694{
695 AccountView*bl = imap->accountView(); 695 AccountView*bl = imap->accountView();
696 if (!bl) return; 696 if (!bl) return;
697 bl->downloadMails(folder,imap->getWrapper()); 697 bl->downloadMails(folder,imap->getWrapper());
698} 698}
699 699
700void IMAPfolderItem::contextMenuSelected(int id) 700void IMAPfolderItem::contextMenuSelected(int id)
701{ 701{
702 odebug << "Selected id: " << id << "" << oendl; 702 odebug << "Selected id: " << id << "" << oendl;
703 AccountView * view = (AccountView*)listView(); 703 AccountView * view = (AccountView*)listView();
704 switch(id) 704 switch(id)
705 { 705 {
706 case FOLDER_MENU_REFRESH_HEADER: 706 case FOLDER_MENU_REFRESH_HEADER:
707 view->refreshCurrent(); 707 view->refreshCurrent();
708 break; 708 break;
709 case FOLDER_MENU_DELETE_ALL_MAILS: 709 case FOLDER_MENU_DELETE_ALL_MAILS:
710 deleteAllMail(imap->getWrapper(),folder); 710 deleteAllMail(imap->getWrapper(),folder);
711 break; 711 break;
712 case FOLDER_MENU_NEW_SUBFOLDER: 712 case FOLDER_MENU_NEW_SUBFOLDER:
713 if (folder->no_inferior()==false) { 713 if (folder->no_inferior()==false) {
714 createNewFolder(); 714 createNewFolder();
715 } 715 }
716 break; 716 break;
717 case FOLDER_MENU_DELETE_FOLDER: 717 case FOLDER_MENU_DELETE_FOLDER:
718 if (folder->getDisplayName().lower()!="inbox") { 718 if (folder->getDisplayName().lower()!="inbox") {
719 deleteFolder(); 719 deleteFolder();
720 } 720 }
721 break; 721 break;
722 case FOLDER_MENU_MOVE_MAILS: 722 case FOLDER_MENU_MOVE_MAILS:
723 downloadMails(); 723 downloadMails();
724 break; 724 break;
725 default: 725 default:
726 break; 726 break;
727 } 727 }
728} 728}
729 729
730/** 730/**
731 * MH Account stuff 731 * MH Account stuff
732 */ 732 */
733/* MH is a little bit different - the top folder can contains messages other than in IMAP and 733/* MH is a little bit different - the top folder can contains messages other than in IMAP and
734 POP3 and MBOX */ 734 POP3 and MBOX */
735MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) 735MHviewItem::MHviewItem( const QString&aPath, AccountView *parent )
736 : AccountViewItem( parent ) 736 : AccountViewItem( parent )
737{ 737{
738 m_Path = aPath; 738 m_Path = aPath;
739 /* be carefull - the space within settext is wanted - thats why the string twice */ 739 /* be carefull - the space within settext is wanted - thats why the string twice */
740 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders"); 740 wrapper = AbstractMail::getWrapper( m_Path,"Local Folders");
741 setPixmap( 0, PIXMAP_LOCALFOLDER ); 741 setPixmap( 0, PIXMAP_LOCALFOLDER );
742 setText( 0, " Local Folders" ); 742 setText( 0, " Local Folders" );
743 setOpen( true ); 743 setOpen( true );
744 folder = 0; 744 folder = 0;
745} 745}
746 746
747MHviewItem::~MHviewItem() 747MHviewItem::~MHviewItem()
748{ 748{
749 delete wrapper; 749 delete wrapper;
750} 750}
751 751
752AbstractMail *MHviewItem::getWrapper() 752AbstractMail *MHviewItem::getWrapper()
753{ 753{
754 return wrapper; 754 return wrapper;
755} 755}
756 756
757void MHviewItem::refresh( QValueList<RecMailP> & target) 757void MHviewItem::refresh( QValueList<RecMailP> & target)
758{ 758{
759 refresh(false); 759 refresh(false);
760 getWrapper()->listMessages( "",target ); 760 getWrapper()->listMessages( "",target );
761} 761}
762 762
763void MHviewItem::refresh(bool force) 763void MHviewItem::refresh(bool force)
764{ 764{
765 if (childCount()>0 && force==false) return; 765 if (childCount()>0 && force==false) return;
766 odebug << "Refresh mh folders" << oendl; 766 odebug << "Refresh mh folders" << oendl;
767 removeChilds(); 767 removeChilds();
768 currentFolders.clear(); 768 currentFolders.clear();
769 QValueList<FolderP> *folders = wrapper->listFolders(); 769 QValueList<FolderP> *folders = wrapper->listFolders();
770 QValueList<FolderP>::ConstIterator it; 770 QValueList<FolderP>::ConstIterator it;
771 MHfolderItem*item = 0; 771 MHfolderItem*item = 0;
772 MHfolderItem*pmaster = 0; 772 MHfolderItem*pmaster = 0;
773 QString fname = ""; 773 QString fname = "";
774 int pos; 774 int pos;
775 for ( it = folders->begin(); it!=folders->end(); ++it) 775 for ( it = folders->begin(); it!=folders->end(); ++it)
776 { 776 {
777 fname = (*it)->getDisplayName(); 777 fname = (*it)->getDisplayName();
778 /* this folder itself */ 778 /* this folder itself */
779 if (fname=="/") 779 if (fname=="/")
780 { 780 {
781 currentFolders.append(fname); 781 currentFolders.append(fname);
782 folder = (*it); 782 folder = (*it);
783 continue; 783 continue;
784 } 784 }
785 currentFolders.append(fname); 785 currentFolders.append(fname);
786 pos = fname.findRev("/"); 786 pos = fname.findRev("/");
787 if (pos > 0) 787 if (pos > 0)
788 { 788 {
789 fname = fname.left(pos); 789 fname = fname.left(pos);
790 pmaster = (MHfolderItem*)findSubItem(fname); 790 pmaster = (MHfolderItem*)findSubItem(fname);
791 } 791 }
792 else 792 else
793 { 793 {
794 pmaster = 0; 794 pmaster = 0;
795 } 795 }
796 if (pmaster) 796 if (pmaster)
797 { 797 {
798 item = new MHfolderItem( (*it), pmaster, item, this ); 798 item = new MHfolderItem( (*it), pmaster, item, this );
799 } 799 }
800 else 800 else
801 { 801 {
802 item = new MHfolderItem( (*it), this , item ); 802 item = new MHfolderItem( (*it), this , item );
803 } 803 }
804 item->setSelectable((*it)->may_select()); 804 item->setSelectable((*it)->may_select());
805 } 805 }
806 delete folders; 806 delete folders;
807} 807}
808 808
809RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) 809RECBODYP MHviewItem::fetchBody( const RecMailP &mail )
810{ 810{
811 odebug << "MH fetchBody" << oendl; 811 odebug << "MH fetchBody" << oendl;
812 return wrapper->fetchBody( mail ); 812 return wrapper->fetchBody( mail );
813} 813}
814 814
815QPopupMenu * MHviewItem::getContextMenu() 815QPopupMenu * MHviewItem::getContextMenu()
816{ 816{
817 QPopupMenu *m = new QPopupMenu(0); 817 QPopupMenu *m = new QPopupMenu(0);
818 if (m) 818 if (m)
819 { 819 {
820 m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); 820 m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER);
821 m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER); 821 m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
822 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); 822 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
823 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); 823 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
824 } 824 }
825 return m; 825 return m;
826} 826}
827 827
828void MHviewItem::createFolder() 828void MHviewItem::createFolder()
829{ 829{
830 Newmdirdlg ndirdlg(0,0,true); 830 Newmdirdlg ndirdlg(0,0,true);
831 if ( QPEApplication::execDialog( &ndirdlg ) ) 831 if ( QPEApplication::execDialog( &ndirdlg ) )
832 { 832 {
833 QString ndir = ndirdlg.Newdir(); 833 QString ndir = ndirdlg.Newdir();
834 if (wrapper->createMbox(ndir)) 834 if (wrapper->createMbox(ndir))
835 { 835 {
836 refresh(true); 836 refresh(true);
837 } 837 }
838 } 838 }
839} 839}
840 840
841void MHviewItem::downloadMails() 841void MHviewItem::downloadMails()
842{ 842{
843 AccountView*bl = accountView(); 843 AccountView*bl = accountView();
844 if (!bl) return; 844 if (!bl) return;
845 bl->downloadMails(folder,getWrapper()); 845 bl->downloadMails(folder,getWrapper());
846} 846}
847 847
848QStringList MHviewItem::subFolders() 848QStringList MHviewItem::subFolders()
849{ 849{
850 return currentFolders; 850 return currentFolders;
851} 851}
852 852
853void MHviewItem::contextMenuSelected(int which) 853void MHviewItem::contextMenuSelected(int which)
854{ 854{
855 AccountView*view = 0; 855 AccountView*view = 0;
856 856
857 switch (which) 857 switch (which)
858 { 858 {
859 case SERVER_MENU_REFRESH_FOLDER: 859 case SERVER_MENU_REFRESH_FOLDER:
860 refresh(true); 860 refresh(true);
861 break; 861 break;
862 case FOLDER_MENU_NEW_SUBFOLDER: 862 case FOLDER_MENU_NEW_SUBFOLDER:
863 createFolder(); 863 createFolder();
864 break; 864 break;
865 case FOLDER_MENU_DELETE_ALL_MAILS: 865 case FOLDER_MENU_DELETE_ALL_MAILS:
866 deleteAllMail(getWrapper(),folder); 866 deleteAllMail(getWrapper(),folder);
867 break; 867 break;
868 case FOLDER_MENU_MOVE_MAILS: 868 case FOLDER_MENU_MOVE_MAILS:
869 downloadMails(); 869 downloadMails();
870 break; 870 break;
871 case FOLDER_MENU_REFRESH_HEADER: 871 case FOLDER_MENU_REFRESH_HEADER:
872 view = (AccountView*)listView(); 872 view = (AccountView*)listView();
873 if (view) view->refreshCurrent(); 873 if (view) view->refreshCurrent();
874 break; 874 break;
875 default: 875 default:
876 break; 876 break;
877 } 877 }
878} 878}
879 879
880MHfolderItem::~MHfolderItem() 880MHfolderItem::~MHfolderItem()
881{} 881{}
882 882
883MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) 883MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after )
884 : AccountViewItem(folderInit, parent,after ) 884 : AccountViewItem(folderInit, parent,after )
885{ 885{
886 mbox = parent; 886 mbox = parent;
887 initName(); 887 initName();
888} 888}
889 889
890MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) 890MHfolderItem::MHfolderItem(const FolderP& folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master)
891 : AccountViewItem(folderInit, parent,after ) 891 : AccountViewItem(folderInit, parent,after )
892{ 892{
893 folder = folderInit; 893 folder = folderInit;
894 mbox = master; 894 mbox = master;
895 initName(); 895 initName();
896} 896}
897 897
898void MHfolderItem::initName() 898void MHfolderItem::initName()
899{ 899{
900 QString bName = folder->getDisplayName(); 900 QString bName = folder->getDisplayName();
901 if (bName.startsWith("/")&&bName.length()>1) 901 if (bName.startsWith("/")&&bName.length()>1)
902 { 902 {
903 bName.replace(0,1,""); 903 bName.replace(0,1,"");
904 } 904 }
905 int pos = bName.findRev("/"); 905 int pos = bName.findRev("/");
906 if (pos > 0) 906 if (pos > 0)
907 { 907 {
908 bName.replace(0,pos+1,""); 908 bName.replace(0,pos+1,"");
909 } 909 }
910 if (bName.lower() == "outgoing") 910 if (bName.lower() == "outgoing")
911 { 911 {
912 setPixmap( 0, PIXMAP_OUTBOXFOLDER ); 912 setPixmap( 0, PIXMAP_OUTBOXFOLDER );
913 } 913 }
914 else if (bName.lower() == "inbox") 914 else if (bName.lower() == "inbox")
915 { 915 {
916 setPixmap( 0, PIXMAP_INBOXFOLDER); 916 setPixmap( 0, PIXMAP_INBOXFOLDER);
917 } else if (bName.lower() == "drafts") { 917 } else if (bName.lower() == "drafts") {
918 setPixmap(0, Resource::loadPixmap("inline/edit")); 918 setPixmap(0, Resource::loadPixmap("edit"));
919 } else { 919 } else {
920 setPixmap( 0, PIXMAP_MBOXFOLDER ); 920 setPixmap( 0, PIXMAP_MBOXFOLDER );
921 } 921 }
922 setText( 0, bName ); 922 setText( 0, bName );
923} 923}
924 924
925const FolderP&MHfolderItem::getFolder()const 925const FolderP&MHfolderItem::getFolder()const
926{ 926{
927 return folder; 927 return folder;
928} 928}
929 929
930void MHfolderItem::refresh(QValueList<RecMailP>&target) 930void MHfolderItem::refresh(QValueList<RecMailP>&target)
931{ 931{
932 if (folder->may_select()) 932 if (folder->may_select())
933 mbox->getWrapper()->listMessages( folder->getName(),target ); 933 mbox->getWrapper()->listMessages( folder->getName(),target );
934} 934}
935 935
936RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) 936RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail)
937{ 937{
938 return mbox->getWrapper()->fetchBody(aMail); 938 return mbox->getWrapper()->fetchBody(aMail);
939} 939}
940 940
941void MHfolderItem::deleteFolder() 941void MHfolderItem::deleteFolder()
942{ 942{
943 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), 943 int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName),
944 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), 944 QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()),
945 QObject::tr("Yes",contextName), 945 QObject::tr("Yes",contextName),
946 QObject::tr("No",contextName),QString::null,1,1); 946 QObject::tr("No",contextName),QString::null,1,1);
947 odebug << "Auswahl: " << yesno << "" << oendl; 947 odebug << "Auswahl: " << yesno << "" << oendl;
948 if (yesno == 0) 948 if (yesno == 0)
949 { 949 {
950 if (mbox->getWrapper()->deleteMbox(folder)) 950 if (mbox->getWrapper()->deleteMbox(folder))
951 { 951 {
952 QListView*v=listView(); 952 QListView*v=listView();
953 MHviewItem * box = mbox; 953 MHviewItem * box = mbox;
954 /* be carefull - after that this object is destroyd so don't use 954 /* be carefull - after that this object is destroyd so don't use
955 * any member of it after that call!!*/ 955 * any member of it after that call!!*/
956 mbox->refresh(true); 956 mbox->refresh(true);
957 if (v) 957 if (v)
958 { 958 {
959 v->setSelected(box,true); 959 v->setSelected(box,true);
960 } 960 }
961 } 961 }
962 } 962 }
963} 963}
964 964
965QPopupMenu * MHfolderItem::getContextMenu() 965QPopupMenu * MHfolderItem::getContextMenu()
966{ 966{
967 QPopupMenu *m = new QPopupMenu(0); 967 QPopupMenu *m = new QPopupMenu(0);
968 if (m) 968 if (m)
969 { 969 {
970 m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); 970 m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER);
971 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); 971 m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER);
972 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); 972 m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS);
973 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); 973 m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS);
974 m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); 974 m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER);
975 } 975 }
976 return m; 976 return m;
977} 977}
978 978
979void MHfolderItem::downloadMails() 979void MHfolderItem::downloadMails()
980{ 980{
981 AccountView*bl = mbox->accountView(); 981 AccountView*bl = mbox->accountView();
982 if (!bl) return; 982 if (!bl) return;
983 bl->downloadMails(folder,mbox->getWrapper()); 983 bl->downloadMails(folder,mbox->getWrapper());
984} 984}
985 985
986void MHfolderItem::createFolder() 986void MHfolderItem::createFolder()
987{ 987{
988 Newmdirdlg ndirdlg(0,0,true); 988 Newmdirdlg ndirdlg(0,0,true);
989 if ( QPEApplication::execDialog( &ndirdlg ) ) 989 if ( QPEApplication::execDialog( &ndirdlg ) )
990 { 990 {
991 QString ndir = ndirdlg.Newdir(); 991 QString ndir = ndirdlg.Newdir();
992 if (mbox->getWrapper()->createMbox(ndir,folder)) 992 if (mbox->getWrapper()->createMbox(ndir,folder))
993 { 993 {
994 QListView*v=listView(); 994 QListView*v=listView();
995 MHviewItem * box = mbox; 995 MHviewItem * box = mbox;
996 /* 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
997 * any member of it after that call!!*/ 997 * any member of it after that call!!*/
998 mbox->refresh(true); 998 mbox->refresh(true);
999 if (v) 999 if (v)
1000 { 1000 {
1001 v->setSelected(box,true); 1001 v->setSelected(box,true);
1002 } 1002 }
1003 } 1003 }
1004 } 1004 }
1005} 1005}
1006 1006
1007void MHfolderItem::contextMenuSelected(int which) 1007void MHfolderItem::contextMenuSelected(int which)
1008{ 1008{
1009 AccountView*view = 0; 1009 AccountView*view = 0;
1010 switch(which) 1010 switch(which)
1011 { 1011 {
1012 case FOLDER_MENU_DELETE_ALL_MAILS: 1012 case FOLDER_MENU_DELETE_ALL_MAILS:
1013 deleteAllMail(mbox->getWrapper(),folder); 1013 deleteAllMail(mbox->getWrapper(),folder);
1014 break; 1014 break;
1015 case FOLDER_MENU_DELETE_FOLDER: 1015 case FOLDER_MENU_DELETE_FOLDER:
1016 deleteFolder(); 1016 deleteFolder();
1017 break; 1017 break;
1018 case FOLDER_MENU_MOVE_MAILS: 1018 case FOLDER_MENU_MOVE_MAILS:
1019 downloadMails(); 1019 downloadMails();
1020 break; 1020 break;
1021 case FOLDER_MENU_NEW_SUBFOLDER: 1021 case FOLDER_MENU_NEW_SUBFOLDER:
1022 createFolder(); 1022 createFolder();
1023 break; 1023 break;
1024 case FOLDER_MENU_REFRESH_HEADER: 1024 case FOLDER_MENU_REFRESH_HEADER:
1025 view = (AccountView*)listView(); 1025 view = (AccountView*)listView();
1026 if (view) view->refreshCurrent(); 1026 if (view) view->refreshCurrent();
1027 break; 1027 break;
1028 default: 1028 default:
1029 break; 1029 break;
1030 } 1030 }
1031} 1031}
1032 1032
1033bool MHfolderItem::isDraftfolder() 1033bool MHfolderItem::isDraftfolder()
1034{ 1034{
1035 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; 1035 if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true;
1036 return false; 1036 return false;
1037} 1037}
1038 1038
1039/** 1039/**
1040 * Generic stuff 1040 * Generic stuff
1041 */ 1041 */
1042 1042
1043const QString AccountViewItem::contextName="AccountViewItem"; 1043const QString AccountViewItem::contextName="AccountViewItem";
1044 1044
1045AccountViewItem::AccountViewItem( AccountView *parent ) 1045AccountViewItem::AccountViewItem( AccountView *parent )
1046 : QListViewItem( parent ) 1046 : QListViewItem( parent )
1047{ 1047{
1048 init(); 1048 init();
1049 m_Backlink = parent; 1049 m_Backlink = parent;
1050} 1050}
1051 1051
1052AccountViewItem::AccountViewItem( QListViewItem *parent) 1052AccountViewItem::AccountViewItem( QListViewItem *parent)
1053 : QListViewItem( parent),folder(0) 1053 : QListViewItem( parent),folder(0)
1054{ 1054{
1055 init(); 1055 init();
1056} 1056}
1057 1057
1058AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after ) 1058AccountViewItem::AccountViewItem( QListViewItem *parent , QListViewItem*after )
1059 :QListViewItem( parent,after ),folder(0) 1059 :QListViewItem( parent,after ),folder(0)
1060{ 1060{
1061 init(); 1061 init();
1062} 1062}
1063 1063
1064AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after ) 1064AccountViewItem::AccountViewItem( const Opie::Core::OSmartPointer<Folder>&folderInit,QListViewItem *parent , QListViewItem*after )
1065 :QListViewItem( parent,after ),folder(folderInit) 1065 :QListViewItem( parent,after ),folder(folderInit)
1066{ 1066{
1067 init(); 1067 init();
1068} 1068}
1069 1069
1070void AccountViewItem::init() 1070void AccountViewItem::init()
1071{ 1071{
1072 m_Backlink = 0; 1072 m_Backlink = 0;
1073} 1073}
1074 1074
1075AccountViewItem::~AccountViewItem() 1075AccountViewItem::~AccountViewItem()
1076{ 1076{
1077 folder = 0; 1077 folder = 0;
1078} 1078}
1079 1079
1080AccountView*AccountViewItem::accountView() 1080AccountView*AccountViewItem::accountView()
1081{ 1081{
1082 return m_Backlink; 1082 return m_Backlink;
1083} 1083}
1084 1084
1085void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) 1085void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder)
1086{ 1086{
1087 if (!wrapper) return; 1087 if (!wrapper) return;
1088 QString fname=""; 1088 QString fname="";
1089 if (folder) fname = folder->getDisplayName(); 1089 if (folder) fname = folder->getDisplayName();
1090 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), 1090 int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName),
1091 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). 1091 QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).
1092 arg(fname), 1092 arg(fname),
1093 QObject::tr("Yes",contextName), 1093 QObject::tr("Yes",contextName),
1094 QObject::tr("No",contextName),QString::null,1,1); 1094 QObject::tr("No",contextName),QString::null,1,1);
1095 odebug << "Auswahl: " << yesno << "" << oendl; 1095 odebug << "Auswahl: " << yesno << "" << oendl;
1096 if (yesno == 0) 1096 if (yesno == 0)
1097 { 1097 {
1098 if (wrapper->deleteAllMail(folder)) 1098 if (wrapper->deleteAllMail(folder))
1099 { 1099 {
1100 AccountView * view = (AccountView*)listView(); 1100 AccountView * view = (AccountView*)listView();
1101 if (view) view->refreshCurrent(); 1101 if (view) view->refreshCurrent();
1102 } 1102 }
1103 } 1103 }
1104} 1104}
1105 1105
1106void AccountViewItem::removeChilds() 1106void AccountViewItem::removeChilds()
1107{ 1107{
1108 QListViewItem *child = firstChild(); 1108 QListViewItem *child = firstChild();
1109 while ( child ) 1109 while ( child )
1110 { 1110 {
1111 QListViewItem *tmp = child; 1111 QListViewItem *tmp = child;
1112 child = child->nextSibling(); 1112 child = child->nextSibling();
1113 delete tmp; 1113 delete tmp;
1114 } 1114 }
1115} 1115}
1116 1116
1117bool AccountViewItem::matchName(const QString&name)const 1117bool AccountViewItem::matchName(const QString&name)const
1118{ 1118{
1119 if (!folder) return false; 1119 if (!folder) return false;
1120 return folder->getDisplayName()==name; 1120 return folder->getDisplayName()==name;
1121} 1121}
1122 1122
1123 1123
1124AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start) 1124AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem*start)
1125{ 1125{
1126 AccountViewItem*pitem,*sitem; 1126 AccountViewItem*pitem,*sitem;
1127 if (!start) pitem = (AccountViewItem*)firstChild(); 1127 if (!start) pitem = (AccountViewItem*)firstChild();
1128 else pitem = (AccountViewItem*)start->firstChild(); 1128 else pitem = (AccountViewItem*)start->firstChild();
1129 while (pitem) 1129 while (pitem)
1130 { 1130 {
1131 if (pitem->matchName(path)) 1131 if (pitem->matchName(path))
1132 { 1132 {
1133 break; 1133 break;
1134 } 1134 }
1135 if (pitem->childCount()>0) 1135 if (pitem->childCount()>0)
1136 { 1136 {
1137 sitem = findSubItem(path,pitem); 1137 sitem = findSubItem(path,pitem);
1138 if (sitem) 1138 if (sitem)
1139 { 1139 {
1140 pitem = sitem; 1140 pitem = sitem;
1141 break; 1141 break;
1142 } 1142 }
1143 } 1143 }
1144 pitem=(AccountViewItem*)pitem->nextSibling(); 1144 pitem=(AccountViewItem*)pitem->nextSibling();
1145 } 1145 }
1146 return pitem; 1146 return pitem;
1147} 1147}
1148 1148
1149bool AccountViewItem::isDraftfolder() 1149bool AccountViewItem::isDraftfolder()
1150{ 1150{
1151 return false; 1151 return false;
1152} 1152}