-rw-r--r-- | noncore/net/mail/accountview.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index f861c20..9f07f56 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -1,667 +1,669 @@ | |||
1 | #include <stdlib.h> | 1 | #include <stdlib.h> |
2 | #include "accountview.h" | 2 | #include "accountview.h" |
3 | #include "mailtypes.h" | 3 | #include "mailtypes.h" |
4 | #include "defines.h" | 4 | #include "defines.h" |
5 | #include "newmaildir.h" | 5 | #include "newmaildir.h" |
6 | #include <qmessagebox.h> | 6 | #include <qmessagebox.h> |
7 | #include <qpopupmenu.h> | 7 | #include <qpopupmenu.h> |
8 | 8 | ||
9 | /** | 9 | /** |
10 | * POP3 Account stuff | 10 | * POP3 Account stuff |
11 | */ | 11 | */ |
12 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) | 12 | POP3viewItem::POP3viewItem( POP3account *a, QListView *parent ) |
13 | : AccountViewItem( parent ) | 13 | : AccountViewItem( parent ) |
14 | { | 14 | { |
15 | account = a; | 15 | account = a; |
16 | wrapper = AbstractMail::getWrapper( account ); | 16 | wrapper = AbstractMail::getWrapper( account ); |
17 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 17 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
18 | setText( 0, account->getAccountName() ); | 18 | setText( 0, account->getAccountName() ); |
19 | setOpen( true ); | 19 | setOpen( true ); |
20 | } | 20 | } |
21 | 21 | ||
22 | POP3viewItem::~POP3viewItem() | 22 | POP3viewItem::~POP3viewItem() |
23 | { | 23 | { |
24 | delete wrapper; | 24 | delete wrapper; |
25 | } | 25 | } |
26 | 26 | ||
27 | AbstractMail *POP3viewItem::getWrapper() | 27 | AbstractMail *POP3viewItem::getWrapper() |
28 | { | 28 | { |
29 | return wrapper; | 29 | return wrapper; |
30 | } | 30 | } |
31 | 31 | ||
32 | void POP3viewItem::refresh( QList<RecMail> & ) | 32 | void POP3viewItem::refresh( QList<RecMail> & ) |
33 | { | 33 | { |
34 | QList<Folder> *folders = wrapper->listFolders(); | 34 | QList<Folder> *folders = wrapper->listFolders(); |
35 | QListViewItem *child = firstChild(); | 35 | QListViewItem *child = firstChild(); |
36 | while ( child ) { | 36 | while ( child ) { |
37 | QListViewItem *tmp = child; | 37 | QListViewItem *tmp = child; |
38 | child = child->nextSibling(); | 38 | child = child->nextSibling(); |
39 | delete tmp; | 39 | delete tmp; |
40 | } | 40 | } |
41 | Folder *it; | 41 | Folder *it; |
42 | QListViewItem*item = 0; | 42 | QListViewItem*item = 0; |
43 | for ( it = folders->first(); it; it = folders->next() ) { | 43 | for ( it = folders->first(); it; it = folders->next() ) { |
44 | item = new POP3folderItem( it, this , item ); | 44 | item = new POP3folderItem( it, this , item ); |
45 | item->setSelectable(it->may_select()); | 45 | item->setSelectable(it->may_select()); |
46 | } | 46 | } |
47 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 47 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
48 | folders->setAutoDelete(false); | 48 | folders->setAutoDelete(false); |
49 | delete folders; | 49 | delete folders; |
50 | } | 50 | } |
51 | 51 | ||
52 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) | 52 | RecBody POP3viewItem::fetchBody( const RecMail &mail ) |
53 | { | 53 | { |
54 | qDebug( "POP3 fetchBody" ); | 54 | qDebug( "POP3 fetchBody" ); |
55 | return wrapper->fetchBody( mail ); | 55 | return wrapper->fetchBody( mail ); |
56 | } | 56 | } |
57 | 57 | ||
58 | POP3folderItem::~POP3folderItem() | 58 | POP3folderItem::~POP3folderItem() |
59 | { | 59 | { |
60 | delete folder; | 60 | delete folder; |
61 | } | 61 | } |
62 | 62 | ||
63 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) | 63 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) |
64 | : AccountViewItem( parent,after ) | 64 | : AccountViewItem( parent,after ) |
65 | { | 65 | { |
66 | folder = folderInit; | 66 | folder = folderInit; |
67 | pop3 = parent; | 67 | pop3 = parent; |
68 | if (folder->getDisplayName().lower()!="inbox") { | 68 | if (folder->getDisplayName().lower()!="inbox") { |
69 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 69 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
70 | } else { | 70 | } else { |
71 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 71 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
72 | } | 72 | } |
73 | setText( 0, folder->getDisplayName() ); | 73 | setText( 0, folder->getDisplayName() ); |
74 | } | 74 | } |
75 | 75 | ||
76 | void POP3folderItem::refresh(QList<RecMail>&target) | 76 | void POP3folderItem::refresh(QList<RecMail>&target) |
77 | { | 77 | { |
78 | if (folder->may_select()) | 78 | if (folder->may_select()) |
79 | pop3->getWrapper()->listMessages( folder->getName(),target ); | 79 | pop3->getWrapper()->listMessages( folder->getName(),target ); |
80 | } | 80 | } |
81 | 81 | ||
82 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) | 82 | RecBody POP3folderItem::fetchBody(const RecMail&aMail) |
83 | { | 83 | { |
84 | return pop3->getWrapper()->fetchBody(aMail); | 84 | return pop3->getWrapper()->fetchBody(aMail); |
85 | } | 85 | } |
86 | 86 | ||
87 | QPopupMenu * POP3folderItem::getContextMenu() | 87 | QPopupMenu * POP3folderItem::getContextMenu() |
88 | { | 88 | { |
89 | QPopupMenu *m = new QPopupMenu(0); | 89 | QPopupMenu *m = new QPopupMenu(0); |
90 | if (m) { | 90 | if (m) { |
91 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 91 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
92 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 92 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
93 | } | 93 | } |
94 | return m; | 94 | return m; |
95 | } | 95 | } |
96 | 96 | ||
97 | void POP3folderItem::contextMenuSelected(int which) | 97 | void POP3folderItem::contextMenuSelected(int which) |
98 | { | 98 | { |
99 | AccountView * view = (AccountView*)listView(); | 99 | AccountView * view = (AccountView*)listView(); |
100 | switch (which) { | 100 | switch (which) { |
101 | case 0: | 101 | case 0: |
102 | view->refreshCurrent(); | 102 | view->refreshCurrent(); |
103 | break; | 103 | break; |
104 | case 1: | 104 | case 1: |
105 | deleteAllMail(pop3->getWrapper(),folder); | 105 | deleteAllMail(pop3->getWrapper(),folder); |
106 | break; | 106 | break; |
107 | default: | 107 | default: |
108 | break; | 108 | break; |
109 | } | 109 | } |
110 | } | 110 | } |
111 | 111 | ||
112 | /** | 112 | /** |
113 | * IMAP Account stuff | 113 | * IMAP Account stuff |
114 | */ | 114 | */ |
115 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) | 115 | IMAPviewItem::IMAPviewItem( IMAPaccount *a, QListView *parent ) |
116 | : AccountViewItem( parent ) | 116 | : AccountViewItem( parent ) |
117 | { | 117 | { |
118 | account = a; | 118 | account = a; |
119 | wrapper = AbstractMail::getWrapper( account ); | 119 | wrapper = AbstractMail::getWrapper( account ); |
120 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 120 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
121 | setText( 0, account->getAccountName() ); | 121 | setText( 0, account->getAccountName() ); |
122 | setOpen( true ); | 122 | setOpen( true ); |
123 | } | 123 | } |
124 | 124 | ||
125 | IMAPviewItem::~IMAPviewItem() | 125 | IMAPviewItem::~IMAPviewItem() |
126 | { | 126 | { |
127 | delete wrapper; | 127 | delete wrapper; |
128 | } | 128 | } |
129 | 129 | ||
130 | AbstractMail *IMAPviewItem::getWrapper() | 130 | AbstractMail *IMAPviewItem::getWrapper() |
131 | { | 131 | { |
132 | return wrapper; | 132 | return wrapper; |
133 | } | 133 | } |
134 | 134 | ||
135 | IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) | 135 | IMAPfolderItem*IMAPviewItem::findSubItem(const QString&path,IMAPfolderItem*start) |
136 | { | 136 | { |
137 | IMAPfolderItem*pitem,*sitem; | 137 | IMAPfolderItem*pitem,*sitem; |
138 | if (!start) pitem = (IMAPfolderItem*)firstChild(); | 138 | if (!start) pitem = (IMAPfolderItem*)firstChild(); |
139 | else pitem = (IMAPfolderItem*)start->firstChild(); | 139 | else pitem = (IMAPfolderItem*)start->firstChild(); |
140 | while (pitem) { | 140 | while (pitem) { |
141 | if (pitem->matchName(path)) { | 141 | if (pitem->matchName(path)) { |
142 | break; | 142 | break; |
143 | } | 143 | } |
144 | if (pitem->childCount()>0) { | 144 | if (pitem->childCount()>0) { |
145 | sitem = findSubItem(path,pitem); | 145 | sitem = findSubItem(path,pitem); |
146 | if (sitem) { | 146 | if (sitem) { |
147 | pitem = sitem; | 147 | pitem = sitem; |
148 | break; | 148 | break; |
149 | } | 149 | } |
150 | } | 150 | } |
151 | pitem=(IMAPfolderItem*)pitem->nextSibling(); | 151 | pitem=(IMAPfolderItem*)pitem->nextSibling(); |
152 | } | 152 | } |
153 | return pitem; | 153 | return pitem; |
154 | } | 154 | } |
155 | 155 | ||
156 | void IMAPviewItem::refresh(QList<RecMail>&) | 156 | void IMAPviewItem::refresh(QList<RecMail>&) |
157 | { | 157 | { |
158 | refreshFolders(false); | 158 | refreshFolders(false); |
159 | } | 159 | } |
160 | 160 | ||
161 | void IMAPviewItem::refreshFolders(bool force) | 161 | void IMAPviewItem::refreshFolders(bool force) |
162 | { | 162 | { |
163 | if (childCount()>0 && force==false) return; | 163 | if (childCount()>0 && force==false) return; |
164 | QList<Folder> *folders = wrapper->listFolders(); | 164 | QList<Folder> *folders = wrapper->listFolders(); |
165 | 165 | ||
166 | QListViewItem *child = firstChild(); | 166 | QListViewItem *child = firstChild(); |
167 | while ( child ) { | 167 | while ( child ) { |
168 | QListViewItem *tmp = child; | 168 | QListViewItem *tmp = child; |
169 | child = child->nextSibling(); | 169 | child = child->nextSibling(); |
170 | delete tmp; | 170 | delete tmp; |
171 | } | 171 | } |
172 | 172 | ||
173 | Folder *it; | 173 | Folder *it; |
174 | QListViewItem*item = 0; | 174 | QListViewItem*item = 0; |
175 | QListViewItem*titem = 0; | 175 | QListViewItem*titem = 0; |
176 | QString fname,del,search; | 176 | QString fname,del,search; |
177 | int pos; | 177 | int pos; |
178 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 178 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
179 | folders->setAutoDelete(false); | 179 | folders->setAutoDelete(false); |
180 | 180 | ||
181 | for ( it = folders->first(); it; it = folders->next() ) { | 181 | for ( it = folders->first(); it; it = folders->next() ) { |
182 | if (it->getDisplayName().lower()=="inbox") { | 182 | if (it->getDisplayName().lower()=="inbox") { |
183 | item = new IMAPfolderItem( it, this , item ); | 183 | item = new IMAPfolderItem( it, this , item ); |
184 | folders->remove(it); | 184 | folders->remove(it); |
185 | qDebug("inbox found"); | 185 | qDebug("inbox found"); |
186 | break; | 186 | break; |
187 | } | 187 | } |
188 | } | 188 | } |
189 | for ( it = folders->first(); it; it = folders->next() ) { | 189 | for ( it = folders->first(); it; it = folders->next() ) { |
190 | fname = it->getDisplayName(); | 190 | fname = it->getDisplayName(); |
191 | pos = fname.findRev(it->Separator()); | 191 | pos = fname.findRev(it->Separator()); |
192 | if (pos != -1) { | 192 | if (pos != -1) { |
193 | fname = fname.left(pos); | 193 | fname = fname.left(pos); |
194 | } | 194 | } |
195 | IMAPfolderItem*pitem = findSubItem(fname); | 195 | IMAPfolderItem*pitem = findSubItem(fname); |
196 | if (pitem) { | 196 | if (pitem) { |
197 | titem = item; | 197 | titem = item; |
198 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); | 198 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
199 | /* setup the short name */ | 199 | /* setup the short name */ |
200 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | 200 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); |
201 | item = titem; | 201 | item = titem; |
202 | } else { | 202 | } else { |
203 | item = new IMAPfolderItem( it, this , item ); | 203 | item = new IMAPfolderItem( it, this , item ); |
204 | } | 204 | } |
205 | } | 205 | } |
206 | delete folders; | 206 | delete folders; |
207 | } | 207 | } |
208 | 208 | ||
209 | QPopupMenu * IMAPviewItem::getContextMenu() | 209 | QPopupMenu * IMAPviewItem::getContextMenu() |
210 | { | 210 | { |
211 | QPopupMenu *m = new QPopupMenu(0); | 211 | QPopupMenu *m = new QPopupMenu(0); |
212 | if (m) { | 212 | if (m) { |
213 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 213 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
214 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 214 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
215 | m->insertSeparator(); | 215 | m->insertSeparator(); |
216 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 216 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
217 | } | 217 | } |
218 | return m; | 218 | return m; |
219 | } | 219 | } |
220 | 220 | ||
221 | void IMAPviewItem::createNewFolder() | 221 | void IMAPviewItem::createNewFolder() |
222 | { | 222 | { |
223 | Newmdirdlg ndirdlg; | 223 | Newmdirdlg ndirdlg; |
224 | ndirdlg.showMaximized(); | 224 | ndirdlg.showMaximized(); |
225 | if (ndirdlg.exec()) { | 225 | if (ndirdlg.exec()) { |
226 | QString ndir = ndirdlg.Newdir(); | 226 | QString ndir = ndirdlg.Newdir(); |
227 | bool makesubs = ndirdlg.subpossible(); | 227 | bool makesubs = ndirdlg.subpossible(); |
228 | QString delemiter = "/"; | 228 | QString delemiter = "/"; |
229 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 229 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
230 | if (item) { | 230 | if (item) { |
231 | delemiter = item->Delemiter(); | 231 | delemiter = item->Delemiter(); |
232 | } | 232 | } |
233 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { | 233 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { |
234 | refreshFolders(true); | 234 | refreshFolders(true); |
235 | } | 235 | } |
236 | } | 236 | } |
237 | } | 237 | } |
238 | 238 | ||
239 | void IMAPviewItem::contextMenuSelected(int id) | 239 | void IMAPviewItem::contextMenuSelected(int id) |
240 | { | 240 | { |
241 | qDebug("Id selected: %i",id); | 241 | qDebug("Id selected: %i",id); |
242 | switch (id) { | 242 | switch (id) { |
243 | case 0: | 243 | case 0: |
244 | refreshFolders(true); | 244 | refreshFolders(true); |
245 | break; | 245 | break; |
246 | case 1: | 246 | case 1: |
247 | createNewFolder(); | 247 | createNewFolder(); |
248 | break; | 248 | break; |
249 | default: | 249 | default: |
250 | break; | 250 | break; |
251 | } | 251 | } |
252 | } | 252 | } |
253 | 253 | ||
254 | RecBody IMAPviewItem::fetchBody(const RecMail&) | 254 | RecBody IMAPviewItem::fetchBody(const RecMail&) |
255 | { | 255 | { |
256 | return RecBody(); | 256 | return RecBody(); |
257 | } | 257 | } |
258 | 258 | ||
259 | IMAPfolderItem::~IMAPfolderItem() | 259 | IMAPfolderItem::~IMAPfolderItem() |
260 | { | 260 | { |
261 | delete folder; | 261 | delete folder; |
262 | } | 262 | } |
263 | 263 | ||
264 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) | 264 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QListViewItem*after ) |
265 | : AccountViewItem( parent , after ) | 265 | : AccountViewItem( parent , after ) |
266 | { | 266 | { |
267 | folder = folderInit; | 267 | folder = folderInit; |
268 | imap = parent; | 268 | imap = parent; |
269 | if (folder->getDisplayName().lower()!="inbox") { | 269 | if (folder->getDisplayName().lower()!="inbox") { |
270 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 270 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
271 | } else { | 271 | } else { |
272 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 272 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
273 | } | 273 | } |
274 | setText( 0, folder->getDisplayName() ); | 274 | setText( 0, folder->getDisplayName() ); |
275 | } | 275 | } |
276 | 276 | ||
277 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) | 277 | IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QListViewItem*after, IMAPviewItem *master ) |
278 | : AccountViewItem( parent,after ) | 278 | : AccountViewItem( parent,after ) |
279 | { | 279 | { |
280 | folder = folderInit; | 280 | folder = folderInit; |
281 | imap = master; | 281 | imap = master; |
282 | if (folder->getDisplayName().lower()!="inbox") { | 282 | if (folder->getDisplayName().lower()!="inbox") { |
283 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 283 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
284 | } else { | 284 | } else { |
285 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 285 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
286 | } | 286 | } |
287 | setText( 0, folder->getDisplayName() ); | 287 | setText( 0, folder->getDisplayName() ); |
288 | } | 288 | } |
289 | 289 | ||
290 | const QString& IMAPfolderItem::Delemiter()const | 290 | const QString& IMAPfolderItem::Delemiter()const |
291 | { | 291 | { |
292 | return folder->Separator(); | 292 | return folder->Separator(); |
293 | } | 293 | } |
294 | 294 | ||
295 | bool IMAPfolderItem::matchName(const QString&name)const | 295 | bool IMAPfolderItem::matchName(const QString&name)const |
296 | { | 296 | { |
297 | return folder->getDisplayName()==name; | 297 | return folder->getDisplayName()==name; |
298 | } | 298 | } |
299 | 299 | ||
300 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 300 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
301 | { | 301 | { |
302 | if (folder->may_select()) { | 302 | if (folder->may_select()) { |
303 | imap->getWrapper()->listMessages( folder->getName(),target ); | 303 | imap->getWrapper()->listMessages( folder->getName(),target ); |
304 | } else { | 304 | } else { |
305 | target.clear(); | 305 | target.clear(); |
306 | } | 306 | } |
307 | } | 307 | } |
308 | 308 | ||
309 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 309 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
310 | { | 310 | { |
311 | return imap->getWrapper()->fetchBody(aMail); | 311 | return imap->getWrapper()->fetchBody(aMail); |
312 | } | 312 | } |
313 | 313 | ||
314 | QPopupMenu * IMAPfolderItem::getContextMenu() | 314 | QPopupMenu * IMAPfolderItem::getContextMenu() |
315 | { | 315 | { |
316 | QPopupMenu *m = new QPopupMenu(0); | 316 | QPopupMenu *m = new QPopupMenu(0); |
317 | if (m) { | 317 | if (m) { |
318 | if (folder->may_select()) { | 318 | if (folder->may_select()) { |
319 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 319 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
320 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 320 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
321 | } | 321 | } |
322 | if (folder->no_inferior()==false) { | 322 | if (folder->no_inferior()==false) { |
323 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 323 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
324 | } | 324 | } |
325 | if (folder->getDisplayName().lower()!="inbox") { | 325 | if (folder->getDisplayName().lower()!="inbox") { |
326 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 326 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
327 | } | 327 | } |
328 | } | 328 | } |
329 | return m; | 329 | return m; |
330 | } | 330 | } |
331 | 331 | ||
332 | void IMAPfolderItem::createNewFolder() | 332 | void IMAPfolderItem::createNewFolder() |
333 | { | 333 | { |
334 | Newmdirdlg ndirdlg; | 334 | Newmdirdlg ndirdlg; |
335 | ndirdlg.showMaximized(); | 335 | ndirdlg.showMaximized(); |
336 | if (ndirdlg.exec()) { | 336 | if (ndirdlg.exec()) { |
337 | QString ndir = ndirdlg.Newdir(); | 337 | QString ndir = ndirdlg.Newdir(); |
338 | bool makesubs = ndirdlg.subpossible(); | 338 | bool makesubs = ndirdlg.subpossible(); |
339 | QString delemiter = Delemiter(); | 339 | QString delemiter = Delemiter(); |
340 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) { | 340 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) { |
341 | imap->refreshFolders(true); | 341 | imap->refreshFolders(true); |
342 | } | 342 | } |
343 | } | 343 | } |
344 | } | 344 | } |
345 | 345 | ||
346 | void IMAPfolderItem::deleteFolder() | 346 | void IMAPfolderItem::deleteFolder() |
347 | { | 347 | { |
348 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 348 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
349 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 349 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
350 | QObject::tr("Yes",contextName), | 350 | QObject::tr("Yes",contextName), |
351 | QObject::tr("No",contextName),QString::null,1,1); | 351 | QObject::tr("No",contextName),QString::null,1,1); |
352 | qDebug("Auswahl: %i",yesno); | 352 | qDebug("Auswahl: %i",yesno); |
353 | if (yesno == 0) { | 353 | if (yesno == 0) { |
354 | if (imap->getWrapper()->deleteMbox(folder)) { | 354 | if (imap->getWrapper()->deleteMbox(folder)) { |
355 | QListView*v=listView(); | 355 | QListView*v=listView(); |
356 | IMAPviewItem * box = imap; | 356 | IMAPviewItem * box = imap; |
357 | /* be carefull - after that this object is destroyd so don't use | 357 | /* be carefull - after that this object is destroyd so don't use |
358 | * any member of it after that call!!*/ | 358 | * any member of it after that call!!*/ |
359 | imap->refreshFolders(true); | 359 | imap->refreshFolders(true); |
360 | if (v) { | 360 | if (v) { |
361 | v->setSelected(box,true); | 361 | v->setSelected(box,true); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | } | 364 | } |
365 | } | 365 | } |
366 | 366 | ||
367 | void IMAPfolderItem::contextMenuSelected(int id) | 367 | void IMAPfolderItem::contextMenuSelected(int id) |
368 | { | 368 | { |
369 | qDebug("Selected id: %i",id); | 369 | qDebug("Selected id: %i",id); |
370 | AccountView * view = (AccountView*)listView(); | 370 | AccountView * view = (AccountView*)listView(); |
371 | switch(id) { | 371 | switch(id) { |
372 | case 0: | 372 | case 0: |
373 | view->refreshCurrent(); | 373 | view->refreshCurrent(); |
374 | break; | 374 | break; |
375 | case 1: | 375 | case 1: |
376 | deleteAllMail(imap->getWrapper(),folder); | 376 | deleteAllMail(imap->getWrapper(),folder); |
377 | break; | 377 | break; |
378 | case 2: | 378 | case 2: |
379 | createNewFolder(); | 379 | createNewFolder(); |
380 | break; | 380 | break; |
381 | case 3: | 381 | case 3: |
382 | deleteFolder(); | 382 | deleteFolder(); |
383 | break; | 383 | break; |
384 | default: | 384 | default: |
385 | break; | 385 | break; |
386 | } | 386 | } |
387 | } | 387 | } |
388 | 388 | ||
389 | /** | 389 | /** |
390 | * Generic stuff | 390 | * Generic stuff |
391 | */ | 391 | */ |
392 | 392 | ||
393 | const QString AccountViewItem::contextName="AccountViewItem"; | 393 | const QString AccountViewItem::contextName="AccountViewItem"; |
394 | 394 | ||
395 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) | 395 | void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) |
396 | { | 396 | { |
397 | if (!wrapper) return; | 397 | if (!wrapper) return; |
398 | QString fname=""; | ||
399 | if (folder) fname = folder->getDisplayName(); | ||
398 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | 400 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
399 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). | 401 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName). |
400 | arg((folder?folder->getDisplayName():"")), | 402 | arg(fname), |
401 | QObject::tr("Yes",contextName), | 403 | QObject::tr("Yes",contextName), |
402 | QObject::tr("No",contextName),QString::null,1,1); | 404 | QObject::tr("No",contextName),QString::null,1,1); |
403 | qDebug("Auswahl: %i",yesno); | 405 | qDebug("Auswahl: %i",yesno); |
404 | if (yesno == 0) { | 406 | if (yesno == 0) { |
405 | if (wrapper->deleteAllMail(folder)) { | 407 | if (wrapper->deleteAllMail(folder)) { |
406 | AccountView * view = (AccountView*)listView(); | 408 | AccountView * view = (AccountView*)listView(); |
407 | if (view) view->refreshCurrent(); | 409 | if (view) view->refreshCurrent(); |
408 | } | 410 | } |
409 | } | 411 | } |
410 | } | 412 | } |
411 | 413 | ||
412 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 414 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
413 | : QListView( parent, name, flags ) | 415 | : QListView( parent, name, flags ) |
414 | { | 416 | { |
415 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), | 417 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), |
416 | SLOT( refresh( QListViewItem * ) ) ); | 418 | SLOT( refresh( QListViewItem * ) ) ); |
417 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 419 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, |
418 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); | 420 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); |
419 | 421 | ||
420 | setSorting(0); | 422 | setSorting(0); |
421 | } | 423 | } |
422 | 424 | ||
423 | void AccountView::slotContextMenu(int id) | 425 | void AccountView::slotContextMenu(int id) |
424 | { | 426 | { |
425 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 427 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
426 | if (!view) return; | 428 | if (!view) return; |
427 | view->contextMenuSelected(id); | 429 | view->contextMenuSelected(id); |
428 | } | 430 | } |
429 | 431 | ||
430 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 432 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
431 | { | 433 | { |
432 | if (button==1) {return;} | 434 | if (button==1) {return;} |
433 | if (!item) return; | 435 | if (!item) return; |
434 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 436 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
435 | QPopupMenu*m = view->getContextMenu(); | 437 | QPopupMenu*m = view->getContextMenu(); |
436 | if (!m) return; | 438 | if (!m) return; |
437 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); | 439 | connect(m,SIGNAL(activated(int)),this,SLOT(slotContextMenu(int))); |
438 | m->setFocus(); | 440 | m->setFocus(); |
439 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); | 441 | m->exec( QPoint( QCursor::pos().x(), QCursor::pos().y()) ); |
440 | delete m; | 442 | delete m; |
441 | } | 443 | } |
442 | 444 | ||
443 | void AccountView::populate( QList<Account> list ) | 445 | void AccountView::populate( QList<Account> list ) |
444 | { | 446 | { |
445 | clear(); | 447 | clear(); |
446 | 448 | ||
447 | QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); | 449 | QString localfolders = (QString) getenv( "HOME" ) + QString("/Applications/opiemail/localmail/"); |
448 | (void) new MBOXviewItem(localfolders,this); | 450 | (void) new MBOXviewItem(localfolders,this); |
449 | 451 | ||
450 | Account *it; | 452 | Account *it; |
451 | for ( it = list.first(); it; it = list.next() ) { | 453 | for ( it = list.first(); it; it = list.next() ) { |
452 | if ( it->getType().compare( "IMAP" ) == 0 ) { | 454 | if ( it->getType().compare( "IMAP" ) == 0 ) { |
453 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); | 455 | IMAPaccount *imap = static_cast<IMAPaccount *>(it); |
454 | qDebug( "added IMAP " + imap->getAccountName() ); | 456 | qDebug( "added IMAP " + imap->getAccountName() ); |
455 | (void) new IMAPviewItem( imap, this ); | 457 | (void) new IMAPviewItem( imap, this ); |
456 | } else if ( it->getType().compare( "POP3" ) == 0 ) { | 458 | } else if ( it->getType().compare( "POP3" ) == 0 ) { |
457 | POP3account *pop3 = static_cast<POP3account *>(it); | 459 | POP3account *pop3 = static_cast<POP3account *>(it); |
458 | qDebug( "added POP3 " + pop3->getAccountName() ); | 460 | qDebug( "added POP3 " + pop3->getAccountName() ); |
459 | (void) new POP3viewItem( pop3, this ); | 461 | (void) new POP3viewItem( pop3, this ); |
460 | } | 462 | } |
461 | } | 463 | } |
462 | } | 464 | } |
463 | 465 | ||
464 | void AccountView::refresh(QListViewItem *item) { | 466 | void AccountView::refresh(QListViewItem *item) { |
465 | 467 | ||
466 | qDebug("AccountView refresh..."); | 468 | qDebug("AccountView refresh..."); |
467 | if ( item ) { | 469 | if ( item ) { |
468 | m_currentItem = item; | 470 | m_currentItem = item; |
469 | QList<RecMail> headerlist; | 471 | QList<RecMail> headerlist; |
470 | headerlist.setAutoDelete(true); | 472 | headerlist.setAutoDelete(true); |
471 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 473 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
472 | view->refresh(headerlist); | 474 | view->refresh(headerlist); |
473 | emit refreshMailview(&headerlist); | 475 | emit refreshMailview(&headerlist); |
474 | } | 476 | } |
475 | } | 477 | } |
476 | 478 | ||
477 | void AccountView::refreshCurrent() | 479 | void AccountView::refreshCurrent() |
478 | { | 480 | { |
479 | m_currentItem = currentItem(); | 481 | m_currentItem = currentItem(); |
480 | if ( !m_currentItem ) return; | 482 | if ( !m_currentItem ) return; |
481 | QList<RecMail> headerlist; | 483 | QList<RecMail> headerlist; |
482 | headerlist.setAutoDelete(true); | 484 | headerlist.setAutoDelete(true); |
483 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 485 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
484 | view->refresh(headerlist); | 486 | view->refresh(headerlist); |
485 | emit refreshMailview(&headerlist); | 487 | emit refreshMailview(&headerlist); |
486 | } | 488 | } |
487 | 489 | ||
488 | void AccountView::refreshAll() | 490 | void AccountView::refreshAll() |
489 | { | 491 | { |
490 | 492 | ||
491 | } | 493 | } |
492 | 494 | ||
493 | RecBody AccountView::fetchBody(const RecMail&aMail) | 495 | RecBody AccountView::fetchBody(const RecMail&aMail) |
494 | { | 496 | { |
495 | QListViewItem*item = selectedItem (); | 497 | QListViewItem*item = selectedItem (); |
496 | if (!item) return RecBody(); | 498 | if (!item) return RecBody(); |
497 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 499 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
498 | return view->fetchBody(aMail); | 500 | return view->fetchBody(aMail); |
499 | } | 501 | } |
500 | 502 | ||
501 | /** | 503 | /** |
502 | * MBOX Account stuff | 504 | * MBOX Account stuff |
503 | */ | 505 | */ |
504 | 506 | ||
505 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) | 507 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) |
506 | : AccountViewItem( parent ) | 508 | : AccountViewItem( parent ) |
507 | { | 509 | { |
508 | m_Path = aPath; | 510 | m_Path = aPath; |
509 | wrapper = AbstractMail::getWrapper( m_Path ); | 511 | wrapper = AbstractMail::getWrapper( m_Path ); |
510 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 512 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
511 | setText( 0, " Local Folders" ); | 513 | setText( 0, " Local Folders" ); |
512 | setOpen( true ); | 514 | setOpen( true ); |
513 | } | 515 | } |
514 | 516 | ||
515 | MBOXviewItem::~MBOXviewItem() | 517 | MBOXviewItem::~MBOXviewItem() |
516 | { | 518 | { |
517 | delete wrapper; | 519 | delete wrapper; |
518 | } | 520 | } |
519 | 521 | ||
520 | AbstractMail *MBOXviewItem::getWrapper() | 522 | AbstractMail *MBOXviewItem::getWrapper() |
521 | { | 523 | { |
522 | return wrapper; | 524 | return wrapper; |
523 | } | 525 | } |
524 | 526 | ||
525 | void MBOXviewItem::refresh( QList<RecMail> & ) | 527 | void MBOXviewItem::refresh( QList<RecMail> & ) |
526 | { | 528 | { |
527 | refresh(false); | 529 | refresh(false); |
528 | } | 530 | } |
529 | 531 | ||
530 | void MBOXviewItem::refresh(bool force) | 532 | void MBOXviewItem::refresh(bool force) |
531 | { | 533 | { |
532 | if (childCount()>0 && force==false) return; | 534 | if (childCount()>0 && force==false) return; |
533 | QList<Folder> *folders = wrapper->listFolders(); | 535 | QList<Folder> *folders = wrapper->listFolders(); |
534 | QListViewItem *child = firstChild(); | 536 | QListViewItem *child = firstChild(); |
535 | while ( child ) { | 537 | while ( child ) { |
536 | QListViewItem *tmp = child; | 538 | QListViewItem *tmp = child; |
537 | child = child->nextSibling(); | 539 | child = child->nextSibling(); |
538 | delete tmp; | 540 | delete tmp; |
539 | } | 541 | } |
540 | Folder *it; | 542 | Folder *it; |
541 | QListViewItem*item = 0; | 543 | QListViewItem*item = 0; |
542 | for ( it = folders->first(); it; it = folders->next() ) { | 544 | for ( it = folders->first(); it; it = folders->next() ) { |
543 | item = new MBOXfolderItem( it, this , item ); | 545 | item = new MBOXfolderItem( it, this , item ); |
544 | item->setSelectable(it->may_select()); | 546 | item->setSelectable(it->may_select()); |
545 | } | 547 | } |
546 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 548 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
547 | folders->setAutoDelete(false); | 549 | folders->setAutoDelete(false); |
548 | delete folders; | 550 | delete folders; |
549 | } | 551 | } |
550 | 552 | ||
551 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) | 553 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) |
552 | { | 554 | { |
553 | qDebug( "MBOX fetchBody" ); | 555 | qDebug( "MBOX fetchBody" ); |
554 | return wrapper->fetchBody( mail ); | 556 | return wrapper->fetchBody( mail ); |
555 | } | 557 | } |
556 | 558 | ||
557 | QPopupMenu * MBOXviewItem::getContextMenu() | 559 | QPopupMenu * MBOXviewItem::getContextMenu() |
558 | { | 560 | { |
559 | QPopupMenu *m = new QPopupMenu(0); | 561 | QPopupMenu *m = new QPopupMenu(0); |
560 | if (m) { | 562 | if (m) { |
561 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 563 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
562 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 564 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
563 | } | 565 | } |
564 | return m; | 566 | return m; |
565 | } | 567 | } |
566 | 568 | ||
567 | void MBOXviewItem::createFolder() | 569 | void MBOXviewItem::createFolder() |
568 | { | 570 | { |
569 | Newmdirdlg ndirdlg(0,0,true); | 571 | Newmdirdlg ndirdlg(0,0,true); |
570 | ndirdlg.showMaximized(); | 572 | ndirdlg.showMaximized(); |
571 | if (ndirdlg.exec()) { | 573 | if (ndirdlg.exec()) { |
572 | QString ndir = ndirdlg.Newdir(); | 574 | QString ndir = ndirdlg.Newdir(); |
573 | if (wrapper->createMbox(ndir)) { | 575 | if (wrapper->createMbox(ndir)) { |
574 | refresh(true); | 576 | refresh(true); |
575 | } | 577 | } |
576 | } | 578 | } |
577 | } | 579 | } |
578 | 580 | ||
579 | void MBOXviewItem::contextMenuSelected(int which) | 581 | void MBOXviewItem::contextMenuSelected(int which) |
580 | { | 582 | { |
581 | switch (which) { | 583 | switch (which) { |
582 | case 0: | 584 | case 0: |
583 | refresh(true); | 585 | refresh(true); |
584 | break; | 586 | break; |
585 | case 1: | 587 | case 1: |
586 | createFolder(); | 588 | createFolder(); |
587 | break; | 589 | break; |
588 | default: | 590 | default: |
589 | break; | 591 | break; |
590 | } | 592 | } |
591 | } | 593 | } |
592 | 594 | ||
593 | MBOXfolderItem::~MBOXfolderItem() | 595 | MBOXfolderItem::~MBOXfolderItem() |
594 | { | 596 | { |
595 | delete folder; | 597 | delete folder; |
596 | } | 598 | } |
597 | 599 | ||
598 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) | 600 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) |
599 | : AccountViewItem( parent,after ) | 601 | : AccountViewItem( parent,after ) |
600 | { | 602 | { |
601 | folder = folderInit; | 603 | folder = folderInit; |
602 | mbox = parent; | 604 | mbox = parent; |
603 | if (folder->getDisplayName().lower() == "outgoing") { | 605 | if (folder->getDisplayName().lower() == "outgoing") { |
604 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 606 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
605 | } else if (folder->getDisplayName().lower() == "inbox") { | 607 | } else if (folder->getDisplayName().lower() == "inbox") { |
606 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 608 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
607 | } else { | 609 | } else { |
608 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 610 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
609 | } | 611 | } |
610 | setText( 0, folder->getDisplayName() ); | 612 | setText( 0, folder->getDisplayName() ); |
611 | } | 613 | } |
612 | 614 | ||
613 | void MBOXfolderItem::refresh(QList<RecMail>&target) | 615 | void MBOXfolderItem::refresh(QList<RecMail>&target) |
614 | { | 616 | { |
615 | if (folder->may_select()) | 617 | if (folder->may_select()) |
616 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 618 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
617 | } | 619 | } |
618 | 620 | ||
619 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) | 621 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) |
620 | { | 622 | { |
621 | return mbox->getWrapper()->fetchBody(aMail); | 623 | return mbox->getWrapper()->fetchBody(aMail); |
622 | } | 624 | } |
623 | 625 | ||
624 | void MBOXfolderItem::deleteFolder() | 626 | void MBOXfolderItem::deleteFolder() |
625 | { | 627 | { |
626 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | 628 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
627 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | 629 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
628 | QObject::tr("Yes",contextName), | 630 | QObject::tr("Yes",contextName), |
629 | QObject::tr("No",contextName),QString::null,1,1); | 631 | QObject::tr("No",contextName),QString::null,1,1); |
630 | qDebug("Auswahl: %i",yesno); | 632 | qDebug("Auswahl: %i",yesno); |
631 | if (yesno == 0) { | 633 | if (yesno == 0) { |
632 | if (mbox->getWrapper()->deleteMbox(folder)) { | 634 | if (mbox->getWrapper()->deleteMbox(folder)) { |
633 | QListView*v=listView(); | 635 | QListView*v=listView(); |
634 | MBOXviewItem * box = mbox; | 636 | MBOXviewItem * box = mbox; |
635 | /* be carefull - after that this object is destroyd so don't use | 637 | /* be carefull - after that this object is destroyd so don't use |
636 | * any member of it after that call!!*/ | 638 | * any member of it after that call!!*/ |
637 | mbox->refresh(true); | 639 | mbox->refresh(true); |
638 | if (v) { | 640 | if (v) { |
639 | v->setSelected(box,true); | 641 | v->setSelected(box,true); |
640 | } | 642 | } |
641 | } | 643 | } |
642 | } | 644 | } |
643 | } | 645 | } |
644 | 646 | ||
645 | QPopupMenu * MBOXfolderItem::getContextMenu() | 647 | QPopupMenu * MBOXfolderItem::getContextMenu() |
646 | { | 648 | { |
647 | QPopupMenu *m = new QPopupMenu(0); | 649 | QPopupMenu *m = new QPopupMenu(0); |
648 | if (m) { | 650 | if (m) { |
649 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | 651 | m->insertItem(QObject::tr("Delete all mails",contextName),0); |
650 | m->insertItem(QObject::tr("Delete folder",contextName),1); | 652 | m->insertItem(QObject::tr("Delete folder",contextName),1); |
651 | } | 653 | } |
652 | return m; | 654 | return m; |
653 | } | 655 | } |
654 | 656 | ||
655 | void MBOXfolderItem::contextMenuSelected(int which) | 657 | void MBOXfolderItem::contextMenuSelected(int which) |
656 | { | 658 | { |
657 | switch(which) { | 659 | switch(which) { |
658 | case 0: | 660 | case 0: |
659 | deleteAllMail(mbox->getWrapper(),folder); | 661 | deleteAllMail(mbox->getWrapper(),folder); |
660 | break; | 662 | break; |
661 | case 1: | 663 | case 1: |
662 | deleteFolder(); | 664 | deleteFolder(); |
663 | break; | 665 | break; |
664 | default: | 666 | default: |
665 | break; | 667 | break; |
666 | } | 668 | } |
667 | } | 669 | } |