summaryrefslogtreecommitdiffabout
path: root/libkdepim
Unidiff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/kpimprefs.cpp9
-rw-r--r--libkdepim/kpimprefs.h3
-rw-r--r--libkdepim/ksyncmanager.cpp166
-rw-r--r--libkdepim/ksyncmanager.h3
4 files changed, 103 insertions, 78 deletions
diff --git a/libkdepim/kpimprefs.cpp b/libkdepim/kpimprefs.cpp
index 0a2f5f1..c21ebaa 100644
--- a/libkdepim/kpimprefs.cpp
+++ b/libkdepim/kpimprefs.cpp
@@ -40,5 +40,12 @@ KPimPrefs::KPimPrefs( const QString &name ) :
40{ 40{
41 config()->setGroup("General"); 41#ifdef _WIN32_
42 QString hdp= locateLocal("data","korganizer")+"\\\\";
43#else
44 QString hdp= locateLocal("data","korganizer")+"/";
45#endif
46 config()->setGroup("SyncOptions");
42 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); 47 addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" );
43 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); 48 addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" );
49 addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" );
50 addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3);
44} 51}
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h
index fde8093..9346f7d 100644
--- a/libkdepim/kpimprefs.h
+++ b/libkdepim/kpimprefs.h
@@ -59,3 +59,4 @@ class KPimPrefs : public KPrefs
59 QString mPassiveSyncPw; 59 QString mPassiveSyncPw;
60 60 int mRingSyncAlgoPrefs;
61 QString mLastSyncedLocalFile;
61 62
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index fad9a76..568c2a9 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -78,3 +78,3 @@ KSyncManager::~KSyncManager()
78 78
79//LR ok 79
80void KSyncManager::fillSyncMenu() 80void KSyncManager::fillSyncMenu()
@@ -103,2 +103,3 @@ void KSyncManager::fillSyncMenu()
103 prof << i18n("Local_file"); 103 prof << i18n("Local_file");
104 prof << i18n("Last_file");
104 KSyncProfile* temp = new KSyncProfile (); 105 KSyncProfile* temp = new KSyncProfile ();
@@ -108,2 +109,4 @@ void KSyncManager::fillSyncMenu()
108 temp->writeConfig(&config); 109 temp->writeConfig(&config);
110 temp->setName( prof[2] );
111 temp->writeConfig(&config);
109 config.setGroup("General"); 112 config.setGroup("General");
@@ -128,4 +131,5 @@ void KSyncManager::fillSyncMenu()
128 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { 131 else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) {
129 mSyncMenu->setItemEnabled( 1000, false ); 132 mSyncMenu->removeItem( 1000 );
130 } 133 }
134 mSyncMenu->removeItem( 1002 );
131} 135}
@@ -193,21 +197,21 @@ void KSyncManager::slotSyncMenu( int action )
193 if ( temp->getIsLocalFileSync() ) { 197 if ( temp->getIsLocalFileSync() ) {
194 switch(mTargetApp) 198 switch(mTargetApp)
195 { 199 {
196 case (KAPI): 200 case (KAPI):
197 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 201 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
198 mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 202 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
199 break; 203 break;
200 case (KOPI): 204 case (KOPI):
201 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 205 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
202 mLastSyncedLocalFile = temp->getRemoteFileName(); 206 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
203 break; 207 break;
204 case (PWMPI): 208 case (PWMPI):
205 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 209 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
206 mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 210 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
207 break; 211 break;
208 default: 212 default:
209 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 213 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
210 break; 214 break;
211 215
212 } 216 }
213 } else { 217 } else {
@@ -241,2 +245,3 @@ void KSyncManager::slotSyncMenu( int action )
241} 245}
246
242void KSyncManager::enableQuick() 247void KSyncManager::enableQuick()
@@ -287,3 +292,2 @@ void KSyncManager::enableQuick()
287 } 292 }
288 //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) );
289 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 293 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
@@ -295,3 +299,3 @@ void KSyncManager::syncLocalFile()
295 299
296 QString fn =mLastSyncedLocalFile; 300 QString fn =mPrefs->mLastSyncedLocalFile;
297 QString ext; 301 QString ext;
@@ -323,2 +327,3 @@ void KSyncManager::syncLocalFile()
323} 327}
328
324bool KSyncManager::syncWithFile( QString fn , bool quick ) 329bool KSyncManager::syncWithFile( QString fn , bool quick )
@@ -355,3 +360,3 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
355 if ( ! quick ) 360 if ( ! quick )
356 mLastSyncedLocalFile = fn; 361 mPrefs->mLastSyncedLocalFile = fn;
357 } 362 }
@@ -359,2 +364,3 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
359} 364}
365
360void KSyncManager::quickSyncLocalFile() 366void KSyncManager::quickSyncLocalFile()
@@ -362,3 +368,3 @@ void KSyncManager::quickSyncLocalFile()
362 368
363 if ( syncWithFile( mLastSyncedLocalFile, false ) ) { 369 if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) {
364 qDebug("quick syncLocalFile() successful "); 370 qDebug("quick syncLocalFile() successful ");
@@ -367,2 +373,3 @@ void KSyncManager::quickSyncLocalFile()
367} 373}
374
368void KSyncManager::multiSync( bool askforPrefs ) 375void KSyncManager::multiSync( bool askforPrefs )
@@ -373,3 +380,3 @@ void KSyncManager::multiSync( bool askforPrefs )
373 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 380 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
374 if ( QMessageBox::information( mParent, i18n("Sync"), 381 if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"),
375 question, 382 question,
@@ -382,3 +389,3 @@ void KSyncManager::multiSync( bool askforPrefs )
382 mCurrentSyncDevice = i18n("Multiple profiles") ; 389 mCurrentSyncDevice = i18n("Multiple profiles") ;
383 mSyncAlgoPrefs = mRingSyncAlgoPrefs; 390 mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs;
384 if ( askforPrefs ) { 391 if ( askforPrefs ) {
@@ -396,3 +403,3 @@ void KSyncManager::multiSync( bool askforPrefs )
396 if ( num ) 403 if ( num )
397 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 404 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) );
398 else 405 else
@@ -401,2 +408,3 @@ void KSyncManager::multiSync( bool askforPrefs )
401} 408}
409
402int KSyncManager::ringSync() 410int KSyncManager::ringSync()
@@ -415,22 +423,22 @@ int KSyncManager::ringSync()
415 423
416 QString includeInRingSync; 424 QString includeInRingSync;
417 switch(mTargetApp) 425 switch(mTargetApp)
418 { 426 {
419 case (KAPI): 427 case (KAPI):
420 includeInRingSync = temp->getIncludeInRingSyncAB(); 428 includeInRingSync = temp->getIncludeInRingSyncAB();
421 break; 429 break;
422 case (KOPI): 430 case (KOPI):
423 includeInRingSync = temp->getIncludeInRingSync(); 431 includeInRingSync = temp->getIncludeInRingSync();
424 break; 432 break;
425 case (PWMPI): 433 case (PWMPI):
426 includeInRingSync = temp->getIncludeInRingSyncPWM(); 434 includeInRingSync = temp->getIncludeInRingSyncPWM();
427 break; 435 break;
428 default: 436 default:
429 qDebug("KSyncManager::ringSync: invalid apptype selected"); 437 qDebug("KSyncManager::ringSync: invalid apptype selected");
430 break; 438 break;
431 439
432 } 440 }
433 441
434 442
435 if ( includeInRingSync && ( i < 1 || i > 2 )) { 443 if ( includeInRingSync && ( i < 1 || i > 2 )) {
436 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 444 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
@@ -450,20 +458,20 @@ int KSyncManager::ringSync()
450 if ( temp->getIsLocalFileSync() ) { 458 if ( temp->getIsLocalFileSync() ) {
451 switch(mTargetApp) 459 switch(mTargetApp)
452 { 460 {
453 case (KAPI): 461 case (KAPI):
454 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) 462 if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) )
455 mLastSyncedLocalFile = temp->getRemoteFileNameAB(); 463 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB();
456 break; 464 break;
457 case (KOPI): 465 case (KOPI):
458 if ( syncWithFile( temp->getRemoteFileName( ), false ) ) 466 if ( syncWithFile( temp->getRemoteFileName( ), false ) )
459 mLastSyncedLocalFile = temp->getRemoteFileName(); 467 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName();
460 break; 468 break;
461 case (PWMPI): 469 case (PWMPI):
462 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) 470 if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) )
463 mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); 471 mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM();
464 break; 472 break;
465 default: 473 default:
466 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); 474 qDebug("KSyncManager::slotSyncMenu: invalid apptype selected");
467 break; 475 break;
468 } 476 }
469 } else { 477 } else {
@@ -474,2 +482,17 @@ int KSyncManager::ringSync()
474 syncPhone(); 482 syncPhone();
483 } else if ( temp->getIsPiSync() ) {
484 if ( mTargetApp == KAPI ) {
485 mPassWordPiSync = temp->getRemotePwAB();
486 mActiveSyncPort = temp->getRemotePortAB();
487 mActiveSyncIP = temp->getRemoteIPAB();
488 } else if ( mTargetApp == KOPI ) {
489 mPassWordPiSync = temp->getRemotePw();
490 mActiveSyncPort = temp->getRemotePort();
491 mActiveSyncIP = temp->getRemoteIP();
492 } else {
493 mPassWordPiSync = temp->getRemotePwPWM();
494 mActiveSyncPort = temp->getRemotePortPWM();
495 mActiveSyncIP = temp->getRemoteIPPWM();
496 }
497 syncPi();
475 } else 498 } else
@@ -560,3 +583,3 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
560 i18n("Okay!")) ; 583 i18n("Okay!")) ;
561 mParent->topLevelWidget()->setCaption (""); 584 mParent->topLevelWidget()->setCaption ("KDE-Pim");
562 return; 585 return;
@@ -566,9 +589,4 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
566 589
567
568
569 if ( syncWithFile( localTempFile, true ) ) { 590 if ( syncWithFile( localTempFile, true ) ) {
570// Event* e = mView->getLastSyncEvent(); 591
571// e->setReadOnly( false );
572// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
573// e->setReadOnly( true );
574 if ( mWriteBackFile ) { 592 if ( mWriteBackFile ) {
@@ -646,2 +664,3 @@ void KSyncManager::edit_sync_options()
646} 664}
665
647QString KSyncManager::getPassword( ) 666QString KSyncManager::getPassword( )
@@ -687,3 +706,3 @@ void KSyncManager::confSync()
687 mLocalMachineName = sp->getLocalMachineName (); 706 mLocalMachineName = sp->getLocalMachineName ();
688 fillSyncMenu(); 707 QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) );
689} 708}
@@ -692,2 +711,3 @@ void KSyncManager::syncSharp()
692{ 711{
712
693 if ( ! syncExternalApplication("sharp") ) 713 if ( ! syncExternalApplication("sharp") )
@@ -714,6 +734,4 @@ void KSyncManager::syncPhone()
714{ 734{
715 emit save();
716 735
717 qDebug("pending syncPhone(); "); 736 syncExternalApplication("phone");
718 //mView->syncPhone();
719 737
@@ -769,2 +787,3 @@ QString KSyncManager::syncFileName()
769 787
788
770void KSyncManager::syncPi() 789void KSyncManager::syncPi()
@@ -1155,2 +1174 @@ void KCommandSocket::deleteSocket()
1155} }
1156
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 25892d8..7027894 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -119,2 +119,3 @@ class KSyncManager : public QObject
119 119
120 void multiSync( bool askforPrefs );
120 bool blockSave() { return mBlockSaveFlag; } 121 bool blockSave() { return mBlockSaveFlag; }
@@ -149,3 +150,2 @@ class KSyncManager : public QObject
149 QString mPhoneModel; 150 QString mPhoneModel;
150 QString mLastSyncedLocalFile; // save!
151 QString mPassWordPiSync; 151 QString mPassWordPiSync;
@@ -180,3 +180,2 @@ class KSyncManager : public QObject
180 bool syncExternalApplication(QString); 180 bool syncExternalApplication(QString);
181 void multiSync( bool askforPrefs );
182 int mCurrentSyncProfile ; 181 int mCurrentSyncProfile ;