summaryrefslogtreecommitdiffabout
path: root/libkdepim/ksyncmanager.cpp
Side-by-side diff
Diffstat (limited to 'libkdepim/ksyncmanager.cpp') (more/less context) (show whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp43
1 files changed, 27 insertions, 16 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index df5a0d9..1f5f4c7 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -1054,5 +1054,4 @@ void KSyncManager::syncPi()
}
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this );
+ KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() );
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
- mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") );
commandSocket->readFile( syncFileName() );
@@ -1067,3 +1066,3 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
if ( state == KCommandSocket::errorR ) {
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
+ KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget());
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
@@ -1098,3 +1097,3 @@ void KSyncManager::readFileFromSocket()
}
- KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
+ KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() );
connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
@@ -1265,3 +1264,3 @@ void KServerSocket::send_file()
while ( ! ts.atEnd() ) {
- os << ts.readLine() << "\r\n";
+ os << ts.readLine() << "\r\n\r\n";
}
@@ -1331,3 +1330,3 @@ void KServerSocket::readBackFileFromSocket()
-KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name )
+KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name )
{
@@ -1335,5 +1334,6 @@ KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host,
mSocket = 0;
+ mFirst = false;
mPort = port;
mHost = host;
-
+ tlw = cap;
mRetVal = quiet;
@@ -1342,2 +1342,14 @@ KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host,
}
+void KCommandSocket::sendFileRequest()
+{
+ if ( tlw )
+ tlw->setCaption( i18n("Connected! Sending request for remote file ...") );
+ mTimerSocket->start( 300000 );
+ QTextStream os( mSocket );
+ os.setEncoding( QTextStream::Latin1 );
+
+ QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
+ os << "GET " << mPassWord << curDt <<"\r\n\r\n";
+}
+
void KCommandSocket::readFile( QString fn )
@@ -1348,2 +1360,3 @@ void KCommandSocket::readFile( QString fn )
connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
+ connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() ));
}
@@ -1352,9 +1365,7 @@ void KCommandSocket::readFile( QString fn )
mFirst = true;
+ if ( tlw )
+ tlw->setCaption( i18n("Trying to connect to remote...") );
mSocket->connectToHost( mHost, mPort );
- QTextStream os( mSocket );
- os.setEncoding( QTextStream::Latin1 );
-
- QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
- os << "GET " << mPassWord << curDt <<"\r\n";
- mTimerSocket->start( 300000 );
+ qDebug("KSS: Waiting for connection");
+ mTimerSocket->start( 20000 );
}
@@ -1385,5 +1396,5 @@ void KCommandSocket::writeFileToSocket()
os2.setEncoding( QTextStream::Latin1 );
- os2 << "PUT " << mPassWord << "\r\n";;
+ os2 << "PUT " << mPassWord << "\r\n\r\n";;
while ( ! ts2.atEnd() ) {
- os2 << ts2.readLine() << "\r\n";
+ os2 << ts2.readLine() << "\r\n\r\n";
}
@@ -1404,3 +1415,3 @@ void KCommandSocket::sendStop()
os2.setEncoding( QTextStream::Latin1 );
- os2 << "STOP\r\n";
+ os2 << "STOP\r\n\r\n";
mSocket->close();