summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Unidiff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp12
1 files changed, 10 insertions, 2 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 28af135..fad9a76 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -778,30 +778,32 @@ void KSyncManager::syncPi()
778 } 778 }
779 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); 779 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this );
780 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 780 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
781 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); 781 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") );
782 commandSocket->readFile( syncFileName() ); 782 commandSocket->readFile( syncFileName() );
783} 783}
784 784
785void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) 785void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
786{ 786{
787 qDebug("MainWindow::deleteCommandSocket %d", state); 787 qDebug("MainWindow::deleteCommandSocket %d", state);
788 788
789 //enum { success, errorW, errorR, quiet }; 789 //enum { success, errorW, errorR, quiet };
790 if ( state == KCommandSocket::errorR ) { 790 if ( state == KCommandSocket::errorR ||state == KCommandSocket::errorTO ) {
791 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") ); 791 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") );
792 delete s; 792 delete s;
793 if ( state == KCommandSocket::errorR ) {
793 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); 794 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
794 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 795 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
795 commandSocket->sendStop(); 796 commandSocket->sendStop();
797 }
796 return; 798 return;
797 799
798 } else if ( state == KCommandSocket::errorW ) { 800 } else if ( state == KCommandSocket::errorW ) {
799 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") ); 801 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") );
800 802
801 } else if ( state == KCommandSocket::successR ) { 803 } else if ( state == KCommandSocket::successR ) {
802 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); 804 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
803 805
804 } else if ( state == KCommandSocket::successW ) { 806 } else if ( state == KCommandSocket::successW ) {
805 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") ); 807 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
806 } 808 }
807 809
@@ -1128,21 +1130,27 @@ void KCommandSocket::readFileFromSocket()
1128 mSocket->close(); 1130 mSocket->close();
1129 // if state is not idle, deleteSocket(); is called via 1131 // if state is not idle, deleteSocket(); is called via
1130 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1132 // connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1131 if ( mSocket->state() == QSocket::Idle ) 1133 if ( mSocket->state() == QSocket::Idle )
1132 deleteSocket(); 1134 deleteSocket();
1133} 1135}
1134 1136
1135void KCommandSocket::deleteSocket() 1137void KCommandSocket::deleteSocket()
1136{ 1138{
1137 if ( mTimerSocket->isActive () ) { 1139 if ( mTimerSocket->isActive () ) {
1138 mTimerSocket->stop(); 1140 mTimerSocket->stop();
1139 KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? ")); 1141 KMessageBox::information( 0, i18n("ERROR:\nConnection to remote host timed out!\nDid you forgot to enable\nsyncing on remote host? "));
1140 mRetVal = errorR; 1142 mRetVal = errorTO;
1143 if ( mSocket ) {
1144 mSocket->close();
1145 if ( mSocket->state() == QSocket::Idle )
1146 deleteSocket();
1147 return;
1148 }
1141 } 1149 }
1142 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal ); 1150 //qDebug("KCommandSocket::deleteSocket() %d", mRetVal );
1143 if ( mSocket) 1151 if ( mSocket)
1144 delete mSocket; 1152 delete mSocket;
1145 mSocket = 0; 1153 mSocket = 0;
1146 emit commandFinished( this, mRetVal ); 1154 emit commandFinished( this, mRetVal );
1147} 1155}
1148 1156