-rw-r--r-- | libkdepim/externalapphandler.cpp | 9 | ||||
-rw-r--r-- | libkdepim/externalapphandler.h | 1 |
2 files changed, 9 insertions, 1 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index f8f4c8a..0d66a5a 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -1,1204 +1,1211 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | #include <stdlib.h> | 30 | #include <stdlib.h> |
31 | 31 | ||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | 35 | ||
36 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #else | 39 | #else |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
45 | 45 | ||
46 | 46 | ||
47 | #include "externalapphandler.h" | 47 | #include "externalapphandler.h" |
48 | 48 | ||
49 | #include "kpimglobalprefs.h" | 49 | #include "kpimglobalprefs.h" |
50 | 50 | ||
51 | //uncomment line to get debug output | 51 | //uncomment line to get debug output |
52 | //#define DEBUG_EXT_APP_HANDLER | 52 | //#define DEBUG_EXT_APP_HANDLER |
53 | 53 | ||
54 | /********************************************************************************* | 54 | /********************************************************************************* |
55 | * | 55 | * |
56 | ********************************************************************************/ | 56 | ********************************************************************************/ |
57 | 57 | ||
58 | 58 | ||
59 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 59 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
60 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) | 60 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) |
61 | { | 61 | { |
62 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 | 62 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 |
63 | if (_usedSourceParameters == 0) | 63 | if (_usedSourceParameters == 0) |
64 | _sourceMessageParameters = "QString,QString)"; | 64 | _sourceMessageParameters = "QString,QString)"; |
65 | else if (_usedSourceParameters == 1) | 65 | else if (_usedSourceParameters == 1) |
66 | _sourceMessageParameters = "(QString,QString,QString)"; | 66 | _sourceMessageParameters = "(QString,QString,QString)"; |
67 | else if (_usedSourceParameters == 2) | 67 | else if (_usedSourceParameters == 2) |
68 | _sourceMessageParameters = "(QString,QString,QString,QString)"; | 68 | _sourceMessageParameters = "(QString,QString,QString,QString)"; |
69 | else if (_usedSourceParameters == 3) | 69 | else if (_usedSourceParameters == 3) |
70 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; | 70 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; |
71 | } | 71 | } |
72 | 72 | ||
73 | /*********************************************************************************/ | 73 | /*********************************************************************************/ |
74 | 74 | ||
75 | QCopTransferItem::QCopTransferItem() | 75 | QCopTransferItem::QCopTransferItem() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | /*********************************************************************************/ | 79 | /*********************************************************************************/ |
80 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) | 80 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) |
81 | { | 81 | { |
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | //sourceMessage passes two parameters: sourceChannel, uid | 84 | //sourceMessage passes two parameters: sourceChannel, uid |
85 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; | 85 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; |
86 | #ifdef DEBUG_EXT_APP_HANDLER | 86 | #ifdef DEBUG_EXT_APP_HANDLER |
87 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); | 87 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); |
88 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); | 88 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); | 91 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); |
92 | 92 | ||
93 | e << _sourceChannel << uid; | 93 | e << _sourceChannel << uid; |
94 | 94 | ||
95 | if (_usedSourceParameters == 1) | 95 | if (_usedSourceParameters == 1) |
96 | e << param1; | 96 | e << param1; |
97 | else if (_usedSourceParameters == 2) | 97 | else if (_usedSourceParameters == 2) |
98 | e << param1 << param2; | 98 | e << param1 << param2; |
99 | else if (_usedSourceParameters == 3) | 99 | else if (_usedSourceParameters == 3) |
100 | e << param1 << param2 << param3; | 100 | e << param1 << param2 << param3; |
101 | 101 | ||
102 | qApp->processEvents(); | 102 | qApp->processEvents(); |
103 | 103 | ||
104 | return true; | 104 | return true; |
105 | 105 | ||
106 | #else | 106 | #else |
107 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 107 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
108 | return false; | 108 | return false; |
109 | #endif | 109 | #endif |
110 | 110 | ||
111 | } | 111 | } |
112 | 112 | ||
113 | 113 | ||
114 | /*********************************************************************************/ | 114 | /*********************************************************************************/ |
115 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) | 115 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) |
116 | { | 116 | { |
117 | 117 | ||
118 | if ( !sourceChannel.isEmpty()) | 118 | if ( !sourceChannel.isEmpty()) |
119 | _sourceChannel = sourceChannel; | 119 | _sourceChannel = sourceChannel; |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | /*********************************************************************************/ | 123 | /*********************************************************************************/ |
124 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 124 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
125 | { | 125 | { |
126 | 126 | ||
127 | // copied from old mail2 | 127 | // copied from old mail2 |
128 | /* | 128 | /* |
129 | static int ii = 0; | 129 | static int ii = 0; |
130 | 130 | ||
131 | // block second call | 131 | // block second call |
132 | if ( ii < 2 ) { | 132 | if ( ii < 2 ) { |
133 | ++ii; | 133 | ++ii; |
134 | if ( ii > 1 ) { | 134 | if ( ii > 1 ) { |
135 | qDebug("qcop call blocked "); | 135 | qDebug("qcop call blocked "); |
136 | return true; | 136 | return true; |
137 | } | 137 | } |
138 | } | 138 | } |
139 | */ | 139 | */ |
140 | 140 | ||
141 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | 141 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); |
142 | 142 | ||
143 | //we are in the target and get a request from the source | 143 | //we are in the target and get a request from the source |
144 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) | 144 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) |
145 | { | 145 | { |
146 | 146 | ||
147 | QDataStream stream( data, IO_ReadOnly ); | 147 | QDataStream stream( data, IO_ReadOnly ); |
148 | 148 | ||
149 | 149 | ||
150 | QString sourceChannel; | 150 | QString sourceChannel; |
151 | QString uid; | 151 | QString uid; |
152 | QString param1; | 152 | QString param1; |
153 | QString param2; | 153 | QString param2; |
154 | QString param3; | 154 | QString param3; |
155 | 155 | ||
156 | stream >> sourceChannel >> uid; | 156 | stream >> sourceChannel >> uid; |
157 | 157 | ||
158 | if (_usedSourceParameters == 0) | 158 | if (_usedSourceParameters == 0) |
159 | { | 159 | { |
160 | emit receivedMessageFromSource(sourceChannel, uid); | 160 | emit receivedMessageFromSource(sourceChannel, uid); |
161 | } | 161 | } |
162 | else if (_usedSourceParameters == 1) | 162 | else if (_usedSourceParameters == 1) |
163 | { | 163 | { |
164 | stream >> param1; | 164 | stream >> param1; |
165 | emit receivedMessageFromSource(sourceChannel, uid, param1); | 165 | emit receivedMessageFromSource(sourceChannel, uid, param1); |
166 | } | 166 | } |
167 | else if (_usedSourceParameters == 2) | 167 | else if (_usedSourceParameters == 2) |
168 | { | 168 | { |
169 | stream >> param1 >> param2; | 169 | stream >> param1 >> param2; |
170 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); | 170 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); |
171 | } | 171 | } |
172 | else if (_usedSourceParameters == 3) | 172 | else if (_usedSourceParameters == 3) |
173 | { | 173 | { |
174 | stream >> param1 >> param2 >> param3; | 174 | stream >> param1 >> param2 >> param3; |
175 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); | 175 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); |
176 | } | 176 | } |
177 | 177 | ||
178 | return true; | 178 | return true; |
179 | } | 179 | } |
180 | 180 | ||
181 | return false; | 181 | return false; |
182 | } | 182 | } |
183 | 183 | ||
184 | 184 | ||
185 | /********************************************************************************* | 185 | /********************************************************************************* |
186 | * | 186 | * |
187 | ********************************************************************************/ | 187 | ********************************************************************************/ |
188 | 188 | ||
189 | 189 | ||
190 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 190 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
191 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 191 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
192 | { | 192 | { |
193 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> | 193 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> |
194 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; | 194 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; |
195 | } | 195 | } |
196 | 196 | ||
197 | /*********************************************************************************/ | 197 | /*********************************************************************************/ |
198 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) | 198 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) |
199 | { | 199 | { |
200 | #ifndef DESKTOP_VERSION | 200 | #ifndef DESKTOP_VERSION |
201 | //targetMessage passes two parameters: uid, map | 201 | //targetMessage passes two parameters: uid, map |
202 | QString targetMessage = _targetMessage + _targetMessageParameters; | 202 | QString targetMessage = _targetMessage + _targetMessageParameters; |
203 | 203 | ||
204 | #ifdef DEBUG_EXT_APP_HANDLER | 204 | #ifdef DEBUG_EXT_APP_HANDLER |
205 | qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 205 | qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
206 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); | 206 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); |
207 | #endif | 207 | #endif |
208 | 208 | ||
209 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 209 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
210 | //US we need no names in the To field. The emailadresses are enough | 210 | //US we need no names in the To field. The emailadresses are enough |
211 | 211 | ||
212 | e << uid << nameEmailMap; | 212 | e << uid << nameEmailMap; |
213 | 213 | ||
214 | qApp->processEvents(); | 214 | qApp->processEvents(); |
215 | 215 | ||
216 | return true; | 216 | return true; |
217 | 217 | ||
218 | #else | 218 | #else |
219 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 219 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
220 | return false; | 220 | return false; |
221 | #endif | 221 | #endif |
222 | 222 | ||
223 | } | 223 | } |
224 | 224 | ||
225 | 225 | ||
226 | /*********************************************************************************/ | 226 | /*********************************************************************************/ |
227 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 227 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
228 | { | 228 | { |
229 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 229 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
230 | 230 | ||
231 | if (res == false) | 231 | if (res == false) |
232 | { | 232 | { |
233 | QDataStream stream( data, IO_ReadOnly ); | 233 | QDataStream stream( data, IO_ReadOnly ); |
234 | 234 | ||
235 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 235 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
236 | 236 | ||
237 | //we are in the source and get an answer from the target | 237 | //we are in the source and get an answer from the target |
238 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 238 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
239 | { | 239 | { |
240 | QMap<QString,QString> adrMap; | 240 | QMap<QString,QString> adrMap; |
241 | QString uid; | 241 | QString uid; |
242 | 242 | ||
243 | stream >> uid >> adrMap; | 243 | stream >> uid >> adrMap; |
244 | 244 | ||
245 | emit receivedMessageFromTarget(uid, adrMap); | 245 | emit receivedMessageFromTarget(uid, adrMap); |
246 | 246 | ||
247 | 247 | ||
248 | return true; | 248 | return true; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | return false; | 252 | return false; |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | /********************************************************************************* | 256 | /********************************************************************************* |
257 | * | 257 | * |
258 | ********************************************************************************/ | 258 | ********************************************************************************/ |
259 | 259 | ||
260 | QCopListTransferItem::~QCopListTransferItem() | 260 | QCopListTransferItem::~QCopListTransferItem() |
261 | { | 261 | { |
262 | 262 | ||
263 | } | 263 | } |
264 | 264 | ||
265 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 265 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
266 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 266 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
267 | { | 267 | { |
268 | //targetMessage returns later two parameters: uid, and three lists | 268 | //targetMessage returns later two parameters: uid, and three lists |
269 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; | 269 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; |
270 | } | 270 | } |
271 | 271 | ||
272 | /*********************************************************************************/ | 272 | /*********************************************************************************/ |
273 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) | 273 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) |
274 | { | 274 | { |
275 | #ifndef DESKTOP_VERSION | 275 | #ifndef DESKTOP_VERSION |
276 | //targetMessage passes two parameters: uid, map | 276 | //targetMessage passes two parameters: uid, map |
277 | QString targetMessage = _targetMessage + _targetMessageParameters; | 277 | QString targetMessage = _targetMessage + _targetMessageParameters; |
278 | 278 | ||
279 | #ifdef DEBUG_EXT_APP_HANDLER | 279 | #ifdef DEBUG_EXT_APP_HANDLER |
280 | qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 280 | qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
281 | qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); | 281 | qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); |
282 | 282 | ||
283 | 283 | ||
284 | for ( int i = 0; i < list3.count(); i++) | 284 | for ( int i = 0; i < list3.count(); i++) |
285 | qDebug("listentry list3: %s",list3[i].latin1()); | 285 | qDebug("listentry list3: %s",list3[i].latin1()); |
286 | #endif | 286 | #endif |
287 | 287 | ||
288 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 288 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
289 | //US we need no names in the To field. The emailadresses are enough | 289 | //US we need no names in the To field. The emailadresses are enough |
290 | 290 | ||
291 | e << uid << list1 << list2 << list3 << list4 << list5 << list6; | 291 | e << uid << list1 << list2 << list3 << list4 << list5 << list6; |
292 | 292 | ||
293 | qApp->processEvents(); | 293 | qApp->processEvents(); |
294 | 294 | ||
295 | return true; | 295 | return true; |
296 | 296 | ||
297 | #else | 297 | #else |
298 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 298 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
299 | return false; | 299 | return false; |
300 | #endif | 300 | #endif |
301 | 301 | ||
302 | } | 302 | } |
303 | 303 | ||
304 | 304 | ||
305 | /*********************************************************************************/ | 305 | /*********************************************************************************/ |
306 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 306 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
307 | { | 307 | { |
308 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 308 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
309 | #ifdef DEBUG_EXT_APP_HANDLER | 309 | #ifdef DEBUG_EXT_APP_HANDLER |
310 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 310 | qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
311 | #endif | 311 | #endif |
312 | 312 | ||
313 | if (res == false) | 313 | if (res == false) |
314 | { | 314 | { |
315 | QDataStream stream( data, IO_ReadOnly ); | 315 | QDataStream stream( data, IO_ReadOnly ); |
316 | 316 | ||
317 | #ifdef DEBUG_EXT_APP_HANDLER | 317 | #ifdef DEBUG_EXT_APP_HANDLER |
318 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 318 | qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
319 | #endif | 319 | #endif |
320 | 320 | ||
321 | //we are in the source and get an answer from the target | 321 | //we are in the source and get an answer from the target |
322 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 322 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
323 | { | 323 | { |
324 | QStringList list1; | 324 | QStringList list1; |
325 | QStringList list2; | 325 | QStringList list2; |
326 | QStringList list3; | 326 | QStringList list3; |
327 | QStringList list4; | 327 | QStringList list4; |
328 | QStringList list5; | 328 | QStringList list5; |
329 | QStringList list6; | 329 | QStringList list6; |
330 | QString uid; | 330 | QString uid; |
331 | 331 | ||
332 | #ifdef DEBUG_EXT_APP_HANDLER | 332 | #ifdef DEBUG_EXT_APP_HANDLER |
333 | qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 333 | qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
334 | #endif | 334 | #endif |
335 | 335 | ||
336 | stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; | 336 | stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; |
337 | emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); | 337 | emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); |
338 | 338 | ||
339 | 339 | ||
340 | return true; | 340 | return true; |
341 | } | 341 | } |
342 | } | 342 | } |
343 | 343 | ||
344 | return false; | 344 | return false; |
345 | } | 345 | } |
346 | 346 | ||
347 | 347 | ||
348 | 348 | ||
349 | /********************************************************************************* | 349 | /********************************************************************************* |
350 | * | 350 | * |
351 | ********************************************************************************/ | 351 | ********************************************************************************/ |
352 | 352 | ||
353 | 353 | ||
354 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; | 354 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; |
355 | static KStaticDeleter<ExternalAppHandler> staticDeleter; | 355 | static KStaticDeleter<ExternalAppHandler> staticDeleter; |
356 | 356 | ||
357 | ExternalAppHandler::ExternalAppHandler() | 357 | ExternalAppHandler::ExternalAppHandler() |
358 | { | 358 | { |
359 | mDefaultItems.setAutoDelete(true); | 359 | mDefaultItems.setAutoDelete(true); |
360 | 360 | ||
361 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); | 361 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); |
362 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); | 362 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); |
363 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 363 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
364 | 364 | ||
365 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); | 365 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); |
366 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); | 366 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); |
367 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 367 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
368 | 368 | ||
369 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); | 369 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); |
370 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 370 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); |
371 | 371 | ||
372 | 372 | ||
373 | 373 | ||
374 | mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); | 374 | mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); |
375 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); | 375 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); |
376 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); | 376 | connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); |
377 | 377 | ||
378 | 378 | ||
379 | } | 379 | } |
380 | 380 | ||
381 | ExternalAppHandler::~ExternalAppHandler() | 381 | ExternalAppHandler::~ExternalAppHandler() |
382 | { | 382 | { |
383 | delete mNameEmailUidListFromKAPITransfer; | 383 | delete mNameEmailUidListFromKAPITransfer; |
384 | //delete mFindByEmailFromKAPITransfer; | 384 | //delete mFindByEmailFromKAPITransfer; |
385 | delete mDisplayDetails; | 385 | delete mDisplayDetails; |
386 | delete mBirthdayListFromKAPITransfer; | 386 | delete mBirthdayListFromKAPITransfer; |
387 | } | 387 | } |
388 | 388 | ||
389 | void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, | 389 | void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, |
390 | const QStringList& nameList, | 390 | const QStringList& nameList, |
391 | const QStringList& emailList, | 391 | const QStringList& emailList, |
392 | const QStringList& uidList, | 392 | const QStringList& uidList, |
393 | const QStringList&, | 393 | const QStringList&, |
394 | const QStringList&, | 394 | const QStringList&, |
395 | const QStringList& ) | 395 | const QStringList& ) |
396 | { | 396 | { |
397 | // this method is a conevnient way to reduce the number of parameters I have to pass | 397 | // this method is a conevnient way to reduce the number of parameters I have to pass |
398 | emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); | 398 | emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void ExternalAppHandler::loadConfig() | 402 | void ExternalAppHandler::loadConfig() |
403 | { | 403 | { |
404 | 404 | ||
405 | mDefaultItems.clear(); | 405 | mDefaultItems.clear(); |
406 | mEmailAppAvailable = UNDEFINED; | 406 | mEmailAppAvailable = UNDEFINED; |
407 | mPhoneAppAvailable = UNDEFINED; | 407 | mPhoneAppAvailable = UNDEFINED; |
408 | mFaxAppAvailable = UNDEFINED; | 408 | mFaxAppAvailable = UNDEFINED; |
409 | mSMSAppAvailable = UNDEFINED; | 409 | mSMSAppAvailable = UNDEFINED; |
410 | mPagerAppAvailable = UNDEFINED; | 410 | mPagerAppAvailable = UNDEFINED; |
411 | mSIPAppAvailable = UNDEFINED; | 411 | mSIPAppAvailable = UNDEFINED; |
412 | 412 | ||
413 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 413 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); |
414 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 414 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); |
415 | QString qtpath = QString::fromLatin1( getenv("QTDIR") ); | 415 | QString qtpath = QString::fromLatin1( getenv("QTDIR") ); |
416 | 416 | ||
417 | //if qtopiapath is not set, fallback to qt | 417 | //if qtopiapath is not set, fallback to qt |
418 | if (qtopiapath.isEmpty()) | 418 | if (qtopiapath.isEmpty()) |
419 | qtopiapath = qtpath; | 419 | qtopiapath = qtpath; |
420 | 420 | ||
421 | //if opiepath is not set, fallback to qtopia | 421 | //if opiepath is not set, fallback to qtopia |
422 | if (opiepath.isEmpty()) | 422 | if (opiepath.isEmpty()) |
423 | opiepath = qtopiapath; | 423 | opiepath = qtopiapath; |
424 | 424 | ||
425 | 425 | ||
426 | 426 | ||
427 | //mailclients | 427 | //mailclients |
428 | QString mailmsg1 = "writeMail(QString,QString)"; | 428 | QString mailmsg1 = "writeMail(QString,QString)"; |
429 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; | 429 | QString mailmsg2 = "writeMail(QMap(QString,QString))"; |
430 | 430 | ||
431 | QString undefined = ""; | 431 | QString undefined = ""; |
432 | 432 | ||
433 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); | 433 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); |
434 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); | 434 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); |
435 | 435 | ||
436 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || | 436 | if (( QFile::exists( qtopiapath + "/bin/ompi" )) || |
437 | ( QFile::exists( opiepath + "/bin/ompi" )) || | 437 | ( QFile::exists( opiepath + "/bin/ompi" )) || |
438 | ( QFile::exists( qtpath + "/bin/ompi" ))) | 438 | ( QFile::exists( qtpath + "/bin/ompi" ))) |
439 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 439 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
440 | 440 | ||
441 | if (( QFile::exists( qtopiapath + "/bin/qtmail" )) || | 441 | if (( QFile::exists( qtopiapath + "/bin/qtmail" )) || |
442 | ( QFile::exists( qtpath + "/bin/qtmail" ))) | 442 | ( QFile::exists( qtpath + "/bin/qtmail" ))) |
443 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 443 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
444 | 444 | ||
445 | if ( QFile::exists( opiepath + "/bin/opiemail" )) | 445 | if ( QFile::exists( opiepath + "/bin/opiemail" )) |
446 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 446 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
447 | 447 | ||
448 | if ( QFile::exists( opiepath + "/bin/mailit" )) | 448 | if ( QFile::exists( opiepath + "/bin/mailit" )) |
449 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); | 449 | addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_MAILIT_EMC, "Opie mailit email client", "QPE/Application/mailit", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); |
450 | 450 | ||
451 | 451 | ||
452 | 452 | ||
453 | //phoneclients | 453 | //phoneclients |
454 | 454 | ||
455 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); | 455 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); |
456 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); | 456 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); |
457 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 457 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
458 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 458 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
459 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 459 | addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
460 | 460 | ||
461 | //faxclients | 461 | //faxclients |
462 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); | 462 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); |
463 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); | 463 | addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); |
464 | 464 | ||
465 | //smsclients | 465 | //smsclients |
466 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); | 466 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); |
467 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); | 467 | addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); |
468 | 468 | ||
469 | //pagerclients | 469 | //pagerclients |
470 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); | 470 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); |
471 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); | 471 | addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); |
472 | 472 | ||
473 | //sipclients | 473 | //sipclients |
474 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); | 474 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No SIP client installed", undefined, undefined, undefined, undefined, undefined); |
475 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); | 475 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other SIP client", undefined, undefined, undefined, undefined, undefined); |
476 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || | 476 | if (( QFile::exists( qtopiapath + "/bin/kppi" )) || |
477 | ( QFile::exists( opiepath + "/bin/kppi" ))) | 477 | ( QFile::exists( opiepath + "/bin/kppi" ))) |
478 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); | 478 | addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::KPPI_SIC, "KP/Pi SIP client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); |
479 | 479 | ||
480 | } | 480 | } |
481 | 481 | ||
482 | ExternalAppHandler *ExternalAppHandler::instance() | 482 | ExternalAppHandler *ExternalAppHandler::instance() |
483 | { | 483 | { |
484 | if ( !sInstance ) { | 484 | if ( !sInstance ) { |
485 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); | 485 | sInstance = staticDeleter.setObject( new ExternalAppHandler() ); |
486 | sInstance->loadConfig(); | 486 | sInstance->loadConfig(); |
487 | } | 487 | } |
488 | 488 | ||
489 | return sInstance; | 489 | return sInstance; |
490 | } | 490 | } |
491 | 491 | ||
492 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) | 492 | void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) |
493 | { | 493 | { |
494 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); | 494 | DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); |
495 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); | 495 | // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); |
496 | mDefaultItems.append(dai); | 496 | mDefaultItems.append(dai); |
497 | } | 497 | } |
498 | 498 | ||
499 | 499 | ||
500 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) | 500 | QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) |
501 | { | 501 | { |
502 | QList<DefaultAppItem> list; | 502 | QList<DefaultAppItem> list; |
503 | 503 | ||
504 | DefaultAppItem* dai; | 504 | DefaultAppItem* dai; |
505 | 505 | ||
506 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 506 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
507 | { | 507 | { |
508 | if (dai->_type == type) | 508 | if (dai->_type == type) |
509 | list.append(dai); | 509 | list.append(dai); |
510 | } | 510 | } |
511 | 511 | ||
512 | return list; | 512 | return list; |
513 | } | 513 | } |
514 | 514 | ||
515 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) | 515 | DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) |
516 | { | 516 | { |
517 | DefaultAppItem* dai; | 517 | DefaultAppItem* dai; |
518 | 518 | ||
519 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) | 519 | for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) |
520 | { | 520 | { |
521 | if (dai->_type == type && dai->_id == clientid) | 521 | if (dai->_type == type && dai->_id == clientid) |
522 | return dai; | 522 | return dai; |
523 | } | 523 | } |
524 | 524 | ||
525 | return 0; | 525 | return 0; |
526 | } | 526 | } |
527 | 527 | ||
528 | bool ExternalAppHandler::isEmailAppAvailable() | 528 | bool ExternalAppHandler::isEmailAppAvailable() |
529 | { | 529 | { |
530 | #ifndef DESKTOP_VERSION | 530 | #ifndef DESKTOP_VERSION |
531 | if (mEmailAppAvailable == UNDEFINED) | 531 | if (mEmailAppAvailable == UNDEFINED) |
532 | { | 532 | { |
533 | int client = KPimGlobalPrefs::instance()->mEmailClient; | 533 | int client = KPimGlobalPrefs::instance()->mEmailClient; |
534 | if (client == KPimGlobalPrefs::NONE_EMC) | 534 | if (client == KPimGlobalPrefs::NONE_EMC) |
535 | mEmailAppAvailable = UNAVAILABLE; | 535 | mEmailAppAvailable = UNAVAILABLE; |
536 | else | 536 | else |
537 | mEmailAppAvailable = AVAILABLE; | 537 | mEmailAppAvailable = AVAILABLE; |
538 | } | 538 | } |
539 | return (mEmailAppAvailable == AVAILABLE); | 539 | return (mEmailAppAvailable == AVAILABLE); |
540 | 540 | ||
541 | #else //DESKTOP_VERSION | 541 | #else //DESKTOP_VERSION |
542 | return false; | 542 | return false; |
543 | #endif //DESKTOP_VERSION | 543 | #endif //DESKTOP_VERSION |
544 | } | 544 | } |
545 | 545 | ||
546 | bool ExternalAppHandler::isSMSAppAvailable() | 546 | bool ExternalAppHandler::isSMSAppAvailable() |
547 | { | 547 | { |
548 | #ifndef DESKTOP_VERSION | 548 | #ifndef DESKTOP_VERSION |
549 | if (mSMSAppAvailable == UNDEFINED) | 549 | if (mSMSAppAvailable == UNDEFINED) |
550 | { | 550 | { |
551 | int client = KPimGlobalPrefs::instance()->mSMSClient; | 551 | int client = KPimGlobalPrefs::instance()->mSMSClient; |
552 | if (client == KPimGlobalPrefs::NONE_SMC) | 552 | if (client == KPimGlobalPrefs::NONE_SMC) |
553 | mSMSAppAvailable = UNAVAILABLE; | 553 | mSMSAppAvailable = UNAVAILABLE; |
554 | else | 554 | else |
555 | mSMSAppAvailable = AVAILABLE; | 555 | mSMSAppAvailable = AVAILABLE; |
556 | } | 556 | } |
557 | 557 | ||
558 | return (mSMSAppAvailable == AVAILABLE); | 558 | return (mSMSAppAvailable == AVAILABLE); |
559 | #else //DESKTOP_VERSION | 559 | #else //DESKTOP_VERSION |
560 | return false; | 560 | return false; |
561 | #endif //DESKTOP_VERSION | 561 | #endif //DESKTOP_VERSION |
562 | } | 562 | } |
563 | 563 | ||
564 | bool ExternalAppHandler::isPhoneAppAvailable() | 564 | bool ExternalAppHandler::isPhoneAppAvailable() |
565 | { | 565 | { |
566 | #ifndef DESKTOP_VERSION | 566 | #ifndef DESKTOP_VERSION |
567 | if (mPhoneAppAvailable == UNDEFINED) | 567 | if (mPhoneAppAvailable == UNDEFINED) |
568 | { | 568 | { |
569 | int client = KPimGlobalPrefs::instance()->mPhoneClient; | 569 | int client = KPimGlobalPrefs::instance()->mPhoneClient; |
570 | if (client == KPimGlobalPrefs::NONE_PHC) | 570 | if (client == KPimGlobalPrefs::NONE_PHC) |
571 | mPhoneAppAvailable = UNAVAILABLE; | 571 | mPhoneAppAvailable = UNAVAILABLE; |
572 | else | 572 | else |
573 | mPhoneAppAvailable = AVAILABLE; | 573 | mPhoneAppAvailable = AVAILABLE; |
574 | } | 574 | } |
575 | 575 | ||
576 | return (mPhoneAppAvailable == AVAILABLE); | 576 | return (mPhoneAppAvailable == AVAILABLE); |
577 | #else //DESKTOP_VERSION | 577 | #else //DESKTOP_VERSION |
578 | return false; | 578 | return false; |
579 | #endif //DESKTOP_VERSION | 579 | #endif //DESKTOP_VERSION |
580 | } | 580 | } |
581 | 581 | ||
582 | bool ExternalAppHandler::isFaxAppAvailable() | 582 | bool ExternalAppHandler::isFaxAppAvailable() |
583 | { | 583 | { |
584 | #ifndef DESKTOP_VERSION | 584 | #ifndef DESKTOP_VERSION |
585 | if (mFaxAppAvailable == UNDEFINED) | 585 | if (mFaxAppAvailable == UNDEFINED) |
586 | { | 586 | { |
587 | int client = KPimGlobalPrefs::instance()->mFaxClient; | 587 | int client = KPimGlobalPrefs::instance()->mFaxClient; |
588 | if (client == KPimGlobalPrefs::NONE_FAC) | 588 | if (client == KPimGlobalPrefs::NONE_FAC) |
589 | mFaxAppAvailable = UNAVAILABLE; | 589 | mFaxAppAvailable = UNAVAILABLE; |
590 | else | 590 | else |
591 | mFaxAppAvailable = AVAILABLE; | 591 | mFaxAppAvailable = AVAILABLE; |
592 | } | 592 | } |
593 | 593 | ||
594 | return (mFaxAppAvailable == AVAILABLE); | 594 | return (mFaxAppAvailable == AVAILABLE); |
595 | #else //DESKTOP_VERSION | 595 | #else //DESKTOP_VERSION |
596 | return false; | 596 | return false; |
597 | #endif //DESKTOP_VERSION | 597 | #endif //DESKTOP_VERSION |
598 | } | 598 | } |
599 | 599 | ||
600 | bool ExternalAppHandler::isPagerAppAvailable() | 600 | bool ExternalAppHandler::isPagerAppAvailable() |
601 | { | 601 | { |
602 | #ifndef DESKTOP_VERSION | 602 | #ifndef DESKTOP_VERSION |
603 | if (mPagerAppAvailable == UNDEFINED) | 603 | if (mPagerAppAvailable == UNDEFINED) |
604 | { | 604 | { |
605 | int client = KPimGlobalPrefs::instance()->mPagerClient; | 605 | int client = KPimGlobalPrefs::instance()->mPagerClient; |
606 | if (client == KPimGlobalPrefs::NONE_PAC) | 606 | if (client == KPimGlobalPrefs::NONE_PAC) |
607 | mPagerAppAvailable = UNAVAILABLE; | 607 | mPagerAppAvailable = UNAVAILABLE; |
608 | else | 608 | else |
609 | mPagerAppAvailable = AVAILABLE; | 609 | mPagerAppAvailable = AVAILABLE; |
610 | } | 610 | } |
611 | 611 | ||
612 | return (mPagerAppAvailable == AVAILABLE); | 612 | return (mPagerAppAvailable == AVAILABLE); |
613 | #else //DESKTOP_VERSION | 613 | #else //DESKTOP_VERSION |
614 | return false; | 614 | return false; |
615 | #endif //DESKTOP_VERSION | 615 | #endif //DESKTOP_VERSION |
616 | } | 616 | } |
617 | 617 | ||
618 | 618 | ||
619 | bool ExternalAppHandler::isSIPAppAvailable() | 619 | bool ExternalAppHandler::isSIPAppAvailable() |
620 | { | 620 | { |
621 | #ifndef DESKTOP_VERSION | 621 | #ifndef DESKTOP_VERSION |
622 | if (mSIPAppAvailable == UNDEFINED) | 622 | if (mSIPAppAvailable == UNDEFINED) |
623 | { | 623 | { |
624 | int client = KPimGlobalPrefs::instance()->mSipClient; | 624 | int client = KPimGlobalPrefs::instance()->mSipClient; |
625 | if (client == KPimGlobalPrefs::NONE_SIC) | 625 | if (client == KPimGlobalPrefs::NONE_SIC) |
626 | mSIPAppAvailable = UNAVAILABLE; | 626 | mSIPAppAvailable = UNAVAILABLE; |
627 | else | 627 | else |
628 | mSIPAppAvailable = AVAILABLE; | 628 | mSIPAppAvailable = AVAILABLE; |
629 | } | 629 | } |
630 | 630 | ||
631 | return (mSIPAppAvailable == AVAILABLE); | 631 | return (mSIPAppAvailable == AVAILABLE); |
632 | #else //DESKTOP_VERSION | 632 | #else //DESKTOP_VERSION |
633 | return false; | 633 | return false; |
634 | #endif //DESKTOP_VERSION | 634 | #endif //DESKTOP_VERSION |
635 | } | 635 | } |
636 | 636 | ||
637 | /************************************************************************** | 637 | /************************************************************************** |
638 | * | 638 | * |
639 | **************************************************************************/ | 639 | **************************************************************************/ |
640 | 640 | ||
641 | 641 | ||
642 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) | 642 | //calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) |
643 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) | 643 | bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) |
644 | { | 644 | { |
645 | 645 | ||
646 | #ifndef DESKTOP_VERSION | 646 | #ifndef DESKTOP_VERSION |
647 | QString channel; | 647 | QString channel; |
648 | QString message2; | 648 | QString message2; |
649 | QString parameters2; | 649 | QString parameters2; |
650 | 650 | ||
651 | 651 | ||
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 | 1138 | if ( cmsg == "callContactdialog()" ) { | |
1139 | qDebug("callContactdialog()"); | ||
1140 | emit callContactdialog(); | ||
1141 | return; | ||
1142 | } | ||
1143 | |||
1139 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 1144 | bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
1140 | if (!res) | 1145 | if (!res) |
1141 | res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); | 1146 | res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); |
1142 | 1147 | ||
1143 | if (!res) | 1148 | if (!res) |
1144 | res = mDisplayDetails->appMessage( cmsg, data ); | 1149 | res = mDisplayDetails->appMessage( cmsg, data ); |
1145 | 1150 | ||
1146 | // if (!res) | 1151 | // if (!res) |
1147 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); | 1152 | // res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); |
1148 | } | 1153 | } |
1149 | 1154 | ||
1150 | 1155 | ||
1151 | 1156 | ||
1152 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 1157 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
1153 | { | 1158 | { |
1154 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 1159 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
1155 | // maybe we are sending to KA/Pi fom a different worldd... | 1160 | // maybe we are sending to KA/Pi fom a different worldd... |
1156 | // 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 |
1157 | // 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()); | ||
1158 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); | 1164 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); |
1165 | //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); | ||
1159 | } | 1166 | } |
1160 | 1167 | ||
1161 | 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) |
1162 | { | 1169 | { |
1163 | QStringList list4, list5, list6; | 1170 | QStringList list4, list5, list6; |
1164 | 1171 | ||
1165 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 1172 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
1166 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1173 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1167 | } | 1174 | } |
1168 | 1175 | ||
1169 | 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) |
1170 | { | 1177 | { |
1171 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1178 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1172 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); | 1179 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); |
1173 | } | 1180 | } |
1174 | 1181 | ||
1175 | 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) |
1176 | { | 1183 | { |
1177 | QStringList list4, list5, list6; | 1184 | QStringList list4, list5, list6; |
1178 | 1185 | ||
1179 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1186 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
1180 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1187 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1181 | } | 1188 | } |
1182 | 1189 | ||
1183 | 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) |
1184 | { | 1191 | { |
1185 | mDisplayDetails->setSourceChannel(""); | 1192 | mDisplayDetails->setSourceChannel(""); |
1186 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); | 1193 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); |
1187 | } | 1194 | } |
1188 | 1195 | ||
1189 | bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 1196 | bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
1190 | { | 1197 | { |
1191 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); | 1198 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); |
1192 | return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); | 1199 | return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid); |
1193 | } | 1200 | } |
1194 | 1201 | ||
1195 | 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) |
1196 | { | 1203 | { |
1197 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); | 1204 | mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel); |
1198 | return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); | 1205 | return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); |
1199 | } | 1206 | } |
1200 | 1207 | ||
1201 | 1208 | ||
1202 | 1209 | ||
1203 | 1210 | ||
1204 | 1211 | ||
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 52a64e1..097f306 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -1,292 +1,293 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
8 | (at your option) any later version. | 8 | (at your option) any later version. |
9 | 9 | ||
10 | This program is distributed in the hope that it will be useful, | 10 | This program is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
13 | GNU General Public License for more details. | 13 | GNU General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU General Public License | 15 | You should have received a copy of the GNU General Public License |
16 | along with this program; if not, write to the Free Software | 16 | along with this program; if not, write to the Free Software |
17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. | 17 | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
18 | 18 | ||
19 | As a special exception, permission is given to link this program | 19 | As a special exception, permission is given to link this program |
20 | with any edition of Qt, and distribute the resulting executable, | 20 | with any edition of Qt, and distribute the resulting executable, |
21 | without including the source code for Qt in the source distribution. | 21 | without including the source code for Qt in the source distribution. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* | 24 | /* |
25 | Enhanced Version of the file for platform independent KDE tools. | 25 | Enhanced Version of the file for platform independent KDE tools. |
26 | Copyright (c) 2004 Ulf Schenk | 26 | Copyright (c) 2004 Ulf Schenk |
27 | 27 | ||
28 | $Id$ | 28 | $Id$ |
29 | */ | 29 | */ |
30 | 30 | ||
31 | #ifndef EXTERNALAPPHANDLER_H | 31 | #ifndef EXTERNALAPPHANDLER_H |
32 | #define EXTERNALAPPHANDLER_H | 32 | #define EXTERNALAPPHANDLER_H |
33 | 33 | ||
34 | #include <qobject.h> | 34 | #include <qobject.h> |
35 | #include <qlist.h> | 35 | #include <qlist.h> |
36 | #include <qmap.h> | 36 | #include <qmap.h> |
37 | 37 | ||
38 | class QCopEnvelope; | 38 | class QCopEnvelope; |
39 | 39 | ||
40 | 40 | ||
41 | class ExternalAppHandler; | 41 | class ExternalAppHandler; |
42 | class QCopTransferItem : public QObject | 42 | class QCopTransferItem : public QObject |
43 | { | 43 | { |
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 | ||
77 | class QCopMapTransferItem : public QCopTransferItem | 77 | class 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 | ||
98 | class QCopListTransferItem : public QCopTransferItem | 98 | class 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 | ||
120 | class DefaultAppItem | 120 | class 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 | ||
146 | class ExternalAppHandler : public QObject | 146 | class 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 callContactdialog(); | ||
236 | void nextView(); | 237 | void nextView(); |
237 | // Emmitted when the target app receives a request from the source app | 238 | // Emmitted when the target app receives a request from the source app |
238 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); | 239 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); |
239 | 240 | ||
240 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi | 241 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi |
241 | // The first parameter is a uniqueid. It can be used to identify the event | 242 | // The first parameter is a uniqueid. It can be used to identify the event |
242 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 243 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
243 | 244 | ||
244 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); | 245 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); |
245 | void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 246 | void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
246 | 247 | ||
247 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 248 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |
248 | 249 | ||
249 | 250 | ||
250 | // Emmitted when the target app receives a request from the source app | 251 | // Emmitted when the target app receives a request from the source app |
251 | void requestForBirthdayList(const QString& sourceChannel, const QString& uid); | 252 | void requestForBirthdayList(const QString& sourceChannel, const QString& uid); |
252 | 253 | ||
253 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi | 254 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi |
254 | // The first parameter is a uniqueid. It can be used to identify the event | 255 | // The first parameter is a uniqueid. It can be used to identify the event |
255 | void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, | 256 | void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, |
256 | const QStringList& anniversaryList, const QStringList& realNameList, | 257 | const QStringList& anniversaryList, const QStringList& realNameList, |
257 | const QStringList& emailList, const QStringList& assembledNameList, | 258 | const QStringList& emailList, const QStringList& assembledNameList, |
258 | const QStringList& uidList); | 259 | const QStringList& uidList); |
259 | 260 | ||
260 | 261 | ||
261 | private: | 262 | private: |
262 | ExternalAppHandler(); | 263 | ExternalAppHandler(); |
263 | QList<DefaultAppItem> mDefaultItems; | 264 | QList<DefaultAppItem> mDefaultItems; |
264 | 265 | ||
265 | Availability mEmailAppAvailable; | 266 | Availability mEmailAppAvailable; |
266 | Availability mPhoneAppAvailable; | 267 | Availability mPhoneAppAvailable; |
267 | Availability mFaxAppAvailable; | 268 | Availability mFaxAppAvailable; |
268 | Availability mSMSAppAvailable; | 269 | Availability mSMSAppAvailable; |
269 | Availability mPagerAppAvailable; | 270 | Availability mPagerAppAvailable; |
270 | Availability mSIPAppAvailable; | 271 | Availability mSIPAppAvailable; |
271 | 272 | ||
272 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; | 273 | QCopListTransferItem* mNameEmailUidListFromKAPITransfer; |
273 | QCopListTransferItem* mFindByEmailFromKAPITransfer; | 274 | QCopListTransferItem* mFindByEmailFromKAPITransfer; |
274 | QCopTransferItem* mDisplayDetails; | 275 | QCopTransferItem* mDisplayDetails; |
275 | QCopListTransferItem* mBirthdayListFromKAPITransfer; | 276 | QCopListTransferItem* mBirthdayListFromKAPITransfer; |
276 | 277 | ||
277 | 278 | ||
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); | 279 | void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); |
279 | 280 | ||
280 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; | 281 | QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; |
281 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; | 282 | void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; |
282 | 283 | ||
283 | 284 | ||
284 | static ExternalAppHandler *sInstance; | 285 | static ExternalAppHandler *sInstance; |
285 | 286 | ||
286 | private slots: | 287 | private slots: |
287 | void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); | 288 | void receivedNameEmailUidList_Slot(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList, const QStringList&, const QStringList&, const QStringList& ); |
288 | 289 | ||
289 | }; | 290 | }; |
290 | 291 | ||
291 | 292 | ||
292 | #endif | 293 | #endif |