-rw-r--r-- | libkdepim/ksyncmanager.cpp | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 719d80b..61a9899 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -324,5 +324,5 @@ void KSyncManager::slotSyncMenu( int action ) } else if ( mTargetApp == KOPI ) { if ( temp->getIsPiSyncSpec() ) - mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); + mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true ); mPassWordPiSync = temp->getRemotePw(); mActiveSyncPort = temp->getRemotePort(); @@ -666,5 +666,5 @@ int KSyncManager::ringSync() mActiveSyncIP = temp->getRemoteIPAB(); } else if ( mTargetApp == KOPI ) { - mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); + mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true ); mPassWordPiSync = temp->getRemotePw(); mActiveSyncPort = temp->getRemotePort(); @@ -1142,19 +1142,28 @@ void KSyncManager::syncPi() mCurrentResourceRemote = ""; if ( mSpecificResources.count() ) { + int lastSyncRes = mSpecificResources.count()/2; + int ccc = mSpecificResources.count()-1; + while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { + --ccc; + --lastSyncRes; + } int startLocal = 0; int startRemote = mSpecificResources.count()/2; emit multiResourceSyncStart( true ); while ( startLocal < mSpecificResources.count()/2 ) { - if ( startLocal+1 >= mSpecificResources.count()/2 ) + if ( startLocal+1 >= lastSyncRes ) emit multiResourceSyncStart( false ); 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(); + if ( !mCurrentResourceRemote.isEmpty() ) { + qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); + 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; |