-rw-r--r-- | noncore/net/mail/accountview.cpp | 40 | ||||
-rw-r--r-- | noncore/net/mail/accountview.h | 6 |
2 files changed, 32 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() | |||
107 | 107 | ||
108 | IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) | ||
109 | { | ||
110 | IMAPfolderItem*pitem,*sitem; | ||
111 | if (!start) pitem = (IMAPfolderItem*)firstChild(); | ||
112 | else pitem = (IMAPfolderItem*)start->firstChild(); | ||
113 | while (pitem) { | ||
114 | if (pitem->matchName(path)) { | ||
115 | break; | ||
116 | } | ||
117 | if (pitem->childCount()>0) { | ||
118 | sitem = findSubItem(path,pitem); | ||
119 | if (sitem) { | ||
120 | pitem = sitem; | ||
121 | break; | ||
122 | } | ||
123 | } | ||
124 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | ||
125 | } | ||
126 | return pitem; | ||
127 | } | ||
128 | |||
108 | void IMAPviewItem::refresh(QList<RecMail>&) | 129 | void IMAPviewItem::refresh(QList<RecMail>&) |
@@ -122,3 +143,2 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
122 | QListViewItem*titem = 0; | 143 | QListViewItem*titem = 0; |
123 | QListViewItem*inboxitem = 0; | ||
124 | QString fname,del,search; | 144 | QString fname,del,search; |
@@ -130,3 +150,3 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
130 | if (it->getDisplayName().lower()=="inbox") { | 150 | if (it->getDisplayName().lower()=="inbox") { |
131 | inboxitem = new IMAPfolderItem( it, this , item ); | 151 | item = new IMAPfolderItem( it, this , item ); |
132 | folders->remove(it); | 152 | folders->remove(it); |
@@ -136,3 +156,2 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
136 | } | 156 | } |
137 | |||
138 | for ( it = folders->first(); it; it = folders->next() ) { | 157 | for ( it = folders->first(); it; it = folders->next() ) { |
@@ -142,14 +161,7 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
142 | fname = fname.left(pos); | 161 | fname = fname.left(pos); |
143 | qDebug(fname); | ||
144 | } | ||
145 | IMAPfolderItem*pitem = (IMAPfolderItem*)firstChild(); | ||
146 | while (pitem) { | ||
147 | if (pitem->matchName(fname)) { | ||
148 | break; | ||
149 | } | ||
150 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | ||
151 | } | 162 | } |
163 | IMAPfolderItem*pitem = findSubItem(fname); | ||
152 | if (pitem) { | 164 | if (pitem) { |
153 | titem = item; | 165 | titem = item; |
154 | item = new IMAPfolderItem(it,pitem,item,this); | 166 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
155 | item->setSelectable(it->may_select()); | 167 | item->setSelectable(it->may_select()); |
@@ -159,3 +171,3 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
159 | } else { | 171 | } else { |
160 | item = new IMAPfolderItem( it, this , (inboxitem?inboxitem:item) ); | 172 | item = new IMAPfolderItem( it, this , item ); |
161 | item->setSelectable(it->may_select()); | 173 | item->setSelectable(it->may_select()); |
@@ -177,3 +189,3 @@ IMAPfolderItem::~IMAPfolderItem() | |||
177 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 189 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
178 | : AccountViewItem( parent ) | 190 | : AccountViewItem( parent , after ) |
179 | { | 191 | { |
diff --git a/noncore/net/mail/accountview.h b/noncore/net/mail/accountview.h index a57935f..64abed9 100644 --- a/noncore/net/mail/accountview.h +++ b/noncore/net/mail/accountview.h | |||
@@ -53,2 +53,4 @@ private: | |||
53 | 53 | ||
54 | class IMAPfolderItem; | ||
55 | |||
54 | class IMAPviewItem : public AccountViewItem | 56 | class IMAPviewItem : public AccountViewItem |
@@ -62,2 +64,6 @@ public: | |||
62 | AbstractMail *getWrapper(); | 64 | AbstractMail *getWrapper(); |
65 | |||
66 | protected: | ||
67 | IMAPfolderItem*findSubItem(const QString&path,IMAPfolderItem*start=0); | ||
68 | |||
63 | private: | 69 | private: |