-rw-r--r-- | noncore/net/mail/accountview.cpp | 8 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 5 |
2 files changed, 8 insertions, 5 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index ac4f0e0..847b099 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -61,41 +61,42 @@ AbstractMail *IMAPviewItem::getWrapper() void IMAPviewItem::refresh(QList<RecMail>&) { QList<Folder> *folders = wrapper->listFolders(); QListViewItem *child = firstChild(); while ( child ) { QListViewItem *tmp = child; child = child->nextSibling(); delete tmp; } Folder *it; + QListViewItem*item = 0; for ( it = folders->first(); it; it = folders->next() ) { - (void) new IMAPfolderItem( it, this ); + item = new IMAPfolderItem( it, this , item ); } } RecBody IMAPviewItem::fetchBody(const RecMail&) { return RecBody(); } IMAPfolderItem::~IMAPfolderItem() { delete folder; } -IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent ) - : AccountViewItem( parent ) +IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) + : AccountViewItem( parent,after ) { folder = folderInit; imap = parent; setPixmap( 0, PIXMAP_IMAPFOLDER ); setText( 0, folder->getDisplayName() ); } void IMAPfolderItem::refresh(QList<RecMail>&target) { imap->getWrapper()->listMessages( folder->getName(),target ); } @@ -104,24 +105,25 @@ RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) return imap->getWrapper()->fetchBody(aMail); } /** * Generic stuff */ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) : QListView( parent, name, flags ) { connect( this, SIGNAL( clicked( QListViewItem * ) ), SLOT( refresh( QListViewItem * ) ) ); + setSorting(-1); } void AccountView::populate( QList<Account> list ) { clear(); Account *it; for ( it = list.first(); it; it = list.next() ) { if ( it->getType().compare( "IMAP" ) == 0 ) { IMAPaccount *imap = static_cast<IMAPaccount *>(it); qDebug( "added IMAP " + imap->getAccountName() ); (void) new IMAPviewItem( imap, this ); diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index cdc87ce..04f9b7a 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h @@ -8,25 +8,26 @@ #include "mailwrapper.h" #include "abstractmail.h" class POP3wrapper; class RecMail; class RecBody; class AccountViewItem : public QListViewItem { public: AccountViewItem( QListView *parent ) : QListViewItem( parent ) {} - AccountViewItem( QListViewItem *parent ) : QListViewItem( parent ) {} + AccountViewItem( QListViewItem *parent) : QListViewItem( parent) {} + AccountViewItem( QListViewItem *parent , QListViewItem*after ) : QListViewItem( parent,after ) {} virtual void refresh(QList<RecMail>&)=0; virtual RecBody fetchBody(const RecMail&)=0; }; class POP3viewItem : public AccountViewItem { public: POP3viewItem( POP3account *a, QListView *parent ); ~POP3viewItem(); virtual void refresh( QList<RecMail> &target ); virtual RecBody fetchBody( const RecMail &mail ); @@ -46,25 +47,25 @@ public: virtual void refresh(QList<RecMail>&); virtual RecBody fetchBody(const RecMail&); AbstractMail *getWrapper(); private: IMAPaccount *account; AbstractMail *wrapper; }; class IMAPfolderItem : public AccountViewItem { public: - IMAPfolderItem( Folder *folder, IMAPviewItem *parent ); + IMAPfolderItem( Folder *folder, IMAPviewItem *parent , QListViewItem*after ); ~IMAPfolderItem(); virtual void refresh(QList<RecMail>&); virtual RecBody fetchBody(const RecMail&); private: Folder *folder; IMAPviewItem *imap; }; class AccountView : public QListView { Q_OBJECT |