Diffstat (limited to 'noncore/net/mail/accountview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/net/mail/accountview.cpp | 143 |
1 files changed, 126 insertions, 17 deletions
diff --git a/noncore/net/mail/accountview.cpp b/noncore/net/mail/accountview.cpp index 8aac14b..30765cf 100644 --- a/noncore/net/mail/accountview.cpp +++ b/noncore/net/mail/accountview.cpp | |||
@@ -164,52 +164,52 @@ void IMAPviewItem::refreshFolders(bool force) | |||
164 | for ( it = folders->first(); it; it = folders->next() ) { | 164 | for ( it = folders->first(); it; it = folders->next() ) { |
165 | fname = it->getDisplayName(); | 165 | fname = it->getDisplayName(); |
166 | pos = fname.findRev(it->Separator()); | 166 | pos = fname.findRev(it->Separator()); |
167 | if (pos != -1) { | 167 | if (pos != -1) { |
168 | fname = fname.left(pos); | 168 | fname = fname.left(pos); |
169 | } | 169 | } |
170 | IMAPfolderItem*pitem = findSubItem(fname); | 170 | IMAPfolderItem*pitem = findSubItem(fname); |
171 | if (pitem) { | 171 | if (pitem) { |
172 | titem = item; | 172 | titem = item; |
173 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); | 173 | item = new IMAPfolderItem(it,pitem,pitem->firstChild(),this); |
174 | /* setup the short name */ | 174 | /* setup the short name */ |
175 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); | 175 | item->setText(0,it->getDisplayName().right(it->getDisplayName().length()-pos-1)); |
176 | item = titem; | 176 | item = titem; |
177 | } else { | 177 | } else { |
178 | item = new IMAPfolderItem( it, this , item ); | 178 | item = new IMAPfolderItem( it, this , item ); |
179 | } | 179 | } |
180 | } | 180 | } |
181 | delete folders; | 181 | delete folders; |
182 | } | 182 | } |
183 | 183 | ||
184 | QPopupMenu * IMAPviewItem::getContextMenu() | 184 | QPopupMenu * IMAPviewItem::getContextMenu() |
185 | { | 185 | { |
186 | QPopupMenu *m = new QPopupMenu(0); | 186 | QPopupMenu *m = new QPopupMenu(0); |
187 | if (m) { | 187 | if (m) { |
188 | m->insertItem(QObject::tr("Refresh folder list","IMAPviewItem"),0); | 188 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); |
189 | m->insertItem(QObject::tr("Create new folder","IMAPviewItem"),1); | 189 | m->insertItem(QObject::tr("Create new folder",contextName),1); |
190 | m->insertSeparator(); | 190 | m->insertSeparator(); |
191 | m->insertItem(QObject::tr("Disconnect","IMAPviewItem"),2); | 191 | m->insertItem(QObject::tr("Disconnect",contextName),2); |
192 | } | 192 | } |
193 | return m; | 193 | return m; |
194 | } | 194 | } |
195 | 195 | ||
196 | void IMAPviewItem::createNewFolder() | 196 | void IMAPviewItem::createNewFolder() |
197 | { | 197 | { |
198 | Newmdirdlg ndirdlg; | 198 | Newmdirdlg ndirdlg; |
199 | ndirdlg.showMaximized(); | 199 | ndirdlg.showMaximized(); |
200 | if (ndirdlg.exec()) { | 200 | if (ndirdlg.exec()) { |
201 | QString ndir = ndirdlg.Newdir(); | 201 | QString ndir = ndirdlg.Newdir(); |
202 | bool makesubs = ndirdlg.subpossible(); | 202 | bool makesubs = ndirdlg.subpossible(); |
203 | QString delemiter = "/"; | 203 | QString delemiter = "/"; |
204 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 204 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
205 | if (item) { | 205 | if (item) { |
206 | delemiter = item->Delemiter(); | 206 | delemiter = item->Delemiter(); |
207 | } | 207 | } |
208 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { | 208 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) { |
209 | refreshFolders(true); | 209 | refreshFolders(true); |
210 | } | 210 | } |
211 | } | 211 | } |
212 | } | 212 | } |
213 | 213 | ||
214 | void IMAPviewItem::contextMenuSelected(int id) | 214 | void IMAPviewItem::contextMenuSelected(int id) |
215 | { | 215 | { |
@@ -270,132 +270,139 @@ const QString& IMAPfolderItem::Delemiter()const | |||
270 | bool IMAPfolderItem::matchName(const QString&name)const | 270 | bool IMAPfolderItem::matchName(const QString&name)const |
271 | { | 271 | { |
272 | return folder->getDisplayName()==name; | 272 | return folder->getDisplayName()==name; |
273 | } | 273 | } |
274 | 274 | ||
275 | void IMAPfolderItem::refresh(QList<RecMail>&target) | 275 | void IMAPfolderItem::refresh(QList<RecMail>&target) |
276 | { | 276 | { |
277 | if (folder->may_select()) { | 277 | if (folder->may_select()) { |
278 | imap->getWrapper()->listMessages( folder->getName(),target ); | 278 | imap->getWrapper()->listMessages( folder->getName(),target ); |
279 | } else { | 279 | } else { |
280 | target.clear(); | 280 | target.clear(); |
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) | 284 | RecBody IMAPfolderItem::fetchBody(const RecMail&aMail) |
285 | { | 285 | { |
286 | return imap->getWrapper()->fetchBody(aMail); | 286 | return imap->getWrapper()->fetchBody(aMail); |
287 | } | 287 | } |
288 | 288 | ||
289 | QPopupMenu * IMAPfolderItem::getContextMenu() | 289 | QPopupMenu * IMAPfolderItem::getContextMenu() |
290 | { | 290 | { |
291 | QPopupMenu *m = new QPopupMenu(0); | 291 | QPopupMenu *m = new QPopupMenu(0); |
292 | if (m) { | 292 | if (m) { |
293 | if (folder->may_select()) { | 293 | if (folder->may_select()) { |
294 | m->insertItem(QObject::tr("Refresh header list","IMAPfolderItem"),0); | 294 | m->insertItem(QObject::tr("Refresh header list",contextName),0); |
295 | m->insertItem(QObject::tr("Delete all mails","IMAPfolderItem"),1); | 295 | m->insertItem(QObject::tr("Delete all mails",contextName),1); |
296 | } | 296 | } |
297 | if (folder->no_inferior()==false) { | 297 | if (folder->no_inferior()==false) { |
298 | m->insertItem(QObject::tr("Create new subfolder","IMAPfolderItem"),2); | 298 | m->insertItem(QObject::tr("Create new subfolder",contextName),2); |
299 | } | 299 | } |
300 | if (folder->getDisplayName().lower()!="inbox") { | 300 | if (folder->getDisplayName().lower()!="inbox") { |
301 | m->insertItem(QObject::tr("Delete folder","IMAPfolderItem"),3); | 301 | m->insertItem(QObject::tr("Delete folder",contextName),3); |
302 | } | 302 | } |
303 | } | 303 | } |
304 | return m; | 304 | return m; |
305 | } | 305 | } |
306 | 306 | ||
307 | void IMAPfolderItem::deleteAllMails() | 307 | void IMAPfolderItem::deleteAllMails() |
308 | { | 308 | { |
309 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails","IMAPfolderItem"), | 309 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), |
310 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>","IMAPfolderItem").arg(folder->getDisplayName()), | 310 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).arg(folder->getDisplayName()), |
311 | QObject::tr("Yes","IMAPfolderItem"), | 311 | QObject::tr("Yes",contextName), |
312 | QObject::tr("No","IMAPfolderItem"),QString::null,1,1); | 312 | QObject::tr("No",contextName),QString::null,1,1); |
313 | qDebug("Auswahl: %i",yesno); | 313 | qDebug("Auswahl: %i",yesno); |
314 | if (yesno == 0) { | 314 | if (yesno == 0) { |
315 | if (imap->getWrapper()->deleteAllMail(folder)) { | 315 | if (imap->getWrapper()->deleteAllMail(folder)) { |
316 | AccountView * view = (AccountView*)listView(); | 316 | AccountView * view = (AccountView*)listView(); |
317 | if (view) view->refreshCurrent(); | 317 | if (view) view->refreshCurrent(); |
318 | } | 318 | } |
319 | } | 319 | } |
320 | } | 320 | } |
321 | 321 | ||
322 | void IMAPfolderItem::createNewFolder() | 322 | void IMAPfolderItem::createNewFolder() |
323 | { | 323 | { |
324 | Newmdirdlg ndirdlg; | 324 | Newmdirdlg ndirdlg; |
325 | ndirdlg.showMaximized(); | 325 | ndirdlg.showMaximized(); |
326 | if (ndirdlg.exec()) { | 326 | if (ndirdlg.exec()) { |
327 | QString ndir = ndirdlg.Newdir(); | 327 | QString ndir = ndirdlg.Newdir(); |
328 | bool makesubs = ndirdlg.subpossible(); | 328 | bool makesubs = ndirdlg.subpossible(); |
329 | QString delemiter = Delemiter(); | 329 | QString delemiter = Delemiter(); |
330 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) { | 330 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) { |
331 | imap->refreshFolders(true); | 331 | imap->refreshFolders(true); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | } | 334 | } |
335 | 335 | ||
336 | void IMAPfolderItem::deleteFolder() | 336 | void IMAPfolderItem::deleteFolder() |
337 | { | 337 | { |
338 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder","IMAPfolderItem"), | 338 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), |
339 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>","IMAPfolderItem").arg(folder->getDisplayName()), | 339 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), |
340 | QObject::tr("Yes","IMAPfolderItem"), | 340 | QObject::tr("Yes",contextName), |
341 | QObject::tr("No","IMAPfolderItem"),QString::null,1,1); | 341 | QObject::tr("No",contextName),QString::null,1,1); |
342 | qDebug("Auswahl: %i",yesno); | 342 | qDebug("Auswahl: %i",yesno); |
343 | if (yesno == 0) { | 343 | if (yesno == 0) { |
344 | if (imap->getWrapper()->deleteMbox(folder)) { | 344 | if (imap->getWrapper()->deleteMbox(folder)) { |
345 | /* be carefull - after that this object is destroyd so don't call | 345 | QListView*v=listView(); |
346 | IMAPviewItem * box = imap; | ||
347 | /* be carefull - after that this object is destroyd so don't use | ||
346 | * any member of it after that call!!*/ | 348 | * any member of it after that call!!*/ |
347 | imap->refreshFolders(true); | 349 | imap->refreshFolders(true); |
350 | if (v) { | ||
351 | v->setSelected(box,true); | ||
352 | } | ||
348 | } | 353 | } |
349 | } | 354 | } |
350 | } | 355 | } |
351 | 356 | ||
352 | void IMAPfolderItem::contextMenuSelected(int id) | 357 | void IMAPfolderItem::contextMenuSelected(int id) |
353 | { | 358 | { |
354 | qDebug("Selected id: %i",id); | 359 | qDebug("Selected id: %i",id); |
355 | AccountView * view = (AccountView*)listView(); | 360 | AccountView * view = (AccountView*)listView(); |
356 | switch(id) { | 361 | switch(id) { |
357 | case 0: | 362 | case 0: |
358 | view->refreshCurrent(); | 363 | view->refreshCurrent(); |
359 | break; | 364 | break; |
360 | case 1: | 365 | case 1: |
361 | deleteAllMails(); | 366 | deleteAllMails(); |
362 | break; | 367 | break; |
363 | case 2: | 368 | case 2: |
364 | createNewFolder(); | 369 | createNewFolder(); |
365 | break; | 370 | break; |
366 | case 3: | 371 | case 3: |
367 | deleteFolder(); | 372 | deleteFolder(); |
368 | break; | 373 | break; |
369 | default: | 374 | default: |
370 | break; | 375 | break; |
371 | } | 376 | } |
372 | } | 377 | } |
373 | 378 | ||
374 | /** | 379 | /** |
375 | * Generic stuff | 380 | * Generic stuff |
376 | */ | 381 | */ |
377 | 382 | ||
383 | const QString AccountViewItem::contextName="AccountViewItem"; | ||
384 | |||
378 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) | 385 | AccountView::AccountView( QWidget *parent, const char *name, WFlags flags ) |
379 | : QListView( parent, name, flags ) | 386 | : QListView( parent, name, flags ) |
380 | { | 387 | { |
381 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), | 388 | connect( this, SIGNAL( selectionChanged( QListViewItem * ) ), |
382 | SLOT( refresh( QListViewItem * ) ) ); | 389 | SLOT( refresh( QListViewItem * ) ) ); |
383 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, | 390 | connect( this, SIGNAL( mouseButtonPressed(int, QListViewItem *,const QPoint&,int ) ),this, |
384 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); | 391 | SLOT( slotHold( int, QListViewItem *,const QPoint&,int ) ) ); |
385 | 392 | ||
386 | setSorting(0); | 393 | setSorting(0); |
387 | } | 394 | } |
388 | 395 | ||
389 | void AccountView::slotContextMenu(int id) | 396 | void AccountView::slotContextMenu(int id) |
390 | { | 397 | { |
391 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); | 398 | AccountViewItem *view = static_cast<AccountViewItem *>(currentItem()); |
392 | if (!view) return; | 399 | if (!view) return; |
393 | view->contextMenuSelected(id); | 400 | view->contextMenuSelected(id); |
394 | } | 401 | } |
395 | 402 | ||
396 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) | 403 | void AccountView::slotHold(int button, QListViewItem * item,const QPoint&,int) |
397 | { | 404 | { |
398 | if (button==1) {return;} | 405 | if (button==1) {return;} |
399 | if (!item) return; | 406 | if (!item) return; |
400 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 407 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
401 | QPopupMenu*m = view->getContextMenu(); | 408 | QPopupMenu*m = view->getContextMenu(); |
@@ -469,78 +476,180 @@ RecBody AccountView::fetchBody(const RecMail&aMail) | |||
469 | */ | 476 | */ |
470 | 477 | ||
471 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) | 478 | MBOXviewItem::MBOXviewItem( const QString&aPath, QListView *parent ) |
472 | : AccountViewItem( parent ) | 479 | : AccountViewItem( parent ) |
473 | { | 480 | { |
474 | m_Path = aPath; | 481 | m_Path = aPath; |
475 | wrapper = AbstractMail::getWrapper( m_Path ); | 482 | wrapper = AbstractMail::getWrapper( m_Path ); |
476 | setPixmap( 0, PIXMAP_LOCALFOLDER ); | 483 | setPixmap( 0, PIXMAP_LOCALFOLDER ); |
477 | setText( 0, " Local Folders" ); | 484 | setText( 0, " Local Folders" ); |
478 | setOpen( true ); | 485 | setOpen( true ); |
479 | } | 486 | } |
480 | 487 | ||
481 | MBOXviewItem::~MBOXviewItem() | 488 | MBOXviewItem::~MBOXviewItem() |
482 | { | 489 | { |
483 | delete wrapper; | 490 | delete wrapper; |
484 | } | 491 | } |
485 | 492 | ||
486 | AbstractMail *MBOXviewItem::getWrapper() | 493 | AbstractMail *MBOXviewItem::getWrapper() |
487 | { | 494 | { |
488 | return wrapper; | 495 | return wrapper; |
489 | } | 496 | } |
490 | 497 | ||
491 | void MBOXviewItem::refresh( QList<RecMail> & ) | 498 | void MBOXviewItem::refresh( QList<RecMail> & ) |
492 | { | 499 | { |
500 | refresh(false); | ||
501 | } | ||
502 | |||
503 | void MBOXviewItem::refresh(bool force) | ||
504 | { | ||
505 | if (childCount()>0 && force==false) return; | ||
493 | QList<Folder> *folders = wrapper->listFolders(); | 506 | QList<Folder> *folders = wrapper->listFolders(); |
494 | QListViewItem *child = firstChild(); | 507 | QListViewItem *child = firstChild(); |
495 | while ( child ) { | 508 | while ( child ) { |
496 | QListViewItem *tmp = child; | 509 | QListViewItem *tmp = child; |
497 | child = child->nextSibling(); | 510 | child = child->nextSibling(); |
498 | delete tmp; | 511 | delete tmp; |
499 | } | 512 | } |
500 | Folder *it; | 513 | Folder *it; |
501 | QListViewItem*item = 0; | 514 | QListViewItem*item = 0; |
502 | for ( it = folders->first(); it; it = folders->next() ) { | 515 | for ( it = folders->first(); it; it = folders->next() ) { |
503 | item = new MBOXfolderItem( it, this , item ); | 516 | item = new MBOXfolderItem( it, this , item ); |
504 | item->setSelectable(it->may_select()); | 517 | item->setSelectable(it->may_select()); |
505 | } | 518 | } |
506 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! | 519 | // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! |
507 | folders->setAutoDelete(false); | 520 | folders->setAutoDelete(false); |
508 | delete folders; | 521 | delete folders; |
509 | } | 522 | } |
510 | 523 | ||
511 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) | 524 | RecBody MBOXviewItem::fetchBody( const RecMail &mail ) |
512 | { | 525 | { |
513 | qDebug( "POP3 fetchBody" ); | 526 | qDebug( "MBOX fetchBody" ); |
514 | return wrapper->fetchBody( mail ); | 527 | return wrapper->fetchBody( mail ); |
515 | } | 528 | } |
516 | 529 | ||
530 | QPopupMenu * MBOXviewItem::getContextMenu() | ||
531 | { | ||
532 | QPopupMenu *m = new QPopupMenu(0); | ||
533 | if (m) { | ||
534 | m->insertItem(QObject::tr("Refresh folder list",contextName),0); | ||
535 | m->insertItem(QObject::tr("Create new folder",contextName),1); | ||
536 | } | ||
537 | return m; | ||
538 | } | ||
539 | |||
540 | void MBOXviewItem::createFolder() | ||
541 | { | ||
542 | Newmdirdlg ndirdlg(0,0,true); | ||
543 | ndirdlg.showMaximized(); | ||
544 | if (ndirdlg.exec()) { | ||
545 | QString ndir = ndirdlg.Newdir(); | ||
546 | if (wrapper->createMbox(ndir)) { | ||
547 | refresh(true); | ||
548 | } | ||
549 | } | ||
550 | } | ||
551 | |||
552 | void MBOXviewItem::contextMenuSelected(int which) | ||
553 | { | ||
554 | switch (which) { | ||
555 | case 0: | ||
556 | refresh(true); | ||
557 | break; | ||
558 | case 1: | ||
559 | createFolder(); | ||
560 | break; | ||
561 | default: | ||
562 | break; | ||
563 | } | ||
564 | } | ||
565 | |||
517 | MBOXfolderItem::~MBOXfolderItem() | 566 | MBOXfolderItem::~MBOXfolderItem() |
518 | { | 567 | { |
519 | delete folder; | 568 | delete folder; |
520 | } | 569 | } |
521 | 570 | ||
522 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) | 571 | MBOXfolderItem::MBOXfolderItem( Folder *folderInit, MBOXviewItem *parent , QListViewItem*after ) |
523 | : AccountViewItem( parent,after ) | 572 | : AccountViewItem( parent,after ) |
524 | { | 573 | { |
525 | folder = folderInit; | 574 | folder = folderInit; |
526 | mbox = parent; | 575 | mbox = parent; |
527 | if (folder->getDisplayName().lower() == "outgoing") { | 576 | if (folder->getDisplayName().lower() == "outgoing") { |
528 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); | 577 | setPixmap( 0, PIXMAP_OUTBOXFOLDER ); |
529 | } else if (folder->getDisplayName().lower() == "inbox") { | 578 | } else if (folder->getDisplayName().lower() == "inbox") { |
530 | setPixmap( 0, PIXMAP_INBOXFOLDER); | 579 | setPixmap( 0, PIXMAP_INBOXFOLDER); |
531 | } else { | 580 | } else { |
532 | setPixmap( 0, PIXMAP_MBOXFOLDER ); | 581 | setPixmap( 0, PIXMAP_MBOXFOLDER ); |
533 | } | 582 | } |
534 | setText( 0, folder->getDisplayName() ); | 583 | setText( 0, folder->getDisplayName() ); |
535 | } | 584 | } |
536 | 585 | ||
537 | void MBOXfolderItem::refresh(QList<RecMail>&target) | 586 | void MBOXfolderItem::refresh(QList<RecMail>&target) |
538 | { | 587 | { |
539 | if (folder->may_select()) | 588 | if (folder->may_select()) |
540 | mbox->getWrapper()->listMessages( folder->getName(),target ); | 589 | mbox->getWrapper()->listMessages( folder->getName(),target ); |
541 | } | 590 | } |
542 | 591 | ||
543 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) | 592 | RecBody MBOXfolderItem::fetchBody(const RecMail&aMail) |
544 | { | 593 | { |
545 | return mbox->getWrapper()->fetchBody(aMail); | 594 | return mbox->getWrapper()->fetchBody(aMail); |
546 | } | 595 | } |
596 | |||
597 | void MBOXfolderItem::deleteAllMails() | ||
598 | { | ||
599 | int yesno = QMessageBox::warning(0,QObject::tr("Delete all mails",contextName), | ||
600 | QObject::tr("<center>Realy delete all mails in box <br>%1</center>",contextName).arg(folder->getDisplayName()), | ||
601 | QObject::tr("Yes",contextName), | ||
602 | QObject::tr("No",contextName),QString::null,1,1); | ||
603 | qDebug("Auswahl: %i",yesno); | ||
604 | if (yesno == 0) { | ||
605 | if (mbox->getWrapper()->deleteAllMail(folder)) { | ||
606 | AccountView * view = (AccountView*)listView(); | ||
607 | if (view) view->refreshCurrent(); | ||
608 | } | ||
609 | } | ||
610 | } | ||
611 | |||
612 | void MBOXfolderItem::deleteFolder() | ||
613 | { | ||
614 | int yesno = QMessageBox::warning(0,QObject::tr("Delete folder",contextName), | ||
615 | QObject::tr("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>",contextName).arg(folder->getDisplayName()), | ||
616 | QObject::tr("Yes",contextName), | ||
617 | QObject::tr("No",contextName),QString::null,1,1); | ||
618 | qDebug("Auswahl: %i",yesno); | ||
619 | if (yesno == 0) { | ||
620 | if (mbox->getWrapper()->deleteMbox(folder)) { | ||
621 | QListView*v=listView(); | ||
622 | MBOXviewItem * box = mbox; | ||
623 | /* be carefull - after that this object is destroyd so don't use | ||
624 | * any member of it after that call!!*/ | ||
625 | mbox->refresh(true); | ||
626 | if (v) { | ||
627 | v->setSelected(box,true); | ||
628 | } | ||
629 | } | ||
630 | } | ||
631 | } | ||
632 | |||
633 | QPopupMenu * MBOXfolderItem::getContextMenu() | ||
634 | { | ||
635 | QPopupMenu *m = new QPopupMenu(0); | ||
636 | if (m) { | ||
637 | m->insertItem(QObject::tr("Delete all mails",contextName),0); | ||
638 | m->insertItem(QObject::tr("Delete folder",contextName),1); | ||
639 | } | ||
640 | return m; | ||
641 | } | ||
642 | |||
643 | void MBOXfolderItem::contextMenuSelected(int which) | ||
644 | { | ||
645 | switch(which) { | ||
646 | case 0: | ||
647 | deleteAllMails(); | ||
648 | break; | ||
649 | case 1: | ||
650 | deleteFolder(); | ||
651 | break; | ||
652 | default: | ||
653 | break; | ||
654 | } | ||
655 | } | ||