-rw-r--r-- | libkdepim/externalapphandler.cpp | 52 | ||||
-rw-r--r-- | libkdepim/externalapphandler.h | 10 |
2 files changed, 40 insertions, 22 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp index b57506b..bd83626 100644 --- a/libkdepim/externalapphandler.cpp +++ b/libkdepim/externalapphandler.cpp | |||
@@ -13,140 +13,154 @@ | |||
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 <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #else | ||
40 | #include <qapplication.h> | ||
38 | #endif | 41 | #endif |
39 | 42 | ||
40 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
41 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
42 | 45 | ||
43 | 46 | ||
44 | #include "externalapphandler.h" | 47 | #include "externalapphandler.h" |
45 | 48 | ||
46 | #include "kpimglobalprefs.h" | 49 | #include "kpimglobalprefs.h" |
47 | 50 | ||
48 | /********************************************************************************* | 51 | /********************************************************************************* |
49 | * | 52 | * |
50 | ********************************************************************************/ | 53 | ********************************************************************************/ |
51 | 54 | ||
52 | 55 | ||
53 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 56 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
54 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) | 57 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) |
55 | { | 58 | { |
56 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 | 59 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 |
57 | _sourceMessageParameters = "(QString,QString,QString)"; | 60 | if (_usedSourceParameters == 0) |
61 | _sourceMessageParameters = "(QString,QString)"; | ||
62 | else if (_usedSourceParameters == 1) | ||
63 | _sourceMessageParameters = "(QString,QString,QString)"; | ||
64 | else if (_usedSourceParameters == 2) | ||
65 | _sourceMessageParameters = "(QString,QString,QString,QString)"; | ||
66 | else if (_usedSourceParameters == 3) | ||
67 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; | ||
58 | } | 68 | } |
59 | 69 | ||
60 | /*********************************************************************************/ | 70 | /*********************************************************************************/ |
61 | 71 | ||
62 | QCopTransferItem::QCopTransferItem() | 72 | QCopTransferItem::QCopTransferItem() |
63 | { | 73 | { |
64 | } | 74 | } |
65 | 75 | ||
66 | /*********************************************************************************/ | 76 | /*********************************************************************************/ |
67 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) | 77 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) |
68 | { | 78 | { |
69 | 79 | ||
70 | #ifndef DESKTOP_VERSION | 80 | #ifndef DESKTOP_VERSION |
71 | //sourceMessage passes two parameters: sourceChannel, uid | 81 | //sourceMessage passes two parameters: sourceChannel, uid |
72 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; | 82 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; |
73 | 83 | ||
74 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); | 84 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); |
75 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param3(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); | 85 | 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()); |
76 | 86 | ||
77 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); | 87 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); |
78 | 88 | ||
79 | e << _sourceChannel << uid; | 89 | e << _sourceChannel << uid; |
80 | 90 | ||
81 | if (_usedSourceParameters == 1) | 91 | if (_usedSourceParameters == 1) |
82 | e << param1; | 92 | e << param1; |
83 | else if (_usedSourceParameters == 2) | 93 | else if (_usedSourceParameters == 2) |
84 | e << param1 << param2; | 94 | e << param1 << param2; |
85 | else if (_usedSourceParameters == 3) | 95 | else if (_usedSourceParameters == 3) |
86 | e << param1 << param2 << param3; | 96 | e << param1 << param2 << param3; |
87 | 97 | ||
98 | qApp->processEvents(); | ||
88 | 99 | ||
89 | return true; | 100 | return true; |
90 | 101 | ||
91 | #else | 102 | #else |
92 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 103 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
93 | return false; | 104 | return false; |
94 | #endif | 105 | #endif |
95 | 106 | ||
96 | } | 107 | } |
97 | 108 | ||
98 | 109 | ||
99 | /*********************************************************************************/ | 110 | /*********************************************************************************/ |
100 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) | 111 | void QCopTransferItem::setSourceChannel(const QString& sourceChannel) |
101 | { | 112 | { |
102 | 113 | ||
103 | if (_sourceChannel.isEmpty()) | 114 | if (_sourceChannel.isEmpty()) |
104 | _sourceChannel = sourceChannel; | 115 | _sourceChannel = sourceChannel; |
105 | } | 116 | } |
106 | 117 | ||
107 | 118 | ||
108 | /*********************************************************************************/ | 119 | /*********************************************************************************/ |
109 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 120 | bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
110 | { | 121 | { |
111 | /*US | 122 | |
112 | // copied from old mail2 | 123 | // copied from old mail2 |
124 | /* | ||
113 | static int ii = 0; | 125 | static int ii = 0; |
114 | 126 | ||
115 | // block second call | 127 | // block second call |
116 | if ( ii < 2 ) { | 128 | if ( ii < 2 ) { |
117 | ++ii; | 129 | ++ii; |
118 | if ( ii > 1 ) { | 130 | if ( ii > 1 ) { |
119 | qDebug("qcop call blocked "); | 131 | qDebug("qcop call blocked "); |
120 | return true; | 132 | return true; |
133 | } | ||
121 | } | 134 | } |
122 | } | ||
123 | */ | 135 | */ |
124 | qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | 136 | |
137 | // qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); | ||
125 | 138 | ||
126 | //we are in the target and get a request from the source | 139 | //we are in the target and get a request from the source |
127 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) | 140 | if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) |
128 | { | 141 | { |
142 | |||
129 | QDataStream stream( data, IO_ReadOnly ); | 143 | QDataStream stream( data, IO_ReadOnly ); |
130 | 144 | ||
131 | 145 | ||
132 | QString sourceChannel; | 146 | QString sourceChannel; |
133 | QString uid; | 147 | QString uid; |
134 | QString param1; | 148 | QString param1; |
135 | QString param2; | 149 | QString param2; |
136 | QString param3; | 150 | QString param3; |
137 | 151 | ||
138 | stream >> sourceChannel >> uid; | 152 | stream >> sourceChannel >> uid; |
139 | 153 | ||
140 | if (_usedSourceParameters == 0) | 154 | if (_usedSourceParameters == 0) |
141 | { | 155 | { |
142 | emit receivedMessageFromSource(sourceChannel, uid); | 156 | emit receivedMessageFromSource(sourceChannel, uid); |
143 | } | 157 | } |
144 | else if (_usedSourceParameters == 1) | 158 | else if (_usedSourceParameters == 1) |
145 | { | 159 | { |
146 | stream >> param1; | 160 | stream >> param1; |
147 | emit receivedMessageFromSource(sourceChannel, uid, param1); | 161 | emit receivedMessageFromSource(sourceChannel, uid, param1); |
148 | } | 162 | } |
149 | else if (_usedSourceParameters == 2) | 163 | else if (_usedSourceParameters == 2) |
150 | { | 164 | { |
151 | stream >> param1 >> param2; | 165 | stream >> param1 >> param2; |
152 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); | 166 | emit receivedMessageFromSource(sourceChannel, uid, param1, param2); |
@@ -170,180 +184,184 @@ bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data | |||
170 | 184 | ||
171 | 185 | ||
172 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 186 | QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
173 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 187 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
174 | { | 188 | { |
175 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> | 189 | //targetMessage returns later two parameters: uid, and map<qstring,qstring> |
176 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; | 190 | _targetMessageParameters = "(QString,QMAP<QString,QString>)"; |
177 | } | 191 | } |
178 | 192 | ||
179 | /*********************************************************************************/ | 193 | /*********************************************************************************/ |
180 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) | 194 | bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) |
181 | { | 195 | { |
182 | #ifndef DESKTOP_VERSION | 196 | #ifndef DESKTOP_VERSION |
183 | //targetMessage passes two parameters: uid, map | 197 | //targetMessage passes two parameters: uid, map |
184 | QString targetMessage = _targetMessage + _targetMessageParameters; | 198 | QString targetMessage = _targetMessage + _targetMessageParameters; |
185 | 199 | ||
186 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 200 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
187 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); | 201 | qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); |
188 | 202 | ||
189 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 203 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
190 | //US we need no names in the To field. The emailadresses are enough | 204 | //US we need no names in the To field. The emailadresses are enough |
191 | 205 | ||
192 | e << uid << nameEmailMap; | 206 | e << uid << nameEmailMap; |
193 | 207 | ||
208 | qApp->processEvents(); | ||
209 | |||
194 | return true; | 210 | return true; |
195 | 211 | ||
196 | #else | 212 | #else |
197 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 213 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
198 | return false; | 214 | return false; |
199 | #endif | 215 | #endif |
200 | 216 | ||
201 | } | 217 | } |
202 | 218 | ||
203 | 219 | ||
204 | /*********************************************************************************/ | 220 | /*********************************************************************************/ |
205 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 221 | bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
206 | { | 222 | { |
207 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 223 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
208 | 224 | ||
209 | if (res == false) | 225 | if (res == false) |
210 | { | 226 | { |
211 | QDataStream stream( data, IO_ReadOnly ); | 227 | QDataStream stream( data, IO_ReadOnly ); |
212 | 228 | ||
213 | qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 229 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
214 | 230 | ||
215 | //we are in the source and get an answer from the target | 231 | //we are in the source and get an answer from the target |
216 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 232 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
217 | { | 233 | { |
218 | QMap<QString,QString> adrMap; | 234 | QMap<QString,QString> adrMap; |
219 | QString uid; | 235 | QString uid; |
220 | 236 | ||
221 | stream >> uid >> adrMap; | 237 | stream >> uid >> adrMap; |
222 | 238 | ||
223 | emit receivedMessageFromTarget(uid, adrMap); | 239 | emit receivedMessageFromTarget(uid, adrMap); |
224 | 240 | ||
225 | 241 | ||
226 | return true; | 242 | return true; |
227 | } | 243 | } |
228 | } | 244 | } |
229 | 245 | ||
230 | return false; | 246 | return false; |
231 | } | 247 | } |
232 | 248 | ||
233 | 249 | ||
234 | /********************************************************************************* | 250 | /********************************************************************************* |
235 | * | 251 | * |
236 | ********************************************************************************/ | 252 | ********************************************************************************/ |
237 | 253 | ||
238 | 254 | ||
239 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 255 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
240 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) | 256 | : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) |
241 | { | 257 | { |
242 | //targetMessage returns later two parameters: uid, and three lists | 258 | //targetMessage returns later two parameters: uid, and three lists |
243 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; | 259 | _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; |
244 | } | 260 | } |
245 | 261 | ||
246 | /*********************************************************************************/ | 262 | /*********************************************************************************/ |
247 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 263 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
248 | { | 264 | { |
249 | #ifndef DESKTOP_VERSION | 265 | #ifndef DESKTOP_VERSION |
250 | //targetMessage passes two parameters: uid, map | 266 | //targetMessage passes two parameters: uid, map |
251 | QString targetMessage = _targetMessage + _targetMessageParameters; | 267 | QString targetMessage = _targetMessage + _targetMessageParameters; |
252 | 268 | ||
253 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); | 269 | qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); |
254 | qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); | 270 | qDebug("passing uid(%s) and list1, list2, list3 as parameter to QCopEnvelope", uid.latin1()); |
255 | 271 | ||
256 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); | 272 | QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); |
257 | //US we need no names in the To field. The emailadresses are enough | 273 | //US we need no names in the To field. The emailadresses are enough |
258 | 274 | ||
259 | e << uid << list1 << list2 << list3; | 275 | e << uid << list1 << list2 << list3; |
260 | 276 | ||
277 | qApp->processEvents(); | ||
278 | |||
261 | return true; | 279 | return true; |
262 | 280 | ||
263 | #else | 281 | #else |
264 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); | 282 | KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); |
265 | return false; | 283 | return false; |
266 | #endif | 284 | #endif |
267 | 285 | ||
268 | } | 286 | } |
269 | 287 | ||
270 | 288 | ||
271 | /*********************************************************************************/ | 289 | /*********************************************************************************/ |
272 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) | 290 | bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) |
273 | { | 291 | { |
274 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 292 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
275 | 293 | ||
276 | if (res == false) | 294 | if (res == false) |
277 | { | 295 | { |
278 | QDataStream stream( data, IO_ReadOnly ); | 296 | QDataStream stream( data, IO_ReadOnly ); |
279 | 297 | ||
280 | qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); | 298 | // qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); |
281 | 299 | ||
282 | //we are in the source and get an answer from the target | 300 | //we are in the source and get an answer from the target |
283 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 301 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
284 | { | 302 | { |
285 | QStringList list1; | 303 | QStringList list1; |
286 | QStringList list2; | 304 | QStringList list2; |
287 | QStringList list3; | 305 | QStringList list3; |
288 | QString uid; | 306 | QString uid; |
289 | 307 | ||
290 | stream >> uid >> list1 >> list2 >> list3; | 308 | stream >> uid >> list1 >> list2 >> list3; |
291 | 309 | ||
292 | emit receivedMessageFromTarget(uid, list1, list2, list3); | 310 | emit receivedMessageFromTarget(uid, list1, list2, list3); |
293 | 311 | ||
294 | 312 | ||
295 | return true; | 313 | return true; |
296 | } | 314 | } |
297 | } | 315 | } |
298 | 316 | ||
299 | return false; | 317 | return false; |
300 | } | 318 | } |
301 | 319 | ||
302 | 320 | ||
303 | 321 | ||
304 | /********************************************************************************* | 322 | /********************************************************************************* |
305 | * | 323 | * |
306 | ********************************************************************************/ | 324 | ********************************************************************************/ |
307 | 325 | ||
308 | 326 | ||
309 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; | 327 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; |
310 | static KStaticDeleter<ExternalAppHandler> staticDeleter; | 328 | static KStaticDeleter<ExternalAppHandler> staticDeleter; |
311 | 329 | ||
312 | ExternalAppHandler::ExternalAppHandler() | 330 | ExternalAppHandler::ExternalAppHandler() |
313 | { | 331 | { |
314 | mDefaultItems.setAutoDelete(true); | 332 | mDefaultItems.setAutoDelete(true); |
315 | 333 | ||
316 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); | 334 | mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); |
317 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); | 335 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); |
318 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 336 | connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
319 | 337 | ||
320 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); | 338 | //US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); |
321 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); | 339 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); |
322 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); | 340 | //US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); |
323 | 341 | ||
324 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); | 342 | mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); |
325 | connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); | 343 | 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&))); |
326 | } | 344 | } |
327 | 345 | ||
328 | ExternalAppHandler::~ExternalAppHandler() | 346 | ExternalAppHandler::~ExternalAppHandler() |
329 | { | 347 | { |
330 | } | 348 | } |
331 | 349 | ||
332 | void ExternalAppHandler::loadConfig() | 350 | void ExternalAppHandler::loadConfig() |
333 | { | 351 | { |
334 | 352 | ||
335 | mDefaultItems.clear(); | 353 | mDefaultItems.clear(); |
336 | 354 | ||
337 | mEmailAppAvailable = UNDEFINED; | 355 | mEmailAppAvailable = UNDEFINED; |
338 | mPhoneAppAvailable = UNDEFINED; | 356 | mPhoneAppAvailable = UNDEFINED; |
339 | mFaxAppAvailable = UNDEFINED; | 357 | mFaxAppAvailable = UNDEFINED; |
340 | mSMSAppAvailable = UNDEFINED; | 358 | mSMSAppAvailable = UNDEFINED; |
341 | mPagerAppAvailable = UNDEFINED; | 359 | mPagerAppAvailable = UNDEFINED; |
342 | 360 | ||
343 | 361 | ||
344 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); | 362 | QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); |
345 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); | 363 | QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); |
346 | 364 | ||
347 | if (opiepath.isEmpty()) | 365 | if (opiepath.isEmpty()) |
348 | opiepath = qtopiapath; | 366 | opiepath = qtopiapath; |
349 | 367 | ||
@@ -965,34 +983,34 @@ void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& dat | |||
965 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) | 983 | bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) |
966 | { | 984 | { |
967 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 985 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
968 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); | 986 | return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); |
969 | } | 987 | } |
970 | 988 | ||
971 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 989 | bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
972 | { | 990 | { |
973 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); | 991 | mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); |
974 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); | 992 | return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); |
975 | } | 993 | } |
976 | 994 | ||
977 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) | 995 | bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) |
978 | { | 996 | { |
979 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 997 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
980 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); | 998 | return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); |
981 | } | 999 | } |
982 | 1000 | ||
983 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) | 1001 | bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) |
984 | { | 1002 | { |
985 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); | 1003 | mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); |
986 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); | 1004 | return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); |
987 | } | 1005 | } |
988 | 1006 | ||
989 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid) | 1007 | bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) |
990 | { | 1008 | { |
991 | mDisplayDetails->setSourceChannel(sourceChannel); | 1009 | mDisplayDetails->setSourceChannel(""); |
992 | return mDisplayDetails->sendMessageToTarget(sessionuid, name, email, uid); | 1010 | return mDisplayDetails->sendMessageToTarget("", name, email, uid); |
993 | } | 1011 | } |
994 | 1012 | ||
995 | 1013 | ||
996 | 1014 | ||
997 | 1015 | ||
998 | 1016 | ||
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index a74080f..1b04b2b 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -177,56 +177,56 @@ class ExternalAppHandler : public QObject | |||
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 | bool isEmailAppAvailable(); | 193 | bool isEmailAppAvailable(); |
194 | bool isSMSAppAvailable(); | 194 | bool isSMSAppAvailable(); |
195 | bool isPhoneAppAvailable(); | 195 | bool isPhoneAppAvailable(); |
196 | bool isFaxAppAvailable(); | 196 | bool isFaxAppAvailable(); |
197 | bool isPagerAppAvailable(); | 197 | bool isPagerAppAvailable(); |
198 | 198 | ||
199 | 199 | ||
200 | //Call this method on the source when you want to select names from the addressbook by using QCop | 200 | //Call this method on the source when you want to select names from the addressbook by using QCop |
201 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid); | 201 | bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); |
202 | //Call this method on the target when you want to return the name/email map to the source (client). | 202 | //Call this method on the target when you want to return the name/email map to the source (client). |
203 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); | 203 | bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); |
204 | 204 | ||
205 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QString& email); | 205 | bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); |
206 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& uid, const QStringList& name, const QStringList& email, const QStringList& uid); | 206 | bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); |
207 | 207 | ||
208 | bool requestDetailsFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 208 | bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); |
209 | 209 | ||
210 | 210 | ||
211 | //loadConfig clears the cache and checks again if the applications are available or not | 211 | //loadConfig clears the cache and checks again if the applications are available or not |
212 | void loadConfig(); | 212 | void loadConfig(); |
213 | 213 | ||
214 | QList<DefaultAppItem> getAvailableDefaultItems(Types); | 214 | QList<DefaultAppItem> getAvailableDefaultItems(Types); |
215 | DefaultAppItem* getDefaultItem(Types, int); | 215 | DefaultAppItem* getDefaultItem(Types, int); |
216 | 216 | ||
217 | public slots: | 217 | public slots: |
218 | void appMessage( const QCString& msg, const QByteArray& data ); | 218 | void appMessage( const QCString& msg, const QByteArray& data ); |
219 | 219 | ||
220 | 220 | ||
221 | signals: | 221 | signals: |
222 | // Emmitted when the target app receives a request from the source app | 222 | // Emmitted when the target app receives a request from the source app |
223 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); | 223 | void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); |
224 | 224 | ||
225 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi | 225 | // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi |
226 | // The first parameter is a uniqueid. It can be used to identify the event | 226 | // The first parameter is a uniqueid. It can be used to identify the event |
227 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 227 | void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
228 | 228 | ||
229 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); | 229 | void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); |
230 | void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); | 230 | void receivedFindBbyEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); |
231 | 231 | ||
232 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); | 232 | void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); |