author | zautrix <zautrix> | 2005-11-25 19:44:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 19:44:15 (UTC) |
commit | 7a439999b9fa2bd7ad76e195cdf95bf5211952cb (patch) (side-by-side diff) | |
tree | 88c7e5771ed955004b6ef3b74c339e6b44b8a7ad | |
parent | 231e6f8215bbc4f7e301965f8f3c650e44586ec9 (diff) | |
download | kdepimpi-7a439999b9fa2bd7ad76e195cdf95bf5211952cb.zip kdepimpi-7a439999b9fa2bd7ad76e195cdf95bf5211952cb.tar.gz kdepimpi-7a439999b9fa2bd7ad76e195cdf95bf5211952cb.tar.bz2 |
sync
-rw-r--r-- | korganizer/koprefs.cpp | 8 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 13 |
2 files changed, 18 insertions, 3 deletions
diff --git a/korganizer/koprefs.cpp b/korganizer/koprefs.cpp index 31ef338..9147af3 100644 --- a/korganizer/koprefs.cpp +++ b/korganizer/koprefs.cpp @@ -533,12 +533,20 @@ int KOPrefs::getFuzzyCalendarID( const QString & name ) KopiCalendarFile * kkf = mCalendars.first(); while ( kkf ) { if ( name.lower() == kkf->mName.lower()) return kkf->mCalNumber; kkf = mCalendars.next(); } + QString name2 = name; + name2.replace (QRegExp ("_")," " ); + kkf = mCalendars.first(); + while ( kkf ) { + if ( name2.lower() == kkf->mName.lower()) + return kkf->mCalNumber; + kkf = mCalendars.next(); + } return 0; } QString KOPrefs::calName( int calNum) const { return (mDefCalColors[calNum-1])->mName; } diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 61a9899..795cd30 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -1137,40 +1137,45 @@ void KSyncManager::syncPi() mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); mPisyncFinished = true; return; } mCurrentResourceLocal = ""; mCurrentResourceRemote = ""; + qDebug ( "KSM: sync pi %d",mSpecificResources.count() ); if ( mSpecificResources.count() ) { int lastSyncRes = mSpecificResources.count()/2; int ccc = mSpecificResources.count()-1; while ( lastSyncRes > 0 && ccc > 0 && mSpecificResources[ ccc ].isEmpty() ) { --ccc; --lastSyncRes; + qDebug ( "KSM: sync pi %d",ccc ); } int startLocal = 0; int startRemote = mSpecificResources.count()/2; emit multiResourceSyncStart( true ); while ( startLocal < mSpecificResources.count()/2 ) { if ( startLocal+1 >= lastSyncRes ) emit multiResourceSyncStart( false ); mPisyncFinished = false; mCurrentResourceLocal = mSpecificResources[ startLocal ]; - mCurrentResourceRemote = mSpecificResources[ startRemote ]; + mCurrentResourceRemote = mSpecificResources[ startRemote ]; + qDebug ( "KSM: AAASyncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); 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(); } } + ++startRemote; ++startLocal; } + mPisyncFinished = true; } else { KCommandSocket* commandSocket = new KCommandSocket( "", mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); commandSocket->readFile( syncFileName() ); } } @@ -1513,12 +1518,14 @@ void KServerSocket::readBackFileFromSocket() 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"; + else + mRemoteResource.replace (QRegExp (" "),"_" ); mPassWord = password; mSocket = 0; mFirst = false; mFirstLine = true; mPort = port; mHost = host; @@ -1539,13 +1546,13 @@ void KCommandSocket::sendFileRequest() mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); mTimerSocket->start( 100, true ); QTextStream os( mSocket ); os.setEncoding( QTextStream::Latin1 ); QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); - os << "GET " << mPassWord << curDt << mRemoteResource << "\r\n\r\n"; + os << "GET " << mPassWord << curDt << " " << mRemoteResource << "\r\n\r\n"; } void KCommandSocket::readFile( QString fn ) { if ( !mSocket ) { mSocket = new QSocket( this ); @@ -1614,13 +1621,13 @@ void KCommandSocket::writeFileToSocket() mConnectProgress.setProgress( count ); mConnectProgress.blockSignals( true ); QTextStream ts2( &file2 ); ts2.setEncoding( QTextStream::Latin1 ); QTextStream os2( mSocket ); os2.setEncoding( QTextStream::Latin1 ); - os2 << "PUT " << mPassWord << mRemoteResource << "\r\n\r\n";; + os2 << "PUT " << mPassWord << " " << mRemoteResource << "\r\n\r\n";; int byteCount = 0; int byteMax = file2.size()/53; while ( ! ts2.atEnd() ) { qApp->processEvents(); if ( byteCount > byteMax ) { byteCount = 0; |