summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp6
-rw-r--r--libkdepim/externalapphandler.h1
2 files changed, 7 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
@@ -927,255 +927,261 @@ bool ExternalAppHandler::callByPager( const QString& pagernumber )
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
939bool ExternalAppHandler::callByFax( const QString& faxnumber ) 939bool 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
996bool ExternalAppHandler::callBySIP( const QString& sipnumber ) 996bool 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
1054QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const 1054QString& 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
1064void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const 1064void 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
1117void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) 1117void 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
1132bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1138bool 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
1138bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1144bool 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
1146bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) 1152bool 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
1152bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1158bool 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
1160bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) 1166bool 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
1166bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1172bool 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
1172bool 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) 1178bool 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
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index 6f5d345..52a64e1 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -44,248 +44,249 @@ class QCopTransferItem : public QObject
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
47 QCopTransferItem(); 47 QCopTransferItem();
48 48
49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); 49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null);
50 50
51 void setSourceChannel(const QString& sourceChannel); 51 void setSourceChannel(const QString& sourceChannel);
52 52
53 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 53 virtual bool appMessage( const QCString& msg, const QByteArray& data );
54 54
55 55
56 signals: 56 signals:
57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid); 57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid);
58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); 58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1);
59 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2); 59 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2);
60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3); 60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3);
61 61
62 public: 62 public:
63 int _usedSourceParameters; 63 int _usedSourceParameters;
64 QString _sourceChannel; 64 QString _sourceChannel;
65 QString _sourceMessage; 65 QString _sourceMessage;
66 QString _sourceMessageParameters; 66 QString _sourceMessageParameters;
67 QString _targetChannel; 67 QString _targetChannel;
68 QString _targetMessage; 68 QString _targetMessage;
69 QString _targetMessageParameters; 69 QString _targetMessageParameters;
70 70
71}; 71};
72 72
73/********************************************************************************* 73/*********************************************************************************
74 * 74 *
75 ********************************************************************************/ 75 ********************************************************************************/
76 76
77class QCopMapTransferItem : public QCopTransferItem 77class QCopMapTransferItem : public QCopTransferItem
78{ 78{
79 Q_OBJECT 79 Q_OBJECT
80 public: 80 public:
81 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 81 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
82 82
83 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); 83 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap);
84 84
85 85
86 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 86 virtual bool appMessage( const QCString& msg, const QByteArray& data );
87 87
88 88
89 signals: 89 signals:
90 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); 90 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap);
91 91
92}; 92};
93 93
94/********************************************************************************* 94/*********************************************************************************
95 * 95 *
96 ********************************************************************************/ 96 ********************************************************************************/
97 97
98class QCopListTransferItem : public QCopTransferItem 98class QCopListTransferItem : public QCopTransferItem
99{ 99{
100 Q_OBJECT 100 Q_OBJECT
101 public: 101 public:
102 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 102 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
103 ~QCopListTransferItem(); 103 ~QCopListTransferItem();
104 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); 104 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6);
105 105
106 106
107 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 107 virtual bool appMessage( const QCString& msg, const QByteArray& data );
108 108
109 109
110 signals: 110 signals:
111 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); 111 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6);
112 112
113}; 113};
114 114
115/********************************************************************************* 115/*********************************************************************************
116 * 116 *
117 ********************************************************************************/ 117 ********************************************************************************/
118 118
119 119
120class DefaultAppItem 120class DefaultAppItem
121{ 121{
122 public: 122 public:
123 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) 123 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2)
124 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) 124 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2)
125 {} 125 {}
126 126
127 DefaultAppItem() 127 DefaultAppItem()
128 { } 128 { }
129 129
130 public: 130 public:
131 int _type; 131 int _type;
132 int _id; 132 int _id;
133 QString _label; 133 QString _label;
134 QString _channel; 134 QString _channel;
135 QString _message; 135 QString _message;
136 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; 136 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ;
137 QString _message2; 137 QString _message2;
138 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; 138 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ;
139 139
140}; 140};
141 141
142/********************************************************************************* 142/*********************************************************************************
143 * 143 *
144 ********************************************************************************/ 144 ********************************************************************************/
145 145
146class ExternalAppHandler : public QObject 146class ExternalAppHandler : public QObject
147{ 147{
148 Q_OBJECT 148 Q_OBJECT
149 public: 149 public:
150 virtual ~ExternalAppHandler(); 150 virtual ~ExternalAppHandler();
151 151
152 static ExternalAppHandler *instance(); 152 static ExternalAppHandler *instance();
153 153
154 enum Types { 154 enum Types {
155 EMAIL = 0, 155 EMAIL = 0,
156 PHONE = 1, 156 PHONE = 1,
157 SMS = 2, 157 SMS = 2,
158 FAX = 3, 158 FAX = 3,
159 PAGER = 4, 159 PAGER = 4,
160 SIP = 5 160 SIP = 5
161 }; 161 };
162 162
163 enum Availability { 163 enum Availability {
164 UNDEFINED = -1, 164 UNDEFINED = -1,
165 UNAVAILABLE = 0, 165 UNAVAILABLE = 0,
166 AVAILABLE = 1 166 AVAILABLE = 1
167 }; 167 };
168 168
169 //calls the emailapplication with a number of attachments that need to be send. 169 //calls the emailapplication with a number of attachments that need to be send.
170 //either parameter can be left empty. 170 //either parameter can be left empty.
171 bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls ); 171 bool mailToMultipleContacts( const QString& recipients, const QString& attachmenturls );
172 172
173 //calls the emailapplication and creates a mail with parameter emailadress as recipients 173 //calls the emailapplication and creates a mail with parameter emailadress as recipients
174 bool mailToOneContact( const QString& name, const QString& emailadress ); 174 bool mailToOneContact( const QString& name, const QString& emailadress );
175 175
176 //calls the emailapplication and creates a mail with parameter as recipients 176 //calls the emailapplication and creates a mail with parameter as recipients
177 // parameters format is 177 // parameters format is
178 // NAME <EMAIL>:SUBJECT 178 // NAME <EMAIL>:SUBJECT
179 bool mailToOneContact( const QString& adressline ); 179 bool mailToOneContact( const QString& adressline );
180 180
181 //calls the phoneapplication with the number 181 //calls the phoneapplication with the number
182 bool callByPhone( const QString& phonenumber ); 182 bool callByPhone( const QString& phonenumber );
183 183
184 //calls the smsapplication with the number 184 //calls the smsapplication with the number
185 bool callBySMS( const QString& phonenumber ); 185 bool callBySMS( const QString& phonenumber );
186 186
187 //calls the pagerapplication with the number 187 //calls the pagerapplication with the number
188 bool callByPager( const QString& pagernumber ); 188 bool callByPager( const QString& pagernumber );
189 189
190 //calls the faxapplication with the number 190 //calls the faxapplication with the number
191 bool callByFax( const QString& faxnumber ); 191 bool callByFax( const QString& faxnumber );
192 192
193 //calls the sipapplication with the number 193 //calls the sipapplication with the number
194 bool callBySIP( const QString& sipnumber ); 194 bool callBySIP( const QString& sipnumber );
195 195
196 bool isEmailAppAvailable(); 196 bool isEmailAppAvailable();
197 bool isSMSAppAvailable(); 197 bool isSMSAppAvailable();
198 bool isPhoneAppAvailable(); 198 bool isPhoneAppAvailable();
199 bool isFaxAppAvailable(); 199 bool isFaxAppAvailable();
200 bool isPagerAppAvailable(); 200 bool isPagerAppAvailable();
201 bool isSIPAppAvailable(); 201 bool isSIPAppAvailable();
202 202
203 203
204 //Call this method on the source when you want to select names from the addressbook by using QCop 204 //Call this method on the source when you want to select names from the addressbook by using QCop
205 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); 205 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
206 //Call this method on the target when you want to return the name/email map to the source (client). 206 //Call this method on the target when you want to return the name/email map to the source (client).
207 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); 207 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
208 208
209 209
210 210
211 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); 211 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email);
212 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); 212 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
213 213
214 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); 214 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid);
215 215
216 216
217 217
218 bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); 218 bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
219 bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, 219 bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid,
220 const QStringList& birthdayList, const QStringList& anniversaryList, 220 const QStringList& birthdayList, const QStringList& anniversaryList,
221 const QStringList& realNameList, const QStringList& emailList, 221 const QStringList& realNameList, const QStringList& emailList,
222 const QStringList& assembledNameList, const QStringList& uidList); 222 const QStringList& assembledNameList, const QStringList& uidList);
223 223
224 224
225 //loadConfig clears the cache and checks again if the applications are available or not 225 //loadConfig clears the cache and checks again if the applications are available or not
226 void loadConfig(); 226 void loadConfig();
227 227
228 QList<DefaultAppItem> getAvailableDefaultItems(Types); 228 QList<DefaultAppItem> getAvailableDefaultItems(Types);
229 DefaultAppItem* getDefaultItem(Types, int); 229 DefaultAppItem* getDefaultItem(Types, int);
230 230
231 public slots: 231 public slots:
232 void appMessage( const QCString& msg, const QByteArray& data ); 232 void appMessage( const QCString& msg, const QByteArray& data );
233 233
234 234
235 signals: 235 signals:
236 void nextView();
236 // Emmitted when the target app receives a request from the source app 237 // Emmitted when the target app receives a request from the source app
237 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); 238 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid);
238 239
239 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 240 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
240 // The first parameter is a uniqueid. It can be used to identify the event 241 // The first parameter is a uniqueid. It can be used to identify the event
241 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 242 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
242 243
243 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); 244 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email);
244 void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 245 void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
245 246
246 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 247 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
247 248
248 249
249 // Emmitted when the target app receives a request from the source app 250 // Emmitted when the target app receives a request from the source app
250 void requestForBirthdayList(const QString& sourceChannel, const QString& uid); 251 void requestForBirthdayList(const QString& sourceChannel, const QString& uid);
251 252
252 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 253 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
253 // The first parameter is a uniqueid. It can be used to identify the event 254 // The first parameter is a uniqueid. It can be used to identify the event
254 void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, 255 void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList,
255 const QStringList& anniversaryList, const QStringList& realNameList, 256 const QStringList& anniversaryList, const QStringList& realNameList,
256 const QStringList& emailList, const QStringList& assembledNameList, 257 const QStringList& emailList, const QStringList& assembledNameList,
257 const QStringList& uidList); 258 const QStringList& uidList);
258 259
259 260
260 private: 261 private:
261 ExternalAppHandler(); 262 ExternalAppHandler();
262 QList<DefaultAppItem> mDefaultItems; 263 QList<DefaultAppItem> mDefaultItems;
263 264
264 Availability mEmailAppAvailable; 265 Availability mEmailAppAvailable;
265 Availability mPhoneAppAvailable; 266 Availability mPhoneAppAvailable;
266 Availability mFaxAppAvailable; 267 Availability mFaxAppAvailable;
267 Availability mSMSAppAvailable; 268 Availability mSMSAppAvailable;
268 Availability mPagerAppAvailable; 269 Availability mPagerAppAvailable;
269 Availability mSIPAppAvailable; 270 Availability mSIPAppAvailable;
270 271
271 QCopListTransferItem* mNameEmailUidListFromKAPITransfer; 272 QCopListTransferItem* mNameEmailUidListFromKAPITransfer;
272 QCopListTransferItem* mFindByEmailFromKAPITransfer; 273 QCopListTransferItem* mFindByEmailFromKAPITransfer;
273 QCopTransferItem* mDisplayDetails; 274 QCopTransferItem* mDisplayDetails;
274 QCopListTransferItem* mBirthdayListFromKAPITransfer; 275 QCopListTransferItem* mBirthdayListFromKAPITransfer;
275 276
276 277
277 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); 278 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2);
278 279
279 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; 280 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const;
280 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; 281 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const;
281 282
282 283
283 static ExternalAppHandler *sInstance; 284 static ExternalAppHandler *sInstance;
284 285
285 private slots: 286 private slots:
286 void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); 287 void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& );
287 288
288}; 289};
289 290
290 291
291#endif 292#endif