author | zautrix <zautrix> | 2004-09-18 18:46:29 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-18 18:46:29 (UTC) |
commit | ec8099bf369e5b8327ca6cfd78b34366353e3abf (patch) (unidiff) | |
tree | 551c515124f7b1c47b2860803efa3922f494f938 | |
parent | 3f16c7aa0ab6badf304c537a6981ece743138821 (diff) | |
download | kdepimpi-ec8099bf369e5b8327ca6cfd78b34366353e3abf.zip kdepimpi-ec8099bf369e5b8327ca6cfd78b34366353e3abf.tar.gz kdepimpi-ec8099bf369e5b8327ca6cfd78b34366353e3abf.tar.bz2 |
More AB sync
-rw-r--r-- | kabc/addresseeview.cpp | 66 | ||||
-rw-r--r-- | kabc/addresseeview.h | 18 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 7 |
3 files changed, 89 insertions, 2 deletions
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index b4717d7..487e8a5 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -30,7 +30,12 @@ | |||
30 | #include <qscrollview.h> | 30 | #include <qscrollview.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qvbox.h> | ||
34 | #include <qlabel.h> | ||
35 | #include <qwidget.h> | ||
36 | #include <qlayout.h> | ||
33 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <qpushbutton.h> | ||
34 | 39 | ||
35 | 40 | ||
36 | #include "externalapphandler.h" | 41 | #include "externalapphandler.h" |
@@ -399,3 +404,64 @@ void AddresseeView::addTag(const QString & tag,const QString & text) | |||
399 | mText.append(str); | 404 | mText.append(str); |
400 | } | 405 | } |
401 | } | 406 | } |
407 | |||
408 | AddresseeChooser::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) | ||
410 | { | ||
411 | findButton( Close )->setText( i18n("Cancel Sync")); | ||
412 | findButton( Ok )->setText( i18n("Remote")); | ||
413 | findButton( User1 )->setText( i18n("Local")); | ||
414 | QWidget* topframe = new QWidget( this ); | ||
415 | //QVBox* topframe = new QVBox( this ); | ||
416 | setMainWidget( topframe ); | ||
417 | QBoxLayout* bl; | ||
418 | if ( QApplication::desktop()->width() < 640 ) { | ||
419 | bl = new QVBoxLayout( topframe ); | ||
420 | |||
421 | } else { | ||
422 | bl = new QHBoxLayout( topframe ); | ||
423 | |||
424 | } | ||
425 | QVBox* subframe = new QVBox( topframe ); | ||
426 | bl->addWidget(subframe ); | ||
427 | QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); | ||
428 | AddresseeView * av = new AddresseeView( subframe ); | ||
429 | av->setAddressee( loc ); | ||
430 | subframe = new QVBox( topframe ); | ||
431 | bl->addWidget(subframe ); | ||
432 | lab = new QLabel( i18n("Remote Addressee"), subframe ); | ||
433 | av = new AddresseeView( subframe ); | ||
434 | av->setAddressee( rem ); | ||
435 | |||
436 | QObject::connect(findButton( Ok ),SIGNAL(clicked()), | ||
437 | SLOT(slot_remote())); | ||
438 | QObject::connect(this,SIGNAL(user1Clicked()), | ||
439 | SLOT(slot_local())); | ||
440 | #ifndef DESKTOP_VERSION | ||
441 | showMaximized(); | ||
442 | #else | ||
443 | resize ( 640, 400 ); | ||
444 | #endif | ||
445 | } | ||
446 | |||
447 | int AddresseeChooser::executeD( bool local ) | ||
448 | { | ||
449 | mSyncResult = 3; | ||
450 | if ( local ) | ||
451 | findButton( User1 )->setFocus(); | ||
452 | else | ||
453 | findButton( Ok )->setFocus(); | ||
454 | exec(); | ||
455 | qDebug("returning %d ",mSyncResult ); | ||
456 | return mSyncResult; | ||
457 | } | ||
458 | void AddresseeChooser::slot_remote() | ||
459 | { | ||
460 | mSyncResult = 2; | ||
461 | accept(); | ||
462 | } | ||
463 | void AddresseeChooser::slot_local() | ||
464 | { | ||
465 | mSyncResult = 1; | ||
466 | accept(); | ||
467 | } | ||
diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h index 1865fc4..689d997 100644 --- a/kabc/addresseeview.h +++ b/kabc/addresseeview.h | |||
@@ -23,6 +23,7 @@ | |||
23 | #define KPIM_ADDRESSEEVIEW_H | 23 | #define KPIM_ADDRESSEEVIEW_H |
24 | 24 | ||
25 | #include <kabc/addressee.h> | 25 | #include <kabc/addressee.h> |
26 | #include <kdialogbase.h> | ||
26 | 27 | ||
27 | //US #include <ktextbrowser.h> | 28 | //US #include <ktextbrowser.h> |
28 | #include <qtextbrowser.h> | 29 | #include <qtextbrowser.h> |
@@ -54,6 +55,23 @@ class AddresseeView : public QTextBrowser | |||
54 | class AddresseeViewPrivate; | 55 | class AddresseeViewPrivate; |
55 | AddresseeViewPrivate *d; | 56 | AddresseeViewPrivate *d; |
56 | }; | 57 | }; |
58 | class AddresseeChooser : public KDialogBase | ||
59 | { | ||
60 | Q_OBJECT | ||
61 | |||
62 | public: | ||
63 | AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent = 0, const char *name = 0 ); | ||
64 | |||
65 | int executeD( bool local ); | ||
66 | |||
67 | private: | ||
68 | int mSyncResult; | ||
69 | |||
70 | private slots: | ||
71 | void slot_remote(); | ||
72 | void slot_local(); | ||
73 | |||
74 | }; | ||
57 | 75 | ||
58 | } | 76 | } |
59 | 77 | ||
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index 74c10d2..b1a951c 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -2652,9 +2652,11 @@ int KABCore::takeAddressee( KABC::Addressee* local, KABC::Addressee* remote, i | |||
2652 | result = getEventViewerDialog()->executeS( localIsNew ); | 2652 | result = getEventViewerDialog()->executeS( localIsNew ); |
2653 | #endif | 2653 | #endif |
2654 | qDebug("conflict! ************************************** "); | 2654 | qDebug("conflict! ************************************** "); |
2655 | result = 1; | 2655 | { |
2656 | KPIM::AddresseeChooser acd ( *local,*remote, localIsNew , this ); | ||
2657 | result = acd.executeD(localIsNew); | ||
2656 | return result; | 2658 | return result; |
2657 | 2659 | } | |
2658 | break; | 2660 | break; |
2659 | case SYNC_PREF_FORCE_LOCAL: | 2661 | case SYNC_PREF_FORCE_LOCAL: |
2660 | return 1; | 2662 | return 1; |
@@ -2725,6 +2727,7 @@ bool KABCore::synchronizeAddressbooks( KABC::AddressBook* local, KABC::AddressBo | |||
2725 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); | 2727 | qDebug("FULLDATE 3 %s %s", addresseeLSync.revision().toString().latin1() , addresseeRSync.revision().toString().latin1() ); |
2726 | } | 2728 | } |
2727 | } | 2729 | } |
2730 | fullDateRange = true; // debug only! | ||
2728 | if ( fullDateRange ) | 2731 | if ( fullDateRange ) |
2729 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); | 2732 | mLastAddressbookSync = QDateTime::currentDateTime().addDays( -100*365); |
2730 | else | 2733 | else |