author | zautrix <zautrix> | 2005-01-08 00:02:17 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-01-08 00:02:17 (UTC) |
commit | 430d67f339232b6cf745840eaa2aaceb14bdc8c7 (patch) (unidiff) | |
tree | ec63659a3ce6a87d75d5d7b29e1c1cb1df33381a /libkdepim/ksyncmanager.cpp | |
parent | 5e7c3e3e51fa939e97b73e6443089edcec8dc663 (diff) | |
download | kdepimpi-430d67f339232b6cf745840eaa2aaceb14bdc8c7.zip kdepimpi-430d67f339232b6cf745840eaa2aaceb14bdc8c7.tar.gz kdepimpi-430d67f339232b6cf745840eaa2aaceb14bdc8c7.tar.bz2 |
fix crash and to
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index 7c53948..6f68d84 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -1299,97 +1299,97 @@ void KServerSocket::readBackFileFromSocket() | |||
1299 | return ; | 1299 | return ; |
1300 | 1300 | ||
1301 | } | 1301 | } |
1302 | 1302 | ||
1303 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); | 1303 | // mView->setLoadedFileVersion(QDateTime::currentDateTime().addSecs( -1)); |
1304 | QTextStream ts ( &file ); | 1304 | QTextStream ts ( &file ); |
1305 | ts.setEncoding( QTextStream::Latin1 ); | 1305 | ts.setEncoding( QTextStream::Latin1 ); |
1306 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); | 1306 | mSyncActionDialog->setCaption( i18n("Writing file to disk...") ); |
1307 | ts << piFileString; | 1307 | ts << piFileString; |
1308 | mSocket->close(); | 1308 | mSocket->close(); |
1309 | if ( mSocket->state() == QSocket::Idle ) | 1309 | if ( mSocket->state() == QSocket::Idle ) |
1310 | QTimer::singleShot( 10, this , SLOT ( discardClient())); | 1310 | QTimer::singleShot( 10, this , SLOT ( discardClient())); |
1311 | file.close(); | 1311 | file.close(); |
1312 | piFileString = ""; | 1312 | piFileString = ""; |
1313 | emit file_received( true ); | 1313 | emit file_received( true ); |
1314 | delete mSyncActionDialog; | 1314 | delete mSyncActionDialog; |
1315 | mSyncActionDialog = 0; | 1315 | mSyncActionDialog = 0; |
1316 | blockRC = false; | 1316 | blockRC = false; |
1317 | 1317 | ||
1318 | } | 1318 | } |
1319 | 1319 | ||
1320 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) | 1320 | KCommandSocket::KCommandSocket ( QString password, Q_UINT16 port, QString host, QObject * parent, const char * name ): QObject( parent, name ) |
1321 | { | 1321 | { |
1322 | mPassWord = password; | 1322 | mPassWord = password; |
1323 | mSocket = 0; | 1323 | mSocket = 0; |
1324 | mPort = port; | 1324 | mPort = port; |
1325 | mHost = host; | 1325 | mHost = host; |
1326 | 1326 | ||
1327 | mRetVal = quiet; | 1327 | mRetVal = quiet; |
1328 | mTimerSocket = new QTimer ( this ); | 1328 | mTimerSocket = new QTimer ( this ); |
1329 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); | 1329 | connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( deleteSocket() ) ); |
1330 | } | 1330 | } |
1331 | void KCommandSocket::readFile( QString fn ) | 1331 | void KCommandSocket::readFile( QString fn ) |
1332 | { | 1332 | { |
1333 | if ( !mSocket ) { | 1333 | if ( !mSocket ) { |
1334 | mSocket = new QSocket( this ); | 1334 | mSocket = new QSocket( this ); |
1335 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); | 1335 | connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); |
1336 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1336 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1337 | } | 1337 | } |
1338 | mFileString = ""; | 1338 | mFileString = ""; |
1339 | mFileName = fn; | 1339 | mFileName = fn; |
1340 | mFirst = true; | 1340 | mFirst = true; |
1341 | mSocket->connectToHost( mHost, mPort ); | 1341 | mSocket->connectToHost( mHost, mPort ); |
1342 | QTextStream os( mSocket ); | 1342 | QTextStream os( mSocket ); |
1343 | os.setEncoding( QTextStream::Latin1 ); | 1343 | os.setEncoding( QTextStream::Latin1 ); |
1344 | 1344 | ||
1345 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); | 1345 | QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); |
1346 | os << "GET " << mPassWord << curDt <<"\r\n"; | 1346 | os << "GET " << mPassWord << curDt <<"\r\n"; |
1347 | mTimerSocket->start( 20000 ); | 1347 | mTimerSocket->start( 300000 ); |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | void KCommandSocket::writeFile( QString fileName ) | 1350 | void KCommandSocket::writeFile( QString fileName ) |
1351 | { | 1351 | { |
1352 | if ( !mSocket ) { | 1352 | if ( !mSocket ) { |
1353 | mSocket = new QSocket( this ); | 1353 | mSocket = new QSocket( this ); |
1354 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1354 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1355 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); | 1355 | connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); |
1356 | } | 1356 | } |
1357 | mFileName = fileName ; | 1357 | mFileName = fileName ; |
1358 | mSocket->connectToHost( mHost, mPort ); | 1358 | mSocket->connectToHost( mHost, mPort ); |
1359 | } | 1359 | } |
1360 | void KCommandSocket::writeFileToSocket() | 1360 | void KCommandSocket::writeFileToSocket() |
1361 | { | 1361 | { |
1362 | QFile file2( mFileName ); | 1362 | QFile file2( mFileName ); |
1363 | if (!file2.open( IO_ReadOnly ) ) { | 1363 | if (!file2.open( IO_ReadOnly ) ) { |
1364 | mRetVal= errorW; | 1364 | mRetVal= errorW; |
1365 | mSocket->close(); | 1365 | mSocket->close(); |
1366 | if ( mSocket->state() == QSocket::Idle ) | 1366 | if ( mSocket->state() == QSocket::Idle ) |
1367 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1367 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1368 | return ; | 1368 | return ; |
1369 | } | 1369 | } |
1370 | QTextStream ts2( &file2 ); | 1370 | QTextStream ts2( &file2 ); |
1371 | ts2.setEncoding( QTextStream::Latin1 ); | 1371 | ts2.setEncoding( QTextStream::Latin1 ); |
1372 | QTextStream os2( mSocket ); | 1372 | QTextStream os2( mSocket ); |
1373 | os2.setEncoding( QTextStream::Latin1 ); | 1373 | os2.setEncoding( QTextStream::Latin1 ); |
1374 | os2 << "PUT " << mPassWord << "\r\n";; | 1374 | os2 << "PUT " << mPassWord << "\r\n";; |
1375 | while ( ! ts2.atEnd() ) { | 1375 | while ( ! ts2.atEnd() ) { |
1376 | os2 << ts2.readLine() << "\r\n"; | 1376 | os2 << ts2.readLine() << "\r\n"; |
1377 | } | 1377 | } |
1378 | mRetVal= successW; | 1378 | mRetVal= successW; |
1379 | file2.close(); | 1379 | file2.close(); |
1380 | mSocket->close(); | 1380 | mSocket->close(); |
1381 | if ( mSocket->state() == QSocket::Idle ) | 1381 | if ( mSocket->state() == QSocket::Idle ) |
1382 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); | 1382 | QTimer::singleShot( 10, this , SLOT ( deleteSocket())); |
1383 | } | 1383 | } |
1384 | void KCommandSocket::sendStop() | 1384 | void KCommandSocket::sendStop() |
1385 | { | 1385 | { |
1386 | if ( !mSocket ) { | 1386 | if ( !mSocket ) { |
1387 | mSocket = new QSocket( this ); | 1387 | mSocket = new QSocket( this ); |
1388 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); | 1388 | connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); |
1389 | } | 1389 | } |
1390 | mSocket->connectToHost( mHost, mPort ); | 1390 | mSocket->connectToHost( mHost, mPort ); |
1391 | QTextStream os2( mSocket ); | 1391 | QTextStream os2( mSocket ); |
1392 | os2.setEncoding( QTextStream::Latin1 ); | 1392 | os2.setEncoding( QTextStream::Latin1 ); |
1393 | os2 << "STOP\r\n"; | 1393 | os2 << "STOP\r\n"; |
1394 | mSocket->close(); | 1394 | mSocket->close(); |
1395 | if ( mSocket->state() == QSocket::Idle ) | 1395 | if ( mSocket->state() == QSocket::Idle ) |