summaryrefslogtreecommitdiffabout
path: root/libkdepim
authorzautrix <zautrix>2005-02-09 12:21:39 (UTC)
committer zautrix <zautrix>2005-02-09 12:21:39 (UTC)
commit940cdd0fd1349e7f8e53adff0595c1d946322ef1 (patch) (side-by-side diff)
tree1a78f2c862afbc0d3c019c0905775782c906df64 /libkdepim
parent968099947455adc0e8681aedf8c161327e311f38 (diff)
downloadkdepimpi-940cdd0fd1349e7f8e53adff0595c1d946322ef1.zip
kdepimpi-940cdd0fd1349e7f8e53adff0595c1d946322ef1.tar.gz
kdepimpi-940cdd0fd1349e7f8e53adff0595c1d946322ef1.tar.bz2
pisync fixes
Diffstat (limited to 'libkdepim') (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp45
-rw-r--r--libkdepim/ksyncmanager.h6
2 files changed, 33 insertions, 18 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();
@@ -1474,3 +1485,3 @@ void KCommandSocket::deleteSocket()
}
- KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? "));
+ KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?"));
emit commandFinished( this, mRetVal );
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 6d89950..9a3066e 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -77,3 +77,3 @@ class KCommandSocket : public QObject
enum state { successR, errorR, successW, errorW, errorTO, quiet };
- KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, const char * name=0 );
+ KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent=0, QWidget* cap = 0, const char * name=0 );
void readFile( QString );
@@ -81,2 +81,5 @@ class KCommandSocket : public QObject
void sendStop();
+
+ private slots :
+ void sendFileRequest();
@@ -90,2 +93,3 @@ class KCommandSocket : public QObject
private :
+ QWidget* tlw;
QSocket* mSocket;