author | zautrix <zautrix> | 2004-10-07 17:51:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 17:51:17 (UTC) |
commit | 1f1538e5707b59bfcff2014901f29a65589229e3 (patch) (unidiff) | |
tree | 0d91a303524e6ac9f7c954f01a0e1d09d0e305e7 /libkdepim | |
parent | bb8293c794d82a57bc93af85ccd89b601356d577 (diff) | |
download | kdepimpi-1f1538e5707b59bfcff2014901f29a65589229e3.zip kdepimpi-1f1538e5707b59bfcff2014901f29a65589229e3.tar.gz kdepimpi-1f1538e5707b59bfcff2014901f29a65589229e3.tar.bz2 |
many cleanups
-rw-r--r-- | libkdepim/kpimprefs.cpp | 9 | ||||
-rw-r--r-- | libkdepim/kpimprefs.h | 3 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 166 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 3 |
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 | |||
@@ -39,7 +39,14 @@ KPimPrefs::KPimPrefs( const QString &name ) : | |||
39 | KPrefs( name ) | 39 | KPrefs( 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 | } |
45 | 52 | ||
diff --git a/libkdepim/kpimprefs.h b/libkdepim/kpimprefs.h index fde8093..9346f7d 100644 --- a/libkdepim/kpimprefs.h +++ b/libkdepim/kpimprefs.h | |||
@@ -58,5 +58,6 @@ class KPimPrefs : public KPrefs | |||
58 | QString mPassiveSyncPort; | 58 | QString mPassiveSyncPort; |
59 | QString mPassiveSyncPw; | 59 | QString mPassiveSyncPw; |
60 | 60 | int mRingSyncAlgoPrefs; | |
61 | QString mLastSyncedLocalFile; | ||
61 | 62 | ||
62 | 63 | ||
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index fad9a76..568c2a9 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -77,5 +77,5 @@ KSyncManager::~KSyncManager() | |||
77 | } | 77 | } |
78 | 78 | ||
79 | //LR ok | 79 | |
80 | void KSyncManager::fillSyncMenu() | 80 | void KSyncManager::fillSyncMenu() |
81 | { | 81 | { |
@@ -102,4 +102,5 @@ void KSyncManager::fillSyncMenu() | |||
102 | prof << i18n("Sharp_DTM"); | 102 | prof << i18n("Sharp_DTM"); |
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 (); |
105 | temp->setName( prof[0] ); | 106 | temp->setName( prof[0] ); |
@@ -107,4 +108,6 @@ void KSyncManager::fillSyncMenu() | |||
107 | temp->setName( prof[1] ); | 108 | temp->setName( prof[1] ); |
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"); |
110 | config.writeEntry("SyncProfileNames",prof); | 113 | config.writeEntry("SyncProfileNames",prof); |
@@ -127,6 +130,7 @@ void KSyncManager::fillSyncMenu() | |||
127 | } | 130 | } |
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 | } |
132 | 136 | ||
@@ -192,23 +196,23 @@ void KSyncManager::slotSyncMenu( int action ) | |||
192 | } else if ( action >= 1003 ) { | 196 | } else if ( action >= 1003 ) { |
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 { |
214 | if ( temp->getIsPhoneSync() ) { | 218 | if ( temp->getIsPhoneSync() ) { |
@@ -240,4 +244,5 @@ void KSyncManager::slotSyncMenu( int action ) | |||
240 | setBlockSave(false); | 244 | setBlockSave(false); |
241 | } | 245 | } |
246 | |||
242 | void KSyncManager::enableQuick() | 247 | void KSyncManager::enableQuick() |
243 | { | 248 | { |
@@ -286,5 +291,4 @@ void KSyncManager::enableQuick() | |||
286 | return; | 291 | return; |
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() ) ); |
290 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 294 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
@@ -294,5 +298,5 @@ void KSyncManager::syncLocalFile() | |||
294 | { | 298 | { |
295 | 299 | ||
296 | QString fn =mLastSyncedLocalFile; | 300 | QString fn =mPrefs->mLastSyncedLocalFile; |
297 | QString ext; | 301 | QString ext; |
298 | 302 | ||
@@ -322,4 +326,5 @@ void KSyncManager::syncLocalFile() | |||
322 | 326 | ||
323 | } | 327 | } |
328 | |||
324 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 329 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
325 | { | 330 | { |
@@ -354,16 +359,18 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) | |||
354 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); | 359 | mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); |
355 | if ( ! quick ) | 360 | if ( ! quick ) |
356 | mLastSyncedLocalFile = fn; | 361 | mPrefs->mLastSyncedLocalFile = fn; |
357 | } | 362 | } |
358 | return ret; | 363 | return ret; |
359 | } | 364 | } |
365 | |||
360 | void KSyncManager::quickSyncLocalFile() | 366 | void KSyncManager::quickSyncLocalFile() |
361 | { | 367 | { |
362 | 368 | ||
363 | if ( syncWithFile( mLastSyncedLocalFile, false ) ) { | 369 | if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) { |
364 | qDebug("quick syncLocalFile() successful "); | 370 | qDebug("quick syncLocalFile() successful "); |
365 | 371 | ||
366 | } | 372 | } |
367 | } | 373 | } |
374 | |||
368 | void KSyncManager::multiSync( bool askforPrefs ) | 375 | void KSyncManager::multiSync( bool askforPrefs ) |
369 | { | 376 | { |
@@ -372,5 +379,5 @@ void KSyncManager::multiSync( bool askforPrefs ) | |||
372 | setBlockSave(true); | 379 | setBlockSave(true); |
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, |
376 | i18n("Yes"), i18n("No"), | 383 | i18n("Yes"), i18n("No"), |
@@ -381,5 +388,5 @@ void KSyncManager::multiSync( bool askforPrefs ) | |||
381 | } | 388 | } |
382 | mCurrentSyncDevice = i18n("Multiple profiles") ; | 389 | mCurrentSyncDevice = i18n("Multiple profiles") ; |
383 | mSyncAlgoPrefs = mRingSyncAlgoPrefs; | 390 | mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; |
384 | if ( askforPrefs ) { | 391 | if ( askforPrefs ) { |
385 | edit_sync_options(); | 392 | edit_sync_options(); |
@@ -395,9 +402,10 @@ void KSyncManager::multiSync( bool askforPrefs ) | |||
395 | emit save(); | 402 | emit save(); |
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 |
399 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); | 406 | mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); |
400 | return; | 407 | return; |
401 | } | 408 | } |
409 | |||
402 | int KSyncManager::ringSync() | 410 | int KSyncManager::ringSync() |
403 | { | 411 | { |
@@ -414,24 +422,24 @@ int KSyncManager::ringSync() | |||
414 | temp->readConfig(&config); | 422 | temp->readConfig(&config); |
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 ... ")); |
437 | ++syncedProfiles; | 445 | ++syncedProfiles; |
@@ -449,22 +457,22 @@ int KSyncManager::ringSync() | |||
449 | } else { | 457 | } else { |
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 { |
470 | if ( temp->getIsPhoneSync() ) { | 478 | if ( temp->getIsPhoneSync() ) { |
@@ -473,4 +481,19 @@ int KSyncManager::ringSync() | |||
473 | mPhoneModel = temp->getPhoneModel( ); | 481 | mPhoneModel = temp->getPhoneModel( ); |
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 |
476 | syncRemote( temp, false ); | 499 | syncRemote( temp, false ); |
@@ -559,5 +582,5 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
559 | question, | 582 | question, |
560 | i18n("Okay!")) ; | 583 | i18n("Okay!")) ; |
561 | mParent->topLevelWidget()->setCaption (""); | 584 | mParent->topLevelWidget()->setCaption ("KDE-Pim"); |
562 | return; | 585 | return; |
563 | } | 586 | } |
@@ -565,11 +588,6 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) | |||
565 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); | 588 | //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); |
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 ) { |
575 | int fi; | 593 | int fi; |
@@ -645,4 +663,5 @@ void KSyncManager::edit_sync_options() | |||
645 | 663 | ||
646 | } | 664 | } |
665 | |||
647 | QString KSyncManager::getPassword( ) | 666 | QString KSyncManager::getPassword( ) |
648 | { | 667 | { |
@@ -686,9 +705,10 @@ void KSyncManager::confSync() | |||
686 | mSyncProfileNames = sp->getSyncProfileNames(); | 705 | mSyncProfileNames = sp->getSyncProfileNames(); |
687 | mLocalMachineName = sp->getLocalMachineName (); | 706 | mLocalMachineName = sp->getLocalMachineName (); |
688 | fillSyncMenu(); | 707 | QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); |
689 | } | 708 | } |
690 | 709 | ||
691 | void KSyncManager::syncSharp() | 710 | void KSyncManager::syncSharp() |
692 | { | 711 | { |
712 | |||
693 | if ( ! syncExternalApplication("sharp") ) | 713 | if ( ! syncExternalApplication("sharp") ) |
694 | qDebug("ERROR sync sharp ");; | 714 | qDebug("ERROR sync sharp ");; |
@@ -713,8 +733,6 @@ bool KSyncManager::syncExternalApplication(QString resource) | |||
713 | void KSyncManager::syncPhone() | 733 | void KSyncManager::syncPhone() |
714 | { | 734 | { |
715 | emit save(); | ||
716 | 735 | ||
717 | qDebug("pending syncPhone(); "); | 736 | syncExternalApplication("phone"); |
718 | //mView->syncPhone(); | ||
719 | 737 | ||
720 | } | 738 | } |
@@ -768,4 +786,5 @@ QString KSyncManager::syncFileName() | |||
768 | } | 786 | } |
769 | 787 | ||
788 | |||
770 | void KSyncManager::syncPi() | 789 | void KSyncManager::syncPi() |
771 | { | 790 | { |
@@ -1154,3 +1173,2 @@ void KCommandSocket::deleteSocket() | |||
1154 | emit commandFinished( this, mRetVal ); | 1173 | emit commandFinished( this, mRetVal ); |
1155 | } | 1174 | } |
1156 | |||
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 25892d8..7027894 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h | |||
@@ -118,4 +118,5 @@ class KSyncManager : public QObject | |||
118 | ~KSyncManager() ; | 118 | ~KSyncManager() ; |
119 | 119 | ||
120 | void multiSync( bool askforPrefs ); | ||
120 | bool blockSave() { return mBlockSaveFlag; } | 121 | bool blockSave() { return mBlockSaveFlag; } |
121 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } | 122 | void setBlockSave(bool sa) { mBlockSaveFlag = sa; } |
@@ -148,5 +149,4 @@ class KSyncManager : public QObject | |||
148 | QString mPhoneConnection; | 149 | QString mPhoneConnection; |
149 | QString mPhoneModel; | 150 | QString mPhoneModel; |
150 | QString mLastSyncedLocalFile; // save! | ||
151 | QString mPassWordPiSync; | 151 | QString mPassWordPiSync; |
152 | QString mActiveSyncPort; | 152 | QString mActiveSyncPort; |
@@ -179,5 +179,4 @@ class KSyncManager : public QObject | |||
179 | void syncSharp(); | 179 | void syncSharp(); |
180 | bool syncExternalApplication(QString); | 180 | bool syncExternalApplication(QString); |
181 | void multiSync( bool askforPrefs ); | ||
182 | int mCurrentSyncProfile ; | 181 | int mCurrentSyncProfile ; |
183 | void syncRemote( KSyncProfile* prof, bool ask = true); | 182 | void syncRemote( KSyncProfile* prof, bool ask = true); |