Diffstat (limited to 'noncore/net/mail/accountitem.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/mail/accountitem.cpp | 259 |
1 files changed, 172 insertions, 87 deletions
diff --git a/noncore/net/mail/accountitem.cpp b/noncore/net/mail/accountitem.cpp index 2d3cd4b..c8f6ec4 100644 --- a/noncore/net/mail/accountitem.cpp +++ b/noncore/net/mail/accountitem.cpp | |||
@@ -1,12 +1,18 @@ | |||
1 | |||
1 | #include "accountitem.h" | 2 | #include "accountitem.h" |
2 | #include "accountview.h" | 3 | #include "accountview.h" |
3 | #include <qpopupmenu.h> | ||
4 | #include <qmessagebox.h> | ||
5 | #include "selectstore.h" | 4 | #include "selectstore.h" |
6 | #include "newmaildir.h" | 5 | #include "newmaildir.h" |
6 | #include "defines.h" | ||
7 | |||
8 | /* OPIE */ | ||
7 | #include <libmailwrapper/mailtypes.h> | 9 | #include <libmailwrapper/mailtypes.h> |
8 | #include <libmailwrapper/abstractmail.h> | 10 | #include <libmailwrapper/abstractmail.h> |
9 | #include <libmailwrapper/mailwrapper.h> | 11 | #include <libmailwrapper/mailwrapper.h> |
10 | #include "defines.h" | 12 | #include <qpe/qpeapplication.h> |
13 | |||
14 | /* QT */ | ||
15 | #include <qpopupmenu.h> | ||
16 | #include <qmessagebox.h> | ||
11 | 17 | ||
12 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} | 18 | #define SETPIX(x) if (!account->getOffline()) {setPixmap( 0,x);} else {setPixmap( 0, PIXMAP_OFFLINE );} |
@@ -21,7 +27,10 @@ POP3viewItem::POP3viewItem( POP3account *a, AccountView *parent ) | |||
21 | SETPIX(PIXMAP_POP3FOLDER); | 27 | SETPIX(PIXMAP_POP3FOLDER); |
22 | #if 0 | 28 | #if 0 |
23 | if (!account->getOffline()) { | 29 | if (!account->getOffline()) |
30 | { | ||
24 | setPixmap( 0, ); | 31 | setPixmap( 0, ); |
25 | } else { | 32 | } |
33 | else | ||
34 | { | ||
26 | setPixmap( 0, PIXMAP_OFFLINE ); | 35 | setPixmap( 0, PIXMAP_OFFLINE ); |
27 | } | 36 | } |
@@ -51,5 +60,6 @@ void POP3viewItem::refresh() | |||
51 | QList<Folder> *folders = wrapper->listFolders(); | 60 | QList<Folder> *folders = wrapper->listFolders(); |
52 | QListViewItem *child = firstChild(); | 61 | QListViewItem *child = firstChild(); |
53 | while ( child ) { | 62 | while ( child ) |
63 | { | ||
54 | QListViewItem *tmp = child; | 64 | QListViewItem *tmp = child; |
55 | child = child->nextSibling(); | 65 | child = child->nextSibling(); |
@@ -58,5 +68,6 @@ void POP3viewItem::refresh() | |||
58 | Folder *it; | 68 | Folder *it; |
59 | QListViewItem*item = 0; | 69 | QListViewItem*item = 0; |
60 | for ( it = folders->first(); it; it = folders->next() ) { | 70 | for ( it = folders->first(); it; it = folders->next() ) |
71 | { | ||
61 | item = new POP3folderItem( it, this , item ); | 72 | item = new POP3folderItem( it, this , item ); |
62 | item->setSelectable(it->may_select()); | 73 | item->setSelectable(it->may_select()); |
@@ -76,9 +87,13 @@ QPopupMenu * POP3viewItem::getContextMenu() | |||
76 | { | 87 | { |
77 | QPopupMenu *m = new QPopupMenu(0); | 88 | QPopupMenu *m = new QPopupMenu(0); |
78 | if (m) { | 89 | if (m) |
79 | if (!account->getOffline()) { | 90 | { |
91 | if (!account->getOffline()) | ||
92 | { | ||
80 | m->insertItem(QObject::tr("Disconnect",contextName),0); | 93 | m->insertItem(QObject::tr("Disconnect",contextName),0); |
81 | m->insertItem(QObject::tr("Set offline",contextName),1); | 94 | m->insertItem(QObject::tr("Set offline",contextName),1); |
82 | } else { | 95 | } |
96 | else | ||
97 | { | ||
83 | m->insertItem(QObject::tr("Set online",contextName),1); | 98 | m->insertItem(QObject::tr("Set online",contextName),1); |
84 | } | 99 | } |
@@ -90,5 +105,6 @@ void POP3viewItem::disconnect() | |||
90 | { | 105 | { |
91 | QListViewItem *child = firstChild(); | 106 | QListViewItem *child = firstChild(); |
92 | while ( child ) { | 107 | while ( child ) |
108 | { | ||
93 | QListViewItem *tmp = child; | 109 | QListViewItem *tmp = child; |
94 | child = child->nextSibling(); | 110 | child = child->nextSibling(); |
@@ -100,5 +116,6 @@ void POP3viewItem::disconnect() | |||
100 | void POP3viewItem::setOnOffline() | 116 | void POP3viewItem::setOnOffline() |
101 | { | 117 | { |
102 | if (!account->getOffline()) { | 118 | if (!account->getOffline()) |
119 | { | ||
103 | disconnect(); | 120 | disconnect(); |
104 | } | 121 | } |
@@ -111,5 +128,6 @@ void POP3viewItem::setOnOffline() | |||
111 | void POP3viewItem::contextMenuSelected(int which) | 128 | void POP3viewItem::contextMenuSelected(int which) |
112 | { | 129 | { |
113 | switch (which) { | 130 | switch (which) |
131 | { | ||
114 | case 0: | 132 | case 0: |
115 | disconnect(); | 133 | disconnect(); |
@@ -122,6 +140,5 @@ void POP3viewItem::contextMenuSelected(int which) | |||
122 | 140 | ||
123 | POP3folderItem::~POP3folderItem() | 141 | POP3folderItem::~POP3folderItem() |
124 | { | 142 | {} |
125 | } | ||
126 | 143 | ||
127 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) | 144 | POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QListViewItem*after ) |
@@ -130,7 +147,10 @@ POP3folderItem::POP3folderItem( Folder *folderInit, POP3viewItem *parent , QList | |||
130 | folder = folderInit; | 147 | folder = folderInit; |
131 | pop3 = parent; | 148 | pop3 = parent; |
132 | if (folder->getDisplayName().lower()!="inbox") { | 149 | if (folder->getDisplayName().lower()!="inbox") |
150 | { | ||
133 | setPixmap( 0, PIXMAP_POP3FOLDER ); | 151 | setPixmap( 0, PIXMAP_POP3FOLDER ); |
134 | } else { | 152 | } |
153 | else | ||
154 | { | ||
135 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 155 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
136 | } | 156 | } |
@@ -152,5 +172,6 @@ QPopupMenu * POP3folderItem::getContextMenu() | |||
152 | { | 172 | { |
153 | QPopupMenu *m = new QPopupMenu(0); | 173 | QPopupMenu *m = new QPopupMenu(0); |
154 | if (m) { | 174 | if (m) |
175 | { | ||
155 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 176 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
156 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 177 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
@@ -170,5 +191,6 @@ void POP3folderItem::contextMenuSelected(int which) | |||
170 | { | 191 | { |
171 | AccountView * view = (AccountView*)listView(); | 192 | AccountView * view = (AccountView*)listView(); |
172 | switch (which) { | 193 | switch (which) |
194 | { | ||
173 | case 0: | 195 | case 0: |
174 | /* must be 'cause pop3 lists are cached */ | 196 | /* must be 'cause pop3 lists are cached */ |
@@ -237,6 +259,8 @@ void IMAPviewItem::refreshFolders(bool force) | |||
237 | folders->setAutoDelete(false); | 259 | folders->setAutoDelete(false); |
238 | 260 | ||
239 | for ( it = folders->first(); it; it = folders->next() ) { | 261 | for ( it = folders->first(); it; it = folders->next() ) |
240 | if (it->getDisplayName().lower()=="inbox") { | 262 | { |
263 | if (it->getDisplayName().lower()=="inbox") | ||
264 | { | ||
241 | item = new IMAPfolderItem( it, this , item ); | 265 | item = new IMAPfolderItem( it, this , item ); |
242 | folders->remove(it); | 266 | folders->remove(it); |
@@ -245,13 +269,16 @@ void IMAPviewItem::refreshFolders(bool force) | |||
245 | } | 269 | } |
246 | } | 270 | } |
247 | for ( it = folders->first(); it; it = folders->next() ) { | 271 | for ( it = folders->first(); it; it = folders->next() ) |
272 | { | ||
248 | fname = it->getDisplayName(); | 273 | fname = it->getDisplayName(); |
249 | currentFolders.append(it->getName()); | 274 | currentFolders.append(it->getName()); |
250 | pos = fname.findRev(it->Separator()); | 275 | pos = fname.findRev(it->Separator()); |
251 | if (pos != -1) { | 276 | if (pos != -1) |
277 | { | ||
252 | fname = fname.left(pos); | 278 | fname = fname.left(pos); |
253 | } | 279 | } |
254 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 280 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
255 | if (pitem) { | 281 | if (pitem) |
282 | { | ||
256 | titem = item; | 283 | titem = item; |
257 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); | 284 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
@@ -259,5 +286,7 @@ void IMAPviewItem::refreshFolders(bool force) | |||
259 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | 286 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); |
260 | item = titem; | 287 | item = titem; |
261 | } else { | 288 | } |
289 | else | ||
290 | { | ||
262 | item = new IMAPfolderItem( it, this , item ); | 291 | item = new IMAPfolderItem( it, this , item ); |
263 | } | 292 | } |
@@ -269,6 +298,8 @@ QPopupMenu * IMAPviewItem::getContextMenu() | |||
269 | { | 298 | { |
270 | QPopupMenu *m = new QPopupMenu(0); | 299 | QPopupMenu *m = new QPopupMenu(0); |
271 | if (m) { | 300 | if (m) |
272 | if (!account->getOffline()) { | 301 | { |
302 | if (!account->getOffline()) | ||
303 | { | ||
273 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 304 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
274 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 305 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
@@ -276,5 +307,7 @@ QPopupMenu * IMAPviewItem::getContextMenu() | |||
276 | m->insertItem(QObject::tr("Disconnect",contextName),2); | 307 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
277 | m->insertItem(QObject::tr("Set offline",contextName),3); | 308 | m->insertItem(QObject::tr("Set offline",contextName),3); |
278 | } else { | 309 | } |
310 | else | ||
311 | { | ||
279 | m->insertItem(QObject::tr("Set online",contextName),3); | 312 | m->insertItem(QObject::tr("Set online",contextName),3); |
280 | } | 313 | } |
@@ -286,14 +319,16 @@ void IMAPviewItem::createNewFolder() | |||
286 | { | 319 | { |
287 | Newmdirdlg ndirdlg; | 320 | Newmdirdlg ndirdlg; |
288 | ndirdlg.showMaximized(); | 321 | if ( QPEApplication::execDialog( &ndirdlg )) |
289 | if (ndirdlg.exec()) { | 322 | { |
290 | QString ndir = ndirdlg.Newdir(); | 323 | QString ndir = ndirdlg.Newdir(); |
291 | bool makesubs = ndirdlg.subpossible(); | 324 | bool makesubs = ndirdlg.subpossible(); |
292 | QString delemiter = "/"; | 325 | QString delemiter = "/"; |
293 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 326 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
294 | if (item) { | 327 | if (item) |
328 | { | ||
295 | delemiter = item->Delemiter(); | 329 | delemiter = item->Delemiter(); |
296 | } | 330 | } |
297 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { | 331 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
332 | { | ||
298 | refreshFolders(true); | 333 | refreshFolders(true); |
299 | } | 334 | } |
@@ -304,5 +339,6 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
304 | { | 339 | { |
305 | qDebug("Id selected: %i",id); | 340 | qDebug("Id selected: %i",id); |
306 | switch (id) { | 341 | switch (id) |
342 | { | ||
307 | case 0: | 343 | case 0: |
308 | refreshFolders(true); | 344 | refreshFolders(true); |
@@ -316,5 +352,6 @@ void IMAPviewItem::contextMenuSelected(int id) | |||
316 | break; | 352 | break; |
317 | case 3: | 353 | case 3: |
318 | if (account->getOffline()==false) { | 354 | if (account->getOffline()==false) |
355 | { | ||
319 | removeChilds(); | 356 | removeChilds(); |
320 | wrapper->logout(); | 357 | wrapper->logout(); |
@@ -345,7 +382,10 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPviewItem *parent , QList | |||
345 | folder = folderInit; | 382 | folder = folderInit; |
346 | imap = parent; | 383 | imap = parent; |
347 | if (folder->getDisplayName().lower()!="inbox") { | 384 | if (folder->getDisplayName().lower()!="inbox") |
385 | { | ||
348 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 386 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
349 | } else { | 387 | } |
388 | else | ||
389 | { | ||
350 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 390 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
351 | } | 391 | } |
@@ -358,7 +398,10 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi | |||
358 | folder = folderInit; | 398 | folder = folderInit; |
359 | imap = master; | 399 | imap = master; |
360 | if (folder->getDisplayName().lower()!="inbox") { | 400 | if (folder->getDisplayName().lower()!="inbox") |
401 | { | ||
361 | setPixmap( 0, PIXMAP_IMAPFOLDER ); | 402 | setPixmap( 0, PIXMAP_IMAPFOLDER ); |
362 | } else { | 403 | } |
404 | else | ||
405 | { | ||
363 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 406 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
364 | } | 407 | } |
@@ -367,6 +410,5 @@ IMAPfolderItem::IMAPfolderItem( Folder *folderInit, IMAPfolderItem *parent , QLi | |||
367 | 410 | ||
368 | IMAPfolderItem::~IMAPfolderItem() | 411 | IMAPfolderItem::~IMAPfolderItem() |
369 | { | 412 | {} |
370 | } | ||
371 | 413 | ||
372 | const QString& IMAPfolderItem::Delemiter()const | 414 | const QString& IMAPfolderItem::Delemiter()const |
@@ -377,7 +419,10 @@ const QString& IMAPfolderItem::Delemiter()const | |||
377 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 419 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
378 | { | 420 | { |
379 | if (folder->may_select()) { | 421 | if (folder->may_select()) |
422 | { | ||
380 | imap->getWrapper()->listMessages( folder->getName(),target ); | 423 | imap->getWrapper()->listMessages( folder->getName(),target ); |
381 | } else { | 424 | } |
425 | else | ||
426 | { | ||
382 | target.clear(); | 427 | target.clear(); |
383 | } | 428 | } |
@@ -392,14 +437,18 @@ QPopupMenu * IMAPfolderItem::getContextMenu() | |||
392 | { | 437 | { |
393 | QPopupMenu *m = new QPopupMenu(0); | 438 | QPopupMenu *m = new QPopupMenu(0); |
394 | if (m) { | 439 | if (m) |
395 | if (folder->may_select()) { | 440 | { |
441 | if (folder->may_select()) | ||
442 | { | ||
396 | m->insertItem(QObject::tr("Refresh header list",contextName),0); | 443 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
397 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); | 444 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),4); |
398 | m->insertItem(QObject::tr("Delete all mails",contextName),1); | 445 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
399 | } | 446 | } |
400 | if (folder->no_inferior()==false) { | 447 | if (folder->no_inferior()==false) |
448 | { | ||
401 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); | 449 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
402 | } | 450 | } |
403 | if (folder->getDisplayName().lower()!="inbox") { | 451 | if (folder->getDisplayName().lower()!="inbox") |
452 | { | ||
404 | m->insertItem(QObject::tr("Delete folder",contextName),3); | 453 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
405 | } | 454 | } |
@@ -411,10 +460,11 @@ void IMAPfolderItem::createNewFolder() | |||
411 | { | 460 | { |
412 | Newmdirdlg ndirdlg; | 461 | Newmdirdlg ndirdlg; |
413 | ndirdlg.showMaximized(); | 462 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
414 | if (ndirdlg.exec()) { | 463 | { |
415 | QString ndir = ndirdlg.Newdir(); | 464 | QString ndir = ndirdlg.Newdir(); |
416 | bool makesubs = ndirdlg.subpossible(); | 465 | bool makesubs = ndirdlg.subpossible(); |
417 | QString delemiter = Delemiter(); | 466 | QString delemiter = Delemiter(); |
418 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) { | 467 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
468 | { | ||
419 | imap->refreshFolders(true); | 469 | imap->refreshFolders(true); |
420 | } | 470 | } |
@@ -429,6 +479,8 @@ void IMAPfolderItem::deleteFolder() | |||
429 | QObject::tr("No",contextName),QString::null,1,1); | 479 | QObject::tr("No",contextName),QString::null,1,1); |
430 | qDebug("Auswahl: %i",yesno); | 480 | qDebug("Auswahl: %i",yesno); |
431 | if (yesno == 0) { | 481 | if (yesno == 0) |
432 | if (imap->getWrapper()->deleteMbox(folder)) { | 482 | { |
483 | if (imap->getWrapper()->deleteMbox(folder)) | ||
484 | { | ||
433 | QListView*v=listView(); | 485 | QListView*v=listView(); |
434 | IMAPviewItem * box = imap; | 486 | IMAPviewItem * box = imap; |
@@ -436,5 +488,6 @@ void IMAPfolderItem::deleteFolder() | |||
436 | * any member of it after that call!!*/ | 488 | * any member of it after that call!!*/ |
437 | imap->refreshFolders(true); | 489 | imap->refreshFolders(true); |
438 | if (v) { | 490 | if (v) |
491 | { | ||
439 | v->setSelected(box,true); | 492 | v->setSelected(box,true); |
440 | } | 493 | } |
@@ -454,5 +507,6 @@ void IMAPfolderItem::contextMenuSelected(int id) | |||
454 | qDebug("Selected id: %i",id); | 507 | qDebug("Selected id: %i",id); |
455 | AccountView * view = (AccountView*)listView(); | 508 | AccountView * view = (AccountView*)listView(); |
456 | switch(id) { | 509 | switch(id) |
510 | { | ||
457 | case 0: | 511 | case 0: |
458 | view->refreshCurrent(); | 512 | view->refreshCurrent(); |
@@ -519,8 +573,10 @@ void MHviewItem::refresh(bool force) | |||
519 | QString fname = ""; | 573 | QString fname = ""; |
520 | int pos; | 574 | int pos; |
521 | for ( it = folders->first(); it; it = folders->next() ) { | 575 | for ( it = folders->first(); it; it = folders->next() ) |
576 | { | ||
522 | fname = it->getDisplayName(); | 577 | fname = it->getDisplayName(); |
523 | /* this folder itself */ | 578 | /* this folder itself */ |
524 | if (fname=="/") { | 579 | if (fname=="/") |
580 | { | ||
525 | currentFolders.append(fname); | 581 | currentFolders.append(fname); |
526 | folder = it; | 582 | folder = it; |
@@ -529,13 +585,19 @@ void MHviewItem::refresh(bool force) | |||
529 | currentFolders.append(fname); | 585 | currentFolders.append(fname); |
530 | pos = fname.findRev("/"); | 586 | pos = fname.findRev("/"); |
531 | if (pos > 0) { | 587 | if (pos > 0) |
588 | { | ||
532 | fname = fname.left(pos); | 589 | fname = fname.left(pos); |
533 | pmaster = (MHfolderItem*)findSubItem(fname); | 590 | pmaster = (MHfolderItem*)findSubItem(fname); |
534 | } else { | 591 | } |
592 | else | ||
593 | { | ||
535 | pmaster = 0; | 594 | pmaster = 0; |
536 | } | 595 | } |
537 | if (pmaster) { | 596 | if (pmaster) |
597 | { | ||
538 | item = new MHfolderItem( it, pmaster, item, this ); | 598 | item = new MHfolderItem( it, pmaster, item, this ); |
539 | } else { | 599 | } |
600 | else | ||
601 | { | ||
540 | item = new MHfolderItem( it, this , item ); | 602 | item = new MHfolderItem( it, this , item ); |
541 | } | 603 | } |
@@ -556,5 +618,6 @@ QPopupMenu * MHviewItem::getContextMenu() | |||
556 | { | 618 | { |
557 | QPopupMenu *m = new QPopupMenu(0); | 619 | QPopupMenu *m = new QPopupMenu(0); |
558 | if (m) { | 620 | if (m) |
621 | { | ||
559 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | 622 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
560 | m->insertItem(QObject::tr("Create new folder",contextName),1); | 623 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
@@ -568,8 +631,9 @@ void MHviewItem::createFolder() | |||
568 | { | 631 | { |
569 | Newmdirdlg ndirdlg(0,0,true); | 632 | Newmdirdlg ndirdlg(0,0,true); |
570 | ndirdlg.showMaximized(); | 633 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
571 | if (ndirdlg.exec()) { | 634 | { |
572 | QString ndir = ndirdlg.Newdir(); | 635 | QString ndir = ndirdlg.Newdir(); |
573 | if (wrapper->createMbox(ndir)) { | 636 | if (wrapper->createMbox(ndir)) |
637 | { | ||
574 | refresh(true); | 638 | refresh(true); |
575 | } | 639 | } |
@@ -591,5 +655,6 @@ QStringList MHviewItem::subFolders() | |||
591 | void MHviewItem::contextMenuSelected(int which) | 655 | void MHviewItem::contextMenuSelected(int which) |
592 | { | 656 | { |
593 | switch (which) { | 657 | switch (which) |
658 | { | ||
594 | case 0: | 659 | case 0: |
595 | refresh(true); | 660 | refresh(true); |
@@ -610,6 +675,5 @@ void MHviewItem::contextMenuSelected(int which) | |||
610 | 675 | ||
611 | MHfolderItem::~MHfolderItem() | 676 | MHfolderItem::~MHfolderItem() |
612 | { | 677 | {} |
613 | } | ||
614 | 678 | ||
615 | MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) | 679 | MHfolderItem::MHfolderItem( Folder *folderInit, MHviewItem *parent , QListViewItem*after ) |
@@ -632,16 +696,23 @@ void MHfolderItem::initName() | |||
632 | { | 696 | { |
633 | QString bName = folder->getDisplayName(); | 697 | QString bName = folder->getDisplayName(); |
634 | if (bName.startsWith("/")&&bName.length()>1) { | 698 | if (bName.startsWith("/")&&bName.length()>1) |
699 | { | ||
635 | bName.replace(0,1,""); | 700 | bName.replace(0,1,""); |
636 | } | 701 | } |
637 | int pos = bName.findRev("/"); | 702 | int pos = bName.findRev("/"); |
638 | if (pos > 0) { | 703 | if (pos > 0) |
704 | { | ||
639 | bName.replace(0,pos+1,""); | 705 | bName.replace(0,pos+1,""); |
640 | } | 706 | } |
641 | if (bName.lower() == "outgoing") { | 707 | if (bName.lower() == "outgoing") |
708 | { | ||
642 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 709 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
643 | } else if (bName.lower() == "inbox") { | 710 | } |
711 | else if (bName.lower() == "inbox") | ||
712 | { | ||
644 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 713 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
645 | } else { | 714 | } |
715 | else | ||
716 | { | ||
646 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 717 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
647 | } | 718 | } |
@@ -672,6 +743,8 @@ void MHfolderItem::deleteFolder() | |||
672 | QObject::tr("No",contextName),QString::null,1,1); | 743 | QObject::tr("No",contextName),QString::null,1,1); |
673 | qDebug("Auswahl: %i",yesno); | 744 | qDebug("Auswahl: %i",yesno); |
674 | if (yesno == 0) { | 745 | if (yesno == 0) |
675 | if (mbox->getWrapper()->deleteMbox(folder)) { | 746 | { |
747 | if (mbox->getWrapper()->deleteMbox(folder)) | ||
748 | { | ||
676 | QListView*v=listView(); | 749 | QListView*v=listView(); |
677 | MHviewItem * box = mbox; | 750 | MHviewItem * box = mbox; |
@@ -679,5 +752,6 @@ void MHfolderItem::deleteFolder() | |||
679 | * any member of it after that call!!*/ | 752 | * any member of it after that call!!*/ |
680 | mbox->refresh(true); | 753 | mbox->refresh(true); |
681 | if (v) { | 754 | if (v) |
755 | { | ||
682 | v->setSelected(box,true); | 756 | v->setSelected(box,true); |
683 | } | 757 | } |
@@ -689,5 +763,6 @@ QPopupMenu * MHfolderItem::getContextMenu() | |||
689 | { | 763 | { |
690 | QPopupMenu *m = new QPopupMenu(0); | 764 | QPopupMenu *m = new QPopupMenu(0); |
691 | if (m) { | 765 | if (m) |
766 | { | ||
692 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); | 767 | m->insertItem(QObject::tr("Move/Copie all mails",contextName),2); |
693 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | 768 | m->insertItem(QObject::tr("Delete all mails",contextName),0); |
@@ -708,8 +783,9 @@ void MHfolderItem::createFolder() | |||
708 | { | 783 | { |
709 | Newmdirdlg ndirdlg(0,0,true); | 784 | Newmdirdlg ndirdlg(0,0,true); |
710 | ndirdlg.showMaximized(); | 785 | if ( QPEApplication::execDialog( &ndirdlg ) ) |
711 | if (ndirdlg.exec()) { | 786 | { |
712 | QString ndir = ndirdlg.Newdir(); | 787 | QString ndir = ndirdlg.Newdir(); |
713 | if (mbox->getWrapper()->createMbox(ndir,folder)) { | 788 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
789 | { | ||
714 | QListView*v=listView(); | 790 | QListView*v=listView(); |
715 | MHviewItem * box = mbox; | 791 | MHviewItem * box = mbox; |
@@ -717,5 +793,6 @@ void MHfolderItem::createFolder() | |||
717 | * any member of it after that call!!*/ | 793 | * any member of it after that call!!*/ |
718 | mbox->refresh(true); | 794 | mbox->refresh(true); |
719 | if (v) { | 795 | if (v) |
796 | { | ||
720 | v->setSelected(box,true); | 797 | v->setSelected(box,true); |
721 | } | 798 | } |
@@ -726,5 +803,6 @@ void MHfolderItem::createFolder() | |||
726 | void MHfolderItem::contextMenuSelected(int which) | 803 | void MHfolderItem::contextMenuSelected(int which) |
727 | { | 804 | { |
728 | switch(which) { | 805 | switch(which) |
806 | { | ||
729 | case 0: | 807 | case 0: |
730 | deleteAllMail(mbox->getWrapper(),folder); | 808 | deleteAllMail(mbox->getWrapper(),folder); |
@@ -796,6 +874,8 @@ void AccountViewItem::deleteAllMail(AbstractMail*wrapper,Folder*folder) | |||
796 | QObject::tr("No",contextName),QString::null,1,1); | 874 | QObject::tr("No",contextName),QString::null,1,1); |
797 | qDebug("Auswahl: %i",yesno); | 875 | qDebug("Auswahl: %i",yesno); |
798 | if (yesno == 0) { | 876 | if (yesno == 0) |
799 | if (wrapper->deleteAllMail(folder)) { | 877 | { |
878 | if (wrapper->deleteAllMail(folder)) | ||
879 | { | ||
800 | AccountView * view = (AccountView*)listView(); | 880 | AccountView * view = (AccountView*)listView(); |
801 | if (view) view->refreshCurrent(); | 881 | if (view) view->refreshCurrent(); |
@@ -807,5 +887,6 @@ void AccountViewItem::removeChilds() | |||
807 | { | 887 | { |
808 | QListViewItem *child = firstChild(); | 888 | QListViewItem *child = firstChild(); |
809 | while ( child ) { | 889 | while ( child ) |
890 | { | ||
810 | QListViewItem *tmp = child; | 891 | QListViewItem *tmp = child; |
811 | child = child->nextSibling(); | 892 | child = child->nextSibling(); |
@@ -826,11 +907,15 @@ AccountViewItem*AccountViewItem::findSubItem(const QString&path,AccountViewItem* | |||
826 | if (!start) pitem = (AccountViewItem*)firstChild(); | 907 | if (!start) pitem = (AccountViewItem*)firstChild(); |
827 | else pitem = (AccountViewItem*)start->firstChild(); | 908 | else pitem = (AccountViewItem*)start->firstChild(); |
828 | while (pitem) { | 909 | while (pitem) |
829 | if (pitem->matchName(path)) { | 910 | { |
911 | if (pitem->matchName(path)) | ||
912 | { | ||
830 | break; | 913 | break; |
831 | } | 914 | } |
832 | if (pitem->childCount()>0) { | 915 | if (pitem->childCount()>0) |
916 | { | ||
833 | sitem = findSubItem(path,pitem); | 917 | sitem = findSubItem(path,pitem); |
834 | if (sitem) { | 918 | if (sitem) |
919 | { | ||
835 | pitem = sitem; | 920 | pitem = sitem; |
836 | break; | 921 | break; |