-rw-r--r-- | kabc/addressee.cpp | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 4cdd5e5..fb32f6e 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp @@ -19,34 +19,36 @@ Boston, MA 02111-1307, USA. */ /* Enhanced Version of the file for platform independent KDE tools. Copyright (c) 2004 Ulf Schenk $Id$ */ #include <kconfig.h> #include <ksharedptr.h> #include <kdebug.h> #include <kapplication.h> #include <klocale.h> +#include <kidmanager.h> //US #include <kstandarddirs.h> +#include <libkcal/syncdefines.h> //US #include "resource.h" #include "addressee.h" using namespace KABC; static bool matchBinaryPattern( int value, int pattern ); struct Addressee::AddresseeData : public KShared { QString uid; QString name; QString formattedName; QString familyName; QString givenName; QString additionalName; @@ -57,61 +59,64 @@ struct Addressee::AddresseeData : public KShared QString mailer; TimeZone timeZone; Geo geo; QString title; QString role; QString organization; QString note; QString productId; QDateTime revision; QString sortString; KURL url; Secrecy secrecy; Picture logo; Picture photo; Sound sound; Agent agent; - + QString mExternalId; PhoneNumber::List phoneNumbers; Address::List addresses; Key::List keys; QStringList emails; QStringList categories; QStringList custom; Resource *resource; bool empty :1; bool changed :1; }; Addressee::Addressee() { mData = new AddresseeData; mData->empty = true; mData->changed = false; mData->resource = 0; + mData->mExternalId = ":"; + mTempSyncStat = SYNC_TEMPSTATE_INITIAL; } Addressee::~Addressee() { } Addressee::Addressee( const Addressee &a ) { mData = a.mData; + mTempSyncStat = SYNC_TEMPSTATE_INITIAL; } Addressee &Addressee::operator=( const Addressee &a ) { mData = a.mData; return (*this); } Addressee Addressee::copy() { Addressee a; *(a.mData) = *mData; return a; } void Addressee::detach() @@ -155,32 +160,79 @@ bool Addressee::operator==( const Addressee &a ) const if ( mData->emails != a.mData->emails ) return false; if ( mData->categories != a.mData->categories ) return false; if ( mData->custom != a.mData->custom ) return false; return true; } bool Addressee::operator!=( const Addressee &a ) const { return !( a == *this ); } bool Addressee::isEmpty() const { return mData->empty; } +void Addressee::removeID(const QString &prof) +{ + detach(); + mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); + +} +void Addressee::setID( const QString & prof , const QString & id ) +{ + detach(); + mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); +} +void Addressee::setTempSyncStat( int id ) +{ + mTempSyncStat = id; +} +int Addressee::tempSyncStat() const +{ + return mTempSyncStat; +} + +QString Addressee::getID( const QString & prof) +{ + return KIdManager::getId ( mData->mExternalId, prof ); +} + +void Addressee::setCsum( const QString & prof , const QString & id ) +{ + detach(); + mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); +} + +QString Addressee::getCsum( const QString & prof) +{ + return KIdManager::getCsum ( mData->mExternalId, prof ); +} + +void Addressee::setIDStr( const QString & s ) +{ + detach(); + mData->mExternalId = s; +} + +QString Addressee::IDStr() const +{ + return mData->mExternalId; +} + void Addressee::setUid( const QString &id ) { if ( id == mData->uid ) return; detach(); mData->empty = false; mData->uid = id; } QString Addressee::uid() const { if ( mData->uid.isEmpty() ) mData->uid = KApplication::randomString( 10 ); return mData->uid; } |