author | zautrix <zautrix> | 2004-09-18 13:13:58 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-18 13:13:58 (UTC) |
commit | bb16660f29fc709791aa0ee4cb63a40710a994a8 (patch) (side-by-side diff) | |
tree | 5d7387987848039bb3594a624b819d136a38b0cd /kabc/addressee.cpp | |
parent | 4ec7c78ebd2c5a79ff224e9b07d9a3164f7fe602 (diff) | |
download | kdepimpi-bb16660f29fc709791aa0ee4cb63a40710a994a8.zip kdepimpi-bb16660f29fc709791aa0ee4cb63a40710a994a8.tar.gz kdepimpi-bb16660f29fc709791aa0ee4cb63a40710a994a8.tar.bz2 |
more AB syncing
-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 @@ -11,115 +11,120 @@ This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License for more details. You should have received a copy of the GNU Library General Public License along with this library; see the file COPYING.LIB. If not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, 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; QString prefix; QString suffix; QString nickName; QDateTime birthday; 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() { if ( mData.count() == 1 ) return; *this = copy(); } bool Addressee::operator==( const Addressee &a ) const { if ( uid() != a.uid() ) return false; @@ -147,48 +152,95 @@ bool Addressee::operator==( const Addressee &a ) const if ( mData->photo != a.mData->photo ) return false; if ( mData->sound != a.mData->sound ) return false; if ( mData->agent != a.mData->agent ) return false; if ( ( mData->url.isValid() || a.mData->url.isValid() ) && ( mData->url != a.mData->url ) ) return false; if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; if ( mData->addresses != a.mData->addresses ) return false; if ( mData->keys != a.mData->keys ) return false; 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; } QString Addressee::uidLabel() { return i18n("Unique Identifier"); } void Addressee::setName( const QString &name ) { |