author | zautrix <zautrix> | 2005-12-02 09:42:53 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-12-02 09:42:53 (UTC) |
commit | a75d2c26aba6cffae8c3f61e173940240042427b (patch) (unidiff) | |
tree | 68f4b61c150bc263a98c78fdf8671bbbc17cdaf8 /libkdepim | |
parent | 64be8d64fc26d1025a24150d065197ba5d608f3d (diff) | |
download | kdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.zip kdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.tar.gz kdepimpi-a75d2c26aba6cffae8c3f61e173940240042427b.tar.bz2 |
more sync
-rw-r--r-- | libkdepim/ksyncmanager.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp index e615cbe..7197b30 100644 --- a/libkdepim/ksyncmanager.cpp +++ b/libkdepim/ksyncmanager.cpp | |||
@@ -396,98 +396,98 @@ void KSyncManager::enableQuick( bool ask ) | |||
396 | #ifndef DESKTOP_VERSION | 396 | #ifndef DESKTOP_VERSION |
397 | int dw = QApplication::desktop()->width(); | 397 | int dw = QApplication::desktop()->width(); |
398 | int dh = QApplication::desktop()->height(); | 398 | int dh = QApplication::desktop()->height(); |
399 | dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); | 399 | dia.move( (dw-dia.width())/2, (dh - dia.height() )/2 ); |
400 | #endif | 400 | #endif |
401 | if ( ! dia.exec() ) | 401 | if ( ! dia.exec() ) |
402 | return; | 402 | return; |
403 | dia.hide(); | 403 | dia.hide(); |
404 | qApp->processEvents(); | 404 | qApp->processEvents(); |
405 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { | 405 | if ( mPrefs->mPassiveSyncPw != lepw.text() ) { |
406 | changed = true; | 406 | changed = true; |
407 | mPrefs->mPassiveSyncPw = lepw.text(); | 407 | mPrefs->mPassiveSyncPw = lepw.text(); |
408 | } | 408 | } |
409 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { | 409 | if ( mPrefs->mPassiveSyncPort != lab.text() ) { |
410 | mPrefs->mPassiveSyncPort = lab.text(); | 410 | mPrefs->mPassiveSyncPort = lab.text(); |
411 | changed = true; | 411 | changed = true; |
412 | } | 412 | } |
413 | autoStart = autostart.isChecked(); | 413 | autoStart = autostart.isChecked(); |
414 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { | 414 | if (mPrefs->mPassiveSyncWithDesktop != syncdesktop.isChecked() ) { |
415 | changed = true; | 415 | changed = true; |
416 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); | 416 | mPrefs->mPassiveSyncWithDesktop = syncdesktop.isChecked(); |
417 | } | 417 | } |
418 | } | 418 | } |
419 | else | 419 | else |
420 | autoStart = mPrefs->mPassiveSyncAutoStart; | 420 | autoStart = mPrefs->mPassiveSyncAutoStart; |
421 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) | 421 | if ( autoStart != mPrefs->mPassiveSyncAutoStart ) |
422 | changed = true; | 422 | changed = true; |
423 | bool ok; | 423 | bool ok; |
424 | mPrefs->mPassiveSyncAutoStart = false; | 424 | mPrefs->mPassiveSyncAutoStart = false; |
425 | Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok); | 425 | Q_UINT32 port_t = mPrefs->mPassiveSyncPort.toUInt(&ok); |
426 | if ( ! ok || port_t > 65535 ) { | 426 | if ( ! ok || port_t > 65535 ) { |
427 | KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error")); | 427 | KMessageBox::information( 0, i18n("No valid port number:\n%1").arg ( mPrefs->mPassiveSyncPort ), i18n("Pi-Sync Port Error")); |
428 | return; | 428 | return; |
429 | } | 429 | } |
430 | Q_UINT16 port = port_t; | 430 | Q_UINT16 port = port_t; |
431 | //qDebug("port %d ", port); | 431 | //qDebug("port %d ", port); |
432 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); | 432 | mServerSocket = new KServerSocket ( mPrefs->mPassiveSyncPw, port ,1 ); |
433 | mServerSocket->setFileName( defaultFileName() );//bbb | 433 | mServerSocket->setFileName( defaultFileName() );//bbb |
434 | if ( !mServerSocket->ok() ) { | 434 | if ( !mServerSocket->ok() ) { |
435 | QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) ); | 435 | QTimer::singleShot( 2000, this, SLOT ( displayErrorPort() ) ); |
436 | delete mServerSocket; | 436 | delete mServerSocket; |
437 | mServerSocket = 0; | 437 | mServerSocket = 0; |
438 | return; | 438 | return; |
439 | } | 439 | } |
440 | mPrefs->mPassiveSyncAutoStart = autoStart; | 440 | mPrefs->mPassiveSyncAutoStart = autoStart; |
441 | if ( changed ) { | 441 | if ( changed ) { |
442 | mPrefs->writeConfig(); | 442 | mPrefs->writeConfig(); |
443 | } | 443 | } |
444 | connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); | 444 | //connect( mServerSocket, SIGNAL ( request_file() ),this, SIGNAL ( request_file() ) ); |
445 | connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); | 445 | //connect( mServerSocket, SIGNAL ( file_received( bool ) ), this, SIGNAL ( getFile( bool ) ) ); |
446 | connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) ); | 446 | connect( mServerSocket, SIGNAL ( request_file(const QString &) ),this, SIGNAL ( request_file(const QString &) ) ); |
447 | connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) ); | 447 | connect( mServerSocket, SIGNAL ( file_received( bool ,const QString &) ), this, SIGNAL ( getFile( bool,const QString & ) ) ); |
448 | } | 448 | } |
449 | void KSyncManager::displayErrorPort() | 449 | void KSyncManager::displayErrorPort() |
450 | { | 450 | { |
451 | 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 | 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")); |
452 | } | 452 | } |
453 | void KSyncManager::syncLocalFile() | 453 | void KSyncManager::syncLocalFile() |
454 | { | 454 | { |
455 | 455 | ||
456 | QString fn =mPrefs->mLastSyncedLocalFile; | 456 | QString fn =mPrefs->mLastSyncedLocalFile; |
457 | QString ext; | 457 | QString ext; |
458 | 458 | ||
459 | switch(mTargetApp) | 459 | switch(mTargetApp) |
460 | { | 460 | { |
461 | case (KAPI): | 461 | case (KAPI): |
462 | ext = "(*.vcf)"; | 462 | ext = "(*.vcf)"; |
463 | break; | 463 | break; |
464 | case (KOPI): | 464 | case (KOPI): |
465 | ext = "(*.ics/*.vcs)"; | 465 | ext = "(*.ics/*.vcs)"; |
466 | break; | 466 | break; |
467 | case (PWMPI): | 467 | case (PWMPI): |
468 | ext = "(*.pwm)"; | 468 | ext = "(*.pwm)"; |
469 | break; | 469 | break; |
470 | default: | 470 | default: |
471 | qDebug("KSM::syncLocalFile: invalid apptype selected"); | 471 | qDebug("KSM::syncLocalFile: invalid apptype selected"); |
472 | break; | 472 | break; |
473 | 473 | ||
474 | } | 474 | } |
475 | 475 | ||
476 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); | 476 | fn =KFileDialog:: getOpenFileName( fn, i18n("Sync filename"+ext), mParent ); |
477 | if ( fn == "" ) | 477 | if ( fn == "" ) |
478 | return; | 478 | return; |
479 | if ( syncWithFile( fn, false ) ) { | 479 | if ( syncWithFile( fn, false ) ) { |
480 | qDebug("KSM::syncLocalFile() successful "); | 480 | qDebug("KSM::syncLocalFile() successful "); |
481 | } | 481 | } |
482 | 482 | ||
483 | } | 483 | } |
484 | 484 | ||
485 | bool KSyncManager::syncWithFile( QString fn , bool quick ) | 485 | bool KSyncManager::syncWithFile( QString fn , bool quick ) |
486 | { | 486 | { |
487 | bool ret = false; | 487 | bool ret = false; |
488 | QFileInfo info; | 488 | QFileInfo info; |
489 | info.setFile( fn ); | 489 | info.setFile( fn ); |
490 | QString mess; | 490 | QString mess; |
491 | if ( !info. exists() ) { | 491 | if ( !info. exists() ) { |
492 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); | 492 | mess = i18n( "Sync file \n...%1\ndoes not exist!\nNothing synced!\n").arg(fn.right( 30) ); |
493 | QMessageBox::warning( mParent, i18n("Warning!"), | 493 | QMessageBox::warning( mParent, i18n("Warning!"), |