-rw-r--r-- | kabc/addressee.cpp | 17 |
1 files changed, 0 insertions, 17 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 7f592e9..155ce24 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1,246 +1,245 @@ | |||
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 | #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 | static bool matchBinaryPatternA( int value, int pattern ); | 46 | static bool matchBinaryPatternA( int value, int pattern ); |
47 | static bool matchBinaryPatternP( int value, int pattern ); | 47 | static bool matchBinaryPatternP( int value, int pattern ); |
48 | 48 | ||
49 | struct Addressee::AddresseeData : public KShared | 49 | struct Addressee::AddresseeData : public KShared |
50 | { | 50 | { |
51 | QString uid; | 51 | QString uid; |
52 | QString name; | 52 | QString name; |
53 | QString formattedName; | 53 | QString formattedName; |
54 | QString defaultFormattedName; | ||
55 | QString familyName; | 54 | QString familyName; |
56 | QString givenName; | 55 | QString givenName; |
57 | QString additionalName; | 56 | QString additionalName; |
58 | QString prefix; | 57 | QString prefix; |
59 | QString suffix; | 58 | QString suffix; |
60 | QString nickName; | 59 | QString nickName; |
61 | QDateTime birthday; | 60 | QDateTime birthday; |
62 | QString mailer; | 61 | QString mailer; |
63 | TimeZone timeZone; | 62 | TimeZone timeZone; |
64 | Geo geo; | 63 | Geo geo; |
65 | QString title; | 64 | QString title; |
66 | QString role; | 65 | QString role; |
67 | QString organization; | 66 | QString organization; |
68 | QString note; | 67 | QString note; |
69 | QString productId; | 68 | QString productId; |
70 | QDateTime revision; | 69 | QDateTime revision; |
71 | QString sortString; | 70 | QString sortString; |
72 | QString externalUID; | 71 | QString externalUID; |
73 | QString originalExternalUID; | 72 | QString originalExternalUID; |
74 | KURL url; | 73 | KURL url; |
75 | Secrecy secrecy; | 74 | Secrecy secrecy; |
76 | Picture logo; | 75 | Picture logo; |
77 | Picture photo; | 76 | Picture photo; |
78 | Sound sound; | 77 | Sound sound; |
79 | Agent agent; | 78 | Agent agent; |
80 | QString mExternalId; | 79 | QString mExternalId; |
81 | PhoneNumber::List phoneNumbers; | 80 | PhoneNumber::List phoneNumbers; |
82 | Address::List addresses; | 81 | Address::List addresses; |
83 | Key::List keys; | 82 | Key::List keys; |
84 | QStringList emails; | 83 | QStringList emails; |
85 | QStringList categories; | 84 | QStringList categories; |
86 | QStringList custom; | 85 | QStringList custom; |
87 | int mTempSyncStat; | 86 | int mTempSyncStat; |
88 | Resource *resource; | 87 | Resource *resource; |
89 | 88 | ||
90 | bool empty :1; | 89 | bool empty :1; |
91 | bool changed :1; | 90 | bool changed :1; |
92 | bool tagged :1; | 91 | bool tagged :1; |
93 | }; | 92 | }; |
94 | 93 | ||
95 | Addressee::Addressee() | 94 | Addressee::Addressee() |
96 | { | 95 | { |
97 | mData = new AddresseeData; | 96 | mData = new AddresseeData; |
98 | mData->empty = true; | 97 | mData->empty = true; |
99 | mData->changed = false; | 98 | mData->changed = false; |
100 | mData->resource = 0; | 99 | mData->resource = 0; |
101 | mData->mExternalId = ":"; | 100 | mData->mExternalId = ":"; |
102 | mData->revision = QDateTime ( QDate( 2003,1,1)); | 101 | mData->revision = QDateTime ( QDate( 2003,1,1)); |
103 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 102 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
104 | } | 103 | } |
105 | 104 | ||
106 | Addressee::~Addressee() | 105 | Addressee::~Addressee() |
107 | { | 106 | { |
108 | } | 107 | } |
109 | 108 | ||
110 | Addressee::Addressee( const Addressee &a ) | 109 | Addressee::Addressee( const Addressee &a ) |
111 | { | 110 | { |
112 | mData = a.mData; | 111 | mData = a.mData; |
113 | } | 112 | } |
114 | 113 | ||
115 | Addressee &Addressee::operator=( const Addressee &a ) | 114 | Addressee &Addressee::operator=( const Addressee &a ) |
116 | { | 115 | { |
117 | mData = a.mData; | 116 | mData = a.mData; |
118 | return (*this); | 117 | return (*this); |
119 | } | 118 | } |
120 | 119 | ||
121 | Addressee Addressee::copy() | 120 | Addressee Addressee::copy() |
122 | { | 121 | { |
123 | Addressee a; | 122 | Addressee a; |
124 | *(a.mData) = *mData; | 123 | *(a.mData) = *mData; |
125 | return a; | 124 | return a; |
126 | } | 125 | } |
127 | 126 | ||
128 | void Addressee::detach() | 127 | void Addressee::detach() |
129 | { | 128 | { |
130 | if ( mData.count() == 1 ) return; | 129 | if ( mData.count() == 1 ) return; |
131 | *this = copy(); | 130 | *this = copy(); |
132 | } | 131 | } |
133 | 132 | ||
134 | bool Addressee::operator==( const Addressee &a ) const | 133 | bool Addressee::operator==( const Addressee &a ) const |
135 | { | 134 | { |
136 | if ( uid() != a.uid() ) return false; | 135 | if ( uid() != a.uid() ) return false; |
137 | if ( mData->name != a.mData->name ) return false; | 136 | if ( mData->name != a.mData->name ) return false; |
138 | if ( mData->formattedName != a.mData->formattedName ) return false; | 137 | if ( mData->formattedName != a.mData->formattedName ) return false; |
139 | if ( mData->familyName != a.mData->familyName ) return false; | 138 | if ( mData->familyName != a.mData->familyName ) return false; |
140 | if ( mData->givenName != a.mData->givenName ) return false; | 139 | if ( mData->givenName != a.mData->givenName ) return false; |
141 | if ( mData->additionalName != a.mData->additionalName ) return false; | 140 | if ( mData->additionalName != a.mData->additionalName ) return false; |
142 | if ( mData->prefix != a.mData->prefix ) return false; | 141 | if ( mData->prefix != a.mData->prefix ) return false; |
143 | if ( mData->suffix != a.mData->suffix ) return false; | 142 | if ( mData->suffix != a.mData->suffix ) return false; |
144 | if ( mData->nickName != a.mData->nickName ) return false; | 143 | if ( mData->nickName != a.mData->nickName ) return false; |
145 | if ( mData->birthday != a.mData->birthday ) return false; | 144 | if ( mData->birthday != a.mData->birthday ) return false; |
146 | if ( mData->mailer != a.mData->mailer ) return false; | 145 | if ( mData->mailer != a.mData->mailer ) return false; |
147 | if ( mData->timeZone != a.mData->timeZone ) return false; | 146 | if ( mData->timeZone != a.mData->timeZone ) return false; |
148 | if ( mData->geo != a.mData->geo ) return false; | 147 | if ( mData->geo != a.mData->geo ) return false; |
149 | if ( mData->title != a.mData->title ) return false; | 148 | if ( mData->title != a.mData->title ) return false; |
150 | if ( mData->role != a.mData->role ) return false; | 149 | if ( mData->role != a.mData->role ) return false; |
151 | if ( mData->organization != a.mData->organization ) return false; | 150 | if ( mData->organization != a.mData->organization ) return false; |
152 | if ( mData->note != a.mData->note ) return false; | 151 | if ( mData->note != a.mData->note ) return false; |
153 | if ( mData->productId != a.mData->productId ) return false; | 152 | if ( mData->productId != a.mData->productId ) return false; |
154 | //if ( mData->revision != a.mData->revision ) return false; | 153 | //if ( mData->revision != a.mData->revision ) return false; |
155 | if ( mData->sortString != a.mData->sortString ) return false; | 154 | if ( mData->sortString != a.mData->sortString ) return false; |
156 | if ( mData->secrecy != a.mData->secrecy ) return false; | 155 | if ( mData->secrecy != a.mData->secrecy ) return false; |
157 | if ( mData->logo != a.mData->logo ) return false; | 156 | if ( mData->logo != a.mData->logo ) return false; |
158 | if ( mData->photo != a.mData->photo ) return false; | 157 | if ( mData->photo != a.mData->photo ) return false; |
159 | if ( mData->sound != a.mData->sound ) return false; | 158 | if ( mData->sound != a.mData->sound ) return false; |
160 | if ( mData->agent != a.mData->agent ) return false; | 159 | if ( mData->agent != a.mData->agent ) return false; |
161 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 160 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
162 | ( mData->url != a.mData->url ) ) return false; | 161 | ( mData->url != a.mData->url ) ) return false; |
163 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 162 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
164 | if ( mData->addresses != a.mData->addresses ) return false; | 163 | if ( mData->addresses != a.mData->addresses ) return false; |
165 | if ( mData->keys != a.mData->keys ) return false; | 164 | if ( mData->keys != a.mData->keys ) return false; |
166 | if ( mData->emails != a.mData->emails ) return false; | 165 | if ( mData->emails != a.mData->emails ) return false; |
167 | if ( mData->categories != a.mData->categories ) return false; | 166 | if ( mData->categories != a.mData->categories ) return false; |
168 | if ( mData->custom != a.mData->custom ) return false; | 167 | if ( mData->custom != a.mData->custom ) return false; |
169 | 168 | ||
170 | return true; | 169 | return true; |
171 | } | 170 | } |
172 | 171 | ||
173 | bool Addressee::operator!=( const Addressee &a ) const | 172 | bool Addressee::operator!=( const Addressee &a ) const |
174 | { | 173 | { |
175 | return !( a == *this ); | 174 | return !( a == *this ); |
176 | } | 175 | } |
177 | 176 | ||
178 | bool Addressee::isEmpty() const | 177 | bool Addressee::isEmpty() const |
179 | { | 178 | { |
180 | return mData->empty; | 179 | return mData->empty; |
181 | } | 180 | } |
182 | ulong Addressee::getCsum4List( const QStringList & attList) | 181 | ulong Addressee::getCsum4List( const QStringList & attList) |
183 | { | 182 | { |
184 | int max = attList.count(); | 183 | int max = attList.count(); |
185 | ulong cSum = 0; | 184 | ulong cSum = 0; |
186 | int j,k,i; | 185 | int j,k,i; |
187 | int add; | 186 | int add; |
188 | for ( i = 0; i < max ; ++i ) { | 187 | for ( i = 0; i < max ; ++i ) { |
189 | QString s = attList[i]; | 188 | QString s = attList[i]; |
190 | if ( ! s.isEmpty() ){ | 189 | if ( ! s.isEmpty() ){ |
191 | j = s.length(); | 190 | j = s.length(); |
192 | for ( k = 0; k < j; ++k ) { | 191 | for ( k = 0; k < j; ++k ) { |
193 | int mul = k +1; | 192 | int mul = k +1; |
194 | add = s[k].unicode (); | 193 | add = s[k].unicode (); |
195 | if ( k < 16 ) | 194 | if ( k < 16 ) |
196 | mul = mul * mul; | 195 | mul = mul * mul; |
197 | int ii = i+1; | 196 | int ii = i+1; |
198 | add = add * mul *ii*ii*ii; | 197 | add = add * mul *ii*ii*ii; |
199 | cSum += add; | 198 | cSum += add; |
200 | //qDebug("csum: %d %d %d", i,k,cSum); | 199 | //qDebug("csum: %d %d %d", i,k,cSum); |
201 | } | 200 | } |
202 | } | 201 | } |
203 | 202 | ||
204 | } | 203 | } |
205 | //QString dump = attList.join(","); | 204 | //QString dump = attList.join(","); |
206 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 205 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
207 | 206 | ||
208 | return cSum; | 207 | return cSum; |
209 | 208 | ||
210 | } | 209 | } |
211 | void Addressee::computeCsum(const QString &dev) | 210 | void Addressee::computeCsum(const QString &dev) |
212 | { | 211 | { |
213 | QStringList l; | 212 | QStringList l; |
214 | //if ( !mData->name.isEmpty() ) l.append(mData->name); | 213 | //if ( !mData->name.isEmpty() ) l.append(mData->name); |
215 | //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 214 | //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
216 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 215 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
217 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 216 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
218 | if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); | 217 | if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); |
219 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 218 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
220 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 219 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
221 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 220 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
222 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 221 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
223 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 222 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
224 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 223 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
225 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 224 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
226 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 225 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
227 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 226 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
228 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 227 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
229 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 228 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
230 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 229 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
231 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 230 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
232 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 231 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
233 | if ( !mData->logo.undefined() ) { | 232 | if ( !mData->logo.undefined() ) { |
234 | if ( !mData->logo.isIntern() ) | 233 | if ( !mData->logo.isIntern() ) |
235 | l.append( mData->logo.url() ); | 234 | l.append( mData->logo.url() ); |
236 | else | 235 | else |
237 | l.append( QString::number(mData->logo.data().width()* mData->logo.data().height())); | 236 | l.append( QString::number(mData->logo.data().width()* mData->logo.data().height())); |
238 | } else { | 237 | } else { |
239 | l.append( "nologo"); | 238 | l.append( "nologo"); |
240 | } | 239 | } |
241 | if ( !mData->photo.undefined() ) { | 240 | if ( !mData->photo.undefined() ) { |
242 | if ( !mData->photo.isIntern() ) | 241 | if ( !mData->photo.isIntern() ) |
243 | l.append( mData->photo.url() ); | 242 | l.append( mData->photo.url() ); |
244 | else | 243 | else |
245 | l.append( QString::number(mData->photo.data().width()* mData->photo.data().height())); | 244 | l.append( QString::number(mData->photo.data().width()* mData->photo.data().height())); |
246 | } else { | 245 | } else { |
@@ -559,411 +558,395 @@ void Addressee::simplifyEmails() | |||
559 | if ( mData->emails.count() == 0 ) return ; | 558 | if ( mData->emails.count() == 0 ) return ; |
560 | QString email = mData->emails.first(); | 559 | QString email = mData->emails.first(); |
561 | detach(); | 560 | detach(); |
562 | mData->emails.clear(); | 561 | mData->emails.clear(); |
563 | mData->emails.append( email ); | 562 | mData->emails.append( email ); |
564 | } | 563 | } |
565 | 564 | ||
566 | void Addressee::simplifyPhoneNumbers() | 565 | void Addressee::simplifyPhoneNumbers() |
567 | { | 566 | { |
568 | int max = 4; | 567 | int max = 4; |
569 | int inList = mData->phoneNumbers.count(); | 568 | int inList = mData->phoneNumbers.count(); |
570 | KABC::PhoneNumber::List removeNumbers; | 569 | KABC::PhoneNumber::List removeNumbers; |
571 | KABC::PhoneNumber::List::Iterator phoneIter; | 570 | KABC::PhoneNumber::List::Iterator phoneIter; |
572 | if ( inList > max ) { | 571 | if ( inList > max ) { |
573 | // delete non-preferred numbers | 572 | // delete non-preferred numbers |
574 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 573 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
575 | ++phoneIter ) { | 574 | ++phoneIter ) { |
576 | if ( inList > max ) { | 575 | if ( inList > max ) { |
577 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { | 576 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { |
578 | removeNumbers.append( ( *phoneIter ) ); | 577 | removeNumbers.append( ( *phoneIter ) ); |
579 | --inList; | 578 | --inList; |
580 | } | 579 | } |
581 | } else | 580 | } else |
582 | break; | 581 | break; |
583 | } | 582 | } |
584 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 583 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
585 | ++phoneIter ) { | 584 | ++phoneIter ) { |
586 | removePhoneNumber(( *phoneIter )); | 585 | removePhoneNumber(( *phoneIter )); |
587 | } | 586 | } |
588 | // delete preferred numbers | 587 | // delete preferred numbers |
589 | if ( inList > max ) { | 588 | if ( inList > max ) { |
590 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 589 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
591 | ++phoneIter ) { | 590 | ++phoneIter ) { |
592 | if ( inList > max ) { | 591 | if ( inList > max ) { |
593 | removeNumbers.append( ( *phoneIter ) ); | 592 | removeNumbers.append( ( *phoneIter ) ); |
594 | --inList; | 593 | --inList; |
595 | } else | 594 | } else |
596 | break; | 595 | break; |
597 | } | 596 | } |
598 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 597 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
599 | ++phoneIter ) { | 598 | ++phoneIter ) { |
600 | removePhoneNumber(( *phoneIter )); | 599 | removePhoneNumber(( *phoneIter )); |
601 | } | 600 | } |
602 | } | 601 | } |
603 | } | 602 | } |
604 | // remove non-numeric characters | 603 | // remove non-numeric characters |
605 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 604 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
606 | ++phoneIter ) { | 605 | ++phoneIter ) { |
607 | if ( ! ( *phoneIter ).simplifyNumber() ) | 606 | if ( ! ( *phoneIter ).simplifyNumber() ) |
608 | removeNumbers.append( ( *phoneIter ) ); | 607 | removeNumbers.append( ( *phoneIter ) ); |
609 | } | 608 | } |
610 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 609 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
611 | ++phoneIter ) { | 610 | ++phoneIter ) { |
612 | removePhoneNumber(( *phoneIter )); | 611 | removePhoneNumber(( *phoneIter )); |
613 | } | 612 | } |
614 | } | 613 | } |
615 | void Addressee::simplifyPhoneNumberTypes() | 614 | void Addressee::simplifyPhoneNumberTypes() |
616 | { | 615 | { |
617 | KABC::PhoneNumber::List::Iterator phoneIter; | 616 | KABC::PhoneNumber::List::Iterator phoneIter; |
618 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 617 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
619 | ++phoneIter ) | 618 | ++phoneIter ) |
620 | ( *phoneIter ).simplifyType(); | 619 | ( *phoneIter ).simplifyType(); |
621 | } | 620 | } |
622 | void Addressee::removeID(const QString &prof) | 621 | void Addressee::removeID(const QString &prof) |
623 | { | 622 | { |
624 | detach(); | 623 | detach(); |
625 | if ( prof.isEmpty() ) | 624 | if ( prof.isEmpty() ) |
626 | mData->mExternalId = ":"; | 625 | mData->mExternalId = ":"; |
627 | else | 626 | else |
628 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 627 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
629 | 628 | ||
630 | } | 629 | } |
631 | void Addressee::setID( const QString & prof , const QString & id ) | 630 | void Addressee::setID( const QString & prof , const QString & id ) |
632 | { | 631 | { |
633 | detach(); | 632 | detach(); |
634 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 633 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
635 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 634 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
636 | } | 635 | } |
637 | void Addressee::setTempSyncStat( int id ) | 636 | void Addressee::setTempSyncStat( int id ) |
638 | { | 637 | { |
639 | if ( mData->mTempSyncStat == id ) return; | 638 | if ( mData->mTempSyncStat == id ) return; |
640 | detach(); | 639 | detach(); |
641 | mData->mTempSyncStat = id; | 640 | mData->mTempSyncStat = id; |
642 | } | 641 | } |
643 | int Addressee::tempSyncStat() const | 642 | int Addressee::tempSyncStat() const |
644 | { | 643 | { |
645 | return mData->mTempSyncStat; | 644 | return mData->mTempSyncStat; |
646 | } | 645 | } |
647 | 646 | ||
648 | const QString Addressee::getID( const QString & prof) const | 647 | const QString Addressee::getID( const QString & prof) const |
649 | { | 648 | { |
650 | return KIdManager::getId ( mData->mExternalId, prof ); | 649 | return KIdManager::getId ( mData->mExternalId, prof ); |
651 | } | 650 | } |
652 | 651 | ||
653 | void Addressee::setCsum( const QString & prof , const QString & id ) | 652 | void Addressee::setCsum( const QString & prof , const QString & id ) |
654 | { | 653 | { |
655 | detach(); | 654 | detach(); |
656 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 655 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
657 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 656 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
658 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 657 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
659 | } | 658 | } |
660 | 659 | ||
661 | const QString Addressee::getCsum( const QString & prof) const | 660 | const QString Addressee::getCsum( const QString & prof) const |
662 | { | 661 | { |
663 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 662 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
664 | } | 663 | } |
665 | 664 | ||
666 | void Addressee::setIDStr( const QString & s ) | 665 | void Addressee::setIDStr( const QString & s ) |
667 | { | 666 | { |
668 | detach(); | 667 | detach(); |
669 | mData->mExternalId = s; | 668 | mData->mExternalId = s; |
670 | } | 669 | } |
671 | 670 | ||
672 | const QString Addressee::IDStr() const | 671 | const QString Addressee::IDStr() const |
673 | { | 672 | { |
674 | return mData->mExternalId; | 673 | return mData->mExternalId; |
675 | } | 674 | } |
676 | 675 | ||
677 | void Addressee::setExternalUID( const QString &id ) | 676 | void Addressee::setExternalUID( const QString &id ) |
678 | { | 677 | { |
679 | if ( id == mData->externalUID ) return; | 678 | if ( id == mData->externalUID ) return; |
680 | detach(); | 679 | detach(); |
681 | mData->empty = false; | 680 | mData->empty = false; |
682 | mData->externalUID = id; | 681 | mData->externalUID = id; |
683 | } | 682 | } |
684 | 683 | ||
685 | const QString Addressee::externalUID() const | 684 | const QString Addressee::externalUID() const |
686 | { | 685 | { |
687 | return mData->externalUID; | 686 | return mData->externalUID; |
688 | } | 687 | } |
689 | void Addressee::setOriginalExternalUID( const QString &id ) | 688 | void Addressee::setOriginalExternalUID( const QString &id ) |
690 | { | 689 | { |
691 | if ( id == mData->originalExternalUID ) return; | 690 | if ( id == mData->originalExternalUID ) return; |
692 | detach(); | 691 | detach(); |
693 | mData->empty = false; | 692 | mData->empty = false; |
694 | //qDebug("*******Set orig uid %s ", id.latin1()); | 693 | //qDebug("*******Set orig uid %s ", id.latin1()); |
695 | mData->originalExternalUID = id; | 694 | mData->originalExternalUID = id; |
696 | } | 695 | } |
697 | 696 | ||
698 | QString Addressee::originalExternalUID() const | 697 | QString Addressee::originalExternalUID() const |
699 | { | 698 | { |
700 | return mData->originalExternalUID; | 699 | return mData->originalExternalUID; |
701 | } | 700 | } |
702 | 701 | ||
703 | void Addressee::setUid( const QString &id ) | 702 | void Addressee::setUid( const QString &id ) |
704 | { | 703 | { |
705 | if ( id == mData->uid ) return; | 704 | if ( id == mData->uid ) return; |
706 | detach(); | 705 | detach(); |
707 | //qDebug("****setuid %s ", id.latin1()); | 706 | //qDebug("****setuid %s ", id.latin1()); |
708 | mData->empty = false; | 707 | mData->empty = false; |
709 | mData->uid = id; | 708 | mData->uid = id; |
710 | } | 709 | } |
711 | 710 | ||
712 | const QString Addressee::uid() const | 711 | const QString Addressee::uid() const |
713 | { | 712 | { |
714 | if ( mData->uid.isEmpty() ) | 713 | if ( mData->uid.isEmpty() ) |
715 | mData->uid = KApplication::randomString( 10 ); | 714 | mData->uid = KApplication::randomString( 10 ); |
716 | 715 | ||
717 | return mData->uid; | 716 | return mData->uid; |
718 | } | 717 | } |
719 | 718 | ||
720 | QString Addressee::uidLabel() | 719 | QString Addressee::uidLabel() |
721 | { | 720 | { |
722 | return i18n("Unique Identifier"); | 721 | return i18n("Unique Identifier"); |
723 | } | 722 | } |
724 | 723 | ||
725 | void Addressee::setName( const QString &name ) | 724 | void Addressee::setName( const QString &name ) |
726 | { | 725 | { |
727 | if ( name == mData->name ) return; | 726 | if ( name == mData->name ) return; |
728 | detach(); | 727 | detach(); |
729 | mData->empty = false; | 728 | mData->empty = false; |
730 | mData->name = name; | 729 | mData->name = name; |
731 | } | 730 | } |
732 | 731 | ||
733 | QString Addressee::name() const | 732 | QString Addressee::name() const |
734 | { | 733 | { |
735 | return mData->name; | 734 | return mData->name; |
736 | } | 735 | } |
737 | 736 | ||
738 | QString Addressee::nameLabel() | 737 | QString Addressee::nameLabel() |
739 | { | 738 | { |
740 | return i18n("Name"); | 739 | return i18n("Name"); |
741 | } | 740 | } |
742 | 741 | ||
743 | 742 | ||
744 | void Addressee::setFormattedName( const QString &formattedName ) | 743 | void Addressee::setFormattedName( const QString &formattedName ) |
745 | { | 744 | { |
746 | if ( formattedName == mData->formattedName ) return; | 745 | if ( formattedName == mData->formattedName ) return; |
747 | detach(); | 746 | detach(); |
748 | mData->empty = false; | 747 | mData->empty = false; |
749 | mData->formattedName = formattedName; | 748 | mData->formattedName = formattedName; |
750 | } | 749 | } |
751 | void Addressee::setDefaultFormattedName( const QString &formattedName ) | ||
752 | { | ||
753 | if ( formattedName == mData->defaultFormattedName ) return; | ||
754 | detach(); | ||
755 | mData->empty = false; | ||
756 | mData->defaultFormattedName = formattedName; | ||
757 | } | ||
758 | 750 | ||
759 | QString Addressee::formattedName() const | 751 | QString Addressee::formattedName() const |
760 | { | 752 | { |
761 | return mData->formattedName; | 753 | return mData->formattedName; |
762 | } | 754 | } |
763 | QString Addressee::defaultFormattedName() const | ||
764 | { | ||
765 | return mData->defaultFormattedName; | ||
766 | } | ||
767 | 755 | ||
768 | QString Addressee::formattedNameLabel() | 756 | QString Addressee::formattedNameLabel() |
769 | { | 757 | { |
770 | return i18n("Formatted Name"); | 758 | return i18n("Formatted Name"); |
771 | } | 759 | } |
772 | 760 | ||
773 | QString Addressee::defaultFormattedNameLabel() | ||
774 | { | ||
775 | return i18n("Def.Formatted Name"); | ||
776 | } | ||
777 | |||
778 | 761 | ||
779 | void Addressee::setFamilyName( const QString &familyName ) | 762 | void Addressee::setFamilyName( const QString &familyName ) |
780 | { | 763 | { |
781 | if ( familyName == mData->familyName ) return; | 764 | if ( familyName == mData->familyName ) return; |
782 | detach(); | 765 | detach(); |
783 | mData->empty = false; | 766 | mData->empty = false; |
784 | mData->familyName = familyName; | 767 | mData->familyName = familyName; |
785 | } | 768 | } |
786 | 769 | ||
787 | QString Addressee::familyName() const | 770 | QString Addressee::familyName() const |
788 | { | 771 | { |
789 | return mData->familyName; | 772 | return mData->familyName; |
790 | } | 773 | } |
791 | 774 | ||
792 | QString Addressee::familyNameLabel() | 775 | QString Addressee::familyNameLabel() |
793 | { | 776 | { |
794 | return i18n("Family Name"); | 777 | return i18n("Family Name"); |
795 | } | 778 | } |
796 | 779 | ||
797 | 780 | ||
798 | void Addressee::setGivenName( const QString &givenName ) | 781 | void Addressee::setGivenName( const QString &givenName ) |
799 | { | 782 | { |
800 | if ( givenName == mData->givenName ) return; | 783 | if ( givenName == mData->givenName ) return; |
801 | detach(); | 784 | detach(); |
802 | mData->empty = false; | 785 | mData->empty = false; |
803 | mData->givenName = givenName; | 786 | mData->givenName = givenName; |
804 | } | 787 | } |
805 | 788 | ||
806 | QString Addressee::givenName() const | 789 | QString Addressee::givenName() const |
807 | { | 790 | { |
808 | return mData->givenName; | 791 | return mData->givenName; |
809 | } | 792 | } |
810 | 793 | ||
811 | QString Addressee::givenNameLabel() | 794 | QString Addressee::givenNameLabel() |
812 | { | 795 | { |
813 | return i18n("Given Name"); | 796 | return i18n("Given Name"); |
814 | } | 797 | } |
815 | 798 | ||
816 | 799 | ||
817 | void Addressee::setAdditionalName( const QString &additionalName ) | 800 | void Addressee::setAdditionalName( const QString &additionalName ) |
818 | { | 801 | { |
819 | if ( additionalName == mData->additionalName ) return; | 802 | if ( additionalName == mData->additionalName ) return; |
820 | detach(); | 803 | detach(); |
821 | mData->empty = false; | 804 | mData->empty = false; |
822 | mData->additionalName = additionalName; | 805 | mData->additionalName = additionalName; |
823 | } | 806 | } |
824 | 807 | ||
825 | QString Addressee::additionalName() const | 808 | QString Addressee::additionalName() const |
826 | { | 809 | { |
827 | return mData->additionalName; | 810 | return mData->additionalName; |
828 | } | 811 | } |
829 | 812 | ||
830 | QString Addressee::additionalNameLabel() | 813 | QString Addressee::additionalNameLabel() |
831 | { | 814 | { |
832 | return i18n("Additional Names"); | 815 | return i18n("Additional Names"); |
833 | } | 816 | } |
834 | 817 | ||
835 | 818 | ||
836 | void Addressee::setPrefix( const QString &prefix ) | 819 | void Addressee::setPrefix( const QString &prefix ) |
837 | { | 820 | { |
838 | if ( prefix == mData->prefix ) return; | 821 | if ( prefix == mData->prefix ) return; |
839 | detach(); | 822 | detach(); |
840 | mData->empty = false; | 823 | mData->empty = false; |
841 | mData->prefix = prefix; | 824 | mData->prefix = prefix; |
842 | } | 825 | } |
843 | 826 | ||
844 | QString Addressee::prefix() const | 827 | QString Addressee::prefix() const |
845 | { | 828 | { |
846 | return mData->prefix; | 829 | return mData->prefix; |
847 | } | 830 | } |
848 | 831 | ||
849 | QString Addressee::prefixLabel() | 832 | QString Addressee::prefixLabel() |
850 | { | 833 | { |
851 | return i18n("Honorific Prefixes"); | 834 | return i18n("Honorific Prefixes"); |
852 | } | 835 | } |
853 | 836 | ||
854 | 837 | ||
855 | void Addressee::setSuffix( const QString &suffix ) | 838 | void Addressee::setSuffix( const QString &suffix ) |
856 | { | 839 | { |
857 | if ( suffix == mData->suffix ) return; | 840 | if ( suffix == mData->suffix ) return; |
858 | detach(); | 841 | detach(); |
859 | mData->empty = false; | 842 | mData->empty = false; |
860 | mData->suffix = suffix; | 843 | mData->suffix = suffix; |
861 | } | 844 | } |
862 | 845 | ||
863 | QString Addressee::suffix() const | 846 | QString Addressee::suffix() const |
864 | { | 847 | { |
865 | return mData->suffix; | 848 | return mData->suffix; |
866 | } | 849 | } |
867 | 850 | ||
868 | QString Addressee::suffixLabel() | 851 | QString Addressee::suffixLabel() |
869 | { | 852 | { |
870 | return i18n("Honorific Suffixes"); | 853 | return i18n("Honorific Suffixes"); |
871 | } | 854 | } |
872 | 855 | ||
873 | 856 | ||
874 | void Addressee::setNickName( const QString &nickName ) | 857 | void Addressee::setNickName( const QString &nickName ) |
875 | { | 858 | { |
876 | if ( nickName == mData->nickName ) return; | 859 | if ( nickName == mData->nickName ) return; |
877 | detach(); | 860 | detach(); |
878 | mData->empty = false; | 861 | mData->empty = false; |
879 | mData->nickName = nickName; | 862 | mData->nickName = nickName; |
880 | } | 863 | } |
881 | 864 | ||
882 | QString Addressee::nickName() const | 865 | QString Addressee::nickName() const |
883 | { | 866 | { |
884 | return mData->nickName; | 867 | return mData->nickName; |
885 | } | 868 | } |
886 | 869 | ||
887 | QString Addressee::nickNameLabel() | 870 | QString Addressee::nickNameLabel() |
888 | { | 871 | { |
889 | return i18n("Nick Name"); | 872 | return i18n("Nick Name"); |
890 | } | 873 | } |
891 | 874 | ||
892 | 875 | ||
893 | void Addressee::setBirthday( const QDateTime &birthday ) | 876 | void Addressee::setBirthday( const QDateTime &birthday ) |
894 | { | 877 | { |
895 | if ( birthday == mData->birthday ) return; | 878 | if ( birthday == mData->birthday ) return; |
896 | detach(); | 879 | detach(); |
897 | mData->empty = false; | 880 | mData->empty = false; |
898 | mData->birthday = birthday; | 881 | mData->birthday = birthday; |
899 | } | 882 | } |
900 | 883 | ||
901 | QDateTime Addressee::birthday() const | 884 | QDateTime Addressee::birthday() const |
902 | { | 885 | { |
903 | return mData->birthday; | 886 | return mData->birthday; |
904 | } | 887 | } |
905 | 888 | ||
906 | QString Addressee::birthdayLabel() | 889 | QString Addressee::birthdayLabel() |
907 | { | 890 | { |
908 | return i18n("Birthday"); | 891 | return i18n("Birthday"); |
909 | } | 892 | } |
910 | 893 | ||
911 | 894 | ||
912 | QString Addressee::homeAddressStreetLabel() | 895 | QString Addressee::homeAddressStreetLabel() |
913 | { | 896 | { |
914 | return i18n("Home Address Street"); | 897 | return i18n("Home Address Street"); |
915 | } | 898 | } |
916 | 899 | ||
917 | 900 | ||
918 | QString Addressee::homeAddressLocalityLabel() | 901 | QString Addressee::homeAddressLocalityLabel() |
919 | { | 902 | { |
920 | return i18n("Home Address Locality"); | 903 | return i18n("Home Address Locality"); |
921 | } | 904 | } |
922 | 905 | ||
923 | 906 | ||
924 | QString Addressee::homeAddressRegionLabel() | 907 | QString Addressee::homeAddressRegionLabel() |
925 | { | 908 | { |
926 | return i18n("Home Address Region"); | 909 | return i18n("Home Address Region"); |
927 | } | 910 | } |
928 | 911 | ||
929 | 912 | ||
930 | QString Addressee::homeAddressPostalCodeLabel() | 913 | QString Addressee::homeAddressPostalCodeLabel() |
931 | { | 914 | { |
932 | return i18n("Home Address Postal Code"); | 915 | return i18n("Home Address Postal Code"); |
933 | } | 916 | } |
934 | 917 | ||
935 | 918 | ||
936 | QString Addressee::homeAddressCountryLabel() | 919 | QString Addressee::homeAddressCountryLabel() |
937 | { | 920 | { |
938 | return i18n("Home Address Country"); | 921 | return i18n("Home Address Country"); |
939 | } | 922 | } |
940 | 923 | ||
941 | 924 | ||
942 | QString Addressee::homeAddressLabelLabel() | 925 | QString Addressee::homeAddressLabelLabel() |
943 | { | 926 | { |
944 | return i18n("Home Address Label"); | 927 | return i18n("Home Address Label"); |
945 | } | 928 | } |
946 | 929 | ||
947 | 930 | ||
948 | QString Addressee::businessAddressStreetLabel() | 931 | QString Addressee::businessAddressStreetLabel() |
949 | { | 932 | { |
950 | return i18n("Business Address Street"); | 933 | return i18n("Business Address Street"); |
951 | } | 934 | } |
952 | 935 | ||
953 | 936 | ||
954 | QString Addressee::businessAddressLocalityLabel() | 937 | QString Addressee::businessAddressLocalityLabel() |
955 | { | 938 | { |
956 | return i18n("Business Address Locality"); | 939 | return i18n("Business Address Locality"); |
957 | } | 940 | } |
958 | 941 | ||
959 | 942 | ||
960 | QString Addressee::businessAddressRegionLabel() | 943 | QString Addressee::businessAddressRegionLabel() |
961 | { | 944 | { |
962 | return i18n("Business Address Region"); | 945 | return i18n("Business Address Region"); |
963 | } | 946 | } |
964 | 947 | ||
965 | 948 | ||
966 | QString Addressee::businessAddressPostalCodeLabel() | 949 | QString Addressee::businessAddressPostalCodeLabel() |
967 | { | 950 | { |
968 | return i18n("Business Address Postal Code"); | 951 | return i18n("Business Address Postal Code"); |
969 | } | 952 | } |