author | zautrix <zautrix> | 2004-09-19 09:11:04 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2004-09-19 09:11:04 (UTC) |
commit | 953277a85e6ec5630ab0d64b4d68815e4e4f9906 (patch) (unidiff) | |
tree | 0a6acbc3ecd65784c1e875159b720849bc27dc48 /kabc | |
parent | 787181d34f0d195ad72c9cf6aedbc317b6dd713e (diff) | |
download | kdepimpi-953277a85e6ec5630ab0d64b4d68815e4e4f9906.zip kdepimpi-953277a85e6ec5630ab0d64b4d68815e4e4f9906.tar.gz kdepimpi-953277a85e6ec5630ab0d64b4d68815e4e4f9906.tar.bz2 |
More AB sync
-rw-r--r-- | kabc/addressee.cpp | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index d6b70c4..c34f671 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -15,550 +15,549 @@ | |||
15 | 15 | ||
16 | You should have received a copy of the GNU Library General Public License | 16 | You should have received a copy of the GNU Library General Public License |
17 | along with this library; see the file COPYING.LIB. If not, write to | 17 | along with this library; see the file COPYING.LIB. If not, write to |
18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 18 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
19 | Boston, MA 02111-1307, USA. | 19 | Boston, MA 02111-1307, USA. |
20 | */ | 20 | */ |
21 | 21 | ||
22 | /* | 22 | /* |
23 | Enhanced Version of the file for platform independent KDE tools. | 23 | Enhanced Version of the file for platform independent KDE tools. |
24 | Copyright (c) 2004 Ulf Schenk | 24 | Copyright (c) 2004 Ulf Schenk |
25 | 25 | ||
26 | $Id$ | 26 | $Id$ |
27 | */ | 27 | */ |
28 | 28 | ||
29 | #include <kconfig.h> | 29 | #include <kconfig.h> |
30 | 30 | ||
31 | #include <ksharedptr.h> | 31 | #include <ksharedptr.h> |
32 | #include <kdebug.h> | 32 | #include <kdebug.h> |
33 | #include <kapplication.h> | 33 | #include <kapplication.h> |
34 | #include <klocale.h> | 34 | #include <klocale.h> |
35 | #include <kidmanager.h> | 35 | #include <kidmanager.h> |
36 | //US | 36 | //US |
37 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
38 | #include <libkcal/syncdefines.h> | 38 | #include <libkcal/syncdefines.h> |
39 | 39 | ||
40 | //US #include "resource.h" | 40 | //US #include "resource.h" |
41 | #include "addressee.h" | 41 | #include "addressee.h" |
42 | 42 | ||
43 | using namespace KABC; | 43 | using namespace KABC; |
44 | 44 | ||
45 | static bool matchBinaryPattern( int value, int pattern ); | 45 | static bool matchBinaryPattern( int value, int pattern ); |
46 | 46 | ||
47 | struct Addressee::AddresseeData : public KShared | 47 | struct Addressee::AddresseeData : public KShared |
48 | { | 48 | { |
49 | QString uid; | 49 | QString uid; |
50 | QString name; | 50 | QString name; |
51 | QString formattedName; | 51 | QString formattedName; |
52 | QString familyName; | 52 | QString familyName; |
53 | QString givenName; | 53 | QString givenName; |
54 | QString additionalName; | 54 | QString additionalName; |
55 | QString prefix; | 55 | QString prefix; |
56 | QString suffix; | 56 | QString suffix; |
57 | QString nickName; | 57 | QString nickName; |
58 | QDateTime birthday; | 58 | QDateTime birthday; |
59 | QString mailer; | 59 | QString mailer; |
60 | TimeZone timeZone; | 60 | TimeZone timeZone; |
61 | Geo geo; | 61 | Geo geo; |
62 | QString title; | 62 | QString title; |
63 | QString role; | 63 | QString role; |
64 | QString organization; | 64 | QString organization; |
65 | QString note; | 65 | QString note; |
66 | QString productId; | 66 | QString productId; |
67 | QDateTime revision; | 67 | QDateTime revision; |
68 | QString sortString; | 68 | QString sortString; |
69 | KURL url; | 69 | KURL url; |
70 | Secrecy secrecy; | 70 | Secrecy secrecy; |
71 | Picture logo; | 71 | Picture logo; |
72 | Picture photo; | 72 | Picture photo; |
73 | Sound sound; | 73 | Sound sound; |
74 | Agent agent; | 74 | Agent agent; |
75 | QString mExternalId; | 75 | QString mExternalId; |
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 | int mTempSyncStat; | 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 | ||
89 | Addressee::Addressee() | 89 | Addressee::Addressee() |
90 | { | 90 | { |
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 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 97 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
98 | } | 98 | } |
99 | 99 | ||
100 | Addressee::~Addressee() | 100 | Addressee::~Addressee() |
101 | { | 101 | { |
102 | } | 102 | } |
103 | 103 | ||
104 | Addressee::Addressee( const Addressee &a ) | 104 | Addressee::Addressee( const Addressee &a ) |
105 | { | 105 | { |
106 | mData = a.mData; | 106 | mData = a.mData; |
107 | } | 107 | } |
108 | 108 | ||
109 | Addressee &Addressee::operator=( const Addressee &a ) | 109 | Addressee &Addressee::operator=( const Addressee &a ) |
110 | { | 110 | { |
111 | mData = a.mData; | 111 | mData = a.mData; |
112 | return (*this); | 112 | return (*this); |
113 | } | 113 | } |
114 | 114 | ||
115 | Addressee Addressee::copy() | 115 | Addressee Addressee::copy() |
116 | { | 116 | { |
117 | Addressee a; | 117 | Addressee a; |
118 | *(a.mData) = *mData; | 118 | *(a.mData) = *mData; |
119 | return a; | 119 | return a; |
120 | } | 120 | } |
121 | 121 | ||
122 | void Addressee::detach() | 122 | void Addressee::detach() |
123 | { | 123 | { |
124 | if ( mData.count() == 1 ) return; | 124 | if ( mData.count() == 1 ) return; |
125 | *this = copy(); | 125 | *this = copy(); |
126 | } | 126 | } |
127 | 127 | ||
128 | bool Addressee::operator==( const Addressee &a ) const | 128 | bool Addressee::operator==( const Addressee &a ) const |
129 | { | 129 | { |
130 | if ( uid() != a.uid() ) return false; | 130 | if ( uid() != a.uid() ) return false; |
131 | if ( mData->name != a.mData->name ) return false; | 131 | if ( mData->name != a.mData->name ) return false; |
132 | if ( mData->formattedName != a.mData->formattedName ) return false; | 132 | if ( mData->formattedName != a.mData->formattedName ) return false; |
133 | if ( mData->familyName != a.mData->familyName ) return false; | 133 | if ( mData->familyName != a.mData->familyName ) return false; |
134 | if ( mData->givenName != a.mData->givenName ) return false; | 134 | if ( mData->givenName != a.mData->givenName ) return false; |
135 | if ( mData->additionalName != a.mData->additionalName ) return false; | 135 | if ( mData->additionalName != a.mData->additionalName ) return false; |
136 | if ( mData->prefix != a.mData->prefix ) return false; | 136 | if ( mData->prefix != a.mData->prefix ) return false; |
137 | if ( mData->suffix != a.mData->suffix ) return false; | 137 | if ( mData->suffix != a.mData->suffix ) return false; |
138 | if ( mData->nickName != a.mData->nickName ) return false; | 138 | if ( mData->nickName != a.mData->nickName ) return false; |
139 | if ( mData->birthday != a.mData->birthday ) return false; | 139 | if ( mData->birthday != a.mData->birthday ) return false; |
140 | if ( mData->mailer != a.mData->mailer ) return false; | 140 | if ( mData->mailer != a.mData->mailer ) return false; |
141 | if ( mData->timeZone != a.mData->timeZone ) return false; | 141 | if ( mData->timeZone != a.mData->timeZone ) return false; |
142 | if ( mData->geo != a.mData->geo ) return false; | 142 | if ( mData->geo != a.mData->geo ) return false; |
143 | if ( mData->title != a.mData->title ) return false; | 143 | if ( mData->title != a.mData->title ) return false; |
144 | if ( mData->role != a.mData->role ) return false; | 144 | if ( mData->role != a.mData->role ) return false; |
145 | if ( mData->organization != a.mData->organization ) return false; | 145 | if ( mData->organization != a.mData->organization ) return false; |
146 | if ( mData->note != a.mData->note ) return false; | 146 | if ( mData->note != a.mData->note ) return false; |
147 | if ( mData->productId != a.mData->productId ) return false; | 147 | if ( mData->productId != a.mData->productId ) return false; |
148 | if ( mData->revision != a.mData->revision ) return false; | 148 | if ( mData->revision != a.mData->revision ) return false; |
149 | if ( mData->sortString != a.mData->sortString ) return false; | 149 | if ( mData->sortString != a.mData->sortString ) return false; |
150 | if ( mData->secrecy != a.mData->secrecy ) return false; | 150 | if ( mData->secrecy != a.mData->secrecy ) return false; |
151 | if ( mData->logo != a.mData->logo ) return false; | 151 | if ( mData->logo != a.mData->logo ) return false; |
152 | if ( mData->photo != a.mData->photo ) return false; | 152 | if ( mData->photo != a.mData->photo ) return false; |
153 | if ( mData->sound != a.mData->sound ) return false; | 153 | if ( mData->sound != a.mData->sound ) return false; |
154 | if ( mData->agent != a.mData->agent ) return false; | 154 | if ( mData->agent != a.mData->agent ) return false; |
155 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 155 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
156 | ( mData->url != a.mData->url ) ) return false; | 156 | ( mData->url != a.mData->url ) ) return false; |
157 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 157 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
158 | if ( mData->addresses != a.mData->addresses ) return false; | 158 | if ( mData->addresses != a.mData->addresses ) return false; |
159 | if ( mData->keys != a.mData->keys ) return false; | 159 | if ( mData->keys != a.mData->keys ) return false; |
160 | if ( mData->emails != a.mData->emails ) return false; | 160 | if ( mData->emails != a.mData->emails ) return false; |
161 | if ( mData->categories != a.mData->categories ) return false; | 161 | if ( mData->categories != a.mData->categories ) return false; |
162 | if ( mData->custom != a.mData->custom ) return false; | 162 | if ( mData->custom != a.mData->custom ) return false; |
163 | 163 | ||
164 | return true; | 164 | return true; |
165 | } | 165 | } |
166 | 166 | ||
167 | bool Addressee::operator!=( const Addressee &a ) const | 167 | bool Addressee::operator!=( const Addressee &a ) const |
168 | { | 168 | { |
169 | return !( a == *this ); | 169 | return !( a == *this ); |
170 | } | 170 | } |
171 | 171 | ||
172 | bool Addressee::isEmpty() const | 172 | bool Addressee::isEmpty() const |
173 | { | 173 | { |
174 | return mData->empty; | 174 | return mData->empty; |
175 | } | 175 | } |
176 | ulong Addressee::getCsum4List( const QStringList & attList) | 176 | ulong Addressee::getCsum4List( const QStringList & attList) |
177 | { | 177 | { |
178 | int max = attList.count(); | 178 | int max = attList.count(); |
179 | ulong cSum = 0; | 179 | ulong cSum = 0; |
180 | int j,k,i; | 180 | int j,k,i; |
181 | int add; | 181 | int add; |
182 | for ( i = 0; i < max ; ++i ) { | 182 | for ( i = 0; i < max ; ++i ) { |
183 | QString s = attList[i]; | 183 | QString s = attList[i]; |
184 | if ( ! s.isEmpty() ){ | 184 | if ( ! s.isEmpty() ){ |
185 | j = s.length(); | 185 | j = s.length(); |
186 | for ( k = 0; k < j; ++k ) { | 186 | for ( k = 0; k < j; ++k ) { |
187 | int mul = k +1; | 187 | int mul = k +1; |
188 | add = s[k].unicode (); | 188 | add = s[k].unicode (); |
189 | if ( k < 16 ) | 189 | if ( k < 16 ) |
190 | mul = mul * mul; | 190 | mul = mul * mul; |
191 | int ii = i+1; | 191 | int ii = i+1; |
192 | add = add * mul *ii*ii*ii; | 192 | add = add * mul *ii*ii*ii; |
193 | cSum += add; | 193 | cSum += add; |
194 | } | 194 | } |
195 | } | 195 | } |
196 | 196 | ||
197 | } | 197 | } |
198 | //QString dump = attList.join(","); | 198 | //QString dump = attList.join(","); |
199 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 199 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
200 | 200 | ||
201 | return cSum; | 201 | return cSum; |
202 | 202 | ||
203 | } | 203 | } |
204 | void Addressee::computeCsum(const QString &dev) | 204 | void Addressee::computeCsum(const QString &dev) |
205 | { | 205 | { |
206 | QStringList l; | 206 | QStringList l; |
207 | if ( !mData->name.isEmpty() ) l.append(mData->name); | 207 | if ( !mData->name.isEmpty() ) l.append(mData->name); |
208 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 208 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
209 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 209 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
210 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 210 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
211 | if ( !mData->additionalName ) l.append( mData->additionalName ); | 211 | if ( !mData->additionalName ) l.append( mData->additionalName ); |
212 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 212 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
213 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 213 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
214 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 214 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
215 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 215 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
216 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 216 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
217 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 217 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
218 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 218 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
219 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 219 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
220 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 220 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
221 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 221 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
222 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 222 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
223 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 223 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
224 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 224 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
225 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 225 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
226 | // if ( !mData->logo.isEmpty() ) l.append( ); | 226 | // if ( !mData->logo.isEmpty() ) l.append( ); |
227 | //if ( !mData->photo.isEmpty() ) l.append( ); | 227 | //if ( !mData->photo.isEmpty() ) l.append( ); |
228 | //if ( !mData->sound.isEmpty() ) l.append( ); | 228 | //if ( !mData->sound.isEmpty() ) l.append( ); |
229 | //if ( !mData->agent.isEmpty() ) l.append( ); | 229 | //if ( !mData->agent.isEmpty() ) l.append( ); |
230 | //if ( mData->url.isValid() ) l.append( ); | 230 | //if ( mData->url.isValid() ) l.append( ); |
231 | #if 0 | 231 | #if 0 |
232 | if ( !mData->phoneNumbers.isEmpty() ) l.append( ); | 232 | if ( !mData->phoneNumbers.isEmpty() ) l.append( ); |
233 | if ( !mData->addresses.isEmpty() ) l.append( ); | 233 | if ( !mData->addresses.isEmpty() ) l.append( ); |
234 | //if ( !mData->keys.isEmpty() ) l.append( ); | 234 | //if ( !mData->keys.isEmpty() ) l.append( ); |
235 | if ( !mData->emails.isEmpty() ) l.append( ); | 235 | if ( !mData->emails.isEmpty() ) l.append( ); |
236 | if ( !mData->categories .isEmpty() ) l.append( ); | 236 | if ( !mData->categories .isEmpty() ) l.append( ); |
237 | if ( !mData->custom.isEmpty() ) l.append( ); | 237 | if ( !mData->custom.isEmpty() ) l.append( ); |
238 | #endif | 238 | #endif |
239 | KABC::PhoneNumber::List phoneNumbers; | 239 | KABC::PhoneNumber::List phoneNumbers; |
240 | KABC::PhoneNumber::List::Iterator phoneIter; | 240 | KABC::PhoneNumber::List::Iterator phoneIter; |
241 | 241 | ||
242 | QStringList t; | 242 | QStringList t; |
243 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 243 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
244 | ++phoneIter ) | 244 | ++phoneIter ) |
245 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 245 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
246 | t.sort(); | 246 | t.sort(); |
247 | uint iii; | 247 | uint iii; |
248 | for ( iii = 0; iii < t.count(); ++iii) | 248 | for ( iii = 0; iii < t.count(); ++iii) |
249 | l.append( t[iii] ); | 249 | l.append( t[iii] ); |
250 | t = mData->emails; | 250 | t = mData->emails; |
251 | t.sort(); | 251 | t.sort(); |
252 | for ( iii = 0; iii < t.count(); ++iii) | 252 | for ( iii = 0; iii < t.count(); ++iii) |
253 | l.append( t[iii] ); | 253 | l.append( t[iii] ); |
254 | t = mData->categories; | 254 | t = mData->categories; |
255 | t.sort(); | 255 | t.sort(); |
256 | for ( iii = 0; iii < t.count(); ++iii) | 256 | for ( iii = 0; iii < t.count(); ++iii) |
257 | l.append( t[iii] ); | 257 | l.append( t[iii] ); |
258 | t = mData->custom; | 258 | t = mData->custom; |
259 | t.sort(); | 259 | t.sort(); |
260 | for ( iii = 0; iii < t.count(); ++iii) | 260 | for ( iii = 0; iii < t.count(); ++iii) |
261 | l.append( t[iii] ); | 261 | l.append( t[iii] ); |
262 | KABC::Address::List::Iterator addressIter; | 262 | KABC::Address::List::Iterator addressIter; |
263 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 263 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
264 | ++addressIter ) { | 264 | ++addressIter ) { |
265 | t = (*addressIter).asList(); | 265 | t = (*addressIter).asList(); |
266 | t.sort(); | 266 | t.sort(); |
267 | for ( iii = 0; iii < t.count(); ++iii) | 267 | for ( iii = 0; iii < t.count(); ++iii) |
268 | l.append( t[iii] ); | 268 | l.append( t[iii] ); |
269 | } | 269 | } |
270 | uint cs = getCsum4List(l); | 270 | uint cs = getCsum4List(l); |
271 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 271 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
272 | setCsum( dev, QString::number (cs )); | 272 | setCsum( dev, QString::number (cs )); |
273 | } | 273 | } |
274 | void Addressee::removeID(const QString &prof) | 274 | void Addressee::removeID(const QString &prof) |
275 | { | 275 | { |
276 | detach(); | 276 | detach(); |
277 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 277 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
278 | 278 | ||
279 | } | 279 | } |
280 | void Addressee::setID( const QString & prof , const QString & id ) | 280 | void Addressee::setID( const QString & prof , const QString & id ) |
281 | { | 281 | { |
282 | detach(); | 282 | detach(); |
283 | qDebug("setID1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | ||
284 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 283 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
285 | qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 284 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
286 | } | 285 | } |
287 | void Addressee::setTempSyncStat( int id ) | 286 | void Addressee::setTempSyncStat( int id ) |
288 | { | 287 | { |
289 | if ( mData->mTempSyncStat == id ) return; | 288 | if ( mData->mTempSyncStat == id ) return; |
290 | detach(); | 289 | detach(); |
291 | mData->mTempSyncStat = id; | 290 | mData->mTempSyncStat = id; |
292 | } | 291 | } |
293 | int Addressee::tempSyncStat() const | 292 | int Addressee::tempSyncStat() const |
294 | { | 293 | { |
295 | return mData->mTempSyncStat; | 294 | return mData->mTempSyncStat; |
296 | } | 295 | } |
297 | 296 | ||
298 | QString Addressee::getID( const QString & prof) | 297 | QString Addressee::getID( const QString & prof) |
299 | { | 298 | { |
300 | return KIdManager::getId ( mData->mExternalId, prof ); | 299 | return KIdManager::getId ( mData->mExternalId, prof ); |
301 | } | 300 | } |
302 | 301 | ||
303 | void Addressee::setCsum( const QString & prof , const QString & id ) | 302 | void Addressee::setCsum( const QString & prof , const QString & id ) |
304 | { | 303 | { |
305 | detach(); | 304 | detach(); |
306 | qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 305 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
307 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 306 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
308 | qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 307 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
309 | } | 308 | } |
310 | 309 | ||
311 | QString Addressee::getCsum( const QString & prof) | 310 | QString Addressee::getCsum( const QString & prof) |
312 | { | 311 | { |
313 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 312 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
314 | } | 313 | } |
315 | 314 | ||
316 | void Addressee::setIDStr( const QString & s ) | 315 | void Addressee::setIDStr( const QString & s ) |
317 | { | 316 | { |
318 | detach(); | 317 | detach(); |
319 | mData->mExternalId = s; | 318 | mData->mExternalId = s; |
320 | } | 319 | } |
321 | 320 | ||
322 | QString Addressee::IDStr() const | 321 | QString Addressee::IDStr() const |
323 | { | 322 | { |
324 | return mData->mExternalId; | 323 | return mData->mExternalId; |
325 | } | 324 | } |
326 | 325 | ||
327 | 326 | ||
328 | void Addressee::setUid( const QString &id ) | 327 | void Addressee::setUid( const QString &id ) |
329 | { | 328 | { |
330 | if ( id == mData->uid ) return; | 329 | if ( id == mData->uid ) return; |
331 | detach(); | 330 | detach(); |
332 | mData->empty = false; | 331 | mData->empty = false; |
333 | mData->uid = id; | 332 | mData->uid = id; |
334 | } | 333 | } |
335 | 334 | ||
336 | QString Addressee::uid() const | 335 | QString Addressee::uid() const |
337 | { | 336 | { |
338 | if ( mData->uid.isEmpty() ) | 337 | if ( mData->uid.isEmpty() ) |
339 | mData->uid = KApplication::randomString( 10 ); | 338 | mData->uid = KApplication::randomString( 10 ); |
340 | 339 | ||
341 | return mData->uid; | 340 | return mData->uid; |
342 | } | 341 | } |
343 | 342 | ||
344 | QString Addressee::uidLabel() | 343 | QString Addressee::uidLabel() |
345 | { | 344 | { |
346 | return i18n("Unique Identifier"); | 345 | return i18n("Unique Identifier"); |
347 | } | 346 | } |
348 | 347 | ||
349 | void Addressee::setName( const QString &name ) | 348 | void Addressee::setName( const QString &name ) |
350 | { | 349 | { |
351 | if ( name == mData->name ) return; | 350 | if ( name == mData->name ) return; |
352 | detach(); | 351 | detach(); |
353 | mData->empty = false; | 352 | mData->empty = false; |
354 | mData->name = name; | 353 | mData->name = name; |
355 | } | 354 | } |
356 | 355 | ||
357 | QString Addressee::name() const | 356 | QString Addressee::name() const |
358 | { | 357 | { |
359 | return mData->name; | 358 | return mData->name; |
360 | } | 359 | } |
361 | 360 | ||
362 | QString Addressee::nameLabel() | 361 | QString Addressee::nameLabel() |
363 | { | 362 | { |
364 | return i18n("Name"); | 363 | return i18n("Name"); |
365 | } | 364 | } |
366 | 365 | ||
367 | 366 | ||
368 | void Addressee::setFormattedName( const QString &formattedName ) | 367 | void Addressee::setFormattedName( const QString &formattedName ) |
369 | { | 368 | { |
370 | if ( formattedName == mData->formattedName ) return; | 369 | if ( formattedName == mData->formattedName ) return; |
371 | detach(); | 370 | detach(); |
372 | mData->empty = false; | 371 | mData->empty = false; |
373 | mData->formattedName = formattedName; | 372 | mData->formattedName = formattedName; |
374 | } | 373 | } |
375 | 374 | ||
376 | QString Addressee::formattedName() const | 375 | QString Addressee::formattedName() const |
377 | { | 376 | { |
378 | return mData->formattedName; | 377 | return mData->formattedName; |
379 | } | 378 | } |
380 | 379 | ||
381 | QString Addressee::formattedNameLabel() | 380 | QString Addressee::formattedNameLabel() |
382 | { | 381 | { |
383 | return i18n("Formatted Name"); | 382 | return i18n("Formatted Name"); |
384 | } | 383 | } |
385 | 384 | ||
386 | 385 | ||
387 | void Addressee::setFamilyName( const QString &familyName ) | 386 | void Addressee::setFamilyName( const QString &familyName ) |
388 | { | 387 | { |
389 | if ( familyName == mData->familyName ) return; | 388 | if ( familyName == mData->familyName ) return; |
390 | detach(); | 389 | detach(); |
391 | mData->empty = false; | 390 | mData->empty = false; |
392 | mData->familyName = familyName; | 391 | mData->familyName = familyName; |
393 | } | 392 | } |
394 | 393 | ||
395 | QString Addressee::familyName() const | 394 | QString Addressee::familyName() const |
396 | { | 395 | { |
397 | return mData->familyName; | 396 | return mData->familyName; |
398 | } | 397 | } |
399 | 398 | ||
400 | QString Addressee::familyNameLabel() | 399 | QString Addressee::familyNameLabel() |
401 | { | 400 | { |
402 | return i18n("Family Name"); | 401 | return i18n("Family Name"); |
403 | } | 402 | } |
404 | 403 | ||
405 | 404 | ||
406 | void Addressee::setGivenName( const QString &givenName ) | 405 | void Addressee::setGivenName( const QString &givenName ) |
407 | { | 406 | { |
408 | if ( givenName == mData->givenName ) return; | 407 | if ( givenName == mData->givenName ) return; |
409 | detach(); | 408 | detach(); |
410 | mData->empty = false; | 409 | mData->empty = false; |
411 | mData->givenName = givenName; | 410 | mData->givenName = givenName; |
412 | } | 411 | } |
413 | 412 | ||
414 | QString Addressee::givenName() const | 413 | QString Addressee::givenName() const |
415 | { | 414 | { |
416 | return mData->givenName; | 415 | return mData->givenName; |
417 | } | 416 | } |
418 | 417 | ||
419 | QString Addressee::givenNameLabel() | 418 | QString Addressee::givenNameLabel() |
420 | { | 419 | { |
421 | return i18n("Given Name"); | 420 | return i18n("Given Name"); |
422 | } | 421 | } |
423 | 422 | ||
424 | 423 | ||
425 | void Addressee::setAdditionalName( const QString &additionalName ) | 424 | void Addressee::setAdditionalName( const QString &additionalName ) |
426 | { | 425 | { |
427 | if ( additionalName == mData->additionalName ) return; | 426 | if ( additionalName == mData->additionalName ) return; |
428 | detach(); | 427 | detach(); |
429 | mData->empty = false; | 428 | mData->empty = false; |
430 | mData->additionalName = additionalName; | 429 | mData->additionalName = additionalName; |
431 | } | 430 | } |
432 | 431 | ||
433 | QString Addressee::additionalName() const | 432 | QString Addressee::additionalName() const |
434 | { | 433 | { |
435 | return mData->additionalName; | 434 | return mData->additionalName; |
436 | } | 435 | } |
437 | 436 | ||
438 | QString Addressee::additionalNameLabel() | 437 | QString Addressee::additionalNameLabel() |
439 | { | 438 | { |
440 | return i18n("Additional Names"); | 439 | return i18n("Additional Names"); |
441 | } | 440 | } |
442 | 441 | ||
443 | 442 | ||
444 | void Addressee::setPrefix( const QString &prefix ) | 443 | void Addressee::setPrefix( const QString &prefix ) |
445 | { | 444 | { |
446 | if ( prefix == mData->prefix ) return; | 445 | if ( prefix == mData->prefix ) return; |
447 | detach(); | 446 | detach(); |
448 | mData->empty = false; | 447 | mData->empty = false; |
449 | mData->prefix = prefix; | 448 | mData->prefix = prefix; |
450 | } | 449 | } |
451 | 450 | ||
452 | QString Addressee::prefix() const | 451 | QString Addressee::prefix() const |
453 | { | 452 | { |
454 | return mData->prefix; | 453 | return mData->prefix; |
455 | } | 454 | } |
456 | 455 | ||
457 | QString Addressee::prefixLabel() | 456 | QString Addressee::prefixLabel() |
458 | { | 457 | { |
459 | return i18n("Honorific Prefixes"); | 458 | return i18n("Honorific Prefixes"); |
460 | } | 459 | } |
461 | 460 | ||
462 | 461 | ||
463 | void Addressee::setSuffix( const QString &suffix ) | 462 | void Addressee::setSuffix( const QString &suffix ) |
464 | { | 463 | { |
465 | if ( suffix == mData->suffix ) return; | 464 | if ( suffix == mData->suffix ) return; |
466 | detach(); | 465 | detach(); |
467 | mData->empty = false; | 466 | mData->empty = false; |
468 | mData->suffix = suffix; | 467 | mData->suffix = suffix; |
469 | } | 468 | } |
470 | 469 | ||
471 | QString Addressee::suffix() const | 470 | QString Addressee::suffix() const |
472 | { | 471 | { |
473 | return mData->suffix; | 472 | return mData->suffix; |
474 | } | 473 | } |
475 | 474 | ||
476 | QString Addressee::suffixLabel() | 475 | QString Addressee::suffixLabel() |
477 | { | 476 | { |
478 | return i18n("Honorific Suffixes"); | 477 | return i18n("Honorific Suffixes"); |
479 | } | 478 | } |
480 | 479 | ||
481 | 480 | ||
482 | void Addressee::setNickName( const QString &nickName ) | 481 | void Addressee::setNickName( const QString &nickName ) |
483 | { | 482 | { |
484 | if ( nickName == mData->nickName ) return; | 483 | if ( nickName == mData->nickName ) return; |
485 | detach(); | 484 | detach(); |
486 | mData->empty = false; | 485 | mData->empty = false; |
487 | mData->nickName = nickName; | 486 | mData->nickName = nickName; |
488 | } | 487 | } |
489 | 488 | ||
490 | QString Addressee::nickName() const | 489 | QString Addressee::nickName() const |
491 | { | 490 | { |
492 | return mData->nickName; | 491 | return mData->nickName; |
493 | } | 492 | } |
494 | 493 | ||
495 | QString Addressee::nickNameLabel() | 494 | QString Addressee::nickNameLabel() |
496 | { | 495 | { |
497 | return i18n("Nick Name"); | 496 | return i18n("Nick Name"); |
498 | } | 497 | } |
499 | 498 | ||
500 | 499 | ||
501 | void Addressee::setBirthday( const QDateTime &birthday ) | 500 | void Addressee::setBirthday( const QDateTime &birthday ) |
502 | { | 501 | { |
503 | if ( birthday == mData->birthday ) return; | 502 | if ( birthday == mData->birthday ) return; |
504 | detach(); | 503 | detach(); |
505 | mData->empty = false; | 504 | mData->empty = false; |
506 | mData->birthday = birthday; | 505 | mData->birthday = birthday; |
507 | } | 506 | } |
508 | 507 | ||
509 | QDateTime Addressee::birthday() const | 508 | QDateTime Addressee::birthday() const |
510 | { | 509 | { |
511 | return mData->birthday; | 510 | return mData->birthday; |
512 | } | 511 | } |
513 | 512 | ||
514 | QString Addressee::birthdayLabel() | 513 | QString Addressee::birthdayLabel() |
515 | { | 514 | { |
516 | return i18n("Birthday"); | 515 | return i18n("Birthday"); |
517 | } | 516 | } |
518 | 517 | ||
519 | 518 | ||
520 | QString Addressee::homeAddressStreetLabel() | 519 | QString Addressee::homeAddressStreetLabel() |
521 | { | 520 | { |
522 | return i18n("Home Address Street"); | 521 | return i18n("Home Address Street"); |
523 | } | 522 | } |
524 | 523 | ||
525 | 524 | ||
526 | QString Addressee::homeAddressLocalityLabel() | 525 | QString Addressee::homeAddressLocalityLabel() |
527 | { | 526 | { |
528 | return i18n("Home Address Locality"); | 527 | return i18n("Home Address Locality"); |
529 | } | 528 | } |
530 | 529 | ||
531 | 530 | ||
532 | QString Addressee::homeAddressRegionLabel() | 531 | QString Addressee::homeAddressRegionLabel() |
533 | { | 532 | { |
534 | return i18n("Home Address Region"); | 533 | return i18n("Home Address Region"); |
535 | } | 534 | } |
536 | 535 | ||
537 | 536 | ||
538 | QString Addressee::homeAddressPostalCodeLabel() | 537 | QString Addressee::homeAddressPostalCodeLabel() |
539 | { | 538 | { |
540 | return i18n("Home Address Postal Code"); | 539 | return i18n("Home Address Postal Code"); |
541 | } | 540 | } |
542 | 541 | ||
543 | 542 | ||
544 | QString Addressee::homeAddressCountryLabel() | 543 | QString Addressee::homeAddressCountryLabel() |
545 | { | 544 | { |
546 | return i18n("Home Address Country"); | 545 | return i18n("Home Address Country"); |
547 | } | 546 | } |
548 | 547 | ||
549 | 548 | ||
550 | QString Addressee::homeAddressLabelLabel() | 549 | QString Addressee::homeAddressLabelLabel() |
551 | { | 550 | { |
552 | return i18n("Home Address Label"); | 551 | return i18n("Home Address Label"); |
553 | } | 552 | } |
554 | 553 | ||
555 | 554 | ||
556 | QString Addressee::businessAddressStreetLabel() | 555 | QString Addressee::businessAddressStreetLabel() |
557 | { | 556 | { |
558 | return i18n("Business Address Street"); | 557 | return i18n("Business Address Street"); |
559 | } | 558 | } |
560 | 559 | ||
561 | 560 | ||
562 | QString Addressee::businessAddressLocalityLabel() | 561 | QString Addressee::businessAddressLocalityLabel() |
563 | { | 562 | { |
564 | return i18n("Business Address Locality"); | 563 | return i18n("Business Address Locality"); |