author | zautrix <zautrix> | 2005-08-22 15:42:41 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-08-22 15:42:41 (UTC) |
commit | 1d82d044bbdedd407f6d08305522187ffd256552 (patch) (unidiff) | |
tree | 08f5651d72548b643ed012e5f6ad938b36d1ae3f /kabc/addressee.cpp | |
parent | f516a558e6d18982a54152b28ca3da78fe76e3fc (diff) | |
download | kdepimpi-1d82d044bbdedd407f6d08305522187ffd256552.zip kdepimpi-1d82d044bbdedd407f6d08305522187ffd256552.tar.gz kdepimpi-1d82d044bbdedd407f6d08305522187ffd256552.tar.bz2 |
kapi search fix
-rw-r--r-- | kabc/addressee.cpp | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index 155ce24..7e1e414 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1,1077 +1,1102 @@ | |||
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 familyName; | 54 | QString familyName; |
55 | QString givenName; | 55 | QString givenName; |
56 | QString additionalName; | 56 | QString additionalName; |
57 | QString prefix; | 57 | QString prefix; |
58 | QString suffix; | 58 | QString suffix; |
59 | QString nickName; | 59 | QString nickName; |
60 | QDateTime birthday; | 60 | QDateTime birthday; |
61 | QString mailer; | 61 | QString mailer; |
62 | TimeZone timeZone; | 62 | TimeZone timeZone; |
63 | Geo geo; | 63 | Geo geo; |
64 | QString title; | 64 | QString title; |
65 | QString role; | 65 | QString role; |
66 | QString organization; | 66 | QString organization; |
67 | QString note; | 67 | QString note; |
68 | QString productId; | 68 | QString productId; |
69 | QDateTime revision; | 69 | QDateTime revision; |
70 | QString sortString; | 70 | QString sortString; |
71 | QString externalUID; | 71 | QString externalUID; |
72 | QString originalExternalUID; | 72 | QString originalExternalUID; |
73 | KURL url; | 73 | KURL url; |
74 | Secrecy secrecy; | 74 | Secrecy secrecy; |
75 | Picture logo; | 75 | Picture logo; |
76 | Picture photo; | 76 | Picture photo; |
77 | Sound sound; | 77 | Sound sound; |
78 | Agent agent; | 78 | Agent agent; |
79 | QString mExternalId; | 79 | QString mExternalId; |
80 | PhoneNumber::List phoneNumbers; | 80 | PhoneNumber::List phoneNumbers; |
81 | Address::List addresses; | 81 | Address::List addresses; |
82 | Key::List keys; | 82 | Key::List keys; |
83 | QStringList emails; | 83 | QStringList emails; |
84 | QStringList categories; | 84 | QStringList categories; |
85 | QStringList custom; | 85 | QStringList custom; |
86 | int mTempSyncStat; | 86 | int mTempSyncStat; |
87 | Resource *resource; | 87 | Resource *resource; |
88 | 88 | ||
89 | bool empty :1; | 89 | bool empty :1; |
90 | bool changed :1; | 90 | bool changed :1; |
91 | bool tagged :1; | 91 | bool tagged :1; |
92 | }; | 92 | }; |
93 | 93 | ||
94 | Addressee::Addressee() | 94 | Addressee::Addressee() |
95 | { | 95 | { |
96 | mData = new AddresseeData; | 96 | mData = new AddresseeData; |
97 | mData->empty = true; | 97 | mData->empty = true; |
98 | mData->changed = false; | 98 | mData->changed = false; |
99 | mData->resource = 0; | 99 | mData->resource = 0; |
100 | mData->mExternalId = ":"; | 100 | mData->mExternalId = ":"; |
101 | mData->revision = QDateTime ( QDate( 2003,1,1)); | 101 | mData->revision = QDateTime ( QDate( 2003,1,1)); |
102 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 102 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
103 | } | 103 | } |
104 | 104 | ||
105 | Addressee::~Addressee() | 105 | Addressee::~Addressee() |
106 | { | 106 | { |
107 | } | 107 | } |
108 | 108 | ||
109 | Addressee::Addressee( const Addressee &a ) | 109 | Addressee::Addressee( const Addressee &a ) |
110 | { | 110 | { |
111 | mData = a.mData; | 111 | mData = a.mData; |
112 | } | 112 | } |
113 | 113 | ||
114 | Addressee &Addressee::operator=( const Addressee &a ) | 114 | Addressee &Addressee::operator=( const Addressee &a ) |
115 | { | 115 | { |
116 | mData = a.mData; | 116 | mData = a.mData; |
117 | return (*this); | 117 | return (*this); |
118 | } | 118 | } |
119 | 119 | ||
120 | Addressee Addressee::copy() | 120 | Addressee Addressee::copy() |
121 | { | 121 | { |
122 | Addressee a; | 122 | Addressee a; |
123 | *(a.mData) = *mData; | 123 | *(a.mData) = *mData; |
124 | return a; | 124 | return a; |
125 | } | 125 | } |
126 | 126 | ||
127 | void Addressee::detach() | 127 | void Addressee::detach() |
128 | { | 128 | { |
129 | if ( mData.count() == 1 ) return; | 129 | if ( mData.count() == 1 ) return; |
130 | *this = copy(); | 130 | *this = copy(); |
131 | } | 131 | } |
132 | 132 | ||
133 | bool Addressee::operator==( const Addressee &a ) const | 133 | bool Addressee::operator==( const Addressee &a ) const |
134 | { | 134 | { |
135 | if ( uid() != a.uid() ) return false; | 135 | if ( uid() != a.uid() ) return false; |
136 | if ( mData->name != a.mData->name ) return false; | 136 | if ( mData->name != a.mData->name ) return false; |
137 | if ( mData->formattedName != a.mData->formattedName ) return false; | 137 | if ( mData->formattedName != a.mData->formattedName ) return false; |
138 | if ( mData->familyName != a.mData->familyName ) return false; | 138 | if ( mData->familyName != a.mData->familyName ) return false; |
139 | if ( mData->givenName != a.mData->givenName ) return false; | 139 | if ( mData->givenName != a.mData->givenName ) return false; |
140 | if ( mData->additionalName != a.mData->additionalName ) return false; | 140 | if ( mData->additionalName != a.mData->additionalName ) return false; |
141 | if ( mData->prefix != a.mData->prefix ) return false; | 141 | if ( mData->prefix != a.mData->prefix ) return false; |
142 | if ( mData->suffix != a.mData->suffix ) return false; | 142 | if ( mData->suffix != a.mData->suffix ) return false; |
143 | if ( mData->nickName != a.mData->nickName ) return false; | 143 | if ( mData->nickName != a.mData->nickName ) return false; |
144 | if ( mData->birthday != a.mData->birthday ) return false; | 144 | if ( mData->birthday != a.mData->birthday ) return false; |
145 | if ( mData->mailer != a.mData->mailer ) return false; | 145 | if ( mData->mailer != a.mData->mailer ) return false; |
146 | if ( mData->timeZone != a.mData->timeZone ) return false; | 146 | if ( mData->timeZone != a.mData->timeZone ) return false; |
147 | if ( mData->geo != a.mData->geo ) return false; | 147 | if ( mData->geo != a.mData->geo ) return false; |
148 | if ( mData->title != a.mData->title ) return false; | 148 | if ( mData->title != a.mData->title ) return false; |
149 | if ( mData->role != a.mData->role ) return false; | 149 | if ( mData->role != a.mData->role ) return false; |
150 | if ( mData->organization != a.mData->organization ) return false; | 150 | if ( mData->organization != a.mData->organization ) return false; |
151 | if ( mData->note != a.mData->note ) return false; | 151 | if ( mData->note != a.mData->note ) return false; |
152 | if ( mData->productId != a.mData->productId ) return false; | 152 | if ( mData->productId != a.mData->productId ) return false; |
153 | //if ( mData->revision != a.mData->revision ) return false; | 153 | //if ( mData->revision != a.mData->revision ) return false; |
154 | if ( mData->sortString != a.mData->sortString ) return false; | 154 | if ( mData->sortString != a.mData->sortString ) return false; |
155 | if ( mData->secrecy != a.mData->secrecy ) return false; | 155 | if ( mData->secrecy != a.mData->secrecy ) return false; |
156 | if ( mData->logo != a.mData->logo ) return false; | 156 | if ( mData->logo != a.mData->logo ) return false; |
157 | if ( mData->photo != a.mData->photo ) return false; | 157 | if ( mData->photo != a.mData->photo ) return false; |
158 | if ( mData->sound != a.mData->sound ) return false; | 158 | if ( mData->sound != a.mData->sound ) return false; |
159 | if ( mData->agent != a.mData->agent ) return false; | 159 | if ( mData->agent != a.mData->agent ) return false; |
160 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 160 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
161 | ( mData->url != a.mData->url ) ) return false; | 161 | ( mData->url != a.mData->url ) ) return false; |
162 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 162 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
163 | if ( mData->addresses != a.mData->addresses ) return false; | 163 | if ( mData->addresses != a.mData->addresses ) return false; |
164 | if ( mData->keys != a.mData->keys ) return false; | 164 | if ( mData->keys != a.mData->keys ) return false; |
165 | if ( mData->emails != a.mData->emails ) return false; | 165 | if ( mData->emails != a.mData->emails ) return false; |
166 | if ( mData->categories != a.mData->categories ) return false; | 166 | if ( mData->categories != a.mData->categories ) return false; |
167 | if ( mData->custom != a.mData->custom ) return false; | 167 | if ( mData->custom != a.mData->custom ) return false; |
168 | 168 | ||
169 | return true; | 169 | return true; |
170 | } | 170 | } |
171 | 171 | ||
172 | bool Addressee::operator!=( const Addressee &a ) const | 172 | bool Addressee::operator!=( const Addressee &a ) const |
173 | { | 173 | { |
174 | return !( a == *this ); | 174 | return !( a == *this ); |
175 | } | 175 | } |
176 | 176 | ||
177 | bool Addressee::isEmpty() const | 177 | bool Addressee::isEmpty() const |
178 | { | 178 | { |
179 | return mData->empty; | 179 | return mData->empty; |
180 | } | 180 | } |
181 | ulong Addressee::getCsum4List( const QStringList & attList) | 181 | ulong Addressee::getCsum4List( const QStringList & attList) |
182 | { | 182 | { |
183 | int max = attList.count(); | 183 | int max = attList.count(); |
184 | ulong cSum = 0; | 184 | ulong cSum = 0; |
185 | int j,k,i; | 185 | int j,k,i; |
186 | int add; | 186 | int add; |
187 | for ( i = 0; i < max ; ++i ) { | 187 | for ( i = 0; i < max ; ++i ) { |
188 | QString s = attList[i]; | 188 | QString s = attList[i]; |
189 | if ( ! s.isEmpty() ){ | 189 | if ( ! s.isEmpty() ){ |
190 | j = s.length(); | 190 | j = s.length(); |
191 | for ( k = 0; k < j; ++k ) { | 191 | for ( k = 0; k < j; ++k ) { |
192 | int mul = k +1; | 192 | int mul = k +1; |
193 | add = s[k].unicode (); | 193 | add = s[k].unicode (); |
194 | if ( k < 16 ) | 194 | if ( k < 16 ) |
195 | mul = mul * mul; | 195 | mul = mul * mul; |
196 | int ii = i+1; | 196 | int ii = i+1; |
197 | add = add * mul *ii*ii*ii; | 197 | add = add * mul *ii*ii*ii; |
198 | cSum += add; | 198 | cSum += add; |
199 | //qDebug("csum: %d %d %d", i,k,cSum); | 199 | //qDebug("csum: %d %d %d", i,k,cSum); |
200 | } | 200 | } |
201 | } | 201 | } |
202 | 202 | ||
203 | } | 203 | } |
204 | //QString dump = attList.join(","); | 204 | //QString dump = attList.join(","); |
205 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 205 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
206 | 206 | ||
207 | return cSum; | 207 | return cSum; |
208 | 208 | ||
209 | } | 209 | } |
210 | void Addressee::computeCsum(const QString &dev) | 210 | void Addressee::computeCsum(const QString &dev) |
211 | { | 211 | { |
212 | QStringList l; | 212 | QStringList l; |
213 | //if ( !mData->name.isEmpty() ) l.append(mData->name); | 213 | //if ( !mData->name.isEmpty() ) l.append(mData->name); |
214 | //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 214 | //if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
215 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 215 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
216 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 216 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
217 | if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); | 217 | if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); |
218 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 218 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
219 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 219 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
220 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 220 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
221 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 221 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
222 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 222 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
223 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 223 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
224 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 224 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
225 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 225 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
226 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 226 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
227 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 227 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
228 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 228 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
229 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 229 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
230 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 230 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
231 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 231 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
232 | if ( !mData->logo.undefined() ) { | 232 | if ( !mData->logo.undefined() ) { |
233 | if ( !mData->logo.isIntern() ) | 233 | if ( !mData->logo.isIntern() ) |
234 | l.append( mData->logo.url() ); | 234 | l.append( mData->logo.url() ); |
235 | else | 235 | else |
236 | 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())); |
237 | } else { | 237 | } else { |
238 | l.append( "nologo"); | 238 | l.append( "nologo"); |
239 | } | 239 | } |
240 | if ( !mData->photo.undefined() ) { | 240 | if ( !mData->photo.undefined() ) { |
241 | if ( !mData->photo.isIntern() ) | 241 | if ( !mData->photo.isIntern() ) |
242 | l.append( mData->photo.url() ); | 242 | l.append( mData->photo.url() ); |
243 | else | 243 | else |
244 | 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())); |
245 | } else { | 245 | } else { |
246 | l.append( "nophoto"); | 246 | l.append( "nophoto"); |
247 | } | 247 | } |
248 | #if 0 | 248 | #if 0 |
249 | if ( !mData->sound.undefined() ) { | 249 | if ( !mData->sound.undefined() ) { |
250 | if ( !mData->sound.isIntern() ) | 250 | if ( !mData->sound.isIntern() ) |
251 | l.append( mData->sound.url() ); | 251 | l.append( mData->sound.url() ); |
252 | else | 252 | else |
253 | l.append( QString(mData->sound.data().with()* mData->sound.data().height())); | 253 | l.append( QString(mData->sound.data().with()* mData->sound.data().height())); |
254 | } else { | 254 | } else { |
255 | l.append( "nosound"); | 255 | l.append( "nosound"); |
256 | } | 256 | } |
257 | #endif | 257 | #endif |
258 | //if ( !mData->agent.isEmpty() ) l.append( ); | 258 | //if ( !mData->agent.isEmpty() ) l.append( ); |
259 | if ( mData->url.isValid() ) | 259 | if ( mData->url.isValid() ) |
260 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); | 260 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); |
261 | KABC::PhoneNumber::List phoneNumbers; | 261 | KABC::PhoneNumber::List phoneNumbers; |
262 | KABC::PhoneNumber::List::Iterator phoneIter; | 262 | KABC::PhoneNumber::List::Iterator phoneIter; |
263 | 263 | ||
264 | QStringList t; | 264 | QStringList t; |
265 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 265 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
266 | ++phoneIter ) | 266 | ++phoneIter ) |
267 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 267 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
268 | t.sort(); | 268 | t.sort(); |
269 | uint iii; | 269 | uint iii; |
270 | for ( iii = 0; iii < t.count(); ++iii) | 270 | for ( iii = 0; iii < t.count(); ++iii) |
271 | l.append( t[iii] ); | 271 | l.append( t[iii] ); |
272 | t = mData->emails; | 272 | t = mData->emails; |
273 | t.sort(); | 273 | t.sort(); |
274 | for ( iii = 0; iii < t.count(); ++iii) | 274 | for ( iii = 0; iii < t.count(); ++iii) |
275 | l.append( t[iii] ); | 275 | l.append( t[iii] ); |
276 | t = mData->categories; | 276 | t = mData->categories; |
277 | t.sort(); | 277 | t.sort(); |
278 | for ( iii = 0; iii < t.count(); ++iii) | 278 | for ( iii = 0; iii < t.count(); ++iii) |
279 | l.append( t[iii] ); | 279 | l.append( t[iii] ); |
280 | t = mData->custom; | 280 | t = mData->custom; |
281 | t.sort(); | 281 | t.sort(); |
282 | for ( iii = 0; iii < t.count(); ++iii) | 282 | for ( iii = 0; iii < t.count(); ++iii) |
283 | if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { | 283 | if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { |
284 | int find = t[iii].find (':')+1; | 284 | int find = t[iii].find (':')+1; |
285 | //qDebug("lennnn %d %d ", find, t[iii].length()); | 285 | //qDebug("lennnn %d %d ", find, t[iii].length()); |
286 | if ( find < t[iii].length()) | 286 | if ( find < t[iii].length()) |
287 | l.append( t[iii] ); | 287 | l.append( t[iii] ); |
288 | 288 | ||
289 | } | 289 | } |
290 | KABC::Address::List::Iterator addressIter; | 290 | KABC::Address::List::Iterator addressIter; |
291 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 291 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
292 | ++addressIter ) { | 292 | ++addressIter ) { |
293 | t = (*addressIter).asList(); | 293 | t = (*addressIter).asList(); |
294 | t.sort(); | 294 | t.sort(); |
295 | for ( iii = 0; iii < t.count(); ++iii) | 295 | for ( iii = 0; iii < t.count(); ++iii) |
296 | l.append( t[iii] ); | 296 | l.append( t[iii] ); |
297 | } | 297 | } |
298 | uint cs = getCsum4List(l); | 298 | uint cs = getCsum4List(l); |
299 | 299 | ||
300 | #if 0 | 300 | #if 0 |
301 | for ( iii = 0; iii < l.count(); ++iii) | 301 | for ( iii = 0; iii < l.count(); ++iii) |
302 | qDebug("%d***%s***",iii,l[iii].latin1()); | 302 | qDebug("%d***%s***",iii,l[iii].latin1()); |
303 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 303 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
304 | #endif | 304 | #endif |
305 | 305 | ||
306 | 306 | ||
307 | setCsum( dev, QString::number (cs )); | 307 | setCsum( dev, QString::number (cs )); |
308 | } | 308 | } |
309 | bool Addressee::matchAddress( QRegExp* re ) const | ||
310 | { | ||
311 | KABC::Address::List::Iterator addressIter; | ||
312 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | ||
313 | ++addressIter ) { | ||
314 | if ( (*addressIter).matchAddress( re ) ) | ||
315 | return true; | ||
316 | } | ||
317 | return false; | ||
318 | } | ||
319 | bool Addressee::matchPhoneNumber( QRegExp* re ) const | ||
320 | { | ||
321 | KABC::PhoneNumber::List::Iterator phoneIter; | ||
322 | |||
323 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) { | ||
324 | #if QT_VERSION >= 0x030000 | ||
325 | if (re->search( (*phoneIter).number() ) == 0) | ||
326 | #else | ||
327 | if (re->match( (*phoneIter).number() ) == 0) | ||
328 | #endif | ||
329 | return true; | ||
309 | 330 | ||
331 | } | ||
332 | return false; | ||
333 | |||
334 | } | ||
310 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | 335 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) |
311 | { | 336 | { |
312 | // merge all standard non-outlook fields. | 337 | // merge all standard non-outlook fields. |
313 | //if isSubSet (e.g. mobile phone sync) merge all fields | 338 | //if isSubSet (e.g. mobile phone sync) merge all fields |
314 | 339 | ||
315 | detach(); | 340 | detach(); |
316 | if ( isSubSet ) { | 341 | if ( isSubSet ) { |
317 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 342 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
318 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 343 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
319 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 344 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
320 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 345 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
321 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 346 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
322 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 347 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
323 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 348 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
324 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | 349 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; |
325 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | 350 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; |
326 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 351 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
327 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | 352 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; |
328 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | 353 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; |
329 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | 354 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; |
330 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | 355 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; |
331 | if ( !mData->birthday.isValid() ) | 356 | if ( !mData->birthday.isValid() ) |
332 | if ( ad.mData->birthday.isValid()) | 357 | if ( ad.mData->birthday.isValid()) |
333 | mData->birthday = ad.mData->birthday; | 358 | mData->birthday = ad.mData->birthday; |
334 | 359 | ||
335 | } | 360 | } |
336 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 361 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
337 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 362 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
338 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 363 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
339 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 364 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
340 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 365 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
341 | QStringList t; | 366 | QStringList t; |
342 | QStringList tAD; | 367 | QStringList tAD; |
343 | uint iii; | 368 | uint iii; |
344 | 369 | ||
345 | // ********** phone numbers | 370 | // ********** phone numbers |
346 | if ( isSubSet ) { | 371 | if ( isSubSet ) { |
347 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 372 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
348 | PhoneNumber::List::Iterator phoneItAD; | 373 | PhoneNumber::List::Iterator phoneItAD; |
349 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 374 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
350 | bool found = false; | 375 | bool found = false; |
351 | PhoneNumber::List::Iterator it; | 376 | PhoneNumber::List::Iterator it; |
352 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 377 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
353 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 378 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
354 | found = true; | 379 | found = true; |
355 | (*it).setType( ( *phoneItAD ).type() ); | 380 | (*it).setType( ( *phoneItAD ).type() ); |
356 | (*it).setNumber( ( *phoneItAD ).number() ); | 381 | (*it).setNumber( ( *phoneItAD ).number() ); |
357 | break; | 382 | break; |
358 | } | 383 | } |
359 | } | 384 | } |
360 | // if ( isSubSet && ! found ) | 385 | // if ( isSubSet && ! found ) |
361 | if ( ! found ) // LR try this one... | 386 | if ( ! found ) // LR try this one... |
362 | mData->phoneNumbers.append( *phoneItAD ); | 387 | mData->phoneNumbers.append( *phoneItAD ); |
363 | } | 388 | } |
364 | } else { | 389 | } else { |
365 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 390 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
366 | PhoneNumber::List::Iterator phoneItAD; | 391 | PhoneNumber::List::Iterator phoneItAD; |
367 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 392 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
368 | bool found = false; | 393 | bool found = false; |
369 | PhoneNumber::List::Iterator it; | 394 | PhoneNumber::List::Iterator it; |
370 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 395 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
371 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 396 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
372 | found = true; | 397 | found = true; |
373 | (*it).setType( ( *phoneItAD ).type() ); | 398 | (*it).setType( ( *phoneItAD ).type() ); |
374 | (*it).setNumber( ( *phoneItAD ).number() ); | 399 | (*it).setNumber( ( *phoneItAD ).number() ); |
375 | break; | 400 | break; |
376 | } | 401 | } |
377 | } | 402 | } |
378 | if ( ! found ) { // append numbers which do not have work or home type | 403 | if ( ! found ) { // append numbers which do not have work or home type |
379 | if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) ) | 404 | if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) ) |
380 | mData->phoneNumbers.append( *phoneItAD ); | 405 | mData->phoneNumbers.append( *phoneItAD ); |
381 | } | 406 | } |
382 | } | 407 | } |
383 | } | 408 | } |
384 | if ( isSubSet ) { | 409 | if ( isSubSet ) { |
385 | // ************* emails; | 410 | // ************* emails; |
386 | t = mData->emails; | 411 | t = mData->emails; |
387 | tAD = ad.mData->emails; | 412 | tAD = ad.mData->emails; |
388 | for ( iii = 0; iii < tAD.count(); ++iii) | 413 | for ( iii = 0; iii < tAD.count(); ++iii) |
389 | if ( !t.contains(tAD[iii] ) ) | 414 | if ( !t.contains(tAD[iii] ) ) |
390 | mData->emails.append( tAD[iii] ); | 415 | mData->emails.append( tAD[iii] ); |
391 | } | 416 | } |
392 | 417 | ||
393 | // ************* categories; | 418 | // ************* categories; |
394 | if ( isSubSet ) { | 419 | if ( isSubSet ) { |
395 | t = mData->categories; | 420 | t = mData->categories; |
396 | tAD = ad.mData->categories; | 421 | tAD = ad.mData->categories; |
397 | for ( iii = 0; iii < tAD.count(); ++iii) | 422 | for ( iii = 0; iii < tAD.count(); ++iii) |
398 | if ( !t.contains(tAD[iii] ) ) | 423 | if ( !t.contains(tAD[iii] ) ) |
399 | mData->categories.append( tAD[iii] ); | 424 | mData->categories.append( tAD[iii] ); |
400 | } | 425 | } |
401 | QStringList::ConstIterator it; | 426 | QStringList::ConstIterator it; |
402 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { | 427 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { |
403 | QString qualifiedName = (*it).left( (*it).find( ":" )); | 428 | QString qualifiedName = (*it).left( (*it).find( ":" )); |
404 | bool found = false; | 429 | bool found = false; |
405 | QStringList::ConstIterator itL; | 430 | QStringList::ConstIterator itL; |
406 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { | 431 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { |
407 | if ( (*itL).startsWith( qualifiedName ) ) { | 432 | if ( (*itL).startsWith( qualifiedName ) ) { |
408 | found = true; | 433 | found = true; |
409 | break; | 434 | break; |
410 | } | 435 | } |
411 | } | 436 | } |
412 | if ( ! found ) { | 437 | if ( ! found ) { |
413 | mData->custom.append( *it ); | 438 | mData->custom.append( *it ); |
414 | } | 439 | } |
415 | } | 440 | } |
416 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; | 441 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; |
417 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; | 442 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; |
418 | if ( !mData->sound.isIntern() ) { | 443 | if ( !mData->sound.isIntern() ) { |
419 | if ( mData->sound.url().isEmpty() ) { | 444 | if ( mData->sound.url().isEmpty() ) { |
420 | mData->sound = ad.mData->sound; | 445 | mData->sound = ad.mData->sound; |
421 | } | 446 | } |
422 | } | 447 | } |
423 | if ( !mData->agent.isIntern() ) { | 448 | if ( !mData->agent.isIntern() ) { |
424 | if ( mData->agent.url().isEmpty() ) { | 449 | if ( mData->agent.url().isEmpty() ) { |
425 | mData->agent = ad.mData->agent; | 450 | mData->agent = ad.mData->agent; |
426 | } | 451 | } |
427 | } | 452 | } |
428 | { | 453 | { |
429 | Key::List::Iterator itA; | 454 | Key::List::Iterator itA; |
430 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { | 455 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { |
431 | bool found = false; | 456 | bool found = false; |
432 | Key::List::Iterator it; | 457 | Key::List::Iterator it; |
433 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 458 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
434 | if ( (*it) == (*itA)) { | 459 | if ( (*it) == (*itA)) { |
435 | found = true; | 460 | found = true; |
436 | break; | 461 | break; |
437 | 462 | ||
438 | } | 463 | } |
439 | } | 464 | } |
440 | if ( ! found ) { | 465 | if ( ! found ) { |
441 | mData->keys.append( *itA ); | 466 | mData->keys.append( *itA ); |
442 | } | 467 | } |
443 | } | 468 | } |
444 | } | 469 | } |
445 | if ( isSubSet ) { | 470 | if ( isSubSet ) { |
446 | KABC::Address::List::Iterator addressIterA; | 471 | KABC::Address::List::Iterator addressIterA; |
447 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { | 472 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { |
448 | bool found = false; | 473 | bool found = false; |
449 | KABC::Address::List::Iterator addressIter; | 474 | KABC::Address::List::Iterator addressIter; |
450 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 475 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
451 | ++addressIter ) { | 476 | ++addressIter ) { |
452 | if ( (*addressIter) == (*addressIterA)) { | 477 | if ( (*addressIter) == (*addressIterA)) { |
453 | found = true; | 478 | found = true; |
454 | (*addressIter).setType( (*addressIterA).type() ); | 479 | (*addressIter).setType( (*addressIterA).type() ); |
455 | break; | 480 | break; |
456 | } | 481 | } |
457 | 482 | ||
458 | } | 483 | } |
459 | if ( isSubSet && ! found ) { | 484 | if ( isSubSet && ! found ) { |
460 | mData->addresses.append( *addressIterA ); | 485 | mData->addresses.append( *addressIterA ); |
461 | } | 486 | } |
462 | } | 487 | } |
463 | } | 488 | } |
464 | //qDebug("merge contact %s ", ad.uid().latin1()); | 489 | //qDebug("merge contact %s ", ad.uid().latin1()); |
465 | setUid( ad.uid() ); | 490 | setUid( ad.uid() ); |
466 | setRevision( ad.revision() ); | 491 | setRevision( ad.revision() ); |
467 | } | 492 | } |
468 | 493 | ||
469 | bool Addressee::removeVoice() | 494 | bool Addressee::removeVoice() |
470 | { | 495 | { |
471 | PhoneNumber::List phoneN = phoneNumbers(); | 496 | PhoneNumber::List phoneN = phoneNumbers(); |
472 | PhoneNumber::List::Iterator phoneIt; | 497 | PhoneNumber::List::Iterator phoneIt; |
473 | bool found = false; | 498 | bool found = false; |
474 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 499 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
475 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 500 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
476 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 501 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
477 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 502 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
478 | insertPhoneNumber( (*phoneIt) ); | 503 | insertPhoneNumber( (*phoneIt) ); |
479 | found = true; | 504 | found = true; |
480 | } | 505 | } |
481 | } | 506 | } |
482 | 507 | ||
483 | } | 508 | } |
484 | return found; | 509 | return found; |
485 | } | 510 | } |
486 | 511 | ||
487 | bool Addressee::containsAdr(const Addressee& ad ) | 512 | bool Addressee::containsAdr(const Addressee& ad ) |
488 | { | 513 | { |
489 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; | 514 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; |
490 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; | 515 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; |
491 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; | 516 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; |
492 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; | 517 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; |
493 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; | 518 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; |
494 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; | 519 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; |
495 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; | 520 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; |
496 | 521 | ||
497 | // compare phone numbers | 522 | // compare phone numbers |
498 | PhoneNumber::List phoneN = ad.phoneNumbers(); | 523 | PhoneNumber::List phoneN = ad.phoneNumbers(); |
499 | PhoneNumber::List::Iterator phoneIt; | 524 | PhoneNumber::List::Iterator phoneIt; |
500 | bool found = false; | 525 | bool found = false; |
501 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 526 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
502 | bool found = false; | 527 | bool found = false; |
503 | PhoneNumber::List phoneL = ad.phoneNumbers(); | 528 | PhoneNumber::List phoneL = ad.phoneNumbers(); |
504 | PhoneNumber::List::Iterator phoneItL; | 529 | PhoneNumber::List::Iterator phoneItL; |
505 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { | 530 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { |
506 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { | 531 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { |
507 | found = true; | 532 | found = true; |
508 | break; | 533 | break; |
509 | } | 534 | } |
510 | } | 535 | } |
511 | if ( ! found ) | 536 | if ( ! found ) |
512 | return false; | 537 | return false; |
513 | } | 538 | } |
514 | return true; | 539 | return true; |
515 | 540 | ||
516 | } | 541 | } |
517 | void Addressee::simplifyAddresses() | 542 | void Addressee::simplifyAddresses() |
518 | { | 543 | { |
519 | 544 | ||
520 | 545 | ||
521 | Address::List list; | 546 | Address::List list; |
522 | Address::List::Iterator it; | 547 | Address::List::Iterator it; |
523 | Address::List::Iterator it2; | 548 | Address::List::Iterator it2; |
524 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 549 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
525 | it2 = it; | 550 | it2 = it; |
526 | ++it2; | 551 | ++it2; |
527 | for( ; it2 != mData->addresses.end(); ++it2 ) { | 552 | for( ; it2 != mData->addresses.end(); ++it2 ) { |
528 | if ( (*it) == (*it2) ) { | 553 | if ( (*it) == (*it2) ) { |
529 | list.append( *it ); | 554 | list.append( *it ); |
530 | break; | 555 | break; |
531 | } | 556 | } |
532 | } | 557 | } |
533 | } | 558 | } |
534 | for( it = list.begin(); it != list.end(); ++it ) { | 559 | for( it = list.begin(); it != list.end(); ++it ) { |
535 | removeAddress( (*it) ); | 560 | removeAddress( (*it) ); |
536 | } | 561 | } |
537 | 562 | ||
538 | list.clear(); | 563 | list.clear(); |
539 | int max = 2; | 564 | int max = 2; |
540 | if ( mData->url.isValid() ) | 565 | if ( mData->url.isValid() ) |
541 | max = 1; | 566 | max = 1; |
542 | if ( mData->addresses.count() <= max ) return ; | 567 | if ( mData->addresses.count() <= max ) return ; |
543 | int count = 0; | 568 | int count = 0; |
544 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 569 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
545 | if ( count >= max ) | 570 | if ( count >= max ) |
546 | list.append( *it ); | 571 | list.append( *it ); |
547 | ++count; | 572 | ++count; |
548 | } | 573 | } |
549 | for( it = list.begin(); it != list.end(); ++it ) { | 574 | for( it = list.begin(); it != list.end(); ++it ) { |
550 | removeAddress( (*it) ); | 575 | removeAddress( (*it) ); |
551 | } | 576 | } |
552 | } | 577 | } |
553 | 578 | ||
554 | // removes all emails but the first | 579 | // removes all emails but the first |
555 | // needed by phone sync | 580 | // needed by phone sync |
556 | void Addressee::simplifyEmails() | 581 | void Addressee::simplifyEmails() |
557 | { | 582 | { |
558 | if ( mData->emails.count() == 0 ) return ; | 583 | if ( mData->emails.count() == 0 ) return ; |
559 | QString email = mData->emails.first(); | 584 | QString email = mData->emails.first(); |
560 | detach(); | 585 | detach(); |
561 | mData->emails.clear(); | 586 | mData->emails.clear(); |
562 | mData->emails.append( email ); | 587 | mData->emails.append( email ); |
563 | } | 588 | } |
564 | 589 | ||
565 | void Addressee::simplifyPhoneNumbers() | 590 | void Addressee::simplifyPhoneNumbers() |
566 | { | 591 | { |
567 | int max = 4; | 592 | int max = 4; |
568 | int inList = mData->phoneNumbers.count(); | 593 | int inList = mData->phoneNumbers.count(); |
569 | KABC::PhoneNumber::List removeNumbers; | 594 | KABC::PhoneNumber::List removeNumbers; |
570 | KABC::PhoneNumber::List::Iterator phoneIter; | 595 | KABC::PhoneNumber::List::Iterator phoneIter; |
571 | if ( inList > max ) { | 596 | if ( inList > max ) { |
572 | // delete non-preferred numbers | 597 | // delete non-preferred numbers |
573 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 598 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
574 | ++phoneIter ) { | 599 | ++phoneIter ) { |
575 | if ( inList > max ) { | 600 | if ( inList > max ) { |
576 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { | 601 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { |
577 | removeNumbers.append( ( *phoneIter ) ); | 602 | removeNumbers.append( ( *phoneIter ) ); |
578 | --inList; | 603 | --inList; |
579 | } | 604 | } |
580 | } else | 605 | } else |
581 | break; | 606 | break; |
582 | } | 607 | } |
583 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 608 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
584 | ++phoneIter ) { | 609 | ++phoneIter ) { |
585 | removePhoneNumber(( *phoneIter )); | 610 | removePhoneNumber(( *phoneIter )); |
586 | } | 611 | } |
587 | // delete preferred numbers | 612 | // delete preferred numbers |
588 | if ( inList > max ) { | 613 | if ( inList > max ) { |
589 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 614 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
590 | ++phoneIter ) { | 615 | ++phoneIter ) { |
591 | if ( inList > max ) { | 616 | if ( inList > max ) { |
592 | removeNumbers.append( ( *phoneIter ) ); | 617 | removeNumbers.append( ( *phoneIter ) ); |
593 | --inList; | 618 | --inList; |
594 | } else | 619 | } else |
595 | break; | 620 | break; |
596 | } | 621 | } |
597 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 622 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
598 | ++phoneIter ) { | 623 | ++phoneIter ) { |
599 | removePhoneNumber(( *phoneIter )); | 624 | removePhoneNumber(( *phoneIter )); |
600 | } | 625 | } |
601 | } | 626 | } |
602 | } | 627 | } |
603 | // remove non-numeric characters | 628 | // remove non-numeric characters |
604 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 629 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
605 | ++phoneIter ) { | 630 | ++phoneIter ) { |
606 | if ( ! ( *phoneIter ).simplifyNumber() ) | 631 | if ( ! ( *phoneIter ).simplifyNumber() ) |
607 | removeNumbers.append( ( *phoneIter ) ); | 632 | removeNumbers.append( ( *phoneIter ) ); |
608 | } | 633 | } |
609 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 634 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
610 | ++phoneIter ) { | 635 | ++phoneIter ) { |
611 | removePhoneNumber(( *phoneIter )); | 636 | removePhoneNumber(( *phoneIter )); |
612 | } | 637 | } |
613 | } | 638 | } |
614 | void Addressee::simplifyPhoneNumberTypes() | 639 | void Addressee::simplifyPhoneNumberTypes() |
615 | { | 640 | { |
616 | KABC::PhoneNumber::List::Iterator phoneIter; | 641 | KABC::PhoneNumber::List::Iterator phoneIter; |
617 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 642 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
618 | ++phoneIter ) | 643 | ++phoneIter ) |
619 | ( *phoneIter ).simplifyType(); | 644 | ( *phoneIter ).simplifyType(); |
620 | } | 645 | } |
621 | void Addressee::removeID(const QString &prof) | 646 | void Addressee::removeID(const QString &prof) |
622 | { | 647 | { |
623 | detach(); | 648 | detach(); |
624 | if ( prof.isEmpty() ) | 649 | if ( prof.isEmpty() ) |
625 | mData->mExternalId = ":"; | 650 | mData->mExternalId = ":"; |
626 | else | 651 | else |
627 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 652 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
628 | 653 | ||
629 | } | 654 | } |
630 | void Addressee::setID( const QString & prof , const QString & id ) | 655 | void Addressee::setID( const QString & prof , const QString & id ) |
631 | { | 656 | { |
632 | detach(); | 657 | detach(); |
633 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 658 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
634 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 659 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
635 | } | 660 | } |
636 | void Addressee::setTempSyncStat( int id ) | 661 | void Addressee::setTempSyncStat( int id ) |
637 | { | 662 | { |
638 | if ( mData->mTempSyncStat == id ) return; | 663 | if ( mData->mTempSyncStat == id ) return; |
639 | detach(); | 664 | detach(); |
640 | mData->mTempSyncStat = id; | 665 | mData->mTempSyncStat = id; |
641 | } | 666 | } |
642 | int Addressee::tempSyncStat() const | 667 | int Addressee::tempSyncStat() const |
643 | { | 668 | { |
644 | return mData->mTempSyncStat; | 669 | return mData->mTempSyncStat; |
645 | } | 670 | } |
646 | 671 | ||
647 | const QString Addressee::getID( const QString & prof) const | 672 | const QString Addressee::getID( const QString & prof) const |
648 | { | 673 | { |
649 | return KIdManager::getId ( mData->mExternalId, prof ); | 674 | return KIdManager::getId ( mData->mExternalId, prof ); |
650 | } | 675 | } |
651 | 676 | ||
652 | void Addressee::setCsum( const QString & prof , const QString & id ) | 677 | void Addressee::setCsum( const QString & prof , const QString & id ) |
653 | { | 678 | { |
654 | detach(); | 679 | detach(); |
655 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 680 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
656 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 681 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
657 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 682 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
658 | } | 683 | } |
659 | 684 | ||
660 | const QString Addressee::getCsum( const QString & prof) const | 685 | const QString Addressee::getCsum( const QString & prof) const |
661 | { | 686 | { |
662 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 687 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
663 | } | 688 | } |
664 | 689 | ||
665 | void Addressee::setIDStr( const QString & s ) | 690 | void Addressee::setIDStr( const QString & s ) |
666 | { | 691 | { |
667 | detach(); | 692 | detach(); |
668 | mData->mExternalId = s; | 693 | mData->mExternalId = s; |
669 | } | 694 | } |
670 | 695 | ||
671 | const QString Addressee::IDStr() const | 696 | const QString Addressee::IDStr() const |
672 | { | 697 | { |
673 | return mData->mExternalId; | 698 | return mData->mExternalId; |
674 | } | 699 | } |
675 | 700 | ||
676 | void Addressee::setExternalUID( const QString &id ) | 701 | void Addressee::setExternalUID( const QString &id ) |
677 | { | 702 | { |
678 | if ( id == mData->externalUID ) return; | 703 | if ( id == mData->externalUID ) return; |
679 | detach(); | 704 | detach(); |
680 | mData->empty = false; | 705 | mData->empty = false; |
681 | mData->externalUID = id; | 706 | mData->externalUID = id; |
682 | } | 707 | } |
683 | 708 | ||
684 | const QString Addressee::externalUID() const | 709 | const QString Addressee::externalUID() const |
685 | { | 710 | { |
686 | return mData->externalUID; | 711 | return mData->externalUID; |
687 | } | 712 | } |
688 | void Addressee::setOriginalExternalUID( const QString &id ) | 713 | void Addressee::setOriginalExternalUID( const QString &id ) |
689 | { | 714 | { |
690 | if ( id == mData->originalExternalUID ) return; | 715 | if ( id == mData->originalExternalUID ) return; |
691 | detach(); | 716 | detach(); |
692 | mData->empty = false; | 717 | mData->empty = false; |
693 | //qDebug("*******Set orig uid %s ", id.latin1()); | 718 | //qDebug("*******Set orig uid %s ", id.latin1()); |
694 | mData->originalExternalUID = id; | 719 | mData->originalExternalUID = id; |
695 | } | 720 | } |
696 | 721 | ||
697 | QString Addressee::originalExternalUID() const | 722 | QString Addressee::originalExternalUID() const |
698 | { | 723 | { |
699 | return mData->originalExternalUID; | 724 | return mData->originalExternalUID; |
700 | } | 725 | } |
701 | 726 | ||
702 | void Addressee::setUid( const QString &id ) | 727 | void Addressee::setUid( const QString &id ) |
703 | { | 728 | { |
704 | if ( id == mData->uid ) return; | 729 | if ( id == mData->uid ) return; |
705 | detach(); | 730 | detach(); |
706 | //qDebug("****setuid %s ", id.latin1()); | 731 | //qDebug("****setuid %s ", id.latin1()); |
707 | mData->empty = false; | 732 | mData->empty = false; |
708 | mData->uid = id; | 733 | mData->uid = id; |
709 | } | 734 | } |
710 | 735 | ||
711 | const QString Addressee::uid() const | 736 | const QString Addressee::uid() const |
712 | { | 737 | { |
713 | if ( mData->uid.isEmpty() ) | 738 | if ( mData->uid.isEmpty() ) |
714 | mData->uid = KApplication::randomString( 10 ); | 739 | mData->uid = KApplication::randomString( 10 ); |
715 | 740 | ||
716 | return mData->uid; | 741 | return mData->uid; |
717 | } | 742 | } |
718 | 743 | ||
719 | QString Addressee::uidLabel() | 744 | QString Addressee::uidLabel() |
720 | { | 745 | { |
721 | return i18n("Unique Identifier"); | 746 | return i18n("Unique Identifier"); |
722 | } | 747 | } |
723 | 748 | ||
724 | void Addressee::setName( const QString &name ) | 749 | void Addressee::setName( const QString &name ) |
725 | { | 750 | { |
726 | if ( name == mData->name ) return; | 751 | if ( name == mData->name ) return; |
727 | detach(); | 752 | detach(); |
728 | mData->empty = false; | 753 | mData->empty = false; |
729 | mData->name = name; | 754 | mData->name = name; |
730 | } | 755 | } |
731 | 756 | ||
732 | QString Addressee::name() const | 757 | QString Addressee::name() const |
733 | { | 758 | { |
734 | return mData->name; | 759 | return mData->name; |
735 | } | 760 | } |
736 | 761 | ||
737 | QString Addressee::nameLabel() | 762 | QString Addressee::nameLabel() |
738 | { | 763 | { |
739 | return i18n("Name"); | 764 | return i18n("Name"); |
740 | } | 765 | } |
741 | 766 | ||
742 | 767 | ||
743 | void Addressee::setFormattedName( const QString &formattedName ) | 768 | void Addressee::setFormattedName( const QString &formattedName ) |
744 | { | 769 | { |
745 | if ( formattedName == mData->formattedName ) return; | 770 | if ( formattedName == mData->formattedName ) return; |
746 | detach(); | 771 | detach(); |
747 | mData->empty = false; | 772 | mData->empty = false; |
748 | mData->formattedName = formattedName; | 773 | mData->formattedName = formattedName; |
749 | } | 774 | } |
750 | 775 | ||
751 | QString Addressee::formattedName() const | 776 | QString Addressee::formattedName() const |
752 | { | 777 | { |
753 | return mData->formattedName; | 778 | return mData->formattedName; |
754 | } | 779 | } |
755 | 780 | ||
756 | QString Addressee::formattedNameLabel() | 781 | QString Addressee::formattedNameLabel() |
757 | { | 782 | { |
758 | return i18n("Formatted Name"); | 783 | return i18n("Formatted Name"); |
759 | } | 784 | } |
760 | 785 | ||
761 | 786 | ||
762 | void Addressee::setFamilyName( const QString &familyName ) | 787 | void Addressee::setFamilyName( const QString &familyName ) |
763 | { | 788 | { |
764 | if ( familyName == mData->familyName ) return; | 789 | if ( familyName == mData->familyName ) return; |
765 | detach(); | 790 | detach(); |
766 | mData->empty = false; | 791 | mData->empty = false; |
767 | mData->familyName = familyName; | 792 | mData->familyName = familyName; |
768 | } | 793 | } |
769 | 794 | ||
770 | QString Addressee::familyName() const | 795 | QString Addressee::familyName() const |
771 | { | 796 | { |
772 | return mData->familyName; | 797 | return mData->familyName; |
773 | } | 798 | } |
774 | 799 | ||
775 | QString Addressee::familyNameLabel() | 800 | QString Addressee::familyNameLabel() |
776 | { | 801 | { |
777 | return i18n("Family Name"); | 802 | return i18n("Family Name"); |
778 | } | 803 | } |
779 | 804 | ||
780 | 805 | ||
781 | void Addressee::setGivenName( const QString &givenName ) | 806 | void Addressee::setGivenName( const QString &givenName ) |
782 | { | 807 | { |
783 | if ( givenName == mData->givenName ) return; | 808 | if ( givenName == mData->givenName ) return; |
784 | detach(); | 809 | detach(); |
785 | mData->empty = false; | 810 | mData->empty = false; |
786 | mData->givenName = givenName; | 811 | mData->givenName = givenName; |
787 | } | 812 | } |
788 | 813 | ||
789 | QString Addressee::givenName() const | 814 | QString Addressee::givenName() const |
790 | { | 815 | { |
791 | return mData->givenName; | 816 | return mData->givenName; |
792 | } | 817 | } |
793 | 818 | ||
794 | QString Addressee::givenNameLabel() | 819 | QString Addressee::givenNameLabel() |
795 | { | 820 | { |
796 | return i18n("Given Name"); | 821 | return i18n("Given Name"); |
797 | } | 822 | } |
798 | 823 | ||
799 | 824 | ||
800 | void Addressee::setAdditionalName( const QString &additionalName ) | 825 | void Addressee::setAdditionalName( const QString &additionalName ) |
801 | { | 826 | { |
802 | if ( additionalName == mData->additionalName ) return; | 827 | if ( additionalName == mData->additionalName ) return; |
803 | detach(); | 828 | detach(); |
804 | mData->empty = false; | 829 | mData->empty = false; |
805 | mData->additionalName = additionalName; | 830 | mData->additionalName = additionalName; |
806 | } | 831 | } |
807 | 832 | ||
808 | QString Addressee::additionalName() const | 833 | QString Addressee::additionalName() const |
809 | { | 834 | { |
810 | return mData->additionalName; | 835 | return mData->additionalName; |
811 | } | 836 | } |
812 | 837 | ||
813 | QString Addressee::additionalNameLabel() | 838 | QString Addressee::additionalNameLabel() |
814 | { | 839 | { |
815 | return i18n("Additional Names"); | 840 | return i18n("Additional Names"); |
816 | } | 841 | } |
817 | 842 | ||
818 | 843 | ||
819 | void Addressee::setPrefix( const QString &prefix ) | 844 | void Addressee::setPrefix( const QString &prefix ) |
820 | { | 845 | { |
821 | if ( prefix == mData->prefix ) return; | 846 | if ( prefix == mData->prefix ) return; |
822 | detach(); | 847 | detach(); |
823 | mData->empty = false; | 848 | mData->empty = false; |
824 | mData->prefix = prefix; | 849 | mData->prefix = prefix; |
825 | } | 850 | } |
826 | 851 | ||
827 | QString Addressee::prefix() const | 852 | QString Addressee::prefix() const |
828 | { | 853 | { |
829 | return mData->prefix; | 854 | return mData->prefix; |
830 | } | 855 | } |
831 | 856 | ||
832 | QString Addressee::prefixLabel() | 857 | QString Addressee::prefixLabel() |
833 | { | 858 | { |
834 | return i18n("Honorific Prefixes"); | 859 | return i18n("Honorific Prefixes"); |
835 | } | 860 | } |
836 | 861 | ||
837 | 862 | ||
838 | void Addressee::setSuffix( const QString &suffix ) | 863 | void Addressee::setSuffix( const QString &suffix ) |
839 | { | 864 | { |
840 | if ( suffix == mData->suffix ) return; | 865 | if ( suffix == mData->suffix ) return; |
841 | detach(); | 866 | detach(); |
842 | mData->empty = false; | 867 | mData->empty = false; |
843 | mData->suffix = suffix; | 868 | mData->suffix = suffix; |
844 | } | 869 | } |
845 | 870 | ||
846 | QString Addressee::suffix() const | 871 | QString Addressee::suffix() const |
847 | { | 872 | { |
848 | return mData->suffix; | 873 | return mData->suffix; |
849 | } | 874 | } |
850 | 875 | ||
851 | QString Addressee::suffixLabel() | 876 | QString Addressee::suffixLabel() |
852 | { | 877 | { |
853 | return i18n("Honorific Suffixes"); | 878 | return i18n("Honorific Suffixes"); |
854 | } | 879 | } |
855 | 880 | ||
856 | 881 | ||
857 | void Addressee::setNickName( const QString &nickName ) | 882 | void Addressee::setNickName( const QString &nickName ) |
858 | { | 883 | { |
859 | if ( nickName == mData->nickName ) return; | 884 | if ( nickName == mData->nickName ) return; |
860 | detach(); | 885 | detach(); |
861 | mData->empty = false; | 886 | mData->empty = false; |
862 | mData->nickName = nickName; | 887 | mData->nickName = nickName; |
863 | } | 888 | } |
864 | 889 | ||
865 | QString Addressee::nickName() const | 890 | QString Addressee::nickName() const |
866 | { | 891 | { |
867 | return mData->nickName; | 892 | return mData->nickName; |
868 | } | 893 | } |
869 | 894 | ||
870 | QString Addressee::nickNameLabel() | 895 | QString Addressee::nickNameLabel() |
871 | { | 896 | { |
872 | return i18n("Nick Name"); | 897 | return i18n("Nick Name"); |
873 | } | 898 | } |
874 | 899 | ||
875 | 900 | ||
876 | void Addressee::setBirthday( const QDateTime &birthday ) | 901 | void Addressee::setBirthday( const QDateTime &birthday ) |
877 | { | 902 | { |
878 | if ( birthday == mData->birthday ) return; | 903 | if ( birthday == mData->birthday ) return; |
879 | detach(); | 904 | detach(); |
880 | mData->empty = false; | 905 | mData->empty = false; |
881 | mData->birthday = birthday; | 906 | mData->birthday = birthday; |
882 | } | 907 | } |
883 | 908 | ||
884 | QDateTime Addressee::birthday() const | 909 | QDateTime Addressee::birthday() const |
885 | { | 910 | { |
886 | return mData->birthday; | 911 | return mData->birthday; |
887 | } | 912 | } |
888 | 913 | ||
889 | QString Addressee::birthdayLabel() | 914 | QString Addressee::birthdayLabel() |
890 | { | 915 | { |
891 | return i18n("Birthday"); | 916 | return i18n("Birthday"); |
892 | } | 917 | } |
893 | 918 | ||
894 | 919 | ||
895 | QString Addressee::homeAddressStreetLabel() | 920 | QString Addressee::homeAddressStreetLabel() |
896 | { | 921 | { |
897 | return i18n("Home Address Street"); | 922 | return i18n("Home Address Street"); |
898 | } | 923 | } |
899 | 924 | ||
900 | 925 | ||
901 | QString Addressee::homeAddressLocalityLabel() | 926 | QString Addressee::homeAddressLocalityLabel() |
902 | { | 927 | { |
903 | return i18n("Home Address Locality"); | 928 | return i18n("Home Address Locality"); |
904 | } | 929 | } |
905 | 930 | ||
906 | 931 | ||
907 | QString Addressee::homeAddressRegionLabel() | 932 | QString Addressee::homeAddressRegionLabel() |
908 | { | 933 | { |
909 | return i18n("Home Address Region"); | 934 | return i18n("Home Address Region"); |
910 | } | 935 | } |
911 | 936 | ||
912 | 937 | ||
913 | QString Addressee::homeAddressPostalCodeLabel() | 938 | QString Addressee::homeAddressPostalCodeLabel() |
914 | { | 939 | { |
915 | return i18n("Home Address Postal Code"); | 940 | return i18n("Home Address Postal Code"); |
916 | } | 941 | } |
917 | 942 | ||
918 | 943 | ||
919 | QString Addressee::homeAddressCountryLabel() | 944 | QString Addressee::homeAddressCountryLabel() |
920 | { | 945 | { |
921 | return i18n("Home Address Country"); | 946 | return i18n("Home Address Country"); |
922 | } | 947 | } |
923 | 948 | ||
924 | 949 | ||
925 | QString Addressee::homeAddressLabelLabel() | 950 | QString Addressee::homeAddressLabelLabel() |
926 | { | 951 | { |
927 | return i18n("Home Address Label"); | 952 | return i18n("Home Address Label"); |
928 | } | 953 | } |
929 | 954 | ||
930 | 955 | ||
931 | QString Addressee::businessAddressStreetLabel() | 956 | QString Addressee::businessAddressStreetLabel() |
932 | { | 957 | { |
933 | return i18n("Business Address Street"); | 958 | return i18n("Business Address Street"); |
934 | } | 959 | } |
935 | 960 | ||
936 | 961 | ||
937 | QString Addressee::businessAddressLocalityLabel() | 962 | QString Addressee::businessAddressLocalityLabel() |
938 | { | 963 | { |
939 | return i18n("Business Address Locality"); | 964 | return i18n("Business Address Locality"); |
940 | } | 965 | } |
941 | 966 | ||
942 | 967 | ||
943 | QString Addressee::businessAddressRegionLabel() | 968 | QString Addressee::businessAddressRegionLabel() |
944 | { | 969 | { |
945 | return i18n("Business Address Region"); | 970 | return i18n("Business Address Region"); |
946 | } | 971 | } |
947 | 972 | ||
948 | 973 | ||
949 | QString Addressee::businessAddressPostalCodeLabel() | 974 | QString Addressee::businessAddressPostalCodeLabel() |
950 | { | 975 | { |
951 | return i18n("Business Address Postal Code"); | 976 | return i18n("Business Address Postal Code"); |
952 | } | 977 | } |
953 | 978 | ||
954 | 979 | ||
955 | QString Addressee::businessAddressCountryLabel() | 980 | QString Addressee::businessAddressCountryLabel() |
956 | { | 981 | { |
957 | return i18n("Business Address Country"); | 982 | return i18n("Business Address Country"); |
958 | } | 983 | } |
959 | 984 | ||
960 | 985 | ||
961 | QString Addressee::businessAddressLabelLabel() | 986 | QString Addressee::businessAddressLabelLabel() |
962 | { | 987 | { |
963 | return i18n("Business Address Label"); | 988 | return i18n("Business Address Label"); |
964 | } | 989 | } |
965 | 990 | ||
966 | 991 | ||
967 | QString Addressee::homePhoneLabel() | 992 | QString Addressee::homePhoneLabel() |
968 | { | 993 | { |
969 | return i18n("Home Phone"); | 994 | return i18n("Home Phone"); |
970 | } | 995 | } |
971 | 996 | ||
972 | 997 | ||
973 | QString Addressee::businessPhoneLabel() | 998 | QString Addressee::businessPhoneLabel() |
974 | { | 999 | { |
975 | return i18n("Business Phone"); | 1000 | return i18n("Business Phone"); |
976 | } | 1001 | } |
977 | 1002 | ||
978 | 1003 | ||
979 | QString Addressee::mobilePhoneLabel() | 1004 | QString Addressee::mobilePhoneLabel() |
980 | { | 1005 | { |
981 | return i18n("Mobile Phone"); | 1006 | return i18n("Mobile Phone"); |
982 | } | 1007 | } |
983 | QString Addressee::mobileWorkPhoneLabel() | 1008 | QString Addressee::mobileWorkPhoneLabel() |
984 | { | 1009 | { |
985 | return i18n("Mobile (work)"); | 1010 | return i18n("Mobile (work)"); |
986 | } | 1011 | } |
987 | QString Addressee::mobileHomePhoneLabel() | 1012 | QString Addressee::mobileHomePhoneLabel() |
988 | { | 1013 | { |
989 | return i18n("Mobile (home)"); | 1014 | return i18n("Mobile (home)"); |
990 | } | 1015 | } |
991 | 1016 | ||
992 | 1017 | ||
993 | QString Addressee::homeFaxLabel() | 1018 | QString Addressee::homeFaxLabel() |
994 | { | 1019 | { |
995 | return i18n("Home Fax"); | 1020 | return i18n("Home Fax"); |
996 | } | 1021 | } |
997 | 1022 | ||
998 | 1023 | ||
999 | QString Addressee::businessFaxLabel() | 1024 | QString Addressee::businessFaxLabel() |
1000 | { | 1025 | { |
1001 | return i18n("Business Fax"); | 1026 | return i18n("Business Fax"); |
1002 | } | 1027 | } |
1003 | 1028 | ||
1004 | 1029 | ||
1005 | QString Addressee::carPhoneLabel() | 1030 | QString Addressee::carPhoneLabel() |
1006 | { | 1031 | { |
1007 | return i18n("Car Phone"); | 1032 | return i18n("Car Phone"); |
1008 | } | 1033 | } |
1009 | 1034 | ||
1010 | 1035 | ||
1011 | QString Addressee::isdnLabel() | 1036 | QString Addressee::isdnLabel() |
1012 | { | 1037 | { |
1013 | return i18n("ISDN"); | 1038 | return i18n("ISDN"); |
1014 | } | 1039 | } |
1015 | 1040 | ||
1016 | 1041 | ||
1017 | QString Addressee::pagerLabel() | 1042 | QString Addressee::pagerLabel() |
1018 | { | 1043 | { |
1019 | return i18n("Pager"); | 1044 | return i18n("Pager"); |
1020 | } | 1045 | } |
1021 | 1046 | ||
1022 | QString Addressee::sipLabel() | 1047 | QString Addressee::sipLabel() |
1023 | { | 1048 | { |
1024 | return i18n("SIP"); | 1049 | return i18n("SIP"); |
1025 | } | 1050 | } |
1026 | 1051 | ||
1027 | QString Addressee::emailLabel() | 1052 | QString Addressee::emailLabel() |
1028 | { | 1053 | { |
1029 | return i18n("Email Address"); | 1054 | return i18n("Email Address"); |
1030 | } | 1055 | } |
1031 | 1056 | ||
1032 | 1057 | ||
1033 | void Addressee::setMailer( const QString &mailer ) | 1058 | void Addressee::setMailer( const QString &mailer ) |
1034 | { | 1059 | { |
1035 | if ( mailer == mData->mailer ) return; | 1060 | if ( mailer == mData->mailer ) return; |
1036 | detach(); | 1061 | detach(); |
1037 | mData->empty = false; | 1062 | mData->empty = false; |
1038 | mData->mailer = mailer; | 1063 | mData->mailer = mailer; |
1039 | } | 1064 | } |
1040 | 1065 | ||
1041 | QString Addressee::mailer() const | 1066 | QString Addressee::mailer() const |
1042 | { | 1067 | { |
1043 | return mData->mailer; | 1068 | return mData->mailer; |
1044 | } | 1069 | } |
1045 | 1070 | ||
1046 | QString Addressee::mailerLabel() | 1071 | QString Addressee::mailerLabel() |
1047 | { | 1072 | { |
1048 | return i18n("Mail Client"); | 1073 | return i18n("Mail Client"); |
1049 | } | 1074 | } |
1050 | 1075 | ||
1051 | 1076 | ||
1052 | void Addressee::setTimeZone( const TimeZone &timeZone ) | 1077 | void Addressee::setTimeZone( const TimeZone &timeZone ) |
1053 | { | 1078 | { |
1054 | if ( timeZone == mData->timeZone ) return; | 1079 | if ( timeZone == mData->timeZone ) return; |
1055 | detach(); | 1080 | detach(); |
1056 | mData->empty = false; | 1081 | mData->empty = false; |
1057 | mData->timeZone = timeZone; | 1082 | mData->timeZone = timeZone; |
1058 | } | 1083 | } |
1059 | 1084 | ||
1060 | TimeZone Addressee::timeZone() const | 1085 | TimeZone Addressee::timeZone() const |
1061 | { | 1086 | { |
1062 | return mData->timeZone; | 1087 | return mData->timeZone; |
1063 | } | 1088 | } |
1064 | 1089 | ||
1065 | QString Addressee::timeZoneLabel() | 1090 | QString Addressee::timeZoneLabel() |
1066 | { | 1091 | { |
1067 | return i18n("Time Zone"); | 1092 | return i18n("Time Zone"); |
1068 | } | 1093 | } |
1069 | 1094 | ||
1070 | 1095 | ||
1071 | void Addressee::setGeo( const Geo &geo ) | 1096 | void Addressee::setGeo( const Geo &geo ) |
1072 | { | 1097 | { |
1073 | if ( geo == mData->geo ) return; | 1098 | if ( geo == mData->geo ) return; |
1074 | detach(); | 1099 | detach(); |
1075 | mData->empty = false; | 1100 | mData->empty = false; |
1076 | mData->geo = geo; | 1101 | mData->geo = geo; |
1077 | } | 1102 | } |