-rw-r--r-- | libkdepim/ksyncmanager.cpp | 47 |
1 files changed, 39 insertions, 8 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index d71264f..a64eb34 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -198,2 +198,3 @@ void KSyncManager::slotSyncMenu( int action ) qDebug("KSM::syncaction %d ", action); + mCurrentResourceLocal = ""; if ( action == 5000 ) @@ -315,3 +316,4 @@ void KSyncManager::slotSyncMenu( int action ) syncPhone(); - } else if ( temp->getIsPiSync() ) { + } else if ( temp->getIsPiSync()|| temp->getIsPiSyncSpec()) { + mSpecificResources.clear(); if ( mTargetApp == KAPI ) { @@ -321,2 +323,4 @@ void KSyncManager::slotSyncMenu( int action ) } else if ( mTargetApp == KOPI ) { + if ( temp->getIsPiSyncSpec() ) + mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); mPassWordPiSync = temp->getRemotePw(); @@ -505,3 +509,3 @@ bool KSyncManager::syncWithFile( QString fn , bool quick ) //qDebug("Now sycing ... "); - if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) + if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ,mCurrentResourceLocal ) ) mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") ); @@ -529,2 +533,3 @@ void KSyncManager::multiSync( bool askforPrefs ) setBlockSave(true); + mCurrentResourceLocal = ""; if ( askforPrefs ) { @@ -574,2 +579,3 @@ int KSyncManager::ringSync() mAskForPreferences = false; + mCurrentResourceLocal = ""; for ( i = 0; i < syncProfileNames.count(); ++i ) { @@ -651,3 +657,4 @@ int KSyncManager::ringSync() syncPhone(); - } else if ( temp->getIsPiSync() ) { + } else if ( temp->getIsPiSync() || temp->getIsPiSyncSpec()) { + mSpecificResources.clear(); if ( mTargetApp == KAPI ) { @@ -657,2 +664,3 @@ int KSyncManager::ringSync() } else if ( mTargetApp == KOPI ) { + mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); mPassWordPiSync = temp->getRemotePw(); @@ -1129,3 +1137,22 @@ void KSyncManager::syncPi() } - KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); + mCurrentResourceLocal = ""; + mCurrentResourceRemote = ""; + if ( mSpecificResources.count() ) { + int startLocal = 0; + int startRemote = mSpecificResources.count()/2; + while ( startLocal < mSpecificResources.count()/2 ) { + mPisyncFinished = false; + mCurrentResourceLocal = mSpecificResources[ startLocal ]; + mCurrentResourceRemote = mSpecificResources[ startRemote ]; + KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); + connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); + commandSocket->readFile( syncFileName() ); + while ( !mPisyncFinished ) { + //qDebug("waiting "); + qApp->processEvents(); + } + ++startLocal; + } + } else { + KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); @@ -1133,2 +1160,3 @@ void KSyncManager::syncPi() } +} @@ -1156,3 +1184,3 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) if ( state == KCommandSocket::errorR ) { - KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); + KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); @@ -1193,3 +1221,3 @@ void KSyncManager::readFileFromSocket() } - KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); + KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); @@ -1464,4 +1492,7 @@ void KServerSocket::readBackFileFromSocket() -KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) +KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) { + mRemoteResource = remres; + if ( mRemoteResource.isEmpty() ) + mRemoteResource = "ALL"; mPassWord = password; @@ -1492,3 +1523,3 @@ void KCommandSocket::sendFileRequest() QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); - os << "GET " << mPassWord << curDt <<"\r\n\r\n"; + os << "GET " << mPassWord << curDt << mRemoteResource << "\r\n\r\n"; } |