From 231e6f8215bbc4f7e301965f8f3c650e44586ec9 Mon Sep 17 00:00:00 2001 From: zautrix Date: Fri, 25 Nov 2005 18:35:16 +0000 Subject: sync --- diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 719d80b..61a9899 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -323,7 +323,7 @@ void KSyncManager::slotSyncMenu( int action ) mActiveSyncIP = temp->getRemoteIPAB(); } else if ( mTargetApp == KOPI ) { if ( temp->getIsPiSyncSpec() ) - mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); + mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true ); mPassWordPiSync = temp->getRemotePw(); mActiveSyncPort = temp->getRemotePort(); mActiveSyncIP = temp->getRemoteIP(); @@ -665,7 +665,7 @@ int KSyncManager::ringSync() mActiveSyncPort = temp->getRemotePortAB(); mActiveSyncIP = temp->getRemoteIPAB(); } else if ( mTargetApp == KOPI ) { - mSpecificResources = QStringList::split( ":", temp->getResSpecKopi() ); + mSpecificResources = QStringList::split( ":", temp->getResSpecKopi(),true ); mPassWordPiSync = temp->getRemotePw(); mActiveSyncPort = temp->getRemotePort(); mActiveSyncIP = temp->getRemoteIP(); @@ -1141,21 +1141,30 @@ void KSyncManager::syncPi() mCurrentResourceLocal = ""; 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; } diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp index 27f7932..744a914 100644 --- a/libkdepim/ksyncprefsdialog.cpp +++ b/libkdepim/ksyncprefsdialog.cpp @@ -591,14 +591,16 @@ void KSyncPrefsDialog::profileChanged( int item ) mIsKapiFileR->setChecked(prof->getIsKapiFile()) ; - QStringList res = QStringList::split( ":",prof->getResSpecKopi()); - int i= res.count()/2; - for ( ;i < res.count(); ++i ) { - mResTableKopi->setText( i, 0, res[i] ); + QStringList res = QStringList::split( ":",prof->getResSpecKopi(), true ); + int add = res.count()/2; + int i; + for ( i = 0;i < add ; ++i ) { + mResTableKopi->setText( i, 0, res[i+add] ); } - res = QStringList::split( ":",prof->getResSpecKapi()); - for ( i = 0;i < res.count(); ++i ) { - mResTableKapi->setText( i, 0, res[i] ); + res = QStringList::split( ":",prof->getResSpecKapi(), true); + add = res.count()/2; + for ( i = 0;i < add; ++i ) { + mResTableKapi->setText( i, 0, res[i+add] ); } mIsNotLocal->setChecked(!prof->getIsLocalFileSync() && !prof->getIsPhoneSync() &&!prof->getIsPiSync() &&!prof->getIsPiSyncSpec()); proGr->setEnabled( item > 2 ); diff --git a/libkdepim/ksyncprofile.cpp b/libkdepim/ksyncprofile.cpp index d6620c8..b0d3efc 100644 --- a/libkdepim/ksyncprofile.cpp +++ b/libkdepim/ksyncprofile.cpp @@ -142,6 +142,8 @@ void KSyncProfile::setDefault() mFilterOutCal = "no filter"; mFilterInAB = "no filter"; mFilterOutAB = "no filter"; + mResSpecKopi = ""; + mResSpecKapi = ""; } void KSyncProfile::readConfig(KConfig *config ) { -- cgit v0.9.0.2