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.h1
-rw-r--r--libkdepim/ksyncmanager.cpp18
3 files changed, 20 insertions, 11 deletions
diff --git a/libkdepim/externalapphandler.cpp b/libkdepim/externalapphandler.cpp
index 0e9c5e5..2ce6926 100644
--- a/libkdepim/externalapphandler.cpp
+++ b/libkdepim/externalapphandler.cpp
@@ -1,80 +1,81 @@
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 <qtimer.h>
33#include <qmap.h> 34#include <qmap.h>
34#include <qregexp.h> 35#include <qregexp.h>
35 36
36#ifndef DESKTOP_VERSION 37#ifndef DESKTOP_VERSION
37#include <qpe/qpeapplication.h> 38#include <qpe/qpeapplication.h>
38#include <qtopia/qcopenvelope_qws.h> 39#include <qtopia/qcopenvelope_qws.h>
39#else 40#else
40#include <qapplication.h> 41#include <qapplication.h>
41#endif 42#endif
42 43
43#include <kstaticdeleter.h> 44#include <kstaticdeleter.h>
44#include <kmessagebox.h> 45#include <kmessagebox.h>
45 46
46 47
47#include "externalapphandler.h" 48#include "externalapphandler.h"
48 49
49#include "kpimglobalprefs.h" 50#include "kpimglobalprefs.h"
50 51
51//uncomment line to get debug output 52//uncomment line to get debug output
52//#define DEBUG_EXT_APP_HANDLER 53//#define DEBUG_EXT_APP_HANDLER
53 54
54/********************************************************************************* 55/*********************************************************************************
55 * 56 *
56 ********************************************************************************/ 57 ********************************************************************************/
57 58
58 59
59QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage) 60QCopTransferItem::QCopTransferItem(int usedSourceParameters, const QString& sourceMessage, const QString& targetChannel, const QString& targetMessage)
60 : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage) 61 : _usedSourceParameters(usedSourceParameters), _sourceMessage(sourceMessage), _targetChannel(targetChannel), _targetMessage(targetMessage)
61{ 62{
62 //sourceMessage passes later three parameters: sourceChannel, uid, param1 63 //sourceMessage passes later three parameters: sourceChannel, uid, param1
63 if (_usedSourceParameters == 0) 64 if (_usedSourceParameters == 0)
64 _sourceMessageParameters = "QString,QString)"; 65 _sourceMessageParameters = "QString,QString)";
65 else if (_usedSourceParameters == 1) 66 else if (_usedSourceParameters == 1)
66 _sourceMessageParameters = "(QString,QString,QString)"; 67 _sourceMessageParameters = "(QString,QString,QString)";
67 else if (_usedSourceParameters == 2) 68 else if (_usedSourceParameters == 2)
68 _sourceMessageParameters = "(QString,QString,QString,QString)"; 69 _sourceMessageParameters = "(QString,QString,QString,QString)";
69 else if (_usedSourceParameters == 3) 70 else if (_usedSourceParameters == 3)
70 _sourceMessageParameters = "(QString,QString,QString,QString,QString)"; 71 _sourceMessageParameters = "(QString,QString,QString,QString,QString)";
71} 72}
72 73
73/*********************************************************************************/ 74/*********************************************************************************/
74 75
75QCopTransferItem::QCopTransferItem() 76QCopTransferItem::QCopTransferItem()
76{ 77{
77} 78}
78 79
79/*********************************************************************************/ 80/*********************************************************************************/
80bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3) 81bool QCopTransferItem::sendMessageToTarget(const QString& uid, const QString& param1, const QString& param2, const QString& param3)
@@ -1084,105 +1085,110 @@ void ExternalAppHandler::passParameters(QCopEnvelope* e, const QString& paramete
1084 QStringList paramlist = QStringList::split(";", parameters); 1085 QStringList paramlist = QStringList::split(";", parameters);
1085 1086
1086 //Now check how many parts we have. 1087 //Now check how many parts we have.
1087 //=0 :no params to pass 1088 //=0 :no params to pass
1088 //>0 :parameters to pass 1089 //>0 :parameters to pass
1089 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it ) 1090 for ( QStringList::Iterator it = paramlist.begin(); it != paramlist.end(); ++it )
1090 { 1091 {
1091 QString param = (*it); 1092 QString param = (*it);
1092 QStringList keyvallist = QStringList::split("=", param); 1093 QStringList keyvallist = QStringList::split("=", param);
1093 1094
1094 //if we have keyvalue pairs, we assume that we pass a map to the envelope 1095 //if we have keyvalue pairs, we assume that we pass a map to the envelope
1095 QStringList::Iterator it2 = keyvallist.begin(); 1096 QStringList::Iterator it2 = keyvallist.begin();
1096 QString key = (*it2); 1097 QString key = (*it2);
1097 key = key.replace( QRegExp("%1"), param1 ); 1098 key = key.replace( QRegExp("%1"), param1 );
1098 key = key.replace( QRegExp("%2"), param2 ); 1099 key = key.replace( QRegExp("%2"), param2 );
1099 ++it2; 1100 ++it2;
1100 1101
1101 if(it2 != keyvallist.end()) 1102 if(it2 != keyvallist.end())
1102 { 1103 {
1103 QString value = (*it2); 1104 QString value = (*it2);
1104 value = value.replace( QRegExp("%1"), param1 ); 1105 value = value.replace( QRegExp("%1"), param1 );
1105 value = value.replace( QRegExp("%2"), param2 ); 1106 value = value.replace( QRegExp("%2"), param2 );
1106 1107
1107 valmap.insert(key, value); 1108 valmap.insert(key, value);
1108 useValMap = true; 1109 useValMap = true;
1109 } 1110 }
1110 else 1111 else
1111 { 1112 {
1112 // qDebug("pass parameter << %s", key.latin1()); 1113 // qDebug("pass parameter << %s", key.latin1());
1113 (*e) << key; 1114 (*e) << key;
1114 } 1115 }
1115 } 1116 }
1116 1117
1117 if (useValMap == true) 1118 if (useValMap == true)
1118 (*e) << valmap; 1119 (*e) << valmap;
1119 1120
1120#endif 1121#endif
1121 1122
1122} 1123}
1123 1124
1124 1125
1125 1126
1126/************************************************************************** 1127/**************************************************************************
1127 * 1128 *
1128 **************************************************************************/ 1129 **************************************************************************/
1129 1130
1130void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data ) 1131void ExternalAppHandler::appMessage( const QCString& cmsg, const QByteArray& data )
1131{ 1132{
1132 1133 qDebug("ExternalAppHandler::appMessage %s %x", cmsg.data(), this);
1133 if ( cmsg == "nextView()" ) { 1134 if ( cmsg == "nextView()" ) {
1134 qDebug("nextView()"); 1135 qDebug("nextView()");
1135 emit nextView(); 1136 QTimer::singleShot( 0, this, SIGNAL ( nextView() ));
1136 return; 1137 return;
1137 } 1138 }
1138 if ( cmsg == "callContactdialog()" ) { 1139 if ( cmsg == "callContactdialog()" ) {
1139 qDebug("callContactdialog()"); 1140 qDebug("callContactdialog()");
1140 emit callContactdialog(); 1141 QTimer::singleShot( 0, this, SIGNAL ( callContactdialog() ));
1142 return;
1143 }
1144 if ( cmsg == "doRingSync" ) {
1145 qDebug("doRingSync");
1146 QTimer::singleShot( 0, this, SIGNAL ( doRingSync() ));
1141 return; 1147 return;
1142 } 1148 }
1143 1149
1144 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1150 bool res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1145 if (!res) 1151 if (!res)
1146 res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data ); 1152 res = mBirthdayListFromKAPITransfer->appMessage( cmsg, data );
1147 1153
1148 if (!res) 1154 if (!res)
1149 res = mDisplayDetails->appMessage( cmsg, data ); 1155 res = mDisplayDetails->appMessage( cmsg, data );
1150 1156
1151// if (!res) 1157// if (!res)
1152// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data ); 1158// res = mNameEmailUidListFromKAPITransfer->appMessage( cmsg, data );
1153} 1159}
1154 1160
1155 1161
1156 1162
1157bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid) 1163bool ExternalAppHandler::requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid)
1158{ 1164{
1159 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1165 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1160 // maybe we are sending to KA/Pi fom a different worldd... 1166 // maybe we are sending to KA/Pi fom a different worldd...
1161 // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application 1167 // it may be that the QAplication::desktop()->width() values in KA/Pi are not the same as in our application
1162 // for that reason we send the current QApplication::desktop()->width() to KA/Pi 1168 // for that reason we send the current QApplication::desktop()->width() to KA/Pi
1163 //qDebug("UID %s ", sessionuid.latin1()); 1169 //qDebug("UID %s ", sessionuid.latin1());
1164 //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() )); 1170 //return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(QString::number ( QApplication::desktop()->width() ));
1165 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid); 1171 return mNameEmailUidListFromKAPITransfer->sendMessageToTarget(sessionuid);
1166} 1172}
1167 1173
1168bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1174bool ExternalAppHandler::returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1169{ 1175{
1170 QStringList list4, list5, list6; 1176 QStringList list4, list5, list6;
1171 1177
1172 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel); 1178 mNameEmailUidListFromKAPITransfer->setSourceChannel(sourceChannel);
1173 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); 1179 return mNameEmailUidListFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1174} 1180}
1175 1181
1176bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email) 1182bool ExternalAppHandler::requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email)
1177{ 1183{
1178 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1184 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1179 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email); 1185 return mFindByEmailFromKAPITransfer->sendMessageToTarget(sessionuid, email);
1180} 1186}
1181 1187
1182bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3) 1188bool ExternalAppHandler::returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& list1, const QStringList& list2, const QStringList& list3)
1183{ 1189{
1184 QStringList list4, list5, list6; 1190 QStringList list4, list5, list6;
1185 1191
1186 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel); 1192 mFindByEmailFromKAPITransfer->setSourceChannel(sourceChannel);
1187 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6); 1193 return mFindByEmailFromKAPITransfer->sendMessageToSource(sessionuid, list1, list2, list3, list4, list5, list6);
1188} 1194}
diff --git a/libkdepim/externalapphandler.h b/libkdepim/externalapphandler.h
index 097f306..b899ad7 100644
--- a/libkdepim/externalapphandler.h
+++ b/libkdepim/externalapphandler.h
@@ -190,96 +190,97 @@ class ExternalAppHandler : public QObject
190 //calls the faxapplication with the number 190 //calls the faxapplication with the number
191 bool callByFax( const QString& faxnumber ); 191 bool callByFax( const QString& faxnumber );
192 192
193 //calls the sipapplication with the number 193 //calls the sipapplication with the number
194 bool callBySIP( const QString& sipnumber ); 194 bool callBySIP( const QString& sipnumber );
195 195
196 bool isEmailAppAvailable(); 196 bool isEmailAppAvailable();
197 bool isSMSAppAvailable(); 197 bool isSMSAppAvailable();
198 bool isPhoneAppAvailable(); 198 bool isPhoneAppAvailable();
199 bool isFaxAppAvailable(); 199 bool isFaxAppAvailable();
200 bool isPagerAppAvailable(); 200 bool isPagerAppAvailable();
201 bool isSIPAppAvailable(); 201 bool isSIPAppAvailable();
202 202
203 203
204 //Call this method on the source when you want to select names from the addressbook by using QCop 204 //Call this method on the source when you want to select names from the addressbook by using QCop
205 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid); 205 bool requestNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
206 //Call this method on the target when you want to return the name/email map to the source (client). 206 //Call this method on the target when you want to return the name/email map to the source (client).
207 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); 207 bool returnNameEmailUidListFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
208 208
209 209
210 210
211 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email); 211 bool requestFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QString& email);
212 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid); 212 bool returnFindByEmailFromKAPI(const QString& sourceChannel, const QString& sessionuid, const QStringList& name, const QStringList& email, const QStringList& uid);
213 213
214 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid); 214 bool requestDetailsFromKAPI(const QString& name, const QString& email, const QString& uid);
215 215
216 216
217 217
218 bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid); 218 bool requestBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid);
219 bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid, 219 bool returnBirthdayListFromKAPI(const QString& sourceChannel, const QString& sessionuid,
220 const QStringList& birthdayList, const QStringList& anniversaryList, 220 const QStringList& birthdayList, const QStringList& anniversaryList,
221 const QStringList& realNameList, const QStringList& emailList, 221 const QStringList& realNameList, const QStringList& emailList,
222 const QStringList& assembledNameList, const QStringList& uidList); 222 const QStringList& assembledNameList, const QStringList& uidList);
223 223
224 224
225 //loadConfig clears the cache and checks again if the applications are available or not 225 //loadConfig clears the cache and checks again if the applications are available or not
226 void loadConfig(); 226 void loadConfig();
227 227
228 QList<DefaultAppItem> getAvailableDefaultItems(Types); 228 QList<DefaultAppItem> getAvailableDefaultItems(Types);
229 DefaultAppItem* getDefaultItem(Types, int); 229 DefaultAppItem* getDefaultItem(Types, int);
230 230
231 public slots: 231 public slots:
232 void appMessage( const QCString& msg, const QByteArray& data ); 232 void appMessage( const QCString& msg, const QByteArray& data );
233 233
234 234
235 signals: 235 signals:
236 void callContactdialog(); 236 void callContactdialog();
237 void nextView(); 237 void nextView();
238 void doRingSync();
238 // Emmitted when the target app receives a request from the source app 239 // Emmitted when the target app receives a request from the source app
239 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid); 240 void requestForNameEmailUidList(const QString& sourceChannel, const QString& uid);
240 241
241 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 242 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
242 // The first parameter is a uniqueid. It can be used to identify the event 243 // The first parameter is a uniqueid. It can be used to identify the event
243 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 244 void receivedNameEmailUidListEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
244 245
245 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email); 246 void requestFindByEmail(const QString& sourceChannel, const QString& uid, const QString& email);
246 void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList); 247 void receivedFindByEmailEvent(const QString& uid, const QStringList& nameList, const QStringList& emailList, const QStringList& uidList);
247 248
248 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid); 249 void requestForDetails(const QString& sourceChannel, const QString& sessionuid, const QString& name, const QString& email, const QString& uid);
249 250
250 251
251 // Emmitted when the target app receives a request from the source app 252 // Emmitted when the target app receives a request from the source app
252 void requestForBirthdayList(const QString& sourceChannel, const QString& uid); 253 void requestForBirthdayList(const QString& sourceChannel, const QString& uid);
253 254
254 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi 255 // Emitted when the source app recieves a list of name/email pairs (=addresses) from another target app. Usually Ka/Pi
255 // The first parameter is a uniqueid. It can be used to identify the event 256 // The first parameter is a uniqueid. It can be used to identify the event
256 void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList, 257 void receivedBirthdayListEvent(const QString& uid, const QStringList& birthdayList,
257 const QStringList& anniversaryList, const QStringList& realNameList, 258 const QStringList& anniversaryList, const QStringList& realNameList,
258 const QStringList& emailList, const QStringList& assembledNameList, 259 const QStringList& emailList, const QStringList& assembledNameList,
259 const QStringList& uidList); 260 const QStringList& uidList);
260 261
261 262
262 private: 263 private:
263 ExternalAppHandler(); 264 ExternalAppHandler();
264 QList<DefaultAppItem> mDefaultItems; 265 QList<DefaultAppItem> mDefaultItems;
265 266
266 Availability mEmailAppAvailable; 267 Availability mEmailAppAvailable;
267 Availability mPhoneAppAvailable; 268 Availability mPhoneAppAvailable;
268 Availability mFaxAppAvailable; 269 Availability mFaxAppAvailable;
269 Availability mSMSAppAvailable; 270 Availability mSMSAppAvailable;
270 Availability mPagerAppAvailable; 271 Availability mPagerAppAvailable;
271 Availability mSIPAppAvailable; 272 Availability mSIPAppAvailable;
272 273
273 QCopListTransferItem* mNameEmailUidListFromKAPITransfer; 274 QCopListTransferItem* mNameEmailUidListFromKAPITransfer;
274 QCopListTransferItem* mFindByEmailFromKAPITransfer; 275 QCopListTransferItem* mFindByEmailFromKAPITransfer;
275 QCopTransferItem* mDisplayDetails; 276 QCopTransferItem* mDisplayDetails;
276 QCopListTransferItem* mBirthdayListFromKAPITransfer; 277 QCopListTransferItem* mBirthdayListFromKAPITransfer;
277 278
278 279
279 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2); 280 void addDefaultAppItem(Types type, int id, const QString& label, const QString& channel, const QString& message, const QString& parameters, const QString& message2, const QString& parameters2);
280 281
281 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const; 282 QString& translateMessage(QString& message, const QString& param1, const QString& param2) const;
282 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const; 283 void passParameters(QCopEnvelope* e, const QString& parameters, const QString& param1, const QString& param2) const;
283 284
284 285
285 static ExternalAppHandler *sInstance; 286 static ExternalAppHandler *sInstance;
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index db815d6..038e032 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -476,104 +476,106 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
476 QString mess; 476 QString mess;
477 if ( !info. exists() ) { 477 if ( !info. exists() ) {
478 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); 478 mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) );
479 QMessageBox::warning( mParent, i18n("Warning!"), 479 QMessageBox::warning( mParent, i18n("Warning!"),
480 mess ); 480 mess );
481 return ret; 481 return ret;
482 } 482 }
483 int result = 0; 483 int result = 0;
484 if ( !quick ) { 484 if ( !quick ) {
485 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false )); 485 mess = i18n("Sync with file \n...%1\nfrom:\n%2\n").arg(fn.right( 25)).arg(KGlobal::locale()->formatDateTime(info.lastModified (), true, false ));
486 result = QMessageBox::warning( mParent, i18n("Warning!"), 486 result = QMessageBox::warning( mParent, i18n("Warning!"),
487 mess, 487 mess,
488 i18n("Sync"), i18n("Cancel"), 0, 488 i18n("Sync"), i18n("Cancel"), 0,
489 0, 1 ); 489 0, 1 );
490 if ( result ) 490 if ( result )
491 return false; 491 return false;
492 } 492 }
493 if ( mAskForPreferences ) 493 if ( mAskForPreferences )
494 if ( !edit_sync_options()) { 494 if ( !edit_sync_options()) {
495 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") ); 495 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
496 return false; 496 return false;
497 } 497 }
498 if ( result == 0 ) { 498 if ( result == 0 ) {
499 //qDebug("Now sycing ... "); 499 //qDebug("Now sycing ... ");
500 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 500 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
501 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); 501 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
502 else 502 else
503 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") ); 503 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed.") );
504 if ( ! quick ) 504 if ( ! quick )
505 mPrefs->mLastSyncedLocalFile = fn; 505 mPrefs->mLastSyncedLocalFile = fn;
506 } 506 }
507 return ret; 507 return ret;
508} 508}
509 509
510void KSyncManager::quickSyncLocalFile() 510void KSyncManager::quickSyncLocalFile()
511{ 511{
512 512
513 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) { 513 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, true ) ) {
514 qDebug("KSM::quick syncLocalFile() successful "); 514 qDebug("KSM::quick syncLocalFile() successful ");
515 515
516 } 516 }
517} 517}
518 518
519void KSyncManager::multiSync( bool askforPrefs ) 519void KSyncManager::multiSync( bool askforPrefs )
520{ 520{
521 if (blockSave()) 521 if (blockSave())
522 return; 522 return;
523 setBlockSave(true); 523 setBlockSave(true);
524 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 524 if ( askforPrefs ) {
525 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), 525 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
526 question, 526 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
527 i18n("Yes"), i18n("No"), 527 question,
528 0, 0 ) != 0 ) { 528 i18n("Yes"), i18n("No"),
529 setBlockSave(false); 529 0, 0 ) != 0 ) {
530 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!")); 530 setBlockSave(false);
531 return; 531 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
532 return;
533 }
532 } 534 }
533 mCurrentSyncDevice = i18n("Multiple profiles") ; 535 mCurrentSyncDevice = i18n("Multiple profiles") ;
534 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; 536 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
535 if ( askforPrefs ) { 537 if ( askforPrefs ) {
536 if ( !edit_sync_options()) { 538 if ( !edit_sync_options()) {
537 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") ); 539 mParent->topLevelWidget()->setCaption( i18n("Syncing aborted.") );
538 return; 540 return;
539 } 541 }
540 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs; 542 mPrefs->mRingSyncAlgoPrefs = mSyncAlgoPrefs;
541 } 543 }
542 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") ); 544 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
543 qApp->processEvents(); 545 qApp->processEvents();
544 int num = ringSync() ; 546 int num = ringSync() ;
545 if ( num > 1 ) 547 if ( num > 1 )
546 ringSync(); 548 ringSync();
547 setBlockSave(false); 549 setBlockSave(false);
548 if ( num ) 550 if ( num )
549 emit save(); 551 emit save();
550 if ( num ) 552 if ( num )
551 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); 553 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
552 else 554 else
553 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 555 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
554 return; 556 return;
555} 557}
556 558
557int KSyncManager::ringSync() 559int KSyncManager::ringSync()
558{ 560{
559 561
560 int syncedProfiles = 0; 562 int syncedProfiles = 0;
561 unsigned int i; 563 unsigned int i;
562 QTime timer; 564 QTime timer;
563 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 565 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
564 QStringList syncProfileNames = mSyncProfileNames; 566 QStringList syncProfileNames = mSyncProfileNames;
565 KSyncProfile* temp = new KSyncProfile (); 567 KSyncProfile* temp = new KSyncProfile ();
566 mAskForPreferences = false; 568 mAskForPreferences = false;
567 for ( i = 0; i < syncProfileNames.count(); ++i ) { 569 for ( i = 0; i < syncProfileNames.count(); ++i ) {
568 mCurrentSyncProfile = i; 570 mCurrentSyncProfile = i;
569 temp->setName(syncProfileNames[mCurrentSyncProfile]); 571 temp->setName(syncProfileNames[mCurrentSyncProfile]);
570 temp->readConfig(&config); 572 temp->readConfig(&config);
571 573
572 bool includeInRingSync = false; 574 bool includeInRingSync = false;
573 switch(mTargetApp) 575 switch(mTargetApp)
574 { 576 {
575 case (KAPI): 577 case (KAPI):
576 includeInRingSync = temp->getIncludeInRingSyncAB(); 578 includeInRingSync = temp->getIncludeInRingSyncAB();
577 break; 579 break;
578 case (KOPI): 580 case (KOPI):
579 includeInRingSync = temp->getIncludeInRingSync(); 581 includeInRingSync = temp->getIncludeInRingSync();