summaryrefslogtreecommitdiffabout
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
parent81d012860ea3d5d17d0e9cf16ec992baa83efbbf (diff)
downloadkdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.zip
kdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.tar.gz
kdepimpi-b71ee5442df23bb9900d3db6e6244773ee34ef13.tar.bz2
sync
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--korganizer/calendarview.cpp11
-rw-r--r--libkdepim/ksyncmanager.cpp42
-rw-r--r--libkdepim/ksyncmanager.h2
3 files changed, 47 insertions, 8 deletions
diff --git a/korganizer/calendarview.cpp b/korganizer/calendarview.cpp
index e45240a..6128137 100644
--- a/korganizer/calendarview.cpp
+++ b/korganizer/calendarview.cpp
@@ -1499,3 +1499,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
case SYNC_PREF_ASK:
- qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
+ //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
if ( lastSync > remoteMod && lastSync > localMod)
@@ -1506,3 +1506,3 @@ int CalendarView::takeEvent( Incidence* local, Incidence* remote, int mode , b
return 2;
- qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
+ //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), localMod.toString().latin1(), remoteMod.toString().latin1() );
localIsNew = localMod >= remoteMod;
@@ -1543,4 +1543,6 @@ Event* CalendarView::getLastSyncEvent()
//qDebug("CurrentSyncDevice %s ",mCurrentSyncDevice .latin1() );
+ mCalendar->setSyncEventsEnabled();
lse = mCalendar->event( "last-syncEvent-"+mCurrentSyncDevice );
if (!lse) {
+ qDebug("KO: New last Syncevent created for local: %s",mCurrentSyncDevice.latin1() );
lse = new Event();
@@ -1557,3 +1559,4 @@ Event* CalendarView::getLastSyncEvent()
mCalendar->addEvent( lse );
- }
+ } else
+ qDebug("KO: Last Syncevent on local found");
@@ -1635,3 +1638,3 @@ bool CalendarView::synchronizeCalendar( Calendar* local, Calendar* remote, int
if ( eventR ) {
- qDebug("last-syncEvent on remote found ");
+ qDebug("KO: Last-syncEvent on remote found ");
eventRSync = (Event*) eventR->clone();
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();
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;