Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 76 |
1 files changed, 44 insertions, 32 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 30765cf..f861c20 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -81,12 +81,37 @@ void POP3folderItem::refresh(QList<RecMail>&target) RecBody POP3folderItem::fetchBody(const RecMail&aMail) { return pop3->getWrapper()->fetchBody(aMail); } +QPopupMenu * POP3folderItem::getContextMenu() +{ + QPopupMenu *m = new QPopupMenu(0); + if (m) { + m->insertItem(QObject::tr("Refresh header list",contextName),0); + m->insertItem(QObject::tr("Delete all mails",contextName),1); + } + return m; +} + +void POP3folderItem::contextMenuSelected(int which) +{ + AccountView * view = (AccountView*)listView(); + switch (which) { + case 0: + view->refreshCurrent(); + break; + case 1: + deleteAllMail(pop3->getWrapper(),folder); + break; + default: + break; + } +} + /** * IMAP Account stuff */ IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) : AccountViewItem( parent ) { @@ -301,27 +326,12 @@ QPopupMenu * IMAPfolderItem::getContextMenu() m->insertItem(QObject::tr("Delete folder",contextName),3); } } return m; } -void IMAPfolderItem::deleteAllMails() -{ - int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), - QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).arg(folder->getDisplayName()), - QObject::tr("Yes",contextName), - QObject::tr("No",contextName),QString::null,1,1); - qDebug("Auswahl: %i",yesno); - if (yesno == 0) { - if (imap->getWrapper()->deleteAllMail(folder)) { - AccountView * view = (AccountView*)listView(); - if (view) view->refreshCurrent(); - } - } -} - void IMAPfolderItem::createNewFolder() { Newmdirdlg ndirdlg; ndirdlg.showMaximized(); if (ndirdlg.exec()) { QString ndir = ndirdlg.Newdir(); @@ -360,13 +370,13 @@ void IMAPfolderItem::contextMenuSelected(int id) AccountView * view = (AccountView*)listView(); switch(id) { case 0: view->refreshCurrent(); break; case 1: - deleteAllMails(); + deleteAllMail(imap->getWrapper(),folder); break; case 2: createNewFolder(); break; case 3: deleteFolder(); @@ -379,12 +389,29 @@ void IMAPfolderItem::contextMenuSelected(int id) /** * Generic stuff */ const QString AccountViewItem::contextName="AccountViewItem"; +void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) +{ + if (!wrapper) return; + int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), + QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). + arg((folder?folder->getDisplayName():"")), + QObject::tr("Yes",contextName), + QObject::tr("No",contextName),QString::null,1,1); + qDebug("Auswahl: %i",yesno); + if (yesno == 0) { + if (wrapper->deleteAllMail(folder)) { + AccountView * view = (AccountView*)listView(); + if (view) view->refreshCurrent(); + } + } +} + AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) : QListView( parent, name, flags ) { connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), SLOT( refresh( QListViewItem * ) ) ); connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, @@ -591,27 +618,12 @@ void MBOXfolderItem::refresh(QList<RecMail>&target) RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) { return mbox->getWrapper()->fetchBody(aMail); } -void MBOXfolderItem::deleteAllMails() -{ - int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), - QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).arg(folder->getDisplayName()), - QObject::tr("Yes",contextName), - QObject::tr("No",contextName),QString::null,1,1); - qDebug("Auswahl: %i",yesno); - if (yesno == 0) { - if (mbox->getWrapper()->deleteAllMail(folder)) { - AccountView * view = (AccountView*)listView(); - if (view) view->refreshCurrent(); - } - } -} - void MBOXfolderItem::deleteFolder() { int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), QObject::tr("Yes",contextName), QObject::tr("No",contextName),QString::null,1,1); @@ -641,13 +653,13 @@ QPopupMenu * MBOXfolderItem::getContextMenu() } void MBOXfolderItem::contextMenuSelected(int which) { switch(which) { case 0: - deleteAllMails(); + deleteAllMail(mbox->getWrapper(),folder); break; case 1: deleteFolder(); break; default: break; |