Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index bc13336..71a0d74 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp @@ -107,2 +107,23 @@ AbstractMail *IMAPviewItem::getWrapper() +IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) +{ + IMAPfolderItem*pitem,*sitem; + if (!start) pitem = (IMAPfolderItem*)firstChild(); + else pitem = (IMAPfolderItem*)start->firstChild(); + while (pitem) { + if (pitem->matchName(path)) { + break; + } + if (pitem->childCount()>0) { + sitem = findSubItem(path,pitem); + if (sitem) { + pitem = sitem; + break; + } + } + pitem=(IMAPfolderItem*)pitem->nextSibling(); + } + return pitem; +} + void IMAPviewItem::refresh(QList<RecMail>&) @@ -122,3 +143,2 @@ void IMAPviewItem::refresh(QList<RecMail>&) QListViewItem*titem = 0; - QListViewItem*inboxitem = 0; QString fname,del,search; @@ -130,3 +150,3 @@ void IMAPviewItem::refresh(QList<RecMail>&) if (it->getDisplayName().lower()=="inbox") { - inboxitem = new IMAPfolderItem( it, this , item ); + item = new IMAPfolderItem( it, this , item ); folders->remove(it); @@ -136,3 +156,2 @@ void IMAPviewItem::refresh(QList<RecMail>&) } - for ( it = folders->first(); it; it = folders->next() ) { @@ -142,14 +161,7 @@ void IMAPviewItem::refresh(QList<RecMail>&) fname = fname.left(pos); - qDebug(fname); - } - IMAPfolderItem*pitem = (IMAPfolderItem*)firstChild(); - while (pitem) { - if (pitem->matchName(fname)) { - break; - } - pitem=(IMAPfolderItem*)pitem->nextSibling(); } + IMAPfolderItem*pitem = findSubItem(fname); if (pitem) { titem = item; - item = new IMAPfolderItem(it,pitem,item,this); + item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); item->setSelectable(it->may_select()); @@ -159,3 +171,3 @@ void IMAPviewItem::refresh(QList<RecMail>&) } else { - item = new IMAPfolderItem( it, this , (inboxitem?inboxitem:item) ); + item = new IMAPfolderItem( it, this , item ); item->setSelectable(it->may_select()); @@ -177,3 +189,3 @@ IMAPfolderItem::~IMAPfolderItem() IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) - : AccountViewItem( parent ) + : AccountViewItem( parent , after ) { |