summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kabcore.cpp12
-rw-r--r--kaddressbook/kabcore.h1
-rw-r--r--libkdepim/ksyncmanager.cpp75
-rw-r--r--libkdepim/ksyncmanager.h4
-rw-r--r--libkdepim/ksyncprefsdialog.cpp6
5 files changed, 42 insertions, 56 deletions
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index 6404410..fa80f5c 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2849,33 +2849,39 @@ bool KABCore::syncExternal(KSyncManager* manager, QString resource)
2849 } 2849 }
2850 } 2850 }
2851 setModified(); 2851 setModified();
2852 } 2852 }
2853 if ( syncOK ) 2853 if ( syncOK )
2854 mViewManager->refreshView(); 2854 mViewManager->refreshView();
2855 return syncOK; 2855 return syncOK;
2856 2856
2857} 2857}
2858 2858
2859void KABCore::getFile( bool success ) 2859void KABCore::getFile( bool success )
2860{ 2860{
2861 qDebug("KABCore::getFile ");
2862 QTimer::singleShot( 15000, this , SLOT ( setCaptionBack()));
2861 if ( ! success ) { 2863 if ( ! success ) {
2862 setCaption( i18n("Error receiving file. Nothing changed!") ); 2864 setCaption( i18n("Error receiving file. Nothing changed!") );
2863 return; 2865 return;
2864 } 2866 }
2865 mAddressBook->importFromFile( sentSyncFile() ); 2867 mAddressBook->importFromFile( sentSyncFile() );
2866 setCaption( i18n("Pi-Sync successful!") ); 2868 topLevelWidget()->setCaption( i18n("Pi-Sync successful!") );
2867} 2869}
2868void KABCore::syncFileRequest() 2870void KABCore::syncFileRequest()
2869{ 2871{
2870 mAddressBook->export2File( sentSyncFile() ); 2872 mAddressBook->export2File( sentSyncFile() );
2871} 2873}
2872QString KABCore::sentSyncFile() 2874QString KABCore::sentSyncFile()
2873{ 2875{
2874#ifdef _WIN32_ 2876#ifdef _WIN32_
2875 return locateLocal( "tmp", "syncab.ics" ); 2877 return locateLocal( "tmp", "copysyncab.vcf" );
2876#else 2878#else
2877 return QString( "/tmp/kapitempfile.vcf" ); 2879 return QString( "/tmp/copysyncab.vcf" );
2878#endif 2880#endif
2879} 2881}
2880 2882
2883void KABCore::setCaptionBack()
2884{
2885 topLevelWidget()->setCaption( i18n("KAddressbook/Pi") );
2886}
2881 2887
diff --git a/kaddressbook/kabcore.h b/kaddressbook/kabcore.h
index 987369d..c628399 100644
--- a/kaddressbook/kabcore.h
+++ b/kaddressbook/kabcore.h
@@ -340,24 +340,25 @@ class KABCore : public QWidget, public KSyncInterface
340 340
341 signals: 341 signals:
342 void contactSelected( const QString &name ); 342 void contactSelected( const QString &name );
343 void contactSelected( const QPixmap &pixmap ); 343 void contactSelected( const QPixmap &pixmap );
344 public slots: 344 public slots:
345 void getFile( bool success ); 345 void getFile( bool success );
346 void syncFileRequest(); 346 void syncFileRequest();
347 void setDetailsVisible( bool visible ); 347 void setDetailsVisible( bool visible );
348 void setDetailsToState(); 348 void setDetailsToState();
349 // void slotSyncMenu( int ); 349 // void slotSyncMenu( int );
350 private slots: 350 private slots:
351 void setJumpButtonBarVisible( bool visible ); 351 void setJumpButtonBarVisible( bool visible );
352 void setCaptionBack();
352 void importFromOL(); 353 void importFromOL();
353 void extensionModified( const KABC::Addressee::List &list ); 354 void extensionModified( const KABC::Addressee::List &list );
354 void extensionChanged( int id ); 355 void extensionChanged( int id );
355 void clipboardDataChanged(); 356 void clipboardDataChanged();
356 void updateActionMenu(); 357 void updateActionMenu();
357 void configureKeyBindings(); 358 void configureKeyBindings();
358 void removeVoice(); 359 void removeVoice();
359#ifdef KAB_EMBEDDED 360#ifdef KAB_EMBEDDED
360 void configureResources(); 361 void configureResources();
361#endif //KAB_EMBEDDED 362#endif //KAB_EMBEDDED
362 363
363 void slotEditorDestroyed( const QString &uid ); 364 void slotEditorDestroyed( const QString &uid );
diff --git a/libkdepim/ksyncmanager.cpp b/libkdepim/ksyncmanager.cpp
index b360644..a663427 100644
--- a/libkdepim/ksyncmanager.cpp
+++ b/libkdepim/ksyncmanager.cpp
@@ -222,25 +222,25 @@ void KSyncManager::slotSyncMenu( int action )
222 mActiveSyncPort = temp->getRemotePortAB(); 222 mActiveSyncPort = temp->getRemotePortAB();
223 mActiveSyncIP = temp->getRemoteIPAB(); 223 mActiveSyncIP = temp->getRemoteIPAB();
224 } else if ( mTargetApp == KOPI ) { 224 } else if ( mTargetApp == KOPI ) {
225 mPassWordPiSync = temp->getRemotePw(); 225 mPassWordPiSync = temp->getRemotePw();
226 mActiveSyncPort = temp->getRemotePort(); 226 mActiveSyncPort = temp->getRemotePort();
227 mActiveSyncIP = temp->getRemoteIP(); 227 mActiveSyncIP = temp->getRemoteIP();
228 } else { 228 } else {
229 mPassWordPiSync = temp->getRemotePwPWM(); 229 mPassWordPiSync = temp->getRemotePwPWM();
230 mActiveSyncPort = temp->getRemotePortPWM(); 230 mActiveSyncPort = temp->getRemotePortPWM();
231 mActiveSyncIP = temp->getRemoteIPPWM(); 231 mActiveSyncIP = temp->getRemoteIPPWM();
232 } 232 }
233 syncPi(); 233 syncPi();
234 } 234 } else
235 syncRemote( temp ); 235 syncRemote( temp );
236 236
237 } 237 }
238 } 238 }
239 delete temp; 239 delete temp;
240 setBlockSave(false); 240 setBlockSave(false);
241} 241}
242void KSyncManager::enableQuick() 242void KSyncManager::enableQuick()
243{ 243{
244 QDialog dia ( 0, "input-dialog", true ); 244 QDialog dia ( 0, "input-dialog", true );
245 QLineEdit lab ( &dia ); 245 QLineEdit lab ( &dia );
246 QVBoxLayout lay( &dia ); 246 QVBoxLayout lay( &dia );
@@ -340,72 +340,72 @@ bool KSyncManager::syncWithFile( QString fn , bool quick )
340 result = QMessageBox::warning( mParent, i18n("Warning!"), 340 result = QMessageBox::warning( mParent, i18n("Warning!"),
341 mess, 341 mess,
342 i18n("Sync"), i18n("Cancel"), 0, 342 i18n("Sync"), i18n("Cancel"), 0,
343 0, 1 ); 343 0, 1 );
344 if ( result ) 344 if ( result )
345 return false; 345 return false;
346 } 346 }
347 if ( mAskForPreferences ) 347 if ( mAskForPreferences )
348 edit_sync_options(); 348 edit_sync_options();
349 if ( result == 0 ) { 349 if ( result == 0 ) {
350 //qDebug("Now sycing ... "); 350 //qDebug("Now sycing ... ");
351 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) ) 351 if ( ret = mImplementation->sync( this, fn, mSyncAlgoPrefs ) )
352 mParent->setCaption( i18n("Synchronization successful") ); 352 mParent->topLevelWidget()->setCaption( i18n("Synchronization successful") );
353 else 353 else
354 mParent->setCaption( i18n("Sync cancelled or failed. Nothing synced.") ); 354 mParent->topLevelWidget()->setCaption( i18n("Sync cancelled or failed. Nothing synced.") );
355 if ( ! quick ) 355 if ( ! quick )
356 mLastSyncedLocalFile = fn; 356 mLastSyncedLocalFile = fn;
357 } 357 }
358 return ret; 358 return ret;
359} 359}
360void KSyncManager::quickSyncLocalFile() 360void KSyncManager::quickSyncLocalFile()
361{ 361{
362 362
363 if ( syncWithFile( mLastSyncedLocalFile, false ) ) { 363 if ( syncWithFile( mLastSyncedLocalFile, false ) ) {
364 qDebug("quick syncLocalFile() successful "); 364 qDebug("quick syncLocalFile() successful ");
365 365
366 } 366 }
367} 367}
368void KSyncManager::multiSync( bool askforPrefs ) 368void KSyncManager::multiSync( bool askforPrefs )
369{ 369{
370 if (blockSave()) 370 if (blockSave())
371 return; 371 return;
372 setBlockSave(true); 372 setBlockSave(true);
373 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!"); 373 QString question = i18n("Do you really want\nto multiple sync\nwith all checked profiles?\nSyncing takes some\ntime - all profiles\nare synced twice!");
374 if ( QMessageBox::information( mParent, i18n("Sync"), 374 if ( QMessageBox::information( mParent, i18n("Sync"),
375 question, 375 question,
376 i18n("Yes"), i18n("No"), 376 i18n("Yes"), i18n("No"),
377 0, 0 ) != 0 ) { 377 0, 0 ) != 0 ) {
378 setBlockSave(false); 378 setBlockSave(false);
379 mParent->setCaption(i18n("Aborted! Nothing synced!")); 379 mParent->topLevelWidget()->setCaption(i18n("Aborted! Nothing synced!"));
380 return; 380 return;
381 } 381 }
382 mCurrentSyncDevice = i18n("Multiple profiles") ; 382 mCurrentSyncDevice = i18n("Multiple profiles") ;
383 mSyncAlgoPrefs = mRingSyncAlgoPrefs; 383 mSyncAlgoPrefs = mRingSyncAlgoPrefs;
384 if ( askforPrefs ) { 384 if ( askforPrefs ) {
385 edit_sync_options(); 385 edit_sync_options();
386 mRingSyncAlgoPrefs = mSyncAlgoPrefs; 386 mRingSyncAlgoPrefs = mSyncAlgoPrefs;
387 } 387 }
388 mParent->setCaption(i18n("Multiple sync started.") ); 388 mParent->topLevelWidget()->setCaption(i18n("Multiple sync started.") );
389 qApp->processEvents(); 389 qApp->processEvents();
390 int num = ringSync() ; 390 int num = ringSync() ;
391 if ( num > 1 ) 391 if ( num > 1 )
392 ringSync(); 392 ringSync();
393 setBlockSave(false); 393 setBlockSave(false);
394 if ( num ) 394 if ( num )
395 emit save(); 395 emit save();
396 if ( num ) 396 if ( num )
397 mParent->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) ); 397 mParent->topLevelWidget()->setCaption(i18n("%1 profiles synced. Multiple sync completed!").arg(num) );
398 else 398 else
399 mParent->setCaption(i18n("Nothing synced! No profiles defined for multisync!")); 399 mParent->topLevelWidget()->setCaption(i18n("Nothing synced! No profiles defined for multisync!"));
400 return; 400 return;
401} 401}
402int KSyncManager::ringSync() 402int KSyncManager::ringSync()
403{ 403{
404 int syncedProfiles = 0; 404 int syncedProfiles = 0;
405 unsigned int i; 405 unsigned int i;
406 QTime timer; 406 QTime timer;
407 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) ); 407 KConfig config ( locateLocal( "config","ksyncprofilesrc" ) );
408 QStringList syncProfileNames = mSyncProfileNames; 408 QStringList syncProfileNames = mSyncProfileNames;
409 KSyncProfile* temp = new KSyncProfile (); 409 KSyncProfile* temp = new KSyncProfile ();
410 mAskForPreferences = false; 410 mAskForPreferences = false;
411 for ( i = 0; i < syncProfileNames.count(); ++i ) { 411 for ( i = 0; i < syncProfileNames.count(); ++i ) {
@@ -424,25 +424,25 @@ int KSyncManager::ringSync()
424 break; 424 break;
425 case (PWMPI): 425 case (PWMPI):
426 includeInRingSync = temp->getIncludeInRingSyncPWM(); 426 includeInRingSync = temp->getIncludeInRingSyncPWM();
427 break; 427 break;
428 default: 428 default:
429 qDebug("KSyncManager::ringSync: invalid apptype selected"); 429 qDebug("KSyncManager::ringSync: invalid apptype selected");
430 break; 430 break;
431 431
432 } 432 }
433 433
434 434
435 if ( includeInRingSync && ( i < 1 || i > 2 )) { 435 if ( includeInRingSync && ( i < 1 || i > 2 )) {
436 mParent->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... ")); 436 mParent->topLevelWidget()->setCaption(i18n("Profile ")+syncProfileNames[mCurrentSyncProfile]+ i18n(" is synced ... "));
437 ++syncedProfiles; 437 ++syncedProfiles;
438 // mAskForPreferences = temp->getAskForPreferences(); 438 // mAskForPreferences = temp->getAskForPreferences();
439 mWriteBackFile = temp->getWriteBackFile(); 439 mWriteBackFile = temp->getWriteBackFile();
440 mWriteBackExistingOnly = temp->getWriteBackExisting(); 440 mWriteBackExistingOnly = temp->getWriteBackExisting();
441 mWriteBackInFuture = 0; 441 mWriteBackInFuture = 0;
442 if ( temp->getWriteBackFuture() ) 442 if ( temp->getWriteBackFuture() )
443 mWriteBackInFuture = temp->getWriteBackFutureWeeks( ); 443 mWriteBackInFuture = temp->getWriteBackFutureWeeks( );
444 mShowSyncSummary = false; 444 mShowSyncSummary = false;
445 mCurrentSyncDevice = syncProfileNames[i] ; 445 mCurrentSyncDevice = syncProfileNames[i] ;
446 mCurrentSyncName = mLocalMachineName; 446 mCurrentSyncName = mLocalMachineName;
447 if ( i == 0 ) { 447 if ( i == 0 ) {
448 syncSharp(); 448 syncSharp();
@@ -469,25 +469,25 @@ int KSyncManager::ringSync()
469 } else { 469 } else {
470 if ( temp->getIsPhoneSync() ) { 470 if ( temp->getIsPhoneSync() ) {
471 mPhoneDevice = temp->getPhoneDevice( ) ; 471 mPhoneDevice = temp->getPhoneDevice( ) ;
472 mPhoneConnection = temp->getPhoneConnection( ); 472 mPhoneConnection = temp->getPhoneConnection( );
473 mPhoneModel = temp->getPhoneModel( ); 473 mPhoneModel = temp->getPhoneModel( );
474 syncPhone(); 474 syncPhone();
475 } else 475 } else
476 syncRemote( temp, false ); 476 syncRemote( temp, false );
477 477
478 } 478 }
479 } 479 }
480 timer.start(); 480 timer.start();
481 mParent->setCaption(i18n("Multiple sync in progress ... please wait!") ); 481 mParent->topLevelWidget()->setCaption(i18n("Multiple sync in progress ... please wait!") );
482 while ( timer.elapsed () < 2000 ) { 482 while ( timer.elapsed () < 2000 ) {
483 qApp->processEvents(); 483 qApp->processEvents();
484#ifndef _WIN32_ 484#ifndef _WIN32_
485 sleep (1); 485 sleep (1);
486#endif 486#endif
487 } 487 }
488 488
489 } 489 }
490 490
491 } 491 }
492 delete temp; 492 delete temp;
493 return syncedProfiles; 493 return syncedProfiles;
@@ -532,69 +532,69 @@ void KSyncManager::syncRemote( KSyncProfile* prof, bool ask)
532 } 532 }
533 533
534 534
535 int fi; 535 int fi;
536 if ( (fi = preCommand.find("$PWD$")) > 0 ) { 536 if ( (fi = preCommand.find("$PWD$")) > 0 ) {
537 QString pwd = getPassword(); 537 QString pwd = getPassword();
538 preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 ); 538 preCommand = preCommand.left( fi )+ pwd + preCommand.mid( fi+5 );
539 539
540 } 540 }
541 int maxlen = 30; 541 int maxlen = 30;
542 if ( QApplication::desktop()->width() > 320 ) 542 if ( QApplication::desktop()->width() > 320 )
543 maxlen += 25; 543 maxlen += 25;
544 mParent->setCaption ( i18n( "Copy remote file to local machine..." ) ); 544 mParent->topLevelWidget()->setCaption ( i18n( "Copy remote file to local machine..." ) );
545 int fileSize = 0; 545 int fileSize = 0;
546 int result = system ( preCommand ); 546 int result = system ( preCommand );
547 // 0 : okay 547 // 0 : okay
548 // 256: no such file or dir 548 // 256: no such file or dir
549 // 549 //
550 qDebug("KO: Remote copy result(0 = okay): %d ",result ); 550 qDebug("KO: Remote copy result(0 = okay): %d ",result );
551 if ( result != 0 ) { 551 if ( result != 0 ) {
552 unsigned int len = maxlen; 552 unsigned int len = maxlen;
553 while ( len < preCommand.length() ) { 553 while ( len < preCommand.length() ) {
554 preCommand.insert( len , "\n" ); 554 preCommand.insert( len , "\n" );
555 len += maxlen +2; 555 len += maxlen +2;
556 } 556 }
557 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ; 557 question = i18n("Sorry, the copy command failed!\nCommand was:\n%1\n \nTry command on console to get more\ndetailed info about the reason.\n").arg (preCommand) ;
558 QMessageBox::information( mParent, i18n("Sync - ERROR"), 558 QMessageBox::information( mParent, i18n("Sync - ERROR"),
559 question, 559 question,
560 i18n("Okay!")) ; 560 i18n("Okay!")) ;
561 mParent->setCaption (""); 561 mParent->topLevelWidget()->setCaption ("");
562 return; 562 return;
563 } 563 }
564 mParent->setCaption ( i18n( "Copying succeed." ) ); 564 mParent->topLevelWidget()->setCaption ( i18n( "Copying succeed." ) );
565 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() ); 565 //qDebug(" file **%s** ",prof->getLocalTempFile().latin1() );
566 566
567 567
568 568
569 if ( syncWithFile( localTempFile, true ) ) { 569 if ( syncWithFile( localTempFile, true ) ) {
570// Event* e = mView->getLastSyncEvent(); 570// Event* e = mView->getLastSyncEvent();
571// e->setReadOnly( false ); 571// e->setReadOnly( false );
572// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]); 572// e->setLocation( KOPrefs::instance()->mSyncProfileNames[mCurrentSyncProfile]);
573// e->setReadOnly( true ); 573// e->setReadOnly( true );
574 if ( mWriteBackFile ) { 574 if ( mWriteBackFile ) {
575 int fi; 575 int fi;
576 if ( (fi = postCommand.find("$PWD$")) > 0 ) { 576 if ( (fi = postCommand.find("$PWD$")) > 0 ) {
577 QString pwd = getPassword(); 577 QString pwd = getPassword();
578 postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 ); 578 postCommand = postCommand.left( fi )+ pwd + postCommand.mid( fi+5 );
579 579
580 } 580 }
581 mParent->setCaption ( i18n( "Writing back file ..." ) ); 581 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file ..." ) );
582 result = system ( postCommand ); 582 result = system ( postCommand );
583 qDebug("Writing back file result: %d ", result); 583 qDebug("Writing back file result: %d ", result);
584 if ( result != 0 ) { 584 if ( result != 0 ) {
585 mParent->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) ); 585 mParent->topLevelWidget()->setCaption ( i18n( "Writing back file result: " )+QString::number( result ) );
586 return; 586 return;
587 } else { 587 } else {
588 mParent->setCaption ( i18n( "Syncronization sucessfully completed" ) ); 588 mParent->topLevelWidget()->setCaption ( i18n( "Syncronization sucessfully completed" ) );
589 } 589 }
590 } 590 }
591 } 591 }
592 return; 592 return;
593} 593}
594 594
595void KSyncManager::edit_sync_options() 595void KSyncManager::edit_sync_options()
596{ 596{
597 //mDialogManager->showSyncOptions(); 597 //mDialogManager->showSyncOptions();
598 //mSyncAlgoPrefs 598 //mSyncAlgoPrefs
599 QDialog dia( mParent, "dia", true ); 599 QDialog dia( mParent, "dia", true );
600 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice ); 600 dia.setCaption( i18n("Device: " ) +mCurrentSyncDevice );
@@ -740,124 +740,102 @@ void KSyncManager::hideProgressBar()
740bool KSyncManager::isProgressBarCanceled() 740bool KSyncManager::isProgressBarCanceled()
741{ 741{
742 return !bar->isVisible(); 742 return !bar->isVisible();
743} 743}
744 744
745QString KSyncManager::syncFileName() 745QString KSyncManager::syncFileName()
746{ 746{
747 747
748 QString fn = "tempfile"; 748 QString fn = "tempfile";
749 switch(mTargetApp) 749 switch(mTargetApp)
750 { 750 {
751 case (KAPI): 751 case (KAPI):
752 fn = "addressbook.vcf"; 752 fn = "tempsyncab.vcf";
753 break; 753 break;
754 case (KOPI): 754 case (KOPI):
755 fn = "synccalendar.ics"; 755 fn = "tempsynccal.ics";
756 break; 756 break;
757 case (PWMPI): 757 case (PWMPI):
758 fn = "manager.pwm"; 758 fn = "tempsyncpw.pwm";
759 break; 759 break;
760 default: 760 default:
761 break; 761 break;
762 } 762 }
763#ifdef _WIN32_ 763#ifdef _WIN32_
764 return locateLocal( "tmp", fn ); 764 return locateLocal( "tmp", fn );
765#else 765#else
766 return (QString( "/tmp/" )+ fn ); 766 return (QString( "/tmp/" )+ fn );
767#endif 767#endif
768} 768}
769 769
770void KSyncManager::syncPi() 770void KSyncManager::syncPi()
771{ 771{
772 qApp->processEvents(); 772 qApp->processEvents();
773 bool ok; 773 bool ok;
774 Q_UINT16 port = mActiveSyncPort.toUInt(&ok); 774 Q_UINT16 port = mActiveSyncPort.toUInt(&ok);
775 if ( ! ok ) { 775 if ( ! ok ) {
776 mParent->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") ); 776 mParent->topLevelWidget()->setCaption( i18n("Sorry, no valid port.Syncing cancelled.") );
777 return; 777 return;
778 } 778 }
779 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this ); 779 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, port, mActiveSyncIP, this );
780 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) ); 780 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int )), this, SLOT(deleteCommandSocket(KCommandSocket*, int)) );
781 mParent->setCaption( i18n("Sending request for remote file ...") ); 781 mParent->topLevelWidget()->setCaption( i18n("Sending request for remote file ...") );
782 commandSocket->readFile( syncFileName() ); 782 commandSocket->readFile( syncFileName() );
783} 783}
784 784
785void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state) 785void KSyncManager::deleteCommandSocket(KCommandSocket*s, int state)
786{ 786{
787 qDebug("MainWindow::deleteCommandSocket %d", state); 787 qDebug("MainWindow::deleteCommandSocket %d", state);
788 788
789 //enum { success, errorW, errorR, quiet }; 789 //enum { success, errorW, errorR, quiet };
790 if ( state == KCommandSocket::errorR ) { 790 if ( state == KCommandSocket::errorR ) {
791 mParent->setCaption( i18n("ERROR: Receiving remote file failed.") ); 791 mParent->topLevelWidget()->setCaption( i18n("ERROR: Receiving remote file failed.") );
792 delete s; 792 delete s;
793 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); 793 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
794 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 794 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
795 commandSocket->sendStop(); 795 commandSocket->sendStop();
796 return; 796 return;
797 797
798 } else if ( state == KCommandSocket::errorW ) { 798 } else if ( state == KCommandSocket::errorW ) {
799 mParent->setCaption( i18n("ERROR:Writing back file failed.") ); 799 mParent->topLevelWidget()->setCaption( i18n("ERROR:Writing back file failed.") );
800 800
801 } else if ( state == KCommandSocket::successR ) { 801 } else if ( state == KCommandSocket::successR ) {
802 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket())); 802 QTimer::singleShot( 1, this , SLOT ( readFileFromSocket()));
803 803
804 } else if ( state == KCommandSocket::successW ) { 804 } else if ( state == KCommandSocket::successW ) {
805 mParent->setCaption( i18n("Pi-Sync succesful!") ); 805 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
806 } 806 }
807 807
808 delete s; 808 delete s;
809} 809}
810 810
811void KSyncManager::readFileFromSocket() 811void KSyncManager::readFileFromSocket()
812{ 812{
813 QString fileName = syncFileName(); 813 QString fileName = syncFileName();
814 mParent->setCaption( i18n("Remote file saved to temp file.") ); 814 mParent->topLevelWidget()->setCaption( i18n("Remote file saved to temp file.") );
815 if ( ! syncWithFile( fileName , true ) ) { 815 if ( ! syncWithFile( fileName , true ) ) {
816 mParent->setCaption( i18n("Syncing failed.") ); 816 mParent->topLevelWidget()->setCaption( i18n("Syncing failed.") );
817 qDebug("Syncing failed "); 817 qDebug("Syncing failed ");
818 return; 818 return;
819 } 819 }
820 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this ); 820 KCommandSocket* commandSocket = new KCommandSocket( mPassWordPiSync, mActiveSyncPort.toUInt(), mActiveSyncIP, this );
821 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) ); 821 connect( commandSocket, SIGNAL(commandFinished( KCommandSocket*, int)), this, SLOT(deleteCommandSocket(KCommandSocket*, int )) );
822 if ( mWriteBackFile ) 822 if ( mWriteBackFile )
823 commandSocket->writeFile( fileName ); 823 commandSocket->writeFile( fileName );
824 else { 824 else {
825 commandSocket->sendStop(); 825 commandSocket->sendStop();
826 mParent->setCaption( i18n("Pi-Sync succesful!") ); 826 mParent->topLevelWidget()->setCaption( i18n("Pi-Sync succesful!") );
827 } 827 }
828} 828}
829 829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name ) 830KServerSocket:: KServerSocket ( QString pw, Q_UINT16 port, int backlog, QObject * parent, const char * name ) : QServerSocket( port, backlog, parent, name )
853{ 831{
854 mPassWord = pw; 832 mPassWord = pw;
855 mSocket = 0; 833 mSocket = 0;
856 mSyncActionDialog = 0; 834 mSyncActionDialog = 0;
857 blockRC = false; 835 blockRC = false;
858}; 836};
859 837
860void KServerSocket::newConnection ( int socket ) 838void KServerSocket::newConnection ( int socket )
861{ 839{
862 // qDebug("KServerSocket:New connection %d ", socket); 840 // qDebug("KServerSocket:New connection %d ", socket);
863 if ( mSocket ) { 841 if ( mSocket ) {
@@ -929,24 +907,25 @@ void KServerSocket::send_file()
929 //qDebug("MainWindow::sendFile(QSocket* s) "); 907 //qDebug("MainWindow::sendFile(QSocket* s) ");
930 if ( mSyncActionDialog ) 908 if ( mSyncActionDialog )
931 delete mSyncActionDialog; 909 delete mSyncActionDialog;
932 mSyncActionDialog = new QDialog ( 0, "input-dialog", true ); 910 mSyncActionDialog = new QDialog ( 0, "input-dialog", true );
933 mSyncActionDialog->setCaption(i18n("Received sync request")); 911 mSyncActionDialog->setCaption(i18n("Received sync request"));
934 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog ); 912 QLabel* label = new QLabel( i18n("Synchronizing from remote ...\n\nDo not use this application!\n\nIf syncing fails\nyou can close this dialog."), mSyncActionDialog );
935 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog ); 913 QVBoxLayout* lay = new QVBoxLayout( mSyncActionDialog );
936 lay->addWidget( label); 914 lay->addWidget( label);
937 lay->setMargin(7); 915 lay->setMargin(7);
938 lay->setSpacing(7); 916 lay->setSpacing(7);
939 mSyncActionDialog->setFixedSize( 230, 120); 917 mSyncActionDialog->setFixedSize( 230, 120);
940 mSyncActionDialog->show(); 918 mSyncActionDialog->show();
919 mSyncActionDialog->raise();
941 qDebug("KSS::saving ... "); 920 qDebug("KSS::saving ... ");
942 emit request_file(); 921 emit request_file();
943 qApp->processEvents(); 922 qApp->processEvents();
944 QString fileName = mFileName; 923 QString fileName = mFileName;
945 QFile file( fileName ); 924 QFile file( fileName );
946 if (!file.open( IO_ReadOnly ) ) { 925 if (!file.open( IO_ReadOnly ) ) {
947 delete mSyncActionDialog; 926 delete mSyncActionDialog;
948 mSyncActionDialog = 0; 927 mSyncActionDialog = 0;
949 qDebug("KSS::error open file "); 928 qDebug("KSS::error open file ");
950 mSocket->close(); 929 mSocket->close();
951 if ( mSocket->state() == QSocket::Idle ) 930 if ( mSocket->state() == QSocket::Idle )
952 QTimer::singleShot( 10, this , SLOT ( discardClient())); 931 QTimer::singleShot( 10, this , SLOT ( discardClient()));
diff --git a/libkdepim/ksyncmanager.h b/libkdepim/ksyncmanager.h
index 0eb3323..aad48d9 100644
--- a/libkdepim/ksyncmanager.h
+++ b/libkdepim/ksyncmanager.h
@@ -150,31 +150,31 @@ class KSyncManager : public QObject
150 QString mLastSyncedLocalFile; // save! 150 QString mLastSyncedLocalFile; // save!
151 QString mPassWordPiSync; 151 QString mPassWordPiSync;
152 QString mActiveSyncPort; 152 QString mActiveSyncPort;
153 QString mActiveSyncIP ; 153 QString mActiveSyncIP ;
154 154
155 signals: 155 signals:
156 void save(); 156 void save();
157 void request_file(); 157 void request_file();
158 void getFile( bool ); 158 void getFile( bool );
159 159
160 public slots: 160 public slots:
161 void slotSyncMenu( int ); 161 void slotSyncMenu( int );
162 void deleteCommandSocket(KCommandSocket*s, int state);
163 void readFileFromSocket();
162 164
163 private: 165 private:
164 // LR ******************************* 166 // LR *******************************
165 // sync stuff! 167 // sync stuff!
166 void syncPi(); 168 void syncPi();
167 void deleteCommandSocket(KCommandSocket*s, int state);
168 void readFileFromSocket();
169 KServerSocket * mServerSocket; 169 KServerSocket * mServerSocket;
170 void enableQuick(); 170 void enableQuick();
171 KPimPrefs* mPrefs; 171 KPimPrefs* mPrefs;
172 QString mDefFileName; 172 QString mDefFileName;
173 QString mCurrentSyncDevice; 173 QString mCurrentSyncDevice;
174 QString mCurrentSyncName; 174 QString mCurrentSyncName;
175 void quickSyncLocalFile(); 175 void quickSyncLocalFile();
176 bool syncWithFile( QString fn , bool quick ); 176 bool syncWithFile( QString fn , bool quick );
177 void syncLocalFile(); 177 void syncLocalFile();
178 void syncPhone(); 178 void syncPhone();
179 void syncSharp(); 179 void syncSharp();
180 bool syncExternalApplication(QString); 180 bool syncExternalApplication(QString);
diff --git a/libkdepim/ksyncprefsdialog.cpp b/libkdepim/ksyncprefsdialog.cpp
index 0caa27e..ee092b9 100644
--- a/libkdepim/ksyncprefsdialog.cpp
+++ b/libkdepim/ksyncprefsdialog.cpp
@@ -279,37 +279,37 @@ void KSyncPrefsDialog::setupSyncAlgTab()
279 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) ); 279 connect ( button, SIGNAL( clicked()), this, SLOT (fillFTP() ) );
280 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget); 280 lab = new QLabel( i18n("Hint: Use $PWD$ for placeholder of password!"), remoteFileWidget);
281 281
282 // *** pi-sync 282 // *** pi-sync
283 piWidget = new QVBox( topFrame); 283 piWidget = new QVBox( topFrame);
284 topLayout->addMultiCellWidget(piWidget, iii,iii,0,1); 284 topLayout->addMultiCellWidget(piWidget, iii,iii,0,1);
285 ++iii; 285 ++iii;
286 temphb = new QHBox( piWidget ); 286 temphb = new QHBox( piWidget );
287 new QLabel( i18n("Calendar:"), temphb); 287 new QLabel( i18n("Calendar:"), temphb);
288 new QLabel( i18n("AddressBook:"), temphb); 288 new QLabel( i18n("AddressBook:"), temphb);
289 new QLabel( i18n("PWManager:"), temphb); 289 new QLabel( i18n("PWManager:"), temphb);
290 290
291 lab = new QLabel( i18n("Password for remote access:"), piWidget); 291 lab = new QLabel( i18n("Password for remote access: (could be the same for each)"), piWidget);
292 temphb = new QHBox( piWidget ); 292 temphb = new QHBox( piWidget );
293 mRemotePw = new QLineEdit(temphb); 293 mRemotePw = new QLineEdit(temphb);
294 mRemotePwAB = new QLineEdit(temphb); 294 mRemotePwAB = new QLineEdit(temphb);
295 mRemotePwPWM = new QLineEdit(temphb); 295 mRemotePwPWM = new QLineEdit(temphb);
296 296
297 lab = new QLabel( i18n("Remote IP address:"), piWidget); 297 lab = new QLabel( i18n("Remote IP address: (could be the same for each)"), piWidget);
298 temphb = new QHBox( piWidget ); 298 temphb = new QHBox( piWidget );
299 mRemoteIP = new QLineEdit(temphb); 299 mRemoteIP = new QLineEdit(temphb);
300 mRemoteIPAB = new QLineEdit(temphb); 300 mRemoteIPAB = new QLineEdit(temphb);
301 mRemoteIPPWM = new QLineEdit(temphb); 301 mRemoteIPPWM = new QLineEdit(temphb);
302 302
303 lab = new QLabel( i18n("Remote port number:"), piWidget); 303 lab = new QLabel( i18n("Remote port number: (should be different for each)"), piWidget);
304 temphb = new QHBox( piWidget ); 304 temphb = new QHBox( piWidget );
305 mRemotePort = new QLineEdit(temphb); 305 mRemotePort = new QLineEdit(temphb);
306 mRemotePortAB = new QLineEdit(temphb); 306 mRemotePortAB = new QLineEdit(temphb);
307 mRemotePortPWM = new QLineEdit(temphb); 307 mRemotePortPWM = new QLineEdit(temphb);
308 308
309} 309}
310 310
311 311
312 312
313 313
314 314
315void KSyncPrefsDialog::slotOK() 315void KSyncPrefsDialog::slotOK()