Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 33 |
1 files changed, 29 insertions, 4 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 77fa706..faa6982 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -1,17 +1,18 @@ #include "accountview.h" #include <libmailwrapper/mailtypes.h> #include <libmailwrapper/abstractmail.h> #include "defines.h" #include "newmaildir.h" +#include "selectstore.h" #include <qmessagebox.h> #include <qpopupmenu.h> /** * POP3 Account stuff */ POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) : AccountViewItem( parent ) { account = a; wrapper = AbstractMail::getWrapper( account ); setPixmap( 0, PIXMAP_POP3FOLDER ); @@ -81,38 +82,51 @@ 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); + m->insertItem(QObject::tr("Download all mails",contextName),2); } return m; } +void POP3folderItem::downloadMails() +{ + Selectstore sels; + sels.showMaximized(); + sels.exec(); +} + void POP3folderItem::contextMenuSelected(int which) { AccountView * view = (AccountView*)listView(); switch (which) { case 0: + /* must be 'cause pop3 lists are cached */ + pop3->getWrapper()->logout(); view->refreshCurrent(); break; case 1: deleteAllMail(pop3->getWrapper(),folder); break; + case 2: + downloadMails(); + break; default: break; } } /** * IMAP Account stuff */ IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) : AccountViewItem( parent ) { account = a; @@ -149,36 +163,43 @@ IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start } } pitem=(IMAPfolderItem*)pitem->nextSibling(); } return pitem; } void IMAPviewItem::refresh(QList<RecMail>&) { refreshFolders(false); } -void IMAPviewItem::refreshFolders(bool force) +void IMAPviewItem::removeChilds() { - if (childCount()>0 && force==false) return; - QList<Folder> *folders = wrapper->listFolders(); - QListViewItem *child = firstChild(); while ( child ) { QListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } +} + +void IMAPviewItem::refreshFolders(bool force) +{ + if (childCount()>0 && force==false) return; + + removeChilds(); + + QList<Folder> *folders = wrapper->listFolders(); + Folder *it; QListViewItem*item = 0; QListViewItem*titem = 0; QString fname,del,search; int pos; // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! folders->setAutoDelete(false); for ( it = folders->first(); it; it = folders->next() ) { if (it->getDisplayName().lower()=="inbox") { item = new IMAPfolderItem( it, this , item ); folders->remove(it); @@ -237,24 +258,28 @@ void IMAPviewItem::createNewFolder() } void IMAPviewItem::contextMenuSelected(int id) { qDebug("Id selected: %i",id); switch (id) { case 0: refreshFolders(true); break; case 1: createNewFolder(); break; + case 2: + removeChilds(); + wrapper->logout(); + break; default: break; } } RecBody IMAPviewItem::fetchBody(const RecMail&) { return RecBody(); } IMAPfolderItem::~IMAPfolderItem() { |