summaryrefslogtreecommitdiffabout
authorzautrix <zautrix>2004-09-21 07:09:09 (UTC)
committer zautrix <zautrix>2004-09-21 07:09:09 (UTC)
commit1cf4cc6e7bf25ee309852c7c97155de86917289f (patch) (side-by-side diff)
tree721dd83559c3c7635d132b8a95cd6fdc4cdcc351
parent434ddaa08e0a650422ef271332a1d11879028095 (diff)
downloadkdepimpi-1cf4cc6e7bf25ee309852c7c97155de86917289f.zip
kdepimpi-1cf4cc6e7bf25ee309852c7c97155de86917289f.tar.gz
kdepimpi-1cf4cc6e7bf25ee309852c7c97155de86917289f.tar.bz2
qtopia format changes
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/plugins/qtopia/resourceqtopia.cpp135
1 files changed, 26 insertions, 109 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
@@ -49,14 +49,12 @@ $Id$
#include "stdaddressbook.h"
#include "qtopiaconverter.h"
#include "syncprefwidget.h"
#include "resourceqtopia.h"
-#include <libkdepim/ksyncprofile.h>
-#include <qpe/quuid.h>
using namespace KABC;
extern "C"
{
void *init_microkabc_qtopia()
{
@@ -188,125 +186,44 @@ bool ResourceQtopia::load()
return true;
}
bool ResourceQtopia::save( Ticket *ticket )
{
- qDebug("ResourceQtopia::save: %s", fileName().latin1());
-
- mDirWatch.stopScan();
-
- KABC::AddressBook::Iterator it;
- 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() );
- 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)
- {
- 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;
- }
- 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("ResourceQtopia::save: %s", fileName().latin1());
- KABC::Addressee::List::Iterator it2;
- for ( it2 = changedAddressees.begin(); it2 != changedAddressees.end(); ++it2 )
- addressBook()->insertAddressee((*it2));
+ mDirWatch.stopScan();
+ KABC::AddressBook::Iterator it;
+ bool res;
+ for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) {
+ PimContact c;
+ KABC::Addressee addressee = (*it);
- mDirWatch.startScan();
+ res = mConverter->addresseeToQtopia( *it, c );
+ if (res == true)
+ {
+ mAccess->addContact(c);
+// if (res == false)
+// qDebug("Unable to append Contact %s", c.fullName().latin1());
+ }
+ else
+ {
+ qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1());
+ }
+ }
- delete ticket;
- unlock( fileName() );
+// mAccess->addressBookUpdated();
- return true;
+ mDirWatch.startScan();
+
+ delete ticket;
+ unlock( fileName() );
+
+ return true;
}
bool ResourceQtopia::lock( const QString &lockfileName )
{
qDebug("ResourceQtopia::lock: %s", fileName().latin1());