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