Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libkdepim/externalapphandler.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index 0d66a5a..0e9c5e5 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -652,560 +652,560 @@ bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QS | |||
652 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 652 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
653 | if (client == KPimGlobalPrefs::OTHER_EMC) | 653 | if (client == KPimGlobalPrefs::OTHER_EMC) |
654 | { | 654 | { |
655 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 655 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
656 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 656 | message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
657 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 657 | parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
658 | } | 658 | } |
659 | else | 659 | else |
660 | { | 660 | { |
661 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); | 661 | DefaultAppItem* dai = getDefaultItem(EMAIL, client); |
662 | if (!dai) | 662 | if (!dai) |
663 | { | 663 | { |
664 | qDebug("could not find configured email application."); | 664 | qDebug("could not find configured email application."); |
665 | return false; | 665 | return false; |
666 | } | 666 | } |
667 | channel = dai->_channel; | 667 | channel = dai->_channel; |
668 | message2 = dai->_message2; | 668 | message2 = dai->_message2; |
669 | parameters2 = dai->_parameters2; | 669 | parameters2 = dai->_parameters2; |
670 | } | 670 | } |
671 | 671 | ||
672 | //first check if one of the mailers need the emails right in the message. | 672 | //first check if one of the mailers need the emails right in the message. |
673 | message2 = translateMessage(message2, emails, urls); | 673 | message2 = translateMessage(message2, emails, urls); |
674 | 674 | ||
675 | 675 | ||
676 | #ifdef DEBUG_EXT_APP_HANDLER | 676 | #ifdef DEBUG_EXT_APP_HANDLER |
677 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); | 677 | qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); |
678 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); | 678 | qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); |
679 | #endif | 679 | #endif |
680 | 680 | ||
681 | 681 | ||
682 | QCopEnvelope e(channel.latin1(), message2.latin1()); | 682 | QCopEnvelope e(channel.latin1(), message2.latin1()); |
683 | //US we need no names in the To field. The emailadresses are enough | 683 | //US we need no names in the To field. The emailadresses are enough |
684 | 684 | ||
685 | passParameters(&e, parameters2, emails, urls); | 685 | passParameters(&e, parameters2, emails, urls); |
686 | 686 | ||
687 | 687 | ||
688 | 688 | ||
689 | #else | 689 | #else |
690 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 690 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
691 | #endif | 691 | #endif |
692 | 692 | ||
693 | return true; | 693 | return true; |
694 | } | 694 | } |
695 | 695 | ||
696 | /************************************************************************** | 696 | /************************************************************************** |
697 | * | 697 | * |
698 | **************************************************************************/ | 698 | **************************************************************************/ |
699 | 699 | ||
700 | 700 | ||
701 | //calls the emailapplication and creates a mail with parameter emails as recipients | 701 | //calls the emailapplication and creates a mail with parameter emails as recipients |
702 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) | 702 | bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) |
703 | { | 703 | { |
704 | #ifndef DESKTOP_VERSION | 704 | #ifndef DESKTOP_VERSION |
705 | QString channel; | 705 | QString channel; |
706 | QString message; | 706 | QString message; |
707 | QString parameters; | 707 | QString parameters; |
708 | 708 | ||
709 | 709 | ||
710 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 710 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
711 | if (client == KPimGlobalPrefs::OTHER_EMC) | 711 | if (client == KPimGlobalPrefs::OTHER_EMC) |
712 | { | 712 | { |
713 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; | 713 | channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; |
714 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; | 714 | message = KPimGlobalPrefs::instance()->mEmailOtherMessage; |
715 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; | 715 | parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; |
716 | } | 716 | } |
717 | else | 717 | else |
718 | { | 718 | { |
719 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); | 719 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); |
720 | if (!dai) | 720 | if (!dai) |
721 | { | 721 | { |
722 | qDebug("could not find configured email application."); | 722 | qDebug("could not find configured email application."); |
723 | return false; | 723 | return false; |
724 | } | 724 | } |
725 | channel = dai->_channel; | 725 | channel = dai->_channel; |
726 | message = dai->_message; | 726 | message = dai->_message; |
727 | parameters = dai->_parameters; | 727 | parameters = dai->_parameters; |
728 | } | 728 | } |
729 | 729 | ||
730 | 730 | ||
731 | //first check if one of the mailers need the emails right in the message. | 731 | //first check if one of the mailers need the emails right in the message. |
732 | message = translateMessage(message, name, emailadress); | 732 | message = translateMessage(message, name, emailadress); |
733 | 733 | ||
734 | 734 | ||
735 | #ifdef DEBUG_EXT_APP_HANDLER | 735 | #ifdef DEBUG_EXT_APP_HANDLER |
736 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 736 | qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
737 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); | 737 | qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); |
738 | #endif | 738 | #endif |
739 | 739 | ||
740 | QCopEnvelope e(channel.latin1(), message.latin1()); | 740 | QCopEnvelope e(channel.latin1(), message.latin1()); |
741 | //US we need no names in the To field. The emailadresses are enough | 741 | //US we need no names in the To field. The emailadresses are enough |
742 | 742 | ||
743 | passParameters(&e, parameters, name, emailadress); | 743 | passParameters(&e, parameters, name, emailadress); |
744 | 744 | ||
745 | 745 | ||
746 | #else | 746 | #else |
747 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); | 747 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); |
748 | #endif | 748 | #endif |
749 | 749 | ||
750 | 750 | ||
751 | return true; | 751 | return true; |
752 | } | 752 | } |
753 | 753 | ||
754 | /************************************************************************** | 754 | /************************************************************************** |
755 | * | 755 | * |
756 | **************************************************************************/ | 756 | **************************************************************************/ |
757 | 757 | ||
758 | //calls the emailapplication and creates a mail with parameter as recipients | 758 | //calls the emailapplication and creates a mail with parameter as recipients |
759 | // parameters format is | 759 | // parameters format is |
760 | // NAME <EMAIL>:SUBJECT | 760 | // NAME <EMAIL>:SUBJECT |
761 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) | 761 | bool ExternalAppHandler::mailToOneContact( const QString& adressline ) |
762 | { | 762 | { |
763 | QString line = adressline; | 763 | QString line = adressline; |
764 | 764 | ||
765 | int first = line.find( "<"); | 765 | int first = line.find( "<"); |
766 | int last = line.find( ">"); | 766 | int last = line.find( ">"); |
767 | QString name = line.left(first); | 767 | QString name = line.left(first); |
768 | QString emailadress = line.mid(first+1, last-first-1); | 768 | QString emailadress = line.mid(first+1, last-first-1); |
769 | 769 | ||
770 | //Subject can not be handled right now. | 770 | //Subject can not be handled right now. |
771 | return mailToOneContact( name, emailadress ); | 771 | return mailToOneContact( name, emailadress ); |
772 | 772 | ||
773 | } | 773 | } |
774 | 774 | ||
775 | 775 | ||
776 | /************************************************************************** | 776 | /************************************************************************** |
777 | * | 777 | * |
778 | **************************************************************************/ | 778 | **************************************************************************/ |
779 | 779 | ||
780 | //calls the phoneapplication with the number | 780 | //calls the phoneapplication with the number |
781 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) | 781 | bool ExternalAppHandler::callByPhone( const QString& phonenumber ) |
782 | { | 782 | { |
783 | #ifndef DESKTOP_VERSION | 783 | #ifndef DESKTOP_VERSION |
784 | QString channel; | 784 | QString channel; |
785 | QString message; | 785 | QString message; |
786 | QString parameters; | 786 | QString parameters; |
787 | 787 | ||
788 | 788 | ||
789 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 789 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
790 | if (client == KPimGlobalPrefs::OTHER_PHC) | 790 | if (client == KPimGlobalPrefs::OTHER_PHC) |
791 | { | 791 | { |
792 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; | 792 | channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; |
793 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; | 793 | message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; |
794 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; | 794 | parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; |
795 | } | 795 | } |
796 | else | 796 | else |
797 | { | 797 | { |
798 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); | 798 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); |
799 | if (!dai) | 799 | if (!dai) |
800 | { | 800 | { |
801 | qDebug("could not find configured phone application."); | 801 | qDebug("could not find configured phone application."); |
802 | return false; | 802 | return false; |
803 | } | 803 | } |
804 | channel = dai->_channel; | 804 | channel = dai->_channel; |
805 | message = dai->_message; | 805 | message = dai->_message; |
806 | parameters = dai->_parameters; | 806 | parameters = dai->_parameters; |
807 | } | 807 | } |
808 | 808 | ||
809 | 809 | ||
810 | //first check if one of the mailers need the emails right in the message. | 810 | //first check if one of the mailers need the emails right in the message. |
811 | message = translateMessage(message, phonenumber, ""); | 811 | message = translateMessage(message, phonenumber, ""); |
812 | 812 | ||
813 | 813 | ||
814 | #ifdef DEBUG_EXT_APP_HANDLER | 814 | #ifdef DEBUG_EXT_APP_HANDLER |
815 | qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 815 | qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
816 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 816 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
817 | #endif | 817 | #endif |
818 | 818 | ||
819 | QCopEnvelope e(channel.latin1(), message.latin1()); | 819 | QCopEnvelope e(channel.latin1(), message.latin1()); |
820 | //US we need no names in the To field. The emailadresses are enough | 820 | //US we need no names in the To field. The emailadresses are enough |
821 | 821 | ||
822 | passParameters(&e, parameters, phonenumber, ""); | 822 | passParameters(&e, parameters, phonenumber, ""); |
823 | 823 | ||
824 | 824 | ||
825 | #else | 825 | #else |
826 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); | 826 | KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); |
827 | #endif | 827 | #endif |
828 | 828 | ||
829 | 829 | ||
830 | return true; | 830 | return true; |
831 | } | 831 | } |
832 | 832 | ||
833 | /************************************************************************** | 833 | /************************************************************************** |
834 | * | 834 | * |
835 | **************************************************************************/ | 835 | **************************************************************************/ |
836 | 836 | ||
837 | //calls the smsapplication with the number | 837 | //calls the smsapplication with the number |
838 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) | 838 | bool ExternalAppHandler::callBySMS( const QString& phonenumber ) |
839 | { | 839 | { |
840 | #ifndef DESKTOP_VERSION | 840 | #ifndef DESKTOP_VERSION |
841 | QString channel; | 841 | QString channel; |
842 | QString message; | 842 | QString message; |
843 | QString parameters; | 843 | QString parameters; |
844 | 844 | ||
845 | 845 | ||
846 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 846 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
847 | if (client == KPimGlobalPrefs::OTHER_SMC) | 847 | if (client == KPimGlobalPrefs::OTHER_SMC) |
848 | { | 848 | { |
849 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; | 849 | channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; |
850 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; | 850 | message = KPimGlobalPrefs::instance()->mSMSOtherMessage; |
851 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; | 851 | parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; |
852 | } | 852 | } |
853 | else | 853 | else |
854 | { | 854 | { |
855 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); | 855 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); |
856 | if (!dai) | 856 | if (!dai) |
857 | { | 857 | { |
858 | qDebug("could not find configured sms application."); | 858 | qDebug("could not find configured sms application."); |
859 | return false; | 859 | return false; |
860 | } | 860 | } |
861 | channel = dai->_channel; | 861 | channel = dai->_channel; |
862 | message = dai->_message; | 862 | message = dai->_message; |
863 | parameters = dai->_parameters; | 863 | parameters = dai->_parameters; |
864 | } | 864 | } |
865 | 865 | ||
866 | 866 | ||
867 | //first check if one of the mailers need the emails right in the message. | 867 | //first check if one of the mailers need the emails right in the message. |
868 | message = translateMessage(message, phonenumber, ""); | 868 | message = translateMessage(message, phonenumber, ""); |
869 | 869 | ||
870 | 870 | ||
871 | #ifdef DEBUG_EXT_APP_HANDLER | 871 | #ifdef DEBUG_EXT_APP_HANDLER |
872 | qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 872 | qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
873 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); | 873 | qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); |
874 | #endif | 874 | #endif |
875 | 875 | ||
876 | QCopEnvelope e(channel.latin1(), message.latin1()); | 876 | QCopEnvelope e(channel.latin1(), message.latin1()); |
877 | //US we need no names in the To field. The emailadresses are enough | 877 | //US we need no names in the To field. The emailadresses are enough |
878 | 878 | ||
879 | passParameters(&e, parameters, phonenumber, ""); | 879 | passParameters(&e, parameters, phonenumber, ""); |
880 | 880 | ||
881 | 881 | ||
882 | #else | 882 | #else |
883 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); | 883 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); |
884 | #endif | 884 | #endif |
885 | 885 | ||
886 | 886 | ||
887 | return true; | 887 | return true; |
888 | } | 888 | } |
889 | 889 | ||
890 | /************************************************************************** | 890 | /************************************************************************** |
891 | * | 891 | * |
892 | **************************************************************************/ | 892 | **************************************************************************/ |
893 | 893 | ||
894 | //calls the pagerapplication with the number | 894 | //calls the pagerapplication with the number |
895 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) | 895 | bool ExternalAppHandler::callByPager( const QString& pagernumber ) |
896 | { | 896 | { |
897 | #ifndef DESKTOP_VERSION | 897 | #ifndef DESKTOP_VERSION |
898 | QString channel; | 898 | QString channel; |
899 | QString message; | 899 | QString message; |
900 | QString parameters; | 900 | QString parameters; |
901 | 901 | ||
902 | 902 | ||
903 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 903 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
904 | if (client == KPimGlobalPrefs::OTHER_PAC) | 904 | if (client == KPimGlobalPrefs::OTHER_PAC) |
905 | { | 905 | { |
906 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; | 906 | channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; |
907 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; | 907 | message = KPimGlobalPrefs::instance()->mPagerOtherMessage; |
908 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; | 908 | parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; |
909 | } | 909 | } |
910 | else | 910 | else |
911 | { | 911 | { |
912 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); | 912 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); |
913 | if (!dai) | 913 | if (!dai) |
914 | { | 914 | { |
915 | qDebug("could not find configured pager application."); | 915 | qDebug("could not find configured pager application."); |
916 | return false; | 916 | return false; |
917 | } | 917 | } |
918 | channel = dai->_channel; | 918 | channel = dai->_channel; |
919 | message = dai->_message; | 919 | message = dai->_message; |
920 | parameters = dai->_parameters; | 920 | parameters = dai->_parameters; |
921 | } | 921 | } |
922 | 922 | ||
923 | 923 | ||
924 | //first check if one of the mailers need the emails right in the message. | 924 | //first check if one of the mailers need the emails right in the message. |
925 | message = translateMessage(message, pagernumber, ""); | 925 | message = translateMessage(message, pagernumber, ""); |
926 | 926 | ||
927 | 927 | ||
928 | #ifdef DEBUG_EXT_APP_HANDLER | 928 | #ifdef DEBUG_EXT_APP_HANDLER |
929 | qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 929 | qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
930 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); | 930 | qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); |
931 | #endif | 931 | #endif |
932 | 932 | ||
933 | QCopEnvelope e(channel.latin1(), message.latin1()); | 933 | QCopEnvelope e(channel.latin1(), message.latin1()); |
934 | //US we need no names in the To field. The emailadresses are enough | 934 | //US we need no names in the To field. The emailadresses are enough |
935 | 935 | ||
936 | passParameters(&e, parameters, pagernumber, ""); | 936 | passParameters(&e, parameters, pagernumber, ""); |
937 | 937 | ||
938 | 938 | ||
939 | #else | 939 | #else |
940 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); | 940 | KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); |
941 | #endif | 941 | #endif |
942 | 942 | ||
943 | 943 | ||
944 | return true; | 944 | return true; |
945 | } | 945 | } |
946 | 946 | ||
947 | /************************************************************************** | 947 | /************************************************************************** |
948 | * | 948 | * |
949 | **************************************************************************/ | 949 | **************************************************************************/ |
950 | 950 | ||
951 | //calls the faxapplication with the number | 951 | //calls the faxapplication with the number |
952 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) | 952 | bool ExternalAppHandler::callByFax( const QString& faxnumber ) |
953 | { | 953 | { |
954 | #ifndef DESKTOP_VERSION | 954 | #ifndef DESKTOP_VERSION |
955 | QString channel; | 955 | QString channel; |
956 | QString message; | 956 | QString message; |
957 | QString parameters; | 957 | QString parameters; |
958 | 958 | ||
959 | 959 | ||
960 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 960 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
961 | if (client == KPimGlobalPrefs::OTHER_FAC) | 961 | if (client == KPimGlobalPrefs::OTHER_FAC) |
962 | { | 962 | { |
963 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; | 963 | channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; |
964 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; | 964 | message = KPimGlobalPrefs::instance()->mFaxOtherMessage; |
965 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; | 965 | parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; |
966 | } | 966 | } |
967 | else | 967 | else |
968 | { | 968 | { |
969 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); | 969 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); |
970 | if (!dai) | 970 | if (!dai) |
971 | { | 971 | { |
972 | qDebug("could not find configured fax application."); | 972 | qDebug("could not find configured fax application."); |
973 | return false; | 973 | return false; |
974 | } | 974 | } |
975 | channel = dai->_channel; | 975 | channel = dai->_channel; |
976 | message = dai->_message; | 976 | message = dai->_message; |
977 | parameters = dai->_parameters; | 977 | parameters = dai->_parameters; |
978 | } | 978 | } |
979 | 979 | ||
980 | 980 | ||
981 | //first check if one of the mailers need the emails right in the message. | 981 | //first check if one of the mailers need the emails right in the message. |
982 | message = translateMessage(message, faxnumber, ""); | 982 | message = translateMessage(message, faxnumber, ""); |
983 | 983 | ||
984 | 984 | ||
985 | #ifdef DEBUG_EXT_APP_HANDLER | 985 | #ifdef DEBUG_EXT_APP_HANDLER |
986 | qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 986 | qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
987 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); | 987 | qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); |
988 | #endif | 988 | #endif |
989 | 989 | ||
990 | QCopEnvelope e(channel.latin1(), message.latin1()); | 990 | QCopEnvelope e(channel.latin1(), message.latin1()); |
991 | //US we need no names in the To field. The emailadresses are enough | 991 | //US we need no names in the To field. The emailadresses are enough |
992 | 992 | ||
993 | passParameters(&e, parameters, faxnumber, ""); | 993 | passParameters(&e, parameters, faxnumber, ""); |
994 | 994 | ||
995 | 995 | ||
996 | #else | 996 | #else |
997 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); | 997 | KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); |
998 | #endif | 998 | #endif |
999 | 999 | ||
1000 | 1000 | ||
1001 | return true; | 1001 | return true; |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /************************************************************************** | 1004 | /************************************************************************** |
1005 | * | 1005 | * |
1006 | **************************************************************************/ | 1006 | **************************************************************************/ |
1007 | 1007 | ||
1008 | //calls the sipapplication with the number | 1008 | //calls the sipapplication with the number |
1009 | bool ExternalAppHandler::callBySIP( const QString& sipnumber ) | 1009 | bool ExternalAppHandler::callBySIP( const QString& sipnumber ) |
1010 | { | 1010 | { |
1011 | #ifndef DESKTOP_VERSION | 1011 | #ifndef DESKTOP_VERSION |
1012 | QString channel; | 1012 | QString channel; |
1013 | QString message; | 1013 | QString message; |
1014 | QString parameters; | 1014 | QString parameters; |
1015 | 1015 | ||
1016 | 1016 | ||
1017 | int client = KPimGlobalPrefs::instance()->mSipClient; | 1017 | int client = KPimGlobalPrefs::instance()->mSipClient; |
1018 | if (client == KPimGlobalPrefs::OTHER_SIC) | 1018 | if (client == KPimGlobalPrefs::OTHER_SIC) |
1019 | { | 1019 | { |
1020 | channel = KPimGlobalPrefs::instance()->mSipOtherChannel; | 1020 | channel = KPimGlobalPrefs::instance()->mSipOtherChannel; |
1021 | message = KPimGlobalPrefs::instance()->mSipOtherMessage; | 1021 | message = KPimGlobalPrefs::instance()->mSipOtherMessage; |
1022 | parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; | 1022 | parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; |
1023 | } | 1023 | } |
1024 | else | 1024 | else |
1025 | { | 1025 | { |
1026 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); | 1026 | DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); |
1027 | if (!dai) | 1027 | if (!dai) |
1028 | { | 1028 | { |
1029 | qDebug("could not find configured sip application."); | 1029 | qDebug("could not find configured sip application."); |
1030 | return false; | 1030 | return false; |
1031 | } | 1031 | } |
1032 | channel = dai->_channel; | 1032 | channel = dai->_channel; |
1033 | message = dai->_message; | 1033 | message = dai->_message; |
1034 | parameters = dai->_parameters; | 1034 | parameters = dai->_parameters; |
1035 | } | 1035 | } |
1036 | 1036 | ||
1037 | 1037 | ||
1038 | //first check if one of the sip apps need the emails right in the message. | 1038 | //first check if one of the sip apps need the emails right in the message. |
1039 | message = translateMessage(message, sipnumber, ""); | 1039 | message = translateMessage(message, sipnumber, ""); |
1040 | 1040 | ||
1041 | 1041 | ||
1042 | #ifdef DEBUG_EXT_APP_HANDLER | 1042 | #ifdef DEBUG_EXT_APP_HANDLER |
1043 | qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); | 1043 | qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); |
1044 | qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); | 1044 | qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); |
1045 | #endif | 1045 | #endif |
1046 | 1046 | ||
1047 | QCopEnvelope e(channel.latin1(), message.latin1()); | 1047 | QCopEnvelope e(channel.latin1(), message.latin1()); |
1048 | //US we need no names in the To field. The emailadresses are enough | 1048 | //US we need no names in the To field. The emailadresses are enough |
1049 | 1049 | ||
1050 | passParameters(&e, parameters, sipnumber, ""); | 1050 | passParameters(&e, parameters, sipnumber, ""); |
1051 | 1051 | ||
1052 | 1052 | ||
1053 | #else | 1053 | #else |
1054 | KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); | 1054 | KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); |
1055 | #endif | 1055 | #endif |
1056 | 1056 | ||
1057 | 1057 | ||
1058 | return true; | 1058 | return true; |
1059 | } | 1059 | } |
1060 | 1060 | ||
1061 | 1061 | ||
1062 | /************************************************************************** | 1062 | /************************************************************************** |
1063 | * | 1063 | * |
1064 | **************************************************************************/ | 1064 | **************************************************************************/ |
1065 | 1065 | ||
1066 | 1066 | ||
1067 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const | 1067 | QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const |
1068 | { | 1068 | { |
1069 | message = message.replace( QRegExp("%1"), param1 ); | 1069 | message = message.replace( QRegExp("%1"), param1 ); |
1070 | return message.replace( QRegExp("%2"), param2 ); | 1070 | return message.replace( QRegExp("%2"), param2 ); |
1071 | } | 1071 | } |
1072 | 1072 | ||
1073 | /************************************************************************** | 1073 | /************************************************************************** |
1074 | * | 1074 | * |
1075 | **************************************************************************/ | 1075 | **************************************************************************/ |
1076 | 1076 | ||
1077 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const | 1077 | void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const |
1078 | { | 1078 | { |
1079 | #ifndef DESKTOP_VERSION | 1079 | #ifndef DESKTOP_VERSION |
1080 | QMap<QString, QString> valmap; | 1080 | QMap<QString, QString> valmap; |
1081 | bool useValMap = false; | 1081 | bool useValMap = false; |
1082 | 1082 | ||
1083 | // first extract all parts of the parameters. | 1083 | // first extract all parts of the parameters. |
1084 | QStringList paramlist = QStringList::split(";", parameters); | 1084 | QStringList paramlist = QStringList::split(";", parameters); |
1085 | 1085 | ||
1086 | //Now check how many parts we have. | 1086 | //Now check how many parts we have. |
1087 | //=0 :no params to pass | 1087 | //=0 :no params to pass |
1088 | //>0 :parameters to pass | 1088 | //>0 :parameters to pass |
1089 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) | 1089 | for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) |
1090 | { | 1090 | { |
1091 | QString param = (*it); | 1091 | QString param = (*it); |
1092 | QStringList keyvallist = QStringList::split("=", param); | 1092 | QStringList keyvallist = QStringList::split("=", param); |
1093 | 1093 | ||
1094 | //if we have keyvalue pairs, we assume that we pass a map to the envelope | 1094 | //if we have keyvalue pairs, we assume that we pass a map to the envelope |
1095 | QStringList::Iterator it2 = keyvallist.begin(); | 1095 | QStringList::Iterator it2 = keyvallist.begin(); |
1096 | QString key = (*it2); | 1096 | QString key = (*it2); |
1097 | key = key.replace( QRegExp("%1"), param1 ); | 1097 | key = key.replace( QRegExp("%1"), param1 ); |
1098 | key = key.replace( QRegExp("%2"), param2 ); | 1098 | key = key.replace( QRegExp("%2"), param2 ); |
1099 | ++it2; | 1099 | ++it2; |
1100 | 1100 | ||
1101 | if(it2 != keyvallist.end()) | 1101 | if(it2 != keyvallist.end()) |
1102 | { | 1102 | { |
1103 | QString value = (*it2); | 1103 | QString value = (*it2); |
1104 | value = value.replace( QRegExp("%1"), param1 ); | 1104 | value = value.replace( QRegExp("%1"), param1 ); |
1105 | value = value.replace( QRegExp("%2"), param2 ); | 1105 | value = value.replace( QRegExp("%2"), param2 ); |
1106 | 1106 | ||
1107 | valmap.insert(key, value); | 1107 | valmap.insert(key, value); |
1108 | useValMap = true; | 1108 | useValMap = true; |
1109 | } | 1109 | } |
1110 | else | 1110 | else |
1111 | { | 1111 | { |
1112 | // qDebug("pass parameter << %s", key.latin1()); | 1112 | // qDebug("pass parameter << %s", key.latin1()); |
1113 | (*e) << key; | 1113 | (*e) << key; |
1114 | } | 1114 | } |
1115 | } | 1115 | } |
1116 | 1116 | ||
1117 | if (useValMap == true) | 1117 | if (useValMap == true) |
1118 | (*e) << valmap; | 1118 | (*e) << valmap; |
1119 | 1119 | ||
1120 | #endif | 1120 | #endif |
1121 | 1121 | ||
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | 1124 | ||
1125 | 1125 | ||
1126 | /************************************************************************** | 1126 | /************************************************************************** |
1127 | * | 1127 | * |
1128 | **************************************************************************/ | 1128 | **************************************************************************/ |
1129 | 1129 | ||
1130 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) | 1130 | void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) |
1131 | { | 1131 | { |
1132 | 1132 | ||
1133 | if ( cmsg == "nextView()" ) { | 1133 | if ( cmsg == "nextView()" ) { |
1134 | qDebug("nextView()"); | 1134 | qDebug("nextView()"); |
1135 | emit nextView(); | 1135 | emit nextView(); |
1136 | return; | 1136 | return; |
1137 | } | 1137 | } |
1138 | if ( cmsg == "callContactdialog()" ) { | 1138 | if ( cmsg == "callContactdialog()" ) { |
1139 | qDebug("callContactdialog()"); | 1139 | qDebug("callContactdialog()"); |
1140 | emit callContactdialog(); | 1140 | emit callContactdialog(); |
1141 | return; | 1141 | return; |
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 1144 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
1145 | if (!res) | 1145 | if (!res) |
1146 | res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); | 1146 | res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); |
1147 | 1147 | ||
1148 | if (!res) | 1148 | if (!res) |
1149 | res = mDisplayDetails->appMessage( cmsg, data ); | 1149 | res = mDisplayDetails->appMessage( cmsg, data ); |
1150 | 1150 | ||
1151 | // if (!res) | 1151 | // if (!res) |
1152 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 1152 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
1153 | } | 1153 | } |
1154 | 1154 | ||
1155 | 1155 | ||
1156 | 1156 | ||
1157 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 1157 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
1158 | { | 1158 | { |
1159 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 1159 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
1160 | // maybe we are sending to KA/Pi fom a different worldd... | 1160 | // maybe we are sending to KA/Pi fom a different worldd... |
1161 | // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application | 1161 | // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application |
1162 | // for that reason we send the current QApplication::desktop()->width() to KA/Pi | 1162 | // for that reason we send the current QApplication::desktop()->width() to KA/Pi |
1163 | //qDebug("UID %s ", sessionuid.latin1()); | 1163 | //qDebug("UID %s ", sessionuid.latin1()); |
1164 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); | 1164 | //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); |
1165 | //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); | 1165 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); |
1166 | } | 1166 | } |
1167 | 1167 | ||
1168 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 1168 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
1169 | { | 1169 | { |
1170 | QStringList list4, list5, list6; | 1170 | QStringList list4, list5, list6; |
1171 | 1171 | ||
1172 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 1172 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
1173 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1173 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1174 | } | 1174 | } |
1175 | 1175 | ||
1176 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) | 1176 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) |
1177 | { | 1177 | { |
1178 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1178 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1179 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); | 1179 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); |
1180 | } | 1180 | } |
1181 | 1181 | ||
1182 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 1182 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
1183 | { | 1183 | { |
1184 | QStringList list4, list5, list6; | 1184 | QStringList list4, list5, list6; |
1185 | 1185 | ||
1186 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1186 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1187 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1187 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) | 1190 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) |
1191 | { | 1191 | { |
1192 | mDisplayDetails->setSourceChannel(""); | 1192 | mDisplayDetails->setSourceChannel(""); |
1193 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); | 1193 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); |
1194 | } | 1194 | } |
1195 | 1195 | ||
1196 | bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 1196 | bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
1197 | { | 1197 | { |
1198 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); | 1198 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); |
1199 | return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); | 1199 | return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); |
1200 | } | 1200 | } |
1201 | 1201 | ||
1202 | bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) | 1202 | bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) |
1203 | { | 1203 | { |
1204 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); | 1204 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); |
1205 | return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1205 | return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1206 | } | 1206 | } |
1207 | 1207 | ||
1208 | 1208 | ||
1209 | 1209 | ||
1210 | 1210 | ||
1211 | 1211 | ||