author | zautrix <zautrix> | 2005-10-29 17:26:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-10-29 17:26:07 (UTC) |
commit | a4f17bd35c56280c45bda847b42b7d3a003b0a42 (patch) (unidiff) | |
tree | d0bc9ec6a81ecfb272c88248614f633835c454e8 | |
parent | 898dbabef6d747447999add46201315d04f85f63 (diff) | |
download | kdepimpi-a4f17bd35c56280c45bda847b42b7d3a003b0a42.zip kdepimpi-a4f17bd35c56280c45bda847b42b7d3a003b0a42.tar.gz kdepimpi-a4f17bd35c56280c45bda847b42b7d3a003b0a42.tar.bz2 |
commit
-rw-r--r-- | libkdepim/externalapphandler.cpp | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index edefda4..59be506 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -529,570 +529,589 @@ QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) | |||
529 | if (dai->_type == type) | 529 | if (dai->_type == type) |
530 | list.append(dai); | 530 | list.append(dai); |
531 | } | 531 | } |
532 | 532 | ||
533 | return list; | 533 | return list; |
534 | } | 534 | } |
535 | 535 | ||
536 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | 536 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) |
537 | { | 537 | { |
538 | DefaultAppItem* dai; | 538 | DefaultAppItem* dai; |
539 | 539 | ||
540 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 540 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
541 | { | 541 | { |
542 | if (dai->_type == type && dai->_id == clientid) | 542 | if (dai->_type == type && dai->_id == clientid) |
543 | return dai; | 543 | return dai; |
544 | } | 544 | } |
545 | 545 | ||
546 | return 0; | 546 | return 0; |
547 | } | 547 | } |
548 | 548 | ||
549 | bool ExternalAppHandler::isEmailAppAvailable() | 549 | bool ExternalAppHandler::isEmailAppAvailable() |
550 | { | 550 | { |
551 | 551 | ||
552 | if (mEmailAppAvailable == UNDEFINED) | 552 | if (mEmailAppAvailable == UNDEFINED) |
553 | { | 553 | { |
554 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 554 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
555 | if (client == KPimGlobalPrefs::NONE_EMC) | 555 | if (client == KPimGlobalPrefs::NONE_EMC) |
556 | mEmailAppAvailable = UNAVAILABLE; | 556 | mEmailAppAvailable = UNAVAILABLE; |
557 | else | 557 | else |
558 | mEmailAppAvailable = AVAILABLE; | 558 | mEmailAppAvailable = AVAILABLE; |
559 | } | 559 | } |
560 | return (mEmailAppAvailable == AVAILABLE); | 560 | return (mEmailAppAvailable == AVAILABLE); |
561 | 561 | ||
562 | } | 562 | } |
563 | 563 | ||
564 | bool ExternalAppHandler::isSMSAppAvailable() | 564 | bool ExternalAppHandler::isSMSAppAvailable() |
565 | { | 565 | { |
566 | #ifndef DESKTOP_VERSION | 566 | #ifndef DESKTOP_VERSION |
567 | if (mSMSAppAvailable == UNDEFINED) | 567 | if (mSMSAppAvailable == UNDEFINED) |
568 | { | 568 | { |
569 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 569 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
570 | if (client == KPimGlobalPrefs::NONE_SMC) | 570 | if (client == KPimGlobalPrefs::NONE_SMC) |
571 | mSMSAppAvailable = UNAVAILABLE; | 571 | mSMSAppAvailable = UNAVAILABLE; |
572 | else | 572 | else |
573 | mSMSAppAvailable = AVAILABLE; | 573 | mSMSAppAvailable = AVAILABLE; |
574 | } | 574 | } |
575 | 575 | ||
576 | return (mSMSAppAvailable == AVAILABLE); | 576 | return (mSMSAppAvailable == AVAILABLE); |
577 | #else //DESKTOP_VERSION | 577 | #else //DESKTOP_VERSION |
578 | return false; | 578 | return false; |
579 | #endif //DESKTOP_VERSION | 579 | #endif //DESKTOP_VERSION |
580 | } | 580 | } |
581 | 581 | ||
582 | bool ExternalAppHandler::isPhoneAppAvailable() | 582 | bool ExternalAppHandler::isPhoneAppAvailable() |
583 | { | 583 | { |
584 | #ifndef DESKTOP_VERSION | 584 | #ifndef DESKTOP_VERSION |
585 | if (mPhoneAppAvailable == UNDEFINED) | 585 | if (mPhoneAppAvailable == UNDEFINED) |
586 | { | 586 | { |
587 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 587 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
588 | if (client == KPimGlobalPrefs::NONE_PHC) | 588 | if (client == KPimGlobalPrefs::NONE_PHC) |
589 | mPhoneAppAvailable = UNAVAILABLE; | 589 | mPhoneAppAvailable = UNAVAILABLE; |
590 | else | 590 | else |
591 | mPhoneAppAvailable = AVAILABLE; | 591 | mPhoneAppAvailable = AVAILABLE; |
592 | } | 592 | } |
593 | 593 | ||
594 | return (mPhoneAppAvailable == AVAILABLE); | 594 | return (mPhoneAppAvailable == AVAILABLE); |
595 | #else //DESKTOP_VERSION | 595 | #else //DESKTOP_VERSION |
596 | return false; | 596 | return false; |
597 | #endif //DESKTOP_VERSION | 597 | #endif //DESKTOP_VERSION |
598 | } | 598 | } |
599 | 599 | ||
600 | bool ExternalAppHandler::isFaxAppAvailable() | 600 | bool ExternalAppHandler::isFaxAppAvailable() |
601 | { | 601 | { |
602 | #ifndef DESKTOP_VERSION | 602 | #ifndef DESKTOP_VERSION |
603 | if (mFaxAppAvailable == UNDEFINED) | 603 | if (mFaxAppAvailable == UNDEFINED) |
604 | { | 604 | { |
605 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 605 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
606 | if (client == KPimGlobalPrefs::NONE_FAC) | 606 | if (client == KPimGlobalPrefs::NONE_FAC) |
607 | mFaxAppAvailable = UNAVAILABLE; | 607 | mFaxAppAvailable = UNAVAILABLE; |
608 | else | 608 | else |
609 | mFaxAppAvailable = AVAILABLE; | 609 | mFaxAppAvailable = AVAILABLE; |
610 | } | 610 | } |
611 | 611 | ||
612 | return (mFaxAppAvailable == AVAILABLE); | 612 | return (mFaxAppAvailable == AVAILABLE); |
613 | #else //DESKTOP_VERSION | 613 | #else //DESKTOP_VERSION |
614 | return false; | 614 | return false; |
615 | #endif //DESKTOP_VERSION | 615 | #endif //DESKTOP_VERSION |
616 | } | 616 | } |
617 | 617 | ||
618 | bool ExternalAppHandler::isPagerAppAvailable() | 618 | bool ExternalAppHandler::isPagerAppAvailable() |
619 | { | 619 | { |
620 | #ifndef DESKTOP_VERSION | 620 | #ifndef DESKTOP_VERSION |
621 | if (mPagerAppAvailable == UNDEFINED) | 621 | if (mPagerAppAvailable == UNDEFINED) |
622 | { | 622 | { |
623 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 623 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
624 | if (client == KPimGlobalPrefs::NONE_PAC) | 624 | if (client == KPimGlobalPrefs::NONE_PAC) |
625 | mPagerAppAvailable = UNAVAILABLE; | 625 | mPagerAppAvailable = UNAVAILABLE; |
626 | else | 626 | else |
627 | mPagerAppAvailable = AVAILABLE; | 627 | mPagerAppAvailable = AVAILABLE; |
628 | } | 628 | } |
629 | 629 | ||
630 | return (mPagerAppAvailable == AVAILABLE); | 630 | return (mPagerAppAvailable == AVAILABLE); |
631 | #else //DESKTOP_VERSION | 631 | #else //DESKTOP_VERSION |
632 | return false; | 632 | return false; |
633 | #endif //DESKTOP_VERSION | 633 | #endif //DESKTOP_VERSION |
634 | } | 634 | } |
635 | 635 | ||
636 | 636 | ||
637 | bool ExternalAppHandler::isSIPAppAvailable() | 637 | bool ExternalAppHandler::isSIPAppAvailable() |
638 | { | 638 | { |
639 | #ifndef DESKTOP_VERSION | 639 | #ifndef DESKTOP_VERSION |
640 | if (mSIPAppAvailable == UNDEFINED) | 640 | if (mSIPAppAvailable == UNDEFINED) |
641 | { | 641 | { |
642 | int client = KPimGlobalPrefs::instance()->mSipClient; | 642 | int client = KPimGlobalPrefs::instance()->mSipClient; |
643 | if (client == KPimGlobalPrefs::NONE_SIC) | 643 | if (client == KPimGlobalPrefs::NONE_SIC) |
644 | mSIPAppAvailable = UNAVAILABLE; | 644 | mSIPAppAvailable = UNAVAILABLE; |
645 | else | 645 | else |
646 | mSIPAppAvailable = AVAILABLE; | 646 | mSIPAppAvailable = AVAILABLE; |
647 | } | 647 | } |
648 | 648 | ||
649 | return (mSIPAppAvailable == AVAILABLE); | 649 | return (mSIPAppAvailable == AVAILABLE); |
650 | #else //DESKTOP_VERSION | 650 | #else //DESKTOP_VERSION |
651 | return false; | 651 | return false; |
652 | #endif //DESKTOP_VERSION | 652 | #endif //DESKTOP_VERSION |
653 | } | 653 | } |
654 | 654 | ||
655 | /************************************************************************** | 655 | /************************************************************************** |
656 | * | 656 | * |
657 | **************************************************************************/ | 657 | **************************************************************************/ |
658 | 658 | ||
659 | 659 | ||
660 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) | 660 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) |
661 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) | 661 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) |
662 | { | 662 | { |
663 | 663 | ||
664 | #ifndef DESKTOP_VERSION | 664 | #ifndef DESKTOP_VERSION |
665 | QString channel; | 665 | QString channel; |
666 | QString message2; | 666 | QString message2; |
667 | QString parameters2; | 667 | QString parameters2; |
668 | 668 | ||
669 | 669 | ||
670 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 670 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
671 | if (client == KPimGlobalPrefs::OTHER_EMC) | 671 | if (client == KPimGlobalPrefs::OTHER_EMC) |
672 | { | 672 | { |
673 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 673 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
674 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 674 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
675 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 675 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
676 | } | 676 | } |
677 | else | 677 | else |
678 | { | 678 | { |
679 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | 679 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); |
680 | if (!dai) | 680 | if (!dai) |
681 | { | 681 | { |
682 | qDebug("could not find configured email application."); | 682 | qDebug("could not find configured email application."); |
683 | return false; | 683 | return false; |
684 | } | 684 | } |
685 | channel = dai->_channel; | 685 | channel = dai->_channel; |
686 | message2 = dai->_message2; | 686 | message2 = dai->_message2; |
687 | parameters2 = dai->_parameters2; | 687 | parameters2 = dai->_parameters2; |
688 | } | 688 | } |
689 | 689 | ||
690 | //first check if one of the mailers need the emails right in the message. | 690 | //first check if one of the mailers need the emails right in the message. |
691 | message2 = translateMessage(message2, emails, urls); | 691 | message2 = translateMessage(message2, emails, urls); |
692 | 692 | ||
693 | 693 | ||
694 | #ifdef DEBUG_EXT_APP_HANDLER | 694 | #ifdef DEBUG_EXT_APP_HANDLER |
695 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 695 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
696 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 696 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
697 | #endif | 697 | #endif |
698 | 698 | ||
699 | 699 | ||
700 | QCopEnvelope e(channel.latin1(), message2.latin1()); | 700 | QCopEnvelope e(channel.latin1(), message2.latin1()); |
701 | //US we need no names in the To field. The emailadresses are enough | 701 | //US we need no names in the To field. The emailadresses are enough |
702 | 702 | ||
703 | passParameters(&e, parameters2, emails, urls); | 703 | passParameters(&e, parameters2, emails, urls); |
704 | 704 | ||
705 | 705 | ||
706 | 706 | ||
707 | #else | 707 | #else |
708 | //qDebug("mtmc %s %s ", emails.latin1(), urls.latin1()); | 708 | //qDebug("mtmc %s %s ", emails.latin1(), urls.latin1()); |
709 | 709 | ||
710 | QString channel; | 710 | QString channel; |
711 | QString message2; | 711 | QString message2; |
712 | QString parameters2; | 712 | QString parameters2; |
713 | QString message; | 713 | QString message; |
714 | QString parameters; | 714 | QString parameters; |
715 | 715 | ||
716 | 716 | ||
717 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 717 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
718 | if (client == KPimGlobalPrefs::OTHER_EMC) | 718 | if (client == KPimGlobalPrefs::OTHER_EMC) |
719 | { | 719 | { |
720 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 720 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
721 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 721 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
722 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 722 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage2; |
723 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | ||
724 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters2; | ||
723 | } | 725 | } |
724 | else | 726 | else |
725 | { | 727 | { |
726 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | 728 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); |
727 | if (!dai) | 729 | if (!dai) |
728 | { | 730 | { |
729 | qDebug("could not find configured email application."); | 731 | qDebug("could not find configured email application."); |
730 | return false; | 732 | return false; |
731 | } | 733 | } |
732 | channel = dai->_channel; | 734 | channel = dai->_channel; |
733 | message2 = dai->_message2; | 735 | message2 = dai->_message2; |
734 | parameters2 = dai->_parameters2; | 736 | parameters2 = dai->_parameters2; |
735 | message = dai->_message; | 737 | message = dai->_message; |
736 | parameters = dai->_parameters; | 738 | parameters = dai->_parameters; |
737 | } | 739 | } |
738 | 740 | ||
739 | //first check if one of the mailers need the emails right in the message. | 741 | //first check if one of the mailers need the emails right in the message. |
740 | message2 = translateMessage(message2, emails, urls); | 742 | message2 = translateMessage(message2, emails, urls); |
741 | #ifdef DEBUG_EXT_APP_HANDLER | 743 | #ifdef DEBUG_EXT_APP_HANDLER |
742 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 744 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
743 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 745 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
744 | #endif | 746 | #endif |
745 | qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() ); | 747 | qDebug("%s --- %s %s --- %s %s", channel.latin1(), message.latin1(),message2.latin1(), parameters.latin1(), parameters2.latin1() ); |
746 | //KMessageBox::sorry( 0, message2 ); | 748 | //KMessageBox::sorry( 0, message2 ); |
747 | QProcess * proc = new QProcess( this ); | 749 | QProcess * proc = new QProcess( this ); |
748 | QStringList list = QStringList::split( " ", message ); | ||
749 | int i = 0; | 750 | int i = 0; |
750 | proc->addArgument( channel ); | 751 | proc->addArgument( channel ); |
751 | while ( i < list.count ( ) ) { | 752 | |
752 | //qDebug("add%sdd ",list[i].stripWhiteSpace().latin1() ); | 753 | if ( message.find (" " ) > 0 ) { |
753 | proc->addArgument( list[i].stripWhiteSpace() ); | 754 | QStringList list = QStringList::split( " ", message ); |
755 | int i = 0; | ||
756 | while ( i < list.count ( ) ) { | ||
757 | //qDebug("add%sdd ",list[i].latin1() ); | ||
758 | proc->addArgument( list[i] ); | ||
759 | //KMessageBox::sorry( 0,list[i]); | ||
754 | ++i; | 760 | ++i; |
761 | } | ||
762 | } else { | ||
763 | proc->addArgument(message ); | ||
764 | //KMessageBox::sorry( 0, message ); | ||
765 | |||
755 | } | 766 | } |
767 | |||
756 | parameters2 = translateMessage(parameters2, urls, "" ); | 768 | parameters2 = translateMessage(parameters2, urls, "" ); |
757 | QString arg = "to='%1'"; | 769 | QString arg = "to='%1'"; |
758 | arg = arg.arg( emails ) + ","+parameters2;; | 770 | arg = arg.arg( emails ) + ","+parameters2;; |
759 | 771 | ||
772 | //KMessageBox::sorry( 0,arg ); | ||
760 | //qDebug("2add%sdd ",arg.latin1() ); | 773 | //qDebug("2add%sdd ",arg.latin1() ); |
761 | proc->addArgument( arg); | 774 | proc->addArgument( arg); |
762 | proc->launch(""); | 775 | proc->launch(""); |
763 | #endif | 776 | #endif |
764 | 777 | ||
765 | return true; | 778 | return true; |
766 | } | 779 | } |
767 | 780 | ||
768 | /************************************************************************** | 781 | /************************************************************************** |
769 | * | 782 | * |
770 | **************************************************************************/ | 783 | **************************************************************************/ |
771 | 784 | ||
772 | 785 | ||
773 | //calls the emailapplication and creates a mail with parameter emails as recipients | 786 | //calls the emailapplication and creates a mail with parameter emails as recipients |
774 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) | 787 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
775 | { | 788 | { |
776 | 789 | ||
777 | QString channel; | 790 | QString channel; |
778 | QString message; | 791 | QString message; |
779 | QString parameters; | 792 | QString parameters; |
780 | 793 | ||
781 | 794 | ||
782 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 795 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
783 | if (client == KPimGlobalPrefs::OTHER_EMC) | 796 | if (client == KPimGlobalPrefs::OTHER_EMC) |
784 | { | 797 | { |
785 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 798 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
786 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 799 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
787 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 800 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
788 | } | 801 | } |
789 | else | 802 | else |
790 | { | 803 | { |
791 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); | 804 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); |
792 | if (!dai) | 805 | if (!dai) |
793 | { | 806 | { |
794 | qDebug("could not find configured email application."); | 807 | qDebug("could not find configured email application."); |
795 | return false; | 808 | return false; |
796 | } | 809 | } |
797 | channel = dai->_channel; | 810 | channel = dai->_channel; |
798 | message = dai->_message; | 811 | message = dai->_message; |
799 | parameters = dai->_parameters; | 812 | parameters = dai->_parameters; |
800 | } | 813 | } |
801 | 814 | ||
802 | #ifdef DESKTOP_VERSION | 815 | #ifdef DESKTOP_VERSION |
803 | //message = channel + " " +message + " \""+ parameters + "\""; | 816 | //message = channel + " " +message + " \""+ parameters + "\""; |
804 | #endif | 817 | #endif |
805 | //first check if one of the mailers need the emails right in the message. | 818 | //first check if one of the mailers need the emails right in the message. |
806 | message = translateMessage(message, name, emailadress); | 819 | message = translateMessage(message, name, emailadress); |
807 | 820 | ||
808 | #ifdef DEBUG_EXT_APP_HANDLER | 821 | #ifdef DEBUG_EXT_APP_HANDLER |
809 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 822 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
810 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); | 823 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
811 | #endif | 824 | #endif |
812 | 825 | ||
813 | #ifndef DESKTOP_VERSION | 826 | #ifndef DESKTOP_VERSION |
814 | QCopEnvelope e(channel.latin1(), message.latin1()); | 827 | QCopEnvelope e(channel.latin1(), message.latin1()); |
815 | //US we need no names in the To field. The emailadresses are enough | 828 | //US we need no names in the To field. The emailadresses are enough |
816 | 829 | ||
817 | passParameters(&e, parameters, name, emailadress); | 830 | passParameters(&e, parameters, name, emailadress); |
818 | #else // DESKTOP_VERSION | 831 | #else // DESKTOP_VERSION |
819 | 832 | ||
820 | //KMessageBox::sorry( 0, message ); | 833 | //KMessageBox::sorry( 0,channel ); |
821 | QProcess * proc = new QProcess( this ); | 834 | QProcess * proc = new QProcess( this ); |
822 | QStringList list = QStringList::split( " ", message ); | ||
823 | int i = 0; | ||
824 | proc->addArgument( channel ); | 835 | proc->addArgument( channel ); |
825 | while ( i < list.count ( ) ) { | 836 | if ( message.find (" " ) > 0 ) { |
837 | QStringList list = QStringList::split( " ", message ); | ||
838 | int i = 0; | ||
839 | while ( i < list.count ( ) ) { | ||
826 | //qDebug("add%sdd ",list[i].latin1() ); | 840 | //qDebug("add%sdd ",list[i].latin1() ); |
827 | proc->addArgument( list[i] ); | 841 | proc->addArgument( list[i] ); |
842 | //KMessageBox::sorry( 0,list[i]); | ||
828 | ++i; | 843 | ++i; |
844 | } | ||
845 | } else { | ||
846 | proc->addArgument(message ); | ||
847 | |||
829 | } | 848 | } |
830 | parameters = translateMessage(parameters, name, emailadress); | 849 | parameters = translateMessage(parameters, name, emailadress); |
831 | proc->addArgument( parameters ); | 850 | proc->addArgument( parameters ); |
832 | proc->launch(""); | 851 | proc->launch(""); |
833 | #endif | 852 | #endif |
834 | 853 | ||
835 | return true; | 854 | return true; |
836 | } | 855 | } |
837 | 856 | ||
838 | /************************************************************************** | 857 | /************************************************************************** |
839 | * | 858 | * |
840 | **************************************************************************/ | 859 | **************************************************************************/ |
841 | 860 | ||
842 | //calls the emailapplication and creates a mail with parameter as recipients | 861 | //calls the emailapplication and creates a mail with parameter as recipients |
843 | // parameters format is | 862 | // parameters format is |
844 | // NAME <EMAIL>:SUBJECT | 863 | // NAME <EMAIL>:SUBJECT |
845 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) | 864 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) |
846 | { | 865 | { |
847 | QString line = adressline; | 866 | QString line = adressline; |
848 | 867 | ||
849 | int first = line.find( "<"); | 868 | int first = line.find( "<"); |
850 | int last = line.find( ">"); | 869 | int last = line.find( ">"); |
851 | QString name = line.left(first); | 870 | QString name = line.left(first); |
852 | QString emailadress = line.mid(first+1, last-first-1); | 871 | QString emailadress = line.mid(first+1, last-first-1); |
853 | 872 | ||
854 | //Subject can not be handled right now. | 873 | //Subject can not be handled right now. |
855 | return mailToOneContact( name, emailadress ); | 874 | return mailToOneContact( name, emailadress ); |
856 | 875 | ||
857 | } | 876 | } |
858 | 877 | ||
859 | 878 | ||
860 | /************************************************************************** | 879 | /************************************************************************** |
861 | * | 880 | * |
862 | **************************************************************************/ | 881 | **************************************************************************/ |
863 | 882 | ||
864 | //calls the phoneapplication with the number | 883 | //calls the phoneapplication with the number |
865 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | 884 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) |
866 | { | 885 | { |
867 | #ifndef DESKTOP_VERSION | 886 | #ifndef DESKTOP_VERSION |
868 | QString channel; | 887 | QString channel; |
869 | QString message; | 888 | QString message; |
870 | QString parameters; | 889 | QString parameters; |
871 | 890 | ||
872 | 891 | ||
873 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 892 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
874 | if (client == KPimGlobalPrefs::OTHER_PHC) | 893 | if (client == KPimGlobalPrefs::OTHER_PHC) |
875 | { | 894 | { |
876 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; | 895 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; |
877 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; | 896 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; |
878 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; | 897 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; |
879 | } | 898 | } |
880 | else | 899 | else |
881 | { | 900 | { |
882 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); | 901 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); |
883 | if (!dai) | 902 | if (!dai) |
884 | { | 903 | { |
885 | qDebug("could not find configured phone application."); | 904 | qDebug("could not find configured phone application."); |
886 | return false; | 905 | return false; |
887 | } | 906 | } |
888 | channel = dai->_channel; | 907 | channel = dai->_channel; |
889 | message = dai->_message; | 908 | message = dai->_message; |
890 | parameters = dai->_parameters; | 909 | parameters = dai->_parameters; |
891 | } | 910 | } |
892 | 911 | ||
893 | 912 | ||
894 | //first check if one of the mailers need the emails right in the message. | 913 | //first check if one of the mailers need the emails right in the message. |
895 | message = translateMessage(message, phonenumber, ""); | 914 | message = translateMessage(message, phonenumber, ""); |
896 | 915 | ||
897 | 916 | ||
898 | #ifdef DEBUG_EXT_APP_HANDLER | 917 | #ifdef DEBUG_EXT_APP_HANDLER |
899 | qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 918 | qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
900 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 919 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
901 | #endif | 920 | #endif |
902 | 921 | ||
903 | QCopEnvelope e(channel.latin1(), message.latin1()); | 922 | QCopEnvelope e(channel.latin1(), message.latin1()); |
904 | //US we need no names in the To field. The emailadresses are enough | 923 | //US we need no names in the To field. The emailadresses are enough |
905 | 924 | ||
906 | passParameters(&e, parameters, phonenumber, ""); | 925 | passParameters(&e, parameters, phonenumber, ""); |
907 | 926 | ||
908 | 927 | ||
909 | #else | 928 | #else |
910 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); | 929 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); |
911 | #endif | 930 | #endif |
912 | 931 | ||
913 | 932 | ||
914 | return true; | 933 | return true; |
915 | } | 934 | } |
916 | 935 | ||
917 | /************************************************************************** | 936 | /************************************************************************** |
918 | * | 937 | * |
919 | **************************************************************************/ | 938 | **************************************************************************/ |
920 | 939 | ||
921 | //calls the smsapplication with the number | 940 | //calls the smsapplication with the number |
922 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | 941 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) |
923 | { | 942 | { |
924 | #ifndef DESKTOP_VERSION | 943 | #ifndef DESKTOP_VERSION |
925 | QString channel; | 944 | QString channel; |
926 | QString message; | 945 | QString message; |
927 | QString parameters; | 946 | QString parameters; |
928 | 947 | ||
929 | 948 | ||
930 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 949 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
931 | if (client == KPimGlobalPrefs::OTHER_SMC) | 950 | if (client == KPimGlobalPrefs::OTHER_SMC) |
932 | { | 951 | { |
933 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; | 952 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; |
934 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; | 953 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; |
935 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; | 954 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; |
936 | } | 955 | } |
937 | else | 956 | else |
938 | { | 957 | { |
939 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); | 958 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); |
940 | if (!dai) | 959 | if (!dai) |
941 | { | 960 | { |
942 | qDebug("could not find configured sms application."); | 961 | qDebug("could not find configured sms application."); |
943 | return false; | 962 | return false; |
944 | } | 963 | } |
945 | channel = dai->_channel; | 964 | channel = dai->_channel; |
946 | message = dai->_message; | 965 | message = dai->_message; |
947 | parameters = dai->_parameters; | 966 | parameters = dai->_parameters; |
948 | } | 967 | } |
949 | 968 | ||
950 | 969 | ||
951 | //first check if one of the mailers need the emails right in the message. | 970 | //first check if one of the mailers need the emails right in the message. |
952 | message = translateMessage(message, phonenumber, ""); | 971 | message = translateMessage(message, phonenumber, ""); |
953 | 972 | ||
954 | 973 | ||
955 | #ifdef DEBUG_EXT_APP_HANDLER | 974 | #ifdef DEBUG_EXT_APP_HANDLER |
956 | qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 975 | qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
957 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 976 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
958 | #endif | 977 | #endif |
959 | 978 | ||
960 | QCopEnvelope e(channel.latin1(), message.latin1()); | 979 | QCopEnvelope e(channel.latin1(), message.latin1()); |
961 | //US we need no names in the To field. The emailadresses are enough | 980 | //US we need no names in the To field. The emailadresses are enough |
962 | 981 | ||
963 | passParameters(&e, parameters, phonenumber, ""); | 982 | passParameters(&e, parameters, phonenumber, ""); |
964 | 983 | ||
965 | 984 | ||
966 | #else | 985 | #else |
967 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); | 986 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); |
968 | #endif | 987 | #endif |
969 | 988 | ||
970 | 989 | ||
971 | return true; | 990 | return true; |
972 | } | 991 | } |
973 | 992 | ||
974 | /************************************************************************** | 993 | /************************************************************************** |
975 | * | 994 | * |
976 | **************************************************************************/ | 995 | **************************************************************************/ |
977 | 996 | ||
978 | //calls the pagerapplication with the number | 997 | //calls the pagerapplication with the number |
979 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) | 998 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) |
980 | { | 999 | { |
981 | #ifndef DESKTOP_VERSION | 1000 | #ifndef DESKTOP_VERSION |
982 | QString channel; | 1001 | QString channel; |
983 | QString message; | 1002 | QString message; |
984 | QString parameters; | 1003 | QString parameters; |
985 | 1004 | ||
986 | 1005 | ||
987 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 1006 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
988 | if (client == KPimGlobalPrefs::OTHER_PAC) | 1007 | if (client == KPimGlobalPrefs::OTHER_PAC) |
989 | { | 1008 | { |
990 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; | 1009 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; |
991 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; | 1010 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; |
992 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; | 1011 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; |
993 | } | 1012 | } |
994 | else | 1013 | else |
995 | { | 1014 | { |
996 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); | 1015 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); |
997 | if (!dai) | 1016 | if (!dai) |
998 | { | 1017 | { |
999 | qDebug("could not find configured pager application."); | 1018 | qDebug("could not find configured pager application."); |
1000 | return false; | 1019 | return false; |
1001 | } | 1020 | } |
1002 | channel = dai->_channel; | 1021 | channel = dai->_channel; |
1003 | message = dai->_message; | 1022 | message = dai->_message; |
1004 | parameters = dai->_parameters; | 1023 | parameters = dai->_parameters; |
1005 | } | 1024 | } |
1006 | 1025 | ||
1007 | 1026 | ||
1008 | //first check if one of the mailers need the emails right in the message. | 1027 | //first check if one of the mailers need the emails right in the message. |
1009 | message = translateMessage(message, pagernumber, ""); | 1028 | message = translateMessage(message, pagernumber, ""); |
1010 | 1029 | ||
1011 | 1030 | ||
1012 | #ifdef DEBUG_EXT_APP_HANDLER | 1031 | #ifdef DEBUG_EXT_APP_HANDLER |
1013 | qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 1032 | qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
1014 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); | 1033 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); |
1015 | #endif | 1034 | #endif |
1016 | 1035 | ||
1017 | QCopEnvelope e(channel.latin1(), message.latin1()); | 1036 | QCopEnvelope e(channel.latin1(), message.latin1()); |
1018 | //US we need no names in the To field. The emailadresses are enough | 1037 | //US we need no names in the To field. The emailadresses are enough |
1019 | 1038 | ||
1020 | passParameters(&e, parameters, pagernumber, ""); | 1039 | passParameters(&e, parameters, pagernumber, ""); |
1021 | 1040 | ||
1022 | 1041 | ||
1023 | #else | 1042 | #else |
1024 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); | 1043 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); |
1025 | #endif | 1044 | #endif |
1026 | 1045 | ||
1027 | 1046 | ||
1028 | return true; | 1047 | return true; |
1029 | } | 1048 | } |
1030 | 1049 | ||
1031 | /************************************************************************** | 1050 | /************************************************************************** |
1032 | * | 1051 | * |
1033 | **************************************************************************/ | 1052 | **************************************************************************/ |
1034 | 1053 | ||
1035 | //calls the faxapplication with the number | 1054 | //calls the faxapplication with the number |
1036 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) | 1055 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) |
1037 | { | 1056 | { |
1038 | #ifndef DESKTOP_VERSION | 1057 | #ifndef DESKTOP_VERSION |
1039 | QString channel; | 1058 | QString channel; |
1040 | QString message; | 1059 | QString message; |
1041 | QString parameters; | 1060 | QString parameters; |
1042 | 1061 | ||
1043 | 1062 | ||
1044 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 1063 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
1045 | if (client == KPimGlobalPrefs::OTHER_FAC) | 1064 | if (client == KPimGlobalPrefs::OTHER_FAC) |
1046 | { | 1065 | { |
1047 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; | 1066 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; |
1048 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; | 1067 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; |
1049 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; | 1068 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; |
1050 | } | 1069 | } |
1051 | else | 1070 | else |
1052 | { | 1071 | { |
1053 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); | 1072 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); |
1054 | if (!dai) | 1073 | if (!dai) |
1055 | { | 1074 | { |
1056 | qDebug("could not find configured fax application."); | 1075 | qDebug("could not find configured fax application."); |
1057 | return false; | 1076 | return false; |
1058 | } | 1077 | } |
1059 | channel = dai->_channel; | 1078 | channel = dai->_channel; |
1060 | message = dai->_message; | 1079 | message = dai->_message; |
1061 | parameters = dai->_parameters; | 1080 | parameters = dai->_parameters; |
1062 | } | 1081 | } |
1063 | 1082 | ||
1064 | 1083 | ||
1065 | //first check if one of the mailers need the emails right in the message. | 1084 | //first check if one of the mailers need the emails right in the message. |
1066 | message = translateMessage(message, faxnumber, ""); | 1085 | message = translateMessage(message, faxnumber, ""); |
1067 | 1086 | ||
1068 | 1087 | ||
1069 | #ifdef DEBUG_EXT_APP_HANDLER | 1088 | #ifdef DEBUG_EXT_APP_HANDLER |
1070 | qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 1089 | qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
1071 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); | 1090 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); |
1072 | #endif | 1091 | #endif |
1073 | 1092 | ||
1074 | QCopEnvelope e(channel.latin1(), message.latin1()); | 1093 | QCopEnvelope e(channel.latin1(), message.latin1()); |
1075 | //US we need no names in the To field. The emailadresses are enough | 1094 | //US we need no names in the To field. The emailadresses are enough |
1076 | 1095 | ||
1077 | passParameters(&e, parameters, faxnumber, ""); | 1096 | passParameters(&e, parameters, faxnumber, ""); |
1078 | 1097 | ||
1079 | 1098 | ||
1080 | #else | 1099 | #else |
1081 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); | 1100 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); |
1082 | #endif | 1101 | #endif |
1083 | 1102 | ||
1084 | 1103 | ||
1085 | return true; | 1104 | return true; |
1086 | } | 1105 | } |
1087 | 1106 | ||
1088 | /************************************************************************** | 1107 | /************************************************************************** |
1089 | * | 1108 | * |
1090 | **************************************************************************/ | 1109 | **************************************************************************/ |
1091 | 1110 | ||
1092 | //calls the sipapplication with the number | 1111 | //calls the sipapplication with the number |
1093 | bool ExternalAppHandler::callBySIP( const QString& sipnumber ) | 1112 | bool ExternalAppHandler::callBySIP( const QString& sipnumber ) |
1094 | { | 1113 | { |
1095 | #ifndef DESKTOP_VERSION | 1114 | #ifndef DESKTOP_VERSION |
1096 | QString channel; | 1115 | QString channel; |
1097 | QString message; | 1116 | QString message; |
1098 | QString parameters; | 1117 | QString parameters; |