author | alwin <alwin> | 2003-12-17 00:30:31 (UTC) |
---|---|---|
committer | alwin <alwin> | 2003-12-17 00:30:31 (UTC) |
commit | a928f1fc8469124e10a7042846d258401e41f7d6 (patch) (unidiff) | |
tree | 225db6d7356d3ff3a0a3f3768c2fc0fa10360edc /noncore/net/mail/accountview.cpp | |
parent | 27151bb106e2cbd7f649dae228189ebcaccd7aac (diff) | |
download | opie-a928f1fc8469124e10a7042846d258401e41f7d6.zip opie-a928f1fc8469124e10a7042846d258401e41f7d6.tar.gz opie-a928f1fc8469124e10a7042846d258401e41f7d6.tar.bz2 |
imap folder will be displayed more structured
Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 65 |
1 files changed, 60 insertions, 5 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 8e21d39..b6bf298 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -106,6 +106,7 @@ AbstractMail *IMAPviewItem::getWrapper() | |||
106 | 106 | ||
107 | void IMAPviewItem::refresh(QList<RecMail>&) | 107 | void IMAPviewItem::refresh(QList<RecMail>&) |
108 | { | 108 | { |
109 | if (childCount()>0) return; | ||
109 | QList<Folder> *folders = wrapper->listFolders(); | 110 | QList<Folder> *folders = wrapper->listFolders(); |
110 | 111 | ||
111 | QListViewItem *child = firstChild(); | 112 | QListViewItem *child = firstChild(); |
@@ -117,12 +118,48 @@ void IMAPviewItem::refresh(QList<RecMail>&) | |||
117 | 118 | ||
118 | Folder *it; | 119 | Folder *it; |
119 | QListViewItem*item = 0; | 120 | QListViewItem*item = 0; |
121 | QListViewItem*titem = 0; | ||
122 | QListViewItem*inboxitem = 0; | ||
123 | QString fname,del,search; | ||
124 | int pos; | ||
125 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | ||
126 | folders->setAutoDelete(false); | ||
127 | |||
128 | for ( it = folders->first(); it; it = folders->next() ) { | ||
129 | if (it->getDisplayName().lower()=="inbox") { | ||
130 | inboxitem = new IMAPfolderItem( it, this , item ); | ||
131 | folders->remove(it); | ||
132 | qDebug("inbox found"); | ||
133 | break; | ||
134 | } | ||
135 | } | ||
136 | |||
120 | for ( it = folders->first(); it; it = folders->next() ) { | 137 | for ( it = folders->first(); it; it = folders->next() ) { |
121 | item = new IMAPfolderItem( it, this , item ); | 138 | fname = it->getDisplayName(); |
139 | pos = fname.findRev(it->Separator()); | ||
140 | if (pos != -1) { | ||
141 | fname = fname.left(pos); | ||
142 | qDebug(fname); | ||
143 | } | ||
144 | IMAPfolderItem*pitem = (IMAPfolderItem*)firstChild(); | ||
145 | while (pitem) { | ||
146 | if (pitem->matchName(fname)) { | ||
147 | break; | ||
148 | } | ||
149 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | ||
150 | } | ||
151 | if (pitem) { | ||
152 | titem = item; | ||
153 | item = new IMAPfolderItem(it,pitem,item,this); | ||
154 | item->setSelectable(it->may_select()); | ||
155 | /* setup the short name */ | ||
156 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | ||
157 | item = titem; | ||
158 | } else { | ||
159 | item = new IMAPfolderItem( it, this , (inboxitem?inboxitem:item) ); | ||
122 | item->setSelectable(it->may_select()); | 160 | item->setSelectable(it->may_select()); |
123 | } | 161 | } |
124 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 162 | } |
125 | folders->setAutoDelete(false); | ||
126 | delete folders; | 163 | delete folders; |
127 | } | 164 | } |
128 | 165 | ||
@@ -137,7 +174,7 @@ IMAPfolderItem::~IMAPfolderItem() | |||
137 | } | 174 | } |
138 | 175 | ||
139 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 176 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
140 | : AccountViewItem( parent,after ) | 177 | : AccountViewItem( parent ) |
141 | { | 178 | { |
142 | folder = folderInit; | 179 | folder = folderInit; |
143 | imap = parent; | 180 | imap = parent; |
@@ -149,6 +186,24 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList | |||
149 | setText( 0, folder->getDisplayName() ); | 186 | setText( 0, folder->getDisplayName() ); |
150 | } | 187 | } |
151 | 188 | ||
189 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | ||
190 | : AccountViewItem( parent,after ) | ||
191 | { | ||
192 | folder = folderInit; | ||
193 | imap = master; | ||
194 | if (folder->getDisplayName().lower()!="inbox") { | ||
195 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | ||
196 | } else { | ||
197 | setPixmap( 0, PIXMAP_INBOXFOLDER); | ||
198 | } | ||
199 | setText( 0, folder->getDisplayName() ); | ||
200 | } | ||
201 | |||
202 | bool IMAPfolderItem::matchName(const QString&name)const | ||
203 | { | ||
204 | return folder->getDisplayName()==name; | ||
205 | } | ||
206 | |||
152 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 207 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
153 | { | 208 | { |
154 | if (folder->may_select()) | 209 | if (folder->may_select()) |
@@ -169,7 +224,7 @@ AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | |||
169 | { | 224 | { |
170 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), | 225 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), |
171 | SLOT( refresh( QListViewItem * ) ) ); | 226 | SLOT( refresh( QListViewItem * ) ) ); |
172 | setSorting(-1); | 227 | setSorting(0); |
173 | } | 228 | } |
174 | 229 | ||
175 | void AccountView::populate( QList<Account> list ) | 230 | void AccountView::populate( QList<Account> list ) |