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