author | alwin <alwin> | 2005-03-09 14:40:43 (UTC) |
---|---|---|
committer | alwin <alwin> | 2005-03-09 14:40:43 (UTC) |
commit | 84f237fb3b83400a031bf7c2d3025f78c02f28a8 (patch) (side-by-side diff) | |
tree | fbe8992bea9ddda02129d4c3aa4facc4ec38e00c /noncore/net/mail/accountitem.cpp | |
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.
Diffstat (limited to 'noncore/net/mail/accountitem.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/accountitem.cpp | 133 |
1 files changed, 75 insertions, 58 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 @@ -92,4 +92,4 @@ QPopupMenu * POP3viewItem::getContextMenu() { - m->insertItem(QObject::tr("Disconnect",contextName),0); - m->insertItem(QObject::tr("Set offline",contextName),1); + m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); + m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); } @@ -97,3 +97,3 @@ QPopupMenu * POP3viewItem::getContextMenu() { - m->insertItem(QObject::tr("Set online",contextName),1); + m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); } @@ -131,6 +131,6 @@ void POP3viewItem::contextMenuSelected(int which) { - case 0: + case SERVER_MENU_DISCONNECT: disconnect(); break; - case 1: + case SERVER_MENU_OFFLINE: setOnOffline(); @@ -174,5 +174,5 @@ QPopupMenu * POP3folderItem::getContextMenu() { - m->insertItem(QObject::tr("Refresh header list",contextName),0); - m->insertItem(QObject::tr("Delete all mails",contextName),1); - m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); + m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); + m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); + m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); } @@ -193,3 +193,3 @@ void POP3folderItem::contextMenuSelected(int which) { - case 0: + case FOLDER_MENU_REFRESH_HEADER: /* must be 'cause pop3 lists are cached */ @@ -198,6 +198,6 @@ void POP3folderItem::contextMenuSelected(int which) break; - case 1: + case FOLDER_MENU_DELETE_ALL_MAILS: deleteAllMail(pop3->getWrapper(),folder); break; - case 2: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); @@ -283,5 +283,5 @@ QPopupMenu * NNTPviewItem::getContextMenu() { - m->insertItem(QObject::tr("Disconnect",contextName),0); - m->insertItem(QObject::tr("Set offline",contextName),1); - m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),2); + m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); + m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); + m->insertItem(QObject::tr("(Un-)Subscribe groups",contextName),SERVER_MENU_SUBSCRIBE); } @@ -289,3 +289,3 @@ QPopupMenu * NNTPviewItem::getContextMenu() { - m->insertItem(QObject::tr("Set online",contextName),1); + m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); } @@ -332,9 +332,9 @@ void NNTPviewItem::contextMenuSelected(int which) { - case 0: + case SERVER_MENU_DISCONNECT: disconnect(); break; - case 1: + case SERVER_MENU_OFFLINE: setOnOffline(); break; - case 2: + case SERVER_MENU_SUBSCRIBE: subscribeGroups(); @@ -378,4 +378,4 @@ QPopupMenu * NNTPfolderItem::getContextMenu() { - m->insertItem(QObject::tr("Refresh header list",contextName),0); - m->insertItem(QObject::tr("Copy all postings",contextName),1); + m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); + m->insertItem(QObject::tr("Copy all postings",contextName),FOLDER_MENU_MOVE_MAILS); } @@ -396,4 +396,4 @@ void NNTPfolderItem::contextMenuSelected(int which) { - case 0: - /* must be 'cause pop3 lists are cached */ + case FOLDER_MENU_REFRESH_HEADER: + /* must be 'cause nntp lists are cached */ nntp->getWrapper()->logout(); @@ -401,3 +401,3 @@ void NNTPfolderItem::contextMenuSelected(int which) break; - case 1: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); @@ -500,7 +500,7 @@ QPopupMenu * IMAPviewItem::getContextMenu() { - m->insertItem(QObject::tr("Refresh folder list",contextName),0); - m->insertItem(QObject::tr("Create new folder",contextName),1); + m->insertItem(QObject::tr("Disconnect",contextName),SERVER_MENU_DISCONNECT); + m->insertItem(QObject::tr("Set offline",contextName),SERVER_MENU_OFFLINE); m->insertSeparator(); - m->insertItem(QObject::tr("Disconnect",contextName),2); - m->insertItem(QObject::tr("Set offline",contextName),3); + m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); + m->insertItem(QObject::tr("Create new folder",contextName),SERVER_MENU_CREATE_FOLDER); } @@ -508,3 +508,3 @@ QPopupMenu * IMAPviewItem::getContextMenu() { - m->insertItem(QObject::tr("Set online",contextName),3); + m->insertItem(QObject::tr("Set online",contextName),SERVER_MENU_OFFLINE); } @@ -539,9 +539,9 @@ void IMAPviewItem::contextMenuSelected(int id) { - case 0: + case SERVER_MENU_REFRESH_FOLDER: refreshFolders(true); break; - case 1: + case SERVER_MENU_CREATE_FOLDER: createNewFolder(); break; - case 2: + case SERVER_MENU_DISCONNECT: removeChilds(); @@ -549,3 +549,3 @@ void IMAPviewItem::contextMenuSelected(int id) break; - case 3: + case SERVER_MENU_OFFLINE: if (account->getOffline()==false) @@ -637,5 +637,5 @@ QPopupMenu * IMAPfolderItem::getContextMenu() { - m->insertItem(QObject::tr("Refresh header list",contextName),0); - m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); - m->insertItem(QObject::tr("Delete all mails",contextName),1); + m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); + m->insertItem(QObject::tr("Move/Copy all mails",contextName),FOLDER_MENU_MOVE_MAILS); + m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); } @@ -643,3 +643,3 @@ QPopupMenu * IMAPfolderItem::getContextMenu() { - m->insertItem(QObject::tr("Create new subfolder",contextName),2); + m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); } @@ -647,3 +647,3 @@ QPopupMenu * IMAPfolderItem::getContextMenu() { - m->insertItem(QObject::tr("Delete folder",contextName),3); + m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); } @@ -705,15 +705,19 @@ void IMAPfolderItem::contextMenuSelected(int id) { - case 0: + case FOLDER_MENU_REFRESH_HEADER: view->refreshCurrent(); break; - case 1: + case FOLDER_MENU_DELETE_ALL_MAILS: deleteAllMail(imap->getWrapper(),folder); break; - case 2: + case FOLDER_MENU_NEW_SUBFOLDER: + if (folder->no_inferior()==false) { createNewFolder(); + } break; - case 3: + case FOLDER_MENU_DELETE_FOLDER: + if (folder->getDisplayName().lower()!="inbox") { deleteFolder(); + } break; - case 4: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); @@ -761,2 +765,3 @@ void MHviewItem::refresh(bool force) if (childCount()>0 && force==false) return; + odebug << "Refresh mh folders" << oendl; removeChilds(); @@ -814,6 +819,6 @@ QPopupMenu * MHviewItem::getContextMenu() { - m->insertItem(QObject::tr("Refresh folder list",contextName),0); - m->insertItem(QObject::tr("Create new folder",contextName),1); - m->insertItem(QObject::tr("Delete all mails",contextName),2); - m->insertItem(QObject::tr("Move/Copie all mails",contextName),3); + m->insertItem(QObject::tr("Refresh folder list",contextName),SERVER_MENU_REFRESH_FOLDER); + m->insertItem(QObject::tr("Create new folder",contextName),FOLDER_MENU_NEW_SUBFOLDER); + m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); + m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); } @@ -849,16 +854,22 @@ void MHviewItem::contextMenuSelected(int which) { + AccountView*view = 0; + switch (which) { - case 0: + case SERVER_MENU_REFRESH_FOLDER: refresh(true); break; - case 1: + case FOLDER_MENU_NEW_SUBFOLDER: createFolder(); break; - case 2: + case FOLDER_MENU_DELETE_ALL_MAILS: deleteAllMail(getWrapper(),folder); break; - case 3: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); break; + case FOLDER_MENU_REFRESH_HEADER: + view = (AccountView*)listView(); + if (view) view->refreshCurrent(); + break; default: @@ -958,6 +969,7 @@ QPopupMenu * MHfolderItem::getContextMenu() { - m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); - m->insertItem(QObject::tr("Delete all mails",contextName),0); - m->insertItem(QObject::tr("Create new subfolder",contextName),3); - m->insertItem(QObject::tr("Delete folder",contextName),1); + m->insertItem(QObject::tr("Create new subfolder",contextName),FOLDER_MENU_NEW_SUBFOLDER); + m->insertItem(QObject::tr("Refresh header list",contextName),FOLDER_MENU_REFRESH_HEADER); + m->insertItem(QObject::tr("Move/Copie all mails",contextName),FOLDER_MENU_MOVE_MAILS); + m->insertItem(QObject::tr("Delete all mails",contextName),FOLDER_MENU_DELETE_ALL_MAILS); + m->insertItem(QObject::tr("Delete folder",contextName),FOLDER_MENU_DELETE_FOLDER); } @@ -996,16 +1008,21 @@ void MHfolderItem::contextMenuSelected(int which) { + AccountView*view = 0; switch(which) { - case 0: + case FOLDER_MENU_DELETE_ALL_MAILS: deleteAllMail(mbox->getWrapper(),folder); break; - case 1: + case FOLDER_MENU_DELETE_FOLDER: deleteFolder(); break; - case 2: + case FOLDER_MENU_MOVE_MAILS: downloadMails(); break; - case 3: + case FOLDER_MENU_NEW_SUBFOLDER: createFolder(); break; + case FOLDER_MENU_REFRESH_HEADER: + view = (AccountView*)listView(); + if (view) view->refreshCurrent(); + break; default: |