-rw-r--r-- | libkdepim/ksyncmanager.cpp | 18 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 6 |
2 files changed, 21 insertions, 3 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index a64eb34..719d80b 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -197,6 +197,7 @@ void KSyncManager::slotSyncMenu( int action ) { qDebug("KSM::syncaction %d ", action); mCurrentResourceLocal = ""; + emit multiResourceSyncStart( false ); if ( action == 5000 ) return; mSyncWithDesktop = false; @@ -441,6 +442,8 @@ void KSyncManager::enableQuick( bool ask ) } connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); + connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) ); + connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) ); } void KSyncManager::displayErrorPort() { @@ -569,7 +572,7 @@ void KSyncManager::multiSync( bool askforPrefs ) int KSyncManager::ringSync() { - + emit multiResourceSyncStart( false ); int syncedProfiles = 0; unsigned int i; QTime timer; @@ -1140,7 +1143,10 @@ void KSyncManager::syncPi() if ( mSpecificResources.count() ) { int startLocal = 0; int startRemote = mSpecificResources.count()/2; + emit multiResourceSyncStart( true ); while ( startLocal < mSpecificResources.count()/2 ) { + if ( startLocal+1 >= mSpecificResources.count()/2 ) + emit multiResourceSyncStart( false ); mPisyncFinished = false; mCurrentResourceLocal = mSpecificResources[ startLocal ]; mCurrentResourceRemote = mSpecificResources[ startRemote ]; @@ -1219,7 +1225,7 @@ void KSyncManager::readFileFromSocket() mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); syncOK = false; } - KCommandSocket* commandSocket = new KCommandSocket( "",mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); + KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote,mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); if ( mWriteBackFile && syncOK ) { mParent->topLevelWidget()->setCaption( i18n("Sending back file ...") ); @@ -1283,6 +1289,7 @@ void KServerSocket::readClient() error_connect("ERROR_ED\r\n\r\n"); return; } + mResource = ""; mErrorMessage = 0; //qDebug("KServerSocket::readClient()"); if ( mSocket->canReadLine() ) { @@ -1299,6 +1306,7 @@ void KServerSocket::readClient() } else KSyncManager::mRequestedSyncEvent = QDateTime(); + mResource =tokens[3]; send_file(); } else { @@ -1310,6 +1318,7 @@ void KServerSocket::readClient() if ( tokens[1] == mPassWord ) { //emit getFile( mSocket ); blockRC = true; + mResource =tokens[2]; get_file(); } else { @@ -1406,6 +1415,7 @@ void KServerSocket::send_file() mSyncActionDialog->setFixedSize( 230, 120); mSyncActionDialog->show(); mSyncActionDialog->raise(); + emit request_file(mResource); emit request_file(); qApp->processEvents(); QString fileName = mFileName; @@ -1467,6 +1477,7 @@ void KServerSocket::readBackFileFromSocket() mSyncActionDialog = 0; qDebug("KSS:Error open read back file "); piFileString = ""; + emit file_received( false, mResource); emit file_received( false ); blockRC = false; return ; @@ -1483,6 +1494,7 @@ void KServerSocket::readBackFileFromSocket() QTimer::singleShot( 10, this , SLOT ( discardClient())); file.close(); piFileString = ""; + emit file_received( true, mResource ); emit file_received( true ); delete mSyncActionDialog; mSyncActionDialog = 0; @@ -1596,7 +1608,7 @@ void KCommandSocket::writeFileToSocket() ts2.setEncoding( QTextStream::Latin1 ); QTextStream os2( mSocket ); os2.setEncoding( QTextStream::Latin1 ); - os2 << "PUT " << mPassWord << "\r\n\r\n";; + os2 << "PUT " << mPassWord << mRemoteResource << "\r\n\r\n";; int byteCount = 0; int byteMax = file2.size()/53; while ( ! ts2.atEnd() ) { diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index f4654ce..53c611d 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -53,6 +53,8 @@ class KServerSocket : public QServerSocket signals: void file_received( bool ); void request_file(); + void file_received( bool, const QString &); + void request_file(const QString &); void saveFile(); void endConnect(); private slots: @@ -62,6 +64,7 @@ class KServerSocket : public QServerSocket void displayErrorMessage(); void readBackFileFromSocket(); private : + QString mResource; int mErrorMessage; bool blockRC; void send_file(); @@ -174,6 +177,9 @@ class KSyncManager : public QObject void save(); void request_file(); void getFile( bool ); + void getFile( bool, const QString &); + void request_file(const QString &); + void multiResourceSyncStart( bool ); public slots: void slotSyncMenu( int ); |