-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 | |||
@@ -1,938 +1,990 @@ | |||
1 | /*** Warning! This file has been generated by the script makeaddressee ***/ | 1 | /*** Warning! This file has been generated by the script makeaddressee ***/ |
2 | /* | 2 | /* |
3 | This file is part of libkabc. | 3 | This file is part of libkabc. |
4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
5 | 5 | ||
6 | This library is free software; you can redistribute it and/or | 6 | This library is free software; you can redistribute it and/or |
7 | modify it under the terms of the GNU Library General Public | 7 | modify it under the terms of the GNU Library General Public |
8 | License as published by the Free Software Foundation; either | 8 | License as published by the Free Software Foundation; either |
9 | version 2 of the License, or (at your option) any later version. | 9 | version 2 of the License, or (at your option) any later version. |
10 | 10 | ||
11 | This library is distributed in the hope that it will be useful, | 11 | This library is distributed in the hope that it will be useful, |
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
14 | Library General Public License for more details. | 14 | Library General Public License for more details. |
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 | //US | 36 | //US |
36 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
38 | #include <libkcal/syncdefines.h> | ||
37 | 39 | ||
38 | //US #include "resource.h" | 40 | //US #include "resource.h" |
39 | #include "addressee.h" | 41 | #include "addressee.h" |
40 | 42 | ||
41 | using namespace KABC; | 43 | using namespace KABC; |
42 | 44 | ||
43 | static bool matchBinaryPattern( int value, int pattern ); | 45 | static bool matchBinaryPattern( int value, int pattern ); |
44 | 46 | ||
45 | struct Addressee::AddresseeData : public KShared | 47 | struct Addressee::AddresseeData : public KShared |
46 | { | 48 | { |
47 | QString uid; | 49 | QString uid; |
48 | QString name; | 50 | QString name; |
49 | QString formattedName; | 51 | QString formattedName; |
50 | QString familyName; | 52 | QString familyName; |
51 | QString givenName; | 53 | QString givenName; |
52 | QString additionalName; | 54 | QString additionalName; |
53 | QString prefix; | 55 | QString prefix; |
54 | QString suffix; | 56 | QString suffix; |
55 | QString nickName; | 57 | QString nickName; |
56 | QDateTime birthday; | 58 | QDateTime birthday; |
57 | QString mailer; | 59 | QString mailer; |
58 | TimeZone timeZone; | 60 | TimeZone timeZone; |
59 | Geo geo; | 61 | Geo geo; |
60 | QString title; | 62 | QString title; |
61 | QString role; | 63 | QString role; |
62 | QString organization; | 64 | QString organization; |
63 | QString note; | 65 | QString note; |
64 | QString productId; | 66 | QString productId; |
65 | QDateTime revision; | 67 | QDateTime revision; |
66 | QString sortString; | 68 | QString sortString; |
67 | KURL url; | 69 | KURL url; |
68 | Secrecy secrecy; | 70 | Secrecy secrecy; |
69 | Picture logo; | 71 | Picture logo; |
70 | Picture photo; | 72 | Picture photo; |
71 | Sound sound; | 73 | Sound sound; |
72 | Agent agent; | 74 | Agent agent; |
73 | 75 | QString mExternalId; | |
74 | PhoneNumber::List phoneNumbers; | 76 | PhoneNumber::List phoneNumbers; |
75 | Address::List addresses; | 77 | Address::List addresses; |
76 | Key::List keys; | 78 | Key::List keys; |
77 | QStringList emails; | 79 | QStringList emails; |
78 | QStringList categories; | 80 | QStringList categories; |
79 | QStringList custom; | 81 | QStringList custom; |
80 | 82 | ||
81 | Resource *resource; | 83 | Resource *resource; |
82 | 84 | ||
83 | bool empty :1; | 85 | bool empty :1; |
84 | bool changed :1; | 86 | bool changed :1; |
85 | }; | 87 | }; |
86 | 88 | ||
87 | Addressee::Addressee() | 89 | Addressee::Addressee() |
88 | { | 90 | { |
89 | mData = new AddresseeData; | 91 | mData = new AddresseeData; |
90 | mData->empty = true; | 92 | mData->empty = true; |
91 | mData->changed = false; | 93 | mData->changed = false; |
92 | mData->resource = 0; | 94 | mData->resource = 0; |
95 | mData->mExternalId = ":"; | ||
96 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | ||
93 | } | 97 | } |
94 | 98 | ||
95 | Addressee::~Addressee() | 99 | Addressee::~Addressee() |
96 | { | 100 | { |
97 | } | 101 | } |
98 | 102 | ||
99 | Addressee::Addressee( const Addressee &a ) | 103 | Addressee::Addressee( const Addressee &a ) |
100 | { | 104 | { |
101 | mData = a.mData; | 105 | mData = a.mData; |
106 | mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | ||
102 | } | 107 | } |
103 | 108 | ||
104 | Addressee &Addressee::operator=( const Addressee &a ) | 109 | Addressee &Addressee::operator=( const Addressee &a ) |
105 | { | 110 | { |
106 | mData = a.mData; | 111 | mData = a.mData; |
107 | return (*this); | 112 | return (*this); |
108 | } | 113 | } |
109 | 114 | ||
110 | Addressee Addressee::copy() | 115 | Addressee Addressee::copy() |
111 | { | 116 | { |
112 | Addressee a; | 117 | Addressee a; |
113 | *(a.mData) = *mData; | 118 | *(a.mData) = *mData; |
114 | return a; | 119 | return a; |
115 | } | 120 | } |
116 | 121 | ||
117 | void Addressee::detach() | 122 | void Addressee::detach() |
118 | { | 123 | { |
119 | if ( mData.count() == 1 ) return; | 124 | if ( mData.count() == 1 ) return; |
120 | *this = copy(); | 125 | *this = copy(); |
121 | } | 126 | } |
122 | 127 | ||
123 | bool Addressee::operator==( const Addressee &a ) const | 128 | bool Addressee::operator==( const Addressee &a ) const |
124 | { | 129 | { |
125 | if ( uid() != a.uid() ) return false; | 130 | if ( uid() != a.uid() ) return false; |
126 | if ( mData->name != a.mData->name ) return false; | 131 | if ( mData->name != a.mData->name ) return false; |
127 | if ( mData->formattedName != a.mData->formattedName ) return false; | 132 | if ( mData->formattedName != a.mData->formattedName ) return false; |
128 | if ( mData->familyName != a.mData->familyName ) return false; | 133 | if ( mData->familyName != a.mData->familyName ) return false; |
129 | if ( mData->givenName != a.mData->givenName ) return false; | 134 | if ( mData->givenName != a.mData->givenName ) return false; |
130 | if ( mData->additionalName != a.mData->additionalName ) return false; | 135 | if ( mData->additionalName != a.mData->additionalName ) return false; |
131 | if ( mData->prefix != a.mData->prefix ) return false; | 136 | if ( mData->prefix != a.mData->prefix ) return false; |
132 | if ( mData->suffix != a.mData->suffix ) return false; | 137 | if ( mData->suffix != a.mData->suffix ) return false; |
133 | if ( mData->nickName != a.mData->nickName ) return false; | 138 | if ( mData->nickName != a.mData->nickName ) return false; |
134 | if ( mData->birthday != a.mData->birthday ) return false; | 139 | if ( mData->birthday != a.mData->birthday ) return false; |
135 | if ( mData->mailer != a.mData->mailer ) return false; | 140 | if ( mData->mailer != a.mData->mailer ) return false; |
136 | if ( mData->timeZone != a.mData->timeZone ) return false; | 141 | if ( mData->timeZone != a.mData->timeZone ) return false; |
137 | if ( mData->geo != a.mData->geo ) return false; | 142 | if ( mData->geo != a.mData->geo ) return false; |
138 | if ( mData->title != a.mData->title ) return false; | 143 | if ( mData->title != a.mData->title ) return false; |
139 | if ( mData->role != a.mData->role ) return false; | 144 | if ( mData->role != a.mData->role ) return false; |
140 | if ( mData->organization != a.mData->organization ) return false; | 145 | if ( mData->organization != a.mData->organization ) return false; |
141 | if ( mData->note != a.mData->note ) return false; | 146 | if ( mData->note != a.mData->note ) return false; |
142 | if ( mData->productId != a.mData->productId ) return false; | 147 | if ( mData->productId != a.mData->productId ) return false; |
143 | if ( mData->revision != a.mData->revision ) return false; | 148 | if ( mData->revision != a.mData->revision ) return false; |
144 | if ( mData->sortString != a.mData->sortString ) return false; | 149 | if ( mData->sortString != a.mData->sortString ) return false; |
145 | if ( mData->secrecy != a.mData->secrecy ) return false; | 150 | if ( mData->secrecy != a.mData->secrecy ) return false; |
146 | if ( mData->logo != a.mData->logo ) return false; | 151 | if ( mData->logo != a.mData->logo ) return false; |
147 | if ( mData->photo != a.mData->photo ) return false; | 152 | if ( mData->photo != a.mData->photo ) return false; |
148 | if ( mData->sound != a.mData->sound ) return false; | 153 | if ( mData->sound != a.mData->sound ) return false; |
149 | if ( mData->agent != a.mData->agent ) return false; | 154 | if ( mData->agent != a.mData->agent ) return false; |
150 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 155 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
151 | ( mData->url != a.mData->url ) ) return false; | 156 | ( mData->url != a.mData->url ) ) return false; |
152 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 157 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
153 | if ( mData->addresses != a.mData->addresses ) return false; | 158 | if ( mData->addresses != a.mData->addresses ) return false; |
154 | if ( mData->keys != a.mData->keys ) return false; | 159 | if ( mData->keys != a.mData->keys ) return false; |
155 | if ( mData->emails != a.mData->emails ) return false; | 160 | if ( mData->emails != a.mData->emails ) return false; |
156 | if ( mData->categories != a.mData->categories ) return false; | 161 | if ( mData->categories != a.mData->categories ) return false; |
157 | if ( mData->custom != a.mData->custom ) return false; | 162 | if ( mData->custom != a.mData->custom ) return false; |
158 | 163 | ||
159 | return true; | 164 | return true; |
160 | } | 165 | } |
161 | 166 | ||
162 | bool Addressee::operator!=( const Addressee &a ) const | 167 | bool Addressee::operator!=( const Addressee &a ) const |
163 | { | 168 | { |
164 | return !( a == *this ); | 169 | return !( a == *this ); |
165 | } | 170 | } |
166 | 171 | ||
167 | bool Addressee::isEmpty() const | 172 | bool Addressee::isEmpty() const |
168 | { | 173 | { |
169 | return mData->empty; | 174 | return mData->empty; |
170 | } | 175 | } |
176 | void Addressee::removeID(const QString &prof) | ||
177 | { | ||
178 | detach(); | ||
179 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | ||
180 | |||
181 | } | ||
182 | void Addressee::setID( const QString & prof , const QString & id ) | ||
183 | { | ||
184 | detach(); | ||
185 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | ||
186 | } | ||
187 | void Addressee::setTempSyncStat( int id ) | ||
188 | { | ||
189 | mTempSyncStat = id; | ||
190 | } | ||
191 | int Addressee::tempSyncStat() const | ||
192 | { | ||
193 | return mTempSyncStat; | ||
194 | } | ||
195 | |||
196 | QString Addressee::getID( const QString & prof) | ||
197 | { | ||
198 | return KIdManager::getId ( mData->mExternalId, prof ); | ||
199 | } | ||
200 | |||
201 | void Addressee::setCsum( const QString & prof , const QString & id ) | ||
202 | { | ||
203 | detach(); | ||
204 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | ||
205 | } | ||
206 | |||
207 | QString Addressee::getCsum( const QString & prof) | ||
208 | { | ||
209 | return KIdManager::getCsum ( mData->mExternalId, prof ); | ||
210 | } | ||
211 | |||
212 | void Addressee::setIDStr( const QString & s ) | ||
213 | { | ||
214 | detach(); | ||
215 | mData->mExternalId = s; | ||
216 | } | ||
217 | |||
218 | QString Addressee::IDStr() const | ||
219 | { | ||
220 | return mData->mExternalId; | ||
221 | } | ||
222 | |||
171 | 223 | ||
172 | void Addressee::setUid( const QString &id ) | 224 | void Addressee::setUid( const QString &id ) |
173 | { | 225 | { |
174 | if ( id == mData->uid ) return; | 226 | if ( id == mData->uid ) return; |
175 | detach(); | 227 | detach(); |
176 | mData->empty = false; | 228 | mData->empty = false; |
177 | mData->uid = id; | 229 | mData->uid = id; |
178 | } | 230 | } |
179 | 231 | ||
180 | QString Addressee::uid() const | 232 | QString Addressee::uid() const |
181 | { | 233 | { |
182 | if ( mData->uid.isEmpty() ) | 234 | if ( mData->uid.isEmpty() ) |
183 | mData->uid = KApplication::randomString( 10 ); | 235 | mData->uid = KApplication::randomString( 10 ); |
184 | 236 | ||
185 | return mData->uid; | 237 | return mData->uid; |
186 | } | 238 | } |
187 | 239 | ||
188 | QString Addressee::uidLabel() | 240 | QString Addressee::uidLabel() |
189 | { | 241 | { |
190 | return i18n("Unique Identifier"); | 242 | return i18n("Unique Identifier"); |
191 | } | 243 | } |
192 | 244 | ||
193 | void Addressee::setName( const QString &name ) | 245 | void Addressee::setName( const QString &name ) |
194 | { | 246 | { |
195 | if ( name == mData->name ) return; | 247 | if ( name == mData->name ) return; |
196 | detach(); | 248 | detach(); |
197 | mData->empty = false; | 249 | mData->empty = false; |
198 | mData->name = name; | 250 | mData->name = name; |
199 | } | 251 | } |
200 | 252 | ||
201 | QString Addressee::name() const | 253 | QString Addressee::name() const |
202 | { | 254 | { |
203 | return mData->name; | 255 | return mData->name; |
204 | } | 256 | } |
205 | 257 | ||
206 | QString Addressee::nameLabel() | 258 | QString Addressee::nameLabel() |
207 | { | 259 | { |
208 | return i18n("Name"); | 260 | return i18n("Name"); |
209 | } | 261 | } |
210 | 262 | ||
211 | 263 | ||
212 | void Addressee::setFormattedName( const QString &formattedName ) | 264 | void Addressee::setFormattedName( const QString &formattedName ) |
213 | { | 265 | { |
214 | if ( formattedName == mData->formattedName ) return; | 266 | if ( formattedName == mData->formattedName ) return; |
215 | detach(); | 267 | detach(); |
216 | mData->empty = false; | 268 | mData->empty = false; |
217 | mData->formattedName = formattedName; | 269 | mData->formattedName = formattedName; |
218 | } | 270 | } |
219 | 271 | ||
220 | QString Addressee::formattedName() const | 272 | QString Addressee::formattedName() const |
221 | { | 273 | { |
222 | return mData->formattedName; | 274 | return mData->formattedName; |
223 | } | 275 | } |
224 | 276 | ||
225 | QString Addressee::formattedNameLabel() | 277 | QString Addressee::formattedNameLabel() |
226 | { | 278 | { |
227 | return i18n("Formatted Name"); | 279 | return i18n("Formatted Name"); |
228 | } | 280 | } |
229 | 281 | ||
230 | 282 | ||
231 | void Addressee::setFamilyName( const QString &familyName ) | 283 | void Addressee::setFamilyName( const QString &familyName ) |
232 | { | 284 | { |
233 | if ( familyName == mData->familyName ) return; | 285 | if ( familyName == mData->familyName ) return; |
234 | detach(); | 286 | detach(); |
235 | mData->empty = false; | 287 | mData->empty = false; |
236 | mData->familyName = familyName; | 288 | mData->familyName = familyName; |
237 | } | 289 | } |
238 | 290 | ||
239 | QString Addressee::familyName() const | 291 | QString Addressee::familyName() const |
240 | { | 292 | { |
241 | return mData->familyName; | 293 | return mData->familyName; |
242 | } | 294 | } |
243 | 295 | ||
244 | QString Addressee::familyNameLabel() | 296 | QString Addressee::familyNameLabel() |
245 | { | 297 | { |
246 | return i18n("Family Name"); | 298 | return i18n("Family Name"); |
247 | } | 299 | } |
248 | 300 | ||
249 | 301 | ||
250 | void Addressee::setGivenName( const QString &givenName ) | 302 | void Addressee::setGivenName( const QString &givenName ) |
251 | { | 303 | { |
252 | if ( givenName == mData->givenName ) return; | 304 | if ( givenName == mData->givenName ) return; |
253 | detach(); | 305 | detach(); |
254 | mData->empty = false; | 306 | mData->empty = false; |
255 | mData->givenName = givenName; | 307 | mData->givenName = givenName; |
256 | } | 308 | } |
257 | 309 | ||
258 | QString Addressee::givenName() const | 310 | QString Addressee::givenName() const |
259 | { | 311 | { |
260 | return mData->givenName; | 312 | return mData->givenName; |
261 | } | 313 | } |
262 | 314 | ||
263 | QString Addressee::givenNameLabel() | 315 | QString Addressee::givenNameLabel() |
264 | { | 316 | { |
265 | return i18n("Given Name"); | 317 | return i18n("Given Name"); |
266 | } | 318 | } |
267 | 319 | ||
268 | 320 | ||
269 | void Addressee::setAdditionalName( const QString &additionalName ) | 321 | void Addressee::setAdditionalName( const QString &additionalName ) |
270 | { | 322 | { |
271 | if ( additionalName == mData->additionalName ) return; | 323 | if ( additionalName == mData->additionalName ) return; |
272 | detach(); | 324 | detach(); |
273 | mData->empty = false; | 325 | mData->empty = false; |
274 | mData->additionalName = additionalName; | 326 | mData->additionalName = additionalName; |
275 | } | 327 | } |
276 | 328 | ||
277 | QString Addressee::additionalName() const | 329 | QString Addressee::additionalName() const |
278 | { | 330 | { |
279 | return mData->additionalName; | 331 | return mData->additionalName; |
280 | } | 332 | } |
281 | 333 | ||
282 | QString Addressee::additionalNameLabel() | 334 | QString Addressee::additionalNameLabel() |
283 | { | 335 | { |
284 | return i18n("Additional Names"); | 336 | return i18n("Additional Names"); |
285 | } | 337 | } |
286 | 338 | ||
287 | 339 | ||
288 | void Addressee::setPrefix( const QString &prefix ) | 340 | void Addressee::setPrefix( const QString &prefix ) |
289 | { | 341 | { |
290 | if ( prefix == mData->prefix ) return; | 342 | if ( prefix == mData->prefix ) return; |
291 | detach(); | 343 | detach(); |
292 | mData->empty = false; | 344 | mData->empty = false; |
293 | mData->prefix = prefix; | 345 | mData->prefix = prefix; |
294 | } | 346 | } |
295 | 347 | ||
296 | QString Addressee::prefix() const | 348 | QString Addressee::prefix() const |
297 | { | 349 | { |
298 | return mData->prefix; | 350 | return mData->prefix; |
299 | } | 351 | } |
300 | 352 | ||
301 | QString Addressee::prefixLabel() | 353 | QString Addressee::prefixLabel() |
302 | { | 354 | { |
303 | return i18n("Honorific Prefixes"); | 355 | return i18n("Honorific Prefixes"); |
304 | } | 356 | } |
305 | 357 | ||
306 | 358 | ||
307 | void Addressee::setSuffix( const QString &suffix ) | 359 | void Addressee::setSuffix( const QString &suffix ) |
308 | { | 360 | { |
309 | if ( suffix == mData->suffix ) return; | 361 | if ( suffix == mData->suffix ) return; |
310 | detach(); | 362 | detach(); |
311 | mData->empty = false; | 363 | mData->empty = false; |
312 | mData->suffix = suffix; | 364 | mData->suffix = suffix; |
313 | } | 365 | } |
314 | 366 | ||
315 | QString Addressee::suffix() const | 367 | QString Addressee::suffix() const |
316 | { | 368 | { |
317 | return mData->suffix; | 369 | return mData->suffix; |
318 | } | 370 | } |
319 | 371 | ||
320 | QString Addressee::suffixLabel() | 372 | QString Addressee::suffixLabel() |
321 | { | 373 | { |
322 | return i18n("Honorific Suffixes"); | 374 | return i18n("Honorific Suffixes"); |
323 | } | 375 | } |
324 | 376 | ||
325 | 377 | ||
326 | void Addressee::setNickName( const QString &nickName ) | 378 | void Addressee::setNickName( const QString &nickName ) |
327 | { | 379 | { |
328 | if ( nickName == mData->nickName ) return; | 380 | if ( nickName == mData->nickName ) return; |
329 | detach(); | 381 | detach(); |
330 | mData->empty = false; | 382 | mData->empty = false; |
331 | mData->nickName = nickName; | 383 | mData->nickName = nickName; |
332 | } | 384 | } |
333 | 385 | ||
334 | QString Addressee::nickName() const | 386 | QString Addressee::nickName() const |
335 | { | 387 | { |
336 | return mData->nickName; | 388 | return mData->nickName; |
337 | } | 389 | } |
338 | 390 | ||
339 | QString Addressee::nickNameLabel() | 391 | QString Addressee::nickNameLabel() |
340 | { | 392 | { |
341 | return i18n("Nick Name"); | 393 | return i18n("Nick Name"); |
342 | } | 394 | } |
343 | 395 | ||
344 | 396 | ||
345 | void Addressee::setBirthday( const QDateTime &birthday ) | 397 | void Addressee::setBirthday( const QDateTime &birthday ) |
346 | { | 398 | { |
347 | if ( birthday == mData->birthday ) return; | 399 | if ( birthday == mData->birthday ) return; |
348 | detach(); | 400 | detach(); |
349 | mData->empty = false; | 401 | mData->empty = false; |
350 | mData->birthday = birthday; | 402 | mData->birthday = birthday; |
351 | } | 403 | } |
352 | 404 | ||
353 | QDateTime Addressee::birthday() const | 405 | QDateTime Addressee::birthday() const |
354 | { | 406 | { |
355 | return mData->birthday; | 407 | return mData->birthday; |
356 | } | 408 | } |
357 | 409 | ||
358 | QString Addressee::birthdayLabel() | 410 | QString Addressee::birthdayLabel() |
359 | { | 411 | { |
360 | return i18n("Birthday"); | 412 | return i18n("Birthday"); |
361 | } | 413 | } |
362 | 414 | ||
363 | 415 | ||
364 | QString Addressee::homeAddressStreetLabel() | 416 | QString Addressee::homeAddressStreetLabel() |
365 | { | 417 | { |
366 | return i18n("Home Address Street"); | 418 | return i18n("Home Address Street"); |
367 | } | 419 | } |
368 | 420 | ||
369 | 421 | ||
370 | QString Addressee::homeAddressLocalityLabel() | 422 | QString Addressee::homeAddressLocalityLabel() |
371 | { | 423 | { |
372 | return i18n("Home Address Locality"); | 424 | return i18n("Home Address Locality"); |
373 | } | 425 | } |
374 | 426 | ||
375 | 427 | ||
376 | QString Addressee::homeAddressRegionLabel() | 428 | QString Addressee::homeAddressRegionLabel() |
377 | { | 429 | { |
378 | return i18n("Home Address Region"); | 430 | return i18n("Home Address Region"); |
379 | } | 431 | } |
380 | 432 | ||
381 | 433 | ||
382 | QString Addressee::homeAddressPostalCodeLabel() | 434 | QString Addressee::homeAddressPostalCodeLabel() |
383 | { | 435 | { |
384 | return i18n("Home Address Postal Code"); | 436 | return i18n("Home Address Postal Code"); |
385 | } | 437 | } |
386 | 438 | ||
387 | 439 | ||
388 | QString Addressee::homeAddressCountryLabel() | 440 | QString Addressee::homeAddressCountryLabel() |
389 | { | 441 | { |
390 | return i18n("Home Address Country"); | 442 | return i18n("Home Address Country"); |
391 | } | 443 | } |
392 | 444 | ||
393 | 445 | ||
394 | QString Addressee::homeAddressLabelLabel() | 446 | QString Addressee::homeAddressLabelLabel() |
395 | { | 447 | { |
396 | return i18n("Home Address Label"); | 448 | return i18n("Home Address Label"); |
397 | } | 449 | } |
398 | 450 | ||
399 | 451 | ||
400 | QString Addressee::businessAddressStreetLabel() | 452 | QString Addressee::businessAddressStreetLabel() |
401 | { | 453 | { |
402 | return i18n("Business Address Street"); | 454 | return i18n("Business Address Street"); |
403 | } | 455 | } |
404 | 456 | ||
405 | 457 | ||
406 | QString Addressee::businessAddressLocalityLabel() | 458 | QString Addressee::businessAddressLocalityLabel() |
407 | { | 459 | { |
408 | return i18n("Business Address Locality"); | 460 | return i18n("Business Address Locality"); |
409 | } | 461 | } |
410 | 462 | ||
411 | 463 | ||
412 | QString Addressee::businessAddressRegionLabel() | 464 | QString Addressee::businessAddressRegionLabel() |
413 | { | 465 | { |
414 | return i18n("Business Address Region"); | 466 | return i18n("Business Address Region"); |
415 | } | 467 | } |
416 | 468 | ||
417 | 469 | ||
418 | QString Addressee::businessAddressPostalCodeLabel() | 470 | QString Addressee::businessAddressPostalCodeLabel() |
419 | { | 471 | { |
420 | return i18n("Business Address Postal Code"); | 472 | return i18n("Business Address Postal Code"); |
421 | } | 473 | } |
422 | 474 | ||
423 | 475 | ||
424 | QString Addressee::businessAddressCountryLabel() | 476 | QString Addressee::businessAddressCountryLabel() |
425 | { | 477 | { |
426 | return i18n("Business Address Country"); | 478 | return i18n("Business Address Country"); |
427 | } | 479 | } |
428 | 480 | ||
429 | 481 | ||
430 | QString Addressee::businessAddressLabelLabel() | 482 | QString Addressee::businessAddressLabelLabel() |
431 | { | 483 | { |
432 | return i18n("Business Address Label"); | 484 | return i18n("Business Address Label"); |
433 | } | 485 | } |
434 | 486 | ||
435 | 487 | ||
436 | QString Addressee::homePhoneLabel() | 488 | QString Addressee::homePhoneLabel() |
437 | { | 489 | { |
438 | return i18n("Home Phone"); | 490 | return i18n("Home Phone"); |
439 | } | 491 | } |
440 | 492 | ||
441 | 493 | ||
442 | QString Addressee::businessPhoneLabel() | 494 | QString Addressee::businessPhoneLabel() |
443 | { | 495 | { |
444 | return i18n("Business Phone"); | 496 | return i18n("Business Phone"); |
445 | } | 497 | } |
446 | 498 | ||
447 | 499 | ||
448 | QString Addressee::mobilePhoneLabel() | 500 | QString Addressee::mobilePhoneLabel() |
449 | { | 501 | { |
450 | return i18n("Mobile Phone"); | 502 | return i18n("Mobile Phone"); |
451 | } | 503 | } |
452 | 504 | ||
453 | 505 | ||
454 | QString Addressee::homeFaxLabel() | 506 | QString Addressee::homeFaxLabel() |
455 | { | 507 | { |
456 | return i18n("Home Fax"); | 508 | return i18n("Home Fax"); |
457 | } | 509 | } |
458 | 510 | ||
459 | 511 | ||
460 | QString Addressee::businessFaxLabel() | 512 | QString Addressee::businessFaxLabel() |
461 | { | 513 | { |
462 | return i18n("Business Fax"); | 514 | return i18n("Business Fax"); |
463 | } | 515 | } |
464 | 516 | ||
465 | 517 | ||
466 | QString Addressee::carPhoneLabel() | 518 | QString Addressee::carPhoneLabel() |
467 | { | 519 | { |
468 | return i18n("Car Phone"); | 520 | return i18n("Car Phone"); |
469 | } | 521 | } |
470 | 522 | ||
471 | 523 | ||
472 | QString Addressee::isdnLabel() | 524 | QString Addressee::isdnLabel() |
473 | { | 525 | { |
474 | return i18n("ISDN"); | 526 | return i18n("ISDN"); |
475 | } | 527 | } |
476 | 528 | ||
477 | 529 | ||
478 | QString Addressee::pagerLabel() | 530 | QString Addressee::pagerLabel() |
479 | { | 531 | { |
480 | return i18n("Pager"); | 532 | return i18n("Pager"); |
481 | } | 533 | } |
482 | 534 | ||
483 | QString Addressee::sipLabel() | 535 | QString Addressee::sipLabel() |
484 | { | 536 | { |
485 | return i18n("SIP"); | 537 | return i18n("SIP"); |
486 | } | 538 | } |
487 | 539 | ||
488 | QString Addressee::emailLabel() | 540 | QString Addressee::emailLabel() |
489 | { | 541 | { |
490 | return i18n("Email Address"); | 542 | return i18n("Email Address"); |
491 | } | 543 | } |
492 | 544 | ||
493 | 545 | ||
494 | void Addressee::setMailer( const QString &mailer ) | 546 | void Addressee::setMailer( const QString &mailer ) |
495 | { | 547 | { |
496 | if ( mailer == mData->mailer ) return; | 548 | if ( mailer == mData->mailer ) return; |
497 | detach(); | 549 | detach(); |
498 | mData->empty = false; | 550 | mData->empty = false; |
499 | mData->mailer = mailer; | 551 | mData->mailer = mailer; |
500 | } | 552 | } |
501 | 553 | ||
502 | QString Addressee::mailer() const | 554 | QString Addressee::mailer() const |
503 | { | 555 | { |
504 | return mData->mailer; | 556 | return mData->mailer; |
505 | } | 557 | } |
506 | 558 | ||
507 | QString Addressee::mailerLabel() | 559 | QString Addressee::mailerLabel() |
508 | { | 560 | { |
509 | return i18n("Mail Client"); | 561 | return i18n("Mail Client"); |
510 | } | 562 | } |
511 | 563 | ||
512 | 564 | ||
513 | void Addressee::setTimeZone( const TimeZone &timeZone ) | 565 | void Addressee::setTimeZone( const TimeZone &timeZone ) |
514 | { | 566 | { |
515 | if ( timeZone == mData->timeZone ) return; | 567 | if ( timeZone == mData->timeZone ) return; |
516 | detach(); | 568 | detach(); |
517 | mData->empty = false; | 569 | mData->empty = false; |
518 | mData->timeZone = timeZone; | 570 | mData->timeZone = timeZone; |
519 | } | 571 | } |
520 | 572 | ||
521 | TimeZone Addressee::timeZone() const | 573 | TimeZone Addressee::timeZone() const |
522 | { | 574 | { |
523 | return mData->timeZone; | 575 | return mData->timeZone; |
524 | } | 576 | } |
525 | 577 | ||
526 | QString Addressee::timeZoneLabel() | 578 | QString Addressee::timeZoneLabel() |
527 | { | 579 | { |
528 | return i18n("Time Zone"); | 580 | return i18n("Time Zone"); |
529 | } | 581 | } |
530 | 582 | ||
531 | 583 | ||
532 | void Addressee::setGeo( const Geo &geo ) | 584 | void Addressee::setGeo( const Geo &geo ) |
533 | { | 585 | { |
534 | if ( geo == mData->geo ) return; | 586 | if ( geo == mData->geo ) return; |
535 | detach(); | 587 | detach(); |
536 | mData->empty = false; | 588 | mData->empty = false; |
537 | mData->geo = geo; | 589 | mData->geo = geo; |
538 | } | 590 | } |
539 | 591 | ||
540 | Geo Addressee::geo() const | 592 | Geo Addressee::geo() const |
541 | { | 593 | { |
542 | return mData->geo; | 594 | return mData->geo; |
543 | } | 595 | } |
544 | 596 | ||
545 | QString Addressee::geoLabel() | 597 | QString Addressee::geoLabel() |
546 | { | 598 | { |
547 | return i18n("Geographic Position"); | 599 | return i18n("Geographic Position"); |
548 | } | 600 | } |
549 | 601 | ||
550 | 602 | ||
551 | void Addressee::setTitle( const QString &title ) | 603 | void Addressee::setTitle( const QString &title ) |
552 | { | 604 | { |
553 | if ( title == mData->title ) return; | 605 | if ( title == mData->title ) return; |
554 | detach(); | 606 | detach(); |
555 | mData->empty = false; | 607 | mData->empty = false; |
556 | mData->title = title; | 608 | mData->title = title; |
557 | } | 609 | } |
558 | 610 | ||
559 | QString Addressee::title() const | 611 | QString Addressee::title() const |
560 | { | 612 | { |
561 | return mData->title; | 613 | return mData->title; |
562 | } | 614 | } |
563 | 615 | ||
564 | QString Addressee::titleLabel() | 616 | QString Addressee::titleLabel() |
565 | { | 617 | { |
566 | return i18n("Title"); | 618 | return i18n("Title"); |
567 | } | 619 | } |
568 | 620 | ||
569 | 621 | ||
570 | void Addressee::setRole( const QString &role ) | 622 | void Addressee::setRole( const QString &role ) |
571 | { | 623 | { |
572 | if ( role == mData->role ) return; | 624 | if ( role == mData->role ) return; |
573 | detach(); | 625 | detach(); |
574 | mData->empty = false; | 626 | mData->empty = false; |
575 | mData->role = role; | 627 | mData->role = role; |
576 | } | 628 | } |
577 | 629 | ||
578 | QString Addressee::role() const | 630 | QString Addressee::role() const |
579 | { | 631 | { |
580 | return mData->role; | 632 | return mData->role; |
581 | } | 633 | } |
582 | 634 | ||
583 | QString Addressee::roleLabel() | 635 | QString Addressee::roleLabel() |
584 | { | 636 | { |
585 | return i18n("Role"); | 637 | return i18n("Role"); |
586 | } | 638 | } |
587 | 639 | ||
588 | 640 | ||
589 | void Addressee::setOrganization( const QString &organization ) | 641 | void Addressee::setOrganization( const QString &organization ) |
590 | { | 642 | { |
591 | if ( organization == mData->organization ) return; | 643 | if ( organization == mData->organization ) return; |
592 | detach(); | 644 | detach(); |
593 | mData->empty = false; | 645 | mData->empty = false; |
594 | mData->organization = organization; | 646 | mData->organization = organization; |
595 | } | 647 | } |
596 | 648 | ||
597 | QString Addressee::organization() const | 649 | QString Addressee::organization() const |
598 | { | 650 | { |
599 | return mData->organization; | 651 | return mData->organization; |
600 | } | 652 | } |
601 | 653 | ||
602 | QString Addressee::organizationLabel() | 654 | QString Addressee::organizationLabel() |
603 | { | 655 | { |
604 | return i18n("Organization"); | 656 | return i18n("Organization"); |
605 | } | 657 | } |
606 | 658 | ||
607 | 659 | ||
608 | void Addressee::setNote( const QString ¬e ) | 660 | void Addressee::setNote( const QString ¬e ) |
609 | { | 661 | { |
610 | if ( note == mData->note ) return; | 662 | if ( note == mData->note ) return; |
611 | detach(); | 663 | detach(); |
612 | mData->empty = false; | 664 | mData->empty = false; |
613 | mData->note = note; | 665 | mData->note = note; |
614 | } | 666 | } |
615 | 667 | ||
616 | QString Addressee::note() const | 668 | QString Addressee::note() const |
617 | { | 669 | { |
618 | return mData->note; | 670 | return mData->note; |
619 | } | 671 | } |
620 | 672 | ||
621 | QString Addressee::noteLabel() | 673 | QString Addressee::noteLabel() |
622 | { | 674 | { |
623 | return i18n("Note"); | 675 | return i18n("Note"); |
624 | } | 676 | } |
625 | 677 | ||
626 | 678 | ||
627 | void Addressee::setProductId( const QString &productId ) | 679 | void Addressee::setProductId( const QString &productId ) |
628 | { | 680 | { |
629 | if ( productId == mData->productId ) return; | 681 | if ( productId == mData->productId ) return; |
630 | detach(); | 682 | detach(); |
631 | mData->empty = false; | 683 | mData->empty = false; |
632 | mData->productId = productId; | 684 | mData->productId = productId; |
633 | } | 685 | } |
634 | 686 | ||
635 | QString Addressee::productId() const | 687 | QString Addressee::productId() const |
636 | { | 688 | { |
637 | return mData->productId; | 689 | return mData->productId; |
638 | } | 690 | } |
639 | 691 | ||
640 | QString Addressee::productIdLabel() | 692 | QString Addressee::productIdLabel() |
641 | { | 693 | { |
642 | return i18n("Product Identifier"); | 694 | return i18n("Product Identifier"); |
643 | } | 695 | } |
644 | 696 | ||
645 | 697 | ||
646 | void Addressee::setRevision( const QDateTime &revision ) | 698 | void Addressee::setRevision( const QDateTime &revision ) |
647 | { | 699 | { |
648 | if ( revision == mData->revision ) return; | 700 | if ( revision == mData->revision ) return; |
649 | detach(); | 701 | detach(); |
650 | mData->empty = false; | 702 | mData->empty = false; |
651 | mData->revision = revision; | 703 | mData->revision = revision; |
652 | } | 704 | } |
653 | 705 | ||
654 | QDateTime Addressee::revision() const | 706 | QDateTime Addressee::revision() const |
655 | { | 707 | { |
656 | return mData->revision; | 708 | return mData->revision; |
657 | } | 709 | } |
658 | 710 | ||
659 | QString Addressee::revisionLabel() | 711 | QString Addressee::revisionLabel() |
660 | { | 712 | { |
661 | return i18n("Revision Date"); | 713 | return i18n("Revision Date"); |
662 | } | 714 | } |
663 | 715 | ||
664 | 716 | ||
665 | void Addressee::setSortString( const QString &sortString ) | 717 | void Addressee::setSortString( const QString &sortString ) |
666 | { | 718 | { |
667 | if ( sortString == mData->sortString ) return; | 719 | if ( sortString == mData->sortString ) return; |
668 | detach(); | 720 | detach(); |
669 | mData->empty = false; | 721 | mData->empty = false; |
670 | mData->sortString = sortString; | 722 | mData->sortString = sortString; |
671 | } | 723 | } |
672 | 724 | ||
673 | QString Addressee::sortString() const | 725 | QString Addressee::sortString() const |
674 | { | 726 | { |
675 | return mData->sortString; | 727 | return mData->sortString; |
676 | } | 728 | } |
677 | 729 | ||
678 | QString Addressee::sortStringLabel() | 730 | QString Addressee::sortStringLabel() |
679 | { | 731 | { |
680 | return i18n("Sort String"); | 732 | return i18n("Sort String"); |
681 | } | 733 | } |
682 | 734 | ||
683 | 735 | ||
684 | void Addressee::setUrl( const KURL &url ) | 736 | void Addressee::setUrl( const KURL &url ) |
685 | { | 737 | { |
686 | if ( url == mData->url ) return; | 738 | if ( url == mData->url ) return; |
687 | detach(); | 739 | detach(); |
688 | mData->empty = false; | 740 | mData->empty = false; |
689 | mData->url = url; | 741 | mData->url = url; |
690 | } | 742 | } |
691 | 743 | ||
692 | KURL Addressee::url() const | 744 | KURL Addressee::url() const |
693 | { | 745 | { |
694 | return mData->url; | 746 | return mData->url; |
695 | } | 747 | } |
696 | 748 | ||
697 | QString Addressee::urlLabel() | 749 | QString Addressee::urlLabel() |
698 | { | 750 | { |
699 | return i18n("URL"); | 751 | return i18n("URL"); |
700 | } | 752 | } |
701 | 753 | ||
702 | 754 | ||
703 | void Addressee::setSecrecy( const Secrecy &secrecy ) | 755 | void Addressee::setSecrecy( const Secrecy &secrecy ) |
704 | { | 756 | { |
705 | if ( secrecy == mData->secrecy ) return; | 757 | if ( secrecy == mData->secrecy ) return; |
706 | detach(); | 758 | detach(); |
707 | mData->empty = false; | 759 | mData->empty = false; |
708 | mData->secrecy = secrecy; | 760 | mData->secrecy = secrecy; |
709 | } | 761 | } |
710 | 762 | ||
711 | Secrecy Addressee::secrecy() const | 763 | Secrecy Addressee::secrecy() const |
712 | { | 764 | { |
713 | return mData->secrecy; | 765 | return mData->secrecy; |
714 | } | 766 | } |
715 | 767 | ||
716 | QString Addressee::secrecyLabel() | 768 | QString Addressee::secrecyLabel() |
717 | { | 769 | { |
718 | return i18n("Security Class"); | 770 | return i18n("Security Class"); |
719 | } | 771 | } |
720 | 772 | ||
721 | 773 | ||
722 | void Addressee::setLogo( const Picture &logo ) | 774 | void Addressee::setLogo( const Picture &logo ) |
723 | { | 775 | { |
724 | if ( logo == mData->logo ) return; | 776 | if ( logo == mData->logo ) return; |
725 | detach(); | 777 | detach(); |
726 | mData->empty = false; | 778 | mData->empty = false; |
727 | mData->logo = logo; | 779 | mData->logo = logo; |
728 | } | 780 | } |
729 | 781 | ||
730 | Picture Addressee::logo() const | 782 | Picture Addressee::logo() const |
731 | { | 783 | { |
732 | return mData->logo; | 784 | return mData->logo; |
733 | } | 785 | } |
734 | 786 | ||
735 | QString Addressee::logoLabel() | 787 | QString Addressee::logoLabel() |
736 | { | 788 | { |
737 | return i18n("Logo"); | 789 | return i18n("Logo"); |
738 | } | 790 | } |
739 | 791 | ||
740 | 792 | ||
741 | void Addressee::setPhoto( const Picture &photo ) | 793 | void Addressee::setPhoto( const Picture &photo ) |
742 | { | 794 | { |
743 | if ( photo == mData->photo ) return; | 795 | if ( photo == mData->photo ) return; |
744 | detach(); | 796 | detach(); |
745 | mData->empty = false; | 797 | mData->empty = false; |
746 | mData->photo = photo; | 798 | mData->photo = photo; |
747 | } | 799 | } |
748 | 800 | ||
749 | Picture Addressee::photo() const | 801 | Picture Addressee::photo() const |
750 | { | 802 | { |
751 | return mData->photo; | 803 | return mData->photo; |
752 | } | 804 | } |
753 | 805 | ||
754 | QString Addressee::photoLabel() | 806 | QString Addressee::photoLabel() |
755 | { | 807 | { |
756 | return i18n("Photo"); | 808 | return i18n("Photo"); |
757 | } | 809 | } |
758 | 810 | ||
759 | 811 | ||
760 | void Addressee::setSound( const Sound &sound ) | 812 | void Addressee::setSound( const Sound &sound ) |
761 | { | 813 | { |
762 | if ( sound == mData->sound ) return; | 814 | if ( sound == mData->sound ) return; |
763 | detach(); | 815 | detach(); |
764 | mData->empty = false; | 816 | mData->empty = false; |
765 | mData->sound = sound; | 817 | mData->sound = sound; |
766 | } | 818 | } |
767 | 819 | ||
768 | Sound Addressee::sound() const | 820 | Sound Addressee::sound() const |
769 | { | 821 | { |
770 | return mData->sound; | 822 | return mData->sound; |
771 | } | 823 | } |
772 | 824 | ||
773 | QString Addressee::soundLabel() | 825 | QString Addressee::soundLabel() |
774 | { | 826 | { |
775 | return i18n("Sound"); | 827 | return i18n("Sound"); |
776 | } | 828 | } |
777 | 829 | ||
778 | 830 | ||
779 | void Addressee::setAgent( const Agent &agent ) | 831 | void Addressee::setAgent( const Agent &agent ) |
780 | { | 832 | { |
781 | if ( agent == mData->agent ) return; | 833 | if ( agent == mData->agent ) return; |
782 | detach(); | 834 | detach(); |
783 | mData->empty = false; | 835 | mData->empty = false; |
784 | mData->agent = agent; | 836 | mData->agent = agent; |
785 | } | 837 | } |
786 | 838 | ||
787 | Agent Addressee::agent() const | 839 | Agent Addressee::agent() const |
788 | { | 840 | { |
789 | return mData->agent; | 841 | return mData->agent; |
790 | } | 842 | } |
791 | 843 | ||
792 | QString Addressee::agentLabel() | 844 | QString Addressee::agentLabel() |
793 | { | 845 | { |
794 | return i18n("Agent"); | 846 | return i18n("Agent"); |
795 | } | 847 | } |
796 | 848 | ||
797 | 849 | ||
798 | 850 | ||
799 | void Addressee::setNameFromString( const QString &str ) | 851 | void Addressee::setNameFromString( const QString &str ) |
800 | { | 852 | { |
801 | setFormattedName( str ); | 853 | setFormattedName( str ); |
802 | setName( str ); | 854 | setName( str ); |
803 | 855 | ||
804 | static bool first = true; | 856 | static bool first = true; |
805 | static QStringList titles; | 857 | static QStringList titles; |
806 | static QStringList suffixes; | 858 | static QStringList suffixes; |
807 | static QStringList prefixes; | 859 | static QStringList prefixes; |
808 | 860 | ||
809 | if ( first ) { | 861 | if ( first ) { |
810 | first = false; | 862 | first = false; |
811 | titles += i18n( "Dr." ); | 863 | titles += i18n( "Dr." ); |
812 | titles += i18n( "Miss" ); | 864 | titles += i18n( "Miss" ); |
813 | titles += i18n( "Mr." ); | 865 | titles += i18n( "Mr." ); |
814 | titles += i18n( "Mrs." ); | 866 | titles += i18n( "Mrs." ); |
815 | titles += i18n( "Ms." ); | 867 | titles += i18n( "Ms." ); |
816 | titles += i18n( "Prof." ); | 868 | titles += i18n( "Prof." ); |
817 | 869 | ||
818 | suffixes += i18n( "I" ); | 870 | suffixes += i18n( "I" ); |
819 | suffixes += i18n( "II" ); | 871 | suffixes += i18n( "II" ); |
820 | suffixes += i18n( "III" ); | 872 | suffixes += i18n( "III" ); |
821 | suffixes += i18n( "Jr." ); | 873 | suffixes += i18n( "Jr." ); |
822 | suffixes += i18n( "Sr." ); | 874 | suffixes += i18n( "Sr." ); |
823 | 875 | ||
824 | prefixes += "van"; | 876 | prefixes += "van"; |
825 | prefixes += "von"; | 877 | prefixes += "von"; |
826 | prefixes += "de"; | 878 | prefixes += "de"; |
827 | 879 | ||
828 | KConfig config( locateLocal( "config", "kabcrc") ); | 880 | KConfig config( locateLocal( "config", "kabcrc") ); |
829 | config.setGroup( "General" ); | 881 | config.setGroup( "General" ); |
830 | titles += config.readListEntry( "Prefixes" ); | 882 | titles += config.readListEntry( "Prefixes" ); |
831 | titles.remove( "" ); | 883 | titles.remove( "" ); |
832 | prefixes += config.readListEntry( "Inclusions" ); | 884 | prefixes += config.readListEntry( "Inclusions" ); |
833 | prefixes.remove( "" ); | 885 | prefixes.remove( "" ); |
834 | suffixes += config.readListEntry( "Suffixes" ); | 886 | suffixes += config.readListEntry( "Suffixes" ); |
835 | suffixes.remove( "" ); | 887 | suffixes.remove( "" ); |
836 | } | 888 | } |
837 | 889 | ||
838 | // clear all name parts | 890 | // clear all name parts |
839 | setPrefix( "" ); | 891 | setPrefix( "" ); |
840 | setGivenName( "" ); | 892 | setGivenName( "" ); |
841 | setAdditionalName( "" ); | 893 | setAdditionalName( "" ); |
842 | setFamilyName( "" ); | 894 | setFamilyName( "" ); |
843 | setSuffix( "" ); | 895 | setSuffix( "" ); |
844 | 896 | ||
845 | if ( str.isEmpty() ) | 897 | if ( str.isEmpty() ) |
846 | return; | 898 | return; |
847 | 899 | ||
848 | int i = str.find(','); | 900 | int i = str.find(','); |
849 | if( i < 0 ) { | 901 | if( i < 0 ) { |
850 | QStringList parts = QStringList::split( " ", str ); | 902 | QStringList parts = QStringList::split( " ", str ); |
851 | int leftOffset = 0; | 903 | int leftOffset = 0; |
852 | int rightOffset = parts.count() - 1; | 904 | int rightOffset = parts.count() - 1; |
853 | 905 | ||
854 | QString suffix; | 906 | QString suffix; |
855 | while ( rightOffset >= 0 ) { | 907 | while ( rightOffset >= 0 ) { |
856 | if ( suffixes.contains( parts[ rightOffset ] ) ) { | 908 | if ( suffixes.contains( parts[ rightOffset ] ) ) { |
857 | suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); | 909 | suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); |
858 | rightOffset--; | 910 | rightOffset--; |
859 | } else | 911 | } else |
860 | break; | 912 | break; |
861 | } | 913 | } |
862 | setSuffix( suffix ); | 914 | setSuffix( suffix ); |
863 | 915 | ||
864 | if ( rightOffset < 0 ) | 916 | if ( rightOffset < 0 ) |
865 | return; | 917 | return; |
866 | 918 | ||
867 | if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { | 919 | if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { |
868 | setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); | 920 | setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); |
869 | rightOffset--; | 921 | rightOffset--; |
870 | } else | 922 | } else |
871 | setFamilyName( parts[ rightOffset ] ); | 923 | setFamilyName( parts[ rightOffset ] ); |
872 | 924 | ||
873 | QString prefix; | 925 | QString prefix; |
874 | while ( leftOffset < rightOffset ) { | 926 | while ( leftOffset < rightOffset ) { |
875 | if ( titles.contains( parts[ leftOffset ] ) ) { | 927 | if ( titles.contains( parts[ leftOffset ] ) ) { |
876 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 928 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
877 | leftOffset++; | 929 | leftOffset++; |
878 | } else | 930 | } else |
879 | break; | 931 | break; |
880 | } | 932 | } |
881 | setPrefix( prefix ); | 933 | setPrefix( prefix ); |
882 | 934 | ||
883 | if ( leftOffset < rightOffset ) { | 935 | if ( leftOffset < rightOffset ) { |
884 | setGivenName( parts[ leftOffset ] ); | 936 | setGivenName( parts[ leftOffset ] ); |
885 | leftOffset++; | 937 | leftOffset++; |
886 | } | 938 | } |
887 | 939 | ||
888 | QString additionalName; | 940 | QString additionalName; |
889 | while ( leftOffset < rightOffset ) { | 941 | while ( leftOffset < rightOffset ) { |
890 | additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 942 | additionalName.append( ( additionalName.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
891 | leftOffset++; | 943 | leftOffset++; |
892 | } | 944 | } |
893 | setAdditionalName( additionalName ); | 945 | setAdditionalName( additionalName ); |
894 | } else { | 946 | } else { |
895 | QString part1 = str.left( i ); | 947 | QString part1 = str.left( i ); |
896 | QString part2 = str.mid( i + 1 ); | 948 | QString part2 = str.mid( i + 1 ); |
897 | 949 | ||
898 | QStringList parts = QStringList::split( " ", part1 ); | 950 | QStringList parts = QStringList::split( " ", part1 ); |
899 | int leftOffset = 0; | 951 | int leftOffset = 0; |
900 | int rightOffset = parts.count() - 1; | 952 | int rightOffset = parts.count() - 1; |
901 | 953 | ||
902 | QString suffix; | 954 | QString suffix; |
903 | while ( rightOffset >= 0 ) { | 955 | while ( rightOffset >= 0 ) { |
904 | if ( suffixes.contains( parts[ rightOffset ] ) ) { | 956 | if ( suffixes.contains( parts[ rightOffset ] ) ) { |
905 | suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); | 957 | suffix.prepend(parts[ rightOffset ] + (suffix.isEmpty() ? "" : " ")); |
906 | rightOffset--; | 958 | rightOffset--; |
907 | } else | 959 | } else |
908 | break; | 960 | break; |
909 | } | 961 | } |
910 | setSuffix( suffix ); | 962 | setSuffix( suffix ); |
911 | 963 | ||
912 | if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { | 964 | if ( rightOffset - 1 >= 0 && prefixes.contains( parts[ rightOffset - 1 ].lower() ) ) { |
913 | setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); | 965 | setFamilyName( parts[ rightOffset - 1 ] + " " + parts[ rightOffset ] ); |
914 | rightOffset--; | 966 | rightOffset--; |
915 | } else | 967 | } else |
916 | setFamilyName( parts[ rightOffset ] ); | 968 | setFamilyName( parts[ rightOffset ] ); |
917 | 969 | ||
918 | QString prefix; | 970 | QString prefix; |
919 | while ( leftOffset < rightOffset ) { | 971 | while ( leftOffset < rightOffset ) { |
920 | if ( titles.contains( parts[ leftOffset ] ) ) { | 972 | if ( titles.contains( parts[ leftOffset ] ) ) { |
921 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 973 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
922 | leftOffset++; | 974 | leftOffset++; |
923 | } else | 975 | } else |
924 | break; | 976 | break; |
925 | } | 977 | } |
926 | 978 | ||
927 | parts = QStringList::split( " ", part2 ); | 979 | parts = QStringList::split( " ", part2 ); |
928 | 980 | ||
929 | leftOffset = 0; | 981 | leftOffset = 0; |
930 | rightOffset = parts.count(); | 982 | rightOffset = parts.count(); |
931 | 983 | ||
932 | while ( leftOffset < rightOffset ) { | 984 | while ( leftOffset < rightOffset ) { |
933 | if ( titles.contains( parts[ leftOffset ] ) ) { | 985 | if ( titles.contains( parts[ leftOffset ] ) ) { |
934 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); | 986 | prefix.append( ( prefix.isEmpty() ? "" : " ") + parts[ leftOffset ] ); |
935 | leftOffset++; | 987 | leftOffset++; |
936 | } else | 988 | } else |
937 | break; | 989 | break; |
938 | } | 990 | } |