author | zautrix <zautrix> | 2005-02-09 12:21:39 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-02-09 12:21:39 (UTC) |
commit | 940cdd0fd1349e7f8e53adff0595c1d946322ef1 (patch) (unidiff) | |
tree | 1a78f2c862afbc0d3c019c0905775782c906df64 /libkdepim/ksyncmanager.cpp | |
parent | 968099947455adc0e8681aedf8c161327e311f38 (diff) | |
download | kdepimpi-940cdd0fd1349e7f8e53adff0595c1d946322ef1.zip kdepimpi-940cdd0fd1349e7f8e53adff0595c1d946322ef1.tar.gz kdepimpi-940cdd0fd1349e7f8e53adff0595c1d946322ef1.tar.bz2 |
pisync fixes
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 45 |
1 files changed, 28 insertions, 17 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index df5a0d9..1f5f4c7 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1053,7 +1053,6 @@ void KSyncManager::syncPi() | |||
1053 | return; | 1053 | return; |
1054 | } | 1054 | } |
1055 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); | 1055 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this, mParent->topLevelWidget() ); |
1056 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); | 1056 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); |
1057 | mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") ); | ||
1058 | commandSocket->readFile( syncFileName() ); | 1057 | commandSocket->readFile( syncFileName() ); |
1059 | } | 1058 | } |
@@ -1066,5 +1065,5 @@ void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) | |||
1066 | delete s; | 1065 | delete s; |
1067 | if ( state == KCommandSocket::errorR ) { | 1066 | if ( state == KCommandSocket::errorR ) { |
1068 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 1067 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget()); |
1069 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1068 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1070 | commandSocket->sendStop(); | 1069 | commandSocket->sendStop(); |
@@ -1097,5 +1096,5 @@ void KSyncManager::readFileFromSocket() | |||
1097 | return; | 1096 | return; |
1098 | } | 1097 | } |
1099 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); | 1098 | KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this, mParent->topLevelWidget() ); |
1100 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); | 1099 | connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); |
1101 | if ( mWriteBackFile ) | 1100 | if ( mWriteBackFile ) |
@@ -1264,5 +1263,5 @@ void KServerSocket::send_file() | |||
1264 | os.setEncoding( QTextStream::Latin1 ); | 1263 | os.setEncoding( QTextStream::Latin1 ); |
1265 | while ( ! ts.atEnd() ) { | 1264 | while ( ! ts.atEnd() ) { |
1266 | os << ts.readLine() << "\r\n"; | 1265 | os << ts.readLine() << "\r\n\r\n"; |
1267 | } | 1266 | } |
1268 | //os << ts.read(); | 1267 | //os << ts.read(); |
@@ -1330,15 +1329,28 @@ void KServerSocket::readBackFileFromSocket() | |||
1330 | } | 1329 | } |
1331 | 1330 | ||
1332 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) | 1331 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, QWidget * cap, const char * name ): QObject( parent, name ) |
1333 | { | 1332 | { |
1334 | mPassWord = password; | 1333 | mPassWord = password; |
1335 | mSocket = 0; | 1334 | mSocket = 0; |
1335 | mFirst = false; | ||
1336 | mPort = port; | 1336 | mPort = port; |
1337 | mHost = host; | 1337 | mHost = host; |
1338 | 1338 | tlw = cap; | |
1339 | mRetVal = quiet; | 1339 | mRetVal = quiet; |
1340 | mTimerSocket = new QTimer ( this ); | 1340 | mTimerSocket = new QTimer ( this ); |
1341 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); | 1341 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); |
1342 | } | 1342 | } |
1343 | void KCommandSocket::sendFileRequest() | ||
1344 | { | ||
1345 | if ( tlw ) | ||
1346 | tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); | ||
1347 | mTimerSocket->start( 300000 ); | ||
1348 | QTextStream os( mSocket ); | ||
1349 | os.setEncoding( QTextStream::Latin1 ); | ||
1350 | |||
1351 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | ||
1352 | os << "GET " << mPassWord << curDt <<"\r\n\r\n"; | ||
1353 | } | ||
1354 | |||
1343 | void KCommandSocket::readFile( QString fn ) | 1355 | void KCommandSocket::readFile( QString fn ) |
1344 | { | 1356 | { |
@@ -1347,15 +1359,14 @@ void KCommandSocket::readFile( QString fn ) | |||
1347 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); | 1359 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); |
1348 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1360 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1361 | connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() )); | ||
1349 | } | 1362 | } |
1350 | mFileString = ""; | 1363 | mFileString = ""; |
1351 | mFileName = fn; | 1364 | mFileName = fn; |
1352 | mFirst = true; | 1365 | mFirst = true; |
1366 | if ( tlw ) | ||
1367 | tlw->setCaption( i18n("Trying to connect to remote...") ); | ||
1353 | mSocket->connectToHost( mHost, mPort ); | 1368 | mSocket->connectToHost( mHost, mPort ); |
1354 | QTextStream os( mSocket ); | 1369 | qDebug("KSS: Waiting for connection"); |
1355 | os.setEncoding( QTextStream::Latin1 ); | 1370 | mTimerSocket->start( 20000 ); |
1356 | |||
1357 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | ||
1358 | os << "GET " << mPassWord << curDt <<"\r\n"; | ||
1359 | mTimerSocket->start( 300000 ); | ||
1360 | } | 1371 | } |
1361 | 1372 | ||
@@ -1384,7 +1395,7 @@ void KCommandSocket::writeFileToSocket() | |||
1384 | QTextStream os2( mSocket ); | 1395 | QTextStream os2( mSocket ); |
1385 | os2.setEncoding( QTextStream::Latin1 ); | 1396 | os2.setEncoding( QTextStream::Latin1 ); |
1386 | os2 << "PUT " << mPassWord << "\r\n";; | 1397 | os2 << "PUT " << mPassWord << "\r\n\r\n";; |
1387 | while ( ! ts2.atEnd() ) { | 1398 | while ( ! ts2.atEnd() ) { |
1388 | os2 << ts2.readLine() << "\r\n"; | 1399 | os2 << ts2.readLine() << "\r\n\r\n"; |
1389 | } | 1400 | } |
1390 | mRetVal= successW; | 1401 | mRetVal= successW; |
@@ -1403,5 +1414,5 @@ void KCommandSocket::sendStop() | |||
1403 | QTextStream os2( mSocket ); | 1414 | QTextStream os2( mSocket ); |
1404 | os2.setEncoding( QTextStream::Latin1 ); | 1415 | os2.setEncoding( QTextStream::Latin1 ); |
1405 | os2 << "STOP\r\n"; | 1416 | os2 << "STOP\r\n\r\n"; |
1406 | mSocket->close(); | 1417 | mSocket->close(); |
1407 | if ( mSocket->state() == QSocket::Idle ) | 1418 | if ( mSocket->state() == QSocket::Idle ) |
@@ -1473,5 +1484,5 @@ void KCommandSocket::deleteSocket() | |||
1473 | mSocket = 0; | 1484 | mSocket = 0; |
1474 | } | 1485 | } |
1475 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host? ")); | 1486 | KMessageBox::error( 0, i18n("Connection to remote\nhost timed out!\nDid you forgot to enable\nsyncing on remote host?")); |
1476 | emit commandFinished( this, mRetVal ); | 1487 | emit commandFinished( this, mRetVal ); |
1477 | return; | 1488 | return; |