author | zautrix <zautrix> | 2004-10-07 13:41:15 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-10-07 13:41:15 (UTC) |
commit | bb8293c794d82a57bc93af85ccd89b601356d577 (patch) (side-by-side diff) | |
tree | 1b5112b9fda89888095bbb9934349c800865043c | |
parent | d14d61ebb2e41329465883a0dfce719d69fc3f3e (diff) | |
download | kdepimpi-bb8293c794d82a57bc93af85ccd89b601356d577.zip kdepimpi-bb8293c794d82a57bc93af85ccd89b601356d577.tar.gz kdepimpi-bb8293c794d82a57bc93af85ccd89b601356d577.tar.bz2 |
sync fixes
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 12 | ||||
-rw-r--r-- | libkdepim/ksyncmanager.h | 4 |
2 files changed, 12 insertions, 4 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 28af135..fad9a76 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp @@ -784,18 +784,20 @@ void KSyncManager::syncPi() void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) { qDebug("MainWindow::deleteCommandSocket %d", state); //enum { success, errorW, errorR, quiet }; - if ( state == KCommandSocket::errorR ) { + if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) { mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); delete s; + if ( state == KCommandSocket::errorR ) { KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); commandSocket->sendStop(); + } return; } else if ( state == KCommandSocket::errorW ) { mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); } else if ( state == KCommandSocket::successR ) { @@ -1134,13 +1136,19 @@ void KCommandSocket::readFileFromSocket() void KCommandSocket::deleteSocket() { if ( mTimerSocket->isActive () ) { mTimerSocket->stop(); KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? ")); - mRetVal = errorR; + mRetVal = errorTO; + if ( mSocket ) { + mSocket->close(); + if ( mSocket->state() == QSocket::Idle ) + deleteSocket(); + return; + } } //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); if ( mSocket) delete mSocket; mSocket = 0; emit commandFinished( this, mRetVal ); diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h index 32400af..25892d8 100644 --- a/libkdepim/ksyncmanager.h +++ b/libkdepim/ksyncmanager.h @@ -72,13 +72,13 @@ private slots: }; class KCommandSocket : public QObject { Q_OBJECT public: - enum state { successR, errorR, successW, errorW, quiet }; + enum state { successR, errorR, successW, errorW, errorTO, quiet }; KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 ); void readFile( QString ); void writeFile( QString ); void sendStop(); @@ -119,12 +119,13 @@ class KSyncManager : public QObject bool blockSave() { return mBlockSaveFlag; } void setBlockSave(bool sa) { mBlockSaveFlag = sa; } void setDefaultFileName( QString s) { mDefFileName = s ;} QString defaultFileName() { return mDefFileName ;} QString syncFileName(); + void fillSyncMenu(); QString getCurrentSyncDevice() { return mCurrentSyncDevice; } QString getCurrentSyncName() { return mCurrentSyncName; } void showProgressBar(int percentage, QString caption = QString::null, int total=100); void hideProgressBar(); @@ -154,13 +155,12 @@ class KSyncManager : public QObject signals: void save(); void request_file(); void getFile( bool ); public slots: - void fillSyncMenu(); void slotSyncMenu( int ); void deleteCommandSocket(KCommandSocket*s, int state); void readFileFromSocket(); private: // LR ******************************* |