summaryrefslogtreecommitdiffabout
path: root/kabc/plugins
authorzautrix <zautrix>2004-09-19 20:14:28 (UTC)
committer zautrix <zautrix>2004-09-19 20:14:28 (UTC)
commitafa28a62314117555d6b32291188eedd1a576284 (patch) (side-by-side diff)
treeea97a247de30a7a34480bc395e1996ab99247361 /kabc/plugins
parente0d8e062c9d8092e47dcadd88b30614ebff43c0c (diff)
downloadkdepimpi-afa28a62314117555d6b32291188eedd1a576284.zip
kdepimpi-afa28a62314117555d6b32291188eedd1a576284.tar.gz
kdepimpi-afa28a62314117555d6b32291188eedd1a576284.tar.bz2
more AB sync
Diffstat (limited to 'kabc/plugins') (more/less context) (show whitespace changes)
-rw-r--r--kabc/plugins/qtopia/qtopiaE.pro2
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.cpp7
-rw-r--r--kabc/plugins/qtopia/qtopiaconverter.h1
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp42
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
@@ -3,7 +3,7 @@ CONFIG += qt warn_on
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
OBJECTS_DIR = obj/$(PLATFORM)
MOC_DIR = moc/$(PLATFORM)
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
@@ -32,6 +32,7 @@ $Id$
#include "qtopiaconverter.h"
#include <qpe/categories.h>
+#include <libkdepim/ksyncprofile.h>
//US #include <qpe/categoryselect.h>
@@ -75,7 +76,10 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
addr.setAdditionalName( contact.middleName() );
addr.setPrefix( contact.nameTitle() );
addr.setSuffix( contact.suffix() );
+
+ addr.setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL );
QString exuid = contact.uid().toString();
+ addr.setOriginalExternalUID( exuid );
int ente = exuid.find( "-0000");
if ( exuid.left(1) == "{" )
exuid = exuid.mid(1);
@@ -251,6 +255,9 @@ bool QtopiaConverter::qtopiaToAddressee( const PimContact &contact, Addressee &a
bool QtopiaConverter::addresseeToQtopia( const Addressee &addr, PimContact &contact )
{
+
+
+
// name
contact.setLastName(addr.familyName());
contact.setFirstName(addr.givenName());
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
@@ -31,6 +31,7 @@ $Id$
#include "addressee.h"
#include <qpe/pim/contact.h>
+#include <qpe/quuid.h>
class Categories;
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
@@ -52,6 +52,8 @@ $Id$
#include "syncprefwidget.h"
#include "resourceqtopia.h"
+#include <libkdepim/ksyncprofile.h>
+#include <qpe/quuid.h>
using namespace KABC;
extern "C"
@@ -197,19 +199,41 @@ bool ResourceQtopia::save( Ticket *ticket )
bool res;
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());
+ }
}
}