author | zautrix <zautrix> | 2005-11-25 22:16:50 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-11-25 22:16:50 (UTC) |
commit | b71ee5442df23bb9900d3db6e6244773ee34ef13 (patch) (side-by-side diff) | |
tree | 221ac1af78b4fcbf741a48687f28570216f89049 /libkdepim/ksyncmanager.cpp | |
parent | 81d012860ea3d5d17d0e9cf16ec992baa83efbbf (diff) | |
download | kdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.zip kdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.tar.gz kdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.tar.bz2 |
sync
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 42 |
1 files changed, 38 insertions, 4 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index e1b15d2..8bf0d27 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -1162,2 +1162,3 @@ void KSyncManager::syncPi() qDebug ( "KSM: Syncing resources: Local: %s --- Remote: %s ",mCurrentResourceLocal.latin1(), mCurrentResourceRemote.latin1() ); + KCommandSocket* commandSocket = new KCommandSocket( mCurrentResourceRemote, mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); @@ -1165,2 +1166,3 @@ void KSyncManager::syncPi() commandSocket->readFile( syncFileName() ); + mParent->topLevelWidget()->setCaption( i18n("Syncing %1 <-> %2").arg( mCurrentResourceLocal ).arg( mCurrentResourceRemote ) ); while ( !mPisyncFinished ) { @@ -1169,2 +1171,10 @@ void KSyncManager::syncPi() } + if ( startLocal+1 < mSpecificResources.count()/2 ) { + mParent->topLevelWidget()->setCaption( i18n("Waiting 2 secs before syncing next resource...") ); + QTime timer; + timer.start(); + while ( timer.elapsed () < 2000 ) { + qApp->processEvents(); + } + } } @@ -1172,2 +1182,3 @@ void KSyncManager::syncPi() ++startLocal; + } @@ -1256,2 +1267,3 @@ KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject { + mPendingConnect = 0; mPassWord = pw; @@ -1262,3 +1274,15 @@ KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject } - +void KServerSocket::waitForSocketFinish() +{ + if ( mSocket ) { + qDebug("KSS:: waiting for finish operation"); + QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish())); + return; + } + mSocket = new QSocket( this ); + connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); + connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); + mSocket->setSocket( mPendingConnect ); + mPendingConnect = 0; +} void KServerSocket::newConnection ( int socket ) @@ -1266,3 +1290,10 @@ void KServerSocket::newConnection ( int socket ) // qDebug("KServerSocket:New connection %d ", socket); + if ( mPendingConnect ) { + qDebug("KSS::Error : new Connection"); + return; + } if ( mSocket ) { + mPendingConnect = socket; + QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish())); + return; qDebug("KSS::newConnection Socket deleted! "); @@ -1271,2 +1302,3 @@ void KServerSocket::newConnection ( int socket ) } + mPendingConnect = 0; mSocket = new QSocket( this ); @@ -1545,2 +1577,3 @@ void KCommandSocket::sendFileRequest() mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); + mConnectProgress.setLabelText( i18n("Waiting for remote file...") ); mTimerSocket->start( 100, true ); @@ -1557,2 +1590,3 @@ void KCommandSocket::readFile( QString fn ) mSocket = new QSocket( this ); + qDebug("KCS: read file - new socket"); connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); @@ -1569,3 +1603,3 @@ void KCommandSocket::readFile( QString fn ) mSocket->connectToHost( mHost, mPort ); - qDebug("KSS: Waiting for connection"); + qDebug("KCS: Waiting for connection"); } @@ -1575,3 +1609,3 @@ void KCommandSocket::updateConnectDialog() if ( mConnectCount == mConnectMax ) { - //qDebug("MAXX %d", mConnectMax); + qDebug("MAXX %d", mConnectMax); mConnectProgress.setTotalSteps ( 30 ); @@ -1580,3 +1614,3 @@ void KCommandSocket::updateConnectDialog() } - //qDebug("updateConnectDialog() %d", mConnectCount); + qDebug("updateConnectDialog() %d", mConnectCount); mConnectProgress.raise(); |