summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2005-11-28 05:26:47 (UTC)
committer zautrix <zautrix>2005-11-28 05:26:47 (UTC)
commitc09ac6c4c77ee1ed50cd9d86a6798eebdede3991 (patch) (unidiff)
tree6cbd88eadaaaf2f31be90eaf11edceae5d81d89e
parent1267a02fc23575f82247f8bd8449dc70dab62d44 (diff)
downloadkdepimpi-c09ac6c4c77ee1ed50cd9d86a6798eebdede3991.zip
kdepimpi-c09ac6c4c77ee1ed50cd9d86a6798eebdede3991.tar.gz
kdepimpi-c09ac6c4c77ee1ed50cd9d86a6798eebdede3991.tar.bz2
sync
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libkdepim/ksyncmanager.cpp5
1 files changed, 2 insertions, 3 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index 28c48fe..4d859ce 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -376,97 +376,96 @@ void KSyncManager::enableQuick( bool ask )
376 syncdesktop.hide();// not implemented! 376 syncdesktop.hide();// not implemented!
377#else 377#else
378 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia ); 378 QCheckBox syncdesktop( i18n("Automatically sync with KDE-Desktop\nwhen receiving sync request"),&dia );
379#endif 379#endif
380 lay.addWidget( &syncdesktop); 380 lay.addWidget( &syncdesktop);
381#else 381#else
382 mPrefs->mPassiveSyncWithDesktop = false; 382 mPrefs->mPassiveSyncWithDesktop = false;
383 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia ); 383 QCheckBox syncdesktop( i18n("Automatically sync\nwith KDE-Desktop"),&dia );
384 syncdesktop.hide(); 384 syncdesktop.hide();
385#endif 385#endif
386 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop ); 386 syncdesktop.setChecked( mPrefs->mPassiveSyncWithDesktop );
387 387
388 QPushButton pb ( "OK", &dia); 388 QPushButton pb ( "OK", &dia);
389 lay.addWidget( &pb ); 389 lay.addWidget( &pb );
390 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) ); 390 connect(&pb, SIGNAL( clicked() ), &dia, SLOT ( accept() ) );
391 dia.resize( 230,120 ); 391 dia.resize( 230,120 );
392 dia.setCaption( i18n("Enter port for Pi-Sync") ); 392 dia.setCaption( i18n("Enter port for Pi-Sync") );
393 dia.show(); 393 dia.show();
394#ifndef DESKTOP_VERSION 394#ifndef DESKTOP_VERSION
395 int dw = QApplication::desktop()->width(); 395 int dw = QApplication::desktop()->width();
396 int dh = QApplication::desktop()->height(); 396 int dh = QApplication::desktop()->height();
397 dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); 397 dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 );
398#endif 398#endif
399 if ( ! dia.exec() ) 399 if ( ! dia.exec() )
400 return; 400 return;
401 dia.hide(); 401 dia.hide();
402 qApp->processEvents(); 402 qApp->processEvents();
403 if ( mPrefs->mPassiveSyncPw != lepw.text() ) { 403 if ( mPrefs->mPassiveSyncPw != lepw.text() ) {
404 changed = true; 404 changed = true;
405 mPrefs->mPassiveSyncPw = lepw.text(); 405 mPrefs->mPassiveSyncPw = lepw.text();
406 } 406 }
407 if ( mPrefs->mPassiveSyncPort != lab.text() ) { 407 if ( mPrefs->mPassiveSyncPort != lab.text() ) {
408 mPrefs->mPassiveSyncPort = lab.text(); 408 mPrefs->mPassiveSyncPort = lab.text();
409 changed = true; 409 changed = true;
410 } 410 }
411 autoStart = autostart.isChecked(); 411 autoStart = autostart.isChecked();
412 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { 412 if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) {
413 changed = true; 413 changed = true;
414 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); 414 mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked();
415 } 415 }
416 } 416 }
417 else 417 else
418 autoStart = mPrefs->mPassiveSyncAutoStart; 418 autoStart = mPrefs->mPassiveSyncAutoStart;
419 if ( autoStart != mPrefs->mPassiveSyncAutoStart ) 419 if ( autoStart != mPrefs->mPassiveSyncAutoStart )
420 changed = true; 420 changed = true;
421 bool ok; 421 bool ok;
422 mPrefs->mPassiveSyncAutoStart = false; 422 mPrefs->mPassiveSyncAutoStart = false;
423 Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok); 423 Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok);
424 qDebug("%d ", port_t);
425 if ( ! ok || port_t > 65535 ) { 424 if ( ! ok || port_t > 65535 ) {
426 KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error")); 425 KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error"));
427 return; 426 return;
428 } 427 }
429 Q_UINT16 port = port_t; 428 Q_UINT16 port = port_t;
430 //qDebug("port %d ", port); 429 //qDebug("port %d ", port);
431 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); 430 mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 );
432 mServerSocket->setFileName( defaultFileName() );//bbb 431 mServerSocket->setFileName( defaultFileName() );//bbb
433 if ( !mServerSocket->ok() ) { 432 if ( !mServerSocket->ok() ) {
434 QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) ); 433 QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) );
435 delete mServerSocket; 434 delete mServerSocket;
436 mServerSocket = 0; 435 mServerSocket = 0;
437 return; 436 return;
438 } 437 }
439 mPrefs->mPassiveSyncAutoStart = autoStart; 438 mPrefs->mPassiveSyncAutoStart = autoStart;
440 if ( changed ) { 439 if ( changed ) {
441 mPrefs->writeConfig(); 440 mPrefs->writeConfig();
442 } 441 }
443 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); 442 connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) );
444 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); 443 connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) );
445 connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) ); 444 connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) );
446 connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) ); 445 connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) );
447} 446}
448void KSyncManager::displayErrorPort() 447void KSyncManager::displayErrorPort()
449{ 448{
450 KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error")); 449 KMessageBox::information( 0, i18n("<b>Enabling Pi-Sync failed!</b> Failed to bind or listen to the port %1! Is another instance already listening to that port?").arg( mPrefs->mPassiveSyncPort) , i18n("Pi-Sync Port Error"));
451} 450}
452void KSyncManager::syncLocalFile() 451void KSyncManager::syncLocalFile()
453{ 452{
454 453
455 QString fn =mPrefs->mLastSyncedLocalFile; 454 QString fn =mPrefs->mLastSyncedLocalFile;
456 QString ext; 455 QString ext;
457 456
458 switch(mTargetApp) 457 switch(mTargetApp)
459 { 458 {
460 case (KAPI): 459 case (KAPI):
461 ext = "(*.vcf)"; 460 ext = "(*.vcf)";
462 break; 461 break;
463 case (KOPI): 462 case (KOPI):
464 ext = "(*.ics/*.vcs)"; 463 ext = "(*.ics/*.vcs)";
465 break; 464 break;
466 case (PWMPI): 465 case (PWMPI):
467 ext = "(*.pwm)"; 466 ext = "(*.pwm)";
468 break; 467 break;
469 default: 468 default:
470 qDebug("KSM::syncLocalFile: invalid apptype selected"); 469 qDebug("KSM::syncLocalFile: invalid apptype selected");
471 break; 470 break;
472 471
@@ -1267,97 +1266,97 @@ KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject
1267 mPendingConnect = 0; 1266 mPendingConnect = 0;
1268 mPassWord = pw; 1267 mPassWord = pw;
1269 mSocket = 0; 1268 mSocket = 0;
1270 mSyncActionDialog = 0; 1269 mSyncActionDialog = 0;
1271 blockRC = false; 1270 blockRC = false;
1272 mErrorMessage = 0; 1271 mErrorMessage = 0;
1273} 1272}
1274void KServerSocket::waitForSocketFinish() 1273void KServerSocket::waitForSocketFinish()
1275{ 1274{
1276 if ( mSocket ) { 1275 if ( mSocket ) {
1277 //qDebug("KSS:: waiting for finish operation"); 1276 //qDebug("KSS:: waiting for finish operation");
1278 QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish())); 1277 QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish()));
1279 return; 1278 return;
1280 } 1279 }
1281 mSocket = new QSocket( this ); 1280 mSocket = new QSocket( this );
1282 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); 1281 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
1283 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 1282 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
1284 mSocket->setSocket( mPendingConnect ); 1283 mSocket->setSocket( mPendingConnect );
1285 mPendingConnect = 0; 1284 mPendingConnect = 0;
1286} 1285}
1287void KServerSocket::newConnection ( int socket ) 1286void KServerSocket::newConnection ( int socket )
1288{ 1287{
1289 // qDebug("KServerSocket:New connection %d ", socket); 1288 // qDebug("KServerSocket:New connection %d ", socket);
1290 if ( mPendingConnect ) { 1289 if ( mPendingConnect ) {
1291 qDebug("KSS::Error : new Connection"); 1290 qDebug("KSS::Error : new Connection");
1292 return; 1291 return;
1293 } 1292 }
1294 if ( mSocket ) { 1293 if ( mSocket ) {
1295 mPendingConnect = socket; 1294 mPendingConnect = socket;
1296 QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish())); 1295 QTimer::singleShot( 250, this , SLOT ( waitForSocketFinish()));
1297 return; 1296 return;
1298 qDebug("KSS::newConnection Socket deleted! "); 1297 qDebug("KSS::newConnection Socket deleted! ");
1299 delete mSocket; 1298 delete mSocket;
1300 mSocket = 0; 1299 mSocket = 0;
1301 } 1300 }
1302 mPendingConnect = 0; 1301 mPendingConnect = 0;
1303 mSocket = new QSocket( this ); 1302 mSocket = new QSocket( this );
1304 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) ); 1303 connect( mSocket , SIGNAL(readyRead()), this, SLOT(readClient()) );
1305 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) ); 1304 connect( mSocket , SIGNAL(delayedCloseFinished()), this, SLOT(discardClient()) );
1306 mSocket->setSocket( socket ); 1305 mSocket->setSocket( socket );
1307} 1306}
1308 1307
1309void KServerSocket::discardClient() 1308void KServerSocket::discardClient()
1310{ 1309{
1311 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1310 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1312} 1311}
1313void KServerSocket::deleteSocket() 1312void KServerSocket::deleteSocket()
1314{ 1313{
1315 qDebug("KSS::deleteSocket"); 1314 //qDebug("KSS::deleteSocket");
1316 if ( mSocket ) { 1315 if ( mSocket ) {
1317 delete mSocket; 1316 delete mSocket;
1318 mSocket = 0; 1317 mSocket = 0;
1319 } 1318 }
1320 if ( mErrorMessage ) 1319 if ( mErrorMessage )
1321 QTimer::singleShot( 10, this , SLOT ( displayErrorMessage())); 1320 QTimer::singleShot( 10, this , SLOT ( displayErrorMessage()));
1322} 1321}
1323void KServerSocket::readClient() 1322void KServerSocket::readClient()
1324{ 1323{
1325 if ( blockRC ) 1324 if ( blockRC )
1326 return; 1325 return;
1327 if ( mSocket == 0 ) { 1326 if ( mSocket == 0 ) {
1328 qDebug("ERROR::KSS::readClient(): mSocket == 0 "); 1327 qDebug("ERROR::KSS::readClient(): mSocket == 0 ");
1329 return; 1328 return;
1330 } 1329 }
1331 if ( mErrorMessage ) { 1330 if ( mErrorMessage ) {
1332 mErrorMessage = 999; 1331 mErrorMessage = 999;
1333 error_connect("ERROR_ED\r\n\r\n"); 1332 error_connect("ERROR_ED\r\n\r\n");
1334 return; 1333 return;
1335 } 1334 }
1336 mResource = ""; 1335 mResource = "";
1337 mErrorMessage = 0; 1336 mErrorMessage = 0;
1338 //qDebug("KServerSocket::readClient()"); 1337 //qDebug("KServerSocket::readClient()");
1339 if ( mSocket->canReadLine() ) { 1338 if ( mSocket->canReadLine() ) {
1340 QString line = mSocket->readLine(); 1339 QString line = mSocket->readLine();
1341 //qDebug("KServerSocket readline: %s ", line.latin1()); 1340 //qDebug("KServerSocket readline: %s ", line.latin1());
1342 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line ); 1341 QStringList tokens = QStringList::split( QRegExp("[ \r\n][ \r\n]*"), line );
1343 if ( tokens[0] == "GET" ) { 1342 if ( tokens[0] == "GET" ) {
1344 if ( tokens[1] == mPassWord ) { 1343 if ( tokens[1] == mPassWord ) {
1345 //emit sendFile( mSocket ); 1344 //emit sendFile( mSocket );
1346 bool ok = false; 1345 bool ok = false;
1347 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok); 1346 QDateTime dt = KGlobal::locale()->readDateTime( tokens[2], KLocale::ISODate, &ok);
1348 if ( ok ) { 1347 if ( ok ) {
1349 KSyncManager::mRequestedSyncEvent = dt; 1348 KSyncManager::mRequestedSyncEvent = dt;
1350 } 1349 }
1351 else 1350 else
1352 KSyncManager::mRequestedSyncEvent = QDateTime(); 1351 KSyncManager::mRequestedSyncEvent = QDateTime();
1353 mResource =tokens[3]; 1352 mResource =tokens[3];
1354 send_file(); 1353 send_file();
1355 } 1354 }
1356 else { 1355 else {
1357 mErrorMessage = 1; 1356 mErrorMessage = 1;
1358 error_connect("ERROR_PW\r\n\r\n"); 1357 error_connect("ERROR_PW\r\n\r\n");
1359 } 1358 }
1360 } 1359 }
1361 if ( tokens[0] == "PUT" ) { 1360 if ( tokens[0] == "PUT" ) {
1362 if ( tokens[1] == mPassWord ) { 1361 if ( tokens[1] == mPassWord ) {
1363 //emit getFile( mSocket ); 1362 //emit getFile( mSocket );
@@ -1555,97 +1554,97 @@ KCommandSocket::KCommandSocket ( QString remres, QString password, Q_UINT16 port
1555 mRemoteResource.replace (QRegExp (" "),"_" ); 1554 mRemoteResource.replace (QRegExp (" "),"_" );
1556 mPassWord = password; 1555 mPassWord = password;
1557 mSocket = 0; 1556 mSocket = 0;
1558 mFirst = false; 1557 mFirst = false;
1559 mFirstLine = true; 1558 mFirstLine = true;
1560 mPort = port; 1559 mPort = port;
1561 mHost = host; 1560 mHost = host;
1562 tlw = cap; 1561 tlw = cap;
1563 mRetVal = quiet; 1562 mRetVal = quiet;
1564 mTimerSocket = new QTimer ( this ); 1563 mTimerSocket = new QTimer ( this );
1565 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) ); 1564 connect( mTimerSocket, SIGNAL ( timeout () ), this, SLOT ( updateConnectDialog() ) );
1566 mConnectProgress.setCaption( i18n("Pi-Sync") ); 1565 mConnectProgress.setCaption( i18n("Pi-Sync") );
1567 connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) ); 1566 connect( &mConnectProgress, SIGNAL ( cancelled () ), this, SLOT ( deleteSocket() ) );
1568 mConnectCount = -1; 1567 mConnectCount = -1;
1569} 1568}
1570void KCommandSocket::sendFileRequest() 1569void KCommandSocket::sendFileRequest()
1571{ 1570{
1572 if ( tlw ) 1571 if ( tlw )
1573 tlw->setCaption( i18n("Connected! Sending request for remote file ...") ); 1572 tlw->setCaption( i18n("Connected! Sending request for remote file ...") );
1574 mConnectProgress.hide(); 1573 mConnectProgress.hide();
1575 mConnectCount = 300;mConnectMax = 300; 1574 mConnectCount = 300;mConnectMax = 300;
1576 mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") ); 1575 mConnectProgress.setCaption( i18n("Pi-Sync: Connected!") );
1577 mConnectProgress.setLabelText( i18n("Waiting for remote file...") ); 1576 mConnectProgress.setLabelText( i18n("Waiting for remote file...") );
1578 mTimerSocket->start( 100, true ); 1577 mTimerSocket->start( 100, true );
1579 QTextStream os( mSocket ); 1578 QTextStream os( mSocket );
1580 os.setEncoding( QTextStream::Latin1 ); 1579 os.setEncoding( QTextStream::Latin1 );
1581 1580
1582 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate ); 1581 QString curDt = " " +KGlobal::locale()->formatDateTime(QDateTime::currentDateTime().addSecs(-1),true, true,KLocale::ISODate );
1583 os << "GET " << mPassWord << curDt << " " << mRemoteResource << "\r\n\r\n"; 1582 os << "GET " << mPassWord << curDt << " " << mRemoteResource << "\r\n\r\n";
1584} 1583}
1585 1584
1586void KCommandSocket::readFile( QString fn ) 1585void KCommandSocket::readFile( QString fn )
1587{ 1586{
1588 if ( !mSocket ) { 1587 if ( !mSocket ) {
1589 mSocket = new QSocket( this ); 1588 mSocket = new QSocket( this );
1590 //qDebug("KCS: read file - new socket"); 1589 //qDebug("KCS: read file - new socket");
1591 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) ); 1590 connect( mSocket, SIGNAL(readyRead()), this, SLOT(startReadFileFromSocket()) );
1592 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1591 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1593 connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() )); 1592 connect( mSocket, SIGNAL(connected ()), this, SLOT(sendFileRequest() ));
1594 } 1593 }
1595 mFileString = ""; 1594 mFileString = "";
1596 mFileName = fn; 1595 mFileName = fn;
1597 mFirst = true; 1596 mFirst = true;
1598 if ( tlw ) 1597 if ( tlw )
1599 tlw->setCaption( i18n("Trying to connect to remote...") ); 1598 tlw->setCaption( i18n("Trying to connect to remote...") );
1600 mConnectCount = 30;mConnectMax = 30; 1599 mConnectCount = 30;mConnectMax = 30;
1601 mTimerSocket->start( 1000, true ); 1600 mTimerSocket->start( 1000, true );
1602 mSocket->connectToHost( mHost, mPort ); 1601 mSocket->connectToHost( mHost, mPort );
1603 qDebug("KCS: Waiting for connection"); 1602 //qDebug("KCS: Waiting for connection");
1604} 1603}
1605void KCommandSocket::updateConnectDialog() 1604void KCommandSocket::updateConnectDialog()
1606{ 1605{
1607 1606
1608 if ( mConnectCount == mConnectMax ) { 1607 if ( mConnectCount == mConnectMax ) {
1609 //qDebug("MAXX %d", mConnectMax); 1608 //qDebug("MAXX %d", mConnectMax);
1610 mConnectProgress.setTotalSteps ( 30 ); 1609 mConnectProgress.setTotalSteps ( 30 );
1611 mConnectProgress.show(); 1610 mConnectProgress.show();
1612 mConnectProgress.setLabelText( i18n("Trying to connect to remote...") ); 1611 mConnectProgress.setLabelText( i18n("Trying to connect to remote...") );
1613 } 1612 }
1614 //qDebug("updateConnectDialog() %d", mConnectCount); 1613 //qDebug("updateConnectDialog() %d", mConnectCount);
1615 mConnectProgress.raise(); 1614 mConnectProgress.raise();
1616 mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 ); 1615 mConnectProgress.setProgress( (mConnectMax - mConnectCount)%30 );
1617 --mConnectCount; 1616 --mConnectCount;
1618 if ( mConnectCount > 0 ) 1617 if ( mConnectCount > 0 )
1619 mTimerSocket->start( 1000, true ); 1618 mTimerSocket->start( 1000, true );
1620 else 1619 else
1621 deleteSocket(); 1620 deleteSocket();
1622 1621
1623} 1622}
1624void KCommandSocket::writeFile( QString fileName ) 1623void KCommandSocket::writeFile( QString fileName )
1625{ 1624{
1626 if ( !mSocket ) { 1625 if ( !mSocket ) {
1627 mSocket = new QSocket( this ); 1626 mSocket = new QSocket( this );
1628 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) ); 1627 connect( mSocket, SIGNAL(delayedCloseFinished ()), this, SLOT(deleteSocket()) );
1629 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) ); 1628 connect( mSocket, SIGNAL(connected ()), this, SLOT(writeFileToSocket()) );
1630 } 1629 }
1631 mFileName = fileName ; 1630 mFileName = fileName ;
1632 mConnectCount = 30;mConnectMax = 30; 1631 mConnectCount = 30;mConnectMax = 30;
1633 mTimerSocket->start( 1000, true ); 1632 mTimerSocket->start( 1000, true );
1634 mSocket->connectToHost( mHost, mPort ); 1633 mSocket->connectToHost( mHost, mPort );
1635} 1634}
1636void KCommandSocket::writeFileToSocket() 1635void KCommandSocket::writeFileToSocket()
1637{ 1636{
1638 mTimerSocket->stop(); 1637 mTimerSocket->stop();
1639 QFile file2( mFileName ); 1638 QFile file2( mFileName );
1640 if (!file2.open( IO_ReadOnly ) ) { 1639 if (!file2.open( IO_ReadOnly ) ) {
1641 mConnectProgress.hide(); 1640 mConnectProgress.hide();
1642 mConnectCount = -1; 1641 mConnectCount = -1;
1643 mRetVal= errorW; 1642 mRetVal= errorW;
1644 mSocket->close(); 1643 mSocket->close();
1645 if ( mSocket->state() == QSocket::Idle ) 1644 if ( mSocket->state() == QSocket::Idle )
1646 QTimer::singleShot( 10, this , SLOT ( deleteSocket())); 1645 QTimer::singleShot( 10, this , SLOT ( deleteSocket()));
1647 return ; 1646 return ;
1648 } 1647 }
1649 mConnectProgress.setTotalSteps ( file2.size() ); 1648 mConnectProgress.setTotalSteps ( file2.size() );
1650 mConnectProgress.show(); 1649 mConnectProgress.show();
1651 int count = 0; 1650 int count = 0;