author | zautrix <zautrix> | 2004-10-23 14:56:10 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-23 14:56:10 (UTC) |
commit | a682b1d39c63cff8d709c67460569c70b661d889 (patch) (unidiff) | |
tree | dd5cb4052b07927b63bafa68b2fd6d40bce6a6dc /libkdepim | |
parent | 73c0cb5307a8276f628765c651ef0284b85d64de (diff) | |
download | kdepimpi-a682b1d39c63cff8d709c67460569c70b661d889.zip kdepimpi-a682b1d39c63cff8d709c67460569c70b661d889.tar.gz kdepimpi-a682b1d39c63cff8d709c67460569c70b661d889.tar.bz2 |
fixed several memory leaks
-rw-r--r-- | libkdepim/externalapphandler.cpp | 12 | ||||
-rw-r--r-- | libkdepim/externalapphandler.h | 2 | ||||
-rw-r--r-- | libkdepim/kpimglobalprefs.cpp | 3 |
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 | |||
@@ -32,65 +32,65 @@ $Id$ | |||
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qmap.h> | 33 | #include <qmap.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | 35 | ||
36 | #ifndef DESKTOP_VERSION | 36 | #ifndef DESKTOP_VERSION |
37 | #include <qpe/qpeapplication.h> | 37 | #include <qpe/qpeapplication.h> |
38 | #include <qtopia/qcopenvelope_qws.h> | 38 | #include <qtopia/qcopenvelope_qws.h> |
39 | #else | 39 | #else |
40 | #include <qapplication.h> | 40 | #include <qapplication.h> |
41 | #endif | 41 | #endif |
42 | 42 | ||
43 | #include <kstaticdeleter.h> | 43 | #include <kstaticdeleter.h> |
44 | #include <kmessagebox.h> | 44 | #include <kmessagebox.h> |
45 | 45 | ||
46 | 46 | ||
47 | #include "externalapphandler.h" | 47 | #include "externalapphandler.h" |
48 | 48 | ||
49 | #include "kpimglobalprefs.h" | 49 | #include "kpimglobalprefs.h" |
50 | 50 | ||
51 | //uncomment line to get debug output | 51 | //uncomment line to get debug output |
52 | //#define DEBUG_EXT_APP_HANDLER | 52 | //#define DEBUG_EXT_APP_HANDLER |
53 | 53 | ||
54 | /********************************************************************************* | 54 | /********************************************************************************* |
55 | * | 55 | * |
56 | ********************************************************************************/ | 56 | ********************************************************************************/ |
57 | 57 | ||
58 | 58 | ||
59 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 59 | QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
60 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) | 60 | : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) |
61 | { | 61 | { |
62 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 | 62 | //sourceMessage passes later three parameters: sourceChannel, uid, param1 |
63 | if (_usedSourceParameters == 0) | 63 | if (_usedSourceParameters == 0) |
64 | _sourceMessageParameters = "(QString,QString)"; | 64 | _sourceMessageParameters = "QString,QString)"; |
65 | else if (_usedSourceParameters == 1) | 65 | else if (_usedSourceParameters == 1) |
66 | _sourceMessageParameters = "(QString,QString,QString)"; | 66 | _sourceMessageParameters = "(QString,QString,QString)"; |
67 | else if (_usedSourceParameters == 2) | 67 | else if (_usedSourceParameters == 2) |
68 | _sourceMessageParameters = "(QString,QString,QString,QString)"; | 68 | _sourceMessageParameters = "(QString,QString,QString,QString)"; |
69 | else if (_usedSourceParameters == 3) | 69 | else if (_usedSourceParameters == 3) |
70 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; | 70 | _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; |
71 | } | 71 | } |
72 | 72 | ||
73 | /*********************************************************************************/ | 73 | /*********************************************************************************/ |
74 | 74 | ||
75 | QCopTransferItem::QCopTransferItem() | 75 | QCopTransferItem::QCopTransferItem() |
76 | { | 76 | { |
77 | } | 77 | } |
78 | 78 | ||
79 | /*********************************************************************************/ | 79 | /*********************************************************************************/ |
80 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) | 80 | bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) |
81 | { | 81 | { |
82 | 82 | ||
83 | #ifndef DESKTOP_VERSION | 83 | #ifndef DESKTOP_VERSION |
84 | //sourceMessage passes two parameters: sourceChannel, uid | 84 | //sourceMessage passes two parameters: sourceChannel, uid |
85 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; | 85 | QString sourceMessage = _sourceMessage + _sourceMessageParameters; |
86 | #ifdef DEBUG_EXT_APP_HANDLER | 86 | #ifdef DEBUG_EXT_APP_HANDLER |
87 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); | 87 | qDebug("1Using QCopEnvelope e(\"%s\",\"%s\")", _targetChannel.latin1(), sourceMessage.latin1()); |
88 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); | 88 | qDebug("passing sourcechannel(%s), uid(%s), param1(%s), param2(%s), param3(%s) as parameter to QCopEnvelope", _sourceChannel.latin1(), uid.latin1(), param1.latin1(), param2.latin1(), param3.latin1()); |
89 | #endif | 89 | #endif |
90 | 90 | ||
91 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); | 91 | QCopEnvelope e(_targetChannel.latin1(), sourceMessage.latin1()); |
92 | 92 | ||
93 | e << _sourceChannel << uid; | 93 | e << _sourceChannel << uid; |
94 | 94 | ||
95 | if (_usedSourceParameters == 1) | 95 | if (_usedSourceParameters == 1) |
96 | e << param1; | 96 | e << param1; |
@@ -228,64 +228,68 @@ bool QCopMapTransferItem::appMessage( const QCString& cmsg, const QByteArray& da | |||
228 | { | 228 | { |
229 | bool res = QCopTransferItem::appMessage( cmsg, data ); | 229 | bool res = QCopTransferItem::appMessage( cmsg, data ); |
230 | 230 | ||
231 | if (res == false) | 231 | if (res == false) |
232 | { | 232 | { |
233 | QDataStream stream( data, IO_ReadOnly ); | 233 | QDataStream stream( data, IO_ReadOnly ); |
234 | 234 | ||
235 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); | 235 | // qDebug("QCopMapTransferItem- QCOP message received: %s ", cmsg.data() ); |
236 | 236 | ||
237 | //we are in the source and get an answer from the target | 237 | //we are in the source and get an answer from the target |
238 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) | 238 | if ((_targetMessage + _targetMessageParameters) == cmsg.data()) |
239 | { | 239 | { |
240 | QMap<QString,QString> adrMap; | 240 | QMap<QString,QString> adrMap; |
241 | QString uid; | 241 | QString uid; |
242 | 242 | ||
243 | stream >> uid >> adrMap; | 243 | stream >> uid >> adrMap; |
244 | 244 | ||
245 | emit receivedMessageFromTarget(uid, adrMap); | 245 | emit receivedMessageFromTarget(uid, adrMap); |
246 | 246 | ||
247 | 247 | ||
248 | return true; | 248 | return true; |
249 | } | 249 | } |
250 | } | 250 | } |
251 | 251 | ||
252 | return false; | 252 | return false; |
253 | } | 253 | } |
254 | 254 | ||
255 | 255 | ||
256 | /********************************************************************************* | 256 | /********************************************************************************* |
257 | * | 257 | * |
258 | ********************************************************************************/ | 258 | ********************************************************************************/ |
259 | 259 | ||
260 | QCopListTransferItem::~QCopListTransferItem() | ||
261 | { | ||
262 | |||
263 | } | ||
260 | 264 | ||
261 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) | 265 | QCopListTransferItem::QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) |
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 | /*********************************************************************************/ |
269 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) | 273 | bool QCopListTransferItem::sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6) |
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; |
@@ -346,65 +350,69 @@ bool QCopListTransferItem::appMessage( const QCString& cmsg, const QByteArray& d | |||
346 | * | 350 | * |
347 | ********************************************************************************/ | 351 | ********************************************************************************/ |
348 | 352 | ||
349 | 353 | ||
350 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; | 354 | ExternalAppHandler *ExternalAppHandler::sInstance = 0; |
351 | static KStaticDeleter<ExternalAppHandler> staticDeleter; | 355 | static KStaticDeleter<ExternalAppHandler> staticDeleter; |
352 | 356 | ||
353 | ExternalAppHandler::ExternalAppHandler() | 357 | ExternalAppHandler::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 | ||
377 | ExternalAppHandler::~ExternalAppHandler() | 381 | ExternalAppHandler::~ExternalAppHandler() |
378 | { | 382 | { |
383 | delete mNameEmailUidListFromKAPITransfer; | ||
384 | //delete mFindByEmailFromKAPITransfer; | ||
385 | delete mDisplayDetails; | ||
386 | delete mBirthdayListFromKAPITransfer; | ||
379 | } | 387 | } |
380 | 388 | ||
381 | void ExternalAppHandler::receivedNameEmailUidList_Slot(const QString& uid, | 389 | void 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 | ||
394 | void ExternalAppHandler::loadConfig() | 402 | void 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 | ||
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h index 4c6f1ea..6f5d345 100644 --- a/libkdepim/externalapphandler.h +++ b/libkdepim/externalapphandler.h | |||
@@ -71,65 +71,65 @@ class QCopTransferItem : public QObject | |||
71 | }; | 71 | }; |
72 | 72 | ||
73 | /********************************************************************************* | 73 | /********************************************************************************* |
74 | * | 74 | * |
75 | ********************************************************************************/ | 75 | ********************************************************************************/ |
76 | 76 | ||
77 | class QCopMapTransferItem : public QCopTransferItem | 77 | class QCopMapTransferItem : public QCopTransferItem |
78 | { | 78 | { |
79 | Q_OBJECT | 79 | Q_OBJECT |
80 | public: | 80 | public: |
81 | QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | 81 | QCopMapTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); |
82 | 82 | ||
83 | bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); | 83 | bool sendMessageToSource(const QString& uid, const QMap<QString,QString>& nameEmailMap); |
84 | 84 | ||
85 | 85 | ||
86 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 86 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); |
87 | 87 | ||
88 | 88 | ||
89 | signals: | 89 | signals: |
90 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); | 90 | void receivedMessageFromTarget(const QString& uid, const QMap<QString,QString>& nameEmailMap); |
91 | 91 | ||
92 | }; | 92 | }; |
93 | 93 | ||
94 | /********************************************************************************* | 94 | /********************************************************************************* |
95 | * | 95 | * |
96 | ********************************************************************************/ | 96 | ********************************************************************************/ |
97 | 97 | ||
98 | class QCopListTransferItem : public QCopTransferItem | 98 | class QCopListTransferItem : public QCopTransferItem |
99 | { | 99 | { |
100 | Q_OBJECT | 100 | Q_OBJECT |
101 | public: | 101 | public: |
102 | QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); | 102 | QCopListTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage); |
103 | 103 | ~QCopListTransferItem(); | |
104 | bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); | 104 | bool sendMessageToSource(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4, const QStringList& list5, const QStringList& list6); |
105 | 105 | ||
106 | 106 | ||
107 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); | 107 | virtual bool appMessage( const QCString& msg, const QByteArray& data ); |
108 | 108 | ||
109 | 109 | ||
110 | signals: | 110 | signals: |
111 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); | 111 | void receivedMessageFromTarget(const QString& uid, const QStringList& list1, const QStringList& list2, const QStringList& list3, const QStringList& list4 , const QStringList& list5, const QStringList& list6); |
112 | 112 | ||
113 | }; | 113 | }; |
114 | 114 | ||
115 | /********************************************************************************* | 115 | /********************************************************************************* |
116 | * | 116 | * |
117 | ********************************************************************************/ | 117 | ********************************************************************************/ |
118 | 118 | ||
119 | 119 | ||
120 | class DefaultAppItem | 120 | class DefaultAppItem |
121 | { | 121 | { |
122 | public: | 122 | public: |
123 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) | 123 | DefaultAppItem(int type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2) |
124 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) | 124 | : _type(type), _id(id), _label(label), _channel(channel), _message(message), _parameters(parameters), _message2(message2), _parameters2(parameters2) |
125 | {} | 125 | {} |
126 | 126 | ||
127 | DefaultAppItem() | 127 | DefaultAppItem() |
128 | { } | 128 | { } |
129 | 129 | ||
130 | public: | 130 | public: |
131 | int _type; | 131 | int _type; |
132 | int _id; | 132 | int _id; |
133 | QString _label; | 133 | QString _label; |
134 | QString _channel; | 134 | QString _channel; |
135 | QString _message; | 135 | QString _message; |
diff --git a/libkdepim/kpimglobalprefs.cpp b/libkdepim/kpimglobalprefs.cpp index 3771569..0fdc3e4 100644 --- a/libkdepim/kpimglobalprefs.cpp +++ b/libkdepim/kpimglobalprefs.cpp | |||
@@ -115,91 +115,90 @@ void KPimGlobalPrefs::setGlobalConfig() | |||
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 | } |
185 | KPimGlobalPrefs::~KPimGlobalPrefs() | 186 | KPimGlobalPrefs::~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 | ||
197 | KPimGlobalPrefs *KPimGlobalPrefs::instance() | 196 | KPimGlobalPrefs *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 | } |