summaryrefslogtreecommitdiffabout
path: root/libkdepim/externalapphandler.cpp
authorulf69 <ulf69>2004-10-07 01:04:18 (UTC)
committer ulf69 <ulf69>2004-10-07 01:04:18 (UTC)
commit0406c1ac252f2fa631f7a486e73b0a97d09874f9 (patch) (unidiff)
tree72de99490603b5913a39a101ef571ba74acd6798 /libkdepim/externalapphandler.cpp
parent0afcfa29ace7bc5e42a11fae44301e1e8230a376 (diff)
downloadkdepimpi-0406c1ac252f2fa631f7a486e73b0a97d09874f9.zip
kdepimpi-0406c1ac252f2fa631f7a486e73b0a97d09874f9.tar.gz
kdepimpi-0406c1ac252f2fa631f7a486e73b0a97d09874f9.tar.bz2
added functionality for Birthdaylookup from kopi via qCop
Diffstat (limited to 'libkdepim/externalapphandler.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp68
1 files changed, 58 insertions, 10 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 99aee86..07bdff2 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -1,1094 +1,1142 @@
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("1Using 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("2Using 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,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, const QStringList& list4, const QStringList& list5, const QStringList& list6)
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("3Using 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, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1());
271
272
273 for ( int i = 0; i < list3.count(); i++)
274 qDebug("listentry list3: %s",list3[i].latin1());
271 275
272 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); 276 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
273 //US we need no names in the To field. The emailadresses are enough 277 //US we need no names in the To field. The emailadresses are enough
274 278
275 e << uid << list1 << list2 << list3; 279 e << uid << list1 << list2 << list3 << list4 << list5 << list6;
276 280
277 qApp->processEvents(); 281 qApp->processEvents();
278 282
279 return true; 283 return true;
280 284
281#else 285#else
282 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 286 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
283 return false; 287 return false;
284#endif 288#endif
285 289
286} 290}
287 291
288 292
289/*********************************************************************************/ 293/*********************************************************************************/
290bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 294bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
291{ 295{
292 bool res = QCopTransferItem::appMessage( cmsg, data ); 296 bool res = QCopTransferItem::appMessage( cmsg, data );
293 qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); 297 qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
294 298
295 if (res == false) 299 if (res == false)
296 { 300 {
297 QDataStream stream( data, IO_ReadOnly ); 301 QDataStream stream( data, IO_ReadOnly );
298 302
299 qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); 303 qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
300 304
301 //we are in the source and get an answer from the target 305 //we are in the source and get an answer from the target
302 if ((_targetMessage + _targetMessageParameters) == cmsg.data()) 306 if ((_targetMessage + _targetMessageParameters) == cmsg.data())
303 { 307 {
304 QStringList list1; 308 QStringList list1;
305 QStringList list2; 309 QStringList list2;
306 QStringList list3; 310 QStringList list3;
311 QStringList list4;
312 QStringList list5;
313 QStringList list6;
307 QString uid; 314 QString uid;
308 315
309 stream >> uid >> list1 >> list2 >> list3; 316 qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
310 emit receivedMessageFromTarget(uid, list1, list2, list3); 317
318 stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6;
319 emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6);
311 320
312 321
313 return true; 322 return true;
314 } 323 }
315 } 324 }
316 325
317 return false; 326 return false;
318} 327}
319 328
320 329
321 330
322/********************************************************************************* 331/*********************************************************************************
323 * 332 *
324 ********************************************************************************/ 333 ********************************************************************************/
325 334
326 335
327ExternalAppHandler *ExternalAppHandler::sInstance = 0; 336ExternalAppHandler *ExternalAppHandler::sInstance = 0;
328static KStaticDeleter<ExternalAppHandler> staticDeleter; 337static KStaticDeleter<ExternalAppHandler> staticDeleter;
329 338
330ExternalAppHandler::ExternalAppHandler() 339ExternalAppHandler::ExternalAppHandler()
331{ 340{
332 mDefaultItems.setAutoDelete(true); 341 mDefaultItems.setAutoDelete(true);
333 342
334 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); 343 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList");
335 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); 344 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&)));
336 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedNameEmailUidListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); 345 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
337 346
338//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); 347//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList");
339//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); 348//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&)));
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&))); 349//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)));
341 350
342 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); 351 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", "");
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&))); 352 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&)));
353
354
355
356 mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList");
357 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&)));
358 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
359
360
344} 361}
345 362
346ExternalAppHandler::~ExternalAppHandler() 363ExternalAppHandler::~ExternalAppHandler()
347{ 364{
348} 365}
349 366
367void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid,
368 const QStringList& nameList,
369 const QStringList& emailList,
370 const QStringList& uidList,
371 const QStringList&,
372 const QStringList&,
373 const QStringList& )
374{
375 // this method is a conevnient way to reduce the number of parameters I have to pass
376 emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList);
377}
378
379
350void ExternalAppHandler::loadConfig() 380void ExternalAppHandler::loadConfig()
351{ 381{
352 382
353 mDefaultItems.clear(); 383 mDefaultItems.clear();
354 mEmailAppAvailable = UNDEFINED; 384 mEmailAppAvailable = UNDEFINED;
355 mPhoneAppAvailable = UNDEFINED; 385 mPhoneAppAvailable = UNDEFINED;
356 mFaxAppAvailable = UNDEFINED; 386 mFaxAppAvailable = UNDEFINED;
357 mSMSAppAvailable = UNDEFINED; 387 mSMSAppAvailable = UNDEFINED;
358 mPagerAppAvailable = UNDEFINED; 388 mPagerAppAvailable = UNDEFINED;
359 mSIPAppAvailable = UNDEFINED; 389 mSIPAppAvailable = UNDEFINED;
360 390
361 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); 391 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
362 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); 392 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
363 393
364 if (opiepath.isEmpty()) 394 if (opiepath.isEmpty())
365 opiepath = qtopiapath; 395 opiepath = qtopiapath;
366 396
367 //mailclients 397 //mailclients
368 QString mailmsg1 = "writeMail(QString,QString)"; 398 QString mailmsg1 = "writeMail(QString,QString)";
369 QString mailmsg2 = "writeMail(QMap(QString,QString))"; 399 QString mailmsg2 = "writeMail(QMap(QString,QString))";
370 400
371 QString undefined = ""; 401 QString undefined = "";
372 402
373 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); 403 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined);
374 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); 404 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined);
375 405
376 if (( QFile::exists( qtopiapath + "/bin/ompi" )) || 406 if (( QFile::exists( qtopiapath + "/bin/ompi" )) ||
377 ( QFile::exists( opiepath + "/bin/ompi" ))) 407 ( QFile::exists( opiepath + "/bin/ompi" )))
378 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 408 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
379 409
380 if ( QFile::exists( qtopiapath + "/bin/qtmail" )) 410 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
381 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 411 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
382 412
383 if ( QFile::exists( opiepath + "/bin/opiemail" )) 413 if ( QFile::exists( opiepath + "/bin/opiemail" ))
384 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 414 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
385 415
386 416
387 417
388 //phoneclients 418 //phoneclients
389 419
390 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); 420 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined);
391 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); 421 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined);
392 if (( QFile::exists( qtopiapath + "/bin/kppi" )) || 422 if (( QFile::exists( qtopiapath + "/bin/kppi" )) ||
393 ( QFile::exists( opiepath + "/bin/kppi" ))) 423 ( QFile::exists( opiepath + "/bin/kppi" )))
394 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); 424 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined);
395 425
396 //faxclients 426 //faxclients
397 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); 427 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined);
398 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); 428 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined);
399 429
400 //smsclients 430 //smsclients
401 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined); 431 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::NONE_SMC, "No sms client installed", undefined, undefined, undefined, undefined, undefined);
402 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined); 432 addDefaultAppItem(ExternalAppHandler::SMS, KPimGlobalPrefs::OTHER_SMC, "Other sms client", undefined, undefined, undefined, undefined, undefined);
403 433
404 //pagerclients 434 //pagerclients
405 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined); 435 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::NONE_PAC, "No pager client installed", undefined, undefined, undefined, undefined, undefined);
406 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined); 436 addDefaultAppItem(ExternalAppHandler::PAGER, KPimGlobalPrefs::OTHER_PAC, "Other pager client", undefined, undefined, undefined, undefined, undefined);
407 437
408 //sipclients 438 //sipclients
409 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No sip client installed", undefined, undefined, undefined, undefined, undefined); 439 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::NONE_SIC, "No sip client installed", undefined, undefined, undefined, undefined, undefined);
410 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other sip client", undefined, undefined, undefined, undefined, undefined); 440 addDefaultAppItem(ExternalAppHandler::SIP, KPimGlobalPrefs::OTHER_SIC, "Other sip client", undefined, undefined, undefined, undefined, undefined);
411 441
412} 442}
413 443
414ExternalAppHandler *ExternalAppHandler::instance() 444ExternalAppHandler *ExternalAppHandler::instance()
415{ 445{
416 if ( !sInstance ) { 446 if ( !sInstance ) {
417 sInstance = staticDeleter.setObject( new ExternalAppHandler() ); 447 sInstance = staticDeleter.setObject( new ExternalAppHandler() );
418 sInstance->loadConfig(); 448 sInstance->loadConfig();
419 } 449 }
420 450
421 return sInstance; 451 return sInstance;
422} 452}
423 453
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) 454void ExternalAppHandler::addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameter, const QString& message2, const QString& parameter2)
425{ 455{
426 DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2); 456 DefaultAppItem* dai = new DefaultAppItem(type, id, label, channel, message, parameter, message2, parameter2);
427 // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() ); 457 // qDebug("%d %d %s %s ", type, id, label.latin1(), channel.latin1() );
428 mDefaultItems.append(dai); 458 mDefaultItems.append(dai);
429} 459}
430 460
431 461
432QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type) 462QList<DefaultAppItem> ExternalAppHandler::getAvailableDefaultItems(Types type)
433{ 463{
434 QList<DefaultAppItem> list; 464 QList<DefaultAppItem> list;
435 465
436 DefaultAppItem* dai; 466 DefaultAppItem* dai;
437 467
438 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) 468 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
439 { 469 {
440 if (dai->_type == type) 470 if (dai->_type == type)
441 list.append(dai); 471 list.append(dai);
442 } 472 }
443 473
444 return list; 474 return list;
445} 475}
446 476
447DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid) 477DefaultAppItem* ExternalAppHandler::getDefaultItem(Types type, int clientid)
448{ 478{
449 DefaultAppItem* dai; 479 DefaultAppItem* dai;
450 480
451 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() ) 481 for ( dai=mDefaultItems.first(); dai != 0; dai=mDefaultItems.next() )
452 { 482 {
453 if (dai->_type == type && dai->_id == clientid) 483 if (dai->_type == type && dai->_id == clientid)
454 return dai; 484 return dai;
455 } 485 }
456 486
457 return 0; 487 return 0;
458} 488}
459 489
460bool ExternalAppHandler::isEmailAppAvailable() 490bool ExternalAppHandler::isEmailAppAvailable()
461{ 491{
462#ifndef DESKTOP_VERSION 492#ifndef DESKTOP_VERSION
463 if (mEmailAppAvailable == UNDEFINED) 493 if (mEmailAppAvailable == UNDEFINED)
464 { 494 {
465 int client = KPimGlobalPrefs::instance()->mEmailClient; 495 int client = KPimGlobalPrefs::instance()->mEmailClient;
466 if (client == KPimGlobalPrefs::NONE_EMC) 496 if (client == KPimGlobalPrefs::NONE_EMC)
467 mEmailAppAvailable = UNAVAILABLE; 497 mEmailAppAvailable = UNAVAILABLE;
468 else 498 else
469 mEmailAppAvailable = AVAILABLE; 499 mEmailAppAvailable = AVAILABLE;
470 } 500 }
471 return (mEmailAppAvailable == AVAILABLE); 501 return (mEmailAppAvailable == AVAILABLE);
472 502
473#else //DESKTOP_VERSION 503#else //DESKTOP_VERSION
474 return false; 504 return false;
475#endif //DESKTOP_VERSION 505#endif //DESKTOP_VERSION
476} 506}
477 507
478bool ExternalAppHandler::isSMSAppAvailable() 508bool ExternalAppHandler::isSMSAppAvailable()
479{ 509{
480#ifndef DESKTOP_VERSION 510#ifndef DESKTOP_VERSION
481 if (mSMSAppAvailable == UNDEFINED) 511 if (mSMSAppAvailable == UNDEFINED)
482 { 512 {
483 int client = KPimGlobalPrefs::instance()->mSMSClient; 513 int client = KPimGlobalPrefs::instance()->mSMSClient;
484 if (client == KPimGlobalPrefs::NONE_SMC) 514 if (client == KPimGlobalPrefs::NONE_SMC)
485 mSMSAppAvailable = UNAVAILABLE; 515 mSMSAppAvailable = UNAVAILABLE;
486 else 516 else
487 mSMSAppAvailable = AVAILABLE; 517 mSMSAppAvailable = AVAILABLE;
488 } 518 }
489 519
490 return (mSMSAppAvailable == AVAILABLE); 520 return (mSMSAppAvailable == AVAILABLE);
491#else //DESKTOP_VERSION 521#else //DESKTOP_VERSION
492 return false; 522 return false;
493#endif //DESKTOP_VERSION 523#endif //DESKTOP_VERSION
494} 524}
495 525
496bool ExternalAppHandler::isPhoneAppAvailable() 526bool ExternalAppHandler::isPhoneAppAvailable()
497{ 527{
498#ifndef DESKTOP_VERSION 528#ifndef DESKTOP_VERSION
499 if (mPhoneAppAvailable == UNDEFINED) 529 if (mPhoneAppAvailable == UNDEFINED)
500 { 530 {
501 int client = KPimGlobalPrefs::instance()->mPhoneClient; 531 int client = KPimGlobalPrefs::instance()->mPhoneClient;
502 if (client == KPimGlobalPrefs::NONE_PHC) 532 if (client == KPimGlobalPrefs::NONE_PHC)
503 mPhoneAppAvailable = UNAVAILABLE; 533 mPhoneAppAvailable = UNAVAILABLE;
504 else 534 else
505 mPhoneAppAvailable = AVAILABLE; 535 mPhoneAppAvailable = AVAILABLE;
506 } 536 }
507 537
508 return (mPhoneAppAvailable == AVAILABLE); 538 return (mPhoneAppAvailable == AVAILABLE);
509#else //DESKTOP_VERSION 539#else //DESKTOP_VERSION
510 return false; 540 return false;
511#endif //DESKTOP_VERSION 541#endif //DESKTOP_VERSION
512} 542}
513 543
514bool ExternalAppHandler::isFaxAppAvailable() 544bool ExternalAppHandler::isFaxAppAvailable()
515{ 545{
516#ifndef DESKTOP_VERSION 546#ifndef DESKTOP_VERSION
517 if (mFaxAppAvailable == UNDEFINED) 547 if (mFaxAppAvailable == UNDEFINED)
518 { 548 {
519 int client = KPimGlobalPrefs::instance()->mFaxClient; 549 int client = KPimGlobalPrefs::instance()->mFaxClient;
520 if (client == KPimGlobalPrefs::NONE_FAC) 550 if (client == KPimGlobalPrefs::NONE_FAC)
521 mFaxAppAvailable = UNAVAILABLE; 551 mFaxAppAvailable = UNAVAILABLE;
522 else 552 else
523 mFaxAppAvailable = AVAILABLE; 553 mFaxAppAvailable = AVAILABLE;
524 } 554 }
525 555
526 return (mFaxAppAvailable == AVAILABLE); 556 return (mFaxAppAvailable == AVAILABLE);
527#else //DESKTOP_VERSION 557#else //DESKTOP_VERSION
528 return false; 558 return false;
529#endif //DESKTOP_VERSION 559#endif //DESKTOP_VERSION
530} 560}
531 561
532bool ExternalAppHandler::isPagerAppAvailable() 562bool ExternalAppHandler::isPagerAppAvailable()
533{ 563{
534#ifndef DESKTOP_VERSION 564#ifndef DESKTOP_VERSION
535 if (mPagerAppAvailable == UNDEFINED) 565 if (mPagerAppAvailable == UNDEFINED)
536 { 566 {
537 int client = KPimGlobalPrefs::instance()->mPagerClient; 567 int client = KPimGlobalPrefs::instance()->mPagerClient;
538 if (client == KPimGlobalPrefs::NONE_PAC) 568 if (client == KPimGlobalPrefs::NONE_PAC)
539 mPagerAppAvailable = UNAVAILABLE; 569 mPagerAppAvailable = UNAVAILABLE;
540 else 570 else
541 mPagerAppAvailable = AVAILABLE; 571 mPagerAppAvailable = AVAILABLE;
542 } 572 }
543 573
544 return (mPagerAppAvailable == AVAILABLE); 574 return (mPagerAppAvailable == AVAILABLE);
545#else //DESKTOP_VERSION 575#else //DESKTOP_VERSION
546 return false; 576 return false;
547#endif //DESKTOP_VERSION 577#endif //DESKTOP_VERSION
548} 578}
549 579
550 580
551bool ExternalAppHandler::isSIPAppAvailable() 581bool ExternalAppHandler::isSIPAppAvailable()
552{ 582{
553#ifndef DESKTOP_VERSION 583#ifndef DESKTOP_VERSION
554 if (mSIPAppAvailable == UNDEFINED) 584 if (mSIPAppAvailable == UNDEFINED)
555 { 585 {
556 int client = KPimGlobalPrefs::instance()->mSipClient; 586 int client = KPimGlobalPrefs::instance()->mSipClient;
557 if (client == KPimGlobalPrefs::NONE_SIC) 587 if (client == KPimGlobalPrefs::NONE_SIC)
558 mSIPAppAvailable = UNAVAILABLE; 588 mSIPAppAvailable = UNAVAILABLE;
559 else 589 else
560 mSIPAppAvailable = AVAILABLE; 590 mSIPAppAvailable = AVAILABLE;
561 } 591 }
562 592
563 return (mSIPAppAvailable == AVAILABLE); 593 return (mSIPAppAvailable == AVAILABLE);
564#else //DESKTOP_VERSION 594#else //DESKTOP_VERSION
565 return false; 595 return false;
566#endif //DESKTOP_VERSION 596#endif //DESKTOP_VERSION
567} 597}
568 598
569/************************************************************************** 599/**************************************************************************
570 * 600 *
571 **************************************************************************/ 601 **************************************************************************/
572 602
573 603
574//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma) 604//calls the emailapplication with a number of attachments that need to be send (Seperated by Comma)
575bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls ) 605bool ExternalAppHandler::mailToMultipleContacts( const QString& emails, const QString& urls )
576{ 606{
577 607
578#ifndef DESKTOP_VERSION 608#ifndef DESKTOP_VERSION
579 QString channel; 609 QString channel;
580 QString message2; 610 QString message2;
581 QString parameters2; 611 QString parameters2;
582 612
583 613
584 int client = KPimGlobalPrefs::instance()->mEmailClient; 614 int client = KPimGlobalPrefs::instance()->mEmailClient;
585 if (client == KPimGlobalPrefs::OTHER_EMC) 615 if (client == KPimGlobalPrefs::OTHER_EMC)
586 { 616 {
587 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; 617 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
588 message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage; 618 message2 = KPimGlobalPrefs::instance()->mEmailOtherMessage;
589 parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; 619 parameters2 = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
590 } 620 }
591 else 621 else
592 { 622 {
593 DefaultAppItem* dai = getDefaultItem(EMAIL, client); 623 DefaultAppItem* dai = getDefaultItem(EMAIL, client);
594 if (!dai) 624 if (!dai)
595 { 625 {
596 qDebug("could not find configured email application."); 626 qDebug("could not find configured email application.");
597 return false; 627 return false;
598 } 628 }
599 channel = dai->_channel; 629 channel = dai->_channel;
600 message2 = dai->_message2; 630 message2 = dai->_message2;
601 parameters2 = dai->_parameters2; 631 parameters2 = dai->_parameters2;
602 } 632 }
603 633
604 //first check if one of the mailers need the emails right in the message. 634 //first check if one of the mailers need the emails right in the message.
605 message2 = translateMessage(message2, emails, urls); 635 message2 = translateMessage(message2, emails, urls);
606 636
607 637
608 qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1()); 638 qDebug("4Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message2.latin1());
609 qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1()); 639 qDebug("passing emailadresses(%s), attachmenturls(%s) as parameters in the form %s to QCopEnvelope", emails.latin1() , urls.latin1(), parameters2.latin1());
610 640
611 641
612 QCopEnvelope e(channel.latin1(), message2.latin1()); 642 QCopEnvelope e(channel.latin1(), message2.latin1());
613 //US we need no names in the To field. The emailadresses are enough 643 //US we need no names in the To field. The emailadresses are enough
614 644
615 passParameters(&e, parameters2, emails, urls); 645 passParameters(&e, parameters2, emails, urls);
616 646
617 647
618 648
619#else 649#else
620 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); 650 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
621#endif 651#endif
622 652
623 return true; 653 return true;
624} 654}
625 655
626/************************************************************************** 656/**************************************************************************
627 * 657 *
628 **************************************************************************/ 658 **************************************************************************/
629 659
630 660
631//calls the emailapplication and creates a mail with parameter emails as recipients 661//calls the emailapplication and creates a mail with parameter emails as recipients
632bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress ) 662bool ExternalAppHandler::mailToOneContact( const QString& name, const QString& emailadress )
633{ 663{
634#ifndef DESKTOP_VERSION 664#ifndef DESKTOP_VERSION
635 QString channel; 665 QString channel;
636 QString message; 666 QString message;
637 QString parameters; 667 QString parameters;
638 668
639 669
640 int client = KPimGlobalPrefs::instance()->mEmailClient; 670 int client = KPimGlobalPrefs::instance()->mEmailClient;
641 if (client == KPimGlobalPrefs::OTHER_EMC) 671 if (client == KPimGlobalPrefs::OTHER_EMC)
642 { 672 {
643 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel; 673 channel = KPimGlobalPrefs::instance()->mEmailOtherChannel;
644 message = KPimGlobalPrefs::instance()->mEmailOtherMessage; 674 message = KPimGlobalPrefs::instance()->mEmailOtherMessage;
645 parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters; 675 parameters = KPimGlobalPrefs::instance()->mEmailOtherMessageParameters;
646 } 676 }
647 else 677 else
648 { 678 {
649 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client); 679 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(EMAIL, client);
650 if (!dai) 680 if (!dai)
651 { 681 {
652 qDebug("could not find configured email application."); 682 qDebug("could not find configured email application.");
653 return false; 683 return false;
654 } 684 }
655 channel = dai->_channel; 685 channel = dai->_channel;
656 message = dai->_message; 686 message = dai->_message;
657 parameters = dai->_parameters; 687 parameters = dai->_parameters;
658 } 688 }
659 689
660 690
661 //first check if one of the mailers need the emails right in the message. 691 //first check if one of the mailers need the emails right in the message.
662 message = translateMessage(message, name, emailadress); 692 message = translateMessage(message, name, emailadress);
663 693
664 694
665 qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 695 qDebug("5Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
666 qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1()); 696 qDebug("passing name(%s), emailadresses(%s) as parameters in the form %s to QCopEnvelope", name.latin1(), emailadress.latin1(), parameters.latin1());
667 697
668 QCopEnvelope e(channel.latin1(), message.latin1()); 698 QCopEnvelope e(channel.latin1(), message.latin1());
669 //US we need no names in the To field. The emailadresses are enough 699 //US we need no names in the To field. The emailadresses are enough
670 700
671 passParameters(&e, parameters, name, emailadress); 701 passParameters(&e, parameters, name, emailadress);
672 702
673 703
674#else 704#else
675 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) ); 705 KMessageBox::sorry( 0, i18n( "This version does not support the sending of emails." ) );
676#endif 706#endif
677 707
678 708
679 return true; 709 return true;
680} 710}
681 711
682/************************************************************************** 712/**************************************************************************
683 * 713 *
684 **************************************************************************/ 714 **************************************************************************/
685 715
686//calls the emailapplication and creates a mail with parameter as recipients 716//calls the emailapplication and creates a mail with parameter as recipients
687// parameters format is 717// parameters format is
688// NAME <EMAIL>:SUBJECT 718// NAME <EMAIL>:SUBJECT
689bool ExternalAppHandler::mailToOneContact( const QString& adressline ) 719bool ExternalAppHandler::mailToOneContact( const QString& adressline )
690{ 720{
691 QString line = adressline; 721 QString line = adressline;
692 722
693 int first = line.find( "<"); 723 int first = line.find( "<");
694 int last = line.find( ">"); 724 int last = line.find( ">");
695 QString name = line.left(first); 725 QString name = line.left(first);
696 QString emailadress = line.mid(first+1, last-first-1); 726 QString emailadress = line.mid(first+1, last-first-1);
697 727
698 //Subject can not be handled right now. 728 //Subject can not be handled right now.
699 return mailToOneContact( name, emailadress ); 729 return mailToOneContact( name, emailadress );
700 730
701} 731}
702 732
703 733
704/************************************************************************** 734/**************************************************************************
705 * 735 *
706 **************************************************************************/ 736 **************************************************************************/
707 737
708//calls the phoneapplication with the number 738//calls the phoneapplication with the number
709bool ExternalAppHandler::callByPhone( const QString& phonenumber ) 739bool ExternalAppHandler::callByPhone( const QString& phonenumber )
710{ 740{
711#ifndef DESKTOP_VERSION 741#ifndef DESKTOP_VERSION
712 QString channel; 742 QString channel;
713 QString message; 743 QString message;
714 QString parameters; 744 QString parameters;
715 745
716 746
717 int client = KPimGlobalPrefs::instance()->mPhoneClient; 747 int client = KPimGlobalPrefs::instance()->mPhoneClient;
718 if (client == KPimGlobalPrefs::OTHER_PHC) 748 if (client == KPimGlobalPrefs::OTHER_PHC)
719 { 749 {
720 channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel; 750 channel = KPimGlobalPrefs::instance()->mPhoneOtherChannel;
721 message = KPimGlobalPrefs::instance()->mPhoneOtherMessage; 751 message = KPimGlobalPrefs::instance()->mPhoneOtherMessage;
722 parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters; 752 parameters = KPimGlobalPrefs::instance()->mPhoneOtherMessageParameters;
723 } 753 }
724 else 754 else
725 { 755 {
726 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client); 756 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PHONE, client);
727 if (!dai) 757 if (!dai)
728 { 758 {
729 qDebug("could not find configured phone application."); 759 qDebug("could not find configured phone application.");
730 return false; 760 return false;
731 } 761 }
732 channel = dai->_channel; 762 channel = dai->_channel;
733 message = dai->_message; 763 message = dai->_message;
734 parameters = dai->_parameters; 764 parameters = dai->_parameters;
735 } 765 }
736 766
737 767
738 //first check if one of the mailers need the emails right in the message. 768 //first check if one of the mailers need the emails right in the message.
739 message = translateMessage(message, phonenumber, ""); 769 message = translateMessage(message, phonenumber, "");
740 770
741 771
742 qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 772 qDebug("6Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
743 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); 773 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
744 774
745 QCopEnvelope e(channel.latin1(), message.latin1()); 775 QCopEnvelope e(channel.latin1(), message.latin1());
746 //US we need no names in the To field. The emailadresses are enough 776 //US we need no names in the To field. The emailadresses are enough
747 777
748 passParameters(&e, parameters, phonenumber, ""); 778 passParameters(&e, parameters, phonenumber, "");
749 779
750 780
751#else 781#else
752 KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) ); 782 KMessageBox::sorry( 0, i18n( "This version does not support phonecalls." ) );
753#endif 783#endif
754 784
755 785
756 return true; 786 return true;
757} 787}
758 788
759/************************************************************************** 789/**************************************************************************
760 * 790 *
761 **************************************************************************/ 791 **************************************************************************/
762 792
763//calls the smsapplication with the number 793//calls the smsapplication with the number
764bool ExternalAppHandler::callBySMS( const QString& phonenumber ) 794bool ExternalAppHandler::callBySMS( const QString& phonenumber )
765{ 795{
766#ifndef DESKTOP_VERSION 796#ifndef DESKTOP_VERSION
767 QString channel; 797 QString channel;
768 QString message; 798 QString message;
769 QString parameters; 799 QString parameters;
770 800
771 801
772 int client = KPimGlobalPrefs::instance()->mSMSClient; 802 int client = KPimGlobalPrefs::instance()->mSMSClient;
773 if (client == KPimGlobalPrefs::OTHER_SMC) 803 if (client == KPimGlobalPrefs::OTHER_SMC)
774 { 804 {
775 channel = KPimGlobalPrefs::instance()->mSMSOtherChannel; 805 channel = KPimGlobalPrefs::instance()->mSMSOtherChannel;
776 message = KPimGlobalPrefs::instance()->mSMSOtherMessage; 806 message = KPimGlobalPrefs::instance()->mSMSOtherMessage;
777 parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters; 807 parameters = KPimGlobalPrefs::instance()->mSMSOtherMessageParameters;
778 } 808 }
779 else 809 else
780 { 810 {
781 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client); 811 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SMS, client);
782 if (!dai) 812 if (!dai)
783 { 813 {
784 qDebug("could not find configured sms application."); 814 qDebug("could not find configured sms application.");
785 return false; 815 return false;
786 } 816 }
787 channel = dai->_channel; 817 channel = dai->_channel;
788 message = dai->_message; 818 message = dai->_message;
789 parameters = dai->_parameters; 819 parameters = dai->_parameters;
790 } 820 }
791 821
792 822
793 //first check if one of the mailers need the emails right in the message. 823 //first check if one of the mailers need the emails right in the message.
794 message = translateMessage(message, phonenumber, ""); 824 message = translateMessage(message, phonenumber, "");
795 825
796 826
797 qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 827 qDebug("7Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
798 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1()); 828 qDebug("passing phonenumber(%s) as parameter in the form %s to QCopEnvelope", phonenumber.latin1(), parameters.latin1());
799 829
800 QCopEnvelope e(channel.latin1(), message.latin1()); 830 QCopEnvelope e(channel.latin1(), message.latin1());
801 //US we need no names in the To field. The emailadresses are enough 831 //US we need no names in the To field. The emailadresses are enough
802 832
803 passParameters(&e, parameters, phonenumber, ""); 833 passParameters(&e, parameters, phonenumber, "");
804 834
805 835
806#else 836#else
807 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) ); 837 KMessageBox::sorry( 0, i18n( "This version does not support the sending of sms." ) );
808#endif 838#endif
809 839
810 840
811 return true; 841 return true;
812} 842}
813 843
814/************************************************************************** 844/**************************************************************************
815 * 845 *
816 **************************************************************************/ 846 **************************************************************************/
817 847
818//calls the pagerapplication with the number 848//calls the pagerapplication with the number
819bool ExternalAppHandler::callByPager( const QString& pagernumber ) 849bool ExternalAppHandler::callByPager( const QString& pagernumber )
820{ 850{
821#ifndef DESKTOP_VERSION 851#ifndef DESKTOP_VERSION
822 QString channel; 852 QString channel;
823 QString message; 853 QString message;
824 QString parameters; 854 QString parameters;
825 855
826 856
827 int client = KPimGlobalPrefs::instance()->mPagerClient; 857 int client = KPimGlobalPrefs::instance()->mPagerClient;
828 if (client == KPimGlobalPrefs::OTHER_PAC) 858 if (client == KPimGlobalPrefs::OTHER_PAC)
829 { 859 {
830 channel = KPimGlobalPrefs::instance()->mPagerOtherChannel; 860 channel = KPimGlobalPrefs::instance()->mPagerOtherChannel;
831 message = KPimGlobalPrefs::instance()->mPagerOtherMessage; 861 message = KPimGlobalPrefs::instance()->mPagerOtherMessage;
832 parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters; 862 parameters = KPimGlobalPrefs::instance()->mPagerOtherMessageParameters;
833 } 863 }
834 else 864 else
835 { 865 {
836 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client); 866 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(PAGER, client);
837 if (!dai) 867 if (!dai)
838 { 868 {
839 qDebug("could not find configured pager application."); 869 qDebug("could not find configured pager application.");
840 return false; 870 return false;
841 } 871 }
842 channel = dai->_channel; 872 channel = dai->_channel;
843 message = dai->_message; 873 message = dai->_message;
844 parameters = dai->_parameters; 874 parameters = dai->_parameters;
845 } 875 }
846 876
847 877
848 //first check if one of the mailers need the emails right in the message. 878 //first check if one of the mailers need the emails right in the message.
849 message = translateMessage(message, pagernumber, ""); 879 message = translateMessage(message, pagernumber, "");
850 880
851 881
852 qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 882 qDebug("8Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
853 qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1()); 883 qDebug("passing pagernumber(%s) as parameter in the form %s to QCopEnvelope", pagernumber.latin1(), parameters.latin1());
854 884
855 QCopEnvelope e(channel.latin1(), message.latin1()); 885 QCopEnvelope e(channel.latin1(), message.latin1());
856 //US we need no names in the To field. The emailadresses are enough 886 //US we need no names in the To field. The emailadresses are enough
857 887
858 passParameters(&e, parameters, pagernumber, ""); 888 passParameters(&e, parameters, pagernumber, "");
859 889
860 890
861#else 891#else
862 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) ); 892 KMessageBox::sorry( 0, i18n( "This version does not support paging." ) );
863#endif 893#endif
864 894
865 895
866 return true; 896 return true;
867} 897}
868 898
869/************************************************************************** 899/**************************************************************************
870 * 900 *
871 **************************************************************************/ 901 **************************************************************************/
872 902
873//calls the faxapplication with the number 903//calls the faxapplication with the number
874bool ExternalAppHandler::callByFax( const QString& faxnumber ) 904bool ExternalAppHandler::callByFax( const QString& faxnumber )
875{ 905{
876#ifndef DESKTOP_VERSION 906#ifndef DESKTOP_VERSION
877 QString channel; 907 QString channel;
878 QString message; 908 QString message;
879 QString parameters; 909 QString parameters;
880 910
881 911
882 int client = KPimGlobalPrefs::instance()->mFaxClient; 912 int client = KPimGlobalPrefs::instance()->mFaxClient;
883 if (client == KPimGlobalPrefs::OTHER_FAC) 913 if (client == KPimGlobalPrefs::OTHER_FAC)
884 { 914 {
885 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel; 915 channel = KPimGlobalPrefs::instance()->mFaxOtherChannel;
886 message = KPimGlobalPrefs::instance()->mFaxOtherMessage; 916 message = KPimGlobalPrefs::instance()->mFaxOtherMessage;
887 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters; 917 parameters = KPimGlobalPrefs::instance()->mFaxOtherMessageParameters;
888 } 918 }
889 else 919 else
890 { 920 {
891 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client); 921 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(FAX, client);
892 if (!dai) 922 if (!dai)
893 { 923 {
894 qDebug("could not find configured fax application."); 924 qDebug("could not find configured fax application.");
895 return false; 925 return false;
896 } 926 }
897 channel = dai->_channel; 927 channel = dai->_channel;
898 message = dai->_message; 928 message = dai->_message;
899 parameters = dai->_parameters; 929 parameters = dai->_parameters;
900 } 930 }
901 931
902 932
903 //first check if one of the mailers need the emails right in the message. 933 //first check if one of the mailers need the emails right in the message.
904 message = translateMessage(message, faxnumber, ""); 934 message = translateMessage(message, faxnumber, "");
905 935
906 936
907 qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 937 qDebug("9Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
908 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1()); 938 qDebug("passing faxnumber(%s) as parameter in the form %s to QCopEnvelope", faxnumber.latin1(), parameters.latin1());
909 939
910 QCopEnvelope e(channel.latin1(), message.latin1()); 940 QCopEnvelope e(channel.latin1(), message.latin1());
911 //US we need no names in the To field. The emailadresses are enough 941 //US we need no names in the To field. The emailadresses are enough
912 942
913 passParameters(&e, parameters, faxnumber, ""); 943 passParameters(&e, parameters, faxnumber, "");
914 944
915 945
916#else 946#else
917 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) ); 947 KMessageBox::sorry( 0, i18n( "This version does not support the sending of faxes." ) );
918#endif 948#endif
919 949
920 950
921 return true; 951 return true;
922} 952}
923 953
924/************************************************************************** 954/**************************************************************************
925 * 955 *
926 **************************************************************************/ 956 **************************************************************************/
927 957
928//calls the sipapplication with the number 958//calls the sipapplication with the number
929bool ExternalAppHandler::callBySIP( const QString& sipnumber ) 959bool ExternalAppHandler::callBySIP( const QString& sipnumber )
930{ 960{
931#ifndef DESKTOP_VERSION 961#ifndef DESKTOP_VERSION
932 QString channel; 962 QString channel;
933 QString message; 963 QString message;
934 QString parameters; 964 QString parameters;
935 965
936 966
937 int client = KPimGlobalPrefs::instance()->mSipClient; 967 int client = KPimGlobalPrefs::instance()->mSipClient;
938 if (client == KPimGlobalPrefs::OTHER_SIC) 968 if (client == KPimGlobalPrefs::OTHER_SIC)
939 { 969 {
940 channel = KPimGlobalPrefs::instance()->mSipOtherChannel; 970 channel = KPimGlobalPrefs::instance()->mSipOtherChannel;
941 message = KPimGlobalPrefs::instance()->mSipOtherMessage; 971 message = KPimGlobalPrefs::instance()->mSipOtherMessage;
942 parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters; 972 parameters = KPimGlobalPrefs::instance()->mSipOtherMessageParameters;
943 } 973 }
944 else 974 else
945 { 975 {
946 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client); 976 DefaultAppItem* dai = ExternalAppHandler::getDefaultItem(SIP, client);
947 if (!dai) 977 if (!dai)
948 { 978 {
949 qDebug("could not find configured sip application."); 979 qDebug("could not find configured sip application.");
950 return false; 980 return false;
951 } 981 }
952 channel = dai->_channel; 982 channel = dai->_channel;
953 message = dai->_message; 983 message = dai->_message;
954 parameters = dai->_parameters; 984 parameters = dai->_parameters;
955 } 985 }
956 986
957 987
958 //first check if one of the sip apps need the emails right in the message. 988 //first check if one of the sip apps need the emails right in the message.
959 message = translateMessage(message, sipnumber, ""); 989 message = translateMessage(message, sipnumber, "");
960 990
961 991
962 qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1()); 992 qDebug("10Using QCopEnvelope e(\"%s\",\"%s\")", channel.latin1(), message.latin1());
963 qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1()); 993 qDebug("passing sipnumber(%s) as parameter in the form %s to QCopEnvelope", sipnumber.latin1(), parameters.latin1());
964 994
965 QCopEnvelope e(channel.latin1(), message.latin1()); 995 QCopEnvelope e(channel.latin1(), message.latin1());
966 //US we need no names in the To field. The emailadresses are enough 996 //US we need no names in the To field. The emailadresses are enough
967 997
968 passParameters(&e, parameters, sipnumber, ""); 998 passParameters(&e, parameters, sipnumber, "");
969 999
970 1000
971#else 1001#else
972 KMessageBox::sorry( 0, i18n( "This version does not support sip." ) ); 1002 KMessageBox::sorry( 0, i18n( "This version does not support sip." ) );
973#endif 1003#endif
974 1004
975 1005
976 return true; 1006 return true;
977} 1007}
978 1008
979 1009
980/************************************************************************** 1010/**************************************************************************
981 * 1011 *
982 **************************************************************************/ 1012 **************************************************************************/
983 1013
984 1014
985QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const 1015QString& ExternalAppHandler::translateMessage(QString& message, const QString& param1, const QString& param2 ) const
986{ 1016{
987 message = message.replace( QRegExp("%1"), param1 ); 1017 message = message.replace( QRegExp("%1"), param1 );
988 return message.replace( QRegExp("%2"), param2 ); 1018 return message.replace( QRegExp("%2"), param2 );
989} 1019}
990 1020
991/************************************************************************** 1021/**************************************************************************
992 * 1022 *
993 **************************************************************************/ 1023 **************************************************************************/
994 1024
995void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const 1025void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1 , const QString& param2) const
996{ 1026{
997#ifndef DESKTOP_VERSION 1027#ifndef DESKTOP_VERSION
998 QMap<QString, QString> valmap; 1028 QMap<QString, QString> valmap;
999 bool useValMap = false; 1029 bool useValMap = false;
1000 1030
1001 // first extract all parts of the parameters. 1031 // first extract all parts of the parameters.
1002 QStringList paramlist = QStringList::split(";", parameters); 1032 QStringList paramlist = QStringList::split(";", parameters);
1003 1033
1004 //Now check how many parts we have. 1034 //Now check how many parts we have.
1005 //=0 :no params to pass 1035 //=0 :no params to pass
1006 //>0 :parameters to pass 1036 //>0 :parameters to pass
1007 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) 1037 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it )
1008 { 1038 {
1009 QString param = (*it); 1039 QString param = (*it);
1010 QStringList keyvallist = QStringList::split("=", param); 1040 QStringList keyvallist = QStringList::split("=", param);
1011 1041
1012 //if we have keyvalue pairs, we assume that we pass a map to the envelope 1042 //if we have keyvalue pairs, we assume that we pass a map to the envelope
1013 QStringList::Iterator it2 = keyvallist.begin(); 1043 QStringList::Iterator it2 = keyvallist.begin();
1014 QString key = (*it2); 1044 QString key = (*it2);
1015 key = key.replace( QRegExp("%1"), param1 ); 1045 key = key.replace( QRegExp("%1"), param1 );
1016 key = key.replace( QRegExp("%2"), param2 ); 1046 key = key.replace( QRegExp("%2"), param2 );
1017 ++it2; 1047 ++it2;
1018 1048
1019 if(it2 != keyvallist.end()) 1049 if(it2 != keyvallist.end())
1020 { 1050 {
1021 QString value = (*it2); 1051 QString value = (*it2);
1022 value = value.replace( QRegExp("%1"), param1 ); 1052 value = value.replace( QRegExp("%1"), param1 );
1023 value = value.replace( QRegExp("%2"), param2 ); 1053 value = value.replace( QRegExp("%2"), param2 );
1024 1054
1025 valmap.insert(key, value); 1055 valmap.insert(key, value);
1026 useValMap = true; 1056 useValMap = true;
1027 } 1057 }
1028 else 1058 else
1029 { 1059 {
1030 // qDebug("pass parameter << %s", key.latin1()); 1060 // qDebug("pass parameter << %s", key.latin1());
1031 (*e) << key; 1061 (*e) << key;
1032 } 1062 }
1033 } 1063 }
1034 1064
1035 if (useValMap == true) 1065 if (useValMap == true)
1036 (*e) << valmap; 1066 (*e) << valmap;
1037 1067
1038#endif 1068#endif
1039 1069
1040} 1070}
1041 1071
1042 1072
1043 1073
1044/************************************************************************** 1074/**************************************************************************
1045 * 1075 *
1046 **************************************************************************/ 1076 **************************************************************************/
1047 1077
1048void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) 1078void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data )
1049{ 1079{
1050 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1080 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1051 if (!res) 1081 if (!res)
1082 res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data );
1083
1084 if (!res)
1052 res = mDisplayDetails->appMessage( cmsg, data ); 1085 res = mDisplayDetails->appMessage( cmsg, data );
1053 1086
1054// if (!res) 1087// if (!res)
1055// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1088// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1056} 1089}
1057 1090
1058 1091
1059 1092
1060bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1093bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
1061{ 1094{
1062 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1095 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1063 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); 1096 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid);
1064} 1097}
1065 1098
1066bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1099bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1067{ 1100{
1068 1101 QStringList list4, list5, list6;
1102
1069 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1103 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1070 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); 1104 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1071} 1105}
1072 1106
1073bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) 1107bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email)
1074{ 1108{
1075 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1109 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1076 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); 1110 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email);
1077} 1111}
1078 1112
1079bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1113bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1080{ 1114{
1115 QStringList list4, list5, list6;
1116
1081 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1117 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1082 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3); 1118 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1083} 1119}
1084 1120
1085bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid) 1121bool ExternalAppHandler::requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid)
1086{ 1122{
1087 mDisplayDetails->setSourceChannel(""); 1123 mDisplayDetails->setSourceChannel("");
1088 return mDisplayDetails->sendMessageToTarget("", name, email, uid); 1124 return mDisplayDetails->sendMessageToTarget("", name, email, uid);
1089} 1125}
1090 1126
1127bool ExternalAppHandler::requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
1128{
1129 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel);
1130 return mBirthdayListFromKAPITransfer->sendMessageToTarget(sessionuid);
1131}
1132
1133bool ExternalAppHandler::returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6)
1134{
1135 mBirthdayListFromKAPITransfer->setSourceChannel(sourceChannel);
1136 return mBirthdayListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1137}
1138
1091 1139
1092 1140
1093 1141
1094 1142