From f909868a098a22c17906f3d2ab05d5fac0332e85 Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 17 Oct 2004 01:11:53 +0000 Subject: many sync fixes --- (limited to 'libkdepim') diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 7ee56e4..c6e06f8 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -146,7 +146,7 @@ void KSyncManager::fillSyncMenu() void KSyncManager::slotSyncMenu( int action ) { - //qDebug("syncaction %d ", action); + qDebug("syncaction %d ", action); if ( action == 0 ) { // seems to be a Qt2 event handling bug @@ -254,6 +254,10 @@ void KSyncManager::slotSyncMenu( int action ) mActiveSyncIP = temp->getRemoteIPPWM(); } syncPi(); + while ( !mPisyncFinished ) { + //qDebug("waiting "); + qApp->processEvents(); + } } else syncRemote( temp ); @@ -472,7 +476,11 @@ int KSyncManager::ringSync() mCurrentSyncDevice = syncProfileNames[i] ; mCurrentSyncName = mLocalMachineName; if ( i == 0 ) { +#ifdef DESKTOP_VERSION + syncKDE(); +#else syncSharp(); +#endif } else { if ( temp->getIsLocalFileSync() ) { switch(mTargetApp) @@ -514,6 +522,14 @@ int KSyncManager::ringSync() mActiveSyncIP = temp->getRemoteIPPWM(); } syncPi(); + while ( !mPisyncFinished ) { + //qDebug("waiting "); + qApp->processEvents(); + } + timer.start(); + while ( timer.elapsed () < 2000 ) { + qApp->processEvents(); + } } else syncRemote( temp, false ); @@ -866,6 +882,7 @@ QString KSyncManager::syncFileName() void KSyncManager::syncPi() { + mPisyncFinished = false; qApp->processEvents(); if ( mAskForPreferences ) edit_pisync_options(); @@ -892,16 +909,19 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); commandSocket->sendStop(); } + mPisyncFinished = true; return; } else if ( state == KCommandSocket::errorW ) { mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); + mPisyncFinished = true; } else if ( state == KCommandSocket::successR ) { QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); } else if ( state == KCommandSocket::successW ) { mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); + mPisyncFinished = true; } delete s; @@ -913,6 +933,7 @@ void KSyncManager::readFileFromSocket() mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); if ( ! syncWithFile( fileName , true ) ) { mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); + mPisyncFinished = true; return; } KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); @@ -922,6 +943,7 @@ void KSyncManager::readFileFromSocket() else { commandSocket->sendStop(); mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); + mPisyncFinished = true; } } diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 7d5b05e..ffb1ea4 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -178,10 +178,7 @@ class KSyncManager : public QObject void edit_pisync_options(); int ringSync(); QString getPassword( ); - - private slots: - void confSync(); - private: + bool mPisyncFinished; bool mBlockSaveFlag; QWidget* mParent; KSyncInterface* mImplementation; @@ -189,6 +186,10 @@ class KSyncManager : public QObject QPopupMenu* mSyncMenu; QProgressBar* bar; +private slots: + void confSync(); + + }; -- cgit v0.9.0.2