-rw-r--r-- | libkdepim/ksyncmanager.cpp | 24 |
1 files changed, 23 insertions, 1 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 7ee56e4..c6e06f8 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -145,9 +145,9 @@ void KSyncManager::fillSyncMenu() | |||
145 | } | 145 | } |
146 | 146 | ||
147 | void KSyncManager::slotSyncMenu( int action ) | 147 | void KSyncManager::slotSyncMenu( int action ) |
148 | { | 148 | { |
149 | //qDebug("syncaction %d ", action); | 149 | qDebug("syncaction %d ", action); |
150 | if ( action == 0 ) { | 150 | if ( action == 0 ) { |
151 | 151 | ||
152 | // seems to be a Qt2 event handling bug | 152 | // seems to be a Qt2 event handling bug |
153 | // syncmenu.clear causes a segfault at first time | 153 | // syncmenu.clear causes a segfault at first time |
@@ -253,8 +253,12 @@ void KSyncManager::slotSyncMenu( int action ) | |||
253 | mActiveSyncPort = temp->getRemotePortPWM(); | 253 | mActiveSyncPort = temp->getRemotePortPWM(); |
254 | mActiveSyncIP = temp->getRemoteIPPWM(); | 254 | mActiveSyncIP = temp->getRemoteIPPWM(); |
255 | } | 255 | } |
256 | syncPi(); | 256 | syncPi(); |
257 | while ( !mPisyncFinished ) { | ||
258 | //qDebug("waiting "); | ||
259 | qApp->processEvents(); | ||
260 | } | ||
257 | } else | 261 | } else |
258 | syncRemote( temp ); | 262 | syncRemote( temp ); |
259 | 263 | ||
260 | } | 264 | } |
@@ -471,9 +475,13 @@ int KSyncManager::ringSync() | |||
471 | mShowSyncSummary = false; | 475 | mShowSyncSummary = false; |
472 | mCurrentSyncDevice = syncProfileNames[i] ; | 476 | mCurrentSyncDevice = syncProfileNames[i] ; |
473 | mCurrentSyncName = mLocalMachineName; | 477 | mCurrentSyncName = mLocalMachineName; |
474 | if ( i == 0 ) { | 478 | if ( i == 0 ) { |
479 | #ifdef DESKTOP_VERSION | ||
480 | syncKDE(); | ||
481 | #else | ||
475 | syncSharp(); | 482 | syncSharp(); |
483 | #endif | ||
476 | } else { | 484 | } else { |
477 | if ( temp->getIsLocalFileSync() ) { | 485 | if ( temp->getIsLocalFileSync() ) { |
478 | switch(mTargetApp) | 486 | switch(mTargetApp) |
479 | { | 487 | { |
@@ -513,8 +521,16 @@ int KSyncManager::ringSync() | |||
513 | mActiveSyncPort = temp->getRemotePortPWM(); | 521 | mActiveSyncPort = temp->getRemotePortPWM(); |
514 | mActiveSyncIP = temp->getRemoteIPPWM(); | 522 | mActiveSyncIP = temp->getRemoteIPPWM(); |
515 | } | 523 | } |
516 | syncPi(); | 524 | syncPi(); |
525 | while ( !mPisyncFinished ) { | ||
526 | //qDebug("waiting "); | ||
527 | qApp->processEvents(); | ||
528 | } | ||
529 | timer.start(); | ||
530 | while ( timer.elapsed () < 2000 ) { | ||
531 | qApp->processEvents(); | ||
532 | } | ||
517 | } else | 533 | } else |
518 | syncRemote( temp, false ); | 534 | syncRemote( temp, false ); |
519 | 535 | ||
520 | } | 536 | } |
@@ -865,8 +881,9 @@ QString KSyncManager::syncFileName() | |||
865 | } | 881 | } |
866 | 882 | ||
867 | void KSyncManager::syncPi() | 883 | void KSyncManager::syncPi() |
868 | { | 884 | { |
885 | mPisyncFinished = false; | ||
869 | qApp->processEvents(); | 886 | qApp->processEvents(); |
870 | if ( mAskForPreferences ) | 887 | if ( mAskForPreferences ) |
871 | edit_pisync_options(); | 888 | edit_pisync_options(); |
872 | bool ok; | 889 | bool ok; |
@@ -891,18 +908,21 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | |||
891 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 908 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
892 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 909 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
893 | commandSocket->sendStop(); | 910 | commandSocket->sendStop(); |
894 | } | 911 | } |
912 | mPisyncFinished = true; | ||
895 | return; | 913 | return; |
896 | 914 | ||
897 | } else if ( state == KCommandSocket::errorW ) { | 915 | } else if ( state == KCommandSocket::errorW ) { |
898 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); | 916 | mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); |
917 | mPisyncFinished = true; | ||
899 | 918 | ||
900 | } else if ( state == KCommandSocket::successR ) { | 919 | } else if ( state == KCommandSocket::successR ) { |
901 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); | 920 | QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); |
902 | 921 | ||
903 | } else if ( state == KCommandSocket::successW ) { | 922 | } else if ( state == KCommandSocket::successW ) { |
904 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 923 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
924 | mPisyncFinished = true; | ||
905 | } | 925 | } |
906 | 926 | ||
907 | delete s; | 927 | delete s; |
908 | } | 928 | } |
@@ -912,8 +932,9 @@ void KSyncManager::readFileFromSocket() | |||
912 | QString fileName = syncFileName(); | 932 | QString fileName = syncFileName(); |
913 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); | 933 | mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") ); |
914 | if ( ! syncWithFile( fileName , true ) ) { | 934 | if ( ! syncWithFile( fileName , true ) ) { |
915 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); | 935 | mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") ); |
936 | mPisyncFinished = true; | ||
916 | return; | 937 | return; |
917 | } | 938 | } |
918 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 939 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); |
919 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 940 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
@@ -921,8 +942,9 @@ void KSyncManager::readFileFromSocket() | |||
921 | commandSocket->writeFile( fileName ); | 942 | commandSocket->writeFile( fileName ); |
922 | else { | 943 | else { |
923 | commandSocket->sendStop(); | 944 | commandSocket->sendStop(); |
924 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); | 945 | mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); |
946 | mPisyncFinished = true; | ||
925 | } | 947 | } |
926 | } | 948 | } |
927 | 949 | ||
928 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) | 950 | KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) |