summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.cpp
Unidiff
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp28
1 files changed, 15 insertions, 13 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index fa56ee9..99aee86 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -1,1092 +1,1094 @@
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/*
25Enhanced Version of the file for platform independent KDE tools. 25Enhanced Version of the file for platform independent KDE tools.
26Copyright (c) 2004 Ulf Schenk 26Copyright (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/********************************************************************************* 51/*********************************************************************************
52 * 52 *
53 ********************************************************************************/ 53 ********************************************************************************/
54 54
55 55
56QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 56QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
57 : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) 57 : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage)
58{ 58{
59 //sourceMessage passes later three parameters: sourceChannel, uid, param1 59 //sourceMessage passes later three parameters: sourceChannel, uid, param1
60 if (_usedSourceParameters == 0) 60 if (_usedSourceParameters == 0)
61 _sourceMessageParameters = "(QString,QString)"; 61 _sourceMessageParameters = "(QString,QString)";
62 else if (_usedSourceParameters == 1) 62 else if (_usedSourceParameters == 1)
63 _sourceMessageParameters = "(QString,QString,QString)"; 63 _sourceMessageParameters = "(QString,QString,QString)";
64 else if (_usedSourceParameters == 2) 64 else if (_usedSourceParameters == 2)
65 _sourceMessageParameters = "(QString,QString,QString,QString)"; 65 _sourceMessageParameters = "(QString,QString,QString,QString)";
66 else if (_usedSourceParameters == 3) 66 else if (_usedSourceParameters == 3)
67 _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; 67 _sourceMessageParameters = "(QString,QString,QString,QString,QString)";
68} 68}
69 69
70/*********************************************************************************/ 70/*********************************************************************************/
71 71
72QCopTransferItem::QCopTransferItem() 72QCopTransferItem::QCopTransferItem()
73{ 73{
74} 74}
75 75
76/*********************************************************************************/ 76/*********************************************************************************/
77bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) 77bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3)
78{ 78{
79 79
80#ifndef DESKTOP_VERSION 80#ifndef DESKTOP_VERSION
81 //sourceMessage passes two parameters: sourceChannel, uid 81 //sourceMessage passes two parameters: sourceChannel, uid
82 QString sourceMessage = _sourceMessage + _sourceMessageParameters; 82 QString sourceMessage = _sourceMessage + _sourceMessageParameters;
83 83
84 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); 84 qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.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()); 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());
86 86
87 QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); 87 QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1());
88 88
89 e << _sourceChannel << uid; 89 e << _sourceChannel << uid;
90 90
91 if (_usedSourceParameters == 1) 91 if (_usedSourceParameters == 1)
92 e << param1; 92 e << param1;
93 else if (_usedSourceParameters == 2) 93 else if (_usedSourceParameters == 2)
94 e << param1 << param2; 94 e << param1 << param2;
95 else if (_usedSourceParameters == 3) 95 else if (_usedSourceParameters == 3)
96 e << param1 << param2 << param3; 96 e << param1 << param2 << param3;
97 97
98 qApp->processEvents(); 98 qApp->processEvents();
99 99
100 return true; 100 return true;
101 101
102#else 102#else
103 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 103 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
104 return false; 104 return false;
105#endif 105#endif
106 106
107} 107}
108 108
109 109
110/*********************************************************************************/ 110/*********************************************************************************/
111void QCopTransferItem::setSourceChannel(const QString& sourceChannel) 111void QCopTransferItem::setSourceChannel(const QString& sourceChannel)
112{ 112{
113 113
114 if (_sourceChannel.isEmpty()) 114 if ( !sourceChannel.isEmpty())
115 _sourceChannel = sourceChannel; 115 _sourceChannel = sourceChannel;
116} 116}
117 117
118 118
119/*********************************************************************************/ 119/*********************************************************************************/
120bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 120bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
121{ 121{
122 122
123 // copied from old mail2 123 // copied from old mail2
124/* 124/*
125 static int ii = 0; 125 static int ii = 0;
126 126
127 // block second call 127 // block second call
128 if ( ii < 2 ) { 128 if ( ii < 2 ) {
129 ++ii; 129 ++ii;
130 if ( ii > 1 ) { 130 if ( ii > 1 ) {
131 qDebug("qcop call blocked "); 131 qDebug("qcop call blocked ");
132 return true; 132 return true;
133 } 133 }
134 } 134 }
135*/ 135*/
136 136
137// qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() ); 137// qDebug("QCopTransferItem- QCOP message received: %s ", cmsg.data() );
138 138
139 //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
140 if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data()) 140 if ( (_sourceMessage + _sourceMessageParameters) == cmsg.data())
141 { 141 {
142 142
143 QDataStream stream( data, IO_ReadOnly ); 143 QDataStream stream( data, IO_ReadOnly );
144 144
145 145
146 QString sourceChannel; 146 QString sourceChannel;
147 QString uid; 147 QString uid;
148 QString param1; 148 QString param1;
149 QString param2; 149 QString param2;
150 QString param3; 150 QString param3;
151 151
152 stream >> sourceChannel >> uid; 152 stream >> sourceChannel >> uid;
153 153
154 if (_usedSourceParameters == 0) 154 if (_usedSourceParameters == 0)
155 { 155 {
156 emit receivedMessageFromSource(sourceChannel, uid); 156 emit receivedMessageFromSource(sourceChannel, uid);
157 } 157 }
158 else if (_usedSourceParameters == 1) 158 else if (_usedSourceParameters == 1)
159 { 159 {
160 stream >> param1; 160 stream >> param1;
161 emit receivedMessageFromSource(sourceChannel, uid, param1); 161 emit receivedMessageFromSource(sourceChannel, uid, param1);
162 } 162 }
163 else if (_usedSourceParameters == 2) 163 else if (_usedSourceParameters == 2)
164 { 164 {
165 stream >> param1 >> param2; 165 stream >> param1 >> param2;
166 emit receivedMessageFromSource(sourceChannel, uid, param1, param2); 166 emit receivedMessageFromSource(sourceChannel, uid, param1, param2);
167 } 167 }
168 else if (_usedSourceParameters == 3) 168 else if (_usedSourceParameters == 3)
169 { 169 {
170 stream >> param1 >> param2 >> param3; 170 stream >> param1 >> param2 >> param3;
171 emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3); 171 emit receivedMessageFromSource(sourceChannel, uid, param1, param2, param3);
172 } 172 }
173 173
174 return true; 174 return true;
175 } 175 }
176 176
177 return false; 177 return false;
178} 178}
179 179
180 180
181/********************************************************************************* 181/*********************************************************************************
182 * 182 *
183 ********************************************************************************/ 183 ********************************************************************************/
184 184
185 185
186QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 186QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
187 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) 187 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage)
188{ 188{
189 //targetMessage returns later two parameters: uid, and map<qstring,qstring> 189 //targetMessage returns later two parameters: uid, and map<qstring,qstring>
190 _targetMessageParameters = "(QString,QMAP<QString,QString>)"; 190 _targetMessageParameters = "(QString,QMAP<QString,QString>)";
191} 191}
192 192
193/*********************************************************************************/ 193/*********************************************************************************/
194bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) 194bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap)
195{ 195{
196#ifndef DESKTOP_VERSION 196#ifndef DESKTOP_VERSION
197 //targetMessage passes two parameters: uid, map 197 //targetMessage passes two parameters: uid, map
198 QString targetMessage = _targetMessage + _targetMessageParameters; 198 QString targetMessage = _targetMessage + _targetMessageParameters;
199 199
200 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); 200 qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
201 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());
202 202
203 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); 203 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
204 //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
205 205
206 e << uid << nameEmailMap; 206 e << uid << nameEmailMap;
207 207
208 qApp->processEvents(); 208 qApp->processEvents();
209 209
210 return true; 210 return true;
211 211
212#else 212#else
213 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 213 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
214 return false; 214 return false;
215#endif 215#endif
216 216
217} 217}
218 218
219 219
220/*********************************************************************************/ 220/*********************************************************************************/
221bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 221bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
222{ 222{
223 bool res = QCopTransferItem::appMessage( cmsg, data ); 223 bool res = QCopTransferItem::appMessage( cmsg, data );
224 224
225 if (res == false) 225 if (res == false)
226 { 226 {
227 QDataStream stream( data, IO_ReadOnly ); 227 QDataStream stream( data, IO_ReadOnly );
228 228
229// qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); 229// qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() );
230 230
231 //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
232 if ((_targetMessage + _targetMessageParameters) == cmsg.data()) 232 if ((_targetMessage + _targetMessageParameters) == cmsg.data())
233 { 233 {
234 QMap<QString,QString> adrMap; 234 QMap<QString,QString> adrMap;
235 QString uid; 235 QString uid;
236 236
237 stream >> uid >> adrMap; 237 stream >> uid >> adrMap;
238 238
239 emit receivedMessageFromTarget(uid, adrMap); 239 emit receivedMessageFromTarget(uid, adrMap);
240 240
241 241
242 return true; 242 return true;
243 } 243 }
244 } 244 }
245 245
246 return false; 246 return false;
247} 247}
248 248
249 249
250/********************************************************************************* 250/*********************************************************************************
251 * 251 *
252 ********************************************************************************/ 252 ********************************************************************************/
253 253
254 254
255QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 255QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
256 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) 256 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage)
257{ 257{
258 //targetMessage returns later two parameters: uid, and three lists 258 //targetMessage returns later two parameters: uid, and three lists
259 _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)"; 259 _targetMessageParameters = "(QString,QStringList,QStringList,QStringList)";
260} 260}
261 261
262/*********************************************************************************/ 262/*********************************************************************************/
263bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 263bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
264{ 264{
265#ifndef DESKTOP_VERSION 265#ifndef DESKTOP_VERSION
266 //targetMessage passes two parameters: uid, map 266 //targetMessage passes two parameters: uid, map
267 QString targetMessage = _targetMessage + _targetMessageParameters; 267 QString targetMessage = _targetMessage + _targetMessageParameters;
268 268
269 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); 269 qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
270 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());
271 271
272 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); 272 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
273 //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
274 274
275 e << uid << list1 << list2 << list3; 275 e << uid << list1 << list2 << list3;
276 276
277 qApp->processEvents(); 277 qApp->processEvents();
278 278
279 return true; 279 return true;
280 280
281#else 281#else
282 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 282 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
283 return false; 283 return false;
284#endif 284#endif
285 285
286} 286}
287 287
288 288
289/*********************************************************************************/ 289/*********************************************************************************/
290bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 290bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
291{ 291{
292 bool res = QCopTransferItem::appMessage( cmsg, data ); 292 bool res = QCopTransferItem::appMessage( cmsg, data );
293 qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
293 294
294 if (res == false) 295 if (res == false)
295 { 296 {
296 QDataStream stream( data, IO_ReadOnly ); 297 QDataStream stream( data, IO_ReadOnly );
297 298
298// qDebug("QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); 299 qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
299 300
300 //we are in the source and get an answer from the target 301 //we are in the source and get an answer from the target
301 if ((_targetMessage + _targetMessageParameters) == cmsg.data()) 302 if ((_targetMessage + _targetMessageParameters) == cmsg.data())
302 { 303 {
303 QStringList list1; 304 QStringList list1;
304 QStringList list2; 305 QStringList list2;
305 QStringList list3; 306 QStringList list3;
306 QString uid; 307 QString uid;
307 308
308 stream >> uid >> list1 >> list2 >> list3; 309 stream >> uid >> list1 >> list2 >> list3;
309 emit receivedMessageFromTarget(uid, list1, list2, list3); 310 emit receivedMessageFromTarget(uid, list1, list2, list3);
310 311
311 312
312 return true; 313 return true;
313 } 314 }
314 } 315 }
315 316
316 return false; 317 return false;
317} 318}
318 319
319 320
320 321
321/********************************************************************************* 322/*********************************************************************************
322 * 323 *
323 ********************************************************************************/ 324 ********************************************************************************/
324 325
325 326
326ExternalAppHandler *ExternalAppHandler::sInstance = 0; 327ExternalAppHandler *ExternalAppHandler::sInstance = 0;
327static KStaticDeleter<ExternalAppHandler> staticDeleter; 328static KStaticDeleter<ExternalAppHandler> staticDeleter;
328 329
329ExternalAppHandler::ExternalAppHandler() 330ExternalAppHandler::ExternalAppHandler()
330{ 331{
331 mDefaultItems.setAutoDelete(true); 332 mDefaultItems.setAutoDelete(true);
332 333
333 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); 334 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList");
334 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&)));
335 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&)));
336 337
337//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); 338//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList");
338//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&)));
339//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&)));
340 341
341 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); 342 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", "");
342 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&))); 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&)));
343} 344}
344 345
345ExternalAppHandler::~ExternalAppHandler() 346ExternalAppHandler::~ExternalAppHandler()
346{ 347{
347} 348}
348 349
349void ExternalAppHandler::loadConfig() 350void ExternalAppHandler::loadConfig()
350{ 351{
351 352
352 mDefaultItems.clear(); 353 mDefaultItems.clear();
353 mEmailAppAvailable = UNDEFINED; 354 mEmailAppAvailable = UNDEFINED;
354 mPhoneAppAvailable = UNDEFINED; 355 mPhoneAppAvailable = UNDEFINED;
355 mFaxAppAvailable = UNDEFINED; 356 mFaxAppAvailable = UNDEFINED;
356 mSMSAppAvailable = UNDEFINED; 357 mSMSAppAvailable = UNDEFINED;
357 mPagerAppAvailable = UNDEFINED; 358 mPagerAppAvailable = UNDEFINED;
358 mSIPAppAvailable = UNDEFINED; 359 mSIPAppAvailable = UNDEFINED;
359 360
360 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); 361 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
361 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); 362 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
362 363
363 if (opiepath.isEmpty()) 364 if (opiepath.isEmpty())
364 opiepath = qtopiapath; 365 opiepath = qtopiapath;
365 366
366 //mailclients 367 //mailclients
367 QString mailmsg1 = "writeMail(QString,QString)"; 368 QString mailmsg1 = "writeMail(QString,QString)";
368 QString mailmsg2 = "writeMail(QMap(QString,QString))"; 369 QString mailmsg2 = "writeMail(QMap(QString,QString))";
369 370
370 QString undefined = ""; 371 QString undefined = "";
371 372
372 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); 373 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined);
373 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); 374 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined);
374 375
375 if (( QFile::exists( qtopiapath + "/bin/ompi" )) || 376 if (( QFile::exists( qtopiapath + "/bin/ompi" )) ||
376 ( QFile::exists( opiepath + "/bin/ompi" ))) 377 ( QFile::exists( opiepath + "/bin/ompi" )))
377 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 378 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
378 379
379 if ( QFile::exists( qtopiapath + "/bin/qtmail" )) 380 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
380 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 381 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
381 382
382 if ( QFile::exists( opiepath + "/bin/opiemail" )) 383 if ( QFile::exists( opiepath + "/bin/opiemail" ))
383 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 384 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
384 385
385 386
386 387
387 //phoneclients 388 //phoneclients
388 389
389 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); 390 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined);
390 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); 391 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined);
391 if (( QFile::exists( qtopiapath + "/bin/kppi" )) || 392 if (( QFile::exists( qtopiapath + "/bin/kppi" )) ||
392 ( QFile::exists( opiepath + "/bin/kppi" ))) 393 ( QFile::exists( opiepath + "/bin/kppi" )))
393 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); 394 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined);
394 395
395 //faxclients 396 //faxclients
396 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); 397 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined);
397 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); 398 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined);
398 399
399 //smsclients 400 //smsclients
400 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); 401 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined);
401 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); 402 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined);
402 403
403 //pagerclients 404 //pagerclients
404 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); 405 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined);
405 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); 406 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined);
406 407
407 //sipclients 408 //sipclients
408 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No sip client installed", undefined, undefined, undefined, undefined, undefined); 409 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No sip client installed", undefined, undefined, undefined, undefined, undefined);
409 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other sip client", undefined, undefined, undefined, undefined, undefined); 410 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other sip client", undefined, undefined, undefined, undefined, undefined);
410 411
411} 412}
412 413
413ExternalAppHandler *ExternalAppHandler::instance() 414ExternalAppHandler *ExternalAppHandler::instance()
414{ 415{
415 if ( !sInstance ) { 416 if ( !sInstance ) {
416 sInstance = staticDeleter.setObject( new ExternalAppHandler() ); 417 sInstance = staticDeleter.setObject( new ExternalAppHandler() );
417 sInstance->loadConfig(); 418 sInstance->loadConfig();
418 } 419 }
419 420
420 return sInstance; 421 return sInstance;
421} 422}
422 423
423void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2) 424void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2)
424{ 425{
425 DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); 426 DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2);
426 // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); 427 // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() );
427 mDefaultItems.append(dai); 428 mDefaultItems.append(dai);
428} 429}
429 430
430 431
431QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) 432QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type)
432{ 433{
433 QList<DefaultAppItem> list; 434 QList<DefaultAppItem> list;
434 435
435 DefaultAppItem* dai; 436 DefaultAppItem* dai;
436 437
437 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) 438 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
438 { 439 {
439 if (dai->_type == type) 440 if (dai->_type == type)
440 list.append(dai); 441 list.append(dai);
441 } 442 }
442 443
443 return list; 444 return list;
444} 445}
445 446
446DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) 447DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
447{ 448{
448 DefaultAppItem* dai; 449 DefaultAppItem* dai;
449 450
450 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) 451 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
451 { 452 {
452 if (dai->_type == type && dai->_id == clientid) 453 if (dai->_type == type && dai->_id == clientid)
453 return dai; 454 return dai;
454 } 455 }
455 456
456 return 0; 457 return 0;
457} 458}
458 459
459bool ExternalAppHandler::isEmailAppAvailable() 460bool ExternalAppHandler::isEmailAppAvailable()
460{ 461{
461#ifndef DESKTOP_VERSION 462#ifndef DESKTOP_VERSION
462 if (mEmailAppAvailable == UNDEFINED) 463 if (mEmailAppAvailable == UNDEFINED)
463 { 464 {
464 int client = KPimGlobalPrefs::instance()->mEmailClient; 465 int client = KPimGlobalPrefs::instance()->mEmailClient;
465 if (client == KPimGlobalPrefs::NONE_EMC) 466 if (client == KPimGlobalPrefs::NONE_EMC)
466 mEmailAppAvailable = UNAVAILABLE; 467 mEmailAppAvailable = UNAVAILABLE;
467 else 468 else
468 mEmailAppAvailable = AVAILABLE; 469 mEmailAppAvailable = AVAILABLE;
469 } 470 }
470 return (mEmailAppAvailable == AVAILABLE); 471 return (mEmailAppAvailable == AVAILABLE);
471 472
472#else //DESKTOP_VERSION 473#else //DESKTOP_VERSION
473 return false; 474 return false;
474#endif //DESKTOP_VERSION 475#endif //DESKTOP_VERSION
475} 476}
476 477
477bool ExternalAppHandler::isSMSAppAvailable() 478bool ExternalAppHandler::isSMSAppAvailable()
478{ 479{
479#ifndef DESKTOP_VERSION 480#ifndef DESKTOP_VERSION
480 if (mSMSAppAvailable == UNDEFINED) 481 if (mSMSAppAvailable == UNDEFINED)
481 { 482 {
482 int client = KPimGlobalPrefs::instance()->mSMSClient; 483 int client = KPimGlobalPrefs::instance()->mSMSClient;
483 if (client == KPimGlobalPrefs::NONE_SMC) 484 if (client == KPimGlobalPrefs::NONE_SMC)
484 mSMSAppAvailable = UNAVAILABLE; 485 mSMSAppAvailable = UNAVAILABLE;
485 else 486 else
486 mSMSAppAvailable = AVAILABLE; 487 mSMSAppAvailable = AVAILABLE;
487 } 488 }
488 489
489 return (mSMSAppAvailable == AVAILABLE); 490 return (mSMSAppAvailable == AVAILABLE);
490#else //DESKTOP_VERSION 491#else //DESKTOP_VERSION
491 return false; 492 return false;
492#endif //DESKTOP_VERSION 493#endif //DESKTOP_VERSION
493} 494}
494 495
495bool ExternalAppHandler::isPhoneAppAvailable() 496bool ExternalAppHandler::isPhoneAppAvailable()
496{ 497{
497#ifndef DESKTOP_VERSION 498#ifndef DESKTOP_VERSION
498 if (mPhoneAppAvailable == UNDEFINED) 499 if (mPhoneAppAvailable == UNDEFINED)
499 { 500 {
500 int client = KPimGlobalPrefs::instance()->mPhoneClient; 501 int client = KPimGlobalPrefs::instance()->mPhoneClient;
501 if (client == KPimGlobalPrefs::NONE_PHC) 502 if (client == KPimGlobalPrefs::NONE_PHC)
502 mPhoneAppAvailable = UNAVAILABLE; 503 mPhoneAppAvailable = UNAVAILABLE;
503 else 504 else
504 mPhoneAppAvailable = AVAILABLE; 505 mPhoneAppAvailable = AVAILABLE;
505 } 506 }
506 507
507 return (mPhoneAppAvailable == AVAILABLE); 508 return (mPhoneAppAvailable == AVAILABLE);
508#else //DESKTOP_VERSION 509#else //DESKTOP_VERSION
509 return false; 510 return false;
510#endif //DESKTOP_VERSION 511#endif //DESKTOP_VERSION
511} 512}
512 513
513bool ExternalAppHandler::isFaxAppAvailable() 514bool ExternalAppHandler::isFaxAppAvailable()
514{ 515{
515#ifndef DESKTOP_VERSION 516#ifndef DESKTOP_VERSION
516 if (mFaxAppAvailable == UNDEFINED) 517 if (mFaxAppAvailable == UNDEFINED)
517 { 518 {
518 int client = KPimGlobalPrefs::instance()->mFaxClient; 519 int client = KPimGlobalPrefs::instance()->mFaxClient;
519 if (client == KPimGlobalPrefs::NONE_FAC) 520 if (client == KPimGlobalPrefs::NONE_FAC)
520 mFaxAppAvailable = UNAVAILABLE; 521 mFaxAppAvailable = UNAVAILABLE;
521 else 522 else
522 mFaxAppAvailable = AVAILABLE; 523 mFaxAppAvailable = AVAILABLE;
523 } 524 }
524 525
525 return (mFaxAppAvailable == AVAILABLE); 526 return (mFaxAppAvailable == AVAILABLE);
526#else //DESKTOP_VERSION 527#else //DESKTOP_VERSION
527 return false; 528 return false;
528#endif //DESKTOP_VERSION 529#endif //DESKTOP_VERSION
529} 530}
530 531
531bool ExternalAppHandler::isPagerAppAvailable() 532bool ExternalAppHandler::isPagerAppAvailable()
532{ 533{
533#ifndef DESKTOP_VERSION 534#ifndef DESKTOP_VERSION
534 if (mPagerAppAvailable == UNDEFINED) 535 if (mPagerAppAvailable == UNDEFINED)
535 { 536 {
536 int client = KPimGlobalPrefs::instance()->mPagerClient; 537 int client = KPimGlobalPrefs::instance()->mPagerClient;
537 if (client == KPimGlobalPrefs::NONE_PAC) 538 if (client == KPimGlobalPrefs::NONE_PAC)
538 mPagerAppAvailable = UNAVAILABLE; 539 mPagerAppAvailable = UNAVAILABLE;
539 else 540 else
540 mPagerAppAvailable = AVAILABLE; 541 mPagerAppAvailable = AVAILABLE;
541 } 542 }
542 543
543 return (mPagerAppAvailable == AVAILABLE); 544 return (mPagerAppAvailable == AVAILABLE);
544#else //DESKTOP_VERSION 545#else //DESKTOP_VERSION
545 return false; 546 return false;
546#endif //DESKTOP_VERSION 547#endif //DESKTOP_VERSION
547} 548}
548 549
549 550
550bool ExternalAppHandler::isSIPAppAvailable() 551bool ExternalAppHandler::isSIPAppAvailable()
551{ 552{
552#ifndef DESKTOP_VERSION 553#ifndef DESKTOP_VERSION
553 if (mSIPAppAvailable == UNDEFINED) 554 if (mSIPAppAvailable == UNDEFINED)
554 { 555 {
555 int client = KPimGlobalPrefs::instance()->mSipClient; 556 int client = KPimGlobalPrefs::instance()->mSipClient;
556 if (client == KPimGlobalPrefs::NONE_SIC) 557 if (client == KPimGlobalPrefs::NONE_SIC)
557 mSIPAppAvailable = UNAVAILABLE; 558 mSIPAppAvailable = UNAVAILABLE;
558 else 559 else
559 mSIPAppAvailable = AVAILABLE; 560 mSIPAppAvailable = AVAILABLE;
560 } 561 }
561 562
562 return (mSIPAppAvailable == AVAILABLE); 563 return (mSIPAppAvailable == AVAILABLE);
563#else //DESKTOP_VERSION 564#else //DESKTOP_VERSION
564 return false; 565 return false;
565#endif //DESKTOP_VERSION 566#endif //DESKTOP_VERSION
566} 567}
567 568
568/************************************************************************** 569/**************************************************************************
569 * 570 *
570 **************************************************************************/ 571 **************************************************************************/
571 572
572 573
573//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) 574//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma)
574bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) 575bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls )
575{ 576{
576 577
577#ifndef DESKTOP_VERSION 578#ifndef DESKTOP_VERSION
578 QString channel; 579 QString channel;
579 QString message2; 580 QString message2;
580 QString parameters2; 581 QString parameters2;
581 582
582 583
583 int client = KPimGlobalPrefs::instance()->mEmailClient; 584 int client = KPimGlobalPrefs::instance()->mEmailClient;
584 if (client == KPimGlobalPrefs::OTHER_EMC) 585 if (client == KPimGlobalPrefs::OTHER_EMC)
585 { 586 {
586 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; 587 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
587 message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; 588 message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage;
588 parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; 589 parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
589 } 590 }
590 else 591 else
591 { 592 {
592 DefaultAppItem* dai = getDefaultItem(EMAIL, client); 593 DefaultAppItem* dai = getDefaultItem(EMAIL, client);
593 if (!dai) 594 if (!dai)
594 { 595 {
595 qDebug("could not find configured email application."); 596 qDebug("could not find configured email application.");
596 return false; 597 return false;
597 } 598 }
598 channel = dai->_channel; 599 channel = dai->_channel;
599 message2 = dai->_message2; 600 message2 = dai->_message2;
600 parameters2 = dai->_parameters2; 601 parameters2 = dai->_parameters2;
601 } 602 }
602 603
603 //first check if one of the mailers need the emails right in the message. 604 //first check if one of the mailers need the emails right in the message.
604 message2 = translateMessage(message2, emails, urls); 605 message2 = translateMessage(message2, emails, urls);
605 606
606 607
607 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); 608 qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1());
608 qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); 609 qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1());
609 610
610 611
611 QCopEnvelope e(channel.latin1(), message2.latin1()); 612 QCopEnvelope e(channel.latin1(), message2.latin1());
612 //US we need no names in the To field. The emailadresses are enough 613 //US we need no names in the To field. The emailadresses are enough
613 614
614 passParameters(&e, parameters2, emails, urls); 615 passParameters(&e, parameters2, emails, urls);
615 616
616 617
617 618
618#else 619#else
619 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); 620 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
620#endif 621#endif
621 622
622 return true; 623 return true;
623} 624}
624 625
625/************************************************************************** 626/**************************************************************************
626 * 627 *
627 **************************************************************************/ 628 **************************************************************************/
628 629
629 630
630//calls the emailapplication and creates a mail with parameter emails as recipients 631//calls the emailapplication and creates a mail with parameter emails as recipients
631bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) 632bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress )
632{ 633{
633#ifndef DESKTOP_VERSION 634#ifndef DESKTOP_VERSION
634 QString channel; 635 QString channel;
635 QString message; 636 QString message;
636 QString parameters; 637 QString parameters;
637 638
638 639
639 int client = KPimGlobalPrefs::instance()->mEmailClient; 640 int client = KPimGlobalPrefs::instance()->mEmailClient;
640 if (client == KPimGlobalPrefs::OTHER_EMC) 641 if (client == KPimGlobalPrefs::OTHER_EMC)
641 { 642 {
642 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; 643 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
643 message = KPimGlobalPrefs::instance()->mEmailOtherMessage; 644 message = KPimGlobalPrefs::instance()->mEmailOtherMessage;
644 parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; 645 parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
645 } 646 }
646 else 647 else
647 { 648 {
648 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); 649 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client);
649 if (!dai) 650 if (!dai)
650 { 651 {
651 qDebug("could not find configured email application."); 652 qDebug("could not find configured email application.");
652 return false; 653 return false;
653 } 654 }
654 channel = dai->_channel; 655 channel = dai->_channel;
655 message = dai->_message; 656 message = dai->_message;
656 parameters = dai->_parameters; 657 parameters = dai->_parameters;
657 } 658 }
658 659
659 660
660 //first check if one of the mailers need the emails right in the message. 661 //first check if one of the mailers need the emails right in the message.
661 message = translateMessage(message, name, emailadress); 662 message = translateMessage(message, name, emailadress);
662 663
663 664
664 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 665 qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
665 qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); 666 qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1());
666 667
667 QCopEnvelope e(channel.latin1(), message.latin1()); 668 QCopEnvelope e(channel.latin1(), message.latin1());
668 //US we need no names in the To field. The emailadresses are enough 669 //US we need no names in the To field. The emailadresses are enough
669 670
670 passParameters(&e, parameters, name, emailadress); 671 passParameters(&e, parameters, name, emailadress);
671 672
672 673
673#else 674#else
674 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); 675 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
675#endif 676#endif
676 677
677 678
678 return true; 679 return true;
679} 680}
680 681
681/************************************************************************** 682/**************************************************************************
682 * 683 *
683 **************************************************************************/ 684 **************************************************************************/
684 685
685//calls the emailapplication and creates a mail with parameter as recipients 686//calls the emailapplication and creates a mail with parameter as recipients
686// parameters format is 687// parameters format is
687// NAME <EMAIL>:SUBJECT 688// NAME <EMAIL>:SUBJECT
688bool ExternalAppHandler::mailToOneContact( const QString& adressline ) 689bool ExternalAppHandler::mailToOneContact( const QString& adressline )
689{ 690{
690 QString line = adressline; 691 QString line = adressline;
691 692
692 int first = line.find( "<"); 693 int first = line.find( "<");
693 int last = line.find( ">"); 694 int last = line.find( ">");
694 QString name = line.left(first); 695 QString name = line.left(first);
695 QString emailadress = line.mid(first+1, last-first-1); 696 QString emailadress = line.mid(first+1, last-first-1);
696 697
697 //Subject can not be handled right now. 698 //Subject can not be handled right now.
698 return mailToOneContact( name, emailadress ); 699 return mailToOneContact( name, emailadress );
699 700
700} 701}
701 702
702 703
703/************************************************************************** 704/**************************************************************************
704 * 705 *
705 **************************************************************************/ 706 **************************************************************************/
706 707
707//calls the phoneapplication with the number 708//calls the phoneapplication with the number
708bool ExternalAppHandler::callByPhone( const QString& phonenumber ) 709bool ExternalAppHandler::callByPhone( const QString& phonenumber )
709{ 710{
710#ifndef DESKTOP_VERSION 711#ifndef DESKTOP_VERSION
711 QString channel; 712 QString channel;
712 QString message; 713 QString message;
713 QString parameters; 714 QString parameters;
714 715
715 716
716 int client = KPimGlobalPrefs::instance()->mPhoneClient; 717 int client = KPimGlobalPrefs::instance()->mPhoneClient;
717 if (client == KPimGlobalPrefs::OTHER_PHC) 718 if (client == KPimGlobalPrefs::OTHER_PHC)
718 { 719 {
719 channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; 720 channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel;
720 message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; 721 message = KPimGlobalPrefs::instance()->mPhoneOtherMessage;
721 parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; 722 parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters;
722 } 723 }
723 else 724 else
724 { 725 {
725 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); 726 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client);
726 if (!dai) 727 if (!dai)
727 { 728 {
728 qDebug("could not find configured phone application."); 729 qDebug("could not find configured phone application.");
729 return false; 730 return false;
730 } 731 }
731 channel = dai->_channel; 732 channel = dai->_channel;
732 message = dai->_message; 733 message = dai->_message;
733 parameters = dai->_parameters; 734 parameters = dai->_parameters;
734 } 735 }
735 736
736 737
737 //first check if one of the mailers need the emails right in the message. 738 //first check if one of the mailers need the emails right in the message.
738 message = translateMessage(message, phonenumber, ""); 739 message = translateMessage(message, phonenumber, "");
739 740
740 741
741 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 742 qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
742 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); 743 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
743 744
744 QCopEnvelope e(channel.latin1(), message.latin1()); 745 QCopEnvelope e(channel.latin1(), message.latin1());
745 //US we need no names in the To field. The emailadresses are enough 746 //US we need no names in the To field. The emailadresses are enough
746 747
747 passParameters(&e, parameters, phonenumber, ""); 748 passParameters(&e, parameters, phonenumber, "");
748 749
749 750
750#else 751#else
751 KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); 752 KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) );
752#endif 753#endif
753 754
754 755
755 return true; 756 return true;
756} 757}
757 758
758/************************************************************************** 759/**************************************************************************
759 * 760 *
760 **************************************************************************/ 761 **************************************************************************/
761 762
762//calls the smsapplication with the number 763//calls the smsapplication with the number
763bool ExternalAppHandler::callBySMS( const QString& phonenumber ) 764bool ExternalAppHandler::callBySMS( const QString& phonenumber )
764{ 765{
765#ifndef DESKTOP_VERSION 766#ifndef DESKTOP_VERSION
766 QString channel; 767 QString channel;
767 QString message; 768 QString message;
768 QString parameters; 769 QString parameters;
769 770
770 771
771 int client = KPimGlobalPrefs::instance()->mSMSClient; 772 int client = KPimGlobalPrefs::instance()->mSMSClient;
772 if (client == KPimGlobalPrefs::OTHER_SMC) 773 if (client == KPimGlobalPrefs::OTHER_SMC)
773 { 774 {
774 channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; 775 channel = KPimGlobalPrefs::instance()->mSMSOtherChannel;
775 message = KPimGlobalPrefs::instance()->mSMSOtherMessage; 776 message = KPimGlobalPrefs::instance()->mSMSOtherMessage;
776 parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; 777 parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters;
777 } 778 }
778 else 779 else
779 { 780 {
780 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); 781 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client);
781 if (!dai) 782 if (!dai)
782 { 783 {
783 qDebug("could not find configured sms application."); 784 qDebug("could not find configured sms application.");
784 return false; 785 return false;
785 } 786 }
786 channel = dai->_channel; 787 channel = dai->_channel;
787 message = dai->_message; 788 message = dai->_message;
788 parameters = dai->_parameters; 789 parameters = dai->_parameters;
789 } 790 }
790 791
791 792
792 //first check if one of the mailers need the emails right in the message. 793 //first check if one of the mailers need the emails right in the message.
793 message = translateMessage(message, phonenumber, ""); 794 message = translateMessage(message, phonenumber, "");
794 795
795 796
796 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 797 qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
797 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); 798 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
798 799
799 QCopEnvelope e(channel.latin1(), message.latin1()); 800 QCopEnvelope e(channel.latin1(), message.latin1());
800 //US we need no names in the To field. The emailadresses are enough 801 //US we need no names in the To field. The emailadresses are enough
801 802
802 passParameters(&e, parameters, phonenumber, ""); 803 passParameters(&e, parameters, phonenumber, "");
803 804
804 805
805#else 806#else
806 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); 807 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) );
807#endif 808#endif
808 809
809 810
810 return true; 811 return true;
811} 812}
812 813
813/************************************************************************** 814/**************************************************************************
814 * 815 *
815 **************************************************************************/ 816 **************************************************************************/
816 817
817//calls the pagerapplication with the number 818//calls the pagerapplication with the number
818bool ExternalAppHandler::callByPager( const QString& pagernumber ) 819bool ExternalAppHandler::callByPager( const QString& pagernumber )
819{ 820{
820#ifndef DESKTOP_VERSION 821#ifndef DESKTOP_VERSION
821 QString channel; 822 QString channel;
822 QString message; 823 QString message;
823 QString parameters; 824 QString parameters;
824 825
825 826
826 int client = KPimGlobalPrefs::instance()->mPagerClient; 827 int client = KPimGlobalPrefs::instance()->mPagerClient;
827 if (client == KPimGlobalPrefs::OTHER_PAC) 828 if (client == KPimGlobalPrefs::OTHER_PAC)
828 { 829 {
829 channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; 830 channel = KPimGlobalPrefs::instance()->mPagerOtherChannel;
830 message = KPimGlobalPrefs::instance()->mPagerOtherMessage; 831 message = KPimGlobalPrefs::instance()->mPagerOtherMessage;
831 parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; 832 parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters;
832 } 833 }
833 else 834 else
834 { 835 {
835 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); 836 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client);
836 if (!dai) 837 if (!dai)
837 { 838 {
838 qDebug("could not find configured pager application."); 839 qDebug("could not find configured pager application.");
839 return false; 840 return false;
840 } 841 }
841 channel = dai->_channel; 842 channel = dai->_channel;
842 message = dai->_message; 843 message = dai->_message;
843 parameters = dai->_parameters; 844 parameters = dai->_parameters;
844 } 845 }
845 846
846 847
847 //first check if one of the mailers need the emails right in the message. 848 //first check if one of the mailers need the emails right in the message.
848 message = translateMessage(message, pagernumber, ""); 849 message = translateMessage(message, pagernumber, "");
849 850
850 851
851 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 852 qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
852 qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); 853 qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1());
853 854
854 QCopEnvelope e(channel.latin1(), message.latin1()); 855 QCopEnvelope e(channel.latin1(), message.latin1());
855 //US we need no names in the To field. The emailadresses are enough 856 //US we need no names in the To field. The emailadresses are enough
856 857
857 passParameters(&e, parameters, pagernumber, ""); 858 passParameters(&e, parameters, pagernumber, "");
858 859
859 860
860#else 861#else
861 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); 862 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) );
862#endif 863#endif
863 864
864 865
865 return true; 866 return true;
866} 867}
867 868
868/************************************************************************** 869/**************************************************************************
869 * 870 *
870 **************************************************************************/ 871 **************************************************************************/
871 872
872//calls the faxapplication with the number 873//calls the faxapplication with the number
873bool ExternalAppHandler::callByFax( const QString& faxnumber ) 874bool ExternalAppHandler::callByFax( const QString& faxnumber )
874{ 875{
875#ifndef DESKTOP_VERSION 876#ifndef DESKTOP_VERSION
876 QString channel; 877 QString channel;
877 QString message; 878 QString message;
878 QString parameters; 879 QString parameters;
879 880
880 881
881 int client = KPimGlobalPrefs::instance()->mFaxClient; 882 int client = KPimGlobalPrefs::instance()->mFaxClient;
882 if (client == KPimGlobalPrefs::OTHER_FAC) 883 if (client == KPimGlobalPrefs::OTHER_FAC)
883 { 884 {
884 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; 885 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel;
885 message = KPimGlobalPrefs::instance()->mFaxOtherMessage; 886 message = KPimGlobalPrefs::instance()->mFaxOtherMessage;
886 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; 887 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters;
887 } 888 }
888 else 889 else
889 { 890 {
890 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); 891 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client);
891 if (!dai) 892 if (!dai)
892 { 893 {
893 qDebug("could not find configured fax application."); 894 qDebug("could not find configured fax application.");
894 return false; 895 return false;
895 } 896 }
896 channel = dai->_channel; 897 channel = dai->_channel;
897 message = dai->_message; 898 message = dai->_message;
898 parameters = dai->_parameters; 899 parameters = dai->_parameters;
899 } 900 }
900 901
901 902
902 //first check if one of the mailers need the emails right in the message. 903 //first check if one of the mailers need the emails right in the message.
903 message = translateMessage(message, faxnumber, ""); 904 message = translateMessage(message, faxnumber, "");
904 905
905 906
906 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 907 qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
907 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); 908 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1());
908 909
909 QCopEnvelope e(channel.latin1(), message.latin1()); 910 QCopEnvelope e(channel.latin1(), message.latin1());
910 //US we need no names in the To field. The emailadresses are enough 911 //US we need no names in the To field. The emailadresses are enough
911 912
912 passParameters(&e, parameters, faxnumber, ""); 913 passParameters(&e, parameters, faxnumber, "");
913 914
914 915
915#else 916#else
916 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); 917 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) );
917#endif 918#endif
918 919
919 920
920 return true; 921 return true;
921} 922}
922 923
923/************************************************************************** 924/**************************************************************************
924 * 925 *
925 **************************************************************************/ 926 **************************************************************************/
926 927
927//calls the sipapplication with the number 928//calls the sipapplication with the number
928bool ExternalAppHandler::callBySIP( const QString& sipnumber ) 929bool ExternalAppHandler::callBySIP( const QString& sipnumber )
929{ 930{
930#ifndef DESKTOP_VERSION 931#ifndef DESKTOP_VERSION
931 QString channel; 932 QString channel;
932 QString message; 933 QString message;
933 QString parameters; 934 QString parameters;
934 935
935 936
936 int client = KPimGlobalPrefs::instance()->mSipClient; 937 int client = KPimGlobalPrefs::instance()->mSipClient;
937 if (client == KPimGlobalPrefs::OTHER_SIC) 938 if (client == KPimGlobalPrefs::OTHER_SIC)
938 { 939 {
939 channel = KPimGlobalPrefs::instance()->mSipOtherChannel; 940 channel = KPimGlobalPrefs::instance()->mSipOtherChannel;
940 message = KPimGlobalPrefs::instance()->mSipOtherMessage; 941 message = KPimGlobalPrefs::instance()->mSipOtherMessage;
941 parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; 942 parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters;
942 } 943 }
943 else 944 else
944 { 945 {
945 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); 946 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client);
946 if (!dai) 947 if (!dai)
947 { 948 {
948 qDebug("could not find configured sip application."); 949 qDebug("could not find configured sip application.");
949 return false; 950 return false;
950 } 951 }
951 channel = dai->_channel; 952 channel = dai->_channel;
952 message = dai->_message; 953 message = dai->_message;
953 parameters = dai->_parameters; 954 parameters = dai->_parameters;
954 } 955 }
955 956
956 957
957 //first check if one of the sip apps need the emails right in the message. 958 //first check if one of the sip apps need the emails right in the message.
958 message = translateMessage(message, sipnumber, ""); 959 message = translateMessage(message, sipnumber, "");
959 960
960 961
961 qDebug("Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 962 qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
962 qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); 963 qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1());
963 964
964 QCopEnvelope e(channel.latin1(), message.latin1()); 965 QCopEnvelope e(channel.latin1(), message.latin1());
965 //US we need no names in the To field. The emailadresses are enough 966 //US we need no names in the To field. The emailadresses are enough
966 967
967 passParameters(&e, parameters, sipnumber, ""); 968 passParameters(&e, parameters, sipnumber, "");
968 969
969 970
970#else 971#else
971 KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); 972 KMessageBox::sorry( 0, i18n( "This version does not support sip." ) );
972#endif 973#endif
973 974
974 975
975 return true; 976 return true;
976} 977}
977 978
978 979
979/************************************************************************** 980/**************************************************************************
980 * 981 *
981 **************************************************************************/ 982 **************************************************************************/
982 983
983 984
984QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const 985QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const
985{ 986{
986 message = message.replace( QRegExp("%1"), param1 ); 987 message = message.replace( QRegExp("%1"), param1 );
987 return message.replace( QRegExp("%2"), param2 ); 988 return message.replace( QRegExp("%2"), param2 );
988} 989}
989 990
990/************************************************************************** 991/**************************************************************************
991 * 992 *
992 **************************************************************************/ 993 **************************************************************************/
993 994
994void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const 995void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const
995{ 996{
996#ifndef DESKTOP_VERSION 997#ifndef DESKTOP_VERSION
997 QMap<QString, QString> valmap; 998 QMap<QString, QString> valmap;
998 bool useValMap = false; 999 bool useValMap = false;
999 1000
1000 // first extract all parts of the parameters. 1001 // first extract all parts of the parameters.
1001 QStringList paramlist = QStringList::split(";", parameters); 1002 QStringList paramlist = QStringList::split(";", parameters);
1002 1003
1003 //Now check how many parts we have. 1004 //Now check how many parts we have.
1004 //=0 :no params to pass 1005 //=0 :no params to pass
1005 //>0 :parameters to pass 1006 //>0 :parameters to pass
1006 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) 1007 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it )
1007 { 1008 {
1008 QString param = (*it); 1009 QString param = (*it);
1009 QStringList keyvallist = QStringList::split("=", param); 1010 QStringList keyvallist = QStringList::split("=", param);
1010 1011
1011 //if we have keyvalue pairs, we assume that we pass a map to the envelope 1012 //if we have keyvalue pairs, we assume that we pass a map to the envelope
1012 QStringList::Iterator it2 = keyvallist.begin(); 1013 QStringList::Iterator it2 = keyvallist.begin();
1013 QString key = (*it2); 1014 QString key = (*it2);
1014 key = key.replace( QRegExp("%1"), param1 ); 1015 key = key.replace( QRegExp("%1"), param1 );
1015 key = key.replace( QRegExp("%2"), param2 ); 1016 key = key.replace( QRegExp("%2"), param2 );
1016 ++it2; 1017 ++it2;
1017 1018
1018 if(it2 != keyvallist.end()) 1019 if(it2 != keyvallist.end())
1019 { 1020 {
1020 QString value = (*it2); 1021 QString value = (*it2);
1021 value = value.replace( QRegExp("%1"), param1 ); 1022 value = value.replace( QRegExp("%1"), param1 );
1022 value = value.replace( QRegExp("%2"), param2 ); 1023 value = value.replace( QRegExp("%2"), param2 );
1023 1024
1024 valmap.insert(key, value); 1025 valmap.insert(key, value);
1025 useValMap = true; 1026 useValMap = true;
1026 } 1027 }
1027 else 1028 else
1028 { 1029 {
1029 // qDebug("pass parameter << %s", key.latin1()); 1030 // qDebug("pass parameter << %s", key.latin1());
1030 (*e) << key; 1031 (*e) << key;
1031 } 1032 }
1032 } 1033 }
1033 1034
1034 if (useValMap == true) 1035 if (useValMap == true)
1035 (*e) << valmap; 1036 (*e) << valmap;
1036 1037
1037#endif 1038#endif
1038 1039
1039} 1040}
1040 1041
1041 1042
1042 1043
1043/************************************************************************** 1044/**************************************************************************
1044 * 1045 *
1045 **************************************************************************/ 1046 **************************************************************************/
1046 1047
1047void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) 1048void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data )
1048{ 1049{
1049 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1050 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1050 if (!res) 1051 if (!res)
1051 res = mDisplayDetails->appMessage( cmsg, data ); 1052 res = mDisplayDetails->appMessage( cmsg, data );
1052 1053
1053// if (!res) 1054// if (!res)
1054// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1055// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1055} 1056}
1056 1057
1057 1058
1058 1059
1059bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1060bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
1060{ 1061{
1061 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1062 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1062 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); 1063 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid);
1063} 1064}
1064 1065
1065bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1066bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1066{ 1067{
1068
1067 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1069 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1068 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); 1070 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3);
1069} 1071}
1070 1072
1071bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) 1073bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email)
1072{ 1074{
1073 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1075 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1074 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); 1076 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email);
1075} 1077}
1076 1078
1077bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1079bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1078{ 1080{
1079 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1081 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1080 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); 1082 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3);
1081} 1083}
1082 1084
1083bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) 1085bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid)
1084{ 1086{
1085 mDisplayDetails->setSourceChannel(""); 1087 mDisplayDetails->setSourceChannel("");
1086 return mDisplayDetails->sendMessageToTarget("", name, email, uid); 1088 return mDisplayDetails->sendMessageToTarget("", name, email, uid);
1087} 1089}
1088 1090
1089 1091
1090 1092
1091 1093
1092 1094