summaryrefslogtreecommitdiffabout
path: root/libkdepim
Side-by-side diff
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp18
1 files changed, 15 insertions, 3 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 02e5587..08a263c 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1051,14 +1051,16 @@ void KSyncManager::syncPi()
qApp->processEvents();
if ( mAskForPreferences )
if ( !edit_pisync_options()) {
mParent->topLevelWidget()->setCaption( i18n("Syncing aborted. Nothing synced.") );
+ mPisyncFinished = true;
return;
}
bool ok;
Q_UINT16 port = mActiveSyncPort.toUInt(&ok);
if ( ! ok ) {
mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
+ mPisyncFinished = true;
return;
}
KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
@@ -1088,8 +1090,14 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
} else if ( state == KCommandSocket::successW ) {
mParent->topLevelWidget()->setCaption( i18n("Pi-Sync successful!") );
mPisyncFinished = true;
+ } else if ( state == KCommandSocket::quiet ){
+ qDebug("KSS: quiet ");
+ mPisyncFinished = true;
+ } else {
+ qDebug("KSS: Error: unknown state: %d ", state);
+ mPisyncFinished = true;
}
delete s;
}
@@ -1270,10 +1278,11 @@ void KServerSocket::send_file()
QTextStream os( mSocket );
os.setEncoding( QTextStream::Latin1 );
while ( ! ts.atEnd() ) {
- os << ts.readLine() << "\r\n\r\n";
+ os << ts.readLine() << "\r\n";
}
+ os << "\r\n";
//os << ts.read();
file.close();
mSyncActionDialog->setCaption( i18n("Waiting for synced file...") );
mSocket->close();
@@ -1373,11 +1382,11 @@ void KCommandSocket::readFile( QString fn )
mFileName = fn;
mFirst = true;
if ( tlw )
tlw->setCaption( i18n("Trying to connect to remote...") );
+ mTimerSocket->start( 20000 );
mSocket->connectToHost( mHost, mPort );
qDebug("KSS: Waiting for connection");
- mTimerSocket->start( 20000 );
}
void KCommandSocket::writeFile( QString fileName )
{
@@ -1386,12 +1395,14 @@ void KCommandSocket::writeFile( QString fileName )
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
}
mFileName = fileName ;
+ mTimerSocket->start( 20000 );
mSocket->connectToHost( mHost, mPort );
}
void KCommandSocket::writeFileToSocket()
{
+ mTimerSocket->stop();
QFile file2( mFileName );
if (!file2.open( IO_ReadOnly ) ) {
mRetVal= errorW;
mSocket->close();
@@ -1404,10 +1415,11 @@ void KCommandSocket::writeFileToSocket()
QTextStream os2( mSocket );
os2.setEncoding( QTextStream::Latin1 );
os2 << "PUT " << mPassWord << "\r\n\r\n";;
while ( ! ts2.atEnd() ) {
- os2 << ts2.readLine() << "\r\n\r\n";
+ os2 << ts2.readLine() << "\r\n";
}
+ os2 << "\r\n";
mRetVal= successW;
file2.close();
mSocket->close();
if ( mSocket->state() == QSocket::Idle )