author | zautrix <zautrix> | 2004-09-21 07:09:09 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-21 07:09:09 (UTC) |
commit | 1cf4cc6e7bf25ee309852c7c97155de86917289f (patch) (side-by-side diff) | |
tree | 721dd83559c3c7635d132b8a95cd6fdc4cdcc351 | |
parent | 434ddaa08e0a650422ef271332a1d11879028095 (diff) | |
download | kdepimpi-1cf4cc6e7bf25ee309852c7c97155de86917289f.zip kdepimpi-1cf4cc6e7bf25ee309852c7c97155de86917289f.tar.gz kdepimpi-1cf4cc6e7bf25ee309852c7c97155de86917289f.tar.bz2 |
qtopia format changes
-rw-r--r-- | kabc/plugins/qtopia/resourceqtopia.cpp | 105 |
1 files changed, 11 insertions, 94 deletions
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 1f90fcb..f9cabcb 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp @@ -54,4 +54,2 @@ $Id$ #include "resourceqtopia.h" -#include <libkdepim/ksyncprofile.h> -#include <qpe/quuid.h> @@ -199,94 +197,17 @@ bool ResourceQtopia::save( Ticket *ticket ) bool res; - KABC::Addressee::List changedAddressees; - QStringList addedUID; + for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { - //KABC::Addressee addressee = (*it); - // qDebug("AAAfor uid %s ", (*it).originalExternalUID().latin1() ); - if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { - QUuid uid( (*it).originalExternalUID() ); - bool ok; - PimContact c = mAccess->contactForId( uid, &ok ); - qDebug("ResourceQtopia::save:Found %d for uid %s ", ok,(*it).originalExternalUID().latin1() ); + PimContact c; + KABC::Addressee addressee = (*it); + res = mConverter->addresseeToQtopia( *it, c ); - if (res == true) { - if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL ) { - qDebug("skipping adding of contact "); - continue; - PimContact e; - AddressBookAccess Access2; - Access2.addContact(e); - const PimContact* contact; - bool res; - QString uid2, Ouid; - AddressBookIterator itt(Access2); - for (contact=itt.toFirst(); itt.current(); ++itt) + if (res == true) { - contact = itt.current(); - QString exuid = contact->uid().toString(); - Ouid =exuid; - int ente = exuid.find( "-0000"); - if ( exuid.left(1) == "{" ) - exuid = exuid.mid(1); - if ( ente > -1 ) - exuid = exuid.left( ente-1 ); - uid2 = exuid; - qDebug("trying find uid "); - if ( !addressBook()->containsExternalUid( uid2 ) ) { - qDebug("ab not contains "); - if ( !addedUID.contains( uid2 )) { - qDebug("list not contains "); - break; - } - } - - } - if ( !itt.current()) { - qDebug("ERROR uid "); - continue; + mAccess->addContact(c); +// if (res == false) +// qDebug("Unable to append Contact %s", c.fullName().latin1()); } else - qDebug("ADD uid detected "); - - - QUuid uid3( Ouid); - PimContact d = Access2.contactForId( uid3, &ok ); - if ( ! ok ) { - qDebug("ADD: Error getting new uid "); - } else { - qDebug("NEW UID found "); - PimContact g = mAccess->contactForId( c.uid(), &ok ); - KABC::Addressee addressee; - mConverter->qtopiaToAddressee( g, addressee ); - addressee.setUid((*it).uid() ); - addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); - changedAddressees.append( addressee ); - addedUID.append( uid2 ); - } - - - } else if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE ) { - qDebug("Remove contact "); - if ( ok ) - mAccess->removeContact(c); - else - qDebug("Error remove contact from qtopia "); - } else if ( (*it).tempSyncStat() != SYNC_TEMPSTATE_NEW_EXTERNAL ) { - if ( ok ) { - qDebug("Update contact "); - mAccess->updateContact(c); - PimContact g = mAccess->contactForId( c.uid(), &ok ); - KABC::Addressee addressee; - mConverter->qtopiaToAddressee( g, addressee ); - addressee.setUid((*it).uid() ); - addressee.setTempSyncStat( SYNC_TEMPSTATE_NEW_CSUM ); - changedAddressees.append( addressee ); - } - else - qDebug("Error update contact from qtopia "); - - } - - } else { - qDebug("Unable to convert Addressee %s", (*it).formattedName().latin1()); - } + { + qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); } @@ -294,7 +215,3 @@ bool ResourceQtopia::save( Ticket *ticket ) - KABC::Addressee::List::Iterator it2; - for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 ) - addressBook()->insertAddressee((*it2)); - - +// mAccess->addressBookUpdated(); |