Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 77 |
1 files changed, 66 insertions, 11 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 62cbf62..3048e49 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -243,5 +243,4 @@ void IMAPviewItem::removeChilds() delete tmp; } - } @@ -707,5 +706,6 @@ void AccountView::downloadMails(Folder*fromFolder,AbstractMail*fromWrapper) * MH Account stuff */ - +/* MH is a little bit different - the top folder can contains messages other than in IMAP and + POP3 and MBOX */ MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) : AccountViewItem( parent ) @@ -717,4 +717,5 @@ MHviewItem::MHviewItem( const QString&aPath, AccountView *parent ) setText( 0, " Local Folders" ); setOpen( true ); + folder = 0; } @@ -722,4 +723,5 @@ MHviewItem::~MHviewItem() { delete wrapper; + if (folder) delete folder; } @@ -729,13 +731,12 @@ AbstractMail *MHviewItem::getWrapper() } -void MHviewItem::refresh( QList<RecMail> & ) +void MHviewItem::refresh( QList<RecMail> & target) { refresh(false); + getWrapper()->listMessages( "",target ); } -void MHviewItem::refresh(bool force) +void MHviewItem::removeChilds() { - if (childCount()>0 && force==false) return; - QList<Folder> *folders = wrapper->listFolders(); QListViewItem *child = firstChild(); while ( child ) { @@ -744,8 +745,27 @@ void MHviewItem::refresh(bool force) delete tmp; } +} + +void MHviewItem::refresh(bool force) +{ + if (childCount()>0 && force==false) return; + removeChilds(); + QList<Folder> *folders = wrapper->listFolders(); Folder *it; - QListViewItem*item = 0; + MHfolderItem*item = 0; + MHfolderItem*pmaster = 0; + QString fname = ""; for ( it = folders->first(); it; it = folders->next() ) { - item = new MHfolderItem( it, this , item ); + fname = it->getDisplayName(); + /* this folder itself */ + if (fname=="/") { + folder = it; + continue; + } + if (pmaster) { + item = new MHfolderItem( it, pmaster, item, this ); + } else { + item = new MHfolderItem( it, this , item ); + } item->setSelectable(it->may_select()); } @@ -767,4 +787,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); } return m; @@ -783,8 +805,16 @@ void MHviewItem::createFolder() } +void MHviewItem::downloadMails() +{ + AccountView*bl = accountView(); + if (!bl) return; + bl->downloadMails(folder,getWrapper()); +} + QStringList MHviewItem::subFolders() { QStringList result; QListViewItem *child = firstChild(); + result.append("/"); while ( child ) { MHfolderItem *tmp = (MHfolderItem*)child; @@ -805,4 +835,10 @@ void MHviewItem::contextMenuSelected(int which) createFolder(); break; + case 2: + deleteAllMail(getWrapper(),folder); + break; + case 3: + downloadMails(); + break; default: break; @@ -820,12 +856,29 @@ MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewIt folder = folderInit; mbox = parent; - if (folder->getDisplayName().lower() == "outgoing") { + initName(); +} + +MHfolderItem::MHfolderItem( Folder *folderInit, MHfolderItem *parent, QListViewItem*after, MHviewItem*master) + : AccountViewItem( parent,after ) +{ + folder = folderInit; + mbox = master; + initName(); +} + +void MHfolderItem::initName() +{ + QString bName = folder->getDisplayName(); + if (bName.startsWith("/")&&bName.length()>1) { + bName.replace(0,1,""); + } + if (bName.lower() == "outgoing") { setPixmap( 0, PIXMAP_OUTBOXFOLDER ); - } else if (folder->getDisplayName().lower() == "inbox") { + } else if (bName.lower() == "inbox") { setPixmap( 0, PIXMAP_INBOXFOLDER); } else { setPixmap( 0, PIXMAP_MBOXFOLDER ); } - setText( 0, folder->getDisplayName() ); + setText( 0, bName ); } @@ -874,4 +927,5 @@ QPopupMenu * MHfolderItem::getContextMenu() m->insertItem(QObject::tr("Delete folder",contextName),1); m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); + m->insertItem(QObject::tr("Create new folder",contextName),3); } return m; @@ -901,2 +955,3 @@ void MHfolderItem::contextMenuSelected(int which) } } + |