-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 @@ -40,5 +40,12 @@ KPimPrefs::KPimPrefs( const QString &name ) : { - config()->setGroup("General"); +#ifdef _WIN32_ + QString hdp= locateLocal("data","korganizer")+"\\\\"; +#else + QString hdp= locateLocal("data","korganizer")+"/"; +#endif + config()->setGroup("SyncOptions"); addItemString("PassiveSyncPort",&mPassiveSyncPort,"9197" ); addItemString("PassiveSyncPw",&mPassiveSyncPw,"abc" ); + addItemString("LastSyncedLocalFile", &mLastSyncedLocalFile ,hdp +"lastsync.ics" ); + addItemInt("RingSyncAlgoPrefs",&mRingSyncAlgoPrefs,3); } 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 QString mPassiveSyncPw; - + int mRingSyncAlgoPrefs; + QString mLastSyncedLocalFile; 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() -//LR ok + void KSyncManager::fillSyncMenu() @@ -103,2 +103,3 @@ void KSyncManager::fillSyncMenu() prof << i18n("Local_file"); + prof << i18n("Last_file"); KSyncProfile* temp = new KSyncProfile (); @@ -108,2 +109,4 @@ void KSyncManager::fillSyncMenu() temp->writeConfig(&config); + temp->setName( prof[2] ); + temp->writeConfig(&config); config.setGroup("General"); @@ -128,4 +131,5 @@ void KSyncManager::fillSyncMenu() else if (!app_dir.exists(QDir::homeDirPath()+"/Applications/dtm" ) ) { - mSyncMenu->setItemEnabled( 1000, false ); + mSyncMenu->removeItem( 1000 ); } + mSyncMenu->removeItem( 1002 ); } @@ -193,21 +197,21 @@ void KSyncManager::slotSyncMenu( int action ) if ( temp->getIsLocalFileSync() ) { - switch(mTargetApp) - { - case (KAPI): - if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) - mLastSyncedLocalFile = temp->getRemoteFileNameAB(); - break; - case (KOPI): - if ( syncWithFile( temp->getRemoteFileName( ), false ) ) - mLastSyncedLocalFile = temp->getRemoteFileName(); - break; - case (PWMPI): - if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) - mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); - break; - default: - qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); - break; + switch(mTargetApp) + { + case (KAPI): + if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) + mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); + break; + case (KOPI): + if ( syncWithFile( temp->getRemoteFileName( ), false ) ) + mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); + break; + case (PWMPI): + if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) + mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); + break; + default: + qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); + break; - } + } } else { @@ -241,2 +245,3 @@ void KSyncManager::slotSyncMenu( int action ) } + void KSyncManager::enableQuick() @@ -287,3 +292,2 @@ void KSyncManager::enableQuick() } - //connect( mServerSocket, SIGNAL ( saveFile() ),this, SIGNAL ( save() ) ); connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); @@ -295,3 +299,3 @@ void KSyncManager::syncLocalFile() - QString fn =mLastSyncedLocalFile; + QString fn =mPrefs->mLastSyncedLocalFile; QString ext; @@ -323,2 +327,3 @@ void KSyncManager::syncLocalFile() } + bool KSyncManager::syncWithFile( QString fn , bool quick ) @@ -355,3 +360,3 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) if ( ! quick ) - mLastSyncedLocalFile = fn; + mPrefs->mLastSyncedLocalFile = fn; } @@ -359,2 +364,3 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) } + void KSyncManager::quickSyncLocalFile() @@ -362,3 +368,3 @@ void KSyncManager::quickSyncLocalFile() - if ( syncWithFile( mLastSyncedLocalFile, false ) ) { + if ( syncWithFile( mPrefs->mLastSyncedLocalFile, false ) ) { qDebug("quick syncLocalFile() successful "); @@ -367,2 +373,3 @@ void KSyncManager::quickSyncLocalFile() } + void KSyncManager::multiSync( bool askforPrefs ) @@ -373,3 +380,3 @@ void KSyncManager::multiSync( bool askforPrefs ) QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); - if ( QMessageBox::information( mParent, i18n("Sync"), + if ( QMessageBox::information( mParent, i18n("KDE-Pim Sync"), question, @@ -382,3 +389,3 @@ void KSyncManager::multiSync( bool askforPrefs ) mCurrentSyncDevice = i18n("Multiple profiles") ; - mSyncAlgoPrefs = mRingSyncAlgoPrefs; + mSyncAlgoPrefs = mPrefs->mRingSyncAlgoPrefs; if ( askforPrefs ) { @@ -396,3 +403,3 @@ void KSyncManager::multiSync( bool askforPrefs ) if ( num ) - mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); + mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync complete!").arg(num) ); else @@ -401,2 +408,3 @@ void KSyncManager::multiSync( bool askforPrefs ) } + int KSyncManager::ringSync() @@ -415,22 +423,22 @@ int KSyncManager::ringSync() - QString includeInRingSync; - switch(mTargetApp) - { - case (KAPI): - includeInRingSync = temp->getIncludeInRingSyncAB(); - break; - case (KOPI): - includeInRingSync = temp->getIncludeInRingSync(); - break; - case (PWMPI): - includeInRingSync = temp->getIncludeInRingSyncPWM(); - break; - default: - qDebug("KSyncManager::ringSync: invalid apptype selected"); - break; + QString includeInRingSync; + switch(mTargetApp) + { + case (KAPI): + includeInRingSync = temp->getIncludeInRingSyncAB(); + break; + case (KOPI): + includeInRingSync = temp->getIncludeInRingSync(); + break; + case (PWMPI): + includeInRingSync = temp->getIncludeInRingSyncPWM(); + break; + default: + qDebug("KSyncManager::ringSync: invalid apptype selected"); + break; - } + } - if ( includeInRingSync && ( i < 1 || i > 2 )) { + if ( includeInRingSync && ( i < 1 || i > 2 )) { mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); @@ -450,20 +458,20 @@ int KSyncManager::ringSync() if ( temp->getIsLocalFileSync() ) { - switch(mTargetApp) - { - case (KAPI): - if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) - mLastSyncedLocalFile = temp->getRemoteFileNameAB(); - break; - case (KOPI): - if ( syncWithFile( temp->getRemoteFileName( ), false ) ) - mLastSyncedLocalFile = temp->getRemoteFileName(); - break; - case (PWMPI): - if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) - mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); - break; - default: - qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); - break; - } + switch(mTargetApp) + { + case (KAPI): + if ( syncWithFile( temp->getRemoteFileNameAB( ), false ) ) + mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNameAB(); + break; + case (KOPI): + if ( syncWithFile( temp->getRemoteFileName( ), false ) ) + mPrefs->mLastSyncedLocalFile = temp->getRemoteFileName(); + break; + case (PWMPI): + if ( syncWithFile( temp->getRemoteFileNamePWM( ), false ) ) + mPrefs->mLastSyncedLocalFile = temp->getRemoteFileNamePWM(); + break; + default: + qDebug("KSyncManager::slotSyncMenu: invalid apptype selected"); + break; + } } else { @@ -474,2 +482,17 @@ int KSyncManager::ringSync() syncPhone(); + } else if ( temp->getIsPiSync() ) { + if ( mTargetApp == KAPI ) { + mPassWordPiSync = temp->getRemotePwAB(); + mActiveSyncPort = temp->getRemotePortAB(); + mActiveSyncIP = temp->getRemoteIPAB(); + } else if ( mTargetApp == KOPI ) { + mPassWordPiSync = temp->getRemotePw(); + mActiveSyncPort = temp->getRemotePort(); + mActiveSyncIP = temp->getRemoteIP(); + } else { + mPassWordPiSync = temp->getRemotePwPWM(); + mActiveSyncPort = temp->getRemotePortPWM(); + mActiveSyncIP = temp->getRemoteIPPWM(); + } + syncPi(); } else @@ -560,3 +583,3 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) i18n("Okay!")) ; - mParent->topLevelWidget()->setCaption (""); + mParent->topLevelWidget()->setCaption ("KDE-Pim"); return; @@ -566,9 +589,4 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask) - - if ( syncWithFile( localTempFile, true ) ) { -// Event* e = mView->getLastSyncEvent(); -// e->setReadOnly( false ); -// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); -// e->setReadOnly( true ); + if ( mWriteBackFile ) { @@ -646,2 +664,3 @@ void KSyncManager::edit_sync_options() } + QString KSyncManager::getPassword( ) @@ -687,3 +706,3 @@ void KSyncManager::confSync() mLocalMachineName = sp->getLocalMachineName (); - fillSyncMenu(); + QTimer::singleShot ( 1, this, SLOT ( fillSyncMenu() ) ); } @@ -692,2 +711,3 @@ void KSyncManager::syncSharp() { + if ( ! syncExternalApplication("sharp") ) @@ -714,6 +734,4 @@ void KSyncManager::syncPhone() { - emit save(); - qDebug("pending syncPhone(); "); - //mView->syncPhone(); + syncExternalApplication("phone"); @@ -769,2 +787,3 @@ QString KSyncManager::syncFileName() + void KSyncManager::syncPi() @@ -1155,2 +1174 @@ void KCommandSocket::deleteSocket() } - 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 + void multiSync( bool askforPrefs ); bool blockSave() { return mBlockSaveFlag; } @@ -149,3 +150,2 @@ class KSyncManager : public QObject QString mPhoneModel; - QString mLastSyncedLocalFile; // save! QString mPassWordPiSync; @@ -180,3 +180,2 @@ class KSyncManager : public QObject bool syncExternalApplication(QString); - void multiSync( bool askforPrefs ); int mCurrentSyncProfile ; |