author | alwin <alwin> | 2005-03-09 14:40:43 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-09 14:40:43 (UTC) |
commit | 84f237fb3b83400a031bf7c2d3025f78c02f28a8 (patch) (unidiff) | |
tree | fbe8992bea9ddda02129d4c3aa4facc4ec38e00c | |
parent | e62e4a9111d9f5cfe4f004f1b21d377b92018b33 (diff) | |
download | opie-84f237fb3b83400a031bf7c2d3025f78c02f28a8.zip opie-84f237fb3b83400a031bf7c2d3025f78c02f28a8.tar.gz opie-84f237fb3b83400a031bf7c2d3025f78c02f28a8.tar.bz2 |
cleanups/fixed potential crashers
context menus are displayed in mainmenu, too.
-rw-r--r-- | noncore/net/mail/accountitem.cpp | 155 | ||||
-rw-r--r-- | noncore/net/mail/accountitem.h | 13 | ||||
-rw-r--r-- | noncore/net/mail/accountview.cpp | 52 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 11 | ||||
-rw-r--r-- | noncore/net/mail/defines.h | 27 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.cpp | 35 | ||||
-rw-r--r-- | noncore/net/mail/mainwindow.h | 5 | ||||
-rw-r--r-- | noncore/net/mail/opiemail.cpp | 4 |
8 files changed, 217 insertions, 85 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index c1574fd..4869df8 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -80,5 +80,5 @@ void POP3viewItem::refresh() | |||
80 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) | 80 | RECBODYP POP3viewItem::fetchBody( const RecMailP &mail ) |
81 | { | 81 | { |
82 | odebug << "POP3 fetchBody" << oendl; | 82 | odebug << "POP3 fetchBody" << oendl; |
83 | return wrapper->fetchBody( mail ); | 83 | return wrapper->fetchBody( mail ); |
84 | } | 84 | } |
@@ -91,10 +91,10 @@ QPopupMenu * POP3viewItem::getContextMenu() | |||
91 | if (!account->getOffline()) | 91 | if (!account->getOffline()) |
92 | { | 92 | { |
93 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 93 | m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); |
94 | m->insertItem(QObject::tr("Set offline",contextName),1); | 94 | m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); |
95 | } | 95 | } |
96 | else | 96 | else |
97 | { | 97 | { |
98 | m->insertItem(QObject::tr("Set online",contextName),1); | 98 | m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); |
99 | } | 99 | } |
100 | } | 100 | } |
@@ -130,8 +130,8 @@ void POP3viewItem::contextMenuSelected(int which) | |||
130 | switch (which) | 130 | switch (which) |
131 | { | 131 | { |
132 | case 0: | 132 | case SERVER_MENU_DISCONNECT: |
133 | disconnect(); | 133 | disconnect(); |
134 | break; | 134 | break; |
135 | case 1: | 135 | case SERVER_MENU_OFFLINE: |
136 | setOnOffline(); | 136 | setOnOffline(); |
137 | break; | 137 | break; |
@@ -173,7 +173,7 @@ QPopupMenu * POP3folderItem::getContextMenu() | |||
173 | if (m) | 173 | if (m) |
174 | { | 174 | { |
175 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 175 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); |
176 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 176 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); |
177 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 177 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); |
178 | } | 178 | } |
179 | return m; | 179 | return m; |
@@ -192,13 +192,13 @@ void POP3folderItem::contextMenuSelected(int which) | |||
192 | switch (which) | 192 | switch (which) |
193 | { | 193 | { |
194 | case 0: | 194 | case FOLDER_MENU_REFRESH_HEADER: |
195 | /* must be 'cause pop3 lists are cached */ | 195 | /* must be 'cause pop3 lists are cached */ |
196 | pop3->getWrapper()->logout(); | 196 | pop3->getWrapper()->logout(); |
197 | view->refreshCurrent(); | 197 | view->refreshCurrent(); |
198 | break; | 198 | break; |
199 | case 1: | 199 | case FOLDER_MENU_DELETE_ALL_MAILS: |
200 | deleteAllMail(pop3->getWrapper(),folder); | 200 | deleteAllMail(pop3->getWrapper(),folder); |
201 | break; | 201 | break; |
202 | case 2: | 202 | case FOLDER_MENU_MOVE_MAILS: |
203 | downloadMails(); | 203 | downloadMails(); |
204 | break; | 204 | break; |
@@ -271,5 +271,5 @@ void NNTPviewItem::refresh() | |||
271 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 271 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
272 | { | 272 | { |
273 | odebug << "NNTP fetchBody" << oendl; | 273 | odebug << "NNTP fetchBody" << oendl; |
274 | return wrapper->fetchBody( mail ); | 274 | return wrapper->fetchBody( mail ); |
275 | } | 275 | } |
@@ -282,11 +282,11 @@ QPopupMenu * NNTPviewItem::getContextMenu() | |||
282 | if (!account->getOffline()) | 282 | if (!account->getOffline()) |
283 | { | 283 | { |
284 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 284 | m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); |
285 | m->insertItem(QObject::tr("Set offline",contextName),1); | 285 | m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); |
286 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); | 286 | m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),SERVER_MENU_SUBSCRIBE); |
287 | } | 287 | } |
288 | else | 288 | else |
289 | { | 289 | { |
290 | m->insertItem(QObject::tr("Set online",contextName),1); | 290 | m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); |
291 | } | 291 | } |
292 | } | 292 | } |
@@ -331,11 +331,11 @@ void NNTPviewItem::contextMenuSelected(int which) | |||
331 | switch (which) | 331 | switch (which) |
332 | { | 332 | { |
333 | case 0: | 333 | case SERVER_MENU_DISCONNECT: |
334 | disconnect(); | 334 | disconnect(); |
335 | break; | 335 | break; |
336 | case 1: | 336 | case SERVER_MENU_OFFLINE: |
337 | setOnOffline(); | 337 | setOnOffline(); |
338 | break; | 338 | break; |
339 | case 2: | 339 | case SERVER_MENU_SUBSCRIBE: |
340 | subscribeGroups(); | 340 | subscribeGroups(); |
341 | break; | 341 | break; |
@@ -377,6 +377,6 @@ QPopupMenu * NNTPfolderItem::getContextMenu() | |||
377 | if (m) | 377 | if (m) |
378 | { | 378 | { |
379 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 379 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); |
380 | m->insertItem(QObject::tr("Copy all postings",contextName),1); | 380 | m->insertItem(QObject::tr("Copy all postings",contextName),FOLDER_MENU_MOVE_MAILS); |
381 | } | 381 | } |
382 | return m; | 382 | return m; |
@@ -395,10 +395,10 @@ void NNTPfolderItem::contextMenuSelected(int which) | |||
395 | switch (which) | 395 | switch (which) |
396 | { | 396 | { |
397 | case 0: | 397 | case FOLDER_MENU_REFRESH_HEADER: |
398 | /* must be 'cause pop3 lists are cached */ | 398 | /* must be 'cause nntp lists are cached */ |
399 | nntp->getWrapper()->logout(); | 399 | nntp->getWrapper()->logout(); |
400 | view->refreshCurrent(); | 400 | view->refreshCurrent(); |
401 | break; | 401 | break; |
402 | case 1: | 402 | case FOLDER_MENU_MOVE_MAILS: |
403 | downloadMails(); | 403 | downloadMails(); |
404 | break; | 404 | break; |
@@ -462,5 +462,5 @@ void IMAPviewItem::refreshFolders(bool force) | |||
462 | item = new IMAPfolderItem( (*it), this , item ); | 462 | item = new IMAPfolderItem( (*it), this , item ); |
463 | folders->remove(it); | 463 | folders->remove(it); |
464 | odebug << "inbox found" << oendl; | 464 | odebug << "inbox found" << oendl; |
465 | break; | 465 | break; |
466 | } | 466 | } |
@@ -499,13 +499,13 @@ QPopupMenu * IMAPviewItem::getContextMenu() | |||
499 | if (!account->getOffline()) | 499 | if (!account->getOffline()) |
500 | { | 500 | { |
501 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 501 | m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); |
502 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 502 | m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); |
503 | m->insertSeparator(); | 503 | m->insertSeparator(); |
504 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 504 | m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); |
505 | m->insertItem(QObject::tr("Set offline",contextName),3); | 505 | m->insertItem(QObject::tr("Create new folder",contextName),SERVER_MENU_CREATE_FOLDER); |
506 | } | 506 | } |
507 | else | 507 | else |
508 | { | 508 | { |
509 | m->insertItem(QObject::tr("Set online",contextName),3); | 509 | m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); |
510 | } | 510 | } |
511 | } | 511 | } |
@@ -535,18 +535,18 @@ void IMAPviewItem::createNewFolder() | |||
535 | void IMAPviewItem::contextMenuSelected(int id) | 535 | void IMAPviewItem::contextMenuSelected(int id) |
536 | { | 536 | { |
537 | odebug << "Id selected: " << id << "" << oendl; | 537 | odebug << "Id selected: " << id << "" << oendl; |
538 | switch (id) | 538 | switch (id) |
539 | { | 539 | { |
540 | case 0: | 540 | case SERVER_MENU_REFRESH_FOLDER: |
541 | refreshFolders(true); | 541 | refreshFolders(true); |
542 | break; | 542 | break; |
543 | case 1: | 543 | case SERVER_MENU_CREATE_FOLDER: |
544 | createNewFolder(); | 544 | createNewFolder(); |
545 | break; | 545 | break; |
546 | case 2: | 546 | case SERVER_MENU_DISCONNECT: |
547 | removeChilds(); | 547 | removeChilds(); |
548 | wrapper->logout(); | 548 | wrapper->logout(); |
549 | break; | 549 | break; |
550 | case 3: | 550 | case SERVER_MENU_OFFLINE: |
551 | if (account->getOffline()==false) | 551 | if (account->getOffline()==false) |
552 | { | 552 | { |
@@ -636,15 +636,15 @@ QPopupMenu * IMAPfolderItem::getContextMenu() | |||
636 | if (folder->may_select()) | 636 | if (folder->may_select()) |
637 | { | 637 | { |
638 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 638 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); |
639 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 639 | m->insertItem(QObject::tr("Move/Copy all mails",contextName),FOLDER_MENU_MOVE_MAILS); |
640 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 640 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); |
641 | } | 641 | } |
642 | if (folder->no_inferior()==false) | 642 | if (folder->no_inferior()==false) |
643 | { | 643 | { |
644 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 644 | m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); |
645 | } | 645 | } |
646 | if (folder->getDisplayName().lower()!="inbox") | 646 | if (folder->getDisplayName().lower()!="inbox") |
647 | { | 647 | { |
648 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 648 | m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); |
649 | } | 649 | } |
650 | } | 650 | } |
@@ -673,5 +673,5 @@ void IMAPfolderItem::deleteFolder() | |||
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 | { |
@@ -700,21 +700,25 @@ void IMAPfolderItem::downloadMails() | |||
700 | void IMAPfolderItem::contextMenuSelected(int id) | 700 | void 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 0: | 706 | case FOLDER_MENU_REFRESH_HEADER: |
707 | view->refreshCurrent(); | 707 | view->refreshCurrent(); |
708 | break; | 708 | break; |
709 | case 1: | 709 | case FOLDER_MENU_DELETE_ALL_MAILS: |
710 | deleteAllMail(imap->getWrapper(),folder); | 710 | deleteAllMail(imap->getWrapper(),folder); |
711 | break; | 711 | break; |
712 | case 2: | 712 | case FOLDER_MENU_NEW_SUBFOLDER: |
713 | createNewFolder(); | 713 | if (folder->no_inferior()==false) { |
714 | createNewFolder(); | ||
715 | } | ||
714 | break; | 716 | break; |
715 | case 3: | 717 | case FOLDER_MENU_DELETE_FOLDER: |
716 | deleteFolder(); | 718 | if (folder->getDisplayName().lower()!="inbox") { |
719 | deleteFolder(); | ||
720 | } | ||
717 | break; | 721 | break; |
718 | case 4: | 722 | case FOLDER_MENU_MOVE_MAILS: |
719 | downloadMails(); | 723 | downloadMails(); |
720 | break; | 724 | break; |
@@ -760,4 +764,5 @@ void MHviewItem::refresh(bool force) | |||
760 | { | 764 | { |
761 | if (childCount()>0 && force==false) return; | 765 | if (childCount()>0 && force==false) return; |
766 | odebug << "Refresh mh folders" << oendl; | ||
762 | removeChilds(); | 767 | removeChilds(); |
763 | currentFolders.clear(); | 768 | currentFolders.clear(); |
@@ -804,5 +809,5 @@ void MHviewItem::refresh(bool force) | |||
804 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 809 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
805 | { | 810 | { |
806 | odebug << "MH fetchBody" << oendl; | 811 | odebug << "MH fetchBody" << oendl; |
807 | return wrapper->fetchBody( mail ); | 812 | return wrapper->fetchBody( mail ); |
808 | } | 813 | } |
@@ -813,8 +818,8 @@ QPopupMenu * MHviewItem::getContextMenu() | |||
813 | if (m) | 818 | if (m) |
814 | { | 819 | { |
815 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 820 | m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); |
816 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 821 | m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER); |
817 | m->insertItem(QObject::tr("Delete all mails",contextName),2); | 822 | m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); |
818 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); | 823 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); |
819 | } | 824 | } |
820 | return m; | 825 | return m; |
@@ -848,18 +853,24 @@ QStringList MHviewItem::subFolders() | |||
848 | void MHviewItem::contextMenuSelected(int which) | 853 | void MHviewItem::contextMenuSelected(int which) |
849 | { | 854 | { |
855 | AccountView*view = 0; | ||
856 | |||
850 | switch (which) | 857 | switch (which) |
851 | { | 858 | { |
852 | case 0: | 859 | case SERVER_MENU_REFRESH_FOLDER: |
853 | refresh(true); | 860 | refresh(true); |
854 | break; | 861 | break; |
855 | case 1: | 862 | case FOLDER_MENU_NEW_SUBFOLDER: |
856 | createFolder(); | 863 | createFolder(); |
857 | break; | 864 | break; |
858 | case 2: | 865 | case FOLDER_MENU_DELETE_ALL_MAILS: |
859 | deleteAllMail(getWrapper(),folder); | 866 | deleteAllMail(getWrapper(),folder); |
860 | break; | 867 | break; |
861 | case 3: | 868 | case FOLDER_MENU_MOVE_MAILS: |
862 | downloadMails(); | 869 | downloadMails(); |
863 | break; | 870 | break; |
871 | case FOLDER_MENU_REFRESH_HEADER: | ||
872 | view = (AccountView*)listView(); | ||
873 | if (view) view->refreshCurrent(); | ||
874 | break; | ||
864 | default: | 875 | default: |
865 | break; | 876 | break; |
@@ -934,5 +945,5 @@ void MHfolderItem::deleteFolder() | |||
934 | QObject::tr("Yes",contextName), | 945 | QObject::tr("Yes",contextName), |
935 | QObject::tr("No",contextName),QString::null,1,1); | 946 | QObject::tr("No",contextName),QString::null,1,1); |
936 | odebug << "Auswahl: " << yesno << "" << oendl; | 947 | odebug << "Auswahl: " << yesno << "" << oendl; |
937 | if (yesno == 0) | 948 | if (yesno == 0) |
938 | { | 949 | { |
@@ -957,8 +968,9 @@ QPopupMenu * MHfolderItem::getContextMenu() | |||
957 | if (m) | 968 | if (m) |
958 | { | 969 | { |
959 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 970 | m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); |
960 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | 971 | m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); |
961 | m->insertItem(QObject::tr("Create new subfolder",contextName),3); | 972 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); |
962 | m->insertItem(QObject::tr("Delete folder",contextName),1); | 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); | ||
963 | } | 975 | } |
964 | return m; | 976 | return m; |
@@ -995,18 +1007,23 @@ void MHfolderItem::createFolder() | |||
995 | void MHfolderItem::contextMenuSelected(int which) | 1007 | void MHfolderItem::contextMenuSelected(int which) |
996 | { | 1008 | { |
1009 | AccountView*view = 0; | ||
997 | switch(which) | 1010 | switch(which) |
998 | { | 1011 | { |
999 | case 0: | 1012 | case FOLDER_MENU_DELETE_ALL_MAILS: |
1000 | deleteAllMail(mbox->getWrapper(),folder); | 1013 | deleteAllMail(mbox->getWrapper(),folder); |
1001 | break; | 1014 | break; |
1002 | case 1: | 1015 | case FOLDER_MENU_DELETE_FOLDER: |
1003 | deleteFolder(); | 1016 | deleteFolder(); |
1004 | break; | 1017 | break; |
1005 | case 2: | 1018 | case FOLDER_MENU_MOVE_MAILS: |
1006 | downloadMails(); | 1019 | downloadMails(); |
1007 | break; | 1020 | break; |
1008 | case 3: | 1021 | case FOLDER_MENU_NEW_SUBFOLDER: |
1009 | createFolder(); | 1022 | createFolder(); |
1010 | break; | 1023 | break; |
1024 | case FOLDER_MENU_REFRESH_HEADER: | ||
1025 | view = (AccountView*)listView(); | ||
1026 | if (view) view->refreshCurrent(); | ||
1027 | break; | ||
1011 | default: | 1028 | default: |
1012 | break; | 1029 | break; |
@@ -1076,5 +1093,5 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,const FolderP&folder) | |||
1076 | QObject::tr("Yes",contextName), | 1093 | QObject::tr("Yes",contextName), |
1077 | QObject::tr("No",contextName),QString::null,1,1); | 1094 | QObject::tr("No",contextName),QString::null,1,1); |
1078 | odebug << "Auswahl: " << yesno << "" << oendl; | 1095 | odebug << "Auswahl: " << yesno << "" << oendl; |
1079 | if (yesno == 0) | 1096 | if (yesno == 0) |
1080 | { | 1097 | { |
diff --git a/noncore/net/mail/accountitem.h b/noncore/net/mail/accountitem.h index f125eeb..b2c50a1 100644 --- a/noncore/net/mail/accountitem.h +++ b/noncore/net/mail/accountitem.h | |||
@@ -37,4 +37,9 @@ public: | |||
37 | virtual bool matchName(const QString&name)const; | 37 | virtual bool matchName(const QString&name)const; |
38 | virtual bool isDraftfolder(); | 38 | virtual bool isDraftfolder(); |
39 | /* 1 - server | ||
40 | * 2 - folder | ||
41 | * 3 - beides | ||
42 | */ | ||
43 | virtual int isServer()const=0; | ||
39 | 44 | ||
40 | protected: | 45 | protected: |
@@ -59,4 +64,5 @@ public: | |||
59 | virtual QPopupMenu * getContextMenu(); | 64 | virtual QPopupMenu * getContextMenu(); |
60 | virtual void contextMenuSelected(int); | 65 | virtual void contextMenuSelected(int); |
66 | virtual int isServer()const{return 1;} | ||
61 | 67 | ||
62 | protected: | 68 | protected: |
@@ -78,4 +84,5 @@ public: | |||
78 | virtual QPopupMenu * getContextMenu(); | 84 | virtual QPopupMenu * getContextMenu(); |
79 | virtual void contextMenuSelected(int); | 85 | virtual void contextMenuSelected(int); |
86 | virtual int isServer()const{return 2;} | ||
80 | 87 | ||
81 | protected: | 88 | protected: |
@@ -96,4 +103,5 @@ public: | |||
96 | virtual QPopupMenu * getContextMenu(); | 103 | virtual QPopupMenu * getContextMenu(); |
97 | virtual void contextMenuSelected(int); | 104 | virtual void contextMenuSelected(int); |
105 | virtual int isServer()const{return 1;} | ||
98 | 106 | ||
99 | protected: | 107 | protected: |
@@ -116,4 +124,5 @@ public: | |||
116 | virtual QPopupMenu * getContextMenu(); | 124 | virtual QPopupMenu * getContextMenu(); |
117 | virtual void contextMenuSelected(int); | 125 | virtual void contextMenuSelected(int); |
126 | virtual int isServer()const{return 2;} | ||
118 | 127 | ||
119 | protected: | 128 | protected: |
@@ -137,4 +146,5 @@ public: | |||
137 | const QStringList&subFolders(); | 146 | const QStringList&subFolders(); |
138 | virtual void refreshFolders(bool force=false); | 147 | virtual void refreshFolders(bool force=false); |
148 | virtual int isServer()const{return 1;} | ||
139 | bool offline(); | 149 | bool offline(); |
140 | 150 | ||
@@ -158,4 +168,5 @@ public: | |||
158 | virtual void contextMenuSelected(int); | 168 | virtual void contextMenuSelected(int); |
159 | virtual const QString& Delemiter()const; | 169 | virtual const QString& Delemiter()const; |
170 | virtual int isServer()const{return 2;} | ||
160 | protected: | 171 | protected: |
161 | virtual void createNewFolder(); | 172 | virtual void createNewFolder(); |
@@ -179,4 +190,5 @@ public: | |||
179 | QStringList subFolders(); | 190 | QStringList subFolders(); |
180 | virtual void refresh(bool force=false); | 191 | virtual void refresh(bool force=false); |
192 | virtual int isServer()const{return 3;} | ||
181 | 193 | ||
182 | protected: | 194 | protected: |
@@ -201,4 +213,5 @@ public: | |||
201 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; | 213 | virtual const Opie::Core::OSmartPointer<Folder>&getFolder()const; |
202 | virtual bool isDraftfolder(); | 214 | virtual bool isDraftfolder(); |
215 | virtual int isServer()const{return 2;} | ||
203 | 216 | ||
204 | protected: | 217 | protected: |
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index c747a8b..d01d6bb 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -21,9 +21,15 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | |||
21 | : QListView( parent, name, flags ) | 21 | : QListView( parent, name, flags ) |
22 | { | 22 | { |
23 | setSorting(0); | ||
24 | setSelectionMode(Single); | ||
25 | m_rightPressed = false; | ||
26 | |||
23 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), | 27 | connect( this, SIGNAL( selectionChanged(QListViewItem*) ), |
24 | SLOT( refresh(QListViewItem*) ) ); | 28 | SLOT( slotSelectionChanged(QListViewItem*) ) ); |
25 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, | 29 | connect( this, SIGNAL( mouseButtonPressed(int,QListViewItem*,const QPoint&,int) ),this, |
26 | SLOT( slotHold(int,QListViewItem*,const QPoint&,int) ) ); | 30 | SLOT( slotMouseButton(int,QListViewItem*,const QPoint&,int) ) ); |
27 | setSorting(0); | 31 | connect( this, SIGNAL(clicked(QListViewItem*) ),this, |
32 | SLOT( slotMouseClicked(QListViewItem*) ) ); | ||
33 | m_currentItem = 0; | ||
28 | } | 34 | } |
29 | 35 | ||
@@ -34,4 +40,16 @@ AccountView::~AccountView() | |||
34 | } | 40 | } |
35 | 41 | ||
42 | void AccountView::slotSelectionChanged(QListViewItem*item) | ||
43 | { | ||
44 | odebug << "AccountView: Selection changed" << oendl; | ||
45 | if (!item) { | ||
46 | emit serverSelected(0); | ||
47 | return; | ||
48 | } | ||
49 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | ||
50 | |||
51 | emit serverSelected(view->isServer()); | ||
52 | } | ||
53 | |||
36 | void AccountView::slotContextMenu(int id) | 54 | void AccountView::slotContextMenu(int id) |
37 | { | 55 | { |
@@ -41,7 +59,7 @@ void AccountView::slotContextMenu(int id) | |||
41 | } | 59 | } |
42 | 60 | ||
43 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 61 | void AccountView::slotRightButton(int button, QListViewItem * item,const QPoint&,int) |
44 | { | 62 | { |
45 | if (button==1) {return;} | 63 | m_rightPressed = true; |
46 | if (!item) return; | 64 | if (!item) return; |
47 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 65 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
@@ -52,4 +70,28 @@ void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | |||
52 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 70 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
53 | delete m; | 71 | delete m; |
72 | setSelected(item,true); | ||
73 | } | ||
74 | |||
75 | void AccountView::slotLeftButton(int button, QListViewItem * item,const QPoint&,int) | ||
76 | { | ||
77 | m_rightPressed = false; | ||
78 | } | ||
79 | |||
80 | void AccountView::slotMouseClicked(QListViewItem*item) | ||
81 | { | ||
82 | if (m_rightPressed) return; | ||
83 | if (!item || m_currentItem == item) return; | ||
84 | /* ### ToDo check settings if on single tab it should open */ | ||
85 | m_currentItem = item; | ||
86 | refresh(m_currentItem); | ||
87 | } | ||
88 | |||
89 | void AccountView::slotMouseButton(int button, QListViewItem * item,const QPoint&pos,int column) | ||
90 | { | ||
91 | if (button==1) { | ||
92 | slotLeftButton(button,item,pos,column); | ||
93 | } else if (button==2) { | ||
94 | slotRightButton(button,item,pos,column); | ||
95 | } | ||
54 | } | 96 | } |
55 | 97 | ||
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index 787b0b0..ae24dce 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -30,10 +30,11 @@ public slots: | |||
30 | virtual void refresh(QListViewItem *item); | 30 | virtual void refresh(QListViewItem *item); |
31 | virtual void refreshCurrent(); | 31 | virtual void refreshCurrent(); |
32 | virtual void slotHold(int, QListViewItem *,const QPoint&,int); | ||
33 | virtual void slotContextMenu(int id); | 32 | virtual void slotContextMenu(int id); |
33 | |||
34 | void setupFolderselect(Selectstore*sels); | 34 | void setupFolderselect(Selectstore*sels); |
35 | 35 | ||
36 | signals: | 36 | signals: |
37 | void refreshMailview(const QValueList<RecMailP>& ); | 37 | void refreshMailview(const QValueList<RecMailP>& ); |
38 | void serverSelected(int); | ||
38 | 39 | ||
39 | protected: | 40 | protected: |
@@ -41,4 +42,12 @@ protected: | |||
41 | QValueList<IMAPviewItem*> imapAccounts; | 42 | QValueList<IMAPviewItem*> imapAccounts; |
42 | QValueList<MHviewItem*> mhAccounts; | 43 | QValueList<MHviewItem*> mhAccounts; |
44 | bool m_rightPressed:1; | ||
45 | |||
46 | protected slots: | ||
47 | virtual void slotRightButton(int, QListViewItem *,const QPoint&,int); | ||
48 | virtual void slotLeftButton(int, QListViewItem *,const QPoint&,int); | ||
49 | virtual void slotMouseButton(int, QListViewItem *,const QPoint&,int); | ||
50 | virtual void slotMouseClicked(QListViewItem*); | ||
51 | virtual void slotSelectionChanged(QListViewItem*); | ||
43 | }; | 52 | }; |
44 | 53 | ||
diff --git a/noncore/net/mail/defines.h b/noncore/net/mail/defines.h index d840f09..5fcbf0f 100644 --- a/noncore/net/mail/defines.h +++ b/noncore/net/mail/defines.h | |||
@@ -19,11 +19,11 @@ | |||
19 | #define PIC_OFFLINE "mail/notconnected" | 19 | #define PIC_OFFLINE "mail/notconnected" |
20 | 20 | ||
21 | #define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) | 21 | #define ICON_COMPOSEMAIL QIconSet( Resource::loadPixmap( PIC_COMPOSEMAIL ) ) |
22 | #define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) | 22 | #define ICON_SENDQUEUED QIconSet( Resource::loadPixmap( PIC_SENDQUEUED ) ) |
23 | #define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) | 23 | #define ICON_SHOWFOLDERS QIconSet( Resource::loadPixmap( PIC_SHOWFOLDERS ) ) |
24 | #define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) | 24 | #define ICON_SEARCHMAILS QIconSet( Resource::loadPixmap( PIC_SEARCHMAILS ) ) |
25 | #define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) | 25 | #define ICON_EDITSETTINGS QIconSet( Resource::loadPixmap( PIC_EDITSETTINGS ) ) |
26 | #define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) | 26 | #define ICON_EDITACCOUNTS QIconSet( Resource::loadPixmap( PIC_EDITACCOUNTS ) ) |
27 | #define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) | 27 | #define ICON_SYNC QIconSet( Resource::loadPixmap( PIC_SYNC ) ) |
28 | 28 | ||
29 | #define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) | 29 | #define PIXMAP_IMAPFOLDER QPixmap( Resource::loadPixmap( PIC_IMAPFOLDER ) ) |
@@ -55,3 +55,16 @@ | |||
55 | #define UTF16LOEND 0xDFFFUL | 55 | #define UTF16LOEND 0xDFFFUL |
56 | 56 | ||
57 | /* used for making menuids transparent */ | ||
58 | #define FOLDER_MENU_REFRESH_HEADER 0 | ||
59 | #define FOLDER_MENU_DELETE_ALL_MAILS 1 | ||
60 | #define FOLDER_MENU_NEW_SUBFOLDER 2 | ||
61 | #define FOLDER_MENU_DELETE_FOLDER 3 | ||
62 | #define FOLDER_MENU_MOVE_MAILS 4 | ||
63 | |||
64 | #define SERVER_MENU_DISCONNECT 5 | ||
65 | #define SERVER_MENU_OFFLINE 6 | ||
66 | #define SERVER_MENU_REFRESH_FOLDER 7 | ||
67 | #define SERVER_MENU_CREATE_FOLDER 8 | ||
68 | #define SERVER_MENU_SUBSCRIBE 9 | ||
69 | |||
57 | #endif | 70 | #endif |
diff --git a/noncore/net/mail/mainwindow.cpp b/noncore/net/mail/mainwindow.cpp index 0a45445..81c8fee 100644 --- a/noncore/net/mail/mainwindow.cpp +++ b/noncore/net/mail/mainwindow.cpp | |||
@@ -22,10 +22,34 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
22 | 22 | ||
23 | toolBar = new QToolBar( this ); | 23 | toolBar = new QToolBar( this ); |
24 | |||
24 | menuBar = new QMenuBar( toolBar ); | 25 | menuBar = new QMenuBar( toolBar ); |
26 | |||
25 | mailMenu = new QPopupMenu( menuBar ); | 27 | mailMenu = new QPopupMenu( menuBar ); |
26 | menuBar->insertItem( tr( "Mail" ), mailMenu ); | 28 | menuBar->insertItem( tr( "Mail" ), mailMenu ); |
29 | |||
27 | settingsMenu = new QPopupMenu( menuBar ); | 30 | settingsMenu = new QPopupMenu( menuBar ); |
28 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); | 31 | menuBar->insertItem( tr( "Settings" ), settingsMenu ); |
29 | 32 | ||
33 | serverMenu = new QPopupMenu( menuBar ); | ||
34 | m_ServerMenuId = menuBar->insertItem( tr( "Server" ), serverMenu ); | ||
35 | serverMenu->insertItem(tr("Disconnect"),SERVER_MENU_DISCONNECT); | ||
36 | serverMenu->insertItem(tr("Set on/offline"),SERVER_MENU_OFFLINE); | ||
37 | serverMenu->insertSeparator(); | ||
38 | serverMenu->insertItem(tr("Refresh folder list"),SERVER_MENU_REFRESH_FOLDER); | ||
39 | serverMenu->insertItem(tr("Create new folder"),SERVER_MENU_CREATE_FOLDER); | ||
40 | serverMenu->insertSeparator(); | ||
41 | serverMenu->insertItem(tr("(Un-)Subscribe groups"),SERVER_MENU_SUBSCRIBE); | ||
42 | |||
43 | folderMenu = new QPopupMenu( menuBar ); | ||
44 | m_FolderMenuId = menuBar->insertItem( tr( "Folder" ), folderMenu ); | ||
45 | folderMenu->insertItem(tr("Refresh headerlist"),FOLDER_MENU_REFRESH_HEADER); | ||
46 | folderMenu->insertItem(tr("Delete all mails"),FOLDER_MENU_DELETE_ALL_MAILS); | ||
47 | folderMenu->insertItem(tr("New subfolder"),FOLDER_MENU_NEW_SUBFOLDER); | ||
48 | folderMenu->insertItem(tr("Delete folder"),FOLDER_MENU_DELETE_FOLDER); | ||
49 | folderMenu->insertItem(tr("Move/Copie all mails"),FOLDER_MENU_MOVE_MAILS); | ||
50 | |||
51 | menuBar->setItemEnabled(m_ServerMenuId,false); | ||
52 | menuBar->setItemEnabled(m_FolderMenuId,false); | ||
53 | |||
30 | addToolBar( toolBar ); | 54 | addToolBar( toolBar ); |
31 | toolBar->setHorizontalStretchable( true ); | 55 | toolBar->setHorizontalStretchable( true ); |
@@ -91,4 +115,8 @@ MainWindow::MainWindow( QWidget *parent, const char *name, WFlags flags ) | |||
91 | folderView->setRootIsDecorated( true ); | 115 | folderView->setRootIsDecorated( true ); |
92 | folderView->addColumn( tr( "Mailbox" ) ); | 116 | folderView->addColumn( tr( "Mailbox" ) ); |
117 | connect(folderView,SIGNAL(serverSelected(int)),this,SLOT(serverSelected(int))); | ||
118 | connect(serverMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); | ||
119 | connect(folderMenu,SIGNAL(activated(int)),folderView,SLOT(slotContextMenu(int))); | ||
120 | |||
93 | 121 | ||
94 | layout->addWidget( folderView ); | 122 | layout->addWidget( folderView ); |
@@ -146,4 +174,11 @@ MainWindow::~MainWindow() | |||
146 | } | 174 | } |
147 | 175 | ||
176 | void MainWindow::serverSelected(int m_isFolder) | ||
177 | { | ||
178 | mailView->clear(); | ||
179 | menuBar->setItemEnabled(m_ServerMenuId,m_isFolder&1); | ||
180 | menuBar->setItemEnabled(m_FolderMenuId,m_isFolder&2); | ||
181 | } | ||
182 | |||
148 | void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) | 183 | void MainWindow::systemMessage( const QCString& msg, const QByteArray& data ) |
149 | { | 184 | { |
diff --git a/noncore/net/mail/mainwindow.h b/noncore/net/mail/mainwindow.h index ad71a54..409f160 100644 --- a/noncore/net/mail/mainwindow.h +++ b/noncore/net/mail/mainwindow.h | |||
@@ -42,9 +42,11 @@ protected slots: | |||
42 | virtual void slotEditSettings(); | 42 | virtual void slotEditSettings(); |
43 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); | 43 | virtual void mailLeftClicked( int, QListViewItem *,const QPoint&,int ); |
44 | virtual void serverSelected(int); | ||
44 | 45 | ||
45 | protected: | 46 | protected: |
46 | QToolBar *toolBar; | 47 | QToolBar *toolBar; |
47 | QMenuBar *menuBar; | 48 | QMenuBar *menuBar; |
48 | QPopupMenu *mailMenu, *settingsMenu; | 49 | QPopupMenu *mailMenu, *settingsMenu,*serverMenu,*folderMenu; |
50 | |||
49 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, | 51 | QAction *composeMail, *sendQueued, *showFolders, *searchMails, *deleteMails, |
50 | *editSettings, *editAccounts, *syncFolders; | 52 | *editSettings, *editAccounts, *syncFolders; |
@@ -54,4 +56,5 @@ protected: | |||
54 | int m_Rotate; | 56 | int m_Rotate; |
55 | QCopChannel* m_sysChannel; | 57 | QCopChannel* m_sysChannel; |
58 | int m_ServerMenuId,m_FolderMenuId; | ||
56 | }; | 59 | }; |
57 | 60 | ||
diff --git a/noncore/net/mail/opiemail.cpp b/noncore/net/mail/opiemail.cpp index 9eba23e..7c6d314 100644 --- a/noncore/net/mail/opiemail.cpp +++ b/noncore/net/mail/opiemail.cpp | |||
@@ -81,6 +81,6 @@ void ValueExplode::splitit() | |||
81 | return; | 81 | return; |
82 | } | 82 | } |
83 | int pos,pos2,startpos; | 83 | int pos,pos2; |
84 | startpos = 0; | 84 | unsigned startpos = 0; |
85 | iLine = m_Command; | 85 | iLine = m_Command; |
86 | while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { | 86 | while ( (pos = iLine.find(mDelemiter,startpos))!=-1) { |