summaryrefslogtreecommitdiffabout
path: root/kabc/addressee.cpp
authorzautrix <zautrix>2004-09-19 09:00:55 (UTC)
committer zautrix <zautrix>2004-09-19 09:00:55 (UTC)
commit787181d34f0d195ad72c9cf6aedbc317b6dd713e (patch) (unidiff)
treeac49d2b1d7887f96f3834458071b89e77b59218b /kabc/addressee.cpp
parentf370d0f89bcaeeb68bd60152a9812a9cd55e5d8a (diff)
downloadkdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.zip
kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.tar.gz
kdepimpi-787181d34f0d195ad72c9cf6aedbc317b6dd713e.tar.bz2
more AB sync
Diffstat (limited to 'kabc/addressee.cpp') (more/less context) (show whitespace changes)
-rw-r--r--kabc/addressee.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp
index 0f5d605..d6b70c4 100644
--- a/kabc/addressee.cpp
+++ b/kabc/addressee.cpp
@@ -76,13 +76,13 @@ struct Addressee::AddresseeData : public KShared
76 PhoneNumber::List phoneNumbers; 76 PhoneNumber::List phoneNumbers;
77 Address::List addresses; 77 Address::List addresses;
78 Key::List keys; 78 Key::List keys;
79 QStringList emails; 79 QStringList emails;
80 QStringList categories; 80 QStringList categories;
81 QStringList custom; 81 QStringList custom;
82 82 int mTempSyncStat;
83 Resource *resource; 83 Resource *resource;
84 84
85 bool empty :1; 85 bool empty :1;
86 bool changed :1; 86 bool changed :1;
87}; 87};
88 88
@@ -91,23 +91,22 @@ Addressee::Addressee()
91 mData = new AddresseeData; 91 mData = new AddresseeData;
92 mData->empty = true; 92 mData->empty = true;
93 mData->changed = false; 93 mData->changed = false;
94 mData->resource = 0; 94 mData->resource = 0;
95 mData->mExternalId = ":"; 95 mData->mExternalId = ":";
96 mData->revision = QDateTime ( QDate( 2004,1,1)); 96 mData->revision = QDateTime ( QDate( 2004,1,1));
97 mTempSyncStat = SYNC_TEMPSTATE_INITIAL; 97 mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
98} 98}
99 99
100Addressee::~Addressee() 100Addressee::~Addressee()
101{ 101{
102} 102}
103 103
104Addressee::Addressee( const Addressee &a ) 104Addressee::Addressee( const Addressee &a )
105{ 105{
106 mData = a.mData; 106 mData = a.mData;
107 mTempSyncStat = SYNC_TEMPSTATE_INITIAL;
108} 107}
109 108
110Addressee &Addressee::operator=( const Addressee &a ) 109Addressee &Addressee::operator=( const Addressee &a )
111{ 110{
112 mData = a.mData; 111 mData = a.mData;
113 return (*this); 112 return (*this);
@@ -265,43 +264,51 @@ void Addressee::computeCsum(const QString &dev)
265 ++addressIter ) { 264 ++addressIter ) {
266 t = (*addressIter).asList(); 265 t = (*addressIter).asList();
267 t.sort(); 266 t.sort();
268 for ( iii = 0; iii < t.count(); ++iii) 267 for ( iii = 0; iii < t.count(); ++iii)
269 l.append( t[iii] ); 268 l.append( t[iii] );
270 } 269 }
271 setCsum( dev, QString::number (getCsum4List(l)) ); 270 uint cs = getCsum4List(l);
271 qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() );
272 setCsum( dev, QString::number (cs ));
272} 273}
273void Addressee::removeID(const QString &prof) 274void Addressee::removeID(const QString &prof)
274{ 275{
275 detach(); 276 detach();
276 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); 277 mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof);
277 278
278} 279}
279void Addressee::setID( const QString & prof , const QString & id ) 280void Addressee::setID( const QString & prof , const QString & id )
280{ 281{
281 detach(); 282 detach();
283 qDebug("setID1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
282 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); 284 mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id );
285 qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
283} 286}
284void Addressee::setTempSyncStat( int id ) 287void Addressee::setTempSyncStat( int id )
285{ 288{
286 mTempSyncStat = id; 289 if ( mData->mTempSyncStat == id ) return;
290 detach();
291 mData->mTempSyncStat = id;
287} 292}
288int Addressee::tempSyncStat() const 293int Addressee::tempSyncStat() const
289{ 294{
290 return mTempSyncStat; 295 return mData->mTempSyncStat;
291} 296}
292 297
293QString Addressee::getID( const QString & prof) 298QString Addressee::getID( const QString & prof)
294{ 299{
295 return KIdManager::getId ( mData->mExternalId, prof ); 300 return KIdManager::getId ( mData->mExternalId, prof );
296} 301}
297 302
298void Addressee::setCsum( const QString & prof , const QString & id ) 303void Addressee::setCsum( const QString & prof , const QString & id )
299{ 304{
300 detach(); 305 detach();
306 qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() );
301 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); 307 mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id );
308 qDebug("setcsum2 %s ",mData->mExternalId.latin1() );
302} 309}
303 310
304QString Addressee::getCsum( const QString & prof) 311QString Addressee::getCsum( const QString & prof)
305{ 312{
306 return KIdManager::getCsum ( mData->mExternalId, prof ); 313 return KIdManager::getCsum ( mData->mExternalId, prof );
307} 314}