summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-01-13 03:53:45 (UTC)
committer zautrix <zautrix>2005-01-13 03:53:45 (UTC)
commit7d00f1441b5e1270dcd447bfb7920dbd3a21503d (patch) (unidiff)
tree8eb3b053e8104914021eff6f39772024784fff64
parent7a4a866cded40032766acb4fe8d02b6347b1d12e (diff)
downloadkdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.zip
kdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.tar.gz
kdepimpi-7d00f1441b5e1270dcd447bfb7920dbd3a21503d.tar.bz2
sync dialog fixes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/calendarview.cpp6
-rw-r--r--libkcal/syncdefines.h6
-rw-r--r--libkdepim/ksyncmanager.cpp10
-rw-r--r--libkdepim/ksyncmanager.h1
-rw-r--r--libkdepim/ksyncprefsdialog.cpp333
-rw-r--r--libkdepim/ksyncprefsdialog.h6
-rw-r--r--libkdepim/ksyncprofile.cpp4
-rw-r--r--libkdepim/ksyncprofile.h3
8 files changed, 218 insertions, 151 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index 7ddbe23..363dc32 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1130,109 +1130,109 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
1130 inR = inL->clone(); 1130 inR = inL->clone();
1131 inR->setIDStr( ":" ); 1131 inR->setIDStr( ":" );
1132 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL ); 1132 inR->setTempSyncStat( SYNC_TEMPSTATE_INITIAL );
1133 remote->addIncidence( inR ); 1133 remote->addIncidence( inR );
1134 } 1134 }
1135 } 1135 }
1136 } else { 1136 } else {
1137 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) { 1137 if ( inL->lastModified() < mLastCalendarSync && mode != 4 ) {
1138 checkExternSyncEvent(eventLSyncSharp, inL); 1138 checkExternSyncEvent(eventLSyncSharp, inL);
1139 local->deleteIncidence( inL ); 1139 local->deleteIncidence( inL );
1140 ++deletedEventL; 1140 ++deletedEventL;
1141 } else { 1141 } else {
1142 if ( ! mSyncManager->mWriteBackExistingOnly ) { 1142 if ( ! mSyncManager->mWriteBackExistingOnly ) {
1143 ++addedEventR; 1143 ++addedEventR;
1144 inL->setLastModified( modifiedCalendar ); 1144 inL->setLastModified( modifiedCalendar );
1145 inR = inL->clone(); 1145 inR = inL->clone();
1146 inR->setIDStr( ":" ); 1146 inR->setIDStr( ":" );
1147 remote->addIncidence( inR ); 1147 remote->addIncidence( inR );
1148 } 1148 }
1149 } 1149 }
1150 } 1150 }
1151 } 1151 }
1152 } 1152 }
1153 inL = el.next(); 1153 inL = el.next();
1154 } 1154 }
1155 int delFut = 0; 1155 int delFut = 0;
1156 int remRem = 0; 1156 int remRem = 0;
1157 if ( mSyncManager->mWriteBackInFuture ) { 1157 if ( mSyncManager->mWriteBackInFuture ) {
1158 er = remote->rawIncidences(); 1158 er = remote->rawIncidences();
1159 remRem = er.count(); 1159 remRem = er.count();
1160 inR = er.first(); 1160 inR = er.first();
1161 QDateTime dt; 1161 QDateTime dt;
1162 QDateTime cur = QDateTime::currentDateTime().addDays( -7 ); 1162 QDateTime cur = QDateTime::currentDateTime().addDays( -(mSyncManager->mWriteBackInPast * 7) );
1163 QDateTime end = cur.addDays( (mSyncManager->mWriteBackInFuture +1 ) *7 ); 1163 QDateTime end = QDateTime::currentDateTime().addDays( (mSyncManager->mWriteBackInFuture ) *7 );
1164 while ( inR ) { 1164 while ( inR ) {
1165 if ( inR->type() == "Todo" ) { 1165 if ( inR->type() == "Todo" ) {
1166 Todo * t = (Todo*)inR; 1166 Todo * t = (Todo*)inR;
1167 if ( t->hasDueDate() ) 1167 if ( t->hasDueDate() )
1168 dt = t->dtDue(); 1168 dt = t->dtDue();
1169 else 1169 else
1170 dt = cur.addSecs( 62 ); 1170 dt = cur.addSecs( 62 );
1171 } 1171 }
1172 else if (inR->type() == "Event" ) { 1172 else if (inR->type() == "Event" ) {
1173 bool ok; 1173 bool ok;
1174 dt = inR->getNextOccurence( cur, &ok ); 1174 dt = inR->getNextOccurence( cur, &ok );
1175 if ( !ok ) 1175 if ( !ok )
1176 dt = cur.addSecs( -62 ); 1176 dt = cur.addSecs( -62 );
1177 } 1177 }
1178 else 1178 else
1179 dt = inR->dtStart(); 1179 dt = inR->dtStart();
1180 if ( dt < cur || dt > end ) { 1180 if ( dt < cur || dt > end ) {
1181 remote->deleteIncidence( inR ); 1181 remote->deleteIncidence( inR );
1182 ++delFut; 1182 ++delFut;
1183 } 1183 }
1184 inR = er.next(); 1184 inR = er.next();
1185 } 1185 }
1186 } 1186 }
1187 bar.hide(); 1187 bar.hide();
1188 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 ); 1188 mLastCalendarSync = QDateTime::currentDateTime().addSecs( 1 );
1189 eventLSync->setReadOnly( false ); 1189 eventLSync->setReadOnly( false );
1190 eventLSync->setDtStart( mLastCalendarSync ); 1190 eventLSync->setDtStart( mLastCalendarSync );
1191 eventRSync->setDtStart( mLastCalendarSync ); 1191 eventRSync->setDtStart( mLastCalendarSync );
1192 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1192 eventLSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1193 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) ); 1193 eventRSync->setDtEnd( mLastCalendarSync.addSecs( 3600 ) );
1194 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ; 1194 eventRSync->setLocation( i18n("Remote from: ")+mCurrentSyncName ) ;
1195 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName ); 1195 eventLSync->setLocation(i18n("Local from: ") + mCurrentSyncName );
1196 eventLSync->setReadOnly( true ); 1196 eventLSync->setReadOnly( true );
1197 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() ); 1197 qDebug("********** %d %d ", mGlobalSyncMode == SYNC_MODE_NORMAL, mSyncManager->syncWithDesktop() );
1198 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal... 1198 if ( mGlobalSyncMode == SYNC_MODE_NORMAL && !mSyncManager->syncWithDesktop()) // kde is abnormal...
1199 remote->addEvent( eventRSync ); 1199 remote->addEvent( eventRSync );
1200 else 1200 else
1201 delete eventRSync; 1201 delete eventRSync;
1202 QString mes; 1202 QString mes;
1203 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR ); 1203 mes .sprintf( i18n("Synchronization summary:\n\n %d items added to local\n %d items added to remote\n %d items updated on local\n %d items updated on remote\n %d items deleted on local\n %d items deleted on remote\n"),addedEvent, addedEventR, changedLocal, changedRemote, deletedEventL, deletedEventR );
1204 QString delmess; 1204 QString delmess;
1205 if ( delFut ) { 1205 if ( delFut ) {
1206 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInFuture, remRem-delFut); 1206 delmess.sprintf( i18n("%d items skipped on remote,\nbecause they are more\nthan %d weeks in the past or\nmore than %d weeks in the future.\nAfter skipping, remote has\n%d calendar/todo items."), delFut,mSyncManager->mWriteBackInPast,mSyncManager->mWriteBackInFuture, remRem-delFut);
1207 mes += delmess; 1207 mes += delmess;
1208 } 1208 }
1209 mes = i18n("Local calendar changed!\n") +mes; 1209 mes = i18n("Local calendar changed!\n") +mes;
1210 mCalendar->checkAlarmForIncidence( 0, true ); 1210 mCalendar->checkAlarmForIncidence( 0, true );
1211 qDebug( mes ); 1211 qDebug( mes );
1212 if ( mSyncManager->mShowSyncSummary ) { 1212 if ( mSyncManager->mShowSyncSummary ) {
1213 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes, 1213 if ( KMessageBox::Cancel == KMessageBox::warningContinueCancel(this, mes,
1214 i18n("KO/Pi Synchronization"),i18n("Write back"))) { 1214 i18n("KO/Pi Synchronization"),i18n("Write back"))) {
1215 qDebug("cancelled "); 1215 qDebug("cancelled ");
1216 return false; 1216 return false;
1217 } 1217 }
1218 } 1218 }
1219 return syncOK; 1219 return syncOK;
1220} 1220}
1221 1221
1222void CalendarView::setSyncDevice( QString s ) 1222void CalendarView::setSyncDevice( QString s )
1223{ 1223{
1224 mCurrentSyncDevice= s; 1224 mCurrentSyncDevice= s;
1225} 1225}
1226void CalendarView::setSyncName( QString s ) 1226void CalendarView::setSyncName( QString s )
1227{ 1227{
1228 mCurrentSyncName= s; 1228 mCurrentSyncName= s;
1229} 1229}
1230bool CalendarView::syncCalendar(QString filename, int mode) 1230bool CalendarView::syncCalendar(QString filename, int mode)
1231{ 1231{
1232 //qDebug("syncCalendar %s ", filename.latin1()); 1232 //qDebug("syncCalendar %s ", filename.latin1());
1233 mGlobalSyncMode = SYNC_MODE_NORMAL; 1233 mGlobalSyncMode = SYNC_MODE_NORMAL;
1234 CalendarLocal* calendar = new CalendarLocal(); 1234 CalendarLocal* calendar = new CalendarLocal();
1235 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId); 1235 calendar->setTimeZoneId(KPimGlobalPrefs::instance()->mTimeZoneId);
1236 FileStorage* storage = new FileStorage( calendar ); 1236 FileStorage* storage = new FileStorage( calendar );
1237 bool syncOK = false; 1237 bool syncOK = false;
1238 storage->setFileName( filename ); 1238 storage->setFileName( filename );
diff --git a/libkcal/syncdefines.h b/libkcal/syncdefines.h
index 704a670..f3204a2 100644
--- a/libkcal/syncdefines.h
+++ b/libkcal/syncdefines.h
@@ -1,24 +1,30 @@
1 1
2#ifndef _KSYNC_DEFINES_H_ 2#ifndef _KSYNC_DEFINES_H_
3#define _KSYNC_DEFINES_H_ 3#define _KSYNC_DEFINES_H_
4 4
5 enum TargetApp {
6 KOPI = 0,
7 KAPI = 1,
8 PWMPI = 2 };
9
10
5#define SYNC_PREF_LOCAL 0 11#define SYNC_PREF_LOCAL 0
6#define SYNC_PREF_REMOTE 1 12#define SYNC_PREF_REMOTE 1
7#define SYNC_PREF_NEWEST 2 13#define SYNC_PREF_NEWEST 2
8#define SYNC_PREF_ASK 3 14#define SYNC_PREF_ASK 3
9#define SYNC_PREF_FORCE_LOCAL 4 15#define SYNC_PREF_FORCE_LOCAL 4
10#define SYNC_PREF_FORCE_REMOTE 5 16#define SYNC_PREF_FORCE_REMOTE 5
11#define SYNC_PREF_TAKE_BOTH 6 17#define SYNC_PREF_TAKE_BOTH 6
12 18
13#define SYNC_MODE_NORMAL 0 19#define SYNC_MODE_NORMAL 0
14#define SYNC_MODE_EXTERNAL 1 20#define SYNC_MODE_EXTERNAL 1
15 21
16#define SYNC_TEMPSTATE_INITIAL 0 22#define SYNC_TEMPSTATE_INITIAL 0
17#define SYNC_TEMPSTATE_ADDED_EXTERNAL -1 23#define SYNC_TEMPSTATE_ADDED_EXTERNAL -1
18#define SYNC_TEMPSTATE_NEW_EXTERNAL -2 24#define SYNC_TEMPSTATE_NEW_EXTERNAL -2
19#define SYNC_TEMPSTATE_DELETE -3 25#define SYNC_TEMPSTATE_DELETE -3
20#define SYNC_TEMPSTATE_NEW_ID -4 26#define SYNC_TEMPSTATE_NEW_ID -4
21#define SYNC_TEMPSTATE_NEW_CSUM -5 27#define SYNC_TEMPSTATE_NEW_CSUM -5
22 28
23 29
24#endif 30#endif
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 6f68d84..33b4a65 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -35,65 +35,65 @@
35#include <kmessagebox.h> 35#include <kmessagebox.h>
36 36
37#include <qdir.h> 37#include <qdir.h>
38#include <qprogressbar.h> 38#include <qprogressbar.h>
39#include <qpopupmenu.h> 39#include <qpopupmenu.h>
40#include <qpushbutton.h> 40#include <qpushbutton.h>
41#include <qradiobutton.h> 41#include <qradiobutton.h>
42#include <qbuttongroup.h> 42#include <qbuttongroup.h>
43#include <qtimer.h> 43#include <qtimer.h>
44#include <qmessagebox.h> 44#include <qmessagebox.h>
45#include <qapplication.h> 45#include <qapplication.h>
46#include <qlineedit.h> 46#include <qlineedit.h>
47#include <qdialog.h> 47#include <qdialog.h>
48#include <qlayout.h> 48#include <qlayout.h>
49#include <qtextcodec.h> 49#include <qtextcodec.h>
50#include <qlabel.h> 50#include <qlabel.h>
51#include <qcheckbox.h> 51#include <qcheckbox.h>
52 52
53#include <klocale.h> 53#include <klocale.h>
54#include <kglobal.h> 54#include <kglobal.h>
55#include <kconfig.h> 55#include <kconfig.h>
56#include <kfiledialog.h> 56#include <kfiledialog.h>
57 57
58QDateTime KSyncManager::mRequestedSyncEvent; 58QDateTime KSyncManager::mRequestedSyncEvent;
59 59
60 60
61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu) 61KSyncManager::KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu)
62 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu) 62 : QObject(), mParent(parent), mImplementation(implementation), mTargetApp(ta), mPrefs(prefs ),mSyncMenu(syncmenu)
63{ 63{
64 mServerSocket = 0; 64 mServerSocket = 0;
65 bar = new QProgressBar ( 1, 0 ); 65 bar = new QProgressBar ( 1, 0 );
66 bar->setCaption (""); 66 bar->setCaption ("");
67 67 mWriteBackInPast = 2;
68 int w = 300; 68 int w = 300;
69 if ( QApplication::desktop()->width() < 320 ) 69 if ( QApplication::desktop()->width() < 320 )
70 w = 220; 70 w = 220;
71 int h = bar->sizeHint().height() ; 71 int h = bar->sizeHint().height() ;
72 int dw = QApplication::desktop()->width(); 72 int dw = QApplication::desktop()->width();
73 int dh = QApplication::desktop()->height(); 73 int dh = QApplication::desktop()->height();
74 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h ); 74 bar->setGeometry( (dw-w)/2, (dh - h )/2 ,w,h );
75 if ( mPrefs->mPassiveSyncAutoStart ) 75 if ( mPrefs->mPassiveSyncAutoStart )
76 enableQuick( false ); 76 enableQuick( false );
77 77
78} 78}
79 79
80KSyncManager::~KSyncManager() 80KSyncManager::~KSyncManager()
81{ 81{
82 delete bar; 82 delete bar;
83} 83}
84 84
85 85
86void KSyncManager::fillSyncMenu() 86void KSyncManager::fillSyncMenu()
87{ 87{
88 if ( mSyncMenu->count() ) 88 if ( mSyncMenu->count() )
89 mSyncMenu->clear(); 89 mSyncMenu->clear();
90 90
91 mSyncMenu->insertItem( i18n("Configure..."), 0 ); 91 mSyncMenu->insertItem( i18n("Configure..."), 0 );
92 mSyncMenu->insertSeparator(); 92 mSyncMenu->insertSeparator();
93 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu ); 93 QPopupMenu *clearMenu = new QPopupMenu ( mSyncMenu );
94 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 ); 94 mSyncMenu->insertItem( i18n("Remove sync info"),clearMenu, 5000 );
95 clearMenu->insertItem( i18n("For all profiles"), 1 ); 95 clearMenu->insertItem( i18n("For all profiles"), 1 );
96 clearMenu->insertSeparator(); 96 clearMenu->insertSeparator();
97 connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) ); 97 connect ( clearMenu, SIGNAL( activated ( int ) ), this, SLOT (slotClearMenu( int ) ) );
98 mSyncMenu->insertSeparator(); 98 mSyncMenu->insertSeparator();
99 if ( mServerSocket == 0 ) { 99 if ( mServerSocket == 0 ) {
@@ -219,66 +219,68 @@ void KSyncManager::slotSyncMenu( int action )
219 return; 219 return;
220 220
221 setBlockSave(true); 221 setBlockSave(true);
222 bool silent = false; 222 bool silent = false;
223 if ( action == 999 ) { 223 if ( action == 999 ) {
224 //special mode for silent syncing 224 //special mode for silent syncing
225 action = 1000; 225 action = 1000;
226 silent = true; 226 silent = true;
227 } 227 }
228 228
229 mCurrentSyncProfile = action - 1000 ; 229 mCurrentSyncProfile = action - 1000 ;
230 mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ; 230 mCurrentSyncDevice = mSyncProfileNames[mCurrentSyncProfile] ;
231 mCurrentSyncName = mLocalMachineName ; 231 mCurrentSyncName = mLocalMachineName ;
232 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 232 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
233 KSyncProfile* temp = new KSyncProfile (); 233 KSyncProfile* temp = new KSyncProfile ();
234 temp->setName(mSyncProfileNames[mCurrentSyncProfile]); 234 temp->setName(mSyncProfileNames[mCurrentSyncProfile]);
235 temp->readConfig(&config); 235 temp->readConfig(&config);
236 if (silent) { 236 if (silent) {
237 mAskForPreferences = false; 237 mAskForPreferences = false;
238 mShowSyncSummary = false; 238 mShowSyncSummary = false;
239 mWriteBackFile = true; 239 mWriteBackFile = true;
240 mSyncAlgoPrefs = 2;// take newest 240 mSyncAlgoPrefs = 2;// take newest
241 } 241 }
242 else { 242 else {
243 mAskForPreferences = temp->getAskForPreferences(); 243 mAskForPreferences = temp->getAskForPreferences();
244 mShowSyncSummary = temp->getShowSummaryAfterSync(); 244 mShowSyncSummary = temp->getShowSummaryAfterSync();
245 mWriteBackFile = temp->getWriteBackFile(); 245 mWriteBackFile = temp->getWriteBackFile();
246 mSyncAlgoPrefs = temp->getSyncPrefs(); 246 mSyncAlgoPrefs = temp->getSyncPrefs();
247 } 247 }
248 mWriteBackExistingOnly = temp->getWriteBackExisting(); 248 mWriteBackExistingOnly = temp->getWriteBackExisting();
249 mIsKapiFile = temp->getIsKapiFile(); 249 mIsKapiFile = temp->getIsKapiFile();
250 mWriteBackInFuture = 0; 250 mWriteBackInFuture = 0;
251 if ( temp->getWriteBackFuture() ) 251 if ( temp->getWriteBackFuture() ) {
252 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 252 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
253 mWriteBackInPast = temp->getWriteBackPastWeeks( );
254 }
253 255
254 if ( action == 1000 ) { 256 if ( action == 1000 ) {
255 mIsKapiFile = false; 257 mIsKapiFile = false;
256#ifdef DESKTOP_VERSION 258#ifdef DESKTOP_VERSION
257 syncKDE(); 259 syncKDE();
258#else 260#else
259 syncSharp(); 261 syncSharp();
260#endif 262#endif
261 263
262 } else if ( action == 1001 ) { 264 } else if ( action == 1001 ) {
263 syncLocalFile(); 265 syncLocalFile();
264 266
265 } else if ( action == 1002 ) { 267 } else if ( action == 1002 ) {
266 mWriteBackFile = false; 268 mWriteBackFile = false;
267 mAskForPreferences = false; 269 mAskForPreferences = false;
268 mShowSyncSummary = false; 270 mShowSyncSummary = false;
269 mSyncAlgoPrefs = 3; 271 mSyncAlgoPrefs = 3;
270 quickSyncLocalFile(); 272 quickSyncLocalFile();
271 273
272 } else if ( action >= 1003 ) { 274 } else if ( action >= 1003 ) {
273 if ( temp->getIsLocalFileSync() ) { 275 if ( temp->getIsLocalFileSync() ) {
274 switch(mTargetApp) 276 switch(mTargetApp)
275 { 277 {
276 case (KAPI): 278 case (KAPI):
277 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 279 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
278 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 280 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
279 break; 281 break;
280 case (KOPI): 282 case (KOPI):
281 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 283 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
282 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 284 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
283 break; 285 break;
284 case (PWMPI): 286 case (PWMPI):
@@ -549,66 +551,68 @@ int KSyncManager::ringSync()
549 mCurrentSyncProfile = i; 551 mCurrentSyncProfile = i;
550 temp->setName(syncProfileNames[mCurrentSyncProfile]); 552 temp->setName(syncProfileNames[mCurrentSyncProfile]);
551 temp->readConfig(&config); 553 temp->readConfig(&config);
552 554
553 bool includeInRingSync; 555 bool includeInRingSync;
554 switch(mTargetApp) 556 switch(mTargetApp)
555 { 557 {
556 case (KAPI): 558 case (KAPI):
557 includeInRingSync = temp->getIncludeInRingSyncAB(); 559 includeInRingSync = temp->getIncludeInRingSyncAB();
558 break; 560 break;
559 case (KOPI): 561 case (KOPI):
560 includeInRingSync = temp->getIncludeInRingSync(); 562 includeInRingSync = temp->getIncludeInRingSync();
561 break; 563 break;
562 case (PWMPI): 564 case (PWMPI):
563 includeInRingSync = temp->getIncludeInRingSyncPWM(); 565 includeInRingSync = temp->getIncludeInRingSyncPWM();
564 break; 566 break;
565 default: 567 default:
566 qDebug("KSyncManager::ringSync: invalid apptype selected"); 568 qDebug("KSyncManager::ringSync: invalid apptype selected");
567 break; 569 break;
568 570
569 } 571 }
570 572
571 573
572 if ( includeInRingSync && ( i < 1 || i > 2 )) { 574 if ( includeInRingSync && ( i < 1 || i > 2 )) {
573 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 575 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
574 ++syncedProfiles; 576 ++syncedProfiles;
575 mSyncWithDesktop = false; 577 mSyncWithDesktop = false;
576 // mAskForPreferences = temp->getAskForPreferences(); 578 // mAskForPreferences = temp->getAskForPreferences();
577 mWriteBackFile = temp->getWriteBackFile(); 579 mWriteBackFile = temp->getWriteBackFile();
578 mWriteBackExistingOnly = temp->getWriteBackExisting(); 580 mWriteBackExistingOnly = temp->getWriteBackExisting();
579 mIsKapiFile = temp->getIsKapiFile(); 581 mIsKapiFile = temp->getIsKapiFile();
580 mWriteBackInFuture = 0; 582 mWriteBackInFuture = 0;
581 if ( temp->getWriteBackFuture() ) 583 if ( temp->getWriteBackFuture() ) {
582 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 584 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
585 mWriteBackInPast = temp->getWriteBackPastWeeks( );
586 }
583 mShowSyncSummary = false; 587 mShowSyncSummary = false;
584 mCurrentSyncDevice = syncProfileNames[i] ; 588 mCurrentSyncDevice = syncProfileNames[i] ;
585 mCurrentSyncName = mLocalMachineName; 589 mCurrentSyncName = mLocalMachineName;
586 if ( i == 0 ) { 590 if ( i == 0 ) {
587 mIsKapiFile = false; 591 mIsKapiFile = false;
588#ifdef DESKTOP_VERSION 592#ifdef DESKTOP_VERSION
589 syncKDE(); 593 syncKDE();
590#else 594#else
591 syncSharp(); 595 syncSharp();
592#endif 596#endif
593 } else { 597 } else {
594 if ( temp->getIsLocalFileSync() ) { 598 if ( temp->getIsLocalFileSync() ) {
595 switch(mTargetApp) 599 switch(mTargetApp)
596 { 600 {
597 case (KAPI): 601 case (KAPI):
598 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 602 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
599 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 603 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
600 break; 604 break;
601 case (KOPI): 605 case (KOPI):
602 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 606 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
603 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); 607 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
604 break; 608 break;
605 case (PWMPI): 609 case (PWMPI):
606 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 610 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
607 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 611 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
608 break; 612 break;
609 default: 613 default:
610 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 614 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
611 break; 615 break;
612 } 616 }
613 } else { 617 } else {
614 if ( temp->getIsPhoneSync() ) { 618 if ( temp->getIsPhoneSync() ) {
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 6da0ee4..2d0a4ab 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -112,64 +112,65 @@ class KSyncManager : public QObject
112 PWMPI = 2 }; 112 PWMPI = 2 };
113 113
114 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu); 114 KSyncManager(QWidget* parent, KSyncInterface* implementation, TargetApp ta, KPimPrefs* prefs, QPopupMenu* syncmenu);
115 ~KSyncManager() ; 115 ~KSyncManager() ;
116 116
117 void multiSync( bool askforPrefs ); 117 void multiSync( bool askforPrefs );
118 bool blockSave() { return mBlockSaveFlag; } 118 bool blockSave() { return mBlockSaveFlag; }
119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; } 119 void setBlockSave(bool sa) { mBlockSaveFlag = sa; }
120 void setDefaultFileName( QString s) { mDefFileName = s ;} 120 void setDefaultFileName( QString s) { mDefFileName = s ;}
121 QString defaultFileName() { return mDefFileName ;} 121 QString defaultFileName() { return mDefFileName ;}
122 QString syncFileName(); 122 QString syncFileName();
123 void enableQuick( bool ask = true); 123 void enableQuick( bool ask = true);
124 124
125 bool syncWithDesktop () { return mSyncWithDesktop;} 125 bool syncWithDesktop () { return mSyncWithDesktop;}
126 QString getCurrentSyncDevice() { return mCurrentSyncDevice; } 126 QString getCurrentSyncDevice() { return mCurrentSyncDevice; }
127 QString getCurrentSyncName() { return mCurrentSyncName; } 127 QString getCurrentSyncName() { return mCurrentSyncName; }
128 128
129 void showProgressBar(int percentage, QString caption = QString::null, int total=100); 129 void showProgressBar(int percentage, QString caption = QString::null, int total=100);
130 void hideProgressBar(); 130 void hideProgressBar();
131 bool isProgressBarCanceled(); 131 bool isProgressBarCanceled();
132 132
133 // sync stuff 133 // sync stuff
134 QString mLocalMachineName; 134 QString mLocalMachineName;
135 QStringList mExternSyncProfiles; 135 QStringList mExternSyncProfiles;
136 QStringList mSyncProfileNames; 136 QStringList mSyncProfileNames;
137 bool mAskForPreferences; 137 bool mAskForPreferences;
138 bool mShowSyncSummary; 138 bool mShowSyncSummary;
139 bool mIsKapiFile; 139 bool mIsKapiFile;
140 bool mWriteBackExistingOnly; 140 bool mWriteBackExistingOnly;
141 int mSyncAlgoPrefs; 141 int mSyncAlgoPrefs;
142 bool mWriteBackFile; 142 bool mWriteBackFile;
143 int mWriteBackInFuture; 143 int mWriteBackInFuture;
144 int mWriteBackInPast;
144 QString mPhoneDevice; 145 QString mPhoneDevice;
145 QString mPhoneConnection; 146 QString mPhoneConnection;
146 QString mPhoneModel; 147 QString mPhoneModel;
147 QString mPassWordPiSync; 148 QString mPassWordPiSync;
148 QString mActiveSyncPort; 149 QString mActiveSyncPort;
149 QString mActiveSyncIP ; 150 QString mActiveSyncIP ;
150 static QDateTime mRequestedSyncEvent; 151 static QDateTime mRequestedSyncEvent;
151 152
152 signals: 153 signals:
153 void save(); 154 void save();
154 void request_file(); 155 void request_file();
155 void getFile( bool ); 156 void getFile( bool );
156 157
157 public slots: 158 public slots:
158 void slotSyncMenu( int ); 159 void slotSyncMenu( int );
159 void slotClearMenu( int action ); 160 void slotClearMenu( int action );
160 void deleteCommandSocket(KCommandSocket*s, int state); 161 void deleteCommandSocket(KCommandSocket*s, int state);
161 void readFileFromSocket(); 162 void readFileFromSocket();
162 void fillSyncMenu(); 163 void fillSyncMenu();
163 164
164 private: 165 private:
165 void syncPi(); 166 void syncPi();
166 KServerSocket * mServerSocket; 167 KServerSocket * mServerSocket;
167 KPimPrefs* mPrefs; 168 KPimPrefs* mPrefs;
168 QString mDefFileName; 169 QString mDefFileName;
169 QString mCurrentSyncDevice; 170 QString mCurrentSyncDevice;
170 QString mCurrentSyncName; 171 QString mCurrentSyncName;
171 void quickSyncLocalFile(); 172 void quickSyncLocalFile();
172 bool syncWithFile( QString fn , bool quick ); 173 bool syncWithFile( QString fn , bool quick );
173 void syncLocalFile(); 174 void syncLocalFile();
174 void syncPhone(); 175 void syncPhone();
175 void syncSharp(); 176 void syncSharp();
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 03265d2..8a3f4cf 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -14,64 +14,66 @@
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#include <qlayout.h> 24#include <qlayout.h>
25#include <qlabel.h> 25#include <qlabel.h>
26#include <qgroupbox.h> 26#include <qgroupbox.h>
27#include <qbuttongroup.h> 27#include <qbuttongroup.h>
28#include <qlineedit.h> 28#include <qlineedit.h>
29#include <qfont.h> 29#include <qfont.h>
30#include <qslider.h> 30#include <qslider.h>
31#include <qfile.h> 31#include <qfile.h>
32#include <qdir.h> 32#include <qdir.h>
33#include <qtextstream.h> 33#include <qtextstream.h>
34#include <qcombobox.h> 34#include <qcombobox.h>
35#include <qvbox.h> 35#include <qvbox.h>
36#include <qhbox.h> 36#include <qhbox.h>
37#include <qspinbox.h> 37#include <qspinbox.h>
38#include <qdatetime.h> 38#include <qdatetime.h>
39#include <qcheckbox.h> 39#include <qcheckbox.h>
40#include <qradiobutton.h> 40#include <qradiobutton.h>
41#include <qpushbutton.h> 41#include <qpushbutton.h>
42#include <qstrlist.h> 42#include <qstrlist.h>
43#include <qapplication.h> 43#include <qapplication.h>
44#include <qlayout.h> 44#include <qlayout.h>
45#include <qscrollview.h> 45#include <qscrollview.h>
46#include <qvgroupbox.h>
47#include <qhgroupbox.h>
46 48
47#include <kcolorbutton.h> 49#include <kcolorbutton.h>
48#include <kdebug.h> 50#include <kdebug.h>
49#include <klocale.h> 51#include <klocale.h>
50#include <kglobal.h> 52#include <kglobal.h>
51#include <kfontdialog.h> 53#include <kfontdialog.h>
52#include <kmessagebox.h> 54#include <kmessagebox.h>
53#include <kcolordialog.h> 55#include <kcolordialog.h>
54#include <kiconloader.h> 56#include <kiconloader.h>
55#include <kemailsettings.h> 57#include <kemailsettings.h>
56#include <kstandarddirs.h> 58#include <kstandarddirs.h>
57#include <kfiledialog.h> 59#include <kfiledialog.h>
58#include <kmessagebox.h> 60#include <kmessagebox.h>
59 61
60//#include <kurlrequester.h> 62//#include <kurlrequester.h>
61#include <klineedit.h> 63#include <klineedit.h>
62#include "ksyncprofile.h" 64#include "ksyncprofile.h"
63 65
64 66
65//#include "koprefs.h" 67//#include "koprefs.h"
66 68
67#include "ksyncprefsdialog.h" 69#include "ksyncprefsdialog.h"
68//#include "koglobals.h" 70//#include "koglobals.h"
69 71
70 72
71KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) : 73KSyncPrefsDialog::KSyncPrefsDialog(QWidget *parent, char *name, bool modal) :
72 KDialog(parent,name,true) 74 KDialog(parent,name,true)
73{ 75{
74 76
75 setCaption( i18n("Synchronization Preferences")); 77 setCaption( i18n("Synchronization Preferences"));
76 78
77 mSyncProfiles.setAutoDelete( true ); 79 mSyncProfiles.setAutoDelete( true );
@@ -112,234 +114,277 @@ void KSyncPrefsDialog::setupSyncAlgTab()
112 //topLayout->addMultiCellWidget(lab , iii,iii,0,1); 114 //topLayout->addMultiCellWidget(lab , iii,iii,0,1);
113 //++iii; 115 //++iii;
114 116
115 mMyMachineName = new QLineEdit(topFrame); 117 mMyMachineName = new QLineEdit(topFrame);
116 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame); 118 lab = new QLabel(mMyMachineName, i18n("Local device name:"), topFrame);
117 topLayout->addWidget(lab ,iii,0); 119 topLayout->addWidget(lab ,iii,0);
118 topLayout->addWidget(mMyMachineName,iii,1); 120 topLayout->addWidget(mMyMachineName,iii,1);
119 ++iii; 121 ++iii;
120 122
121 QHBox* buttonbox = new QHBox( topFrame); 123 QHBox* buttonbox = new QHBox( topFrame);
122 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1); 124 topLayout->addMultiCellWidget(buttonbox, iii,iii,0,1);
123 ++iii; 125 ++iii;
124 button = new QPushButton( i18n("New profile"), buttonbox ); 126 button = new QPushButton( i18n("New profile"), buttonbox );
125 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) ); 127 connect ( button, SIGNAL( clicked()), this, SLOT (newProfile() ) );
126 128
127 button = new QPushButton( i18n("Clone profile"), buttonbox ); 129 button = new QPushButton( i18n("Clone profile"), buttonbox );
128 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) ); 130 connect ( button, SIGNAL( clicked()), this, SLOT ( cloneProfile() ) );
129 131
130 button = new QPushButton( i18n("Delete profile"), buttonbox ); 132 button = new QPushButton( i18n("Delete profile"), buttonbox );
131 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) ); 133 connect ( button, SIGNAL( clicked()), this, SLOT (deleteProfile() ) );
132 134
133 mProfileBox = new QComboBox(topFrame); 135 mProfileBox = new QComboBox(topFrame);
134 mProfileBox->setEditable ( true ); 136 mProfileBox->setEditable ( true );
135 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion); 137 mProfileBox->setInsertionPolicy(QComboBox::NoInsertion);
136 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) ); 138 connect ( mProfileBox, SIGNAL(activated ( int ) ), this, SLOT (profileChanged( int ) ) );
137 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) ); 139 connect ( mProfileBox, SIGNAL( textChanged ( const QString & ) ), this, SLOT (textChanged( const QString & ) ) );
138 140
139 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame); 141 lab = new QLabel(mProfileBox, i18n("Profile:"), topFrame);
140 topLayout->addWidget(lab ,iii,0); 142 topLayout->addWidget(lab ,iii,0);
141 topLayout->addWidget(mProfileBox, iii,1); 143 topLayout->addWidget(mProfileBox, iii,1);
142 ++iii; 144 ++iii;
143 145
144 QHBox *iims = new QHBox( topFrame ); 146
147
148 QHGroupBox *iims = new QHGroupBox( i18n("Multiple Sync options"), topFrame);
145 new QLabel( i18n("Include in multiple "), iims ); 149 new QLabel( i18n("Include in multiple "), iims );
146 mIncludeInRing = new QCheckBox( i18n("calendar "), iims ); 150 mIncludeInRing = new QCheckBox( i18n("calendar "), iims );
147 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims ); 151 mIncludeInRingAB = new QCheckBox( i18n("addressbook "), iims );
148 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims ); 152 mIncludeInRingPWM = new QCheckBox( i18n("pwmanager"), iims );
149 new QLabel( i18n(" sync"), iims ); 153 new QLabel( i18n(" sync"), iims );
150 topLayout->addMultiCellWidget(iims, iii,iii,0,1); 154 topLayout->addMultiCellWidget(iims, iii,iii,0,1);
151 ++iii; 155 ++iii;
152 156 QVGroupBox* gb0 = new QVGroupBox( i18n("Sync algo options"), topFrame);
153 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame ); 157 topLayout->addMultiCellWidget(gb0, iii,iii,0,1);
154 topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
155 ++iii;
156 QButtonGroup* gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
157 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
158 ++iii;
159 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
160 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
161 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
162 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
163 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
164 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
165 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
166
167 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
168 topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
169 ++iii;
170
171 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
172 topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
173 ++iii; 158 ++iii;
159 QButtonGroup* gr;
160 {
161 QVGroupBox* topFrame = gb0;
162 mAskForPreferences = new QCheckBox( i18n("Ask for preferences before sync"), topFrame );
163 //topLayout->addMultiCellWidget(mAskForPreferences, iii,iii,0,1);
164 //++iii;
165 gr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Sync preferences"), topFrame);
166 //topLayout->addMultiCellWidget(gr, iii,iii,0,1);
167 //++iii;
168 loc = new QRadioButton ( i18n("Take local entry on conflict"), gr );
169 rem = new QRadioButton ( i18n("Take remote entry on conflict"), gr );
170 newest = new QRadioButton ( i18n("Take newest entry on conflict"), gr );
171 ask = new QRadioButton ( i18n("Ask for every entry on conflict"), gr );
172 f_loc= new QRadioButton ( i18n("Force: Take local entry always"), gr );
173 f_rem = new QRadioButton ( i18n("Force: Take remote entry always"), gr );
174 // both = new QRadioButton ( i18n("Take both on conflict"), gr );
175
176 mShowSummaryAfterSync = new QCheckBox( i18n("Show summary after sync"), topFrame );
177 //topLayout->addMultiCellWidget(mShowSummaryAfterSync, iii,iii,0,1);
178 //++iii;
179
180 mWriteBackFile = new QCheckBox( i18n("Write back synced data"), topFrame );
181 // topLayout->addMultiCellWidget(mWriteBackFile, iii,iii,0,1);
182 // ++iii;
174 183
175 mWriteBackExisting= new QCheckBox( i18n("-- Write back (on remote) existing entries only"), topFrame ); 184 QVGroupBox* gb2 = new QVGroupBox( i18n("Write back options"), topFrame);
176 topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1); 185 //topLayout->addMultiCellWidget(gb2, iii,iii,0,1);
177 ++iii; 186 //++iii;
178 187 {
179 mWriteBackFuture= new QCheckBox( i18n("-- Write back (calendar) entries in future only"), topFrame ); 188 QVGroupBox*topFrame = gb2;
180 topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1); 189 mWriteBackExisting= new QCheckBox( i18n("Write back (on remote) existing entries only"), topFrame );
181 ++iii; 190 //topLayout->addMultiCellWidget(mWriteBackExisting, iii,iii,0,1);
182 topLayout->addMultiCellWidget(new QLabel( i18n("---- Max. weeks in future: ") , topFrame ), iii,iii,0,0); 191 //++iii;
183 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, topFrame); 192 mWriteBackFuture= new QCheckBox( i18n("Write back (calendar) entries for time period only"), topFrame );
184 topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1); 193 //topLayout->addMultiCellWidget(mWriteBackFuture, iii,iii,0,1);
185 ++iii; 194 //++iii;
186 195 QHGroupBox* gb3 = new QHGroupBox( i18n("Time period"), topFrame);
196 connect ( mWriteBackFuture, SIGNAL( toggled ( bool ) ), gb3, SLOT ( setEnabled ( bool ) ) );
197 new QLabel( i18n("From ") , gb3 );
198 mWriteBackPastWeeks= new QSpinBox(1,104, 1, gb3);
199 new QLabel( i18n(" weeks in the past to ") , gb3 );
200 mWriteBackFutureWeeks= new QSpinBox(1,104, 1, gb3);
201 new QLabel( i18n(" weeks in the future ") , gb3 );
202 //topLayout->addMultiCellWidget(mWriteBackFutureWeeks, iii,iii,1,1);
203 //++iii;
204 gb3->setEnabled( false );
205 }
206 connect ( mWriteBackFile, SIGNAL( toggled ( bool ) ), gb2, SLOT ( setEnabled ( bool ) ) );
207
208 }
187 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame); 209 proGr = new QButtonGroup ( 1, Qt::Horizontal, i18n("Profile kind"), topFrame);
188 gr = proGr; 210 gr = proGr;
189 topLayout->addMultiCellWidget(gr, iii,iii,0,1); 211 topLayout->addMultiCellWidget(gr, iii,iii,0,1);
190 ++iii; 212 ++iii;
191 mIsLocal = new QRadioButton ( i18n("Local file"), gr ); 213 mIsLocal = new QRadioButton ( i18n("Local file"), gr );
192 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr ); 214 mIsPi = new QRadioButton ( i18n("Pi-Sync ( direct Kx/Pi to Kx/Pi sync )"), gr );
193 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 215 connect (mIsPi, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
194 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr ); 216 mIsNotLocal = new QRadioButton ( i18n("Remote file (w down/upload command)"), gr );
195 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 217 connect (mIsLocal, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
196 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr ); 218 mIsPhone = new QRadioButton ( i18n("Mobile device (cell phone)"), gr );
197 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) ); 219 connect (mIsPhone, SIGNAL( toggled(bool)), this, SLOT (kindChanged(bool) ) );
198 220
199 221 QVGroupBox* gb1 = new QVGroupBox( i18n("Profile kind specific settings"), topFrame);
200 phoneWidget = new QVBox( topFrame); 222 topLayout->addMultiCellWidget(gb1, iii,iii,0,1);
201 topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
202 ++iii;
203 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
204 QHBox* temphb = new QHBox( phoneWidget );
205 new QLabel( i18n("I/O device: "), temphb );
206 mPhoneDevice = new QLineEdit( temphb);
207 button = new QPushButton( i18n("Help..."), temphb );
208 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
209
210
211 temphb = new QHBox( phoneWidget );
212 new QLabel( i18n("Connection: "), temphb );
213 mPhoneConnection = new QLineEdit( temphb);
214 button = new QPushButton( i18n("Help..."), temphb );
215 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
216
217
218 temphb = new QHBox( phoneWidget );
219 new QLabel( i18n("Model(opt.): "), temphb );
220 mPhoneModel = new QLineEdit( temphb);
221 button = new QPushButton( i18n("Help..."), temphb );
222 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
223
224 // *** local
225 localFileWidget = new QVBox( topFrame);
226 topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
227 ++iii; 223 ++iii;
228 temphb = new QHBox( localFileWidget );
229
230 lab = new QLabel( i18n("Local file Cal:"), temphb );
231 lab = new QLabel( i18n("Local file ABook:"), temphb );
232 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
233 temphb = new QHBox( localFileWidget );
234 button = new QPushButton( i18n("Choose..."), temphb );
235 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
236 button = new QPushButton( i18n("Choose..."), temphb );
237 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
238 button = new QPushButton( i18n("Choose..."), temphb );
239 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
240 temphb = new QHBox( localFileWidget );
241
242 mRemoteFile = new QLineEdit( temphb);
243 mRemoteFileAB = new QLineEdit( temphb);
244 mRemoteFilePWM = new QLineEdit( temphb);
245 mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget );
246
247
248 // *** remote
249 remoteFileWidget = new QVBox( topFrame);
250 topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
251 ++iii;
252 temphb = new QHBox( remoteFileWidget );
253 new QLabel( i18n("Calendar:"), temphb);
254 new QLabel( i18n("AddressBook:"), temphb);
255 new QLabel( i18n("PWManager:"), temphb);
256
257 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
258 temphb = new QHBox( remoteFileWidget );
259 mRemotePrecommand = new QLineEdit(temphb);
260 mRemotePrecommandAB = new QLineEdit(temphb);
261 mRemotePrecommandPWM = new QLineEdit(temphb);
262
263 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
264 temphb = new QHBox( remoteFileWidget );
265 mLocalTempFile = new QLineEdit(temphb);
266 mLocalTempFileAB = new QLineEdit(temphb);
267 mLocalTempFilePWM = new QLineEdit(temphb);
268
269 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
270 temphb = new QHBox( remoteFileWidget );
271 mRemotePostcommand = new QLineEdit(temphb );
272 mRemotePostcommandAB = new QLineEdit(temphb );
273 mRemotePostcommandPWM = new QLineEdit(temphb );
274 mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget );
275 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
276 temphb = new QHBox( remoteFileWidget );
277 button = new QPushButton( i18n("ssh/scp"), temphb );
278 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
279 button = new QPushButton( i18n("ftp"), temphb );
280 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
281 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
282
283 // *** pi-sync
284 piWidget = new QVBox( topFrame);
285 topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
286 ++iii;
287 temphb = new QHBox( piWidget );
288 new QLabel( i18n("Calendar:"), temphb);
289 new QLabel( i18n("AddressBook:"), temphb);
290 new QLabel( i18n("PWManager:"), temphb);
291
292 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
293 temphb = new QHBox( piWidget );
294 mRemotePw = new QLineEdit(temphb);
295 mRemotePwAB = new QLineEdit(temphb);
296 mRemotePwPWM = new QLineEdit(temphb);
297
298 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
299 temphb = new QHBox( piWidget );
300 mRemoteIP = new QLineEdit(temphb);
301 mRemoteIPAB = new QLineEdit(temphb);
302 mRemoteIPPWM = new QLineEdit(temphb);
303
304 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
305 temphb = new QHBox( piWidget );
306 mRemotePort = new QLineEdit(temphb);
307 mRemotePortAB = new QLineEdit(temphb);
308 mRemotePortPWM = new QLineEdit(temphb);
309 224
225 // ******************************************
226 // Profile kind specific settings
227 {
228 // *** phone *******************************
229 QVGroupBox* topFrame = gb1;
230 phoneWidget = new QVBox( topFrame);
231 //topLayout->addMultiCellWidget(phoneWidget, iii,iii,0,1);
232 //++iii;
233 mWriteContactToSIM = 0;//new QCheckBox( i18n("Sync contacts with phone SIM card (If not, sync with phone memory)"), phoneWidget );
234 QHBox* temphb = new QHBox( phoneWidget );
235 new QLabel( i18n("I/O device: "), temphb );
236 mPhoneDevice = new QLineEdit( temphb);
237 button = new QPushButton( i18n("Help..."), temphb );
238 connect ( button, SIGNAL( clicked()), this, SLOT ( helpDevice() ) );
239
240
241 temphb = new QHBox( phoneWidget );
242 new QLabel( i18n("Connection: "), temphb );
243 mPhoneConnection = new QLineEdit( temphb);
244 button = new QPushButton( i18n("Help..."), temphb );
245 connect ( button, SIGNAL( clicked()), this, SLOT ( helpConnection() ) );
246
247
248 temphb = new QHBox( phoneWidget );
249 new QLabel( i18n("Model(opt.): "), temphb );
250 mPhoneModel = new QLineEdit( temphb);
251 button = new QPushButton( i18n("Help..."), temphb );
252 connect ( button, SIGNAL( clicked()), this, SLOT ( helpModel() ) );
253
254 // *** local*******************************
255 localFileWidget = new QVBox( topFrame);
256 //topLayout->addMultiCellWidget(localFileWidget, iii,iii,0,1);
257 //++iii;
258 temphb = new QHBox( localFileWidget );
259
260 lab = new QLabel( i18n("Local file Cal:"), temphb );
261 lab = new QLabel( i18n("Local file ABook:"), temphb );
262 lab = new QLabel( i18n("Local file PWMgr:"), temphb );
263 temphb = new QHBox( localFileWidget );
264 button = new QPushButton( i18n("Choose..."), temphb );
265 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFile() ) );
266 button = new QPushButton( i18n("Choose..."), temphb );
267 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFileAB() ) );
268 button = new QPushButton( i18n("Choose..."), temphb );
269 connect ( button, SIGNAL( clicked()), this, SLOT ( chooseFilePWM() ) );
270 temphb = new QHBox( localFileWidget );
271
272 mRemoteFile = new QLineEdit( temphb);
273 mRemoteFileAB = new QLineEdit( temphb);
274 mRemoteFilePWM = new QLineEdit( temphb);
275 mIsKapiFileL = new QCheckBox( i18n("Addressbook file (*.vcf) is used by KA/Pi"), localFileWidget );
276
277
278 // *** remote*******************************
279 remoteFileWidget = new QVBox( topFrame);
280 //topLayout->addMultiCellWidget(remoteFileWidget, iii,iii,0,1);
281 //++iii;
282 temphb = new QHBox( remoteFileWidget );
283 new QLabel( i18n("Calendar:"), temphb);
284 new QLabel( i18n("AddressBook:"), temphb);
285 new QLabel( i18n("PWManager:"), temphb);
286
287 lab = new QLabel( i18n("Pre sync (download) command:"), remoteFileWidget);
288 temphb = new QHBox( remoteFileWidget );
289 mRemotePrecommand = new QLineEdit(temphb);
290 mRemotePrecommandAB = new QLineEdit(temphb);
291 mRemotePrecommandPWM = new QLineEdit(temphb);
292
293 lab = new QLabel( i18n("Local temp file:"), remoteFileWidget);
294 temphb = new QHBox( remoteFileWidget );
295 mLocalTempFile = new QLineEdit(temphb);
296 mLocalTempFileAB = new QLineEdit(temphb);
297 mLocalTempFilePWM = new QLineEdit(temphb);
298
299 lab = new QLabel( i18n("Post sync (upload) command:"), remoteFileWidget);
300 temphb = new QHBox( remoteFileWidget );
301 mRemotePostcommand = new QLineEdit(temphb );
302 mRemotePostcommandAB = new QLineEdit(temphb );
303 mRemotePostcommandPWM = new QLineEdit(temphb );
304 mIsKapiFileR = new QCheckBox( i18n("Addressbook file is used by KA/Pi"), remoteFileWidget );
305 lab = new QLabel( i18n("Fill in default values for:"), remoteFileWidget);
306 temphb = new QHBox( remoteFileWidget );
307 button = new QPushButton( i18n("ssh/scp"), temphb );
308 connect ( button, SIGNAL( clicked()), this, SLOT (fillSSH() ) );
309 button = new QPushButton( i18n("ftp"), temphb );
310 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
311 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
312
313 // *** pi-sync*******************************
314 piWidget = new QVBox( topFrame);
315 //topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
316 //++iii;
317 temphb = new QHBox( piWidget );
318 new QLabel( i18n("Calendar:"), temphb);
319 new QLabel( i18n("AddressBook:"), temphb);
320 new QLabel( i18n("PWManager:"), temphb);
321
322 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
323 temphb = new QHBox( piWidget );
324 mRemotePw = new QLineEdit(temphb);
325 mRemotePwAB = new QLineEdit(temphb);
326 mRemotePwPWM = new QLineEdit(temphb);
327
328 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
329 temphb = new QHBox( piWidget );
330 mRemoteIP = new QLineEdit(temphb);
331 mRemoteIPAB = new QLineEdit(temphb);
332 mRemoteIPPWM = new QLineEdit(temphb);
333
334 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
335 temphb = new QHBox( piWidget );
336 mRemotePort = new QLineEdit(temphb);
337 mRemotePortAB = new QLineEdit(temphb);
338 mRemotePortPWM = new QLineEdit(temphb);
339 }
340 // ******************************************
341 // Profile kind specific settings END
342
310} 343}
311 344
312 345
313 346
347void KSyncPrefsDialog::readFilter()
348{
349 mFilterKapi.clear();
350 mFilterKopi.clear();
351 mFilterKopi.append(i18n("No Filter") );
352 mFilterKapi.append(i18n("No Filter") );
353 KConfig cfgko(locateLocal("config","korganizerrc"));
354 KConfig cfgka(locateLocal("config","kaddressbookrc"));
355 cfgko.setGroup("General");
356 mFilterKopi = cfgko.readListEntry("CalendarFilters");
357 mFilterKopi.prepend(i18n("No Filter") );
358}
314 359
315 360
316void KSyncPrefsDialog::slotOK() 361void KSyncPrefsDialog::slotOK()
317{ 362{
318 if ( mMyMachineName->text() == "undefined" ) { 363 if ( mMyMachineName->text() == "undefined" ) {
319 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error")); 364 KMessageBox::error(this,i18n("Local device name undefined!\nPlease define device name!"),i18n("KO/Pi config error"));
320 return; 365 return;
321 } 366 }
322 int i; 367 int i;
323 for (i = 0; i < mSyncProfileNames.count(); ++ i) { 368 for (i = 0; i < mSyncProfileNames.count(); ++ i) {
324 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) { 369 if ( mSyncProfileNames.contains( mSyncProfileNames[i]) > 1 ) {
325 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error")); 370 KMessageBox::error(this,i18n("Multiple profiles with same name!\nPlease use unique profile names!"),i18n("KO/Pi config error"));
326 return; 371 return;
327 } 372 }
328 } 373 }
329 usrWriteConfig(); 374 usrWriteConfig();
330 QDialog::accept(); 375 QDialog::accept();
331} 376}
332void KSyncPrefsDialog::accept() 377void KSyncPrefsDialog::accept()
333{ 378{
334 slotOK(); 379 slotOK();
335} 380}
336void KSyncPrefsDialog::chooseFile() 381void KSyncPrefsDialog::chooseFile()
337{ 382{
338 QString fn = QDir::homeDirPath(); 383 QString fn = QDir::homeDirPath();
339 384
340 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this ); 385 fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename(*.ics/*.vcs)"), this );
341 if ( fn == "" ) 386 if ( fn == "" )
342 return; 387 return;
343 mRemoteFile->setText( fn ); 388 mRemoteFile->setText( fn );
344} 389}
345 390
@@ -401,64 +446,65 @@ void KSyncPrefsDialog::profileChanged( int item )
401 mRemotePortPWM->setText(prof->getRemotePortPWM()); 446 mRemotePortPWM->setText(prof->getRemotePortPWM());
402 447
403 mRemotePrecommand->setText(prof->getPreSyncCommand()); 448 mRemotePrecommand->setText(prof->getPreSyncCommand());
404 mRemotePostcommand->setText(prof->getPostSyncCommand()); 449 mRemotePostcommand->setText(prof->getPostSyncCommand());
405 mLocalTempFile->setText(prof->getLocalTempFile()); 450 mLocalTempFile->setText(prof->getLocalTempFile());
406 mRemoteFile->setText(prof->getRemoteFileName()) ; 451 mRemoteFile->setText(prof->getRemoteFileName()) ;
407 452
408 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB()); 453 mRemotePrecommandAB->setText(prof->getPreSyncCommandAB());
409 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB()); 454 mRemotePostcommandAB->setText(prof->getPostSyncCommandAB());
410 mLocalTempFileAB->setText(prof->getLocalTempFileAB()); 455 mLocalTempFileAB->setText(prof->getLocalTempFileAB());
411 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ; 456 mRemoteFileAB->setText(prof->getRemoteFileNameAB()) ;
412 457
413 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM()); 458 mRemotePrecommandPWM->setText(prof->getPreSyncCommandPWM());
414 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM()); 459 mRemotePostcommandPWM->setText(prof->getPostSyncCommandPWM());
415 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM()); 460 mLocalTempFilePWM->setText(prof->getLocalTempFilePWM());
416 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ; 461 mRemoteFilePWM->setText(prof->getRemoteFileNamePWM()) ;
417 462
418 if ( mWriteContactToSIM ) 463 if ( mWriteContactToSIM )
419 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM()); 464 mWriteContactToSIM->setChecked( prof->getWriteContactToSIM());
420 mPhoneDevice->setText(prof->getPhoneDevice()); 465 mPhoneDevice->setText(prof->getPhoneDevice());
421 mPhoneConnection->setText(prof->getPhoneConnection()); 466 mPhoneConnection->setText(prof->getPhoneConnection());
422 mPhoneModel->setText(prof->getPhoneModel()); 467 mPhoneModel->setText(prof->getPhoneModel());
423 468
424 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync()); 469 mShowSummaryAfterSync->setChecked( prof->getShowSummaryAfterSync());
425 mAskForPreferences->setChecked( prof->getAskForPreferences()); 470 mAskForPreferences->setChecked( prof->getAskForPreferences());
426 mWriteBackExisting->setChecked( prof->getWriteBackExisting() ); 471 mWriteBackExisting->setChecked( prof->getWriteBackExisting() );
427 mWriteBackFile->setChecked( prof->getWriteBackFile()); 472 mWriteBackFile->setChecked( prof->getWriteBackFile());
428 mIncludeInRing->setChecked( prof->getIncludeInRingSync() ); 473 mIncludeInRing->setChecked( prof->getIncludeInRingSync() );
429 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() ); 474 mIncludeInRingAB->setChecked( prof->getIncludeInRingSyncAB() );
430 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() ); 475 mIncludeInRingPWM->setChecked( prof->getIncludeInRingSyncPWM() );
431 mWriteBackFuture->setChecked( prof->getWriteBackFuture()); 476 mWriteBackFuture->setChecked( prof->getWriteBackFuture());
432 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() ); 477 mWriteBackFutureWeeks->setValue( prof->getWriteBackFutureWeeks() );
478 mWriteBackPastWeeks->setValue( prof->getWriteBackPastWeeks() );
433 479
434 switch ( prof->getSyncPrefs() ) { 480 switch ( prof->getSyncPrefs() ) {
435 case 0: 481 case 0:
436 loc->setChecked( true); 482 loc->setChecked( true);
437 break; 483 break;
438 case 1: 484 case 1:
439 rem->setChecked( true ); 485 rem->setChecked( true );
440 break; 486 break;
441 case 2: 487 case 2:
442 newest->setChecked( true); 488 newest->setChecked( true);
443 break; 489 break;
444 case 3: 490 case 3:
445 ask->setChecked( true); 491 ask->setChecked( true);
446 break; 492 break;
447 case 4: 493 case 4:
448 f_loc->setChecked( true); 494 f_loc->setChecked( true);
449 break; 495 break;
450 case 5: 496 case 5:
451 f_rem->setChecked( true); 497 f_rem->setChecked( true);
452 break; 498 break;
453 case 6: 499 case 6:
454 //both->setChecked( true); 500 //both->setChecked( true);
455 break; 501 break;
456 default: 502 default:
457 break; 503 break;
458 } 504 }
459 mIsLocal->setChecked(prof->getIsLocalFileSync()) ; 505 mIsLocal->setChecked(prof->getIsLocalFileSync()) ;
460 mIsPhone->setChecked(prof->getIsPhoneSync()) ; 506 mIsPhone->setChecked(prof->getIsPhoneSync()) ;
461 mIsPi->setChecked(prof->getIsPiSync()) ; 507 mIsPi->setChecked(prof->getIsPiSync()) ;
462 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ; 508 mIsKapiFileL->setChecked(prof->getIsKapiFile()) ;
463 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; 509 mIsKapiFileR->setChecked(prof->getIsKapiFile()) ;
464 510
@@ -564,64 +610,65 @@ void KSyncPrefsDialog::saveProfile()
564 610
565 prof->setRemotePwPWM( mRemotePwPWM->text()); 611 prof->setRemotePwPWM( mRemotePwPWM->text());
566 prof->setRemoteIPPWM( mRemoteIPPWM->text()); 612 prof->setRemoteIPPWM( mRemoteIPPWM->text());
567 prof->setRemotePortPWM( mRemotePortPWM->text()); 613 prof->setRemotePortPWM( mRemotePortPWM->text());
568 614
569 prof->setPreSyncCommand( mRemotePrecommand->text()); 615 prof->setPreSyncCommand( mRemotePrecommand->text());
570 prof->setPostSyncCommand( mRemotePostcommand->text() ); 616 prof->setPostSyncCommand( mRemotePostcommand->text() );
571 prof->setLocalTempFile( mLocalTempFile->text()); 617 prof->setLocalTempFile( mLocalTempFile->text());
572 prof->setRemoteFileName( mRemoteFile->text() ); 618 prof->setRemoteFileName( mRemoteFile->text() );
573 prof->setPreSyncCommandAB( mRemotePrecommandAB->text()); 619 prof->setPreSyncCommandAB( mRemotePrecommandAB->text());
574 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() ); 620 prof->setPostSyncCommandAB( mRemotePostcommandAB->text() );
575 prof->setLocalTempFileAB( mLocalTempFileAB->text()); 621 prof->setLocalTempFileAB( mLocalTempFileAB->text());
576 prof->setRemoteFileNameAB( mRemoteFileAB->text() ); 622 prof->setRemoteFileNameAB( mRemoteFileAB->text() );
577 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text()); 623 prof->setPreSyncCommandPWM( mRemotePrecommandPWM->text());
578 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() ); 624 prof->setPostSyncCommandPWM( mRemotePostcommandPWM->text() );
579 prof->setLocalTempFilePWM( mLocalTempFilePWM->text()); 625 prof->setLocalTempFilePWM( mLocalTempFilePWM->text());
580 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() ); 626 prof->setRemoteFileNamePWM( mRemoteFilePWM->text() );
581 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() ); 627 prof->setShowSummaryAfterSync( mShowSummaryAfterSync->isChecked() );
582 prof->setAskForPreferences( mAskForPreferences->isChecked()); 628 prof->setAskForPreferences( mAskForPreferences->isChecked());
583 prof->setWriteBackExisting(mWriteBackExisting->isChecked() ); 629 prof->setWriteBackExisting(mWriteBackExisting->isChecked() );
584 prof->setWriteBackFile( mWriteBackFile->isChecked()); 630 prof->setWriteBackFile( mWriteBackFile->isChecked());
585 prof->setIncludeInRingSync( mIncludeInRing->isChecked() ); 631 prof->setIncludeInRingSync( mIncludeInRing->isChecked() );
586 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() ); 632 prof->setIncludeInRingSyncAB( mIncludeInRingAB->isChecked() );
587 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() ); 633 prof->setIncludeInRingSyncPWM( mIncludeInRingPWM->isChecked() );
588 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ; 634 int syncprefs = rem->isChecked()*1+newest->isChecked()*2+ ask->isChecked()*3+ f_loc->isChecked()*4+ f_rem->isChecked()*5 ;//+ both->isChecked()*6 ;
589 prof->setSyncPrefs( syncprefs); 635 prof->setSyncPrefs( syncprefs);
590 prof->setIsLocalFileSync( mIsLocal->isChecked() ); 636 prof->setIsLocalFileSync( mIsLocal->isChecked() );
591 prof->setIsPhoneSync( mIsPhone->isChecked() ); 637 prof->setIsPhoneSync( mIsPhone->isChecked() );
592 prof->setIsPiSync( mIsPi->isChecked() ); 638 prof->setIsPiSync( mIsPi->isChecked() );
593 prof->setIsKapiFile( mIsKapiFileL->isChecked() ); 639 prof->setIsKapiFile( mIsKapiFileL->isChecked() );
594 prof->setWriteBackFuture(mWriteBackFuture->isChecked()); 640 prof->setWriteBackFuture(mWriteBackFuture->isChecked());
595 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value()); 641 prof->setWriteBackFutureWeeks(mWriteBackFutureWeeks->value());
642 prof->setWriteBackPastWeeks(mWriteBackPastWeeks->value());
596 if ( mWriteContactToSIM ) 643 if ( mWriteContactToSIM )
597 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked()); 644 prof->setWriteContactToSIM(mWriteContactToSIM->isChecked());
598 prof->setPhoneDevice( mPhoneDevice->text() ); 645 prof->setPhoneDevice( mPhoneDevice->text() );
599 prof->setPhoneConnection( mPhoneConnection->text() ); 646 prof->setPhoneConnection( mPhoneConnection->text() );
600 prof->setPhoneModel( mPhoneModel->text() ); 647 prof->setPhoneModel( mPhoneModel->text() );
601 648
602 } 649 }
603 650
604} 651}
605 652
606void KSyncPrefsDialog::insertProfiles() 653void KSyncPrefsDialog::insertProfiles()
607{ 654{
608 int curItem = mProfileBox->currentItem(); 655 int curItem = mProfileBox->currentItem();
609 mProfileBox->blockSignals( true ); 656 mProfileBox->blockSignals( true );
610 mProfileBox->clear(); 657 mProfileBox->clear();
611 mProfileBox->insertStringList (mSyncProfileNames ); 658 mProfileBox->insertStringList (mSyncProfileNames );
612 int item = mSyncProfileNames.count() -1; 659 int item = mSyncProfileNames.count() -1;
613 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() ) 660 if ( curItem >= 0 && mSyncProfileNames.count() > 0 && curItem < mSyncProfileNames.count() )
614 mProfileBox->setCurrentItem( curItem ); 661 mProfileBox->setCurrentItem( curItem );
615 else if ( item >= 0 ) { 662 else if ( item >= 0 ) {
616 mProfileBox->setCurrentItem( item ); 663 mProfileBox->setCurrentItem( item );
617 } 664 }
618 currentSelection = -1; 665 currentSelection = -1;
619 if ( mSyncProfileNames.count() > 0 ) { 666 if ( mSyncProfileNames.count() > 0 ) {
620 //qDebug(" profileChanged( mProfileBox->currentItem() "); 667 //qDebug(" profileChanged( mProfileBox->currentItem() ");
621 profileChanged( mProfileBox->currentItem() ); 668 profileChanged( mProfileBox->currentItem() );
622 currentSelection = mProfileBox->currentItem(); 669 currentSelection = mProfileBox->currentItem();
623 } 670 }
624 mProfileBox->blockSignals( false ); 671 mProfileBox->blockSignals( false );
625} 672}
626 673
627void KSyncPrefsDialog::addProfile ( KSyncProfile* temp ) 674void KSyncPrefsDialog::addProfile ( KSyncProfile* temp )
diff --git a/libkdepim/ksyncprefsdialog.h b/libkdepim/ksyncprefsdialog.h
index c601a58..997f524 100644
--- a/libkdepim/ksyncprefsdialog.h
+++ b/libkdepim/ksyncprefsdialog.h
@@ -49,105 +49,107 @@ class KSyncPrefsDialog : public KDialog
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 /** Initialize dialog and pages */ 51 /** Initialize dialog and pages */
52 KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false); 52 KSyncPrefsDialog(QWidget *parent=0,char *name=0,bool modal=false);
53 ~KSyncPrefsDialog(); 53 ~KSyncPrefsDialog();
54 void usrReadConfig(); 54 void usrReadConfig();
55 void setLocalMachineName ( const QString& name ); 55 void setLocalMachineName ( const QString& name );
56 QString getLocalMachineName ( ); 56 QString getLocalMachineName ( );
57 57
58 QStringList getSyncProfileNames(); 58 QStringList getSyncProfileNames();
59 59
60 public slots: 60 public slots:
61 protected slots: 61 protected slots:
62 void accept(); 62 void accept();
63 void deleteProfile(); 63 void deleteProfile();
64 void newProfile(); 64 void newProfile();
65 void cloneProfile(); 65 void cloneProfile();
66 void kindChanged(bool); 66 void kindChanged(bool);
67 void fillSSH(); 67 void fillSSH();
68 void fillFTP(); 68 void fillFTP();
69 void textChanged( const QString & ); 69 void textChanged( const QString & );
70 void profileChanged( int ); 70 void profileChanged( int );
71 void chooseFile(); 71 void chooseFile();
72 void chooseFileAB(); 72 void chooseFileAB();
73 void chooseFilePWM(); 73 void chooseFilePWM();
74 void slotOK(); 74 void slotOK();
75 void helpDevice(); 75 void helpDevice();
76 void helpModel(); 76 void helpModel();
77 void helpConnection(); 77 void helpConnection();
78 78
79 protected: 79 protected:
80 void usrWriteConfig(); 80 void usrWriteConfig();
81
82 void setupSyncAlgTab(); 81 void setupSyncAlgTab();
83 82 void readFilter();
84 private: 83 private:
85 int currentSelection; 84 int currentSelection;
86 QPtrList<KSyncProfile> mSyncProfiles; 85 QPtrList<KSyncProfile> mSyncProfiles;
87 QStringList mSyncProfileNames; 86 QStringList mSyncProfileNames;
87 QStringList mFilterKapi;
88 QStringList mFilterKopi;
88 QLineEdit * mMyMachineName; 89 QLineEdit * mMyMachineName;
89 QComboBox * mProfileBox; 90 QComboBox * mProfileBox;
90 QRadioButton* mIsLocal; 91 QRadioButton* mIsLocal;
91 QRadioButton* mIsNotLocal; 92 QRadioButton* mIsNotLocal;
92 QRadioButton* mIsPhone; 93 QRadioButton* mIsPhone;
93 QRadioButton* mIsPi; 94 QRadioButton* mIsPi;
94 QCheckBox* mIncludeInRing; 95 QCheckBox* mIncludeInRing;
95 QCheckBox* mIncludeInRingAB; 96 QCheckBox* mIncludeInRingAB;
96 QCheckBox* mIncludeInRingPWM; 97 QCheckBox* mIncludeInRingPWM;
97 void addProfile ( KSyncProfile* ); 98 void addProfile ( KSyncProfile* );
98 void insertProfiles(); 99 void insertProfiles();
99 void saveProfile(); 100 void saveProfile();
100 QButtonGroup* proGr; 101 QButtonGroup* proGr;
101 102
102 QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both; 103 QRadioButton* loc, *rem, *newest, *ask, *f_loc,* f_rem, *both;
103 104
104 105
105 QLineEdit * mRemotePostcommand; 106 QLineEdit * mRemotePostcommand;
106 QLineEdit * mRemotePrecommand; 107 QLineEdit * mRemotePrecommand;
107 QLineEdit * mRemoteFile; 108 QLineEdit * mRemoteFile;
108 QLineEdit * mLocalTempFile; 109 QLineEdit * mLocalTempFile;
109 110
110 QLineEdit * mRemotePostcommandAB; 111 QLineEdit * mRemotePostcommandAB;
111 QLineEdit * mRemotePrecommandAB; 112 QLineEdit * mRemotePrecommandAB;
112 QLineEdit * mRemoteFileAB; 113 QLineEdit * mRemoteFileAB;
113 QLineEdit * mLocalTempFileAB; 114 QLineEdit * mLocalTempFileAB;
114 115
115 QLineEdit * mRemotePostcommandPWM; 116 QLineEdit * mRemotePostcommandPWM;
116 QLineEdit * mRemotePrecommandPWM; 117 QLineEdit * mRemotePrecommandPWM;
117 QLineEdit * mRemoteFilePWM; 118 QLineEdit * mRemoteFilePWM;
118 QLineEdit * mLocalTempFilePWM; 119 QLineEdit * mLocalTempFilePWM;
119 120
120 121
121 QLineEdit * mRemotePw; 122 QLineEdit * mRemotePw;
122 QLineEdit * mRemoteIP; 123 QLineEdit * mRemoteIP;
123 QLineEdit * mRemotePort; 124 QLineEdit * mRemotePort;
124 125
125 QLineEdit * mRemotePwAB; 126 QLineEdit * mRemotePwAB;
126 QLineEdit * mRemoteIPAB; 127 QLineEdit * mRemoteIPAB;
127 QLineEdit * mRemotePortAB; 128 QLineEdit * mRemotePortAB;
128 129
129 QLineEdit * mRemotePwPWM; 130 QLineEdit * mRemotePwPWM;
130 QLineEdit * mRemoteIPPWM; 131 QLineEdit * mRemoteIPPWM;
131 QLineEdit * mRemotePortPWM; 132 QLineEdit * mRemotePortPWM;
132 133
133 QLineEdit * mPhoneDevice; 134 QLineEdit * mPhoneDevice;
134 QLineEdit * mPhoneConnection; 135 QLineEdit * mPhoneConnection;
135 QLineEdit * mPhoneModel; 136 QLineEdit * mPhoneModel;
136 137
137 QWidget* mSetupSyncAlgTab; 138 QWidget* mSetupSyncAlgTab;
138 QVBox* localFileWidget; 139 QVBox* localFileWidget;
139 QVBox* remoteFileWidget; 140 QVBox* remoteFileWidget;
140 QVBox* phoneWidget; 141 QVBox* phoneWidget;
141 QVBox* piWidget; 142 QVBox* piWidget;
142 QCheckBox* mWriteBackFile; 143 QCheckBox* mWriteBackFile;
143 QCheckBox* mWriteBackFuture; 144 QCheckBox* mWriteBackFuture;
144 QSpinBox* mWriteBackFutureWeeks; 145 QSpinBox* mWriteBackFutureWeeks;
146 QSpinBox* mWriteBackPastWeeks;
145 QCheckBox* mWriteBackExisting; 147 QCheckBox* mWriteBackExisting;
146 QCheckBox* mAskForPreferences; 148 QCheckBox* mAskForPreferences;
147 QCheckBox* mShowSummaryAfterSync; 149 QCheckBox* mShowSummaryAfterSync;
148 QCheckBox* mWriteContactToSIM; 150 QCheckBox* mWriteContactToSIM;
149 QCheckBox* mIsKapiFileL; 151 QCheckBox* mIsKapiFileL;
150 QCheckBox* mIsKapiFileR; 152 QCheckBox* mIsKapiFileR;
151}; 153};
152 154
153#endif 155#endif
diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp
index 029b70b..9f404cb 100644
--- a/libkdepim/ksyncprofile.cpp
+++ b/libkdepim/ksyncprofile.cpp
@@ -41,212 +41,216 @@ KSyncProfile::~KSyncProfile()
41 41
42 42
43KSyncProfile* KSyncProfile::clone() 43KSyncProfile* KSyncProfile::clone()
44{ 44{
45 KSyncProfile* myClone = new KSyncProfile(); 45 KSyncProfile* myClone = new KSyncProfile();
46 myClone->setRemotePw(mRemotePw); 46 myClone->setRemotePw(mRemotePw);
47 myClone->setRemoteIP(mRemoteIP); 47 myClone->setRemoteIP(mRemoteIP);
48 myClone->setRemotePort(mRemotePort); 48 myClone->setRemotePort(mRemotePort);
49 myClone->setRemotePwAB(mRemotePwAB); 49 myClone->setRemotePwAB(mRemotePwAB);
50 myClone->setRemoteIPAB(mRemoteIPAB); 50 myClone->setRemoteIPAB(mRemoteIPAB);
51 myClone->setRemotePortAB(mRemotePortAB); 51 myClone->setRemotePortAB(mRemotePortAB);
52 myClone->setRemotePwPWM(mRemotePwPWM); 52 myClone->setRemotePwPWM(mRemotePwPWM);
53 myClone->setRemoteIPPWM(mRemoteIPPWM); 53 myClone->setRemoteIPPWM(mRemoteIPPWM);
54 myClone->setRemotePortPWM (mRemotePortPWM); 54 myClone->setRemotePortPWM (mRemotePortPWM);
55 myClone->setPreSyncCommand( mPreSyncCommand ); 55 myClone->setPreSyncCommand( mPreSyncCommand );
56 myClone->setPostSyncCommand( mPostSyncCommand ); 56 myClone->setPostSyncCommand( mPostSyncCommand );
57 myClone->setLocalTempFile( mLocalTempFile); 57 myClone->setLocalTempFile( mLocalTempFile);
58 myClone->setRemoteFileName( mRemoteFileName ); 58 myClone->setRemoteFileName( mRemoteFileName );
59 myClone->setPreSyncCommandAB( mPreSyncCommandAB ); 59 myClone->setPreSyncCommandAB( mPreSyncCommandAB );
60 myClone->setPostSyncCommandAB( mPostSyncCommandAB ); 60 myClone->setPostSyncCommandAB( mPostSyncCommandAB );
61 myClone->setLocalTempFileAB( mLocalTempFileAB); 61 myClone->setLocalTempFileAB( mLocalTempFileAB);
62 myClone->setRemoteFileNameAB( mRemoteFileNameAB ); 62 myClone->setRemoteFileNameAB( mRemoteFileNameAB );
63 myClone->setPreSyncCommandPWM( mPreSyncCommandPWM ); 63 myClone->setPreSyncCommandPWM( mPreSyncCommandPWM );
64 myClone->setPostSyncCommandPWM( mPostSyncCommandPWM ); 64 myClone->setPostSyncCommandPWM( mPostSyncCommandPWM );
65 myClone->setLocalTempFilePWM( mLocalTempFilePWM); 65 myClone->setLocalTempFilePWM( mLocalTempFilePWM);
66 myClone->setRemoteFileNamePWM( mRemoteFileNamePWM ); 66 myClone->setRemoteFileNamePWM( mRemoteFileNamePWM );
67 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync ); 67 myClone->setShowSummaryAfterSync( mShowSummaryAfterSync );
68 myClone->setAskForPreferences( mAskForPreferences); 68 myClone->setAskForPreferences( mAskForPreferences);
69 myClone->setWriteBackExisting(mWriteBackExisting ); 69 myClone->setWriteBackExisting(mWriteBackExisting );
70 myClone->setWriteBackFile( mWriteBackFile); 70 myClone->setWriteBackFile( mWriteBackFile);
71 myClone->setWriteBackFuture( mWriteBackFuture ); 71 myClone->setWriteBackFuture( mWriteBackFuture );
72 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks ); 72 myClone->setWriteBackFutureWeeks( mWriteBackFutureWeeks );
73 myClone->setWriteBackPastWeeks( mWriteBackPastWeeks );
73 myClone->setIncludeInRingSync( mIncludeInRingSync ); 74 myClone->setIncludeInRingSync( mIncludeInRingSync );
74 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB ); 75 myClone->setIncludeInRingSyncAB( mIncludeInRingSyncAB );
75 myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM ); 76 myClone->setIncludeInRingSyncPWM( mIncludeInRingSyncPWM );
76 myClone->setSyncPrefs( mSyncPrefs); 77 myClone->setSyncPrefs( mSyncPrefs);
77 myClone->setIsLocalFileSync( mIsLocalFileSync ); 78 myClone->setIsLocalFileSync( mIsLocalFileSync );
78 myClone->setIsPhoneSync( mIsPhoneSync ); 79 myClone->setIsPhoneSync( mIsPhoneSync );
79 myClone->setIsKapiFile( mIsKapiFile ); 80 myClone->setIsKapiFile( mIsKapiFile );
80 myClone->setIsPiSync( mIsPiSync ); 81 myClone->setIsPiSync( mIsPiSync );
81 myClone->setWriteContactToSIM( mWriteContactToSIM ); 82 myClone->setWriteContactToSIM( mWriteContactToSIM );
82 myClone->setName( "noName" ); 83 myClone->setName( "noName" );
83 //myClone->setIdentifier( "noID" ); 84 //myClone->setIdentifier( "noID" );
84 return myClone; 85 return myClone;
85} 86}
86 87
87 88
88void KSyncProfile::setDefault() 89void KSyncProfile::setDefault()
89{ 90{
90 mPreSyncCommand = i18n("command for downloading remote file to local device"); 91 mPreSyncCommand = i18n("command for downloading remote file to local device");
91 mPostSyncCommand = i18n("command for uploading local temp file to remote device"); 92 mPostSyncCommand = i18n("command for uploading local temp file to remote device");
92 mLocalTempFile = "/tmp/mycalendar.ics"; 93 mLocalTempFile = "/tmp/mycalendar.ics";
93 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics"; 94 mRemoteFileName = "/home/polo/kdepim/apps/korganizer/localfile.ics";
94 mPreSyncCommandAB = i18n("command for downloading remote file to local device"); 95 mPreSyncCommandAB = i18n("command for downloading remote file to local device");
95 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device"); 96 mPostSyncCommandAB = i18n("command for uploading local temp file to remote device");
96 mLocalTempFileAB = "/tmp/std.vcf"; 97 mLocalTempFileAB = "/tmp/std.vcf";
97 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf"; 98 mRemoteFileNameAB = "/home/polo/kdepim/apps/kabc/localfile.vcf";
98 mPreSyncCommandPWM = i18n("command for downloading remote file to local device"); 99 mPreSyncCommandPWM = i18n("command for downloading remote file to local device");
99 mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device"); 100 mPostSyncCommandPWM = i18n("command for uploading local temp file to remote device");
100 mLocalTempFilePWM = "/tmp/passwords.pwm"; 101 mLocalTempFilePWM = "/tmp/passwords.pwm";
101 mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm"; 102 mRemoteFileNamePWM = "/home/polo/kdepim/apps/pwmanager/localfile.pwm";
102 103
103 mRemotePw = "abc"; 104 mRemotePw = "abc";
104 mRemoteIP = "192.168.0.99"; 105 mRemoteIP = "192.168.0.99";
105 mRemotePort = "9197"; 106 mRemotePort = "9197";
106 107
107 mRemotePwAB = "abc"; 108 mRemotePwAB = "abc";
108 mRemoteIPAB = "192.168.0.99"; 109 mRemoteIPAB = "192.168.0.99";
109 mRemotePortAB = "9198"; 110 mRemotePortAB = "9198";
110 111
111 mRemotePwPWM = "abc"; 112 mRemotePwPWM = "abc";
112 mRemoteIPPWM = "192.168.0.99"; 113 mRemoteIPPWM = "192.168.0.99";
113 mRemotePortPWM = "9199"; 114 mRemotePortPWM = "9199";
114 115
115 mShowSummaryAfterSync = true; 116 mShowSummaryAfterSync = true;
116 mAskForPreferences = true; 117 mAskForPreferences = true;
117 mWriteBackExisting = false; 118 mWriteBackExisting = false;
118 mWriteBackFuture = false; 119 mWriteBackFuture = false;
119 mWriteBackFutureWeeks = 12; 120 mWriteBackFutureWeeks = 12;
121 mWriteBackPastWeeks = 2;
120 mWriteBackFile = true; 122 mWriteBackFile = true;
121 mIncludeInRingSync = false; 123 mIncludeInRingSync = false;
122 mIncludeInRingSyncAB = false; 124 mIncludeInRingSyncAB = false;
123 mIncludeInRingSyncPWM = false; 125 mIncludeInRingSyncPWM = false;
124 mSyncPrefs = SYNC_PREF_ASK; 126 mSyncPrefs = SYNC_PREF_ASK;
125 mIsLocalFileSync = true; 127 mIsLocalFileSync = true;
126 mName = "noName"; 128 mName = "noName";
127 mIsPhoneSync = false; 129 mIsPhoneSync = false;
128 mIsPiSync = false; 130 mIsPiSync = false;
129 mIsKapiFile = false; 131 mIsKapiFile = false;
130 mWriteContactToSIM = false; 132 mWriteContactToSIM = false;
131 mPhoneDevice = "/dev/ircomm"; 133 mPhoneDevice = "/dev/ircomm";
132 mPhoneConnection = "irda"; 134 mPhoneConnection = "irda";
133 mPhoneModel = "6310i"; 135 mPhoneModel = "6310i";
134} 136}
135void KSyncProfile::readConfig(KConfig *config ) 137void KSyncProfile::readConfig(KConfig *config )
136{ 138{
137 if (config) 139 if (config)
138 { 140 {
139 141
140 config->setGroup( mName ); 142 config->setGroup( mName );
141 143
142 mName = config->readEntry( "Name", mName ); 144 mName = config->readEntry( "Name", mName );
143 145
144 mRemotePw = config->readEntry( "RemotePw",mRemotePw ); 146 mRemotePw = config->readEntry( "RemotePw",mRemotePw );
145 mRemoteIP = config->readEntry( "RemoteIP",mRemoteIP ); 147 mRemoteIP = config->readEntry( "RemoteIP",mRemoteIP );
146 mRemotePort = config->readEntry( "RemotePort", mRemotePort ); 148 mRemotePort = config->readEntry( "RemotePort", mRemotePort );
147 mRemotePwAB = config->readEntry( "RemotePwAB", mRemotePwAB ); 149 mRemotePwAB = config->readEntry( "RemotePwAB", mRemotePwAB );
148 mRemoteIPAB = config->readEntry( "RemoteIPAB", mRemoteIPAB ); 150 mRemoteIPAB = config->readEntry( "RemoteIPAB", mRemoteIPAB );
149 mRemotePortAB = config->readEntry( "RemotePortAB", mRemotePortAB ); 151 mRemotePortAB = config->readEntry( "RemotePortAB", mRemotePortAB );
150 mRemotePwPWM = config->readEntry( "RemotePwPWM", mRemotePwPWM ); 152 mRemotePwPWM = config->readEntry( "RemotePwPWM", mRemotePwPWM );
151 mRemoteIPPWM = config->readEntry( "RemoteIPPWM", mRemoteIPPWM ); 153 mRemoteIPPWM = config->readEntry( "RemoteIPPWM", mRemoteIPPWM );
152 mRemotePortPWM = config->readEntry( "RemotePortPWM", mRemotePortPWM ); 154 mRemotePortPWM = config->readEntry( "RemotePortPWM", mRemotePortPWM );
153 155
154 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand ); 156 mPreSyncCommand = config->readEntry( "PreSyncCommand",mPreSyncCommand );
155 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand ); 157 mPostSyncCommand = config->readEntry( "PostSyncCommand", mPostSyncCommand );
156 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile ); 158 mLocalTempFile = config->readEntry( "LocalTempFile", mLocalTempFile );
157 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName ); 159 mRemoteFileName = config->readEntry( "RemoteFileName", mRemoteFileName );
158 160
159 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB ); 161 mPreSyncCommandAB = config->readEntry( "PreSyncCommandAB",mPreSyncCommandAB );
160 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB ); 162 mPostSyncCommandAB = config->readEntry( "PostSyncCommandAB", mPostSyncCommandAB );
161 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB ); 163 mLocalTempFileAB = config->readEntry( "LocalTempFileAB", mLocalTempFileAB );
162 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB ); 164 mRemoteFileNameAB = config->readEntry( "RemoteFileNameAB", mRemoteFileNameAB );
163 165
164 mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); 166 mPreSyncCommandPWM = config->readEntry( "PreSyncCommandPWM",mPreSyncCommandPWM );
165 mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); 167 mPostSyncCommandPWM = config->readEntry( "PostSyncCommandPWM", mPostSyncCommandPWM );
166 mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM ); 168 mLocalTempFilePWM = config->readEntry( "LocalTempFilePWM", mLocalTempFilePWM );
167 mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); 169 mRemoteFileNamePWM = config->readEntry( "RemoteFileNamePWM", mRemoteFileNamePWM );
168 170
169 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice ); 171 mPhoneDevice = config->readEntry( "PhoneDevice", mPhoneDevice );
170 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection ); 172 mPhoneConnection = config->readEntry( "PhoneConnection", mPhoneConnection );
171 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel ); 173 mPhoneModel = config->readEntry( "PhoneModel", mPhoneModel );
172 174
173 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync ); 175 mIncludeInRingSync = config->readBoolEntry( "IncludeInRingSync",mIncludeInRingSync );
174 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 176 mIncludeInRingSyncAB = config->readBoolEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
175 mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); 177 mIncludeInRingSyncPWM = config->readBoolEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM );
176 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); 178 mShowSummaryAfterSync = config->readBoolEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
177 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences ); 179 mAskForPreferences = config->readBoolEntry( "AskForPreferences",mAskForPreferences );
178 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting ); 180 mWriteBackExisting = config->readBoolEntry( "WriteBackExisting",mWriteBackExisting );
179 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture ); 181 mWriteBackFuture = config->readBoolEntry( "WriteBackFuture",mWriteBackFuture );
180 mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile ); 182 mWriteBackFile = config->readBoolEntry( "WriteBackFile",mWriteBackFile );
181 mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM ); 183 mWriteContactToSIM = config->readBoolEntry( "WriteContactToSIM",mWriteContactToSIM );
182 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs ); 184 mSyncPrefs = config->readNumEntry( "SyncPrefs", mSyncPrefs );
183 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks ); 185 mWriteBackFutureWeeks = config->readNumEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks );
186 mWriteBackPastWeeks = config->readNumEntry( "WriteBackPastWeeks", mWriteBackPastWeeks );
184 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync ); 187 mIsLocalFileSync= config->readBoolEntry( "IsLocalFileSync", mIsLocalFileSync );
185 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync ); 188 mIsPhoneSync= config->readBoolEntry( "IsPhoneSync", mIsPhoneSync );
186 mIsPiSync= config->readBoolEntry( "IsPiSync", mIsPiSync ); 189 mIsPiSync= config->readBoolEntry( "IsPiSync", mIsPiSync );
187 mIsKapiFile = config->readBoolEntry( "IsKapiFile", mIsKapiFile ); 190 mIsKapiFile = config->readBoolEntry( "IsKapiFile", mIsKapiFile );
188 } 191 }
189 else 192 else
190 { 193 {
191 setDefault(); 194 setDefault();
192 } 195 }
193} 196}
194 197
195void KSyncProfile::deleteConfig(KConfig *config ) 198void KSyncProfile::deleteConfig(KConfig *config )
196{ 199{
197 config->deleteGroup( mName ); 200 config->deleteGroup( mName );
198} 201}
199 202
200void KSyncProfile::writeConfig( KConfig * config ) 203void KSyncProfile::writeConfig( KConfig * config )
201{ 204{
202 config->setGroup(mName); 205 config->setGroup(mName);
203 206
204 config->writeEntry( "RemotePw", mRemotePw); 207 config->writeEntry( "RemotePw", mRemotePw);
205 config->writeEntry( "RemoteIP", mRemoteIP); 208 config->writeEntry( "RemoteIP", mRemoteIP);
206 config->writeEntry( "RemotePort", mRemotePort); 209 config->writeEntry( "RemotePort", mRemotePort);
207 210
208 config->writeEntry( "RemotePwAB", mRemotePwAB); 211 config->writeEntry( "RemotePwAB", mRemotePwAB);
209 config->writeEntry( "RemoteIPAB", mRemoteIPAB); 212 config->writeEntry( "RemoteIPAB", mRemoteIPAB);
210 config->writeEntry( "RemotePortAB", mRemotePortAB); 213 config->writeEntry( "RemotePortAB", mRemotePortAB);
211 214
212 config->writeEntry( "RemotePwPWM", mRemotePwPWM); 215 config->writeEntry( "RemotePwPWM", mRemotePwPWM);
213 config->writeEntry( "RemoteIPPWM", mRemoteIPPWM); 216 config->writeEntry( "RemoteIPPWM", mRemoteIPPWM);
214 config->writeEntry( "RemotePortPWM", mRemotePortPWM); 217 config->writeEntry( "RemotePortPWM", mRemotePortPWM);
215 218
216 config->writeEntry( "Name", mName ); 219 config->writeEntry( "Name", mName );
217 config->writeEntry( "PreSyncCommand",mPreSyncCommand ); 220 config->writeEntry( "PreSyncCommand",mPreSyncCommand );
218 config->writeEntry( "PostSyncCommand", mPostSyncCommand ); 221 config->writeEntry( "PostSyncCommand", mPostSyncCommand );
219 config->writeEntry( "LocalTempFile", mLocalTempFile ); 222 config->writeEntry( "LocalTempFile", mLocalTempFile );
220 config->writeEntry( "RemoteFileName", mRemoteFileName ); 223 config->writeEntry( "RemoteFileName", mRemoteFileName );
221 224
222 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB ); 225 config->writeEntry( "PreSyncCommandAB",mPreSyncCommandAB );
223 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB ); 226 config->writeEntry( "PostSyncCommandAB", mPostSyncCommandAB );
224 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB ); 227 config->writeEntry( "LocalTempFileAB", mLocalTempFileAB );
225 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB ); 228 config->writeEntry( "RemoteFileNameAB", mRemoteFileNameAB );
226 229
227 config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM ); 230 config->writeEntry( "PreSyncCommandPWM",mPreSyncCommandPWM );
228 config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM ); 231 config->writeEntry( "PostSyncCommandPWM", mPostSyncCommandPWM );
229 config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM ); 232 config->writeEntry( "LocalTempFilePWM", mLocalTempFilePWM );
230 config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM ); 233 config->writeEntry( "RemoteFileNamePWM", mRemoteFileNamePWM );
231 234
232 config->writeEntry( "PhoneDevice", mPhoneDevice ); 235 config->writeEntry( "PhoneDevice", mPhoneDevice );
233 config->writeEntry( "PhoneConnection", mPhoneConnection ); 236 config->writeEntry( "PhoneConnection", mPhoneConnection );
234 config->writeEntry( "PhoneModel", mPhoneModel ); 237 config->writeEntry( "PhoneModel", mPhoneModel );
235 238
236 config->writeEntry( "IncludeInRingSync",mIncludeInRingSync ); 239 config->writeEntry( "IncludeInRingSync",mIncludeInRingSync );
237 config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB ); 240 config->writeEntry( "IncludeInRingSyncAB",mIncludeInRingSyncAB );
238 config->writeEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM ); 241 config->writeEntry( "IncludeInRingSyncPWM",mIncludeInRingSyncPWM );
239 config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync ); 242 config->writeEntry( "ShowSummaryAfterSync", mShowSummaryAfterSync );
240 config->writeEntry( "AskForPreferences",mAskForPreferences ); 243 config->writeEntry( "AskForPreferences",mAskForPreferences );
241 config->writeEntry( "WriteBackExisting",mWriteBackExisting ); 244 config->writeEntry( "WriteBackExisting",mWriteBackExisting );
242 config->writeEntry( "WriteBackFuture",mWriteBackFuture ); 245 config->writeEntry( "WriteBackFuture",mWriteBackFuture );
243 config->writeEntry( "WriteBackFile",mWriteBackFile ); 246 config->writeEntry( "WriteBackFile",mWriteBackFile );
244 config->writeEntry( "WriteContactToSIM",mWriteContactToSIM ); 247 config->writeEntry( "WriteContactToSIM",mWriteContactToSIM );
245 config->writeEntry( "SyncPrefs", mSyncPrefs ); 248 config->writeEntry( "SyncPrefs", mSyncPrefs );
246 config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks); 249 config->writeEntry( "WriteBackFutureWeeks", mWriteBackFutureWeeks);
250 config->writeEntry( "WriteBackPastWeeks", mWriteBackPastWeeks);
247 config->writeEntry( "IsLocalFileSync", mIsLocalFileSync ); 251 config->writeEntry( "IsLocalFileSync", mIsLocalFileSync );
248 config->writeEntry( "IsPhoneSync", mIsPhoneSync ); 252 config->writeEntry( "IsPhoneSync", mIsPhoneSync );
249 config->writeEntry( "IsPiSync", mIsPiSync ); 253 config->writeEntry( "IsPiSync", mIsPiSync );
250 config->writeEntry( "IsKapiFile", mIsKapiFile ); 254 config->writeEntry( "IsKapiFile", mIsKapiFile );
251} 255}
252 256
diff --git a/libkdepim/ksyncprofile.h b/libkdepim/ksyncprofile.h
index 0a59111..e970b50 100644
--- a/libkdepim/ksyncprofile.h
+++ b/libkdepim/ksyncprofile.h
@@ -99,90 +99,93 @@ class KSyncProfile : public QObject {
99 QString getPhoneConnection( ) { return mPhoneConnection;} 99 QString getPhoneConnection( ) { return mPhoneConnection;}
100 void setPhoneModel( const QString& n ) { mPhoneModel = n;} 100 void setPhoneModel( const QString& n ) { mPhoneModel = n;}
101 QString getPhoneModel( ) { return mPhoneModel;} 101 QString getPhoneModel( ) { return mPhoneModel;}
102 /* 102 /*
103 void set( const QString& n ) { = n;} 103 void set( const QString& n ) { = n;}
104 QString get( ) { return ;} 104 QString get( ) { return ;}
105 */ 105 */
106 106
107 void setName( const QString& n ) {mName = n;} 107 void setName( const QString& n ) {mName = n;}
108 QString getName( ) { return mName;} 108 QString getName( ) { return mName;}
109 void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;} 109 void setShowSummaryAfterSync( bool b ) { mShowSummaryAfterSync = b;}
110 bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;} 110 bool getShowSummaryAfterSync( ) { return mShowSummaryAfterSync ;}
111 void setAskForPreferences( bool b ) { mAskForPreferences= b;} 111 void setAskForPreferences( bool b ) { mAskForPreferences= b;}
112 bool getAskForPreferences( ) { return mAskForPreferences;} 112 bool getAskForPreferences( ) { return mAskForPreferences;}
113 void setWriteBackExisting( bool b ) { mWriteBackExisting = b;} 113 void setWriteBackExisting( bool b ) { mWriteBackExisting = b;}
114 bool getWriteBackExisting( ) { return mWriteBackExisting;} 114 bool getWriteBackExisting( ) { return mWriteBackExisting;}
115 void setWriteBackFuture( bool b ) { mWriteBackFuture = b;} 115 void setWriteBackFuture( bool b ) { mWriteBackFuture = b;}
116 bool getWriteBackFuture( ) { return mWriteBackFuture;} 116 bool getWriteBackFuture( ) { return mWriteBackFuture;}
117 void setWriteBackFile( bool b ) { mWriteBackFile= b;} 117 void setWriteBackFile( bool b ) { mWriteBackFile= b;}
118 bool getWriteBackFile( ) { return mWriteBackFile;} 118 bool getWriteBackFile( ) { return mWriteBackFile;}
119 void setWriteContactToSIM( bool b ) { mWriteContactToSIM= b;} 119 void setWriteContactToSIM( bool b ) { mWriteContactToSIM= b;}
120 bool getWriteContactToSIM( ) { return mWriteContactToSIM;} 120 bool getWriteContactToSIM( ) { return mWriteContactToSIM;}
121 void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;} 121 void setIncludeInRingSync( bool b ) {mIncludeInRingSync = b;}
122 bool getIncludeInRingSync( ) { return mIncludeInRingSync;} 122 bool getIncludeInRingSync( ) { return mIncludeInRingSync;}
123 void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;} 123 void setIncludeInRingSyncAB( bool b ) {mIncludeInRingSyncAB = b;}
124 bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;} 124 bool getIncludeInRingSyncAB( ) { return mIncludeInRingSyncAB;}
125 void setIncludeInRingSyncPWM( bool b ) {mIncludeInRingSyncPWM = b;} 125 void setIncludeInRingSyncPWM( bool b ) {mIncludeInRingSyncPWM = b;}
126 bool getIncludeInRingSyncPWM( ) { return mIncludeInRingSyncPWM;} 126 bool getIncludeInRingSyncPWM( ) { return mIncludeInRingSyncPWM;}
127 void setSyncPrefs( int n ) { mSyncPrefs= n;} 127 void setSyncPrefs( int n ) { mSyncPrefs= n;}
128 int getSyncPrefs( ) { return mSyncPrefs;} 128 int getSyncPrefs( ) { return mSyncPrefs;}
129 void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;} 129 void setWriteBackFutureWeeks( int n ) { mWriteBackFutureWeeks= n;}
130 int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;} 130 int getWriteBackFutureWeeks( ) { return mWriteBackFutureWeeks;}
131 void setWriteBackPastWeeks( int n ) { mWriteBackPastWeeks= n;}
132 int getWriteBackPastWeeks( ) { return mWriteBackPastWeeks;}
131 void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;} 133 void setIsLocalFileSync( bool b ) { mIsLocalFileSync= b;}
132 bool getIsLocalFileSync( ) { return mIsLocalFileSync;} 134 bool getIsLocalFileSync( ) { return mIsLocalFileSync;}
133 void setIsPhoneSync( bool b ) { mIsPhoneSync= b;} 135 void setIsPhoneSync( bool b ) { mIsPhoneSync= b;}
134 bool getIsPhoneSync( ) { return mIsPhoneSync;} 136 bool getIsPhoneSync( ) { return mIsPhoneSync;}
135 void setIsPiSync( bool b ) { mIsPiSync= b;} 137 void setIsPiSync( bool b ) { mIsPiSync= b;}
136 bool getIsPiSync( ) { return mIsPiSync;} 138 bool getIsPiSync( ) { return mIsPiSync;}
137 void setIsKapiFile( bool b ) { mIsKapiFile= b;} 139 void setIsKapiFile( bool b ) { mIsKapiFile= b;}
138 bool getIsKapiFile( ) { return mIsKapiFile;} 140 bool getIsKapiFile( ) { return mIsKapiFile;}
139 private: 141 private:
140 QString mName; 142 QString mName;
141 QString mPreSyncCommand; 143 QString mPreSyncCommand;
142 QString mPostSyncCommand; 144 QString mPostSyncCommand;
143 QString mLocalTempFile; 145 QString mLocalTempFile;
144 QString mRemoteFileName; 146 QString mRemoteFileName;
145 QString mPreSyncCommandAB; 147 QString mPreSyncCommandAB;
146 QString mPostSyncCommandAB; 148 QString mPostSyncCommandAB;
147 QString mLocalTempFileAB; 149 QString mLocalTempFileAB;
148 QString mRemoteFileNameAB; 150 QString mRemoteFileNameAB;
149 QString mPreSyncCommandPWM; 151 QString mPreSyncCommandPWM;
150 QString mPostSyncCommandPWM; 152 QString mPostSyncCommandPWM;
151 QString mLocalTempFilePWM; 153 QString mLocalTempFilePWM;
152 QString mRemoteFileNamePWM; 154 QString mRemoteFileNamePWM;
153 155
154 QString mRemotePw; 156 QString mRemotePw;
155 QString mRemoteIP; 157 QString mRemoteIP;
156 QString mRemotePort; 158 QString mRemotePort;
157 159
158 QString mRemotePwAB; 160 QString mRemotePwAB;
159 QString mRemoteIPAB; 161 QString mRemoteIPAB;
160 QString mRemotePortAB; 162 QString mRemotePortAB;
161 163
162 QString mRemotePwPWM; 164 QString mRemotePwPWM;
163 QString mRemoteIPPWM; 165 QString mRemoteIPPWM;
164 QString mRemotePortPWM; 166 QString mRemotePortPWM;
165 167
166 QString mPhoneDevice; 168 QString mPhoneDevice;
167 QString mPhoneConnection; 169 QString mPhoneConnection;
168 QString mPhoneModel; 170 QString mPhoneModel;
169 171
170 bool mIncludeInRingSync; 172 bool mIncludeInRingSync;
171 bool mIncludeInRingSyncAB; 173 bool mIncludeInRingSyncAB;
172 bool mIncludeInRingSyncPWM; 174 bool mIncludeInRingSyncPWM;
173 int mSyncPrefs; 175 int mSyncPrefs;
174 bool mWriteBackFile; 176 bool mWriteBackFile;
175 bool mWriteBackExisting; 177 bool mWriteBackExisting;
176 bool mWriteBackFuture; 178 bool mWriteBackFuture;
177 int mWriteBackFutureWeeks; 179 int mWriteBackFutureWeeks;
180 int mWriteBackPastWeeks;
178 bool mAskForPreferences; 181 bool mAskForPreferences;
179 bool mShowSummaryAfterSync; 182 bool mShowSummaryAfterSync;
180 bool mIsLocalFileSync; 183 bool mIsLocalFileSync;
181 bool mIsPhoneSync; 184 bool mIsPhoneSync;
182 bool mWriteContactToSIM; 185 bool mWriteContactToSIM;
183 186
184 bool mIsPiSync; 187 bool mIsPiSync;
185 bool mIsKapiFile; 188 bool mIsKapiFile;
186}; 189};
187 190
188#endif 191#endif