author | zautrix <zautrix> | 2004-09-19 20:14:28 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-19 20:14:28 (UTC) |
commit | afa28a62314117555d6b32291188eedd1a576284 (patch) (side-by-side diff) | |
tree | ea97a247de30a7a34480bc395e1996ab99247361 /kabc/plugins | |
parent | e0d8e062c9d8092e47dcadd88b30614ebff43c0c (diff) | |
download | kdepimpi-afa28a62314117555d6b32291188eedd1a576284.zip kdepimpi-afa28a62314117555d6b32291188eedd1a576284.tar.gz kdepimpi-afa28a62314117555d6b32291188eedd1a576284.tar.bz2 |
more AB sync
-rw-r--r-- | kabc/plugins/qtopia/qtopiaE.pro | 2 | ||||
-rw-r--r-- | kabc/plugins/qtopia/qtopiaconverter.cpp | 7 | ||||
-rw-r--r-- | kabc/plugins/qtopia/qtopiaconverter.h | 1 | ||||
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 42 |
4 files changed, 42 insertions, 10 deletions
diff --git a/kabc/plugins/qtopia/qtopiaE.pro b/kabc/plugins/qtopia/qtopiaE.pro index 148da2a..c0aa960 100644 --- a/kabc/plugins/qtopia/qtopiaE.pro +++ b/kabc/plugins/qtopia/qtopiaE.pro @@ -5,3 +5,3 @@ TARGET = microkabc_qtopia -INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include +INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp index 7d00a3f..de45e63 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.cpp +++ b/kabc/plugins/qtopia/qtopiaconverter.cpp @@ -34,2 +34,3 @@ $Id$ #include <qpe/categories.h> +#include <libkdepim/ksyncprofile.h> //US #include <qpe/categoryselect.h> @@ -77,3 +78,6 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a addr.setSuffix( contact.suffix() ); + + addr.setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); QString exuid = contact.uid().toString(); + addr.setOriginalExternalUID( exuid ); int ente = exuid.find( "-0000"); @@ -253,2 +257,5 @@ bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &cont { + + + // name diff --git a/kabc/plugins/qtopia/qtopiaconverter.h b/kabc/plugins/qtopia/qtopiaconverter.h index 8f4c698..012a6e2 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.h +++ b/kabc/plugins/qtopia/qtopiaconverter.h @@ -33,2 +33,3 @@ $Id$ #include <qpe/pim/contact.h> +#include <qpe/quuid.h> diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 48a9f22..935a1cf 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp @@ -54,2 +54,4 @@ $Id$ #include "resourceqtopia.h" +#include <libkdepim/ksyncprofile.h> +#include <qpe/quuid.h> @@ -199,15 +201,37 @@ bool ResourceQtopia::save( Ticket *ticket ) for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { - PimContact c; - KABC::Addressee addressee = (*it); - + //KABC::Addressee addressee = (*it); + if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { + QUuid uid( (*it).originalExternalUID() ); + bool ok; + PimContact c = mAccess->contactForId( uid, &ok ); res = mConverter->addresseeToQtopia( *it, c ); - if (res == true) - { + if (res == true) { + if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL ) { mAccess->addContact(c); -// if (res == false) -// qDebug("Unable to append Contact %s", c.fullName().latin1()); + KABC::Addressee addressee; + mConverter->qtopiaToAddressee( c, addressee ); + addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); + addressBook()->insertAddressee( addressee ); + + } else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { + if ( ok ) + mAccess->removeContact(c); + else + qDebug("Error revoe contact from qtopia "); + } else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { + if ( ok ) { + mAccess->updateContact(c); + KABC::Addressee addressee; + mConverter->qtopiaToAddressee( c, addressee ); + addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); + addressBook()->insertAddressee( addressee ); } else - { - qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); + qDebug("Error update contact from qtopia "); + + } + + } else { + qDebug("Unable to convert Addressee %s", (*it).formattedName().latin1()); + } } |