-rw-r--r-- | kabc/addressee.cpp | 75 |
1 files changed, 34 insertions, 41 deletions
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index cb10160..2aca559 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1,1170 +1,1163 @@ | |||
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 | } | 199 | } |
200 | } | 200 | } |
201 | 201 | ||
202 | } | 202 | } |
203 | //QString dump = attList.join(","); | 203 | //QString dump = attList.join(","); |
204 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 204 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
205 | 205 | ||
206 | return cSum; | 206 | return cSum; |
207 | 207 | ||
208 | } | 208 | } |
209 | void Addressee::computeCsum(const QString &dev) | 209 | void Addressee::computeCsum(const QString &dev) |
210 | { | 210 | { |
211 | QStringList l; | 211 | QStringList l; |
212 | if ( !mData->name.isEmpty() ) l.append(mData->name); | 212 | if ( !mData->name.isEmpty() ) l.append(mData->name); |
213 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 213 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
214 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 214 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
215 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 215 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
216 | if ( !mData->additionalName ) l.append( mData->additionalName ); | 216 | if ( !mData->additionalName ) l.append( mData->additionalName ); |
217 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 217 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
218 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 218 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
219 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 219 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
220 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 220 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
221 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 221 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
222 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 222 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
223 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 223 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
224 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 224 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
225 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 225 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
226 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 226 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
227 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 227 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
228 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 228 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
229 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 229 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
230 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 230 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
231 | // if ( !mData->logo.isEmpty() ) l.append( ); | 231 | // if ( !mData->logo.isEmpty() ) l.append( ); |
232 | //if ( !mData->photo.isEmpty() ) l.append( ); | 232 | //if ( !mData->photo.isEmpty() ) l.append( ); |
233 | //if ( !mData->sound.isEmpty() ) l.append( ); | 233 | //if ( !mData->sound.isEmpty() ) l.append( ); |
234 | //if ( !mData->agent.isEmpty() ) l.append( ); | 234 | //if ( !mData->agent.isEmpty() ) l.append( ); |
235 | if ( mData->url.isValid() ) | 235 | if ( mData->url.isValid() ) |
236 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); | 236 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); |
237 | KABC::PhoneNumber::List phoneNumbers; | 237 | KABC::PhoneNumber::List phoneNumbers; |
238 | KABC::PhoneNumber::List::Iterator phoneIter; | 238 | KABC::PhoneNumber::List::Iterator phoneIter; |
239 | 239 | ||
240 | QStringList t; | 240 | QStringList t; |
241 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 241 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
242 | ++phoneIter ) | 242 | ++phoneIter ) |
243 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 243 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
244 | t.sort(); | 244 | t.sort(); |
245 | uint iii; | 245 | uint iii; |
246 | for ( iii = 0; iii < t.count(); ++iii) | 246 | for ( iii = 0; iii < t.count(); ++iii) |
247 | l.append( t[iii] ); | 247 | l.append( t[iii] ); |
248 | t = mData->emails; | 248 | t = mData->emails; |
249 | t.sort(); | 249 | t.sort(); |
250 | for ( iii = 0; iii < t.count(); ++iii) | 250 | for ( iii = 0; iii < t.count(); ++iii) |
251 | l.append( t[iii] ); | 251 | l.append( t[iii] ); |
252 | t = mData->categories; | 252 | t = mData->categories; |
253 | t.sort(); | 253 | t.sort(); |
254 | for ( iii = 0; iii < t.count(); ++iii) | 254 | for ( iii = 0; iii < t.count(); ++iii) |
255 | l.append( t[iii] ); | 255 | l.append( t[iii] ); |
256 | t = mData->custom; | 256 | t = mData->custom; |
257 | t.sort(); | 257 | t.sort(); |
258 | for ( iii = 0; iii < t.count(); ++iii) | 258 | for ( iii = 0; iii < t.count(); ++iii) |
259 | l.append( t[iii] ); | 259 | l.append( t[iii] ); |
260 | KABC::Address::List::Iterator addressIter; | 260 | KABC::Address::List::Iterator addressIter; |
261 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 261 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
262 | ++addressIter ) { | 262 | ++addressIter ) { |
263 | t = (*addressIter).asList(); | 263 | t = (*addressIter).asList(); |
264 | t.sort(); | 264 | t.sort(); |
265 | for ( iii = 0; iii < t.count(); ++iii) | 265 | for ( iii = 0; iii < t.count(); ++iii) |
266 | l.append( t[iii] ); | 266 | l.append( t[iii] ); |
267 | } | 267 | } |
268 | uint cs = getCsum4List(l); | 268 | uint cs = getCsum4List(l); |
269 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 269 | // qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
270 | setCsum( dev, QString::number (cs )); | 270 | setCsum( dev, QString::number (cs )); |
271 | } | 271 | } |
272 | 272 | ||
273 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | 273 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) |
274 | { | 274 | { |
275 | 275 | ||
276 | detach(); | 276 | detach(); |
277 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 277 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
278 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 278 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
279 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 279 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
280 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 280 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
281 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 281 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; |
282 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 282 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
283 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 283 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
284 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 284 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
285 | if ( !mData->birthday.isValid() ) | 285 | if ( !mData->birthday.isValid() ) |
286 | if ( ad.mData->birthday.isValid()) | 286 | if ( ad.mData->birthday.isValid()) |
287 | mData->birthday = ad.mData->birthday; | 287 | mData->birthday = ad.mData->birthday; |
288 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 288 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
289 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 289 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
290 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 290 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
291 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | 291 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; |
292 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | 292 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; |
293 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | 293 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; |
294 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | 294 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; |
295 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 295 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
296 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 296 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
297 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | 297 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; |
298 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | 298 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; |
299 | QStringList t; | 299 | QStringList t; |
300 | QStringList tAD; | 300 | QStringList tAD; |
301 | uint iii; | 301 | uint iii; |
302 | if ( isSubSet ) { | 302 | if ( isSubSet ) { |
303 | // ********** phone numbers | 303 | // ********** phone numbers |
304 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 304 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
305 | PhoneNumber::List::Iterator phoneItAD; | 305 | PhoneNumber::List::Iterator phoneItAD; |
306 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 306 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
307 | bool found = false; | 307 | bool found = false; |
308 | PhoneNumber::List::Iterator it; | 308 | PhoneNumber::List::Iterator it; |
309 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 309 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
310 | if ( (*it) == ( *phoneItAD ) ) { | 310 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
311 | found = true; | 311 | found = true; |
312 | (*it).setType( ( *phoneItAD ).type() ); | ||
312 | break; | 313 | break; |
313 | } | 314 | } |
314 | } | 315 | } |
315 | if ( ! found ) | 316 | if ( ! found ) |
316 | mData->phoneNumbers.append( *phoneItAD ); | 317 | mData->phoneNumbers.append( *phoneItAD ); |
317 | } | 318 | } |
318 | // ************* emails; | 319 | // ************* emails; |
319 | t = mData->emails; | 320 | t = mData->emails; |
320 | tAD = ad.mData->emails; | 321 | tAD = ad.mData->emails; |
321 | for ( iii = 0; iii < tAD.count(); ++iii) | 322 | for ( iii = 0; iii < tAD.count(); ++iii) |
322 | if ( !t.contains(tAD[iii] ) ) | 323 | if ( !t.contains(tAD[iii] ) ) |
323 | mData->emails.append( tAD[iii] ); | 324 | mData->emails.append( tAD[iii] ); |
324 | // ************* categories; | 325 | // ************* categories; |
325 | t = mData->categories; | 326 | t = mData->categories; |
326 | tAD = ad.mData->categories; | 327 | tAD = ad.mData->categories; |
327 | for ( iii = 0; iii < tAD.count(); ++iii) | 328 | for ( iii = 0; iii < tAD.count(); ++iii) |
328 | if ( !t.contains(tAD[iii] ) ) | 329 | if ( !t.contains(tAD[iii] ) ) |
329 | mData->categories.append( tAD[iii] ); | 330 | mData->categories.append( tAD[iii] ); |
330 | 331 | ||
331 | 332 | ||
332 | } | 333 | } |
333 | 334 | ||
334 | QStringList::ConstIterator it; | 335 | QStringList::ConstIterator it; |
335 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { | 336 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { |
336 | QString qualifiedName = (*it).left( (*it).find( ":" )); | 337 | QString qualifiedName = (*it).left( (*it).find( ":" )); |
337 | bool found = false; | 338 | bool found = false; |
338 | QStringList::ConstIterator itL; | 339 | QStringList::ConstIterator itL; |
339 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { | 340 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { |
340 | if ( (*itL).startsWith( qualifiedName ) ) { | 341 | if ( (*itL).startsWith( qualifiedName ) ) { |
341 | found = true; | 342 | found = true; |
342 | break; | 343 | break; |
343 | } | 344 | } |
344 | } | 345 | } |
345 | if ( ! found ) { | 346 | if ( ! found ) { |
346 | mData->custom.append( *it ); | 347 | mData->custom.append( *it ); |
347 | } | 348 | } |
348 | } | 349 | } |
349 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; | 350 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; |
350 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; | 351 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; |
351 | if ( !mData->sound.isIntern() ) { | 352 | if ( !mData->sound.isIntern() ) { |
352 | if ( mData->sound.url().isEmpty() ) { | 353 | if ( mData->sound.url().isEmpty() ) { |
353 | mData->sound = ad.mData->sound; | 354 | mData->sound = ad.mData->sound; |
354 | } | 355 | } |
355 | } | 356 | } |
356 | if ( !mData->agent.isIntern() ) { | 357 | if ( !mData->agent.isIntern() ) { |
357 | if ( mData->agent.url().isEmpty() ) { | 358 | if ( mData->agent.url().isEmpty() ) { |
358 | mData->agent = ad.mData->agent; | 359 | mData->agent = ad.mData->agent; |
359 | } | 360 | } |
360 | } | 361 | } |
361 | 362 | { | |
362 | #if 0 | 363 | Key::List::Iterator itA; |
363 | 364 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { | |
364 | if ( mData->url.isValid() ) | 365 | bool found = false; |
365 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); | 366 | Key::List::Iterator it; |
366 | KABC::PhoneNumber::List phoneNumbers; | 367 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
367 | KABC::PhoneNumber::List::Iterator phoneIter; | 368 | if ( (*it) == (*itA)) { |
368 | 369 | found = true; | |
369 | QStringList t; | 370 | break; |
370 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 371 | |
371 | ++phoneIter ) | 372 | } |
372 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 373 | } |
373 | t.sort(); | 374 | if ( ! found ) { |
374 | uint iii; | 375 | mData->keys.append( *itA ); |
375 | for ( iii = 0; iii < t.count(); ++iii) | 376 | } |
376 | l.append( t[iii] ); | 377 | } |
377 | t = mData->emails; | ||
378 | t.sort(); | ||
379 | for ( iii = 0; iii < t.count(); ++iii) | ||
380 | l.append( t[iii] ); | ||
381 | t = mData->categories; | ||
382 | t.sort(); | ||
383 | for ( iii = 0; iii < t.count(); ++iii) | ||
384 | l.append( t[iii] ); | ||
385 | t = mData->custom; | ||
386 | t.sort(); | ||
387 | for ( iii = 0; iii < t.count(); ++iii) | ||
388 | l.append( t[iii] ); | ||
389 | KABC::Address::List::Iterator addressIter; | ||
390 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | ||
391 | ++addressIter ) { | ||
392 | t = (*addressIter).asList(); | ||
393 | t.sort(); | ||
394 | for ( iii = 0; iii < t.count(); ++iii) | ||
395 | l.append( t[iii] ); | ||
396 | } | 378 | } |
379 | KABC::Address::List::Iterator addressIterA; | ||
380 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { | ||
381 | bool found = false; | ||
382 | KABC::Address::List::Iterator addressIter; | ||
383 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | ||
384 | ++addressIter ) { | ||
385 | if ( (*addressIter) == (*addressIterA)) { | ||
386 | found = true; | ||
387 | (*addressIter).setType( (*addressIterA).type() ); | ||
388 | break; | ||
389 | } | ||
397 | 390 | ||
398 | #endif | 391 | } |
399 | 392 | if ( ! found ) { | |
400 | // pending: | 393 | mData->addresses.append( *addressIterA ); |
401 | // merging addresses | 394 | } |
402 | // merging keys | 395 | } |
403 | //qDebug("merge contact %s ", ad.uid().latin1()); | 396 | //qDebug("merge contact %s ", ad.uid().latin1()); |
404 | setUid( ad.uid() ); | 397 | setUid( ad.uid() ); |
405 | setRevision( ad.revision() ); | 398 | setRevision( ad.revision() ); |
406 | } | 399 | } |
407 | 400 | ||
408 | bool Addressee::removeVoice() | 401 | bool Addressee::removeVoice() |
409 | { | 402 | { |
410 | PhoneNumber::List phoneN = phoneNumbers(); | 403 | PhoneNumber::List phoneN = phoneNumbers(); |
411 | PhoneNumber::List::Iterator phoneIt; | 404 | PhoneNumber::List::Iterator phoneIt; |
412 | bool found = false; | 405 | bool found = false; |
413 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 406 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
414 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 407 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
415 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 408 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
416 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 409 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
417 | insertPhoneNumber( (*phoneIt) ); | 410 | insertPhoneNumber( (*phoneIt) ); |
418 | found = true; | 411 | found = true; |
419 | } | 412 | } |
420 | } | 413 | } |
421 | 414 | ||
422 | } | 415 | } |
423 | return found; | 416 | return found; |
424 | } | 417 | } |
425 | 418 | ||
426 | bool Addressee::containsAdr(const Addressee& ad ) | 419 | bool Addressee::containsAdr(const Addressee& ad ) |
427 | { | 420 | { |
428 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; | 421 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; |
429 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; | 422 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; |
430 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; | 423 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; |
431 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; | 424 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; |
432 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; | 425 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; |
433 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; | 426 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; |
434 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; | 427 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; |
435 | 428 | ||
436 | // compare phone numbers | 429 | // compare phone numbers |
437 | PhoneNumber::List phoneN = ad.phoneNumbers(); | 430 | PhoneNumber::List phoneN = ad.phoneNumbers(); |
438 | PhoneNumber::List::Iterator phoneIt; | 431 | PhoneNumber::List::Iterator phoneIt; |
439 | bool found = false; | 432 | bool found = false; |
440 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 433 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
441 | bool found = false; | 434 | bool found = false; |
442 | PhoneNumber::List phoneL = ad.phoneNumbers(); | 435 | PhoneNumber::List phoneL = ad.phoneNumbers(); |
443 | PhoneNumber::List::Iterator phoneItL; | 436 | PhoneNumber::List::Iterator phoneItL; |
444 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { | 437 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { |
445 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { | 438 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { |
446 | found = true; | 439 | found = true; |
447 | break; | 440 | break; |
448 | } | 441 | } |
449 | } | 442 | } |
450 | if ( ! found ) | 443 | if ( ! found ) |
451 | return false; | 444 | return false; |
452 | } | 445 | } |
453 | return true; | 446 | return true; |
454 | 447 | ||
455 | } | 448 | } |
456 | void Addressee::simplifyAddresses() | 449 | void Addressee::simplifyAddresses() |
457 | { | 450 | { |
458 | int max = 2; | 451 | int max = 2; |
459 | if ( mData->url.isValid() ) | 452 | if ( mData->url.isValid() ) |
460 | max = 1; | 453 | max = 1; |
461 | if ( mData->addresses.count() <= max ) return ; | 454 | if ( mData->addresses.count() <= max ) return ; |
462 | int count = 0; | 455 | int count = 0; |
463 | Address::List list; | 456 | Address::List list; |
464 | Address::List::Iterator it; | 457 | Address::List::Iterator it; |
465 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 458 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
466 | if ( count >= max ) | 459 | if ( count >= max ) |
467 | list.append( *it ); | 460 | list.append( *it ); |
468 | ++count; | 461 | ++count; |
469 | } | 462 | } |
470 | for( it = list.begin(); it != list.end(); ++it ) { | 463 | for( it = list.begin(); it != list.end(); ++it ) { |
471 | removeAddress( (*it) ); | 464 | removeAddress( (*it) ); |
472 | } | 465 | } |
473 | } | 466 | } |
474 | 467 | ||
475 | // removes all emails but the first | 468 | // removes all emails but the first |
476 | // needed by phone sync | 469 | // needed by phone sync |
477 | void Addressee::simplifyEmails() | 470 | void Addressee::simplifyEmails() |
478 | { | 471 | { |
479 | if ( mData->emails.count() == 0 ) return ; | 472 | if ( mData->emails.count() == 0 ) return ; |
480 | QString email = mData->emails.first(); | 473 | QString email = mData->emails.first(); |
481 | detach(); | 474 | detach(); |
482 | mData->emails.clear(); | 475 | mData->emails.clear(); |
483 | mData->emails.append( email ); | 476 | mData->emails.append( email ); |
484 | } | 477 | } |
485 | 478 | ||
486 | void Addressee::simplifyPhoneNumbers() | 479 | void Addressee::simplifyPhoneNumbers() |
487 | { | 480 | { |
488 | KABC::PhoneNumber::List removeNumbers; | 481 | KABC::PhoneNumber::List removeNumbers; |
489 | KABC::PhoneNumber::List::Iterator phoneIter; | 482 | KABC::PhoneNumber::List::Iterator phoneIter; |
490 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 483 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
491 | ++phoneIter ) { | 484 | ++phoneIter ) { |
492 | if ( ! ( *phoneIter ).simplifyNumber() ) | 485 | if ( ! ( *phoneIter ).simplifyNumber() ) |
493 | removeNumbers.append( ( *phoneIter ) ); | 486 | removeNumbers.append( ( *phoneIter ) ); |
494 | } | 487 | } |
495 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 488 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
496 | ++phoneIter ) { | 489 | ++phoneIter ) { |
497 | removePhoneNumber(( *phoneIter )); | 490 | removePhoneNumber(( *phoneIter )); |
498 | } | 491 | } |
499 | } | 492 | } |
500 | void Addressee::simplifyPhoneNumberTypes() | 493 | void Addressee::simplifyPhoneNumberTypes() |
501 | { | 494 | { |
502 | KABC::PhoneNumber::List::Iterator phoneIter; | 495 | KABC::PhoneNumber::List::Iterator phoneIter; |
503 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 496 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
504 | ++phoneIter ) | 497 | ++phoneIter ) |
505 | ( *phoneIter ).simplifyType(); | 498 | ( *phoneIter ).simplifyType(); |
506 | } | 499 | } |
507 | void Addressee::removeID(const QString &prof) | 500 | void Addressee::removeID(const QString &prof) |
508 | { | 501 | { |
509 | detach(); | 502 | detach(); |
510 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 503 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
511 | 504 | ||
512 | } | 505 | } |
513 | void Addressee::setID( const QString & prof , const QString & id ) | 506 | void Addressee::setID( const QString & prof , const QString & id ) |
514 | { | 507 | { |
515 | detach(); | 508 | detach(); |
516 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 509 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
517 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 510 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
518 | } | 511 | } |
519 | void Addressee::setTempSyncStat( int id ) | 512 | void Addressee::setTempSyncStat( int id ) |
520 | { | 513 | { |
521 | if ( mData->mTempSyncStat == id ) return; | 514 | if ( mData->mTempSyncStat == id ) return; |
522 | detach(); | 515 | detach(); |
523 | mData->mTempSyncStat = id; | 516 | mData->mTempSyncStat = id; |
524 | } | 517 | } |
525 | int Addressee::tempSyncStat() const | 518 | int Addressee::tempSyncStat() const |
526 | { | 519 | { |
527 | return mData->mTempSyncStat; | 520 | return mData->mTempSyncStat; |
528 | } | 521 | } |
529 | 522 | ||
530 | QString Addressee::getID( const QString & prof) | 523 | QString Addressee::getID( const QString & prof) |
531 | { | 524 | { |
532 | return KIdManager::getId ( mData->mExternalId, prof ); | 525 | return KIdManager::getId ( mData->mExternalId, prof ); |
533 | } | 526 | } |
534 | 527 | ||
535 | void Addressee::setCsum( const QString & prof , const QString & id ) | 528 | void Addressee::setCsum( const QString & prof , const QString & id ) |
536 | { | 529 | { |
537 | detach(); | 530 | detach(); |
538 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 531 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
539 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 532 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
540 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 533 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
541 | } | 534 | } |
542 | 535 | ||
543 | QString Addressee::getCsum( const QString & prof) | 536 | QString Addressee::getCsum( const QString & prof) |
544 | { | 537 | { |
545 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 538 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
546 | } | 539 | } |
547 | 540 | ||
548 | void Addressee::setIDStr( const QString & s ) | 541 | void Addressee::setIDStr( const QString & s ) |
549 | { | 542 | { |
550 | detach(); | 543 | detach(); |
551 | mData->mExternalId = s; | 544 | mData->mExternalId = s; |
552 | } | 545 | } |
553 | 546 | ||
554 | QString Addressee::IDStr() const | 547 | QString Addressee::IDStr() const |
555 | { | 548 | { |
556 | return mData->mExternalId; | 549 | return mData->mExternalId; |
557 | } | 550 | } |
558 | 551 | ||
559 | void Addressee::setExternalUID( const QString &id ) | 552 | void Addressee::setExternalUID( const QString &id ) |
560 | { | 553 | { |
561 | if ( id == mData->externalUID ) return; | 554 | if ( id == mData->externalUID ) return; |
562 | detach(); | 555 | detach(); |
563 | mData->empty = false; | 556 | mData->empty = false; |
564 | mData->externalUID = id; | 557 | mData->externalUID = id; |
565 | } | 558 | } |
566 | 559 | ||
567 | QString Addressee::externalUID() const | 560 | QString Addressee::externalUID() const |
568 | { | 561 | { |
569 | return mData->externalUID; | 562 | return mData->externalUID; |
570 | } | 563 | } |
571 | void Addressee::setOriginalExternalUID( const QString &id ) | 564 | void Addressee::setOriginalExternalUID( const QString &id ) |
572 | { | 565 | { |
573 | if ( id == mData->originalExternalUID ) return; | 566 | if ( id == mData->originalExternalUID ) return; |
574 | detach(); | 567 | detach(); |
575 | mData->empty = false; | 568 | mData->empty = false; |
576 | //qDebug("*******Set orig uid %s ", id.latin1()); | 569 | //qDebug("*******Set orig uid %s ", id.latin1()); |
577 | mData->originalExternalUID = id; | 570 | mData->originalExternalUID = id; |
578 | } | 571 | } |
579 | 572 | ||
580 | QString Addressee::originalExternalUID() const | 573 | QString Addressee::originalExternalUID() const |
581 | { | 574 | { |
582 | return mData->originalExternalUID; | 575 | return mData->originalExternalUID; |
583 | } | 576 | } |
584 | 577 | ||
585 | void Addressee::setUid( const QString &id ) | 578 | void Addressee::setUid( const QString &id ) |
586 | { | 579 | { |
587 | if ( id == mData->uid ) return; | 580 | if ( id == mData->uid ) return; |
588 | detach(); | 581 | detach(); |
589 | //qDebug("****setuid %s ", id.latin1()); | 582 | //qDebug("****setuid %s ", id.latin1()); |
590 | mData->empty = false; | 583 | mData->empty = false; |
591 | mData->uid = id; | 584 | mData->uid = id; |
592 | } | 585 | } |
593 | 586 | ||
594 | QString Addressee::uid() const | 587 | QString Addressee::uid() const |
595 | { | 588 | { |
596 | if ( mData->uid.isEmpty() ) | 589 | if ( mData->uid.isEmpty() ) |
597 | mData->uid = KApplication::randomString( 10 ); | 590 | mData->uid = KApplication::randomString( 10 ); |
598 | 591 | ||
599 | return mData->uid; | 592 | return mData->uid; |
600 | } | 593 | } |
601 | 594 | ||
602 | QString Addressee::uidLabel() | 595 | QString Addressee::uidLabel() |
603 | { | 596 | { |
604 | return i18n("Unique Identifier"); | 597 | return i18n("Unique Identifier"); |
605 | } | 598 | } |
606 | 599 | ||
607 | void Addressee::setName( const QString &name ) | 600 | void Addressee::setName( const QString &name ) |
608 | { | 601 | { |
609 | if ( name == mData->name ) return; | 602 | if ( name == mData->name ) return; |
610 | detach(); | 603 | detach(); |
611 | mData->empty = false; | 604 | mData->empty = false; |
612 | mData->name = name; | 605 | mData->name = name; |
613 | } | 606 | } |
614 | 607 | ||
615 | QString Addressee::name() const | 608 | QString Addressee::name() const |
616 | { | 609 | { |
617 | return mData->name; | 610 | return mData->name; |
618 | } | 611 | } |
619 | 612 | ||
620 | QString Addressee::nameLabel() | 613 | QString Addressee::nameLabel() |
621 | { | 614 | { |
622 | return i18n("Name"); | 615 | return i18n("Name"); |
623 | } | 616 | } |
624 | 617 | ||
625 | 618 | ||
626 | void Addressee::setFormattedName( const QString &formattedName ) | 619 | void Addressee::setFormattedName( const QString &formattedName ) |
627 | { | 620 | { |
628 | if ( formattedName == mData->formattedName ) return; | 621 | if ( formattedName == mData->formattedName ) return; |
629 | detach(); | 622 | detach(); |
630 | mData->empty = false; | 623 | mData->empty = false; |
631 | mData->formattedName = formattedName; | 624 | mData->formattedName = formattedName; |
632 | } | 625 | } |
633 | 626 | ||
634 | QString Addressee::formattedName() const | 627 | QString Addressee::formattedName() const |
635 | { | 628 | { |
636 | return mData->formattedName; | 629 | return mData->formattedName; |
637 | } | 630 | } |
638 | 631 | ||
639 | QString Addressee::formattedNameLabel() | 632 | QString Addressee::formattedNameLabel() |
640 | { | 633 | { |
641 | return i18n("Formatted Name"); | 634 | return i18n("Formatted Name"); |
642 | } | 635 | } |
643 | 636 | ||
644 | 637 | ||
645 | void Addressee::setFamilyName( const QString &familyName ) | 638 | void Addressee::setFamilyName( const QString &familyName ) |
646 | { | 639 | { |
647 | if ( familyName == mData->familyName ) return; | 640 | if ( familyName == mData->familyName ) return; |
648 | detach(); | 641 | detach(); |
649 | mData->empty = false; | 642 | mData->empty = false; |
650 | mData->familyName = familyName; | 643 | mData->familyName = familyName; |
651 | } | 644 | } |
652 | 645 | ||
653 | QString Addressee::familyName() const | 646 | QString Addressee::familyName() const |
654 | { | 647 | { |
655 | return mData->familyName; | 648 | return mData->familyName; |
656 | } | 649 | } |
657 | 650 | ||
658 | QString Addressee::familyNameLabel() | 651 | QString Addressee::familyNameLabel() |
659 | { | 652 | { |
660 | return i18n("Family Name"); | 653 | return i18n("Family Name"); |
661 | } | 654 | } |
662 | 655 | ||
663 | 656 | ||
664 | void Addressee::setGivenName( const QString &givenName ) | 657 | void Addressee::setGivenName( const QString &givenName ) |
665 | { | 658 | { |
666 | if ( givenName == mData->givenName ) return; | 659 | if ( givenName == mData->givenName ) return; |
667 | detach(); | 660 | detach(); |
668 | mData->empty = false; | 661 | mData->empty = false; |
669 | mData->givenName = givenName; | 662 | mData->givenName = givenName; |
670 | } | 663 | } |
671 | 664 | ||
672 | QString Addressee::givenName() const | 665 | QString Addressee::givenName() const |
673 | { | 666 | { |
674 | return mData->givenName; | 667 | return mData->givenName; |
675 | } | 668 | } |
676 | 669 | ||
677 | QString Addressee::givenNameLabel() | 670 | QString Addressee::givenNameLabel() |
678 | { | 671 | { |
679 | return i18n("Given Name"); | 672 | return i18n("Given Name"); |
680 | } | 673 | } |
681 | 674 | ||
682 | 675 | ||
683 | void Addressee::setAdditionalName( const QString &additionalName ) | 676 | void Addressee::setAdditionalName( const QString &additionalName ) |
684 | { | 677 | { |
685 | if ( additionalName == mData->additionalName ) return; | 678 | if ( additionalName == mData->additionalName ) return; |
686 | detach(); | 679 | detach(); |
687 | mData->empty = false; | 680 | mData->empty = false; |
688 | mData->additionalName = additionalName; | 681 | mData->additionalName = additionalName; |
689 | } | 682 | } |
690 | 683 | ||
691 | QString Addressee::additionalName() const | 684 | QString Addressee::additionalName() const |
692 | { | 685 | { |
693 | return mData->additionalName; | 686 | return mData->additionalName; |
694 | } | 687 | } |
695 | 688 | ||
696 | QString Addressee::additionalNameLabel() | 689 | QString Addressee::additionalNameLabel() |
697 | { | 690 | { |
698 | return i18n("Additional Names"); | 691 | return i18n("Additional Names"); |
699 | } | 692 | } |
700 | 693 | ||
701 | 694 | ||
702 | void Addressee::setPrefix( const QString &prefix ) | 695 | void Addressee::setPrefix( const QString &prefix ) |
703 | { | 696 | { |
704 | if ( prefix == mData->prefix ) return; | 697 | if ( prefix == mData->prefix ) return; |
705 | detach(); | 698 | detach(); |
706 | mData->empty = false; | 699 | mData->empty = false; |
707 | mData->prefix = prefix; | 700 | mData->prefix = prefix; |
708 | } | 701 | } |
709 | 702 | ||
710 | QString Addressee::prefix() const | 703 | QString Addressee::prefix() const |
711 | { | 704 | { |
712 | return mData->prefix; | 705 | return mData->prefix; |
713 | } | 706 | } |
714 | 707 | ||
715 | QString Addressee::prefixLabel() | 708 | QString Addressee::prefixLabel() |
716 | { | 709 | { |
717 | return i18n("Honorific Prefixes"); | 710 | return i18n("Honorific Prefixes"); |
718 | } | 711 | } |
719 | 712 | ||
720 | 713 | ||
721 | void Addressee::setSuffix( const QString &suffix ) | 714 | void Addressee::setSuffix( const QString &suffix ) |
722 | { | 715 | { |
723 | if ( suffix == mData->suffix ) return; | 716 | if ( suffix == mData->suffix ) return; |
724 | detach(); | 717 | detach(); |
725 | mData->empty = false; | 718 | mData->empty = false; |
726 | mData->suffix = suffix; | 719 | mData->suffix = suffix; |
727 | } | 720 | } |
728 | 721 | ||
729 | QString Addressee::suffix() const | 722 | QString Addressee::suffix() const |
730 | { | 723 | { |
731 | return mData->suffix; | 724 | return mData->suffix; |
732 | } | 725 | } |
733 | 726 | ||
734 | QString Addressee::suffixLabel() | 727 | QString Addressee::suffixLabel() |
735 | { | 728 | { |
736 | return i18n("Honorific Suffixes"); | 729 | return i18n("Honorific Suffixes"); |
737 | } | 730 | } |
738 | 731 | ||
739 | 732 | ||
740 | void Addressee::setNickName( const QString &nickName ) | 733 | void Addressee::setNickName( const QString &nickName ) |
741 | { | 734 | { |
742 | if ( nickName == mData->nickName ) return; | 735 | if ( nickName == mData->nickName ) return; |
743 | detach(); | 736 | detach(); |
744 | mData->empty = false; | 737 | mData->empty = false; |
745 | mData->nickName = nickName; | 738 | mData->nickName = nickName; |
746 | } | 739 | } |
747 | 740 | ||
748 | QString Addressee::nickName() const | 741 | QString Addressee::nickName() const |
749 | { | 742 | { |
750 | return mData->nickName; | 743 | return mData->nickName; |
751 | } | 744 | } |
752 | 745 | ||
753 | QString Addressee::nickNameLabel() | 746 | QString Addressee::nickNameLabel() |
754 | { | 747 | { |
755 | return i18n("Nick Name"); | 748 | return i18n("Nick Name"); |
756 | } | 749 | } |
757 | 750 | ||
758 | 751 | ||
759 | void Addressee::setBirthday( const QDateTime &birthday ) | 752 | void Addressee::setBirthday( const QDateTime &birthday ) |
760 | { | 753 | { |
761 | if ( birthday == mData->birthday ) return; | 754 | if ( birthday == mData->birthday ) return; |
762 | detach(); | 755 | detach(); |
763 | mData->empty = false; | 756 | mData->empty = false; |
764 | mData->birthday = birthday; | 757 | mData->birthday = birthday; |
765 | } | 758 | } |
766 | 759 | ||
767 | QDateTime Addressee::birthday() const | 760 | QDateTime Addressee::birthday() const |
768 | { | 761 | { |
769 | return mData->birthday; | 762 | return mData->birthday; |
770 | } | 763 | } |
771 | 764 | ||
772 | QString Addressee::birthdayLabel() | 765 | QString Addressee::birthdayLabel() |
773 | { | 766 | { |
774 | return i18n("Birthday"); | 767 | return i18n("Birthday"); |
775 | } | 768 | } |
776 | 769 | ||
777 | 770 | ||
778 | QString Addressee::homeAddressStreetLabel() | 771 | QString Addressee::homeAddressStreetLabel() |
779 | { | 772 | { |
780 | return i18n("Home Address Street"); | 773 | return i18n("Home Address Street"); |
781 | } | 774 | } |
782 | 775 | ||
783 | 776 | ||
784 | QString Addressee::homeAddressLocalityLabel() | 777 | QString Addressee::homeAddressLocalityLabel() |
785 | { | 778 | { |
786 | return i18n("Home Address Locality"); | 779 | return i18n("Home Address Locality"); |
787 | } | 780 | } |
788 | 781 | ||
789 | 782 | ||
790 | QString Addressee::homeAddressRegionLabel() | 783 | QString Addressee::homeAddressRegionLabel() |
791 | { | 784 | { |
792 | return i18n("Home Address Region"); | 785 | return i18n("Home Address Region"); |
793 | } | 786 | } |
794 | 787 | ||
795 | 788 | ||
796 | QString Addressee::homeAddressPostalCodeLabel() | 789 | QString Addressee::homeAddressPostalCodeLabel() |
797 | { | 790 | { |
798 | return i18n("Home Address Postal Code"); | 791 | return i18n("Home Address Postal Code"); |
799 | } | 792 | } |
800 | 793 | ||
801 | 794 | ||
802 | QString Addressee::homeAddressCountryLabel() | 795 | QString Addressee::homeAddressCountryLabel() |
803 | { | 796 | { |
804 | return i18n("Home Address Country"); | 797 | return i18n("Home Address Country"); |
805 | } | 798 | } |
806 | 799 | ||
807 | 800 | ||
808 | QString Addressee::homeAddressLabelLabel() | 801 | QString Addressee::homeAddressLabelLabel() |
809 | { | 802 | { |
810 | return i18n("Home Address Label"); | 803 | return i18n("Home Address Label"); |
811 | } | 804 | } |
812 | 805 | ||
813 | 806 | ||
814 | QString Addressee::businessAddressStreetLabel() | 807 | QString Addressee::businessAddressStreetLabel() |
815 | { | 808 | { |
816 | return i18n("Business Address Street"); | 809 | return i18n("Business Address Street"); |
817 | } | 810 | } |
818 | 811 | ||
819 | 812 | ||
820 | QString Addressee::businessAddressLocalityLabel() | 813 | QString Addressee::businessAddressLocalityLabel() |
821 | { | 814 | { |
822 | return i18n("Business Address Locality"); | 815 | return i18n("Business Address Locality"); |
823 | } | 816 | } |
824 | 817 | ||
825 | 818 | ||
826 | QString Addressee::businessAddressRegionLabel() | 819 | QString Addressee::businessAddressRegionLabel() |
827 | { | 820 | { |
828 | return i18n("Business Address Region"); | 821 | return i18n("Business Address Region"); |
829 | } | 822 | } |
830 | 823 | ||
831 | 824 | ||
832 | QString Addressee::businessAddressPostalCodeLabel() | 825 | QString Addressee::businessAddressPostalCodeLabel() |
833 | { | 826 | { |
834 | return i18n("Business Address Postal Code"); | 827 | return i18n("Business Address Postal Code"); |
835 | } | 828 | } |
836 | 829 | ||
837 | 830 | ||
838 | QString Addressee::businessAddressCountryLabel() | 831 | QString Addressee::businessAddressCountryLabel() |
839 | { | 832 | { |
840 | return i18n("Business Address Country"); | 833 | return i18n("Business Address Country"); |
841 | } | 834 | } |
842 | 835 | ||
843 | 836 | ||
844 | QString Addressee::businessAddressLabelLabel() | 837 | QString Addressee::businessAddressLabelLabel() |
845 | { | 838 | { |
846 | return i18n("Business Address Label"); | 839 | return i18n("Business Address Label"); |
847 | } | 840 | } |
848 | 841 | ||
849 | 842 | ||
850 | QString Addressee::homePhoneLabel() | 843 | QString Addressee::homePhoneLabel() |
851 | { | 844 | { |
852 | return i18n("Home Phone"); | 845 | return i18n("Home Phone"); |
853 | } | 846 | } |
854 | 847 | ||
855 | 848 | ||
856 | QString Addressee::businessPhoneLabel() | 849 | QString Addressee::businessPhoneLabel() |
857 | { | 850 | { |
858 | return i18n("Business Phone"); | 851 | return i18n("Business Phone"); |
859 | } | 852 | } |
860 | 853 | ||
861 | 854 | ||
862 | QString Addressee::mobilePhoneLabel() | 855 | QString Addressee::mobilePhoneLabel() |
863 | { | 856 | { |
864 | return i18n("Mobile Phone"); | 857 | return i18n("Mobile Phone"); |
865 | } | 858 | } |
866 | 859 | ||
867 | 860 | ||
868 | QString Addressee::homeFaxLabel() | 861 | QString Addressee::homeFaxLabel() |
869 | { | 862 | { |
870 | return i18n("Home Fax"); | 863 | return i18n("Home Fax"); |
871 | } | 864 | } |
872 | 865 | ||
873 | 866 | ||
874 | QString Addressee::businessFaxLabel() | 867 | QString Addressee::businessFaxLabel() |
875 | { | 868 | { |
876 | return i18n("Business Fax"); | 869 | return i18n("Business Fax"); |
877 | } | 870 | } |
878 | 871 | ||
879 | 872 | ||
880 | QString Addressee::carPhoneLabel() | 873 | QString Addressee::carPhoneLabel() |
881 | { | 874 | { |
882 | return i18n("Car Phone"); | 875 | return i18n("Car Phone"); |
883 | } | 876 | } |
884 | 877 | ||
885 | 878 | ||
886 | QString Addressee::isdnLabel() | 879 | QString Addressee::isdnLabel() |
887 | { | 880 | { |
888 | return i18n("ISDN"); | 881 | return i18n("ISDN"); |
889 | } | 882 | } |
890 | 883 | ||
891 | 884 | ||
892 | QString Addressee::pagerLabel() | 885 | QString Addressee::pagerLabel() |
893 | { | 886 | { |
894 | return i18n("Pager"); | 887 | return i18n("Pager"); |
895 | } | 888 | } |
896 | 889 | ||
897 | QString Addressee::sipLabel() | 890 | QString Addressee::sipLabel() |
898 | { | 891 | { |
899 | return i18n("SIP"); | 892 | return i18n("SIP"); |
900 | } | 893 | } |
901 | 894 | ||
902 | QString Addressee::emailLabel() | 895 | QString Addressee::emailLabel() |
903 | { | 896 | { |
904 | return i18n("Email Address"); | 897 | return i18n("Email Address"); |
905 | } | 898 | } |
906 | 899 | ||
907 | 900 | ||
908 | void Addressee::setMailer( const QString &mailer ) | 901 | void Addressee::setMailer( const QString &mailer ) |
909 | { | 902 | { |
910 | if ( mailer == mData->mailer ) return; | 903 | if ( mailer == mData->mailer ) return; |
911 | detach(); | 904 | detach(); |
912 | mData->empty = false; | 905 | mData->empty = false; |
913 | mData->mailer = mailer; | 906 | mData->mailer = mailer; |
914 | } | 907 | } |
915 | 908 | ||
916 | QString Addressee::mailer() const | 909 | QString Addressee::mailer() const |
917 | { | 910 | { |
918 | return mData->mailer; | 911 | return mData->mailer; |
919 | } | 912 | } |
920 | 913 | ||
921 | QString Addressee::mailerLabel() | 914 | QString Addressee::mailerLabel() |
922 | { | 915 | { |
923 | return i18n("Mail Client"); | 916 | return i18n("Mail Client"); |
924 | } | 917 | } |
925 | 918 | ||
926 | 919 | ||
927 | void Addressee::setTimeZone( const TimeZone &timeZone ) | 920 | void Addressee::setTimeZone( const TimeZone &timeZone ) |
928 | { | 921 | { |
929 | if ( timeZone == mData->timeZone ) return; | 922 | if ( timeZone == mData->timeZone ) return; |
930 | detach(); | 923 | detach(); |
931 | mData->empty = false; | 924 | mData->empty = false; |
932 | mData->timeZone = timeZone; | 925 | mData->timeZone = timeZone; |
933 | } | 926 | } |
934 | 927 | ||
935 | TimeZone Addressee::timeZone() const | 928 | TimeZone Addressee::timeZone() const |
936 | { | 929 | { |
937 | return mData->timeZone; | 930 | return mData->timeZone; |
938 | } | 931 | } |
939 | 932 | ||
940 | QString Addressee::timeZoneLabel() | 933 | QString Addressee::timeZoneLabel() |
941 | { | 934 | { |
942 | return i18n("Time Zone"); | 935 | return i18n("Time Zone"); |
943 | } | 936 | } |
944 | 937 | ||
945 | 938 | ||
946 | void Addressee::setGeo( const Geo &geo ) | 939 | void Addressee::setGeo( const Geo &geo ) |
947 | { | 940 | { |
948 | if ( geo == mData->geo ) return; | 941 | if ( geo == mData->geo ) return; |
949 | detach(); | 942 | detach(); |
950 | mData->empty = false; | 943 | mData->empty = false; |
951 | mData->geo = geo; | 944 | mData->geo = geo; |
952 | } | 945 | } |
953 | 946 | ||
954 | Geo Addressee::geo() const | 947 | Geo Addressee::geo() const |
955 | { | 948 | { |
956 | return mData->geo; | 949 | return mData->geo; |
957 | } | 950 | } |
958 | 951 | ||
959 | QString Addressee::geoLabel() | 952 | QString Addressee::geoLabel() |
960 | { | 953 | { |
961 | return i18n("Geographic Position"); | 954 | return i18n("Geographic Position"); |
962 | } | 955 | } |
963 | 956 | ||
964 | 957 | ||
965 | void Addressee::setTitle( const QString &title ) | 958 | void Addressee::setTitle( const QString &title ) |
966 | { | 959 | { |
967 | if ( title == mData->title ) return; | 960 | if ( title == mData->title ) return; |
968 | detach(); | 961 | detach(); |
969 | mData->empty = false; | 962 | mData->empty = false; |
970 | mData->title = title; | 963 | mData->title = title; |
971 | } | 964 | } |
972 | 965 | ||
973 | QString Addressee::title() const | 966 | QString Addressee::title() const |
974 | { | 967 | { |
975 | return mData->title; | 968 | return mData->title; |
976 | } | 969 | } |
977 | 970 | ||
978 | QString Addressee::titleLabel() | 971 | QString Addressee::titleLabel() |
979 | { | 972 | { |
980 | return i18n("Title"); | 973 | return i18n("Title"); |
981 | } | 974 | } |
982 | 975 | ||
983 | 976 | ||
984 | void Addressee::setRole( const QString &role ) | 977 | void Addressee::setRole( const QString &role ) |
985 | { | 978 | { |
986 | if ( role == mData->role ) return; | 979 | if ( role == mData->role ) return; |
987 | detach(); | 980 | detach(); |
988 | mData->empty = false; | 981 | mData->empty = false; |
989 | mData->role = role; | 982 | mData->role = role; |
990 | } | 983 | } |
991 | 984 | ||
992 | QString Addressee::role() const | 985 | QString Addressee::role() const |
993 | { | 986 | { |
994 | return mData->role; | 987 | return mData->role; |
995 | } | 988 | } |
996 | 989 | ||
997 | QString Addressee::roleLabel() | 990 | QString Addressee::roleLabel() |
998 | { | 991 | { |
999 | return i18n("Role"); | 992 | return i18n("Role"); |
1000 | } | 993 | } |
1001 | 994 | ||
1002 | 995 | ||
1003 | void Addressee::setOrganization( const QString &organization ) | 996 | void Addressee::setOrganization( const QString &organization ) |
1004 | { | 997 | { |
1005 | if ( organization == mData->organization ) return; | 998 | if ( organization == mData->organization ) return; |
1006 | detach(); | 999 | detach(); |
1007 | mData->empty = false; | 1000 | mData->empty = false; |
1008 | mData->organization = organization; | 1001 | mData->organization = organization; |
1009 | } | 1002 | } |
1010 | 1003 | ||
1011 | QString Addressee::organization() const | 1004 | QString Addressee::organization() const |
1012 | { | 1005 | { |
1013 | return mData->organization; | 1006 | return mData->organization; |
1014 | } | 1007 | } |
1015 | 1008 | ||
1016 | QString Addressee::organizationLabel() | 1009 | QString Addressee::organizationLabel() |
1017 | { | 1010 | { |
1018 | return i18n("Organization"); | 1011 | return i18n("Organization"); |
1019 | } | 1012 | } |
1020 | 1013 | ||
1021 | 1014 | ||
1022 | void Addressee::setNote( const QString ¬e ) | 1015 | void Addressee::setNote( const QString ¬e ) |
1023 | { | 1016 | { |
1024 | if ( note == mData->note ) return; | 1017 | if ( note == mData->note ) return; |
1025 | detach(); | 1018 | detach(); |
1026 | mData->empty = false; | 1019 | mData->empty = false; |
1027 | mData->note = note; | 1020 | mData->note = note; |
1028 | } | 1021 | } |
1029 | 1022 | ||
1030 | QString Addressee::note() const | 1023 | QString Addressee::note() const |
1031 | { | 1024 | { |
1032 | return mData->note; | 1025 | return mData->note; |
1033 | } | 1026 | } |
1034 | 1027 | ||
1035 | QString Addressee::noteLabel() | 1028 | QString Addressee::noteLabel() |
1036 | { | 1029 | { |
1037 | return i18n("Note"); | 1030 | return i18n("Note"); |
1038 | } | 1031 | } |
1039 | 1032 | ||
1040 | 1033 | ||
1041 | void Addressee::setProductId( const QString &productId ) | 1034 | void Addressee::setProductId( const QString &productId ) |
1042 | { | 1035 | { |
1043 | if ( productId == mData->productId ) return; | 1036 | if ( productId == mData->productId ) return; |
1044 | detach(); | 1037 | detach(); |
1045 | mData->empty = false; | 1038 | mData->empty = false; |
1046 | mData->productId = productId; | 1039 | mData->productId = productId; |
1047 | } | 1040 | } |
1048 | 1041 | ||
1049 | QString Addressee::productId() const | 1042 | QString Addressee::productId() const |
1050 | { | 1043 | { |
1051 | return mData->productId; | 1044 | return mData->productId; |
1052 | } | 1045 | } |
1053 | 1046 | ||
1054 | QString Addressee::productIdLabel() | 1047 | QString Addressee::productIdLabel() |
1055 | { | 1048 | { |
1056 | return i18n("Product Identifier"); | 1049 | return i18n("Product Identifier"); |
1057 | } | 1050 | } |
1058 | 1051 | ||
1059 | 1052 | ||
1060 | void Addressee::setRevision( const QDateTime &revision ) | 1053 | void Addressee::setRevision( const QDateTime &revision ) |
1061 | { | 1054 | { |
1062 | if ( revision == mData->revision ) return; | 1055 | if ( revision == mData->revision ) return; |
1063 | detach(); | 1056 | detach(); |
1064 | mData->empty = false; | 1057 | mData->empty = false; |
1065 | mData->revision = revision; | 1058 | mData->revision = revision; |
1066 | } | 1059 | } |
1067 | 1060 | ||
1068 | QDateTime Addressee::revision() const | 1061 | QDateTime Addressee::revision() const |
1069 | { | 1062 | { |
1070 | return mData->revision; | 1063 | return mData->revision; |
1071 | } | 1064 | } |
1072 | 1065 | ||
1073 | QString Addressee::revisionLabel() | 1066 | QString Addressee::revisionLabel() |
1074 | { | 1067 | { |
1075 | return i18n("Revision Date"); | 1068 | return i18n("Revision Date"); |
1076 | } | 1069 | } |
1077 | 1070 | ||
1078 | 1071 | ||
1079 | void Addressee::setSortString( const QString &sortString ) | 1072 | void Addressee::setSortString( const QString &sortString ) |
1080 | { | 1073 | { |
1081 | if ( sortString == mData->sortString ) return; | 1074 | if ( sortString == mData->sortString ) return; |
1082 | detach(); | 1075 | detach(); |
1083 | mData->empty = false; | 1076 | mData->empty = false; |
1084 | mData->sortString = sortString; | 1077 | mData->sortString = sortString; |
1085 | } | 1078 | } |
1086 | 1079 | ||
1087 | QString Addressee::sortString() const | 1080 | QString Addressee::sortString() const |
1088 | { | 1081 | { |
1089 | return mData->sortString; | 1082 | return mData->sortString; |
1090 | } | 1083 | } |
1091 | 1084 | ||
1092 | QString Addressee::sortStringLabel() | 1085 | QString Addressee::sortStringLabel() |
1093 | { | 1086 | { |
1094 | return i18n("Sort String"); | 1087 | return i18n("Sort String"); |
1095 | } | 1088 | } |
1096 | 1089 | ||
1097 | 1090 | ||
1098 | void Addressee::setUrl( const KURL &url ) | 1091 | void Addressee::setUrl( const KURL &url ) |
1099 | { | 1092 | { |
1100 | if ( url == mData->url ) return; | 1093 | if ( url == mData->url ) return; |
1101 | detach(); | 1094 | detach(); |
1102 | mData->empty = false; | 1095 | mData->empty = false; |
1103 | mData->url = url; | 1096 | mData->url = url; |
1104 | } | 1097 | } |
1105 | 1098 | ||
1106 | KURL Addressee::url() const | 1099 | KURL Addressee::url() const |
1107 | { | 1100 | { |
1108 | return mData->url; | 1101 | return mData->url; |
1109 | } | 1102 | } |
1110 | 1103 | ||
1111 | QString Addressee::urlLabel() | 1104 | QString Addressee::urlLabel() |
1112 | { | 1105 | { |
1113 | return i18n("URL"); | 1106 | return i18n("URL"); |
1114 | } | 1107 | } |
1115 | 1108 | ||
1116 | 1109 | ||
1117 | void Addressee::setSecrecy( const Secrecy &secrecy ) | 1110 | void Addressee::setSecrecy( const Secrecy &secrecy ) |
1118 | { | 1111 | { |
1119 | if ( secrecy == mData->secrecy ) return; | 1112 | if ( secrecy == mData->secrecy ) return; |
1120 | detach(); | 1113 | detach(); |
1121 | mData->empty = false; | 1114 | mData->empty = false; |
1122 | mData->secrecy = secrecy; | 1115 | mData->secrecy = secrecy; |
1123 | } | 1116 | } |
1124 | 1117 | ||
1125 | Secrecy Addressee::secrecy() const | 1118 | Secrecy Addressee::secrecy() const |
1126 | { | 1119 | { |
1127 | return mData->secrecy; | 1120 | return mData->secrecy; |
1128 | } | 1121 | } |
1129 | 1122 | ||
1130 | QString Addressee::secrecyLabel() | 1123 | QString Addressee::secrecyLabel() |
1131 | { | 1124 | { |
1132 | return i18n("Security Class"); | 1125 | return i18n("Security Class"); |
1133 | } | 1126 | } |
1134 | 1127 | ||
1135 | 1128 | ||
1136 | void Addressee::setLogo( const Picture &logo ) | 1129 | void Addressee::setLogo( const Picture &logo ) |
1137 | { | 1130 | { |
1138 | if ( logo == mData->logo ) return; | 1131 | if ( logo == mData->logo ) return; |
1139 | detach(); | 1132 | detach(); |
1140 | mData->empty = false; | 1133 | mData->empty = false; |
1141 | mData->logo = logo; | 1134 | mData->logo = logo; |
1142 | } | 1135 | } |
1143 | 1136 | ||
1144 | Picture Addressee::logo() const | 1137 | Picture Addressee::logo() const |
1145 | { | 1138 | { |
1146 | return mData->logo; | 1139 | return mData->logo; |
1147 | } | 1140 | } |
1148 | 1141 | ||
1149 | QString Addressee::logoLabel() | 1142 | QString Addressee::logoLabel() |
1150 | { | 1143 | { |
1151 | return i18n("Logo"); | 1144 | return i18n("Logo"); |
1152 | } | 1145 | } |
1153 | 1146 | ||
1154 | 1147 | ||
1155 | void Addressee::setPhoto( const Picture &photo ) | 1148 | void Addressee::setPhoto( const Picture &photo ) |
1156 | { | 1149 | { |
1157 | if ( photo == mData->photo ) return; | 1150 | if ( photo == mData->photo ) return; |
1158 | detach(); | 1151 | detach(); |
1159 | mData->empty = false; | 1152 | mData->empty = false; |
1160 | mData->photo = photo; | 1153 | mData->photo = photo; |
1161 | } | 1154 | } |
1162 | 1155 | ||
1163 | Picture Addressee::photo() const | 1156 | Picture Addressee::photo() const |
1164 | { | 1157 | { |
1165 | return mData->photo; | 1158 | return mData->photo; |
1166 | } | 1159 | } |
1167 | 1160 | ||
1168 | QString Addressee::photoLabel() | 1161 | QString Addressee::photoLabel() |
1169 | { | 1162 | { |
1170 | return i18n("Photo"); | 1163 | return i18n("Photo"); |