summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp24
1 files changed, 18 insertions, 6 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index a64eb34..719d80b 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -195,9 +195,10 @@ void KSyncManager::slotClearMenu( int action )
}
void KSyncManager::slotSyncMenu( int action )
{
qDebug("KSM::syncaction %d ", action);
- mCurrentResourceLocal = "";
+ mCurrentResourceLocal = "";
+ emit multiResourceSyncStart( false );
if ( action == 5000 )
return;
mSyncWithDesktop = false;
if ( action == 0 ) {
@@ -440,8 +441,10 @@ void KSyncManager::enableQuick( bool ask )
mPrefs->writeConfig();
}
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()
{
KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error"));
@@ -568,9 +571,9 @@ void KSyncManager::multiSync( bool askforPrefs )
}
int KSyncManager::ringSync()
{
-
+ emit multiResourceSyncStart( false );
int syncedProfiles = 0;
unsigned int i;
QTime timer;
KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
@@ -1139,9 +1142,12 @@ void KSyncManager::syncPi()
mCurrentResourceRemote = "";
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 ];
KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
@@ -1218,9 +1224,9 @@ void KSyncManager::readFileFromSocket()
if ( ! syncWithFile( fileName , true ) ) {
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 ...") );
commandSocket->writeFile( fileName );
@@ -1282,8 +1288,9 @@ void KServerSocket::readClient()
mErrorMessage = 999;
error_connect("ERROR_ED\r\n\r\n");
return;
}
+ mResource = "";
mErrorMessage = 0;
//qDebug("KServerSocket::readClient()");
if ( mSocket->canReadLine() ) {
QString line = mSocket->readLine();
@@ -1298,8 +1305,9 @@ void KServerSocket::readClient()
KSyncManager::mRequestedSyncEvent = dt;
}
else
KSyncManager::mRequestedSyncEvent = QDateTime();
+ mResource =tokens[3];
send_file();
}
else {
mErrorMessage = 1;
@@ -1309,8 +1317,9 @@ void KServerSocket::readClient()
if ( tokens[0] == "PUT" ) {
if ( tokens[1] == mPassWord ) {
//emit getFile( mSocket );
blockRC = true;
+ mResource =tokens[2];
get_file();
}
else {
mErrorMessage = 2;
@@ -1405,8 +1414,9 @@ void KServerSocket::send_file()
} else
mSyncActionDialog->setFixedSize( 230, 120);
mSyncActionDialog->show();
mSyncActionDialog->raise();
+ emit request_file(mResource);
emit request_file();
qApp->processEvents();
QString fileName = mFileName;
QFile file( fileName );
@@ -1466,9 +1476,10 @@ void KServerSocket::readBackFileFromSocket()
delete mSyncActionDialog;
mSyncActionDialog = 0;
qDebug("KSS:Error open read back file ");
piFileString = "";
- emit file_received( false );
+ emit file_received( false, mResource);
+ emit file_received( false);
blockRC = false;
return ;
}
@@ -1482,9 +1493,10 @@ void KServerSocket::readBackFileFromSocket()
if ( mSocket->state() == QSocket::Idle )
QTimer::singleShot( 10, this , SLOT ( discardClient()));
file.close();
piFileString = "";
- emit file_received( true );
+ emit file_received( true, mResource );
+ emit file_received( true);
delete mSyncActionDialog;
mSyncActionDialog = 0;
blockRC = false;
@@ -1595,9 +1607,9 @@ void KCommandSocket::writeFileToSocket()
QTextStream ts2( &file2 );
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() ) {
qApp->processEvents();