summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/externalapphandler.cpp12
-rw-r--r--libkdepim/externalapphandler.h2
-rw-r--r--libkdepim/kpimglobalprefs.cpp3
3 files changed, 12 insertions, 5 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 779b20e..9085673 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -1,128 +1,128 @@
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//uncomment line to get debug output 51//uncomment line to get debug output
52//#define DEBUG_EXT_APP_HANDLER 52//#define DEBUG_EXT_APP_HANDLER
53 53
54/********************************************************************************* 54/*********************************************************************************
55 * 55 *
56 ********************************************************************************/ 56 ********************************************************************************/
57 57
58 58
59QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 59QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
60 : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) 60 : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage)
61{ 61{
62 //sourceMessage passes later three parameters: sourceChannel, uid, param1 62 //sourceMessage passes later three parameters: sourceChannel, uid, param1
63 if (_usedSourceParameters == 0) 63 if (_usedSourceParameters == 0)
64 _sourceMessageParameters = "(QString,QString)"; 64 _sourceMessageParameters = "QString,QString)";
65 else if (_usedSourceParameters == 1) 65 else if (_usedSourceParameters == 1)
66 _sourceMessageParameters = "(QString,QString,QString)"; 66 _sourceMessageParameters = "(QString,QString,QString)";
67 else if (_usedSourceParameters == 2) 67 else if (_usedSourceParameters == 2)
68 _sourceMessageParameters = "(QString,QString,QString,QString)"; 68 _sourceMessageParameters = "(QString,QString,QString,QString)";
69 else if (_usedSourceParameters == 3) 69 else if (_usedSourceParameters == 3)
70 _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; 70 _sourceMessageParameters = "(QString,QString,QString,QString,QString)";
71} 71}
72 72
73/*********************************************************************************/ 73/*********************************************************************************/
74 74
75QCopTransferItem::QCopTransferItem() 75QCopTransferItem::QCopTransferItem()
76{ 76{
77} 77}
78 78
79/*********************************************************************************/ 79/*********************************************************************************/
80bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) 80bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3)
81{ 81{
82 82
83#ifndef DESKTOP_VERSION 83#ifndef DESKTOP_VERSION
84 //sourceMessage passes two parameters: sourceChannel, uid 84 //sourceMessage passes two parameters: sourceChannel, uid
85 QString sourceMessage = _sourceMessage + _sourceMessageParameters; 85 QString sourceMessage = _sourceMessage + _sourceMessageParameters;
86#ifdef DEBUG_EXT_APP_HANDLER 86#ifdef DEBUG_EXT_APP_HANDLER
87 qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); 87 qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1());
88 qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); 88 qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1());
89#endif 89#endif
90 90
91 QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); 91 QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1());
92 92
93 e << _sourceChannel << uid; 93 e << _sourceChannel << uid;
94 94
95 if (_usedSourceParameters == 1) 95 if (_usedSourceParameters == 1)
96 e << param1; 96 e << param1;
97 else if (_usedSourceParameters == 2) 97 else if (_usedSourceParameters == 2)
98 e << param1 << param2; 98 e << param1 << param2;
99 else if (_usedSourceParameters == 3) 99 else if (_usedSourceParameters == 3)
100 e << param1 << param2 << param3; 100 e << param1 << param2 << param3;
101 101
102 qApp->processEvents(); 102 qApp->processEvents();
103 103
104 return true; 104 return true;
105 105
106#else 106#else
107 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 107 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
108 return false; 108 return false;
109#endif 109#endif
110 110
111} 111}
112 112
113 113
114/*********************************************************************************/ 114/*********************************************************************************/
115void QCopTransferItem::setSourceChannel(const QString& sourceChannel) 115void QCopTransferItem::setSourceChannel(const QString& sourceChannel)
116{ 116{
117 117
118 if ( !sourceChannel.isEmpty()) 118 if ( !sourceChannel.isEmpty())
119 _sourceChannel = sourceChannel; 119 _sourceChannel = sourceChannel;
120} 120}
121 121
122 122
123/*********************************************************************************/ 123/*********************************************************************************/
124bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 124bool QCopTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
125{ 125{
126 126
127 // copied from old mail2 127 // copied from old mail2
128/* 128/*
@@ -196,247 +196,255 @@ QCopMapTransferItem::QCopMapTransferItem(int usedSourceParameters, const QString
196 196
197/*********************************************************************************/ 197/*********************************************************************************/
198bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap) 198bool QCopMapTransferItem::sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap)
199{ 199{
200#ifndef DESKTOP_VERSION 200#ifndef DESKTOP_VERSION
201 //targetMessage passes two parameters: uid, map 201 //targetMessage passes two parameters: uid, map
202 QString targetMessage = _targetMessage + _targetMessageParameters; 202 QString targetMessage = _targetMessage + _targetMessageParameters;
203 203
204#ifdef DEBUG_EXT_APP_HANDLER 204#ifdef DEBUG_EXT_APP_HANDLER
205 qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); 205 qDebug("2Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
206 qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1()); 206 qDebug("passing uid(%s) and map as parameter to QCopEnvelope", uid.latin1());
207#endif 207#endif
208 208
209 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); 209 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
210 //US we need no names in the To field. The emailadresses are enough 210 //US we need no names in the To field. The emailadresses are enough
211 211
212 e << uid << nameEmailMap; 212 e << uid << nameEmailMap;
213 213
214 qApp->processEvents(); 214 qApp->processEvents();
215 215
216 return true; 216 return true;
217 217
218#else 218#else
219 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 219 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
220 return false; 220 return false;
221#endif 221#endif
222 222
223} 223}
224 224
225 225
226/*********************************************************************************/ 226/*********************************************************************************/
227bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 227bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
228{ 228{
229 bool res = QCopTransferItem::appMessage( cmsg, data ); 229 bool res = QCopTransferItem::appMessage( cmsg, data );
230 230
231 if (res == false) 231 if (res == false)
232 { 232 {
233 QDataStream stream( data, IO_ReadOnly ); 233 QDataStream stream( data, IO_ReadOnly );
234 234
235// qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); 235// qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() );
236 236
237 //we are in the source and get an answer from the target 237 //we are in the source and get an answer from the target
238 if ((_targetMessage + _targetMessageParameters) == cmsg.data()) 238 if ((_targetMessage + _targetMessageParameters) == cmsg.data())
239 { 239 {
240 QMap<QString,QString> adrMap; 240 QMap<QString,QString> adrMap;
241 QString uid; 241 QString uid;
242 242
243 stream >> uid >> adrMap; 243 stream >> uid >> adrMap;
244 244
245 emit receivedMessageFromTarget(uid, adrMap); 245 emit receivedMessageFromTarget(uid, adrMap);
246 246
247 247
248 return true; 248 return true;
249 } 249 }
250 } 250 }
251 251
252 return false; 252 return false;
253} 253}
254 254
255 255
256/********************************************************************************* 256/*********************************************************************************
257 * 257 *
258 ********************************************************************************/ 258 ********************************************************************************/
259 259
260QCopListTransferItem::~QCopListTransferItem()
261{
262
263}
260 264
261QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 265QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
262 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage) 266 : QCopTransferItem(usedSourceParameters, sourceMessage, targetChannel,targetMessage)
263{ 267{
264 //targetMessage returns later two parameters: uid, and three lists 268 //targetMessage returns later two parameters: uid, and three lists
265 _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)"; 269 _targetMessageParameters = "(QString,QStringList,QStringList,QStringList,QStringList,QStringList,QStringList)";
266} 270}
267 271
268/*********************************************************************************/ 272/*********************************************************************************/
269bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) 273bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6)
270{ 274{
271#ifndef DESKTOP_VERSION 275#ifndef DESKTOP_VERSION
272 //targetMessage passes two parameters: uid, map 276 //targetMessage passes two parameters: uid, map
273 QString targetMessage = _targetMessage + _targetMessageParameters; 277 QString targetMessage = _targetMessage + _targetMessageParameters;
274 278
275#ifdef DEBUG_EXT_APP_HANDLER 279#ifdef DEBUG_EXT_APP_HANDLER
276 qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1()); 280 qDebug("3Using QCopEnvelope e(\"%s\",\"%s\")", _sourceChannel.latin1(), targetMessage.latin1());
277 qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1()); 281 qDebug("passing uid(%s) and list1, list2, list3, list4, list5, list6 as parameter to QCopEnvelope", uid.latin1());
278 282
279 283
280 for ( int i = 0; i < list3.count(); i++) 284 for ( int i = 0; i < list3.count(); i++)
281 qDebug("listentry list3: %s",list3[i].latin1()); 285 qDebug("listentry list3: %s",list3[i].latin1());
282#endif 286#endif
283 287
284 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1()); 288 QCopEnvelope e(_sourceChannel.latin1(), targetMessage.latin1());
285 //US we need no names in the To field. The emailadresses are enough 289 //US we need no names in the To field. The emailadresses are enough
286 290
287 e << uid << list1 << list2 << list3 << list4 << list5 << list6; 291 e << uid << list1 << list2 << list3 << list4 << list5 << list6;
288 292
289 qApp->processEvents(); 293 qApp->processEvents();
290 294
291 return true; 295 return true;
292 296
293#else 297#else
294 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) ); 298 KMessageBox::sorry( 0, i18n( "This version does not support QCop." ) );
295 return false; 299 return false;
296#endif 300#endif
297 301
298} 302}
299 303
300 304
301/*********************************************************************************/ 305/*********************************************************************************/
302bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data ) 306bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& data )
303{ 307{
304 bool res = QCopTransferItem::appMessage( cmsg, data ); 308 bool res = QCopTransferItem::appMessage( cmsg, data );
305#ifdef DEBUG_EXT_APP_HANDLER 309#ifdef DEBUG_EXT_APP_HANDLER
306 qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); 310 qDebug("1QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
307#endif 311#endif
308 312
309 if (res == false) 313 if (res == false)
310 { 314 {
311 QDataStream stream( data, IO_ReadOnly ); 315 QDataStream stream( data, IO_ReadOnly );
312 316
313#ifdef DEBUG_EXT_APP_HANDLER 317#ifdef DEBUG_EXT_APP_HANDLER
314 qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); 318 qDebug("2QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
315#endif 319#endif
316 320
317 //we are in the source and get an answer from the target 321 //we are in the source and get an answer from the target
318 if ((_targetMessage + _targetMessageParameters) == cmsg.data()) 322 if ((_targetMessage + _targetMessageParameters) == cmsg.data())
319 { 323 {
320 QStringList list1; 324 QStringList list1;
321 QStringList list2; 325 QStringList list2;
322 QStringList list3; 326 QStringList list3;
323 QStringList list4; 327 QStringList list4;
324 QStringList list5; 328 QStringList list5;
325 QStringList list6; 329 QStringList list6;
326 QString uid; 330 QString uid;
327 331
328#ifdef DEBUG_EXT_APP_HANDLER 332#ifdef DEBUG_EXT_APP_HANDLER
329 qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() ); 333 qDebug("3QCopListTransferItem- QCOP message received: %s ", cmsg.data() );
330#endif 334#endif
331 335
332 stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6; 336 stream >> uid >> list1 >> list2 >> list3 >> list4 >> list5 >> list6;
333 emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6); 337 emit receivedMessageFromTarget(uid, list1, list2, list3, list4, list5, list6);
334 338
335 339
336 return true; 340 return true;
337 } 341 }
338 } 342 }
339 343
340 return false; 344 return false;
341} 345}
342 346
343 347
344 348
345/********************************************************************************* 349/*********************************************************************************
346 * 350 *
347 ********************************************************************************/ 351 ********************************************************************************/
348 352
349 353
350ExternalAppHandler *ExternalAppHandler::sInstance = 0; 354ExternalAppHandler *ExternalAppHandler::sInstance = 0;
351static KStaticDeleter<ExternalAppHandler> staticDeleter; 355static KStaticDeleter<ExternalAppHandler> staticDeleter;
352 356
353ExternalAppHandler::ExternalAppHandler() 357ExternalAppHandler::ExternalAppHandler()
354{ 358{
355 mDefaultItems.setAutoDelete(true); 359 mDefaultItems.setAutoDelete(true);
356 360
357 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList"); 361 mNameEmailUidListFromKAPITransfer = new QCopListTransferItem(0, "requestNameEmailUIDListFromKAPI", "QPE/Application/kapi", "receiveNameEmailUIDList");
358 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&))); 362 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForNameEmailUidList(const QString&, const QString&)));
359 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 363 connect(mNameEmailUidListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SLOT (receivedNameEmailUidList_Slot(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
360 364
361//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList"); 365//US mFindByEmailFromKAPITransfer = new QCopListTransferItem(1, "requestFindByEmailFromKAPI", "QPE/Application/kapi", "receiveFindByEmailNameEmailUIDList");
362//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&))); 366//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&)), this, SIGNAL (requestForFindByEmail(const QString&, const QString&, const QString&)));
363//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&))); 367//US connect(mFindByEmailFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedFindByEmailEvent(const QString&, const QStringList&, const QStringList&, const QStringList&)));
364 368
365 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", ""); 369 mDisplayDetails = new QCopListTransferItem(3, "requestDisplayDetailsFromKAPI", "QPE/Application/kapi", "");
366 connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&))); 370 connect(mDisplayDetails, SIGNAL (receivedMessageFromSource(const QString&, const QString&, const QString&, const QString&, const QString&)), this, SIGNAL (requestForDetails(const QString&, const QString&, const QString&, const QString&, const QString&)));
367 371
368 372
369 373
370 mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList"); 374 mBirthdayListFromKAPITransfer = new QCopListTransferItem(0, "requestBirthdayListFromKAPI", "QPE/Application/kapi", "receiveBirthdayList");
371 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&))); 375 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromSource(const QString&, const QString&)), this, SIGNAL (requestForBirthdayList(const QString&, const QString&)));
372 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&))); 376 connect(mBirthdayListFromKAPITransfer, SIGNAL (receivedMessageFromTarget(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)), this, SIGNAL (receivedBirthdayListEvent(const QString&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&, const QStringList&)));
373 377
374 378
375} 379}
376 380
377ExternalAppHandler::~ExternalAppHandler() 381ExternalAppHandler::~ExternalAppHandler()
378{ 382{
383 delete mNameEmailUidListFromKAPITransfer;
384 //delete mFindByEmailFromKAPITransfer;
385 delete mDisplayDetails;
386 delete mBirthdayListFromKAPITransfer;
379} 387}
380 388
381void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, 389void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid,
382 const QStringList& nameList, 390 const QStringList& nameList,
383 const QStringList& emailList, 391 const QStringList& emailList,
384 const QStringList& uidList, 392 const QStringList& uidList,
385 const QStringList&, 393 const QStringList&,
386 const QStringList&, 394 const QStringList&,
387 const QStringList& ) 395 const QStringList& )
388{ 396{
389 // this method is a conevnient way to reduce the number of parameters I have to pass 397 // this method is a conevnient way to reduce the number of parameters I have to pass
390 emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList); 398 emit receivedNameEmailUidListEvent(uid, nameList, emailList, uidList);
391} 399}
392 400
393 401
394void ExternalAppHandler::loadConfig() 402void ExternalAppHandler::loadConfig()
395{ 403{
396 404
397 mDefaultItems.clear(); 405 mDefaultItems.clear();
398 mEmailAppAvailable = UNDEFINED; 406 mEmailAppAvailable = UNDEFINED;
399 mPhoneAppAvailable = UNDEFINED; 407 mPhoneAppAvailable = UNDEFINED;
400 mFaxAppAvailable = UNDEFINED; 408 mFaxAppAvailable = UNDEFINED;
401 mSMSAppAvailable = UNDEFINED; 409 mSMSAppAvailable = UNDEFINED;
402 mPagerAppAvailable = UNDEFINED; 410 mPagerAppAvailable = UNDEFINED;
403 mSIPAppAvailable = UNDEFINED; 411 mSIPAppAvailable = UNDEFINED;
404 412
405 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") ); 413 QString opiepath = QString::fromLatin1( getenv("OPIEDIR") );
406 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") ); 414 QString qtopiapath = QString::fromLatin1( getenv("QPEDIR") );
407 415
408 if (opiepath.isEmpty()) 416 if (opiepath.isEmpty())
409 opiepath = qtopiapath; 417 opiepath = qtopiapath;
410 418
411 //mailclients 419 //mailclients
412 QString mailmsg1 = "writeMail(QString,QString)"; 420 QString mailmsg1 = "writeMail(QString,QString)";
413 QString mailmsg2 = "writeMail(QMap(QString,QString))"; 421 QString mailmsg2 = "writeMail(QMap(QString,QString))";
414 422
415 QString undefined = ""; 423 QString undefined = "";
416 424
417 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined); 425 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::NONE_EMC, "No email client installed", undefined, undefined, undefined, undefined, undefined);
418 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined); 426 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OTHER_EMC, "Userdefined email client", undefined, undefined, undefined, undefined, undefined);
419 427
420 if (( QFile::exists( qtopiapath + "/bin/ompi" )) || 428 if (( QFile::exists( qtopiapath + "/bin/ompi" )) ||
421 ( QFile::exists( opiepath + "/bin/ompi" ))) 429 ( QFile::exists( opiepath + "/bin/ompi" )))
422 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 430 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OMPI_EMC, "OM/Pi email client", "QPE/Application/ompi", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
423 431
424 if ( QFile::exists( qtopiapath + "/bin/qtmail" )) 432 if ( QFile::exists( qtopiapath + "/bin/qtmail" ))
425 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 433 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::QTOPIA_EMC, "Qtopia email client", "QPE/Application/qtmail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
426 434
427 if ( QFile::exists( opiepath + "/bin/opiemail" )) 435 if ( QFile::exists( opiepath + "/bin/opiemail" ))
428 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2"); 436 addDefaultAppItem(ExternalAppHandler::EMAIL, KPimGlobalPrefs::OPIE_EMC, "Opie email client", "QPE/Application/opiemail", mailmsg1, "%1;%2", mailmsg2, "TO=%1;ATTACHMENT=%2");
429 437
430 438
431 439
432 //phoneclients 440 //phoneclients
433 441
434 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined); 442 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::NONE_PHC, "No phone client installed", undefined, undefined, undefined, undefined, undefined);
435 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined); 443 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::OTHER_PHC, "Other phone client", undefined, undefined, undefined, undefined, undefined);
436 if (( QFile::exists( qtopiapath + "/bin/kppi" )) || 444 if (( QFile::exists( qtopiapath + "/bin/kppi" )) ||
437 ( QFile::exists( opiepath + "/bin/kppi" ))) 445 ( QFile::exists( opiepath + "/bin/kppi" )))
438 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined); 446 addDefaultAppItem(ExternalAppHandler::PHONE, KPimGlobalPrefs::KPPI_PHC, "KP/Pi phone client", "QPE/Application/kppi", "-ring:%1", "", undefined, undefined);
439 447
440 //faxclients 448 //faxclients
441 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined); 449 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::NONE_FAC, "No fax client installed", undefined, undefined, undefined, undefined, undefined);
442 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined); 450 addDefaultAppItem(ExternalAppHandler::FAX, KPimGlobalPrefs::OTHER_FAC, "Other fax client", undefined, undefined, undefined, undefined, undefined);
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index 4c6f1ea..6f5d345 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -39,129 +39,129 @@ class QCopEnvelope;
39 39
40 40
41class ExternalAppHandler; 41class ExternalAppHandler;
42class QCopTransferItem : public QObject 42class QCopTransferItem : public QObject
43{ 43{
44 Q_OBJECT 44 Q_OBJECT
45 public: 45 public:
46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 46 QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
47 QCopTransferItem(); 47 QCopTransferItem();
48 48
49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null); 49 bool sendMessageToTarget(const QString& uid, const QString& param1 = QString::null, const QString& param2 = QString::null, const QString& param3 = QString::null);
50 50
51 void setSourceChannel(const QString& sourceChannel); 51 void setSourceChannel(const QString& sourceChannel);
52 52
53 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 53 virtual bool appMessage( const QCString& msg, const QByteArray& data );
54 54
55 55
56 signals: 56 signals:
57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid); 57 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid);
58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1); 58 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1);
59 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2); 59 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2);
60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3); 60 void receivedMessageFromSource(const QString& sourceChannel, const QString& uid, const QString& param1, const QString& param2, const QString& param3);
61 61
62 public: 62 public:
63 int _usedSourceParameters; 63 int _usedSourceParameters;
64 QString _sourceChannel; 64 QString _sourceChannel;
65 QString _sourceMessage; 65 QString _sourceMessage;
66 QString _sourceMessageParameters; 66 QString _sourceMessageParameters;
67 QString _targetChannel; 67 QString _targetChannel;
68 QString _targetMessage; 68 QString _targetMessage;
69 QString _targetMessageParameters; 69 QString _targetMessageParameters;
70 70
71}; 71};
72 72
73/********************************************************************************* 73/*********************************************************************************
74 * 74 *
75 ********************************************************************************/ 75 ********************************************************************************/
76 76
77class QCopMapTransferItem : public QCopTransferItem 77class QCopMapTransferItem : public QCopTransferItem
78{ 78{
79 Q_OBJECT 79 Q_OBJECT
80 public: 80 public:
81 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 81 QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
82 82
83 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); 83 bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap);
84 84
85 85
86 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 86 virtual bool appMessage( const QCString& msg, const QByteArray& data );
87 87
88 88
89 signals: 89 signals:
90 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); 90 void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap);
91 91
92}; 92};
93 93
94/********************************************************************************* 94/*********************************************************************************
95 * 95 *
96 ********************************************************************************/ 96 ********************************************************************************/
97 97
98class QCopListTransferItem : public QCopTransferItem 98class QCopListTransferItem : public QCopTransferItem
99{ 99{
100 Q_OBJECT 100 Q_OBJECT
101 public: 101 public:
102 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); 102 QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage);
103 103 ~QCopListTransferItem();
104 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); 104 bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6);
105 105
106 106
107 virtual bool appMessage( const QCString& msg, const QByteArray& data ); 107 virtual bool appMessage( const QCString& msg, const QByteArray& data );
108 108
109 109
110 signals: 110 signals:
111 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); 111 void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6);
112 112
113}; 113};
114 114
115/********************************************************************************* 115/*********************************************************************************
116 * 116 *
117 ********************************************************************************/ 117 ********************************************************************************/
118 118
119 119
120class DefaultAppItem 120class DefaultAppItem
121{ 121{
122 public: 122 public:
123 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) 123 DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2)
124 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) 124 : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2)
125 {} 125 {}
126 126
127 DefaultAppItem() 127 DefaultAppItem()
128 { } 128 { }
129 129
130 public: 130 public:
131 int _type; 131 int _type;
132 int _id; 132 int _id;
133 QString _label; 133 QString _label;
134 QString _channel; 134 QString _channel;
135 QString _message; 135 QString _message;
136 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ; 136 QString _parameters;// a list of parameters in stringrepresentation. Delimiter is ;
137 QString _message2; 137 QString _message2;
138 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ; 138 QString _parameters2; // a list of parameters in stringrepresentation. Delimiter is ;
139 139
140}; 140};
141 141
142/********************************************************************************* 142/*********************************************************************************
143 * 143 *
144 ********************************************************************************/ 144 ********************************************************************************/
145 145
146class ExternalAppHandler : public QObject 146class ExternalAppHandler : public QObject
147{ 147{
148 Q_OBJECT 148 Q_OBJECT
149 public: 149 public:
150 virtual ~ExternalAppHandler(); 150 virtual ~ExternalAppHandler();
151 151
152 static ExternalAppHandler *instance(); 152 static ExternalAppHandler *instance();
153 153
154 enum Types { 154 enum Types {
155 EMAIL = 0, 155 EMAIL = 0,
156 PHONE = 1, 156 PHONE = 1,
157 SMS = 2, 157 SMS = 2,
158 FAX = 3, 158 FAX = 3,
159 PAGER = 4, 159 PAGER = 4,
160 SIP = 5 160 SIP = 5
161 }; 161 };
162 162
163 enum Availability { 163 enum Availability {
164 UNDEFINED = -1, 164 UNDEFINED = -1,
165 UNAVAILABLE = 0, 165 UNAVAILABLE = 0,
166 AVAILABLE = 1 166 AVAILABLE = 1
167 }; 167 };
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp
index 3771569..0fdc3e4 100644
--- a/libkdepim/kpimglobalprefs.cpp
+++ b/libkdepim/kpimglobalprefs.cpp
@@ -83,123 +83,122 @@ KPimGlobalPrefs::KPimGlobalPrefs( const QString &name )
83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" ); 83 addItemString( "FaxChannelMessage", &mFaxOtherMessage, "" );
84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" ); 84 addItemString( "FaxChannelParameters", &mFaxOtherMessageParameters, "" );
85 85
86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC ); 86 addItemInt( "SMSChannelType", &mSMSClient, NONE_SMC );
87 addItemString( "SMSChannel", &mSMSOtherChannel, "" ); 87 addItemString( "SMSChannel", &mSMSOtherChannel, "" );
88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" ); 88 addItemString( "SMSChannelMessage", &mSMSOtherMessage, "" );
89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" ); 89 addItemString( "SMSChannelParameters", &mSMSOtherMessageParameters, "" );
90 90
91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC ); 91 addItemInt( "PagerChannelType", &mPagerClient, NONE_PAC );
92 addItemString( "PagerChannel", &mPagerOtherChannel, "" ); 92 addItemString( "PagerChannel", &mPagerOtherChannel, "" );
93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" ); 93 addItemString( "PagerChannelMessage", &mPagerOtherMessage, "" );
94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" ); 94 addItemString( "PagerChannelParameters", &mPagerOtherMessageParameters, "" );
95 95
96 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC ); 96 addItemInt( "SIPChannelType", &mSipClient, KPPI_SIC );
97 addItemString( "SIPChannel", &mSipOtherChannel, "" ); 97 addItemString( "SIPChannel", &mSipOtherChannel, "" );
98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" ); 98 addItemString( "SIPChannelMessage", &mSipOtherMessage, "" );
99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" ); 99 addItemString( "SIPChannelParameters", &mSipOtherMessageParameters, "" );
100 100
101 KPrefs::setCurrentGroup( "PhoneAccess" ); 101 KPrefs::setCurrentGroup( "PhoneAccess" );
102 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm"); 102 addItemString("Ex2PhoneDevice",&mEx2PhoneDevice,"/dev/ircomm");
103 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda"); 103 addItemString("Ex2PhoneConnection",&mEx2PhoneConnection,"irda");
104 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i"); 104 addItemString("Ex2PhoneModel",&mEx2PhoneModel,"6310i");
105 105
106} 106}
107 107
108void KPimGlobalPrefs::setGlobalConfig() 108void KPimGlobalPrefs::setGlobalConfig()
109{ 109{
110 if ( mLocaleDict == 0 ) { 110 if ( mLocaleDict == 0 ) {
111 QString fileName ; 111 QString fileName ;
112 QString name = KGlobal::getAppName() +"/"; 112 QString name = KGlobal::getAppName() +"/";
113#ifndef DESKTOP_VERSION 113#ifndef DESKTOP_VERSION
114 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name 114 fileName= QString(getenv("QPEDIR"))+"/pics/kdepim/"+name
115#else 115#else
116 fileName = qApp->applicationDirPath () + "/kdepim/"+ name; 116 fileName = qApp->applicationDirPath () + "/kdepim/"+ name;
117#endif 117#endif
118 mLocaleDict = 0; 118 mLocaleDict = 0;
119 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) { 119 if ( mPreferredLanguage > 0 && mPreferredLanguage < 5 ) {
120 120
121 if ( mPreferredLanguage == 1 ) 121 if ( mPreferredLanguage == 1 )
122 fileName = fileName+"germantranslation.txt"; 122 fileName = fileName+"germantranslation.txt";
123 else if ( mPreferredLanguage == 4 ) 123 else if ( mPreferredLanguage == 4 )
124 fileName = fileName+"usertranslation.txt"; 124 fileName = fileName+"usertranslation.txt";
125 else if ( mPreferredLanguage == 2 ) 125 else if ( mPreferredLanguage == 2 )
126 fileName = fileName+"frenchtranslation.txt"; 126 fileName = fileName+"frenchtranslation.txt";
127 else if ( mPreferredLanguage == 3 ) 127 else if ( mPreferredLanguage == 3 )
128 fileName = fileName+"italiantranslation.txt"; 128 fileName = fileName+"italiantranslation.txt";
129 QFile file( fileName ); 129 QFile file( fileName );
130 if (file.open( IO_ReadOnly ) ) { 130 if (file.open( IO_ReadOnly ) ) {
131 QTextStream ts( &file ); 131 QTextStream ts( &file );
132 ts.setEncoding( QTextStream::Latin1 ); 132 ts.setEncoding( QTextStream::Latin1 );
133 //ts.setCodec( QTextCodec::latin1 ); 133 //ts.setCodec( QTextCodec::latin1 );
134 QString text = ts.read(); 134 QString text = ts.read();
135 file.close(); 135 file.close();
136 text.replace( QRegExp("\\\\n"), "\n" ); 136 text.replace( QRegExp("\\\\n"), "\n" );
137 QString line; 137 QString line;
138 QString we; 138 QString we;
139 QString wt; 139 QString wt;
140 int br = 0; 140 int br = 0;
141 int nbr; 141 int nbr;
142 nbr = text.find ( "},", br ); 142 nbr = text.find ( "},", br );
143 line = text.mid( br, nbr - br ); 143 line = text.mid( br, nbr - br );
144 br = nbr+1; 144 br = nbr+1;
145 int se, ee, st, et; 145 int se, ee, st, et;
146 mLocaleDict = new QDict<QString>; 146 mLocaleDict = new QDict<QString>;
147 mLocaleDict->setAutoDelete( true );
147 QString end = "{ \"\",\"\" }"; 148 QString end = "{ \"\",\"\" }";
148 while ( (line != end) && (br > 1) ) { 149 while ( (line != end) && (br > 1) ) {
149 //qDebug("%d *%s* ", br, line.latin1()); 150 //qDebug("%d *%s* ", br, line.latin1());
150 se = line.find("\"")+1; 151 se = line.find("\"")+1;
151 et = line.findRev("\"",-1); 152 et = line.findRev("\"",-1);
152 ee = line.find("\",\""); 153 ee = line.find("\",\"");
153 st = ee+3; 154 st = ee+3;
154 we = line.mid( se, ee-se ); 155 we = line.mid( se, ee-se );
155 wt = line.mid( st, et-st ); 156 wt = line.mid( st, et-st );
156 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1()); 157 //qDebug("*%s* *%s* ", we.latin1(), wt.latin1());
157 mLocaleDict->insert( we, new QString (wt) ); 158 mLocaleDict->insert( we, new QString (wt) );
158 nbr = text.find ( "}", br ); 159 nbr = text.find ( "}", br );
159 line = text.mid( br, nbr - br ); 160 line = text.mid( br, nbr - br );
160 br = nbr+1; 161 br = nbr+1;
161 } 162 }
162 //qDebug("end *%s* ", end.latin1()); 163 //qDebug("end *%s* ", end.latin1());
163 164
164 setLocaleDict( mLocaleDict ); 165 setLocaleDict( mLocaleDict );
165 } else { 166 } else {
166 qDebug("KO: Cannot find translation file %s",fileName.latin1() ); 167 qDebug("KO: Cannot find translation file %s",fileName.latin1() );
167 } 168 }
168 } 169 }
169 } 170 }
170 171
171 KGlobal::locale()->setHore24Format( !mPreferredTime ); 172 KGlobal::locale()->setHore24Format( !mPreferredTime );
172 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday ); 173 KGlobal::locale()->setWeekStartMonday( !mWeekStartsOnSunday );
173 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate ); 174 KGlobal::locale()->setIntDateFormat( (KLocale::IntDateFormat)mPreferredDate );
174 KGlobal::locale()->setLanguage( mPreferredLanguage ); 175 KGlobal::locale()->setLanguage( mPreferredLanguage );
175 QString dummy = mUserDateFormatLong; 176 QString dummy = mUserDateFormatLong;
176 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") )); 177 KGlobal::locale()->setDateFormat(dummy.replace( QRegExp("K"), QString(",") ));
177 dummy = mUserDateFormatShort; 178 dummy = mUserDateFormatShort;
178 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") )); 179 KGlobal::locale()->setDateFormatShort(dummy.replace( QRegExp("K"), QString(",") ));
179 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving, 180 KGlobal::locale()->setDaylightSaving( mUseDaylightsaving,
180 mDaylightsavingStart, 181 mDaylightsavingStart,
181 mDaylightsavingEnd ); 182 mDaylightsavingEnd );
182 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min ); 183 KGlobal::locale()->setTimezone( mTimeZoneId, mTimeZoneAdd30min );
183 184
184} 185}
185KPimGlobalPrefs::~KPimGlobalPrefs() 186KPimGlobalPrefs::~KPimGlobalPrefs()
186{ 187{
187 if (sInstance == this) 188 if (sInstance == this)
188 sInstance = staticDeleterGP.setObject(0); 189 sInstance = staticDeleterGP.setObject(0);
189 else 190 else
190 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?"); 191 qDebug("Whats this? Error in KPimGlobalPrefs::~KPimGlobalPrefs() ?");
191 //qDebug("KPimGlobalPrefs::~KPimGlobalPrefs() ");
192 writeConfig();
193 if ( mLocaleDict ) 192 if ( mLocaleDict )
194 delete mLocaleDict; 193 delete mLocaleDict;
195} 194}
196 195
197KPimGlobalPrefs *KPimGlobalPrefs::instance() 196KPimGlobalPrefs *KPimGlobalPrefs::instance()
198{ 197{
199 if ( !sInstance ) { 198 if ( !sInstance ) {
200 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() ); 199 sInstance = staticDeleterGP.setObject( new KPimGlobalPrefs() );
201 sInstance->readConfig(); 200 sInstance->readConfig();
202 } 201 }
203 202
204 return sInstance; 203 return sInstance;
205} 204}