summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-11-25 22:16:50 (UTC)
committer zautrix <zautrix>2005-11-25 22:16:50 (UTC)
commitb71ee5442df23bb9900d3db6e6244773ee34ef13 (patch) (side-by-side diff)
tree221ac1af78b4fcbf741a48687f28570216f89049 /libkdepim
parent81d012860ea3d5d17d0e9cf16ec992baa83efbbf (diff)
downloadkdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.zip
kdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.tar.gz
kdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.tar.bz2
sync
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp48
-rw-r--r--libkdepim/ksyncmanager.h2
2 files changed, 43 insertions, 7 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index e1b15d2..8bf0d27 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1162,5 +1162,7 @@ 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() );
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
- commandSocket->readFile( syncFileName() );
+ commandSocket->readFile( syncFileName() );
+ mParent->topLevelWidget()->setCaption( i18n("Syncing %1 <-> %2").arg( mCurrentResourceLocal ).arg( mCurrentResourceRemote ) );
while ( !mPisyncFinished ) {
@@ -1169,5 +1171,14 @@ 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();
+ }
+ }
}
++startRemote;
- ++startLocal;
+ ++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 );
@@ -1556,3 +1589,4 @@ void KCommandSocket::readFile( QString fn )
if ( !mSocket ) {
- mSocket = new QSocket( this );
+ 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();
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 53c611d..604adb8 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -60,2 +60,3 @@ class KServerSocket : public QServerSocket
private slots:
+ void waitForSocketFinish();
void discardClient();
@@ -66,2 +67,3 @@ class KServerSocket : public QServerSocket
private :
+ int mPendingConnect;
QString mResource;