summaryrefslogtreecommitdiffabout
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/addresseeview.cpp15
-rw-r--r--kaddressbook/kabcore.cpp29
2 files changed, 11 insertions, 33 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp
index 487e8a5..2dda968 100644
--- a/kabc/addresseeview.cpp
+++ b/kabc/addresseeview.cpp
@@ -391,77 +391,74 @@ void AddresseeView::addTag(const QString & tag,const QString & text)
391 pos=tmpText.find("\n"); 391 pos=tmpText.find("\n");
392 tmp=tmpText.left(pos); 392 tmp=tmpText.left(pos);
393 tmpText=tmpText.right(tmpText.length()-pos-1); 393 tmpText=tmpText.right(tmpText.length()-pos-1);
394 tmpStr+=tmp+"<br>"; 394 tmpStr+=tmp+"<br>";
395 } 395 }
396 } 396 }
397 else tmpStr += tmpText; 397 else tmpStr += tmpText;
398 tmpStr+="</" + tag + ">"; 398 tmpStr+="</" + tag + ">";
399 mText.append(tmpStr); 399 mText.append(tmpStr);
400 } 400 }
401 else 401 else
402 { 402 {
403 str += text + "</" + tag + ">"; 403 str += text + "</" + tag + ">";
404 mText.append(str); 404 mText.append(str);
405 } 405 }
406} 406}
407 407
408AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, 408AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name,
409 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) 409 true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false)
410{ 410{
411 findButton( Close )->setText( i18n("Cancel Sync")); 411 findButton( Close )->setText( i18n("Cancel Sync"));
412 findButton( Ok )->setText( i18n("Remote")); 412 findButton( Ok )->setText( i18n("Remote"));
413 findButton( User1 )->setText( i18n("Local")); 413 findButton( User1 )->setText( i18n("Local"));
414 QWidget* topframe = new QWidget( this ); 414 QWidget* topframe = new QWidget( this );
415 //QVBox* topframe = new QVBox( this );
416 setMainWidget( topframe ); 415 setMainWidget( topframe );
417 QBoxLayout* bl; 416 QBoxLayout* bl;
418 if ( QApplication::desktop()->width() < 640 ) { 417 if ( QApplication::desktop()->width() < 640 ) {
419 bl = new QVBoxLayout( topframe ); 418 bl = new QVBoxLayout( topframe );
420
421 } else { 419 } else {
422 bl = new QHBoxLayout( topframe ); 420 bl = new QHBoxLayout( topframe );
423
424 } 421 }
425 QVBox* subframe = new QVBox( topframe ); 422 QVBox* subframe = new QVBox( topframe );
426 bl->addWidget(subframe ); 423 bl->addWidget(subframe );
427 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); 424 QLabel* lab = new QLabel( i18n("Local Addressee"), subframe );
425 if ( takeloc )
426 lab->setBackgroundColor(Qt::green.light() );
428 AddresseeView * av = new AddresseeView( subframe ); 427 AddresseeView * av = new AddresseeView( subframe );
429 av->setAddressee( loc ); 428 av->setAddressee( loc );
430 subframe = new QVBox( topframe ); 429 subframe = new QVBox( topframe );
431 bl->addWidget(subframe ); 430 bl->addWidget(subframe );
432 lab = new QLabel( i18n("Remote Addressee"), subframe ); 431 lab = new QLabel( i18n("Remote Addressee"), subframe );
432 if ( !takeloc )
433 lab->setBackgroundColor(Qt::green.light() );
433 av = new AddresseeView( subframe ); 434 av = new AddresseeView( subframe );
434 av->setAddressee( rem ); 435 av->setAddressee( rem );
435 436 QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote()));
436 QObject::connect(findButton( Ok ),SIGNAL(clicked()), 437 QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local()));
437 SLOT(slot_remote()));
438 QObject::connect(this,SIGNAL(user1Clicked()),
439 SLOT(slot_local()));
440#ifndef DESKTOP_VERSION 438#ifndef DESKTOP_VERSION
441 showMaximized(); 439 showMaximized();
442#else 440#else
443 resize ( 640, 400 ); 441 resize ( 640, 400 );
444#endif 442#endif
445} 443}
446 444
447int AddresseeChooser::executeD( bool local ) 445int AddresseeChooser::executeD( bool local )
448{ 446{
449 mSyncResult = 3; 447 mSyncResult = 3;
450 if ( local ) 448 if ( local )
451 findButton( User1 )->setFocus(); 449 findButton( User1 )->setFocus();
452 else 450 else
453 findButton( Ok )->setFocus(); 451 findButton( Ok )->setFocus();
454 exec(); 452 exec();
455 qDebug("returning %d ",mSyncResult );
456 return mSyncResult; 453 return mSyncResult;
457} 454}
458void AddresseeChooser::slot_remote() 455void AddresseeChooser::slot_remote()
459{ 456{
460 mSyncResult = 2; 457 mSyncResult = 2;
461 accept(); 458 accept();
462} 459}
463void AddresseeChooser::slot_local() 460void AddresseeChooser::slot_local()
464{ 461{
465 mSyncResult = 1; 462 mSyncResult = 1;
466 accept(); 463 accept();
467} 464}
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp
index b1a951c..cc8eb52 100644
--- a/kaddressbook/kabcore.cpp
+++ b/kaddressbook/kabcore.cpp
@@ -2606,77 +2606,59 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i
2606 mode = SYNC_PREF_ASK; 2606 mode = SYNC_PREF_ASK;
2607 2607
2608 switch( mode ) { 2608 switch( mode ) {
2609 case SYNC_PREF_LOCAL: 2609 case SYNC_PREF_LOCAL:
2610 if ( lastSync > remote->revision() ) 2610 if ( lastSync > remote->revision() )
2611 return 1; 2611 return 1;
2612 if ( lastSync > local->revision() ) 2612 if ( lastSync > local->revision() )
2613 return 2; 2613 return 2;
2614 return 1; 2614 return 1;
2615 break; 2615 break;
2616 case SYNC_PREF_REMOTE: 2616 case SYNC_PREF_REMOTE:
2617 if ( lastSync > remote->revision() ) 2617 if ( lastSync > remote->revision() )
2618 return 1; 2618 return 1;
2619 if ( lastSync > local->revision() ) 2619 if ( lastSync > local->revision() )
2620 return 2; 2620 return 2;
2621 return 2; 2621 return 2;
2622 break; 2622 break;
2623 case SYNC_PREF_NEWEST: 2623 case SYNC_PREF_NEWEST:
2624 if ( local->revision() > remote->revision() ) 2624 if ( local->revision() > remote->revision() )
2625 return 1; 2625 return 1;
2626 else 2626 else
2627 return 2; 2627 return 2;
2628 break; 2628 break;
2629 case SYNC_PREF_ASK: 2629 case SYNC_PREF_ASK:
2630 qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->revision().toString().latin1(), remote->revision().toString().latin1() ); 2630 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->revision().toString().latin1(), remote->revision().toString().latin1() );
2631 if ( lastSync > remote->revision() ) 2631 if ( lastSync > remote->revision() )
2632 return 1; 2632 return 1;
2633 if ( lastSync > local->revision() ) 2633 if ( lastSync > local->revision() )
2634 return 2; 2634 return 2;
2635 //qDebug("lsy %s --- lo %s --- re %s ", lastSync.toString().latin1(), local->revision().toString().latin1(), remote->revision().toString().latin1() );
2636 localIsNew = local->revision() >= remote->revision(); 2635 localIsNew = local->revision() >= remote->revision();
2637#if 0 2636 //qDebug("conflict! ************************************** ");
2638 if ( localIsNew )
2639 getEventViewerDialog()->setColorMode( 1 );
2640 else
2641 getEventViewerDialog()->setColorMode( 2 );
2642 getEventViewerDialog()->setIncidence(local);
2643 if ( localIsNew )
2644 getEventViewerDialog()->setColorMode( 2 );
2645 else
2646 getEventViewerDialog()->setColorMode( 1 );
2647 getEventViewerDialog()->addIncidence(remote);
2648 getEventViewerDialog()->setColorMode( 0 );
2649 //qDebug("local %d remote %d ",local->relatedTo(),remote->relatedTo() );
2650 getEventViewerDialog()->setCaption( mCurrentSyncDevice +i18n(" : Conflict! Please choose entry!"));
2651 getEventViewerDialog()->showMe();
2652 result = getEventViewerDialog()->executeS( localIsNew );
2653#endif
2654 qDebug("conflict! ************************************** ");
2655 { 2637 {
2656 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); 2638 KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this );
2657 result = acd.executeD(localIsNew); 2639 result = acd.executeD(localIsNew);
2658 return result; 2640 return result;
2659 } 2641 }
2660 break; 2642 break;
2661 case SYNC_PREF_FORCE_LOCAL: 2643 case SYNC_PREF_FORCE_LOCAL:
2662 return 1; 2644 return 1;
2663 break; 2645 break;
2664 case SYNC_PREF_FORCE_REMOTE: 2646 case SYNC_PREF_FORCE_REMOTE:
2665 return 2; 2647 return 2;
2666 break; 2648 break;
2667 2649
2668 default: 2650 default:
2669 // SYNC_PREF_TAKE_BOTH not implemented 2651 // SYNC_PREF_TAKE_BOTH not implemented
2670 break; 2652 break;
2671 } 2653 }
2672 return 0; 2654 return 0;
2673} 2655}
2674bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode) 2656bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBook* remote,int mode)
2675{ 2657{
2676 bool syncOK = true; 2658 bool syncOK = true;
2677 int addedAddressee = 0; 2659 int addedAddressee = 0;
2678 int addedAddresseeR = 0; 2660 int addedAddresseeR = 0;
2679 int deletedAddresseeR = 0; 2661 int deletedAddresseeR = 0;
2680 int deletedAddresseeL = 0; 2662 int deletedAddresseeL = 0;
2681 int changedLocal = 0; 2663 int changedLocal = 0;
2682 int changedRemote = 0; 2664 int changedRemote = 0;
@@ -2953,49 +2935,48 @@ bool KABCore::syncAB(QString filename, int mode)
2953 2935
2954 } 2936 }
2955 if ( syncOK ) 2937 if ( syncOK )
2956 mViewManager->refreshView(); 2938 mViewManager->refreshView();
2957 return syncOK; 2939 return syncOK;
2958#if 0 2940#if 0
2959 2941
2960 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) { 2942 if ( storage->load(KOPrefs::instance()->mUseQuicksave) ) {
2961 getEventViewerDialog()->setSyncMode( true ); 2943 getEventViewerDialog()->setSyncMode( true );
2962 syncOK = synchronizeCalendar( mCalendar, calendar, mode ); 2944 syncOK = synchronizeCalendar( mCalendar, calendar, mode );
2963 getEventViewerDialog()->setSyncMode( false ); 2945 getEventViewerDialog()->setSyncMode( false );
2964 if ( syncOK ) { 2946 if ( syncOK ) {
2965 if ( KOPrefs::instance()->mWriteBackFile ) 2947 if ( KOPrefs::instance()->mWriteBackFile )
2966 { 2948 {
2967 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) ); 2949 storage->setSaveFormat( new ICalFormat( KOPrefs::instance()->mUseQuicksave) );
2968 storage->save(); 2950 storage->save();
2969 } 2951 }
2970 } 2952 }
2971 setModified(); 2953 setModified();
2972 } 2954 }
2973 2955
2974#endif 2956#endif
2975} 2957}
2976 2958
2977
2978void KABCore::confSync() 2959void KABCore::confSync()
2979{ 2960{
2980 static KSyncPrefsDialog* sp = 0; 2961 static KSyncPrefsDialog* sp = 0;
2981 if ( ! sp ) { 2962 if ( ! sp ) {
2982 sp = new KSyncPrefsDialog( this, "syncprefs", true ); 2963 sp = new KSyncPrefsDialog( this, "syncprefs", true );
2983 } 2964 }
2984 sp->usrReadConfig(); 2965 sp->usrReadConfig();
2985#ifndef DESKTOP_VERSION 2966#ifndef DESKTOP_VERSION
2986 sp->showMaximized(); 2967 sp->showMaximized();
2987#else 2968#else
2988 sp->show(); 2969 sp->show();
2989#endif 2970#endif
2990 sp->exec(); 2971 sp->exec();
2991 KABPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames(); 2972 KABPrefs::instance()->mSyncProfileNames = sp->getSyncProfileNames();
2992 KABPrefs::instance()->mLocalMachineName = sp->getLocalMachineName (); 2973 KABPrefs::instance()->mLocalMachineName = sp->getLocalMachineName ();
2993 fillSyncMenu(); 2974 fillSyncMenu();
2994} 2975}
2995void KABCore::syncSharp() 2976void KABCore::syncSharp()
2996{ 2977{
2997 if ( mModified ) 2978 if ( mModified )
2998 save(); 2979 save();
2999 qDebug("pending syncSharp() "); 2980 qDebug("pending syncSharp() ");
3000 //mView->syncSharp(); 2981 //mView->syncSharp();
3001 setModified(); 2982 setModified();