-rw-r--r-- | kmicromail/accountitem.cpp | 12 | ||||
-rw-r--r-- | kmicromail/accountview.cpp | 5 | ||||
-rw-r--r-- | kmicromail/editaccounts.cpp | 3 | ||||
-rw-r--r-- | kmicromail/opiemail.cpp | 6 |
4 files changed, 22 insertions, 4 deletions
diff --git a/kmicromail/accountitem.cpp b/kmicromail/accountitem.cpp index 567de87..fcb2052 100644 --- a/kmicromail/accountitem.cpp +++ b/kmicromail/accountitem.cpp | |||
@@ -271,97 +271,99 @@ void NNTPviewItem::refresh() | |||
271 | if (account->getOffline()) return; | 271 | if (account->getOffline()) return; |
272 | QValueList<FolderP> *folders = wrapper->listFolders(); | 272 | QValueList<FolderP> *folders = wrapper->listFolders(); |
273 | 273 | ||
274 | QListViewItem *child = firstChild(); | 274 | QListViewItem *child = firstChild(); |
275 | while ( child ) | 275 | while ( child ) |
276 | { | 276 | { |
277 | QListViewItem *tmp = child; | 277 | QListViewItem *tmp = child; |
278 | child = child->nextSibling(); | 278 | child = child->nextSibling(); |
279 | delete tmp; | 279 | delete tmp; |
280 | } | 280 | } |
281 | QValueList<FolderP>::ConstIterator it; | 281 | QValueList<FolderP>::ConstIterator it; |
282 | QListViewItem*item = 0; | 282 | QListViewItem*item = 0; |
283 | for ( it = folders->begin(); it!=folders->end(); ++it) | 283 | for ( it = folders->begin(); it!=folders->end(); ++it) |
284 | { | 284 | { |
285 | item = new NNTPfolderItem( (*it), this , item ); | 285 | item = new NNTPfolderItem( (*it), this , item ); |
286 | item->setSelectable( (*it)->may_select()); | 286 | item->setSelectable( (*it)->may_select()); |
287 | } | 287 | } |
288 | delete folders; | 288 | delete folders; |
289 | } | 289 | } |
290 | 290 | ||
291 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) | 291 | RECBODYP NNTPviewItem::fetchBody( const RecMailP &mail ) |
292 | { | 292 | { |
293 | 293 | ||
294 | return wrapper->fetchBody( mail ); | 294 | return wrapper->fetchBody( mail ); |
295 | } | 295 | } |
296 | 296 | ||
297 | QPopupMenu * NNTPviewItem::getContextMenu() | 297 | QPopupMenu * NNTPviewItem::getContextMenu() |
298 | { | 298 | { |
299 | QPopupMenu *m = new QPopupMenu(0); | 299 | QPopupMenu *m = new QPopupMenu(0); |
300 | if (m) | 300 | if (m) |
301 | { | 301 | { |
302 | if (!account->getOffline()) | 302 | if (!account->getOffline()) |
303 | { | 303 | { |
304 | m->insertItem(i18n("Disconnect"),0); | 304 | m->insertItem(i18n("Disconnect"),0); |
305 | m->insertItem(i18n("Set offline"),1); | 305 | m->insertItem(i18n("Set offline"),1); |
306 | //m->insertItem(i18n("(Un-)Subscribe groups"),2); | 306 | //m->insertItem(i18n("(Un-)Subscribe groups"),2); |
307 | } | 307 | } |
308 | else | 308 | else |
309 | { | 309 | { |
310 | m->insertItem(i18n("Set online"),1); | 310 | m->insertItem(i18n("Set online"),1); |
311 | } | 311 | } |
312 | } | 312 | } |
313 | return m; | 313 | return m; |
314 | } | 314 | } |
315 | 315 | ||
316 | void NNTPviewItem::subscribeGroups() | 316 | void NNTPviewItem::subscribeGroups() |
317 | { | 317 | { |
318 | NNTPGroupsDlg dlg(account); | 318 | NNTPGroupsDlg dlg(account); |
319 | #ifndef DESKTOP_VERSION | ||
319 | dlg.showMaximized(); | 320 | dlg.showMaximized(); |
321 | #endif | ||
320 | if ( dlg.exec()== QDialog::Accepted ){ | 322 | if ( dlg.exec()== QDialog::Accepted ){ |
321 | refresh(); | 323 | refresh(); |
322 | } | 324 | } |
323 | } | 325 | } |
324 | 326 | ||
325 | void NNTPviewItem::disconnect() | 327 | void NNTPviewItem::disconnect() |
326 | { | 328 | { |
327 | QListViewItem *child = firstChild(); | 329 | QListViewItem *child = firstChild(); |
328 | while ( child ) | 330 | while ( child ) |
329 | { | 331 | { |
330 | QListViewItem *tmp = child; | 332 | QListViewItem *tmp = child; |
331 | child = child->nextSibling(); | 333 | child = child->nextSibling(); |
332 | delete tmp; | 334 | delete tmp; |
333 | } | 335 | } |
334 | wrapper->logout(); | 336 | wrapper->logout(); |
335 | } | 337 | } |
336 | 338 | ||
337 | void NNTPviewItem::setOnOffline() | 339 | void NNTPviewItem::setOnOffline() |
338 | { | 340 | { |
339 | if (!account->getOffline()) | 341 | if (!account->getOffline()) |
340 | { | 342 | { |
341 | disconnect(); | 343 | disconnect(); |
342 | } | 344 | } |
343 | account->setOffline(!account->getOffline()); | 345 | account->setOffline(!account->getOffline()); |
344 | account->save(); | 346 | account->save(); |
345 | //FIXME | 347 | //FIXME |
346 | SETPIX(PIXMAP_POP3FOLDER); | 348 | SETPIX(PIXMAP_POP3FOLDER); |
347 | refresh(); | 349 | refresh(); |
348 | } | 350 | } |
349 | 351 | ||
350 | void NNTPviewItem::contextMenuSelected(int which) | 352 | void NNTPviewItem::contextMenuSelected(int which) |
351 | { | 353 | { |
352 | switch (which) | 354 | switch (which) |
353 | { | 355 | { |
354 | case 0: | 356 | case 0: |
355 | disconnect(); | 357 | disconnect(); |
356 | break; | 358 | break; |
357 | case 1: | 359 | case 1: |
358 | setOnOffline(); | 360 | setOnOffline(); |
359 | break; | 361 | break; |
360 | case 2: | 362 | case 2: |
361 | subscribeGroups(); | 363 | subscribeGroups(); |
362 | break; | 364 | break; |
363 | } | 365 | } |
364 | } | 366 | } |
365 | 367 | ||
366 | NNTPfolderItem::~NNTPfolderItem() | 368 | NNTPfolderItem::~NNTPfolderItem() |
367 | {} | 369 | {} |
@@ -494,97 +496,99 @@ void IMAPviewItem::refreshFolders(bool force) | |||
494 | { | 496 | { |
495 | fname = fname.left(pos); | 497 | fname = fname.left(pos); |
496 | } | 498 | } |
497 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); | 499 | IMAPfolderItem*pitem = (IMAPfolderItem*)findSubItem(fname); |
498 | if (pitem) | 500 | if (pitem) |
499 | { | 501 | { |
500 | titem = item; | 502 | titem = item; |
501 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); | 503 | item = new IMAPfolderItem( (*it),pitem,pitem->firstChild(),this); |
502 | /* setup the short name */ | 504 | /* setup the short name */ |
503 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); | 505 | item->setText(0,(*it)->getDisplayName().mid(pos+1)); |
504 | item = titem; | 506 | item = titem; |
505 | } | 507 | } |
506 | else | 508 | else |
507 | { | 509 | { |
508 | item = new IMAPfolderItem( (*it), this , item ); | 510 | item = new IMAPfolderItem( (*it), this , item ); |
509 | } | 511 | } |
510 | } | 512 | } |
511 | delete folders; | 513 | delete folders; |
512 | } | 514 | } |
513 | 515 | ||
514 | QPopupMenu * IMAPviewItem::getContextMenu() | 516 | QPopupMenu * IMAPviewItem::getContextMenu() |
515 | { | 517 | { |
516 | QPopupMenu *m = new QPopupMenu(0); | 518 | QPopupMenu *m = new QPopupMenu(0); |
517 | if (m) | 519 | if (m) |
518 | { | 520 | { |
519 | if (!account->getOffline()) | 521 | if (!account->getOffline()) |
520 | { | 522 | { |
521 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 523 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
522 | m->insertItem(i18n("Refresh folder list"),0); | 524 | m->insertItem(i18n("Refresh folder list"),0); |
523 | m->insertItem(i18n("Create new folder"),1); | 525 | m->insertItem(i18n("Create new folder"),1); |
524 | m->insertSeparator(); | 526 | m->insertSeparator(); |
525 | m->insertItem(i18n("Disconnect"),2); | 527 | m->insertItem(i18n("Disconnect"),2); |
526 | m->insertItem(i18n("Set offline"),3); | 528 | m->insertItem(i18n("Set offline"),3); |
527 | m->insertSeparator(); | 529 | m->insertSeparator(); |
528 | } | 530 | } |
529 | else | 531 | else |
530 | { | 532 | { |
531 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 533 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
532 | m->insertItem(i18n("Set online"),3); | 534 | m->insertItem(i18n("Set online"),3); |
533 | } | 535 | } |
534 | } | 536 | } |
535 | return m; | 537 | return m; |
536 | } | 538 | } |
537 | 539 | ||
538 | void IMAPviewItem::createNewFolder() | 540 | void IMAPviewItem::createNewFolder() |
539 | { | 541 | { |
540 | Newmdirdlg ndirdlg; | 542 | Newmdirdlg ndirdlg; |
541 | 543 | ||
542 | ndirdlg.showMaximized(); | 544 | #ifndef DESKTOP_VERSION |
545 | //ndirdlg.showMaximized(); | ||
546 | #endif | ||
543 | if ( ndirdlg.exec() ) | 547 | if ( ndirdlg.exec() ) |
544 | { | 548 | { |
545 | QString ndir = ndirdlg.Newdir(); | 549 | QString ndir = ndirdlg.Newdir(); |
546 | bool makesubs = ndirdlg.subpossible(); | 550 | bool makesubs = ndirdlg.subpossible(); |
547 | QString delemiter = "/"; | 551 | QString delemiter = "/"; |
548 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); | 552 | IMAPfolderItem*item = (IMAPfolderItem*)firstChild(); |
549 | if (item) | 553 | if (item) |
550 | { | 554 | { |
551 | delemiter = item->Delemiter(); | 555 | delemiter = item->Delemiter(); |
552 | } | 556 | } |
553 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) | 557 | if (wrapper->createMbox(ndir,0,delemiter,makesubs)) |
554 | { | 558 | { |
555 | refreshFolders(true); | 559 | refreshFolders(true); |
556 | } | 560 | } |
557 | } | 561 | } |
558 | } | 562 | } |
559 | 563 | ||
560 | void IMAPviewItem::contextMenuSelected(int id) | 564 | void IMAPviewItem::contextMenuSelected(int id) |
561 | { | 565 | { |
562 | 566 | ||
563 | switch (id) | 567 | switch (id) |
564 | { | 568 | { |
565 | case 0: | 569 | case 0: |
566 | refreshFolders(true); | 570 | refreshFolders(true); |
567 | break; | 571 | break; |
568 | case 1: | 572 | case 1: |
569 | createNewFolder(); | 573 | createNewFolder(); |
570 | break; | 574 | break; |
571 | case 2: | 575 | case 2: |
572 | removeChilds(); | 576 | removeChilds(); |
573 | wrapper->logout(); | 577 | wrapper->logout(); |
574 | break; | 578 | break; |
575 | case 3: | 579 | case 3: |
576 | if (account->getOffline()==false) | 580 | if (account->getOffline()==false) |
577 | { | 581 | { |
578 | removeChilds(); | 582 | removeChilds(); |
579 | wrapper->logout(); | 583 | wrapper->logout(); |
580 | } | 584 | } |
581 | account->setOffline(!account->getOffline()); | 585 | account->setOffline(!account->getOffline()); |
582 | account->save(); | 586 | account->save(); |
583 | SETPIX(PIXMAP_IMAPFOLDER); | 587 | SETPIX(PIXMAP_IMAPFOLDER); |
584 | refreshFolders(false); | 588 | refreshFolders(false); |
585 | break; | 589 | break; |
586 | case GET_NEW_MAILS: // daunlood | 590 | case GET_NEW_MAILS: // daunlood |
587 | { | 591 | { |
588 | if (account->getOffline()) { | 592 | if (account->getOffline()) { |
589 | contextMenuSelected( 3 ); | 593 | contextMenuSelected( 3 ); |
590 | } | 594 | } |
@@ -648,97 +652,97 @@ const QString& IMAPfolderItem::Delemiter()const | |||
648 | { | 652 | { |
649 | return folder->Separator(); | 653 | return folder->Separator(); |
650 | } | 654 | } |
651 | 655 | ||
652 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) | 656 | void IMAPfolderItem::refresh(QValueList<RecMailP>&target) |
653 | { | 657 | { |
654 | if (folder->may_select()) | 658 | if (folder->may_select()) |
655 | { | 659 | { |
656 | imap->getWrapper()->listMessages( folder->getName(),target ); | 660 | imap->getWrapper()->listMessages( folder->getName(),target ); |
657 | } | 661 | } |
658 | else | 662 | else |
659 | { | 663 | { |
660 | target.clear(); | 664 | target.clear(); |
661 | } | 665 | } |
662 | } | 666 | } |
663 | 667 | ||
664 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) | 668 | RECBODYP IMAPfolderItem::fetchBody(const RecMailP&aMail) |
665 | { | 669 | { |
666 | return imap->getWrapper()->fetchBody(aMail); | 670 | return imap->getWrapper()->fetchBody(aMail); |
667 | } | 671 | } |
668 | 672 | ||
669 | QPopupMenu * IMAPfolderItem::getContextMenu() | 673 | QPopupMenu * IMAPfolderItem::getContextMenu() |
670 | { | 674 | { |
671 | QPopupMenu *m = new QPopupMenu(0); | 675 | QPopupMenu *m = new QPopupMenu(0); |
672 | if (m) | 676 | if (m) |
673 | { | 677 | { |
674 | if (folder->may_select()) | 678 | if (folder->may_select()) |
675 | { | 679 | { |
676 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); | 680 | m->insertItem(i18n("Get new messages"),GET_NEW_MAILS); |
677 | m->insertItem(i18n("Refresh header list"),0); | 681 | m->insertItem(i18n("Refresh header list"),0); |
678 | m->insertItem(i18n("Move/Copie all mails"),4); | 682 | m->insertItem(i18n("Move/Copie all mails"),4); |
679 | m->insertItem(i18n("Delete all mails"),1); | 683 | m->insertItem(i18n("Delete all mails"),1); |
680 | } | 684 | } |
681 | if (folder->no_inferior()==false) | 685 | if (folder->no_inferior()==false) |
682 | { | 686 | { |
683 | m->insertItem(i18n("Create new subfolder"),2); | 687 | m->insertItem(i18n("Create new subfolder"),2); |
684 | } | 688 | } |
685 | if (folder->getDisplayName().lower()!="inbox") | 689 | if (folder->getDisplayName().lower()!="inbox") |
686 | { | 690 | { |
687 | m->insertItem(i18n("Delete folder"),3); | 691 | m->insertItem(i18n("Delete folder"),3); |
688 | } | 692 | } |
689 | } | 693 | } |
690 | return m; | 694 | return m; |
691 | } | 695 | } |
692 | 696 | ||
693 | void IMAPfolderItem::createNewFolder() | 697 | void IMAPfolderItem::createNewFolder() |
694 | { | 698 | { |
695 | Newmdirdlg ndirdlg; | 699 | Newmdirdlg ndirdlg; |
696 | ndirdlg.showMaximized(); | 700 | //ndirdlg.showMaximized(); |
697 | if ( ndirdlg.exec() ) | 701 | if ( ndirdlg.exec() ) |
698 | { | 702 | { |
699 | QString ndir = ndirdlg.Newdir(); | 703 | QString ndir = ndirdlg.Newdir(); |
700 | bool makesubs = ndirdlg.subpossible(); | 704 | bool makesubs = ndirdlg.subpossible(); |
701 | QString delemiter = Delemiter(); | 705 | QString delemiter = Delemiter(); |
702 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) | 706 | if (imap->wrapper->createMbox(ndir,folder,delemiter,makesubs)) |
703 | { | 707 | { |
704 | imap->refreshFolders(true); | 708 | imap->refreshFolders(true); |
705 | } | 709 | } |
706 | } | 710 | } |
707 | } | 711 | } |
708 | 712 | ||
709 | void IMAPfolderItem::deleteFolder() | 713 | void IMAPfolderItem::deleteFolder() |
710 | { | 714 | { |
711 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), | 715 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), |
712 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), | 716 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), |
713 | i18n("Yes"), | 717 | i18n("Yes"), |
714 | i18n("No"),QString::null,1,1); | 718 | i18n("No"),QString::null,1,1); |
715 | 719 | ||
716 | if (yesno == 0) | 720 | if (yesno == 0) |
717 | { | 721 | { |
718 | if (imap->getWrapper()->deleteMbox(folder)) | 722 | if (imap->getWrapper()->deleteMbox(folder)) |
719 | { | 723 | { |
720 | QListView*v=listView(); | 724 | QListView*v=listView(); |
721 | IMAPviewItem * box = imap; | 725 | IMAPviewItem * box = imap; |
722 | /* be carefull - after that this object is destroyd so don't use | 726 | /* be carefull - after that this object is destroyd so don't use |
723 | * any member of it after that call!!*/ | 727 | * any member of it after that call!!*/ |
724 | imap->refreshFolders(true); | 728 | imap->refreshFolders(true); |
725 | if (v) | 729 | if (v) |
726 | { | 730 | { |
727 | v->setSelected(box,true); | 731 | v->setSelected(box,true); |
728 | } | 732 | } |
729 | } | 733 | } |
730 | } | 734 | } |
731 | } | 735 | } |
732 | 736 | ||
733 | void IMAPfolderItem::downloadMails() | 737 | void IMAPfolderItem::downloadMails() |
734 | { | 738 | { |
735 | AccountView*bl = imap->accountView(); | 739 | AccountView*bl = imap->accountView(); |
736 | if (!bl) return; | 740 | if (!bl) return; |
737 | bl->downloadMails(folder,imap->getWrapper()); | 741 | bl->downloadMails(folder,imap->getWrapper()); |
738 | } | 742 | } |
739 | 743 | ||
740 | void IMAPfolderItem::contextMenuSelected(int id) | 744 | void IMAPfolderItem::contextMenuSelected(int id) |
741 | { | 745 | { |
742 | 746 | ||
743 | AccountView * view = (AccountView*)listView(); | 747 | AccountView * view = (AccountView*)listView(); |
744 | switch(id) | 748 | switch(id) |
@@ -824,97 +828,97 @@ void MHviewItem::refresh(bool force) | |||
824 | continue; | 828 | continue; |
825 | } | 829 | } |
826 | currentFolders.append(fname); | 830 | currentFolders.append(fname); |
827 | pos = fname.findRev("/"); | 831 | pos = fname.findRev("/"); |
828 | if (pos > 0) | 832 | if (pos > 0) |
829 | { | 833 | { |
830 | fname = fname.left(pos); | 834 | fname = fname.left(pos); |
831 | pmaster = (MHfolderItem*)findSubItem(fname); | 835 | pmaster = (MHfolderItem*)findSubItem(fname); |
832 | } | 836 | } |
833 | else | 837 | else |
834 | { | 838 | { |
835 | pmaster = 0; | 839 | pmaster = 0; |
836 | } | 840 | } |
837 | if (pmaster) | 841 | if (pmaster) |
838 | { | 842 | { |
839 | item = new MHfolderItem( (*it), pmaster, item, this ); | 843 | item = new MHfolderItem( (*it), pmaster, item, this ); |
840 | } | 844 | } |
841 | else | 845 | else |
842 | { | 846 | { |
843 | item = new MHfolderItem( (*it), this , item ); | 847 | item = new MHfolderItem( (*it), this , item ); |
844 | } | 848 | } |
845 | item->setSelectable((*it)->may_select()); | 849 | item->setSelectable((*it)->may_select()); |
846 | } | 850 | } |
847 | delete folders; | 851 | delete folders; |
848 | } | 852 | } |
849 | 853 | ||
850 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) | 854 | RECBODYP MHviewItem::fetchBody( const RecMailP &mail ) |
851 | { | 855 | { |
852 | 856 | ||
853 | return wrapper->fetchBody( mail ); | 857 | return wrapper->fetchBody( mail ); |
854 | } | 858 | } |
855 | 859 | ||
856 | QPopupMenu * MHviewItem::getContextMenu() | 860 | QPopupMenu * MHviewItem::getContextMenu() |
857 | { | 861 | { |
858 | QPopupMenu *m = new QPopupMenu(0); | 862 | QPopupMenu *m = new QPopupMenu(0); |
859 | if (m) | 863 | if (m) |
860 | { | 864 | { |
861 | m->insertItem(i18n("Refresh folder list"),0); | 865 | m->insertItem(i18n("Refresh folder list"),0); |
862 | m->insertItem(i18n("Create new folder"),1); | 866 | m->insertItem(i18n("Create new folder"),1); |
863 | m->insertItem(i18n("Delete all mails"),2); | 867 | m->insertItem(i18n("Delete all mails"),2); |
864 | m->insertItem(i18n("Move/Copie all mails"),3); | 868 | m->insertItem(i18n("Move/Copie all mails"),3); |
865 | } | 869 | } |
866 | return m; | 870 | return m; |
867 | } | 871 | } |
868 | 872 | ||
869 | void MHviewItem::createFolder() | 873 | void MHviewItem::createFolder() |
870 | { | 874 | { |
871 | Newmdirdlg ndirdlg(0,0,true); | 875 | Newmdirdlg ndirdlg(0,0,true); |
872 | ndirdlg.showMaximized(); | 876 | //ndirdlg.showMaximized(); |
873 | if ( ndirdlg.exec() ) | 877 | if ( ndirdlg.exec() ) |
874 | { | 878 | { |
875 | QString ndir = ndirdlg.Newdir(); | 879 | QString ndir = ndirdlg.Newdir(); |
876 | if (wrapper->createMbox(ndir)) | 880 | if (wrapper->createMbox(ndir)) |
877 | { | 881 | { |
878 | refresh(true); | 882 | refresh(true); |
879 | } | 883 | } |
880 | } | 884 | } |
881 | } | 885 | } |
882 | 886 | ||
883 | void MHviewItem::downloadMails() | 887 | void MHviewItem::downloadMails() |
884 | { | 888 | { |
885 | AccountView*bl = accountView(); | 889 | AccountView*bl = accountView(); |
886 | if (!bl) return; | 890 | if (!bl) return; |
887 | bl->downloadMails(folder,getWrapper()); | 891 | bl->downloadMails(folder,getWrapper()); |
888 | } | 892 | } |
889 | 893 | ||
890 | QStringList MHviewItem::subFolders() | 894 | QStringList MHviewItem::subFolders() |
891 | { | 895 | { |
892 | return currentFolders; | 896 | return currentFolders; |
893 | } | 897 | } |
894 | 898 | ||
895 | void MHviewItem::contextMenuSelected(int which) | 899 | void MHviewItem::contextMenuSelected(int which) |
896 | { | 900 | { |
897 | switch (which) | 901 | switch (which) |
898 | { | 902 | { |
899 | case 0: | 903 | case 0: |
900 | refresh(true); | 904 | refresh(true); |
901 | break; | 905 | break; |
902 | case 1: | 906 | case 1: |
903 | createFolder(); | 907 | createFolder(); |
904 | break; | 908 | break; |
905 | case 2: | 909 | case 2: |
906 | deleteAllMail(getWrapper(),folder); | 910 | deleteAllMail(getWrapper(),folder); |
907 | break; | 911 | break; |
908 | case 3: | 912 | case 3: |
909 | downloadMails(); | 913 | downloadMails(); |
910 | break; | 914 | break; |
911 | default: | 915 | default: |
912 | break; | 916 | break; |
913 | } | 917 | } |
914 | } | 918 | } |
915 | 919 | ||
916 | MHfolderItem::~MHfolderItem() | 920 | MHfolderItem::~MHfolderItem() |
917 | {} | 921 | {} |
918 | 922 | ||
919 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) | 923 | MHfolderItem::MHfolderItem( const FolderP &folderInit, MHviewItem *parent , QListViewItem*after ) |
920 | : AccountViewItem(folderInit, parent,after ) | 924 | : AccountViewItem(folderInit, parent,after ) |
@@ -976,97 +980,97 @@ RECBODYP MHfolderItem::fetchBody(const RecMailP&aMail) | |||
976 | 980 | ||
977 | void MHfolderItem::deleteFolder() | 981 | void MHfolderItem::deleteFolder() |
978 | { | 982 | { |
979 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), | 983 | int yesno = QMessageBox::warning(0,i18n("Delete folder"), |
980 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), | 984 | i18n("<center>Realy delete folder <br><b>%1</b><br>and all if it content?</center>").arg(folder->getDisplayName()), |
981 | i18n("Yes"), | 985 | i18n("Yes"), |
982 | i18n("No"),QString::null,1,1); | 986 | i18n("No"),QString::null,1,1); |
983 | 987 | ||
984 | if (yesno == 0) | 988 | if (yesno == 0) |
985 | { | 989 | { |
986 | if (mbox->getWrapper()->deleteMbox(folder)) | 990 | if (mbox->getWrapper()->deleteMbox(folder)) |
987 | { | 991 | { |
988 | QListView*v=listView(); | 992 | QListView*v=listView(); |
989 | MHviewItem * box = mbox; | 993 | MHviewItem * box = mbox; |
990 | /* be carefull - after that this object is destroyd so don't use | 994 | /* be carefull - after that this object is destroyd so don't use |
991 | * any member of it after that call!!*/ | 995 | * any member of it after that call!!*/ |
992 | mbox->refresh(true); | 996 | mbox->refresh(true); |
993 | if (v) | 997 | if (v) |
994 | { | 998 | { |
995 | v->setSelected(box,true); | 999 | v->setSelected(box,true); |
996 | } | 1000 | } |
997 | } | 1001 | } |
998 | } | 1002 | } |
999 | } | 1003 | } |
1000 | 1004 | ||
1001 | QPopupMenu * MHfolderItem::getContextMenu() | 1005 | QPopupMenu * MHfolderItem::getContextMenu() |
1002 | { | 1006 | { |
1003 | QPopupMenu *m = new QPopupMenu(0); | 1007 | QPopupMenu *m = new QPopupMenu(0); |
1004 | if (m) | 1008 | if (m) |
1005 | { | 1009 | { |
1006 | m->insertItem(i18n("Move/Copie all mails"),2); | 1010 | m->insertItem(i18n("Move/Copie all mails"),2); |
1007 | m->insertItem(i18n("Delete all mails"),0); | 1011 | m->insertItem(i18n("Delete all mails"),0); |
1008 | m->insertItem(i18n("Create new subfolder"),3); | 1012 | m->insertItem(i18n("Create new subfolder"),3); |
1009 | m->insertItem(i18n("Delete folder"),1); | 1013 | m->insertItem(i18n("Delete folder"),1); |
1010 | } | 1014 | } |
1011 | return m; | 1015 | return m; |
1012 | } | 1016 | } |
1013 | 1017 | ||
1014 | void MHfolderItem::downloadMails() | 1018 | void MHfolderItem::downloadMails() |
1015 | { | 1019 | { |
1016 | AccountView*bl = mbox->accountView(); | 1020 | AccountView*bl = mbox->accountView(); |
1017 | if (!bl) return; | 1021 | if (!bl) return; |
1018 | bl->downloadMails(folder,mbox->getWrapper()); | 1022 | bl->downloadMails(folder,mbox->getWrapper()); |
1019 | } | 1023 | } |
1020 | 1024 | ||
1021 | void MHfolderItem::createFolder() | 1025 | void MHfolderItem::createFolder() |
1022 | { | 1026 | { |
1023 | Newmdirdlg ndirdlg(0,0,true); | 1027 | Newmdirdlg ndirdlg(0,0,true); |
1024 | ndirdlg.showMaximized(); | 1028 | //ndirdlg.showMaximized(); |
1025 | if (ndirdlg.exec() ) | 1029 | if (ndirdlg.exec() ) |
1026 | { | 1030 | { |
1027 | QString ndir = ndirdlg.Newdir(); | 1031 | QString ndir = ndirdlg.Newdir(); |
1028 | if (mbox->getWrapper()->createMbox(ndir,folder)) | 1032 | if (mbox->getWrapper()->createMbox(ndir,folder)) |
1029 | { | 1033 | { |
1030 | QListView*v=listView(); | 1034 | QListView*v=listView(); |
1031 | MHviewItem * box = mbox; | 1035 | MHviewItem * box = mbox; |
1032 | /* be carefull - after that this object is destroyd so don't use | 1036 | /* be carefull - after that this object is destroyd so don't use |
1033 | * any member of it after that call!!*/ | 1037 | * any member of it after that call!!*/ |
1034 | mbox->refresh(true); | 1038 | mbox->refresh(true); |
1035 | if (v) | 1039 | if (v) |
1036 | { | 1040 | { |
1037 | v->setSelected(box,true); | 1041 | v->setSelected(box,true); |
1038 | } | 1042 | } |
1039 | } | 1043 | } |
1040 | } | 1044 | } |
1041 | } | 1045 | } |
1042 | 1046 | ||
1043 | void MHfolderItem::contextMenuSelected(int which) | 1047 | void MHfolderItem::contextMenuSelected(int which) |
1044 | { | 1048 | { |
1045 | switch(which) | 1049 | switch(which) |
1046 | { | 1050 | { |
1047 | case 0: | 1051 | case 0: |
1048 | deleteAllMail(mbox->getWrapper(),folder); | 1052 | deleteAllMail(mbox->getWrapper(),folder); |
1049 | break; | 1053 | break; |
1050 | case 1: | 1054 | case 1: |
1051 | deleteFolder(); | 1055 | deleteFolder(); |
1052 | break; | 1056 | break; |
1053 | case 2: | 1057 | case 2: |
1054 | downloadMails(); | 1058 | downloadMails(); |
1055 | break; | 1059 | break; |
1056 | case 3: | 1060 | case 3: |
1057 | createFolder(); | 1061 | createFolder(); |
1058 | break; | 1062 | break; |
1059 | default: | 1063 | default: |
1060 | break; | 1064 | break; |
1061 | } | 1065 | } |
1062 | } | 1066 | } |
1063 | 1067 | ||
1064 | bool MHfolderItem::isDraftfolder() | 1068 | bool MHfolderItem::isDraftfolder() |
1065 | { | 1069 | { |
1066 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; | 1070 | if (folder && folder->getName()==AbstractMail::defaultLocalfolder()+"/"+AbstractMail::draftFolder()) return true; |
1067 | return false; | 1071 | return false; |
1068 | } | 1072 | } |
1069 | 1073 | ||
1070 | /** | 1074 | /** |
1071 | * Generic stuff | 1075 | * Generic stuff |
1072 | */ | 1076 | */ |
diff --git a/kmicromail/accountview.cpp b/kmicromail/accountview.cpp index c10d384..c9c4a0f 100644 --- a/kmicromail/accountview.cpp +++ b/kmicromail/accountview.cpp | |||
@@ -78,97 +78,102 @@ void AccountView::populate( QList<Account> list ) | |||
78 | /* must not be hold 'cause it isn't required */ | 78 | /* must not be hold 'cause it isn't required */ |
79 | (void) new POP3viewItem( pop3, this ); | 79 | (void) new POP3viewItem( pop3, this ); |
80 | } | 80 | } |
81 | else if ( it->getType() == MAILLIB::A_NNTP ) | 81 | else if ( it->getType() == MAILLIB::A_NNTP ) |
82 | { | 82 | { |
83 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); | 83 | NNTPaccount *nntp = static_cast<NNTPaccount *>(it); |
84 | /* must not be hold 'cause it isn't required */ | 84 | /* must not be hold 'cause it isn't required */ |
85 | (void) new NNTPviewItem( nntp, this ); | 85 | (void) new NNTPviewItem( nntp, this ); |
86 | } | 86 | } |
87 | } | 87 | } |
88 | } | 88 | } |
89 | 89 | ||
90 | void AccountView::refresh(QListViewItem *item) | 90 | void AccountView::refresh(QListViewItem *item) |
91 | { | 91 | { |
92 | if ( item ) | 92 | if ( item ) |
93 | { | 93 | { |
94 | m_currentItem = item; | 94 | m_currentItem = item; |
95 | QValueList<RecMailP> headerlist; | 95 | QValueList<RecMailP> headerlist; |
96 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 96 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
97 | view->refresh(headerlist); | 97 | view->refresh(headerlist); |
98 | emit refreshMailview(headerlist); | 98 | emit refreshMailview(headerlist); |
99 | } | 99 | } |
100 | } | 100 | } |
101 | 101 | ||
102 | void AccountView::refreshCurrent() | 102 | void AccountView::refreshCurrent() |
103 | { | 103 | { |
104 | m_currentItem = currentItem(); | 104 | m_currentItem = currentItem(); |
105 | if ( !m_currentItem ) return; | 105 | if ( !m_currentItem ) return; |
106 | QValueList<RecMailP> headerlist; | 106 | QValueList<RecMailP> headerlist; |
107 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); | 107 | AccountViewItem *view = static_cast<AccountViewItem *>(m_currentItem); |
108 | view->refresh(headerlist); | 108 | view->refresh(headerlist); |
109 | emit refreshMailview(headerlist); | 109 | emit refreshMailview(headerlist); |
110 | } | 110 | } |
111 | 111 | ||
112 | void AccountView::refreshAll() | 112 | void AccountView::refreshAll() |
113 | { | 113 | { |
114 | } | 114 | } |
115 | 115 | ||
116 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) | 116 | RecBodyP AccountView::fetchBody(const RecMailP&aMail) |
117 | { | 117 | { |
118 | QListViewItem*item = selectedItem (); | 118 | QListViewItem*item = selectedItem (); |
119 | if (!item) return new RecBody(); | 119 | if (!item) return new RecBody(); |
120 | AccountViewItem *view = static_cast<AccountViewItem *>(item); | 120 | AccountViewItem *view = static_cast<AccountViewItem *>(item); |
121 | return view->fetchBody(aMail); | 121 | return view->fetchBody(aMail); |
122 | } | 122 | } |
123 | 123 | ||
124 | void AccountView::setupFolderselect(Selectstore*sels) | 124 | void AccountView::setupFolderselect(Selectstore*sels) |
125 | { | 125 | { |
126 | |||
127 | #ifndef DESKTOP_VERSION | ||
126 | sels->showMaximized(); | 128 | sels->showMaximized(); |
129 | #else | ||
130 | sels->show(); | ||
131 | #endif | ||
127 | QStringList sFolders; | 132 | QStringList sFolders; |
128 | unsigned int i = 0; | 133 | unsigned int i = 0; |
129 | for (i=0; i < mhAccounts.count();++i) | 134 | for (i=0; i < mhAccounts.count();++i) |
130 | { | 135 | { |
131 | mhAccounts[i]->refresh(false); | 136 | mhAccounts[i]->refresh(false); |
132 | sFolders = mhAccounts[i]->subFolders(); | 137 | sFolders = mhAccounts[i]->subFolders(); |
133 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); | 138 | sels->addAccounts(mhAccounts[i]->getWrapper(),sFolders); |
134 | } | 139 | } |
135 | for (i=0; i < imapAccounts.count();++i) | 140 | for (i=0; i < imapAccounts.count();++i) |
136 | { | 141 | { |
137 | if (imapAccounts[i]->offline()) | 142 | if (imapAccounts[i]->offline()) |
138 | continue; | 143 | continue; |
139 | imapAccounts[i]->refreshFolders(false); | 144 | imapAccounts[i]->refreshFolders(false); |
140 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); | 145 | sels->addAccounts(imapAccounts[i]->getWrapper(),imapAccounts[i]->subFolders()); |
141 | } | 146 | } |
142 | } | 147 | } |
143 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) | 148 | void AccountView::downloadMailsInbox(const FolderP&fromFolder,AbstractMail*fromWrapper) |
144 | { | 149 | { |
145 | #if 0 | 150 | #if 0 |
146 | AbstractMail*targetMail = 0; | 151 | AbstractMail*targetMail = 0; |
147 | QString targetFolder = ""; | 152 | QString targetFolder = ""; |
148 | Selectstore sels; | 153 | Selectstore sels; |
149 | setupFolderselect(&sels); | 154 | setupFolderselect(&sels); |
150 | if (!sels.exec()) return; | 155 | if (!sels.exec()) return; |
151 | targetMail = sels.currentMail(); | 156 | targetMail = sels.currentMail(); |
152 | targetFolder = sels.currentFolder(); | 157 | targetFolder = sels.currentFolder(); |
153 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || | 158 | if ( (fromWrapper==targetMail && fromFolder->getName()==targetFolder) || |
154 | targetFolder.isEmpty()) | 159 | targetFolder.isEmpty()) |
155 | { | 160 | { |
156 | return; | 161 | return; |
157 | } | 162 | } |
158 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) | 163 | if (sels.newFolder() && !targetMail->createMbox(targetFolder)) |
159 | { | 164 | { |
160 | QMessageBox::critical(0,i18n("Error creating new Folder"), | 165 | QMessageBox::critical(0,i18n("Error creating new Folder"), |
161 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); | 166 | i18n("<center>Error while creating<br>new folder - breaking.</center>")); |
162 | return; | 167 | return; |
163 | } | 168 | } |
164 | int maxsize = 0; | 169 | int maxsize = 0; |
165 | if ( sels.useSize->isChecked()) | 170 | if ( sels.useSize->isChecked()) |
166 | maxsize = sels.sizeSpinBox->value(); | 171 | maxsize = sels.sizeSpinBox->value(); |
167 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); | 172 | fromWrapper->mvcpAllMails(fromFolder,targetFolder,targetMail,sels.moveMails(), maxsize); |
168 | #endif | 173 | #endif |
169 | fromWrapper->downloadNewMails( fromFolder, mhAccounts[0]->getWrapper()); | 174 | fromWrapper->downloadNewMails( fromFolder, mhAccounts[0]->getWrapper()); |
170 | refreshCurrent(); | 175 | refreshCurrent(); |
171 | 176 | ||
172 | } | 177 | } |
173 | 178 | ||
174 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) | 179 | void AccountView::downloadMails(const FolderP&fromFolder,AbstractMail*fromWrapper) |
diff --git a/kmicromail/editaccounts.cpp b/kmicromail/editaccounts.cpp index 0d30097..48c3963 100644 --- a/kmicromail/editaccounts.cpp +++ b/kmicromail/editaccounts.cpp | |||
@@ -62,97 +62,100 @@ EditAccounts::EditAccounts( Settings *s, QWidget *parent, const char *name, bool | |||
62 | 62 | ||
63 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); | 63 | connect( newMail, SIGNAL( clicked() ), SLOT( slotNewMail() ) ); |
64 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); | 64 | connect( editMail, SIGNAL( clicked() ), SLOT( slotEditMail() ) ); |
65 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); | 65 | connect( deleteMail, SIGNAL( clicked() ), SLOT( slotDeleteMail() ) ); |
66 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); | 66 | connect( newNews, SIGNAL( clicked() ), SLOT( slotNewNews() ) ); |
67 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); | 67 | connect( editNews, SIGNAL( clicked() ), SLOT( slotEditNews() ) ); |
68 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); | 68 | connect( deleteNews, SIGNAL( clicked() ), SLOT( slotDeleteNews() ) ); |
69 | 69 | ||
70 | slotFillLists(); | 70 | slotFillLists(); |
71 | } | 71 | } |
72 | 72 | ||
73 | void EditAccounts::slotFillLists() | 73 | void EditAccounts::slotFillLists() |
74 | { | 74 | { |
75 | mailList->clear(); | 75 | mailList->clear(); |
76 | newsList->clear(); | 76 | newsList->clear(); |
77 | 77 | ||
78 | QList<Account> accounts = settings->getAccounts(); | 78 | QList<Account> accounts = settings->getAccounts(); |
79 | Account *it; | 79 | Account *it; |
80 | for ( it = accounts.first(); it; it = accounts.next() ) | 80 | for ( it = accounts.first(); it; it = accounts.next() ) |
81 | { | 81 | { |
82 | if ( it->getType()==MAILLIB::A_NNTP ) | 82 | if ( it->getType()==MAILLIB::A_NNTP ) |
83 | { | 83 | { |
84 | (void) new AccountListItem( newsList, it ); | 84 | (void) new AccountListItem( newsList, it ); |
85 | } | 85 | } |
86 | else | 86 | else |
87 | { | 87 | { |
88 | (void) new AccountListItem( mailList, it ); | 88 | (void) new AccountListItem( mailList, it ); |
89 | } | 89 | } |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | void EditAccounts::slotNewMail() | 93 | void EditAccounts::slotNewMail() |
94 | { | 94 | { |
95 | QString *selection = new QString(); | 95 | QString *selection = new QString(); |
96 | SelectMailType selType( selection, this, 0, true ); | 96 | SelectMailType selType( selection, this, 0, true ); |
97 | selType.show(); | 97 | selType.show(); |
98 | if ( QDialog::Accepted == selType.exec() ) | 98 | if ( QDialog::Accepted == selType.exec() ) |
99 | { | 99 | { |
100 | slotNewAccount( *selection ); | 100 | slotNewAccount( *selection ); |
101 | } | 101 | } |
102 | } | 102 | } |
103 | 103 | ||
104 | void EditAccounts::slotNewAccount( const QString &type ) | 104 | void EditAccounts::slotNewAccount( const QString &type ) |
105 | { | 105 | { |
106 | if ( type.compare( i18n("IMAP") ) == 0 ) | 106 | if ( type.compare( i18n("IMAP") ) == 0 ) |
107 | { | 107 | { |
108 | IMAPaccount *account = new IMAPaccount(); | 108 | IMAPaccount *account = new IMAPaccount(); |
109 | IMAPconfig imap( account, this, 0, true ); | 109 | IMAPconfig imap( account, this, 0, true ); |
110 | |||
111 | #ifndef DESKTOP_VERSION | ||
110 | imap.showMaximized(); | 112 | imap.showMaximized(); |
113 | #endif | ||
111 | if ( QDialog::Accepted == imap.exec() ) | 114 | if ( QDialog::Accepted == imap.exec() ) |
112 | { | 115 | { |
113 | settings->addAccount( account ); | 116 | settings->addAccount( account ); |
114 | account->save(); | 117 | account->save(); |
115 | slotFillLists(); | 118 | slotFillLists(); |
116 | } | 119 | } |
117 | else | 120 | else |
118 | { | 121 | { |
119 | account->remove(); | 122 | account->remove(); |
120 | } | 123 | } |
121 | } | 124 | } |
122 | else if ( type.compare( i18n("POP3") ) == 0 ) | 125 | else if ( type.compare( i18n("POP3") ) == 0 ) |
123 | { | 126 | { |
124 | POP3account *account = new POP3account(); | 127 | POP3account *account = new POP3account(); |
125 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); | 128 | POP3config pop3( account, this, 0, true, WStyle_ContextHelp ); |
126 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) | 129 | if ( QDialog::Accepted == KApplication::execDialog( &pop3 ) ) |
127 | { | 130 | { |
128 | settings->addAccount( account ); | 131 | settings->addAccount( account ); |
129 | account->save(); | 132 | account->save(); |
130 | slotFillLists(); | 133 | slotFillLists(); |
131 | } | 134 | } |
132 | else | 135 | else |
133 | { | 136 | { |
134 | account->remove(); | 137 | account->remove(); |
135 | } | 138 | } |
136 | } | 139 | } |
137 | else if ( type.compare( i18n("SMTP") ) == 0 ) | 140 | else if ( type.compare( i18n("SMTP") ) == 0 ) |
138 | { | 141 | { |
139 | SMTPaccount *account = new SMTPaccount(); | 142 | SMTPaccount *account = new SMTPaccount(); |
140 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); | 143 | SMTPconfig smtp( account, this, 0, true, WStyle_ContextHelp ); |
141 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) | 144 | if ( QDialog::Accepted == KApplication::execDialog( &smtp ) ) |
142 | { | 145 | { |
143 | settings->addAccount( account ); | 146 | settings->addAccount( account ); |
144 | account->save(); | 147 | account->save(); |
145 | slotFillLists(); | 148 | slotFillLists(); |
146 | 149 | ||
147 | } | 150 | } |
148 | else | 151 | else |
149 | { | 152 | { |
150 | account->remove(); | 153 | account->remove(); |
151 | } | 154 | } |
152 | } | 155 | } |
153 | else if ( type.compare( i18n("NNTP") ) == 0 ) | 156 | else if ( type.compare( i18n("NNTP") ) == 0 ) |
154 | { | 157 | { |
155 | NNTPaccount *account = new NNTPaccount(); | 158 | NNTPaccount *account = new NNTPaccount(); |
156 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); | 159 | NNTPconfig nntp( account, this, 0, true, WStyle_ContextHelp ); |
157 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) | 160 | if ( QDialog::Accepted == KApplication::execDialog( &nntp ) ) |
158 | { | 161 | { |
diff --git a/kmicromail/opiemail.cpp b/kmicromail/opiemail.cpp index fe9df87..8d16ae7 100644 --- a/kmicromail/opiemail.cpp +++ b/kmicromail/opiemail.cpp | |||
@@ -80,166 +80,172 @@ void OpieMail::message(const QCString &msg, const QByteArray &data) | |||
80 | //qDebug("slotComposeMail() "); | 80 | //qDebug("slotComposeMail() "); |
81 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call | 81 | // we cannot call slotComposeMail(); directly, because may be executing a QCOP call |
82 | // and a QCOP call does not like a processevents in his execution | 82 | // and a QCOP call does not like a processevents in his execution |
83 | // with the Qtimer we call slotComposeMail() after we reached the main event loop | 83 | // with the Qtimer we call slotComposeMail() after we reached the main event loop |
84 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 84 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
85 | // slotComposeMail(); | 85 | // slotComposeMail(); |
86 | } | 86 | } |
87 | else if (msg == "newMail(QString)") | 87 | else if (msg == "newMail(QString)") |
88 | { | 88 | { |
89 | //qDebug(" newMail(QString)"); | 89 | //qDebug(" newMail(QString)"); |
90 | QDataStream stream(data,IO_ReadOnly); | 90 | QDataStream stream(data,IO_ReadOnly); |
91 | stream >> mPendingName; | 91 | stream >> mPendingName; |
92 | // the format is | 92 | // the format is |
93 | // NAME <EMAIL>:SUBJECT | 93 | // NAME <EMAIL>:SUBJECT |
94 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); | 94 | QTimer::singleShot ( 50, this, SLOT(slotComposeMail() ) ); |
95 | } else { | 95 | } else { |
96 | mPendingData = data; | 96 | mPendingData = data; |
97 | mPendingMessage = msg; | 97 | mPendingMessage = msg; |
98 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); | 98 | QTimer::singleShot ( 50, this, SLOT(slotExtAppHandler() ) ); |
99 | } | 99 | } |
100 | 100 | ||
101 | //qDebug("END OpieMail::message "); | 101 | //qDebug("END OpieMail::message "); |
102 | } | 102 | } |
103 | void OpieMail::slotExtAppHandler() | 103 | void OpieMail::slotExtAppHandler() |
104 | { | 104 | { |
105 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); | 105 | ExternalAppHandler::instance()->appMessage ( mPendingMessage, mPendingData ); |
106 | } | 106 | } |
107 | void OpieMail::slotwriteMail2(const QString& namemail ) | 107 | void OpieMail::slotwriteMail2(const QString& namemail ) |
108 | { | 108 | { |
109 | //qDebug("OpieMail::slotwriteMail2 "); | 109 | //qDebug("OpieMail::slotwriteMail2 "); |
110 | //qApp->processEvents(); | 110 | //qApp->processEvents(); |
111 | ComposeMail compose( settings, this, 0, true ); | 111 | ComposeMail compose( settings, this, 0, true ); |
112 | if ( !namemail.isEmpty() ) { | 112 | if ( !namemail.isEmpty() ) { |
113 | QString to = namemail; | 113 | QString to = namemail; |
114 | if ( namemail.find( " <") > 1 ) { | 114 | if ( namemail.find( " <") > 1 ) { |
115 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; | 115 | to = "\"" +to.replace( QRegExp( " <"), "\" <") ; |
116 | } else | 116 | } else |
117 | if ( namemail.find( "<") > 1 ) { | 117 | if ( namemail.find( "<") > 1 ) { |
118 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; | 118 | to = "\"" +to.replace( QRegExp( "<"), "\" <") ; |
119 | } | 119 | } |
120 | int sub = to.find( ">:"); | 120 | int sub = to.find( ">:"); |
121 | if ( sub > 0 ) { | 121 | if ( sub > 0 ) { |
122 | compose.setTo( to.left(sub+1) ); | 122 | compose.setTo( to.left(sub+1) ); |
123 | compose.setSubject( to.mid(sub+2) ); | 123 | compose.setSubject( to.mid(sub+2) ); |
124 | } else | 124 | } else |
125 | compose.setTo( to ); | 125 | compose.setTo( to ); |
126 | } | 126 | } |
127 | compose.slotAdjustColumns(); | 127 | compose.slotAdjustColumns(); |
128 | #ifndef DESKTOP_VERSION | ||
128 | compose.showMaximized(); | 129 | compose.showMaximized(); |
130 | #endif | ||
129 | compose.exec(); | 131 | compose.exec(); |
130 | raise(); | 132 | raise(); |
131 | //qDebug("retttich "); | 133 | //qDebug("retttich "); |
132 | } | 134 | } |
133 | void OpieMail::slotwriteMail(const QString&name,const QString&email) | 135 | void OpieMail::slotwriteMail(const QString&name,const QString&email) |
134 | { | 136 | { |
135 | // qDebug("OpieMail::slotwriteMail "); | 137 | // qDebug("OpieMail::slotwriteMail "); |
136 | ComposeMail compose( settings, this, 0, true ); | 138 | ComposeMail compose( settings, this, 0, true ); |
137 | if (!email.isEmpty()) | 139 | if (!email.isEmpty()) |
138 | { | 140 | { |
139 | if (!name.isEmpty()) | 141 | if (!name.isEmpty()) |
140 | { | 142 | { |
141 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); | 143 | compose.setTo("\"" + name + "\"" + " " + "<"+ email + ">"); |
142 | } | 144 | } |
143 | else | 145 | else |
144 | { | 146 | { |
145 | compose.setTo(email); | 147 | compose.setTo(email); |
146 | } | 148 | } |
147 | } | 149 | } |
148 | compose.slotAdjustColumns(); | 150 | compose.slotAdjustColumns(); |
151 | #ifndef DESKTOP_VERSION | ||
149 | compose.showMaximized(); | 152 | compose.showMaximized(); |
153 | #endif | ||
150 | compose.exec(); | 154 | compose.exec(); |
151 | raise(); | 155 | raise(); |
152 | } | 156 | } |
153 | 157 | ||
154 | void OpieMail::slotComposeMail() | 158 | void OpieMail::slotComposeMail() |
155 | { | 159 | { |
156 | if ( mPendingEmail == QString::null && mPendingName == QString::null) | 160 | if ( mPendingEmail == QString::null && mPendingName == QString::null) |
157 | slotwriteMail2( QString () ); | 161 | slotwriteMail2( QString () ); |
158 | else { | 162 | else { |
159 | if ( mPendingEmail == QString::null ) | 163 | if ( mPendingEmail == QString::null ) |
160 | slotwriteMail2( mPendingName ); | 164 | slotwriteMail2( mPendingName ); |
161 | else | 165 | else |
162 | slotwriteMail( mPendingName, mPendingEmail ); | 166 | slotwriteMail( mPendingName, mPendingEmail ); |
163 | } | 167 | } |
164 | //slotwriteMail(0l,0l); | 168 | //slotwriteMail(0l,0l); |
165 | } | 169 | } |
166 | 170 | ||
167 | void OpieMail::slotSendQueued() | 171 | void OpieMail::slotSendQueued() |
168 | { | 172 | { |
169 | SMTPaccount *smtp = 0; | 173 | SMTPaccount *smtp = 0; |
170 | 174 | ||
171 | QList<Account> list = settings->getAccounts(); | 175 | QList<Account> list = settings->getAccounts(); |
172 | QList<SMTPaccount> smtpList; | 176 | QList<SMTPaccount> smtpList; |
173 | smtpList.setAutoDelete(false); | 177 | smtpList.setAutoDelete(false); |
174 | Account *it; | 178 | Account *it; |
175 | for ( it = list.first(); it; it = list.next() ) | 179 | for ( it = list.first(); it; it = list.next() ) |
176 | { | 180 | { |
177 | if ( it->getType() == MAILLIB::A_SMTP ) | 181 | if ( it->getType() == MAILLIB::A_SMTP ) |
178 | { | 182 | { |
179 | smtp = static_cast<SMTPaccount *>(it); | 183 | smtp = static_cast<SMTPaccount *>(it); |
180 | smtpList.append(smtp); | 184 | smtpList.append(smtp); |
181 | } | 185 | } |
182 | } | 186 | } |
183 | if (smtpList.count()==0) | 187 | if (smtpList.count()==0) |
184 | { | 188 | { |
185 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); | 189 | QMessageBox::information(0,i18n("Info"),i18n("Define a smtp account first!\n")); |
186 | return; | 190 | return; |
187 | } | 191 | } |
188 | if (smtpList.count()==1) | 192 | if (smtpList.count()==1) |
189 | { | 193 | { |
190 | smtp = smtpList.at(0); | 194 | smtp = smtpList.at(0); |
191 | } | 195 | } |
192 | else | 196 | else |
193 | { | 197 | { |
194 | smtp = 0; | 198 | smtp = 0; |
195 | selectsmtp selsmtp; | 199 | selectsmtp selsmtp; |
196 | selsmtp.setSelectionlist(&smtpList); | 200 | selsmtp.setSelectionlist(&smtpList); |
201 | #ifndef DESKTOP_VERSION | ||
197 | selsmtp.showMaximized(); | 202 | selsmtp.showMaximized(); |
203 | #endif | ||
198 | if ( selsmtp.exec() == QDialog::Accepted ) | 204 | if ( selsmtp.exec() == QDialog::Accepted ) |
199 | { | 205 | { |
200 | smtp = selsmtp.selected_smtp(); | 206 | smtp = selsmtp.selected_smtp(); |
201 | } | 207 | } |
202 | } | 208 | } |
203 | if (smtp) | 209 | if (smtp) |
204 | { | 210 | { |
205 | SMTPwrapper * wrap = new SMTPwrapper(smtp); | 211 | SMTPwrapper * wrap = new SMTPwrapper(smtp); |
206 | if ( wrap->flushOutbox() ) | 212 | if ( wrap->flushOutbox() ) |
207 | { | 213 | { |
208 | QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); | 214 | QMessageBox::information(0,i18n("Info"),i18n("Mail queue flushed")); |
209 | } | 215 | } |
210 | delete wrap; | 216 | delete wrap; |
211 | } | 217 | } |
212 | } | 218 | } |
213 | 219 | ||
214 | void OpieMail::slotSearchMails() | 220 | void OpieMail::slotSearchMails() |
215 | { | 221 | { |
216 | qDebug("OpieMail::slotSearchMails():not implemented "); | 222 | qDebug("OpieMail::slotSearchMails():not implemented "); |
217 | } | 223 | } |
218 | 224 | ||
219 | void OpieMail::slotEditSettings() | 225 | void OpieMail::slotEditSettings() |
220 | { | 226 | { |
221 | 227 | ||
222 | KOPrefsDialog settingsDialog( this, "koprefs", true ); | 228 | KOPrefsDialog settingsDialog( this, "koprefs", true ); |
223 | #ifndef DESKTOP_VERSION | 229 | #ifndef DESKTOP_VERSION |
224 | settingsDialog.showMaximized(); | 230 | settingsDialog.showMaximized(); |
225 | #endif | 231 | #endif |
226 | settingsDialog.exec(); | 232 | settingsDialog.exec(); |
227 | 233 | ||
228 | // KApplication::execDialog(settingsDialog); | 234 | // KApplication::execDialog(settingsDialog); |
229 | } | 235 | } |
230 | 236 | ||
231 | void OpieMail::slotEditAccounts() | 237 | void OpieMail::slotEditAccounts() |
232 | { | 238 | { |
233 | EditAccounts eaDialog( settings, this, 0, true ); | 239 | EditAccounts eaDialog( settings, this, 0, true ); |
234 | eaDialog.slotAdjustColumns(); | 240 | eaDialog.slotAdjustColumns(); |
235 | #ifndef DESKTOP_VERSION | 241 | #ifndef DESKTOP_VERSION |
236 | eaDialog.showMaximized(); | 242 | eaDialog.showMaximized(); |
237 | #endif | 243 | #endif |
238 | eaDialog.exec(); | 244 | eaDialog.exec(); |
239 | if ( settings ) delete settings; | 245 | if ( settings ) delete settings; |
240 | settings = new Settings(); | 246 | settings = new Settings(); |
241 | 247 | ||
242 | folderView->populate( settings->getAccounts() ); | 248 | folderView->populate( settings->getAccounts() ); |
243 | } | 249 | } |
244 | void OpieMail::replyMail() | 250 | void OpieMail::replyMail() |
245 | { | 251 | { |