author | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
---|---|---|
committer | Michael Krelin <hacker@klever.net> | 2007-07-04 11:23:42 (UTC) |
commit | a08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (unidiff) | |
tree | 8ee90d686081c52e7c69b5ce946e9b1a7d690001 /kabc | |
parent | 11edc920afe4f274c0964436633aa632c8288a40 (diff) | |
download | kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2 |
initial public commit of qt4 portp1
169 files changed, 967 insertions, 732 deletions
diff --git a/kabc/address.h b/kabc/address.h index 38ad20b..41794fe 100644 --- a/kabc/address.h +++ b/kabc/address.h | |||
@@ -1,350 +1,350 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_ADDRESS_H | 28 | #ifndef KABC_ADDRESS_H |
29 | #define KABC_ADDRESS_H | 29 | #define KABC_ADDRESS_H |
30 | 30 | ||
31 | #include <qmap.h> | 31 | #include <qmap.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | #include <qregexp.h> | 33 | #include <qregexp.h> |
34 | #include <qstringlist.h> | 34 | #include <qstringlist.h> |
35 | #include <qvaluelist.h> | 35 | #include <q3valuelist.h> |
36 | 36 | ||
37 | // template tags for address formatting localization | 37 | // template tags for address formatting localization |
38 | #define KABC_FMTTAG_realname QString("%n") | 38 | #define KABC_FMTTAG_realname QString("%n") |
39 | #define KABC_FMTTAG_REALNAME QString("%N") | 39 | #define KABC_FMTTAG_REALNAME QString("%N") |
40 | #define KABC_FMTTAG_company QString("%cm") | 40 | #define KABC_FMTTAG_company QString("%cm") |
41 | #define KABC_FMTTAG_COMPANY QString("%CM") | 41 | #define KABC_FMTTAG_COMPANY QString("%CM") |
42 | #define KABC_FMTTAG_pobox QString("%p") | 42 | #define KABC_FMTTAG_pobox QString("%p") |
43 | #define KABC_FMTTAG_street QString("%s") | 43 | #define KABC_FMTTAG_street QString("%s") |
44 | #define KABC_FMTTAG_STREET QString("%S") | 44 | #define KABC_FMTTAG_STREET QString("%S") |
45 | #define KABC_FMTTAG_zipcode QString("%z") | 45 | #define KABC_FMTTAG_zipcode QString("%z") |
46 | #define KABC_FMTTAG_location QString("%l") | 46 | #define KABC_FMTTAG_location QString("%l") |
47 | #define KABC_FMTTAG_LOCATION QString("%L") | 47 | #define KABC_FMTTAG_LOCATION QString("%L") |
48 | #define KABC_FMTTAG_region QString("%r") | 48 | #define KABC_FMTTAG_region QString("%r") |
49 | #define KABC_FMTTAG_REGION QString("%R") | 49 | #define KABC_FMTTAG_REGION QString("%R") |
50 | #define KABC_FMTTAG_newline QString("\\n") | 50 | #define KABC_FMTTAG_newline QString("\\n") |
51 | #define KABC_FMTTAG_condcomma QString("%,") | 51 | #define KABC_FMTTAG_condcomma QString("%,") |
52 | #define KABC_FMTTAG_condwhite QString("%w") | 52 | #define KABC_FMTTAG_condwhite QString("%w") |
53 | #define KABC_FMTTAG_purgeempty QString("%0") | 53 | #define KABC_FMTTAG_purgeempty QString("%0") |
54 | 54 | ||
55 | namespace KABC { | 55 | namespace KABC { |
56 | 56 | ||
57 | /** | 57 | /** |
58 | @short Postal address information. | 58 | @short Postal address information. |
59 | 59 | ||
60 | This class represents information about a postal address. | 60 | This class represents information about a postal address. |
61 | */ | 61 | */ |
62 | class Address | 62 | class Address |
63 | { | 63 | { |
64 | friend QDataStream &operator<<( QDataStream &, const Address & ); | 64 | friend QDataStream &operator<<( QDataStream &, const Address & ); |
65 | friend QDataStream &operator>>( QDataStream &, Address & ); | 65 | friend QDataStream &operator>>( QDataStream &, Address & ); |
66 | 66 | ||
67 | public: | 67 | public: |
68 | /** | 68 | /** |
69 | List of addresses. | 69 | List of addresses. |
70 | */ | 70 | */ |
71 | typedef QValueList<Address> List; | 71 | typedef Q3ValueList<Address> List; |
72 | typedef QValueList<int> TypeList; | 72 | typedef Q3ValueList<int> TypeList; |
73 | 73 | ||
74 | /** | 74 | /** |
75 | Address types: | 75 | Address types: |
76 | 76 | ||
77 | @li @p Dom - domestic | 77 | @li @p Dom - domestic |
78 | @li @p Intl - international | 78 | @li @p Intl - international |
79 | @li @p Postal - postal | 79 | @li @p Postal - postal |
80 | @li @p Parcel - parcel | 80 | @li @p Parcel - parcel |
81 | @li @p Home - home address | 81 | @li @p Home - home address |
82 | @li @p Work - address at work | 82 | @li @p Work - address at work |
83 | @li @p Pref - preferred address | 83 | @li @p Pref - preferred address |
84 | */ | 84 | */ |
85 | enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32, | 85 | enum Type { Dom = 1, Intl = 2, Postal = 4, Parcel = 8, Home = 16, Work = 32, |
86 | Pref = 64 }; | 86 | Pref = 64 }; |
87 | 87 | ||
88 | /** | 88 | /** |
89 | Constructor that creates an empty Address, which is initialized | 89 | Constructor that creates an empty Address, which is initialized |
90 | with a unique id (see @ref id()). | 90 | with a unique id (see @ref id()). |
91 | */ | 91 | */ |
92 | Address(); | 92 | Address(); |
93 | 93 | ||
94 | /** | 94 | /** |
95 | This is like @ref Address() just above, with the difference | 95 | This is like @ref Address() just above, with the difference |
96 | that you can specify the type. | 96 | that you can specify the type. |
97 | */ | 97 | */ |
98 | Address( int ); | 98 | Address( int ); |
99 | bool matchAddress( QRegExp* searchExp ) const; | 99 | bool matchAddress( QRegExp* searchExp ) const; |
100 | 100 | ||
101 | bool operator==( const Address & ) const; | 101 | bool operator==( const Address & ) const; |
102 | bool operator!=( const Address & ) const; | 102 | bool operator!=( const Address & ) const; |
103 | 103 | ||
104 | /** | 104 | /** |
105 | Returns true, if the address is empty. | 105 | Returns true, if the address is empty. |
106 | */ | 106 | */ |
107 | bool isEmpty() const; | 107 | bool isEmpty() const; |
108 | 108 | ||
109 | /** | 109 | /** |
110 | Clears all entries of the address. | 110 | Clears all entries of the address. |
111 | */ | 111 | */ |
112 | void clear(); | 112 | void clear(); |
113 | QStringList asList(); | 113 | QStringList asList(); |
114 | 114 | ||
115 | /** | 115 | /** |
116 | Sets the unique id. | 116 | Sets the unique id. |
117 | */ | 117 | */ |
118 | void setId( const QString & ); | 118 | void setId( const QString & ); |
119 | 119 | ||
120 | /* | 120 | /* |
121 | Returns the unique id. | 121 | Returns the unique id. |
122 | */ | 122 | */ |
123 | QString id() const; | 123 | QString id() const; |
124 | 124 | ||
125 | /** | 125 | /** |
126 | Sets the type of address. See enum for definiton of types. | 126 | Sets the type of address. See enum for definiton of types. |
127 | 127 | ||
128 | @param type type, can be a bitwise or of multiple types. | 128 | @param type type, can be a bitwise or of multiple types. |
129 | */ | 129 | */ |
130 | void setType( int type ); | 130 | void setType( int type ); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | Returns the type of address. Can be a bitwise or of multiple types. | 133 | Returns the type of address. Can be a bitwise or of multiple types. |
134 | */ | 134 | */ |
135 | int type() const; | 135 | int type() const; |
136 | 136 | ||
137 | /** | 137 | /** |
138 | Returns a translated string of all types the address has. | 138 | Returns a translated string of all types the address has. |
139 | */ | 139 | */ |
140 | QString typeLabel() const; | 140 | QString typeLabel() const; |
141 | 141 | ||
142 | /** | 142 | /** |
143 | Sets the post office box. | 143 | Sets the post office box. |
144 | */ | 144 | */ |
145 | void setPostOfficeBox( const QString & ); | 145 | void setPostOfficeBox( const QString & ); |
146 | 146 | ||
147 | /** | 147 | /** |
148 | Returns the post office box. | 148 | Returns the post office box. |
149 | */ | 149 | */ |
150 | QString postOfficeBox() const; | 150 | QString postOfficeBox() const; |
151 | 151 | ||
152 | /** | 152 | /** |
153 | Returns the translated label for post office box field. | 153 | Returns the translated label for post office box field. |
154 | */ | 154 | */ |
155 | static QString postOfficeBoxLabel(); | 155 | static QString postOfficeBoxLabel(); |
156 | 156 | ||
157 | /** | 157 | /** |
158 | Sets the extended address information. | 158 | Sets the extended address information. |
159 | */ | 159 | */ |
160 | void setExtended( const QString & ); | 160 | void setExtended( const QString & ); |
161 | 161 | ||
162 | /** | 162 | /** |
163 | Returns the extended address information. | 163 | Returns the extended address information. |
164 | */ | 164 | */ |
165 | QString extended() const; | 165 | QString extended() const; |
166 | 166 | ||
167 | /** | 167 | /** |
168 | Returns the translated label for extended field. | 168 | Returns the translated label for extended field. |
169 | */ | 169 | */ |
170 | static QString extendedLabel(); | 170 | static QString extendedLabel(); |
171 | 171 | ||
172 | /** | 172 | /** |
173 | Sets the street (including number). | 173 | Sets the street (including number). |
174 | */ | 174 | */ |
175 | void setStreet( const QString & ); | 175 | void setStreet( const QString & ); |
176 | 176 | ||
177 | /** | 177 | /** |
178 | Returns the street. | 178 | Returns the street. |
179 | */ | 179 | */ |
180 | QString street() const; | 180 | QString street() const; |
181 | 181 | ||
182 | /** | 182 | /** |
183 | Returns the translated label for street field. | 183 | Returns the translated label for street field. |
184 | */ | 184 | */ |
185 | static QString streetLabel(); | 185 | static QString streetLabel(); |
186 | 186 | ||
187 | /** | 187 | /** |
188 | Sets the locality, e.g. city. | 188 | Sets the locality, e.g. city. |
189 | */ | 189 | */ |
190 | void setLocality( const QString & ); | 190 | void setLocality( const QString & ); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | Returns the locality. | 193 | Returns the locality. |
194 | */ | 194 | */ |
195 | QString locality() const; | 195 | QString locality() const; |
196 | 196 | ||
197 | /** | 197 | /** |
198 | Returns the translated label for locality field. | 198 | Returns the translated label for locality field. |
199 | */ | 199 | */ |
200 | static QString localityLabel(); | 200 | static QString localityLabel(); |
201 | 201 | ||
202 | /** | 202 | /** |
203 | Sets the region, e.g. state. | 203 | Sets the region, e.g. state. |
204 | */ | 204 | */ |
205 | void setRegion( const QString & ); | 205 | void setRegion( const QString & ); |
206 | 206 | ||
207 | /** | 207 | /** |
208 | Returns the region. | 208 | Returns the region. |
209 | */ | 209 | */ |
210 | QString region() const; | 210 | QString region() const; |
211 | 211 | ||
212 | /** | 212 | /** |
213 | Returns the translated label for region field. | 213 | Returns the translated label for region field. |
214 | */ | 214 | */ |
215 | static QString regionLabel(); | 215 | static QString regionLabel(); |
216 | 216 | ||
217 | /** | 217 | /** |
218 | Sets the postal code. | 218 | Sets the postal code. |
219 | */ | 219 | */ |
220 | void setPostalCode( const QString & ); | 220 | void setPostalCode( const QString & ); |
221 | 221 | ||
222 | /** | 222 | /** |
223 | Returns the postal code. | 223 | Returns the postal code. |
224 | */ | 224 | */ |
225 | QString postalCode() const; | 225 | QString postalCode() const; |
226 | 226 | ||
227 | /** | 227 | /** |
228 | Returns the translated label for postal code field. | 228 | Returns the translated label for postal code field. |
229 | */ | 229 | */ |
230 | static QString postalCodeLabel(); | 230 | static QString postalCodeLabel(); |
231 | 231 | ||
232 | /** | 232 | /** |
233 | Sets the country. | 233 | Sets the country. |
234 | */ | 234 | */ |
235 | void setCountry( const QString & ); | 235 | void setCountry( const QString & ); |
236 | 236 | ||
237 | /** | 237 | /** |
238 | Returns the country. | 238 | Returns the country. |
239 | */ | 239 | */ |
240 | QString country() const; | 240 | QString country() const; |
241 | 241 | ||
242 | /** | 242 | /** |
243 | Returns the translated label for country field. | 243 | Returns the translated label for country field. |
244 | */ | 244 | */ |
245 | static QString countryLabel(); | 245 | static QString countryLabel(); |
246 | 246 | ||
247 | /** | 247 | /** |
248 | Sets the delivery label. This is the literal text to be used as label. | 248 | Sets the delivery label. This is the literal text to be used as label. |
249 | */ | 249 | */ |
250 | void setLabel( const QString & ); | 250 | void setLabel( const QString & ); |
251 | 251 | ||
252 | /** | 252 | /** |
253 | Returns the delivery label. | 253 | Returns the delivery label. |
254 | */ | 254 | */ |
255 | QString label() const; | 255 | QString label() const; |
256 | 256 | ||
257 | /** | 257 | /** |
258 | Returns the translated label for delivery label field. | 258 | Returns the translated label for delivery label field. |
259 | */ | 259 | */ |
260 | static QString labelLabel(); | 260 | static QString labelLabel(); |
261 | 261 | ||
262 | /** | 262 | /** |
263 | Returns the list of available types. | 263 | Returns the list of available types. |
264 | */ | 264 | */ |
265 | static TypeList typeList(); | 265 | static TypeList typeList(); |
266 | 266 | ||
267 | /** | 267 | /** |
268 | Returns the translated label for a special type. | 268 | Returns the translated label for a special type. |
269 | */ | 269 | */ |
270 | static QString typeLabel( int type ); | 270 | static QString typeLabel( int type ); |
271 | 271 | ||
272 | /** | 272 | /** |
273 | Used for debug output. | 273 | Used for debug output. |
274 | */ | 274 | */ |
275 | void dump() const; | 275 | void dump() const; |
276 | 276 | ||
277 | /** | 277 | /** |
278 | Returns this address formatted according to the country-specific | 278 | Returns this address formatted according to the country-specific |
279 | address formatting rules. The formatting rules applied depend on | 279 | address formatting rules. The formatting rules applied depend on |
280 | either the addresses {@link #country country} field, or (if the | 280 | either the addresses {@link #country country} field, or (if the |
281 | latter is empty) on the system country setting. If companyName is | 281 | latter is empty) on the system country setting. If companyName is |
282 | provided, an available business address format will be preferred. | 282 | provided, an available business address format will be preferred. |
283 | 283 | ||
284 | @param realName the formatted name of the contact | 284 | @param realName the formatted name of the contact |
285 | @param orgaName the name of the organization or company | 285 | @param orgaName the name of the organization or company |
286 | @return the formatted address (containing newline characters) | 286 | @return the formatted address (containing newline characters) |
287 | */ | 287 | */ |
288 | QString formattedAddress( const QString &realName=QString::null | 288 | QString formattedAddress( const QString &realName=QString::null |
289 | , const QString &orgaName=QString::null ) const; | 289 | , const QString &orgaName=QString::null ) const; |
290 | 290 | ||
291 | /** | 291 | /** |
292 | Returns ISO code for a localized country name. Only localized country | 292 | Returns ISO code for a localized country name. Only localized country |
293 | names will be understood. This might be replaced by a KLocale method in | 293 | names will be understood. This might be replaced by a KLocale method in |
294 | the future. | 294 | the future. |
295 | @param cname name of the country | 295 | @param cname name of the country |
296 | @return two digit ISO code | 296 | @return two digit ISO code |
297 | */ | 297 | */ |
298 | static QString countryToISO( const QString &cname ); | 298 | static QString countryToISO( const QString &cname ); |
299 | 299 | ||
300 | /** | 300 | /** |
301 | Returns a localized country name for a ISO code. | 301 | Returns a localized country name for a ISO code. |
302 | This might be replaced by a KLocale method in the future. | 302 | This might be replaced by a KLocale method in the future. |
303 | @param ISOname two digit ISO code | 303 | @param ISOname two digit ISO code |
304 | @return localized name of the country | 304 | @return localized name of the country |
305 | @since 3.2 | 305 | @since 3.2 |
306 | */ | 306 | */ |
307 | static QString ISOtoCountry( const QString &ISOname ); | 307 | static QString ISOtoCountry( const QString &ISOname ); |
308 | 308 | ||
309 | private: | 309 | private: |
310 | /** | 310 | /** |
311 | Parses a snippet of an address template | 311 | Parses a snippet of an address template |
312 | @param tsection the template string to be parsed | 312 | @param tsection the template string to be parsed |
313 | @param result QString reference in which the result will be stored | 313 | @param result QString reference in which the result will be stored |
314 | @return true if at least one tag evaluated positively, else false | 314 | @return true if at least one tag evaluated positively, else false |
315 | */ | 315 | */ |
316 | bool parseAddressTemplateSection( const QString &tsection | 316 | bool parseAddressTemplateSection( const QString &tsection |
317 | , QString &result | 317 | , QString &result |
318 | , const QString &realName | 318 | , const QString &realName |
319 | , const QString &orgaName ) const; | 319 | , const QString &orgaName ) const; |
320 | 320 | ||
321 | /** | 321 | /** |
322 | Finds the balanced closing bracket starting from the opening bracket at | 322 | Finds the balanced closing bracket starting from the opening bracket at |
323 | pos in tsection. | 323 | pos in tsection. |
324 | @return position of closing bracket, -1 for unbalanced brackets | 324 | @return position of closing bracket, -1 for unbalanced brackets |
325 | */ | 325 | */ |
326 | int findBalancedBracket( const QString &tsection, int pos ) const; | 326 | int findBalancedBracket( const QString &tsection, int pos ) const; |
327 | 327 | ||
328 | bool mEmpty; | 328 | bool mEmpty; |
329 | 329 | ||
330 | QString mId; | 330 | QString mId; |
331 | int mType; | 331 | int mType; |
332 | 332 | ||
333 | QString mPostOfficeBox; | 333 | QString mPostOfficeBox; |
334 | QString mExtended; | 334 | QString mExtended; |
335 | QString mStreet; | 335 | QString mStreet; |
336 | QString mLocality; | 336 | QString mLocality; |
337 | QString mRegion; | 337 | QString mRegion; |
338 | QString mPostalCode; | 338 | QString mPostalCode; |
339 | QString mCountry; | 339 | QString mCountry; |
340 | QString mLabel; | 340 | QString mLabel; |
341 | 341 | ||
342 | static QMap<QString, QString> mISOMap; | 342 | static QMap<QString, QString> mISOMap; |
343 | }; | 343 | }; |
344 | 344 | ||
345 | QDataStream &operator<<( QDataStream &, const Address & ); | 345 | QDataStream &operator<<( QDataStream &, const Address & ); |
346 | QDataStream &operator>>( QDataStream &, Address & ); | 346 | QDataStream &operator>>( QDataStream &, Address & ); |
347 | 347 | ||
348 | } | 348 | } |
349 | 349 | ||
350 | #endif | 350 | #endif |
diff --git a/kabc/addressbook.cpp b/kabc/addressbook.cpp index fe59fcb..c700897 100644 --- a/kabc/addressbook.cpp +++ b/kabc/addressbook.cpp | |||
@@ -1,1314 +1,1314 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | /*US | 28 | /*US |
29 | 29 | ||
30 | #include <qfile.h> | 30 | #include <qfile.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qtimer.h> | 32 | #include <qtimer.h> |
33 | 33 | ||
34 | #include <kapplication.h> | 34 | #include <kapplication.h> |
35 | #include <kinstance.h> | 35 | #include <kinstance.h> |
36 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
37 | 37 | ||
38 | #include "errorhandler.h" | 38 | #include "errorhandler.h" |
39 | */ | 39 | */ |
40 | #include <qptrlist.h> | 40 | #include <q3ptrlist.h> |
41 | #include <qtextstream.h> | 41 | #include <q3textstream.h> |
42 | #include <qfile.h> | 42 | #include <qfile.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | 44 | ||
45 | #include <kglobal.h> | 45 | #include <kglobal.h> |
46 | #include <klocale.h> | 46 | #include <klocale.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | #include <kdebug.h> | 48 | #include <kdebug.h> |
49 | #include <libkcal/syncdefines.h> | 49 | #include <libkcal/syncdefines.h> |
50 | #include <libkdepim/phoneaccess.h> | 50 | #include <libkdepim/phoneaccess.h> |
51 | #include "addressbook.h" | 51 | #include "addressbook.h" |
52 | #include "resource.h" | 52 | #include "resource.h" |
53 | #include "vcardconverter.h" | 53 | #include "vcardconverter.h" |
54 | #include "vcardparser/vcardtool.h" | 54 | #include "vcardparser/vcardtool.h" |
55 | 55 | ||
56 | //US #include "addressbook.moc" | 56 | //US #include "addressbook.moc" |
57 | 57 | ||
58 | using namespace KABC; | 58 | using namespace KABC; |
59 | 59 | ||
60 | struct AddressBook::AddressBookData | 60 | struct AddressBook::AddressBookData |
61 | { | 61 | { |
62 | Addressee::List mAddressees; | 62 | Addressee::List mAddressees; |
63 | Addressee::List mRemovedAddressees; | 63 | Addressee::List mRemovedAddressees; |
64 | Field::List mAllFields; | 64 | Field::List mAllFields; |
65 | KConfig *mConfig; | 65 | KConfig *mConfig; |
66 | KRES::Manager<Resource> *mManager; | 66 | KRES::Manager<Resource> *mManager; |
67 | //US ErrorHandler *mErrorHandler; | 67 | //US ErrorHandler *mErrorHandler; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | struct AddressBook::Iterator::IteratorData | 70 | struct AddressBook::Iterator::IteratorData |
71 | { | 71 | { |
72 | Addressee::List::Iterator mIt; | 72 | Addressee::List::Iterator mIt; |
73 | }; | 73 | }; |
74 | 74 | ||
75 | struct AddressBook::ConstIterator::ConstIteratorData | 75 | struct AddressBook::ConstIterator::ConstIteratorData |
76 | { | 76 | { |
77 | Addressee::List::ConstIterator mIt; | 77 | Addressee::List::ConstIterator mIt; |
78 | }; | 78 | }; |
79 | 79 | ||
80 | AddressBook::Iterator::Iterator() | 80 | AddressBook::Iterator::Iterator() |
81 | { | 81 | { |
82 | d = new IteratorData; | 82 | d = new IteratorData; |
83 | } | 83 | } |
84 | 84 | ||
85 | AddressBook::Iterator::Iterator( const AddressBook::Iterator &i ) | 85 | AddressBook::Iterator::Iterator( const AddressBook::Iterator &i ) |
86 | { | 86 | { |
87 | d = new IteratorData; | 87 | d = new IteratorData; |
88 | d->mIt = i.d->mIt; | 88 | d->mIt = i.d->mIt; |
89 | } | 89 | } |
90 | 90 | ||
91 | AddressBook::Iterator &AddressBook::Iterator::operator=( const AddressBook::Iterator &i ) | 91 | AddressBook::Iterator &AddressBook::Iterator::operator=( const AddressBook::Iterator &i ) |
92 | { | 92 | { |
93 | if( this == &i ) return *this; // guard against self assignment | 93 | if( this == &i ) return *this; // guard against self assignment |
94 | delete d; // delete the old data the Iterator was completely constructed before | 94 | delete d; // delete the old data the Iterator was completely constructed before |
95 | d = new IteratorData; | 95 | d = new IteratorData; |
96 | d->mIt = i.d->mIt; | 96 | d->mIt = i.d->mIt; |
97 | return *this; | 97 | return *this; |
98 | } | 98 | } |
99 | 99 | ||
100 | AddressBook::Iterator::~Iterator() | 100 | AddressBook::Iterator::~Iterator() |
101 | { | 101 | { |
102 | delete d; | 102 | delete d; |
103 | } | 103 | } |
104 | 104 | ||
105 | const Addressee &AddressBook::Iterator::operator*() const | 105 | const Addressee &AddressBook::Iterator::operator*() const |
106 | { | 106 | { |
107 | return *(d->mIt); | 107 | return *(d->mIt); |
108 | } | 108 | } |
109 | 109 | ||
110 | Addressee &AddressBook::Iterator::operator*() | 110 | Addressee &AddressBook::Iterator::operator*() |
111 | { | 111 | { |
112 | return *(d->mIt); | 112 | return *(d->mIt); |
113 | } | 113 | } |
114 | 114 | ||
115 | Addressee *AddressBook::Iterator::operator->() | 115 | Addressee *AddressBook::Iterator::operator->() |
116 | { | 116 | { |
117 | return &(*(d->mIt)); | 117 | return &(*(d->mIt)); |
118 | } | 118 | } |
119 | 119 | ||
120 | AddressBook::Iterator &AddressBook::Iterator::operator++() | 120 | AddressBook::Iterator &AddressBook::Iterator::operator++() |
121 | { | 121 | { |
122 | (d->mIt)++; | 122 | (d->mIt)++; |
123 | return *this; | 123 | return *this; |
124 | } | 124 | } |
125 | 125 | ||
126 | AddressBook::Iterator &AddressBook::Iterator::operator++(int) | 126 | AddressBook::Iterator &AddressBook::Iterator::operator++(int) |
127 | { | 127 | { |
128 | (d->mIt)++; | 128 | (d->mIt)++; |
129 | return *this; | 129 | return *this; |
130 | } | 130 | } |
131 | 131 | ||
132 | AddressBook::Iterator &AddressBook::Iterator::operator--() | 132 | AddressBook::Iterator &AddressBook::Iterator::operator--() |
133 | { | 133 | { |
134 | (d->mIt)--; | 134 | (d->mIt)--; |
135 | return *this; | 135 | return *this; |
136 | } | 136 | } |
137 | 137 | ||
138 | AddressBook::Iterator &AddressBook::Iterator::operator--(int) | 138 | AddressBook::Iterator &AddressBook::Iterator::operator--(int) |
139 | { | 139 | { |
140 | (d->mIt)--; | 140 | (d->mIt)--; |
141 | return *this; | 141 | return *this; |
142 | } | 142 | } |
143 | 143 | ||
144 | bool AddressBook::Iterator::operator==( const Iterator &it ) | 144 | bool AddressBook::Iterator::operator==( const Iterator &it ) |
145 | { | 145 | { |
146 | return ( d->mIt == it.d->mIt ); | 146 | return ( d->mIt == it.d->mIt ); |
147 | } | 147 | } |
148 | 148 | ||
149 | bool AddressBook::Iterator::operator!=( const Iterator &it ) | 149 | bool AddressBook::Iterator::operator!=( const Iterator &it ) |
150 | { | 150 | { |
151 | return ( d->mIt != it.d->mIt ); | 151 | return ( d->mIt != it.d->mIt ); |
152 | } | 152 | } |
153 | 153 | ||
154 | 154 | ||
155 | AddressBook::ConstIterator::ConstIterator() | 155 | AddressBook::ConstIterator::ConstIterator() |
156 | { | 156 | { |
157 | d = new ConstIteratorData; | 157 | d = new ConstIteratorData; |
158 | } | 158 | } |
159 | 159 | ||
160 | AddressBook::ConstIterator::ConstIterator( const AddressBook::ConstIterator &i ) | 160 | AddressBook::ConstIterator::ConstIterator( const AddressBook::ConstIterator &i ) |
161 | { | 161 | { |
162 | d = new ConstIteratorData; | 162 | d = new ConstIteratorData; |
163 | d->mIt = i.d->mIt; | 163 | d->mIt = i.d->mIt; |
164 | } | 164 | } |
165 | 165 | ||
166 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i ) | 166 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator=( const AddressBook::ConstIterator &i ) |
167 | { | 167 | { |
168 | if( this == &i ) return *this; // guard for self assignment | 168 | if( this == &i ) return *this; // guard for self assignment |
169 | delete d; // delete the old data because the Iterator was really constructed before | 169 | delete d; // delete the old data because the Iterator was really constructed before |
170 | d = new ConstIteratorData; | 170 | d = new ConstIteratorData; |
171 | d->mIt = i.d->mIt; | 171 | d->mIt = i.d->mIt; |
172 | return *this; | 172 | return *this; |
173 | } | 173 | } |
174 | 174 | ||
175 | AddressBook::ConstIterator::~ConstIterator() | 175 | AddressBook::ConstIterator::~ConstIterator() |
176 | { | 176 | { |
177 | delete d; | 177 | delete d; |
178 | } | 178 | } |
179 | 179 | ||
180 | const Addressee &AddressBook::ConstIterator::operator*() const | 180 | const Addressee &AddressBook::ConstIterator::operator*() const |
181 | { | 181 | { |
182 | return *(d->mIt); | 182 | return *(d->mIt); |
183 | } | 183 | } |
184 | 184 | ||
185 | const Addressee* AddressBook::ConstIterator::operator->() const | 185 | const Addressee* AddressBook::ConstIterator::operator->() const |
186 | { | 186 | { |
187 | return &(*(d->mIt)); | 187 | return &(*(d->mIt)); |
188 | } | 188 | } |
189 | 189 | ||
190 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator++() | 190 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator++() |
191 | { | 191 | { |
192 | (d->mIt)++; | 192 | (d->mIt)++; |
193 | return *this; | 193 | return *this; |
194 | } | 194 | } |
195 | 195 | ||
196 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator++(int) | 196 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator++(int) |
197 | { | 197 | { |
198 | (d->mIt)++; | 198 | (d->mIt)++; |
199 | return *this; | 199 | return *this; |
200 | } | 200 | } |
201 | 201 | ||
202 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator--() | 202 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator--() |
203 | { | 203 | { |
204 | (d->mIt)--; | 204 | (d->mIt)--; |
205 | return *this; | 205 | return *this; |
206 | } | 206 | } |
207 | 207 | ||
208 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator--(int) | 208 | AddressBook::ConstIterator &AddressBook::ConstIterator::operator--(int) |
209 | { | 209 | { |
210 | (d->mIt)--; | 210 | (d->mIt)--; |
211 | return *this; | 211 | return *this; |
212 | } | 212 | } |
213 | 213 | ||
214 | bool AddressBook::ConstIterator::operator==( const ConstIterator &it ) | 214 | bool AddressBook::ConstIterator::operator==( const ConstIterator &it ) |
215 | { | 215 | { |
216 | return ( d->mIt == it.d->mIt ); | 216 | return ( d->mIt == it.d->mIt ); |
217 | } | 217 | } |
218 | 218 | ||
219 | bool AddressBook::ConstIterator::operator!=( const ConstIterator &it ) | 219 | bool AddressBook::ConstIterator::operator!=( const ConstIterator &it ) |
220 | { | 220 | { |
221 | return ( d->mIt != it.d->mIt ); | 221 | return ( d->mIt != it.d->mIt ); |
222 | } | 222 | } |
223 | 223 | ||
224 | 224 | ||
225 | AddressBook::AddressBook() | 225 | AddressBook::AddressBook() |
226 | { | 226 | { |
227 | init(0, "contact"); | 227 | init(0, "contact"); |
228 | } | 228 | } |
229 | 229 | ||
230 | AddressBook::AddressBook( const QString &config ) | 230 | AddressBook::AddressBook( const QString &config ) |
231 | { | 231 | { |
232 | init(config, "contact"); | 232 | init(config, "contact"); |
233 | } | 233 | } |
234 | 234 | ||
235 | AddressBook::AddressBook( const QString &config, const QString &family ) | 235 | AddressBook::AddressBook( const QString &config, const QString &family ) |
236 | { | 236 | { |
237 | init(config, family); | 237 | init(config, family); |
238 | 238 | ||
239 | } | 239 | } |
240 | 240 | ||
241 | // the default family is "contact" | 241 | // the default family is "contact" |
242 | void AddressBook::init(const QString &config, const QString &family ) | 242 | void AddressBook::init(const QString &config, const QString &family ) |
243 | { | 243 | { |
244 | blockLSEchange = false; | 244 | blockLSEchange = false; |
245 | d = new AddressBookData; | 245 | d = new AddressBookData; |
246 | QString fami = family; | 246 | QString fami = family; |
247 | if (config != 0) { | 247 | if (!config.isEmpty()) { |
248 | if ( family == "syncContact" ) { | 248 | if ( family == "syncContact" ) { |
249 | qDebug("creating sync config "); | 249 | qDebug("creating sync config "); |
250 | fami = "contact"; | 250 | fami = "contact"; |
251 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); | 251 | KConfig* con = new KConfig( locateLocal("config", "syncContactrc") ); |
252 | con->setGroup( "General" ); | 252 | con->setGroup( "General" ); |
253 | con->writeEntry( "ResourceKeys", QString("sync") ); | 253 | con->writeEntry( "ResourceKeys", QString("sync") ); |
254 | con->writeEntry( "Standard", QString("sync") ); | 254 | con->writeEntry( "Standard", QString("sync") ); |
255 | con->setGroup( "Resource_sync" ); | 255 | con->setGroup( "Resource_sync" ); |
256 | con->writeEntry( "FileName", config ); | 256 | con->writeEntry( "FileName", config ); |
257 | con->writeEntry( "FileFormat", QString("vcard") ); | 257 | con->writeEntry( "FileFormat", QString("vcard") ); |
258 | con->writeEntry( "ResourceIdentifier", QString("sync") ); | 258 | con->writeEntry( "ResourceIdentifier", QString("sync") ); |
259 | con->writeEntry( "ResourceName", QString("sync_res") ); | 259 | con->writeEntry( "ResourceName", QString("sync_res") ); |
260 | if ( config.right(4) == ".xml" ) | 260 | if ( config.right(4) == ".xml" ) |
261 | con->writeEntry( "ResourceType", QString("qtopia") ); | 261 | con->writeEntry( "ResourceType", QString("qtopia") ); |
262 | else if ( config == "sharp" ) { | 262 | else if ( config == "sharp" ) { |
263 | con->writeEntry( "ResourceType", QString("sharp") ); | 263 | con->writeEntry( "ResourceType", QString("sharp") ); |
264 | } else { | 264 | } else { |
265 | con->writeEntry( "ResourceType", QString("file") ); | 265 | con->writeEntry( "ResourceType", QString("file") ); |
266 | } | 266 | } |
267 | //con->sync(); | 267 | //con->sync(); |
268 | d->mConfig = con; | 268 | d->mConfig = con; |
269 | } | 269 | } |
270 | else | 270 | else |
271 | d->mConfig = new KConfig( locateLocal("config", config) ); | 271 | d->mConfig = new KConfig( locateLocal("config", config) ); |
272 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); | 272 | // qDebug("AddressBook::init 1 config=%s",config.latin1() ); |
273 | } | 273 | } |
274 | else { | 274 | else { |
275 | d->mConfig = 0; | 275 | d->mConfig = 0; |
276 | // qDebug("AddressBook::init 1 config=0"); | 276 | // qDebug("AddressBook::init 1 config=0"); |
277 | } | 277 | } |
278 | 278 | ||
279 | //US d->mErrorHandler = 0; | 279 | //US d->mErrorHandler = 0; |
280 | d->mManager = new KRES::Manager<Resource>( fami ); | 280 | d->mManager = new KRES::Manager<Resource>( fami ); |
281 | d->mManager->readConfig( d->mConfig ); | 281 | d->mManager->readConfig( d->mConfig ); |
282 | if ( family == "syncContact" ) { | 282 | if ( family == "syncContact" ) { |
283 | KRES::Manager<Resource> *manager = d->mManager; | 283 | KRES::Manager<Resource> *manager = d->mManager; |
284 | KRES::Manager<Resource>::ActiveIterator it; | 284 | KRES::Manager<Resource>::ActiveIterator it; |
285 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 285 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
286 | (*it)->setAddressBook( this ); | 286 | (*it)->setAddressBook( this ); |
287 | if ( !(*it)->open() ) | 287 | if ( !(*it)->open() ) |
288 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); | 288 | error( QString( "Unable to open resource '%1'!" ).arg( (*it)->resourceName() ) ); |
289 | } | 289 | } |
290 | Resource *res = standardResource(); | 290 | Resource *res = standardResource(); |
291 | if ( !res ) { | 291 | if ( !res ) { |
292 | qDebug("ERROR: no standard resource"); | 292 | qDebug("ERROR: no standard resource"); |
293 | res = manager->createResource( "file" ); | 293 | res = manager->createResource( "file" ); |
294 | if ( res ) | 294 | if ( res ) |
295 | { | 295 | { |
296 | addResource( res ); | 296 | addResource( res ); |
297 | } | 297 | } |
298 | else | 298 | else |
299 | qDebug(" No resource available!!!"); | 299 | qDebug(" No resource available!!!"); |
300 | } | 300 | } |
301 | setStandardResource( res ); | 301 | setStandardResource( res ); |
302 | manager->writeConfig(); | 302 | manager->writeConfig(); |
303 | } | 303 | } |
304 | addCustomField( i18n( "Department" ), KABC::Field::Organization, | 304 | addCustomField( i18n( "Department" ), KABC::Field::Organization, |
305 | "X-Department", "KADDRESSBOOK" ); | 305 | "X-Department", "KADDRESSBOOK" ); |
306 | addCustomField( i18n( "Profession" ), KABC::Field::Organization, | 306 | addCustomField( i18n( "Profession" ), KABC::Field::Organization, |
307 | "X-Profession", "KADDRESSBOOK" ); | 307 | "X-Profession", "KADDRESSBOOK" ); |
308 | addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, | 308 | addCustomField( i18n( "Assistant's Name" ), KABC::Field::Organization, |
309 | "X-AssistantsName", "KADDRESSBOOK" ); | 309 | "X-AssistantsName", "KADDRESSBOOK" ); |
310 | addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, | 310 | addCustomField( i18n( "Manager's Name" ), KABC::Field::Organization, |
311 | "X-ManagersName", "KADDRESSBOOK" ); | 311 | "X-ManagersName", "KADDRESSBOOK" ); |
312 | addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, | 312 | addCustomField( i18n( "Spouse's Name" ), KABC::Field::Personal, |
313 | "X-SpousesName", "KADDRESSBOOK" ); | 313 | "X-SpousesName", "KADDRESSBOOK" ); |
314 | addCustomField( i18n( "Office" ), KABC::Field::Personal, | 314 | addCustomField( i18n( "Office" ), KABC::Field::Personal, |
315 | "X-Office", "KADDRESSBOOK" ); | 315 | "X-Office", "KADDRESSBOOK" ); |
316 | addCustomField( i18n( "IM Address" ), KABC::Field::Personal, | 316 | addCustomField( i18n( "IM Address" ), KABC::Field::Personal, |
317 | "X-IMAddress", "KADDRESSBOOK" ); | 317 | "X-IMAddress", "KADDRESSBOOK" ); |
318 | addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, | 318 | addCustomField( i18n( "Anniversary" ), KABC::Field::Personal, |
319 | "X-Anniversary", "KADDRESSBOOK" ); | 319 | "X-Anniversary", "KADDRESSBOOK" ); |
320 | 320 | ||
321 | //US added this field to become compatible with Opie/qtopia addressbook | 321 | //US added this field to become compatible with Opie/qtopia addressbook |
322 | // values can be "female" or "male" or "". An empty field represents undefined. | 322 | // values can be "female" or "male" or "". An empty field represents undefined. |
323 | addCustomField( i18n( "Gender" ), KABC::Field::Personal, | 323 | addCustomField( i18n( "Gender" ), KABC::Field::Personal, |
324 | "X-Gender", "KADDRESSBOOK" ); | 324 | "X-Gender", "KADDRESSBOOK" ); |
325 | addCustomField( i18n( "Children" ), KABC::Field::Personal, | 325 | addCustomField( i18n( "Children" ), KABC::Field::Personal, |
326 | "X-Children", "KADDRESSBOOK" ); | 326 | "X-Children", "KADDRESSBOOK" ); |
327 | addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, | 327 | addCustomField( i18n( "FreeBusyUrl" ), KABC::Field::Personal, |
328 | "X-FreeBusyUrl", "KADDRESSBOOK" ); | 328 | "X-FreeBusyUrl", "KADDRESSBOOK" ); |
329 | addCustomField( i18n( "ExternalID" ), KABC::Field::Personal, | 329 | addCustomField( i18n( "ExternalID" ), KABC::Field::Personal, |
330 | "X-ExternalID", "KADDRESSBOOK" ); | 330 | "X-ExternalID", "KADDRESSBOOK" ); |
331 | } | 331 | } |
332 | 332 | ||
333 | AddressBook::~AddressBook() | 333 | AddressBook::~AddressBook() |
334 | { | 334 | { |
335 | delete d->mConfig; d->mConfig = 0; | 335 | delete d->mConfig; d->mConfig = 0; |
336 | delete d->mManager; d->mManager = 0; | 336 | delete d->mManager; d->mManager = 0; |
337 | //US delete d->mErrorHandler; d->mErrorHandler = 0; | 337 | //US delete d->mErrorHandler; d->mErrorHandler = 0; |
338 | delete d; d = 0; | 338 | delete d; d = 0; |
339 | } | 339 | } |
340 | 340 | ||
341 | bool AddressBook::load() | 341 | bool AddressBook::load() |
342 | { | 342 | { |
343 | 343 | ||
344 | clear(); | 344 | clear(); |
345 | KRES::Manager<Resource>::ActiveIterator it; | 345 | KRES::Manager<Resource>::ActiveIterator it; |
346 | bool ok = true; | 346 | bool ok = true; |
347 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) | 347 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |
348 | if ( !(*it)->load() ) { | 348 | if ( !(*it)->load() ) { |
349 | qDebug( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); | 349 | qDebug( i18n("Unable to load resource '%1'").arg( (*it)->resourceName() ) ); |
350 | ok = false; | 350 | ok = false; |
351 | } else { | 351 | } else { |
352 | qDebug( i18n("Resource loaded: '%1'").arg( (*it)->resourceName() ) ); | 352 | qDebug( i18n("Resource loaded: '%1'").arg( (*it)->resourceName() ) ); |
353 | } | 353 | } |
354 | // mark all addressees as unchanged | 354 | // mark all addressees as unchanged |
355 | Addressee::List::Iterator addrIt; | 355 | Addressee::List::Iterator addrIt; |
356 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) { | 356 | for ( addrIt = d->mAddressees.begin(); addrIt != d->mAddressees.end(); ++addrIt ) { |
357 | (*addrIt).setChanged( false ); | 357 | (*addrIt).setChanged( false ); |
358 | QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); | 358 | QString id = (*addrIt).custom( "KADDRESSBOOK", "X-ExternalID" ); |
359 | if ( !id.isEmpty() ) { | 359 | if ( !id.isEmpty() ) { |
360 | //qDebug("setId aa %s ", id.latin1()); | 360 | //qDebug("setId aa %s ", id.latin1()); |
361 | (*addrIt).setIDStr(id ); | 361 | (*addrIt).setIDStr(id ); |
362 | } | 362 | } |
363 | } | 363 | } |
364 | blockLSEchange = true; | 364 | blockLSEchange = true; |
365 | return ok; | 365 | return ok; |
366 | } | 366 | } |
367 | 367 | ||
368 | bool AddressBook::save( Ticket *ticket ) | 368 | bool AddressBook::save( Ticket *ticket ) |
369 | { | 369 | { |
370 | kdDebug(5700) << "AddressBook::save()"<< endl; | 370 | kdDebug(5700) << "AddressBook::save()"<< endl; |
371 | 371 | ||
372 | if ( ticket->resource() ) { | 372 | if ( ticket->resource() ) { |
373 | deleteRemovedAddressees(); | 373 | deleteRemovedAddressees(); |
374 | return ticket->resource()->save( ticket ); | 374 | return ticket->resource()->save( ticket ); |
375 | } | 375 | } |
376 | 376 | ||
377 | return false; | 377 | return false; |
378 | } | 378 | } |
379 | // exports all Addressees, which are syncable | 379 | // exports all Addressees, which are syncable |
380 | void AddressBook::export2File( QString fileName, QString resourceName ) | 380 | void AddressBook::export2File( QString fileName, QString resourceName ) |
381 | { | 381 | { |
382 | 382 | ||
383 | QFile outFile( fileName ); | 383 | QFile outFile( fileName ); |
384 | if ( !outFile.open( IO_WriteOnly ) ) { | 384 | if ( !outFile.open( QIODevice::WriteOnly ) ) { |
385 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); | 385 | QString text = i18n( "<qt>Unable to open file <b>%1</b> for export.</qt>" ); |
386 | KMessageBox::error( 0, text.arg( fileName ) ); | 386 | KMessageBox::error( 0, text.arg( fileName ) ); |
387 | return ; | 387 | return ; |
388 | } | 388 | } |
389 | QTextStream t( &outFile ); | 389 | Q3TextStream t( &outFile ); |
390 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 390 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
391 | Iterator it; | 391 | Iterator it; |
392 | KABC::VCardConverter::Version version; | 392 | KABC::VCardConverter::Version version; |
393 | version = KABC::VCardConverter::v3_0; | 393 | version = KABC::VCardConverter::v3_0; |
394 | for ( it = begin(); it != end(); ++it ) { | 394 | for ( it = begin(); it != end(); ++it ) { |
395 | if ( (*it).resource() ) { | 395 | if ( (*it).resource() ) { |
396 | bool include = (*it).resource()->includeInSync(); | 396 | bool include = (*it).resource()->includeInSync(); |
397 | if ( !resourceName.isEmpty() ) | 397 | if ( !resourceName.isEmpty() ) |
398 | include = (resourceName == (*it).resource()->resourceName() ); | 398 | include = (resourceName == (*it).resource()->resourceName() ); |
399 | if ( include ) { | 399 | if ( include ) { |
400 | //qDebug(QString ("Exporting resource %1 to file %2").arg( (*it).resource()->resourceName() ).arg( fileName ) ); | 400 | //qDebug(QString ("Exporting resource %1 to file %2").arg( (*it).resource()->resourceName() ).arg( fileName ) ); |
401 | if ( !(*it).IDStr().isEmpty() ) { | 401 | if ( !(*it).IDStr().isEmpty() ) { |
402 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); | 402 | (*it).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*it).IDStr() ); |
403 | } | 403 | } |
404 | KABC::VCardConverter converter; | 404 | KABC::VCardConverter converter; |
405 | QString vcard; | 405 | QString vcard; |
406 | //Resource *resource() const; | 406 | //Resource *resource() const; |
407 | converter.addresseeToVCard( *it, vcard, version ); | 407 | converter.addresseeToVCard( *it, vcard, version ); |
408 | t << vcard << "\r\n"; | 408 | t << vcard << "\r\n"; |
409 | } | 409 | } |
410 | } | 410 | } |
411 | } | 411 | } |
412 | t << "\r\n\r\n"; | 412 | t << "\r\n\r\n"; |
413 | outFile.close(); | 413 | outFile.close(); |
414 | } | 414 | } |
415 | // if QStringList uids is empty, all are exported | 415 | // if QStringList uids is empty, all are exported |
416 | bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) | 416 | bool AddressBook::export2PhoneFormat( QStringList uids ,QString fileName ) |
417 | { | 417 | { |
418 | KABC::VCardConverter converter; | 418 | KABC::VCardConverter converter; |
419 | QString datastream; | 419 | QString datastream; |
420 | Iterator it; | 420 | Iterator it; |
421 | bool all = uids.isEmpty(); | 421 | bool all = uids.isEmpty(); |
422 | for ( it = begin(); it != end(); ++it ) { | 422 | for ( it = begin(); it != end(); ++it ) { |
423 | // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { | 423 | // for( QStringList::ConstIterator it = uids.begin(); it != uids.end(); ++it ) { |
424 | if ( ! all ) { | 424 | if ( ! all ) { |
425 | if ( ! ( uids.contains((*it).uid() ) )) | 425 | if ( ! ( uids.contains((*it).uid() ) )) |
426 | continue; | 426 | continue; |
427 | } | 427 | } |
428 | KABC::Addressee a = ( *it ); | 428 | KABC::Addressee a = ( *it ); |
429 | if ( a.isEmpty() ) | 429 | if ( a.isEmpty() ) |
430 | continue; | 430 | continue; |
431 | if ( all && a.resource() && !a.resource()->includeInSync() ) | 431 | if ( all && a.resource() && !a.resource()->includeInSync() ) |
432 | continue; | 432 | continue; |
433 | a.simplifyEmails(); | 433 | a.simplifyEmails(); |
434 | a.simplifyPhoneNumbers(); | 434 | a.simplifyPhoneNumbers(); |
435 | a.simplifyPhoneNumberTypes(); | 435 | a.simplifyPhoneNumberTypes(); |
436 | a.simplifyAddresses(); | 436 | a.simplifyAddresses(); |
437 | 437 | ||
438 | QString vcard; | 438 | QString vcard; |
439 | QString vcardnew; | 439 | QString vcardnew; |
440 | converter.addresseeToVCard( a, vcard ); | 440 | converter.addresseeToVCard( a, vcard ); |
441 | int start = 0; | 441 | int start = 0; |
442 | int next; | 442 | int next; |
443 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { | 443 | while ( (next = vcard.find("TYPE=", start) )>= 0 ) { |
444 | int semi = vcard.find(";", next); | 444 | int semi = vcard.find(";", next); |
445 | int dopp = vcard.find(":", next); | 445 | int dopp = vcard.find(":", next); |
446 | int sep; | 446 | int sep; |
447 | if ( semi < dopp && semi >= 0 ) | 447 | if ( semi < dopp && semi >= 0 ) |
448 | sep = semi ; | 448 | sep = semi ; |
449 | else | 449 | else |
450 | sep = dopp; | 450 | sep = dopp; |
451 | vcardnew +=vcard.mid( start, next - start); | 451 | vcardnew +=vcard.mid( start, next - start); |
452 | vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); | 452 | vcardnew +=vcard.mid( next+5,sep -next -5 ).upper(); |
453 | start = sep; | 453 | start = sep; |
454 | } | 454 | } |
455 | vcardnew += vcard.mid( start,vcard.length() ); | 455 | vcardnew += vcard.mid( start,vcard.length() ); |
456 | vcard = ""; | 456 | vcard = ""; |
457 | start = 0; | 457 | start = 0; |
458 | while ( (next = vcardnew.find("ADR", start) )>= 0 ) { | 458 | while ( (next = vcardnew.find("ADR", start) )>= 0 ) { |
459 | int sep = vcardnew.find(":", next); | 459 | int sep = vcardnew.find(":", next); |
460 | vcard +=vcardnew.mid( start, next - start+3); | 460 | vcard +=vcardnew.mid( start, next - start+3); |
461 | start = sep; | 461 | start = sep; |
462 | } | 462 | } |
463 | vcard += vcardnew.mid( start,vcardnew.length() ); | 463 | vcard += vcardnew.mid( start,vcardnew.length() ); |
464 | vcard.replace ( QRegExp(";;;") , "" ); | 464 | vcard.replace ( QRegExp(";;;") , "" ); |
465 | vcard.replace ( QRegExp(";;") , "" ); | 465 | vcard.replace ( QRegExp(";;") , "" ); |
466 | datastream += vcard; | 466 | datastream += vcard; |
467 | 467 | ||
468 | } | 468 | } |
469 | 469 | ||
470 | QFile outFile(fileName); | 470 | QFile outFile(fileName); |
471 | if ( outFile.open(IO_WriteOnly) ) { | 471 | if ( outFile.open(QIODevice::WriteOnly) ) { |
472 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); | 472 | datastream.replace ( QRegExp("VERSION:3.0") , "VERSION:2.1" ); |
473 | QTextStream t( &outFile ); // use a text stream | 473 | Q3TextStream t( &outFile ); // use a text stream |
474 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 474 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
475 | t <<datastream; | 475 | t <<datastream; |
476 | t << "\r\n\r\n"; | 476 | t << "\r\n\r\n"; |
477 | outFile.close(); | 477 | outFile.close(); |
478 | 478 | ||
479 | } else { | 479 | } else { |
480 | qDebug("Error open temp file "); | 480 | qDebug("Error open temp file "); |
481 | return false; | 481 | return false; |
482 | } | 482 | } |
483 | return true; | 483 | return true; |
484 | 484 | ||
485 | } | 485 | } |
486 | int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld, QString resource ) | 486 | int AddressBook::importFromFile( QString fileName, bool replaceLabel, bool removeOld, QString resource ) |
487 | { | 487 | { |
488 | 488 | ||
489 | if ( removeOld ) | 489 | if ( removeOld ) |
490 | setUntagged( true, resource ); | 490 | setUntagged( true, resource ); |
491 | KABC::Addressee::List list; | 491 | KABC::Addressee::List list; |
492 | QFile file( fileName ); | 492 | QFile file( fileName ); |
493 | file.open( IO_ReadOnly ); | 493 | file.open( QIODevice::ReadOnly ); |
494 | QByteArray rawData = file.readAll(); | 494 | QByteArray rawData = file.readAll(); |
495 | file.close(); | 495 | file.close(); |
496 | QString data; | 496 | QString data; |
497 | if ( replaceLabel ) { | 497 | if ( replaceLabel ) { |
498 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); | 498 | data = QString::fromLatin1( rawData.data(), rawData.size() + 1 ); |
499 | data.replace ( QRegExp("LABEL") , "ADR" ); | 499 | data.replace ( QRegExp("LABEL") , "ADR" ); |
500 | data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); | 500 | data.replace ( QRegExp("CHARSET=ISO-8859-1") , "" ); |
501 | } else | 501 | } else |
502 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 502 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
503 | KABC::VCardTool tool; | 503 | KABC::VCardTool tool; |
504 | list = tool.parseVCards( data ); | 504 | list = tool.parseVCards( data ); |
505 | KABC::Addressee::List::Iterator it; | 505 | KABC::Addressee::List::Iterator it; |
506 | 506 | ||
507 | Resource * setRes = 0; | 507 | Resource * setRes = 0; |
508 | if ( !resource.isEmpty() ) { | 508 | if ( !resource.isEmpty() ) { |
509 | KRES::Manager<Resource>::ActiveIterator it; | 509 | KRES::Manager<Resource>::ActiveIterator it; |
510 | KRES::Manager<Resource> *manager = d->mManager; | 510 | KRES::Manager<Resource> *manager = d->mManager; |
511 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 511 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
512 | //qDebug("SaveAB::checking resource..." ); | 512 | //qDebug("SaveAB::checking resource..." ); |
513 | if ( (*it)->resourceName() == resource ) { | 513 | if ( (*it)->resourceName() == resource ) { |
514 | setRes = (*it); | 514 | setRes = (*it); |
515 | qDebug("KA: AB: Inserting imported contacs to resource %s", resource.latin1()); | 515 | qDebug("KA: AB: Inserting imported contacs to resource %s", resource.latin1()); |
516 | break; | 516 | break; |
517 | } | 517 | } |
518 | } | 518 | } |
519 | } | 519 | } |
520 | for ( it = list.begin(); it != list.end(); ++it ) { | 520 | for ( it = list.begin(); it != list.end(); ++it ) { |
521 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); | 521 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); |
522 | if ( !id.isEmpty() ) | 522 | if ( !id.isEmpty() ) |
523 | (*it).setIDStr(id ); | 523 | (*it).setIDStr(id ); |
524 | (*it).setResource( setRes ); | 524 | (*it).setResource( setRes ); |
525 | if ( replaceLabel ) | 525 | if ( replaceLabel ) |
526 | (*it).removeVoice(); | 526 | (*it).removeVoice(); |
527 | if ( removeOld ) | 527 | if ( removeOld ) |
528 | (*it).setTagged( true ); | 528 | (*it).setTagged( true ); |
529 | insertAddressee( (*it), false, true ); | 529 | insertAddressee( (*it), false, true ); |
530 | } | 530 | } |
531 | if ( removeOld ) | 531 | if ( removeOld ) |
532 | removeUntagged(); | 532 | removeUntagged(); |
533 | return list.count(); | 533 | return list.count(); |
534 | } | 534 | } |
535 | void AddressBook::setUntagged(bool setNonSyncTagged, QString resource) // = false , "") | 535 | void AddressBook::setUntagged(bool setNonSyncTagged, QString resource) // = false , "") |
536 | { | 536 | { |
537 | Iterator ait; | 537 | Iterator ait; |
538 | if ( !resource.isEmpty() ) { | 538 | if ( !resource.isEmpty() ) { |
539 | for ( ait = begin(); ait != end(); ++ait ) { | 539 | for ( ait = begin(); ait != end(); ++ait ) { |
540 | if ( (*ait).resource() && (*ait).resource()->resourceName() == resource ) { | 540 | if ( (*ait).resource() && (*ait).resource()->resourceName() == resource ) { |
541 | (*ait).setTagged( false ); | 541 | (*ait).setTagged( false ); |
542 | } | 542 | } |
543 | else | 543 | else |
544 | (*ait).setTagged( true ); | 544 | (*ait).setTagged( true ); |
545 | } | 545 | } |
546 | } else { | 546 | } else { |
547 | for ( ait = begin(); ait != end(); ++ait ) { | 547 | for ( ait = begin(); ait != end(); ++ait ) { |
548 | if ( setNonSyncTagged ) { | 548 | if ( setNonSyncTagged ) { |
549 | if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { | 549 | if ( (*ait).resource() && ! (*ait).resource()->includeInSync() ) { |
550 | (*ait).setTagged( true ); | 550 | (*ait).setTagged( true ); |
551 | } else | 551 | } else |
552 | (*ait).setTagged( false ); | 552 | (*ait).setTagged( false ); |
553 | } else | 553 | } else |
554 | (*ait).setTagged( false ); | 554 | (*ait).setTagged( false ); |
555 | } | 555 | } |
556 | } | 556 | } |
557 | } | 557 | } |
558 | void AddressBook::removeUntagged() | 558 | void AddressBook::removeUntagged() |
559 | { | 559 | { |
560 | Iterator ait; | 560 | Iterator ait; |
561 | bool todelete = false; | 561 | bool todelete = false; |
562 | Iterator todel; | 562 | Iterator todel; |
563 | for ( ait = begin(); ait != end(); ++ait ) { | 563 | for ( ait = begin(); ait != end(); ++ait ) { |
564 | if ( todelete ) | 564 | if ( todelete ) |
565 | removeAddressee( todel ); | 565 | removeAddressee( todel ); |
566 | if (!(*ait).tagged()) { | 566 | if (!(*ait).tagged()) { |
567 | todelete = true; | 567 | todelete = true; |
568 | todel = ait; | 568 | todel = ait; |
569 | } else | 569 | } else |
570 | todelete = false; | 570 | todelete = false; |
571 | } | 571 | } |
572 | if ( todelete ) | 572 | if ( todelete ) |
573 | removeAddressee( todel ); | 573 | removeAddressee( todel ); |
574 | deleteRemovedAddressees(); | 574 | deleteRemovedAddressees(); |
575 | } | 575 | } |
576 | void AddressBook::smplifyAddressees() | 576 | void AddressBook::smplifyAddressees() |
577 | { | 577 | { |
578 | Iterator ait; | 578 | Iterator ait; |
579 | for ( ait = begin(); ait != end(); ++ait ) { | 579 | for ( ait = begin(); ait != end(); ++ait ) { |
580 | (*ait).simplifyEmails(); | 580 | (*ait).simplifyEmails(); |
581 | (*ait).simplifyPhoneNumbers(); | 581 | (*ait).simplifyPhoneNumbers(); |
582 | (*ait).simplifyPhoneNumberTypes(); | 582 | (*ait).simplifyPhoneNumberTypes(); |
583 | (*ait).simplifyAddresses(); | 583 | (*ait).simplifyAddresses(); |
584 | } | 584 | } |
585 | } | 585 | } |
586 | void AddressBook::removeSyncInfo( QString syncProfile) | 586 | void AddressBook::removeSyncInfo( QString syncProfile) |
587 | { | 587 | { |
588 | Iterator ait; | 588 | Iterator ait; |
589 | for ( ait = begin(); ait != end(); ++ait ) { | 589 | for ( ait = begin(); ait != end(); ++ait ) { |
590 | (*ait).removeID( syncProfile ); | 590 | (*ait).removeID( syncProfile ); |
591 | } | 591 | } |
592 | if ( syncProfile.isEmpty() ) { | 592 | if ( syncProfile.isEmpty() ) { |
593 | Iterator it = begin(); | 593 | Iterator it = begin(); |
594 | Iterator it2 ; | 594 | Iterator it2 ; |
595 | while ( it != end() ) { | 595 | while ( it != end() ) { |
596 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { | 596 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
597 | it2 = it; | 597 | it2 = it; |
598 | //qDebug("removing %s ",(*it).uid().latin1() ); | 598 | //qDebug("removing %s ",(*it).uid().latin1() ); |
599 | ++it; | 599 | ++it; |
600 | removeAddressee( it2 ); | 600 | removeAddressee( it2 ); |
601 | } else { | 601 | } else { |
602 | //qDebug("skipping %s ",(*it).uid().latin1() ); | 602 | //qDebug("skipping %s ",(*it).uid().latin1() ); |
603 | ++it; | 603 | ++it; |
604 | } | 604 | } |
605 | } | 605 | } |
606 | } else { | 606 | } else { |
607 | Addressee lse; | 607 | Addressee lse; |
608 | lse = findByUid( "last-syncAddressee-"+ syncProfile ); | 608 | lse = findByUid( "last-syncAddressee-"+ syncProfile ); |
609 | if ( ! lse.isEmpty() ) | 609 | if ( ! lse.isEmpty() ) |
610 | removeAddressee( lse ); | 610 | removeAddressee( lse ); |
611 | } | 611 | } |
612 | 612 | ||
613 | } | 613 | } |
614 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) | 614 | void AddressBook::preparePhoneSync( QString currentSyncDevice, bool isPreSync ) |
615 | { | 615 | { |
616 | Iterator ait; | 616 | Iterator ait; |
617 | for ( ait = begin(); ait != end(); ++ait ) { | 617 | for ( ait = begin(); ait != end(); ++ait ) { |
618 | QString id = (*ait).IDStr(); | 618 | QString id = (*ait).IDStr(); |
619 | (*ait).setIDStr( ":"); | 619 | (*ait).setIDStr( ":"); |
620 | (*ait).setExternalUID( id ); | 620 | (*ait).setExternalUID( id ); |
621 | (*ait).setOriginalExternalUID( id ); | 621 | (*ait).setOriginalExternalUID( id ); |
622 | if ( isPreSync ) | 622 | if ( isPreSync ) |
623 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); | 623 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_EXTERNAL ); |
624 | else { | 624 | else { |
625 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 625 | (*ait).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
626 | (*ait).setID( currentSyncDevice,id ); | 626 | (*ait).setID( currentSyncDevice,id ); |
627 | 627 | ||
628 | } | 628 | } |
629 | } | 629 | } |
630 | } | 630 | } |
631 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) | 631 | void AddressBook::findNewExtIds( QString fileName, QString currentSyncDevice ) |
632 | { | 632 | { |
633 | 633 | ||
634 | setUntagged(); | 634 | setUntagged(); |
635 | KABC::Addressee::List list; | 635 | KABC::Addressee::List list; |
636 | QFile file( fileName ); | 636 | QFile file( fileName ); |
637 | file.open( IO_ReadOnly ); | 637 | file.open( QIODevice::ReadOnly ); |
638 | QByteArray rawData = file.readAll(); | 638 | QByteArray rawData = file.readAll(); |
639 | file.close(); | 639 | file.close(); |
640 | QString data; | 640 | QString data; |
641 | 641 | ||
642 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); | 642 | data = QString::fromUtf8( rawData.data(), rawData.size() + 1 ); |
643 | KABC::VCardTool tool; | 643 | KABC::VCardTool tool; |
644 | list = tool.parseVCards( data ); | 644 | list = tool.parseVCards( data ); |
645 | KABC::Addressee::List::Iterator it; | 645 | KABC::Addressee::List::Iterator it; |
646 | for ( it = list.begin(); it != list.end(); ++it ) { | 646 | for ( it = list.begin(); it != list.end(); ++it ) { |
647 | Iterator ait; | 647 | Iterator ait; |
648 | for ( ait = begin(); ait != end(); ++ait ) { | 648 | for ( ait = begin(); ait != end(); ++ait ) { |
649 | if ( !(*ait).tagged() ) { | 649 | if ( !(*ait).tagged() ) { |
650 | if ( (*ait).containsAdr(*it)) { | 650 | if ( (*ait).containsAdr(*it)) { |
651 | (*ait).setTagged(true); | 651 | (*ait).setTagged(true); |
652 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); | 652 | QString id = (*it).custom( "KADDRESSBOOK", "X-ExternalID" ); |
653 | (*it).setIDStr( ":"); | 653 | (*it).setIDStr( ":"); |
654 | (*it).setID( currentSyncDevice,id ); | 654 | (*it).setID( currentSyncDevice,id ); |
655 | (*it).setExternalUID( id ); | 655 | (*it).setExternalUID( id ); |
656 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 656 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
657 | (*it).setUid( ( (*ait).uid() )); | 657 | (*it).setUid( ( (*ait).uid() )); |
658 | break; | 658 | break; |
659 | } | 659 | } |
660 | } | 660 | } |
661 | 661 | ||
662 | } | 662 | } |
663 | if ( ait == end() ) | 663 | if ( ait == end() ) |
664 | qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1()); | 664 | qDebug("ERROR:: no ext ID found for uid: %s", (*it).uid().latin1()); |
665 | } | 665 | } |
666 | clear(); | 666 | clear(); |
667 | for ( it = list.begin(); it != list.end(); ++it ) { | 667 | for ( it = list.begin(); it != list.end(); ++it ) { |
668 | insertAddressee( (*it) ); | 668 | insertAddressee( (*it) ); |
669 | } | 669 | } |
670 | } | 670 | } |
671 | 671 | ||
672 | bool AddressBook::saveABphone( QString fileName ) | 672 | bool AddressBook::saveABphone( QString fileName ) |
673 | { | 673 | { |
674 | //smplifyAddressees(); | 674 | //smplifyAddressees(); |
675 | qDebug("saveABphone:: saving AB... "); | 675 | qDebug("saveABphone:: saving AB... "); |
676 | if ( ! export2PhoneFormat( QStringList() ,fileName ) ) | 676 | if ( ! export2PhoneFormat( QStringList() ,fileName ) ) |
677 | return false; | 677 | return false; |
678 | qDebug("saveABphone:: writing to phone... "); | 678 | qDebug("saveABphone:: writing to phone... "); |
679 | if ( !PhoneAccess::writeToPhone( fileName) ) { | 679 | if ( !PhoneAccess::writeToPhone( fileName) ) { |
680 | return false; | 680 | return false; |
681 | } | 681 | } |
682 | qDebug("saveABphone:: re-reading from phone... "); | 682 | qDebug("saveABphone:: re-reading from phone... "); |
683 | if ( !PhoneAccess::readFromPhone( fileName) ) { | 683 | if ( !PhoneAccess::readFromPhone( fileName) ) { |
684 | return false; | 684 | return false; |
685 | } | 685 | } |
686 | return true; | 686 | return true; |
687 | } | 687 | } |
688 | bool AddressBook::saveAB() | 688 | bool AddressBook::saveAB() |
689 | { | 689 | { |
690 | bool ok = true; | 690 | bool ok = true; |
691 | 691 | ||
692 | deleteRemovedAddressees(); | 692 | deleteRemovedAddressees(); |
693 | Iterator ait; | 693 | Iterator ait; |
694 | for ( ait = begin(); ait != end(); ++ait ) { | 694 | for ( ait = begin(); ait != end(); ++ait ) { |
695 | if ( !(*ait).IDStr().isEmpty() ) { | 695 | if ( !(*ait).IDStr().isEmpty() ) { |
696 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); | 696 | (*ait).insertCustom( "KADDRESSBOOK", "X-ExternalID", (*ait).IDStr() ); |
697 | } | 697 | } |
698 | } | 698 | } |
699 | KRES::Manager<Resource>::ActiveIterator it; | 699 | KRES::Manager<Resource>::ActiveIterator it; |
700 | KRES::Manager<Resource> *manager = d->mManager; | 700 | KRES::Manager<Resource> *manager = d->mManager; |
701 | qDebug("SaveAB::saving..." ); | 701 | qDebug("SaveAB::saving..." ); |
702 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { | 702 | for ( it = manager->activeBegin(); it != manager->activeEnd(); ++it ) { |
703 | qDebug("SaveAB::checking resource..." ); | 703 | qDebug("SaveAB::checking resource..." ); |
704 | if ( (*it)->readOnly() ) | 704 | if ( (*it)->readOnly() ) |
705 | qDebug("SaveAB::resource is readonly." ); | 705 | qDebug("SaveAB::resource is readonly." ); |
706 | if ( (*it)->isOpen() ) | 706 | if ( (*it)->isOpen() ) |
707 | qDebug("SaveAB::resource is open" ); | 707 | qDebug("SaveAB::resource is open" ); |
708 | 708 | ||
709 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { | 709 | if ( !(*it)->readOnly() && (*it)->isOpen() ) { |
710 | Ticket *ticket = requestSaveTicket( *it ); | 710 | Ticket *ticket = requestSaveTicket( *it ); |
711 | qDebug("SaveAB::StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); | 711 | qDebug("SaveAB::StdAddressBook::save '%s'", (*it)->resourceName().latin1() ); |
712 | if ( !ticket ) { | 712 | if ( !ticket ) { |
713 | qDebug( i18n( "SaveAB::Unable to save to resource '%1'. It is locked." ) | 713 | qDebug( i18n( "SaveAB::Unable to save to resource '%1'. It is locked." ) |
714 | .arg( (*it)->resourceName() ) ); | 714 | .arg( (*it)->resourceName() ) ); |
715 | return false; | 715 | return false; |
716 | } | 716 | } |
717 | 717 | ||
718 | //if ( !save( ticket ) ) | 718 | //if ( !save( ticket ) ) |
719 | if ( ticket->resource() ) { | 719 | if ( ticket->resource() ) { |
720 | QString name = ticket->resource()->resourceName(); | 720 | QString name = ticket->resource()->resourceName(); |
721 | if ( ! ticket->resource()->save( ticket ) ) | 721 | if ( ! ticket->resource()->save( ticket ) ) |
722 | ok = false; | 722 | ok = false; |
723 | else | 723 | else |
724 | qDebug("SaveAB::resource saved '%s'", name.latin1() ); | 724 | qDebug("SaveAB::resource saved '%s'", name.latin1() ); |
725 | 725 | ||
726 | } else | 726 | } else |
727 | ok = false; | 727 | ok = false; |
728 | 728 | ||
729 | } | 729 | } |
730 | } | 730 | } |
731 | return ok; | 731 | return ok; |
732 | } | 732 | } |
733 | 733 | ||
734 | AddressBook::Iterator AddressBook::begin() | 734 | AddressBook::Iterator AddressBook::begin() |
735 | { | 735 | { |
736 | Iterator it = Iterator(); | 736 | Iterator it = Iterator(); |
737 | it.d->mIt = d->mAddressees.begin(); | 737 | it.d->mIt = d->mAddressees.begin(); |
738 | return it; | 738 | return it; |
739 | } | 739 | } |
740 | 740 | ||
741 | AddressBook::ConstIterator AddressBook::begin() const | 741 | AddressBook::ConstIterator AddressBook::begin() const |
742 | { | 742 | { |
743 | ConstIterator it = ConstIterator(); | 743 | ConstIterator it = ConstIterator(); |
744 | it.d->mIt = d->mAddressees.begin(); | 744 | it.d->mIt = d->mAddressees.begin(); |
745 | return it; | 745 | return it; |
746 | } | 746 | } |
747 | 747 | ||
748 | AddressBook::Iterator AddressBook::end() | 748 | AddressBook::Iterator AddressBook::end() |
749 | { | 749 | { |
750 | Iterator it = Iterator(); | 750 | Iterator it = Iterator(); |
751 | it.d->mIt = d->mAddressees.end(); | 751 | it.d->mIt = d->mAddressees.end(); |
752 | return it; | 752 | return it; |
753 | } | 753 | } |
754 | 754 | ||
755 | AddressBook::ConstIterator AddressBook::end() const | 755 | AddressBook::ConstIterator AddressBook::end() const |
756 | { | 756 | { |
757 | ConstIterator it = ConstIterator(); | 757 | ConstIterator it = ConstIterator(); |
758 | it.d->mIt = d->mAddressees.end(); | 758 | it.d->mIt = d->mAddressees.end(); |
759 | return it; | 759 | return it; |
760 | } | 760 | } |
761 | 761 | ||
762 | void AddressBook::clear() | 762 | void AddressBook::clear() |
763 | { | 763 | { |
764 | d->mAddressees.clear(); | 764 | d->mAddressees.clear(); |
765 | } | 765 | } |
766 | 766 | ||
767 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) | 767 | Ticket *AddressBook::requestSaveTicket( Resource *resource ) |
768 | { | 768 | { |
769 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; | 769 | kdDebug(5700) << "AddressBook::requestSaveTicket()" << endl; |
770 | 770 | ||
771 | if ( !resource ) | 771 | if ( !resource ) |
772 | { | 772 | { |
773 | qDebug("AddressBook::requestSaveTicket no resource" ); | 773 | qDebug("AddressBook::requestSaveTicket no resource" ); |
774 | resource = standardResource(); | 774 | resource = standardResource(); |
775 | } | 775 | } |
776 | 776 | ||
777 | KRES::Manager<Resource>::ActiveIterator it; | 777 | KRES::Manager<Resource>::ActiveIterator it; |
778 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 778 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
779 | if ( (*it) == resource ) { | 779 | if ( (*it) == resource ) { |
780 | if ( (*it)->readOnly() || !(*it)->isOpen() ) | 780 | if ( (*it)->readOnly() || !(*it)->isOpen() ) |
781 | return 0; | 781 | return 0; |
782 | else | 782 | else |
783 | return (*it)->requestSaveTicket(); | 783 | return (*it)->requestSaveTicket(); |
784 | } | 784 | } |
785 | } | 785 | } |
786 | 786 | ||
787 | return 0; | 787 | return 0; |
788 | } | 788 | } |
789 | //void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); | 789 | //void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); |
790 | void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) | 790 | void AddressBook::insertAddressee( const Addressee &a, bool setRev, bool takeResource ) |
791 | { | 791 | { |
792 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { | 792 | if ( blockLSEchange && setRev && a.uid().left( 19 ) == QString("last-syncAddressee-") ) { |
793 | //qDebug("block insert "); | 793 | //qDebug("block insert "); |
794 | return; | 794 | return; |
795 | } | 795 | } |
796 | //qDebug("inserting.... %s ",a.uid().latin1() ); | 796 | //qDebug("inserting.... %s ",a.uid().latin1() ); |
797 | bool found = false; | 797 | bool found = false; |
798 | Addressee::List::Iterator it; | 798 | Addressee::List::Iterator it; |
799 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { | 799 | for ( it = d->mAddressees.begin(); it != d->mAddressees.end(); ++it ) { |
800 | if ( a.uid() == (*it).uid() ) { | 800 | if ( a.uid() == (*it).uid() ) { |
801 | 801 | ||
802 | bool changed = false; | 802 | bool changed = false; |
803 | Addressee addr = a; | 803 | Addressee addr = a; |
804 | if ( addr != (*it) ) | 804 | if ( addr != (*it) ) |
805 | changed = true; | 805 | changed = true; |
806 | 806 | ||
807 | if ( takeResource ) { | 807 | if ( takeResource ) { |
808 | Resource * res = (*it).resource(); | 808 | Resource * res = (*it).resource(); |
809 | (*it) = a; | 809 | (*it) = a; |
810 | (*it).setResource( res ); | 810 | (*it).setResource( res ); |
811 | } else { | 811 | } else { |
812 | (*it) = a; | 812 | (*it) = a; |
813 | if ( (*it).resource() == 0 ) | 813 | if ( (*it).resource() == 0 ) |
814 | (*it).setResource( standardResource() ); | 814 | (*it).setResource( standardResource() ); |
815 | } | 815 | } |
816 | if ( changed ) { | 816 | if ( changed ) { |
817 | if ( setRev ) { | 817 | if ( setRev ) { |
818 | (*it).setRevision( QDateTime::currentDateTime() ); | 818 | (*it).setRevision( QDateTime::currentDateTime() ); |
819 | } | 819 | } |
820 | (*it).setChanged( true ); | 820 | (*it).setChanged( true ); |
821 | } | 821 | } |
822 | 822 | ||
823 | found = true; | 823 | found = true; |
824 | } else { | 824 | } else { |
825 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { | 825 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
826 | QString name = (*it).uid().mid( 19 ); | 826 | QString name = (*it).uid().mid( 19 ); |
827 | Addressee b = a; | 827 | Addressee b = a; |
828 | QString id = b.getID( name ); | 828 | QString id = b.getID( name ); |
829 | if ( ! id.isEmpty() ) { | 829 | if ( ! id.isEmpty() ) { |
830 | QString des = (*it).note(); | 830 | QString des = (*it).note(); |
831 | int startN; | 831 | int startN; |
832 | if( (startN = des.find( id ) ) >= 0 ) { | 832 | if( (startN = des.find( id ) ) >= 0 ) { |
833 | int endN = des.find( ",", startN+1 ); | 833 | int endN = des.find( ",", startN+1 ); |
834 | des = des.left( startN ) + des.mid( endN+1 ); | 834 | des = des.left( startN ) + des.mid( endN+1 ); |
835 | (*it).setNote( des ); | 835 | (*it).setNote( des ); |
836 | } | 836 | } |
837 | } | 837 | } |
838 | } | 838 | } |
839 | } | 839 | } |
840 | } | 840 | } |
841 | if ( found ) | 841 | if ( found ) |
842 | return; | 842 | return; |
843 | 843 | ||
844 | d->mAddressees.append( a ); | 844 | d->mAddressees.append( a ); |
845 | Addressee& addr = d->mAddressees.last(); | 845 | Addressee& addr = d->mAddressees.last(); |
846 | if ( addr.resource() == 0 ) | 846 | if ( addr.resource() == 0 ) |
847 | addr.setResource( standardResource() ); | 847 | addr.setResource( standardResource() ); |
848 | addr.setChanged( true ); | 848 | addr.setChanged( true ); |
849 | } | 849 | } |
850 | 850 | ||
851 | void AddressBook::removeAddressee( const Addressee &a ) | 851 | void AddressBook::removeAddressee( const Addressee &a ) |
852 | { | 852 | { |
853 | Iterator it; | 853 | Iterator it; |
854 | Iterator it2; | 854 | Iterator it2; |
855 | bool found = false; | 855 | bool found = false; |
856 | for ( it = begin(); it != end(); ++it ) { | 856 | for ( it = begin(); it != end(); ++it ) { |
857 | if ( a.uid() == (*it).uid() ) { | 857 | if ( a.uid() == (*it).uid() ) { |
858 | found = true; | 858 | found = true; |
859 | it2 = it; | 859 | it2 = it; |
860 | } else { | 860 | } else { |
861 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { | 861 | if ( (*it).uid().left( 19 ) == QString("last-syncAddressee-") ) { |
862 | QString name = (*it).uid().mid( 19 ); | 862 | QString name = (*it).uid().mid( 19 ); |
863 | Addressee b = a; | 863 | Addressee b = a; |
864 | QString id = b.getID( name ); | 864 | QString id = b.getID( name ); |
865 | if ( ! id.isEmpty() ) { | 865 | if ( ! id.isEmpty() ) { |
866 | QString des = (*it).note(); | 866 | QString des = (*it).note(); |
867 | if( des.find( id ) < 0 ) { | 867 | if( des.find( id ) < 0 ) { |
868 | des += id + ","; | 868 | des += id + ","; |
869 | (*it).setNote( des ); | 869 | (*it).setNote( des ); |
870 | } | 870 | } |
871 | } | 871 | } |
872 | } | 872 | } |
873 | 873 | ||
874 | } | 874 | } |
875 | } | 875 | } |
876 | 876 | ||
877 | if ( found ) | 877 | if ( found ) |
878 | removeAddressee( it2 ); | 878 | removeAddressee( it2 ); |
879 | 879 | ||
880 | } | 880 | } |
881 | 881 | ||
882 | void AddressBook::removeSyncAddressees( bool removeDeleted ) | 882 | void AddressBook::removeSyncAddressees( bool removeDeleted ) |
883 | { | 883 | { |
884 | Iterator it = begin(); | 884 | Iterator it = begin(); |
885 | Iterator it2 ; | 885 | Iterator it2 ; |
886 | QDateTime dt ( QDate( 2003,1,1) ); | 886 | QDateTime dt ( QDate( 2003,1,1) ); |
887 | while ( it != end() ) { | 887 | while ( it != end() ) { |
888 | (*it).setRevision( dt ); | 888 | (*it).setRevision( dt ); |
889 | if (( *it).IDStr() != "changed" ) { | 889 | if (( *it).IDStr() != "changed" ) { |
890 | // "changed" is used for tagging changed addressees when syncing with KDE or OL | 890 | // "changed" is used for tagging changed addressees when syncing with KDE or OL |
891 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); | 891 | (*it).removeCustom( "KADDRESSBOOK", "X-ExternalID" ); |
892 | (*it).setIDStr(":"); | 892 | (*it).setIDStr(":"); |
893 | } | 893 | } |
894 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { | 894 | if ( ( (*it).tempSyncStat() == SYNC_TEMPSTATE_DELETE && removeDeleted )|| (*it).uid().left( 19 ) == QString("last-syncAddressee-")) { |
895 | it2 = it; | 895 | it2 = it; |
896 | //qDebug("removing %s ",(*it).uid().latin1() ); | 896 | //qDebug("removing %s ",(*it).uid().latin1() ); |
897 | ++it; | 897 | ++it; |
898 | removeAddressee( it2 ); | 898 | removeAddressee( it2 ); |
899 | } else { | 899 | } else { |
900 | //qDebug("skipping %s ",(*it).uid().latin1() ); | 900 | //qDebug("skipping %s ",(*it).uid().latin1() ); |
901 | if ( removeDeleted ) { | 901 | if ( removeDeleted ) { |
902 | // we have no postprocessing in the resource, we have to do it here | 902 | // we have no postprocessing in the resource, we have to do it here |
903 | // we have to compute csum for all, because it could be the first sync | 903 | // we have to compute csum for all, because it could be the first sync |
904 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); | 904 | (*it).setTempSyncStat( SYNC_TEMPSTATE_NEW_ID ); |
905 | } | 905 | } |
906 | ++it; | 906 | ++it; |
907 | } | 907 | } |
908 | } | 908 | } |
909 | deleteRemovedAddressees(); | 909 | deleteRemovedAddressees(); |
910 | } | 910 | } |
911 | 911 | ||
912 | void AddressBook::removeAddressee( const Iterator &it ) | 912 | void AddressBook::removeAddressee( const Iterator &it ) |
913 | { | 913 | { |
914 | d->mRemovedAddressees.append( (*it) ); | 914 | d->mRemovedAddressees.append( (*it) ); |
915 | d->mAddressees.remove( it.d->mIt ); | 915 | d->mAddressees.remove( it.d->mIt ); |
916 | } | 916 | } |
917 | 917 | ||
918 | AddressBook::Iterator AddressBook::find( const Addressee &a ) | 918 | AddressBook::Iterator AddressBook::find( const Addressee &a ) |
919 | { | 919 | { |
920 | Iterator it; | 920 | Iterator it; |
921 | for ( it = begin(); it != end(); ++it ) { | 921 | for ( it = begin(); it != end(); ++it ) { |
922 | if ( a.uid() == (*it).uid() ) { | 922 | if ( a.uid() == (*it).uid() ) { |
923 | return it; | 923 | return it; |
924 | } | 924 | } |
925 | } | 925 | } |
926 | return end(); | 926 | return end(); |
927 | } | 927 | } |
928 | 928 | ||
929 | Addressee AddressBook::findByUid( const QString &uid ) | 929 | Addressee AddressBook::findByUid( const QString &uid ) |
930 | { | 930 | { |
931 | Iterator it; | 931 | Iterator it; |
932 | for ( it = begin(); it != end(); ++it ) { | 932 | for ( it = begin(); it != end(); ++it ) { |
933 | if ( uid == (*it).uid() ) { | 933 | if ( uid == (*it).uid() ) { |
934 | return *it; | 934 | return *it; |
935 | } | 935 | } |
936 | } | 936 | } |
937 | return Addressee(); | 937 | return Addressee(); |
938 | } | 938 | } |
939 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) | 939 | void AddressBook::preExternSync( AddressBook* aBook, const QString& csd , bool isSubset ) |
940 | { | 940 | { |
941 | //qDebug("AddressBook::preExternSync "); | 941 | //qDebug("AddressBook::preExternSync "); |
942 | AddressBook::Iterator it; | 942 | AddressBook::Iterator it; |
943 | for ( it = begin(); it != end(); ++it ) { | 943 | for ( it = begin(); it != end(); ++it ) { |
944 | (*it).setID( csd, (*it).externalUID() ); | 944 | (*it).setID( csd, (*it).externalUID() ); |
945 | (*it).computeCsum( csd ); | 945 | (*it).computeCsum( csd ); |
946 | } | 946 | } |
947 | mergeAB( aBook ,csd, isSubset ); | 947 | mergeAB( aBook ,csd, isSubset ); |
948 | } | 948 | } |
949 | void AddressBook::preOLSync( AddressBook* aBook, const QString& csd ) | 949 | void AddressBook::preOLSync( AddressBook* aBook, const QString& csd ) |
950 | { | 950 | { |
951 | //qDebug("AddressBook::preExternSync "); | 951 | //qDebug("AddressBook::preExternSync "); |
952 | AddressBook::Iterator it; | 952 | AddressBook::Iterator it; |
953 | for ( it = begin(); it != end(); ++it ) { | 953 | for ( it = begin(); it != end(); ++it ) { |
954 | (*it).setID( csd, (*it).externalUID() ); | 954 | (*it).setID( csd, (*it).externalUID() ); |
955 | (*it).computeCsum( csd ); | 955 | (*it).computeCsum( csd ); |
956 | } | 956 | } |
957 | 957 | ||
958 | Addressee ad; | 958 | Addressee ad; |
959 | for ( it = begin(); it != end(); ++it ) { | 959 | for ( it = begin(); it != end(); ++it ) { |
960 | ad = aBook->findByExternUid( (*it).externalUID(), csd ); | 960 | ad = aBook->findByExternUid( (*it).externalUID(), csd ); |
961 | if ( !ad.isEmpty() ) { | 961 | if ( !ad.isEmpty() ) { |
962 | (*it).mergeOLContact( ad ); | 962 | (*it).mergeOLContact( ad ); |
963 | } | 963 | } |
964 | } | 964 | } |
965 | } | 965 | } |
966 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) | 966 | void AddressBook::postExternSync( AddressBook* aBook , const QString& csd, bool setID) |
967 | { | 967 | { |
968 | //qDebug("AddressBook::postExternSync "); | 968 | //qDebug("AddressBook::postExternSync "); |
969 | AddressBook::Iterator it; | 969 | AddressBook::Iterator it; |
970 | int foundEmpty = 0; | 970 | int foundEmpty = 0; |
971 | for ( it = begin(); it != end(); ++it ) { | 971 | for ( it = begin(); it != end(); ++it ) { |
972 | //qDebug("check uid %s ", (*it).uid().latin1() ); | 972 | //qDebug("check uid %s ", (*it).uid().latin1() ); |
973 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || | 973 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID || |
974 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || | 974 | (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_CSUM || |
975 | (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { | 975 | (*it).tempSyncStat() == SYNC_TEMPSTATE_ADDED_EXTERNAL) { |
976 | Addressee ad = aBook->findByUid( ( (*it).uid() )); | 976 | Addressee ad = aBook->findByUid( ( (*it).uid() )); |
977 | if ( ad.isEmpty() ) { | 977 | if ( ad.isEmpty() ) { |
978 | ++foundEmpty; | 978 | ++foundEmpty; |
979 | //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); | 979 | //qDebug("postExternSync:addressee is empty: %s ", (*it).uid().latin1()); |
980 | //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); | 980 | //qDebug("-- formatted name %s ",(*it).formattedName().latin1() ); |
981 | } else { | 981 | } else { |
982 | (*it).setIDStr(":"); | 982 | (*it).setIDStr(":"); |
983 | if ( setID ) { | 983 | if ( setID ) { |
984 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) | 984 | if ( (*it).tempSyncStat() == SYNC_TEMPSTATE_NEW_ID ) |
985 | ad.setID( csd, (*it).externalUID() );{ | 985 | ad.setID( csd, (*it).externalUID() );{ |
986 | } | 986 | } |
987 | } else | 987 | } else |
988 | ad.setID( csd, (*it).uid() ); | 988 | ad.setID( csd, (*it).uid() ); |
989 | (*it).computeCsum( csd ); | 989 | (*it).computeCsum( csd ); |
990 | ad.setCsum( csd, (*it).getCsum( csd ) ); | 990 | ad.setCsum( csd, (*it).getCsum( csd ) ); |
991 | //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); | 991 | //qDebug("CSUM %s ",(*it).getCsum( csd ).latin1() ); |
992 | aBook->insertAddressee( ad , false); | 992 | aBook->insertAddressee( ad , false); |
993 | } | 993 | } |
994 | } | 994 | } |
995 | } | 995 | } |
996 | if ( foundEmpty ) { | 996 | if ( foundEmpty ) { |
997 | qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); | 997 | qDebug("postExternSync:%d empty addressees found:\n probably filtered out by incoming sync filter.",foundEmpty ); |
998 | } | 998 | } |
999 | 999 | ||
1000 | } | 1000 | } |
1001 | 1001 | ||
1002 | bool AddressBook::containsExternalUid( const QString& uid ) | 1002 | bool AddressBook::containsExternalUid( const QString& uid ) |
1003 | { | 1003 | { |
1004 | Iterator it; | 1004 | Iterator it; |
1005 | for ( it = begin(); it != end(); ++it ) { | 1005 | for ( it = begin(); it != end(); ++it ) { |
1006 | if ( uid == (*it).externalUID( ) ) | 1006 | if ( uid == (*it).externalUID( ) ) |
1007 | return true; | 1007 | return true; |
1008 | } | 1008 | } |
1009 | return false; | 1009 | return false; |
1010 | } | 1010 | } |
1011 | const Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) const | 1011 | const Addressee AddressBook::findByExternUid( const QString& uid , const QString& profile ) const |
1012 | { | 1012 | { |
1013 | ConstIterator it; | 1013 | ConstIterator it; |
1014 | for ( it = begin(); it != end(); ++it ) { | 1014 | for ( it = begin(); it != end(); ++it ) { |
1015 | if ( uid == (*it).getID( profile ) ) | 1015 | if ( uid == (*it).getID( profile ) ) |
1016 | return (*it); | 1016 | return (*it); |
1017 | } | 1017 | } |
1018 | return Addressee(); | 1018 | return Addressee(); |
1019 | } | 1019 | } |
1020 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) | 1020 | void AddressBook::mergeAB( AddressBook *aBook, const QString& profile , bool isSubset ) |
1021 | { | 1021 | { |
1022 | Iterator it; | 1022 | Iterator it; |
1023 | Addressee ad; | 1023 | Addressee ad; |
1024 | for ( it = begin(); it != end(); ++it ) { | 1024 | for ( it = begin(); it != end(); ++it ) { |
1025 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); | 1025 | ad = aBook->findByExternUid( (*it).externalUID(), profile ); |
1026 | if ( !ad.isEmpty() ) { | 1026 | if ( !ad.isEmpty() ) { |
1027 | (*it).mergeContact( ad ,isSubset); | 1027 | (*it).mergeContact( ad ,isSubset); |
1028 | } | 1028 | } |
1029 | } | 1029 | } |
1030 | #if 0 | 1030 | #if 0 |
1031 | // test only | 1031 | // test only |
1032 | for ( it = begin(); it != end(); ++it ) { | 1032 | for ( it = begin(); it != end(); ++it ) { |
1033 | 1033 | ||
1034 | qDebug("uid %s ", (*it).uid().latin1()); | 1034 | qDebug("uid %s ", (*it).uid().latin1()); |
1035 | } | 1035 | } |
1036 | #endif | 1036 | #endif |
1037 | } | 1037 | } |
1038 | 1038 | ||
1039 | #if 0 | 1039 | #if 0 |
1040 | Addressee::List AddressBook::getExternLastSyncAddressees() | 1040 | Addressee::List AddressBook::getExternLastSyncAddressees() |
1041 | { | 1041 | { |
1042 | Addressee::List results; | 1042 | Addressee::List results; |
1043 | 1043 | ||
1044 | Iterator it; | 1044 | Iterator it; |
1045 | for ( it = begin(); it != end(); ++it ) { | 1045 | for ( it = begin(); it != end(); ++it ) { |
1046 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { | 1046 | if ( (*it).uid().left( 19 ) == "last-syncAddressee-" ) { |
1047 | if ( (*it).familyName().left(4) == "!E: " ) | 1047 | if ( (*it).familyName().left(4) == "!E: " ) |
1048 | results.append( *it ); | 1048 | results.append( *it ); |
1049 | } | 1049 | } |
1050 | } | 1050 | } |
1051 | 1051 | ||
1052 | return results; | 1052 | return results; |
1053 | } | 1053 | } |
1054 | #endif | 1054 | #endif |
1055 | void AddressBook::resetTempSyncStat() | 1055 | void AddressBook::resetTempSyncStat() |
1056 | { | 1056 | { |
1057 | Iterator it; | 1057 | Iterator it; |
1058 | for ( it = begin(); it != end(); ++it ) { | 1058 | for ( it = begin(); it != end(); ++it ) { |
1059 | (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); | 1059 | (*it).setTempSyncStat ( SYNC_TEMPSTATE_INITIAL ); |
1060 | } | 1060 | } |
1061 | 1061 | ||
1062 | } | 1062 | } |
1063 | 1063 | ||
1064 | QStringList AddressBook:: uidList() | 1064 | QStringList AddressBook:: uidList() |
1065 | { | 1065 | { |
1066 | QStringList results; | 1066 | QStringList results; |
1067 | Iterator it; | 1067 | Iterator it; |
1068 | for ( it = begin(); it != end(); ++it ) { | 1068 | for ( it = begin(); it != end(); ++it ) { |
1069 | results.append( (*it).uid() ); | 1069 | results.append( (*it).uid() ); |
1070 | } | 1070 | } |
1071 | return results; | 1071 | return results; |
1072 | } | 1072 | } |
1073 | 1073 | ||
1074 | 1074 | ||
1075 | Addressee::List AddressBook::allAddressees() | 1075 | Addressee::List AddressBook::allAddressees() |
1076 | { | 1076 | { |
1077 | return d->mAddressees; | 1077 | return d->mAddressees; |
1078 | 1078 | ||
1079 | } | 1079 | } |
1080 | 1080 | ||
1081 | Addressee::List AddressBook::findByName( const QString &name ) | 1081 | Addressee::List AddressBook::findByName( const QString &name ) |
1082 | { | 1082 | { |
1083 | Addressee::List results; | 1083 | Addressee::List results; |
1084 | 1084 | ||
1085 | Iterator it; | 1085 | Iterator it; |
1086 | for ( it = begin(); it != end(); ++it ) { | 1086 | for ( it = begin(); it != end(); ++it ) { |
1087 | if ( name == (*it).realName() ) { | 1087 | if ( name == (*it).realName() ) { |
1088 | results.append( *it ); | 1088 | results.append( *it ); |
1089 | } | 1089 | } |
1090 | } | 1090 | } |
1091 | 1091 | ||
1092 | return results; | 1092 | return results; |
1093 | } | 1093 | } |
1094 | 1094 | ||
1095 | Addressee::List AddressBook::findByEmail( const QString &email ) | 1095 | Addressee::List AddressBook::findByEmail( const QString &email ) |
1096 | { | 1096 | { |
1097 | Addressee::List results; | 1097 | Addressee::List results; |
1098 | QStringList mailList; | 1098 | QStringList mailList; |
1099 | 1099 | ||
1100 | Iterator it; | 1100 | Iterator it; |
1101 | for ( it = begin(); it != end(); ++it ) { | 1101 | for ( it = begin(); it != end(); ++it ) { |
1102 | mailList = (*it).emails(); | 1102 | mailList = (*it).emails(); |
1103 | for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { | 1103 | for ( QStringList::Iterator ite = mailList.begin(); ite != mailList.end(); ++ite ) { |
1104 | if ( email == (*ite) ) { | 1104 | if ( email == (*ite) ) { |
1105 | results.append( *it ); | 1105 | results.append( *it ); |
1106 | } | 1106 | } |
1107 | } | 1107 | } |
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | return results; | 1110 | return results; |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | Addressee::List AddressBook::findByCategory( const QString &category ) | 1113 | Addressee::List AddressBook::findByCategory( const QString &category ) |
1114 | { | 1114 | { |
1115 | Addressee::List results; | 1115 | Addressee::List results; |
1116 | 1116 | ||
1117 | Iterator it; | 1117 | Iterator it; |
1118 | for ( it = begin(); it != end(); ++it ) { | 1118 | for ( it = begin(); it != end(); ++it ) { |
1119 | if ( (*it).hasCategory( category) ) { | 1119 | if ( (*it).hasCategory( category) ) { |
1120 | results.append( *it ); | 1120 | results.append( *it ); |
1121 | } | 1121 | } |
1122 | } | 1122 | } |
1123 | 1123 | ||
1124 | return results; | 1124 | return results; |
1125 | } | 1125 | } |
1126 | 1126 | ||
1127 | void AddressBook::dump() const | 1127 | void AddressBook::dump() const |
1128 | { | 1128 | { |
1129 | kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl; | 1129 | kdDebug(5700) << "AddressBook::dump() --- begin ---" << endl; |
1130 | 1130 | ||
1131 | ConstIterator it; | 1131 | ConstIterator it; |
1132 | for( it = begin(); it != end(); ++it ) { | 1132 | for( it = begin(); it != end(); ++it ) { |
1133 | (*it).dump(); | 1133 | (*it).dump(); |
1134 | } | 1134 | } |
1135 | 1135 | ||
1136 | kdDebug(5700) << "AddressBook::dump() --- end ---" << endl; | 1136 | kdDebug(5700) << "AddressBook::dump() --- end ---" << endl; |
1137 | } | 1137 | } |
1138 | 1138 | ||
1139 | QString AddressBook::identifier() | 1139 | QString AddressBook::identifier() |
1140 | { | 1140 | { |
1141 | QStringList identifier; | 1141 | QStringList identifier; |
1142 | 1142 | ||
1143 | 1143 | ||
1144 | KRES::Manager<Resource>::ActiveIterator it; | 1144 | KRES::Manager<Resource>::ActiveIterator it; |
1145 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 1145 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
1146 | if ( !(*it)->identifier().isEmpty() ) | 1146 | if ( !(*it)->identifier().isEmpty() ) |
1147 | identifier.append( (*it)->identifier() ); | 1147 | identifier.append( (*it)->identifier() ); |
1148 | } | 1148 | } |
1149 | 1149 | ||
1150 | return identifier.join( ":" ); | 1150 | return identifier.join( ":" ); |
1151 | } | 1151 | } |
1152 | 1152 | ||
1153 | Field::List AddressBook::fields( int category ) | 1153 | Field::List AddressBook::fields( int category ) |
1154 | { | 1154 | { |
1155 | if ( d->mAllFields.isEmpty() ) { | 1155 | if ( d->mAllFields.isEmpty() ) { |
1156 | d->mAllFields = Field::allFields(); | 1156 | d->mAllFields = Field::allFields(); |
1157 | } | 1157 | } |
1158 | 1158 | ||
1159 | if ( category == Field::All ) return d->mAllFields; | 1159 | if ( category == Field::All ) return d->mAllFields; |
1160 | 1160 | ||
1161 | Field::List result; | 1161 | Field::List result; |
1162 | Field::List::ConstIterator it; | 1162 | Field::List::ConstIterator it; |
1163 | for( it = d->mAllFields.begin(); it != d->mAllFields.end(); ++it ) { | 1163 | for( it = d->mAllFields.begin(); it != d->mAllFields.end(); ++it ) { |
1164 | if ( (*it)->category() & category ) result.append( *it ); | 1164 | if ( (*it)->category() & category ) result.append( *it ); |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | return result; | 1167 | return result; |
1168 | } | 1168 | } |
1169 | 1169 | ||
1170 | bool AddressBook::addCustomField( const QString &label, int category, | 1170 | bool AddressBook::addCustomField( const QString &label, int category, |
1171 | const QString &key, const QString &app ) | 1171 | const QString &key, const QString &app ) |
1172 | { | 1172 | { |
1173 | if ( d->mAllFields.isEmpty() ) { | 1173 | if ( d->mAllFields.isEmpty() ) { |
1174 | d->mAllFields = Field::allFields(); | 1174 | d->mAllFields = Field::allFields(); |
1175 | } | 1175 | } |
1176 | //US QString a = app.isNull() ? KGlobal::instance()->instanceName() : app; | 1176 | //US QString a = app.isNull() ? KGlobal::instance()->instanceName() : app; |
1177 | QString a = app.isNull() ? KGlobal::getAppName() : app; | 1177 | QString a = app.isNull() ? KGlobal::getAppName() : app; |
1178 | 1178 | ||
1179 | QString k = key.isNull() ? label : key; | 1179 | QString k = key.isNull() ? label : key; |
1180 | 1180 | ||
1181 | Field *field = Field::createCustomField( label, category, k, a ); | 1181 | Field *field = Field::createCustomField( label, category, k, a ); |
1182 | 1182 | ||
1183 | if ( !field ) return false; | 1183 | if ( !field ) return false; |
1184 | 1184 | ||
1185 | d->mAllFields.append( field ); | 1185 | d->mAllFields.append( field ); |
1186 | 1186 | ||
1187 | return true; | 1187 | return true; |
1188 | } | 1188 | } |
1189 | 1189 | ||
1190 | QDataStream &KABC::operator<<( QDataStream &s, const AddressBook &ab ) | 1190 | QDataStream &KABC::operator<<( QDataStream &s, const AddressBook &ab ) |
1191 | { | 1191 | { |
1192 | if (!ab.d) return s; | 1192 | if (!ab.d) return s; |
1193 | 1193 | ||
1194 | return s << ab.d->mAddressees; | 1194 | return s << ab.d->mAddressees; |
1195 | } | 1195 | } |
1196 | 1196 | ||
1197 | QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab ) | 1197 | QDataStream &KABC::operator>>( QDataStream &s, AddressBook &ab ) |
1198 | { | 1198 | { |
1199 | if (!ab.d) return s; | 1199 | if (!ab.d) return s; |
1200 | 1200 | ||
1201 | s >> ab.d->mAddressees; | 1201 | s >> ab.d->mAddressees; |
1202 | 1202 | ||
1203 | return s; | 1203 | return s; |
1204 | } | 1204 | } |
1205 | 1205 | ||
1206 | bool AddressBook::addResource( Resource *resource ) | 1206 | bool AddressBook::addResource( Resource *resource ) |
1207 | { | 1207 | { |
1208 | if ( !resource->open() ) { | 1208 | if ( !resource->open() ) { |
1209 | kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl; | 1209 | kdDebug(5700) << "AddressBook::addResource(): can't add resource" << endl; |
1210 | return false; | 1210 | return false; |
1211 | } | 1211 | } |
1212 | 1212 | ||
1213 | resource->setAddressBook( this ); | 1213 | resource->setAddressBook( this ); |
1214 | 1214 | ||
1215 | d->mManager->add( resource ); | 1215 | d->mManager->add( resource ); |
1216 | return true; | 1216 | return true; |
1217 | } | 1217 | } |
1218 | void AddressBook::removeResources() | 1218 | void AddressBook::removeResources() |
1219 | { | 1219 | { |
1220 | //remove all possible resources. This should cleanup the configfile. | 1220 | //remove all possible resources. This should cleanup the configfile. |
1221 | QPtrList<KABC::Resource> mResources = resources(); | 1221 | Q3PtrList<KABC::Resource> mResources = resources(); |
1222 | 1222 | ||
1223 | QPtrListIterator<KABC::Resource> it(mResources); | 1223 | Q3PtrListIterator<KABC::Resource> it(mResources); |
1224 | for ( ; it.current(); ++it ) { | 1224 | for ( ; it.current(); ++it ) { |
1225 | KABC::Resource *res = it.current(); | 1225 | KABC::Resource *res = it.current(); |
1226 | removeResource(res); | 1226 | removeResource(res); |
1227 | } | 1227 | } |
1228 | } | 1228 | } |
1229 | 1229 | ||
1230 | bool AddressBook::removeResource( Resource *resource ) | 1230 | bool AddressBook::removeResource( Resource *resource ) |
1231 | { | 1231 | { |
1232 | resource->close(); | 1232 | resource->close(); |
1233 | 1233 | ||
1234 | if ( resource == standardResource() ) | 1234 | if ( resource == standardResource() ) |
1235 | d->mManager->setStandardResource( 0 ); | 1235 | d->mManager->setStandardResource( 0 ); |
1236 | 1236 | ||
1237 | resource->setAddressBook( 0 ); | 1237 | resource->setAddressBook( 0 ); |
1238 | 1238 | ||
1239 | d->mManager->remove( resource ); | 1239 | d->mManager->remove( resource ); |
1240 | return true; | 1240 | return true; |
1241 | } | 1241 | } |
1242 | 1242 | ||
1243 | QPtrList<Resource> AddressBook::resources() | 1243 | Q3PtrList<Resource> AddressBook::resources() |
1244 | { | 1244 | { |
1245 | QPtrList<Resource> list; | 1245 | Q3PtrList<Resource> list; |
1246 | 1246 | ||
1247 | // qDebug("AddressBook::resources() 1"); | 1247 | // qDebug("AddressBook::resources() 1"); |
1248 | 1248 | ||
1249 | KRES::Manager<Resource>::ActiveIterator it; | 1249 | KRES::Manager<Resource>::ActiveIterator it; |
1250 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) | 1250 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) |
1251 | list.append( *it ); | 1251 | list.append( *it ); |
1252 | 1252 | ||
1253 | return list; | 1253 | return list; |
1254 | } | 1254 | } |
1255 | 1255 | ||
1256 | /*US | 1256 | /*US |
1257 | void AddressBook::setErrorHandler( ErrorHandler *handler ) | 1257 | void AddressBook::setErrorHandler( ErrorHandler *handler ) |
1258 | { | 1258 | { |
1259 | delete d->mErrorHandler; | 1259 | delete d->mErrorHandler; |
1260 | d->mErrorHandler = handler; | 1260 | d->mErrorHandler = handler; |
1261 | } | 1261 | } |
1262 | */ | 1262 | */ |
1263 | 1263 | ||
1264 | void AddressBook::error( const QString& msg ) | 1264 | void AddressBook::error( const QString& msg ) |
1265 | { | 1265 | { |
1266 | /*US | 1266 | /*US |
1267 | if ( !d->mErrorHandler ) // create default error handler | 1267 | if ( !d->mErrorHandler ) // create default error handler |
1268 | d->mErrorHandler = new ConsoleErrorHandler; | 1268 | d->mErrorHandler = new ConsoleErrorHandler; |
1269 | 1269 | ||
1270 | if ( d->mErrorHandler ) | 1270 | if ( d->mErrorHandler ) |
1271 | d->mErrorHandler->error( msg ); | 1271 | d->mErrorHandler->error( msg ); |
1272 | else | 1272 | else |
1273 | kdError(5700) << "no error handler defined" << endl; | 1273 | kdError(5700) << "no error handler defined" << endl; |
1274 | */ | 1274 | */ |
1275 | kdDebug(5700) << "msg" << endl; | 1275 | kdDebug(5700) << "msg" << endl; |
1276 | qDebug(msg); | 1276 | qDebug(msg); |
1277 | } | 1277 | } |
1278 | 1278 | ||
1279 | void AddressBook::deleteRemovedAddressees() | 1279 | void AddressBook::deleteRemovedAddressees() |
1280 | { | 1280 | { |
1281 | Addressee::List::Iterator it; | 1281 | Addressee::List::Iterator it; |
1282 | for ( it = d->mRemovedAddressees.begin(); it != d->mRemovedAddressees.end(); ++it ) { | 1282 | for ( it = d->mRemovedAddressees.begin(); it != d->mRemovedAddressees.end(); ++it ) { |
1283 | Resource *resource = (*it).resource(); | 1283 | Resource *resource = (*it).resource(); |
1284 | if ( resource && !resource->readOnly() && resource->isOpen() ) | 1284 | if ( resource && !resource->readOnly() && resource->isOpen() ) |
1285 | resource->removeAddressee( *it ); | 1285 | resource->removeAddressee( *it ); |
1286 | } | 1286 | } |
1287 | 1287 | ||
1288 | d->mRemovedAddressees.clear(); | 1288 | d->mRemovedAddressees.clear(); |
1289 | } | 1289 | } |
1290 | 1290 | ||
1291 | void AddressBook::setStandardResource( Resource *resource ) | 1291 | void AddressBook::setStandardResource( Resource *resource ) |
1292 | { | 1292 | { |
1293 | // qDebug("AddressBook::setStandardResource 1"); | 1293 | // qDebug("AddressBook::setStandardResource 1"); |
1294 | d->mManager->setStandardResource( resource ); | 1294 | d->mManager->setStandardResource( resource ); |
1295 | } | 1295 | } |
1296 | 1296 | ||
1297 | Resource *AddressBook::standardResource() | 1297 | Resource *AddressBook::standardResource() |
1298 | { | 1298 | { |
1299 | return d->mManager->standardResource(); | 1299 | return d->mManager->standardResource(); |
1300 | } | 1300 | } |
1301 | 1301 | ||
1302 | KRES::Manager<Resource> *AddressBook::resourceManager() | 1302 | KRES::Manager<Resource> *AddressBook::resourceManager() |
1303 | { | 1303 | { |
1304 | return d->mManager; | 1304 | return d->mManager; |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | void AddressBook::cleanUp() | 1307 | void AddressBook::cleanUp() |
1308 | { | 1308 | { |
1309 | KRES::Manager<Resource>::ActiveIterator it; | 1309 | KRES::Manager<Resource>::ActiveIterator it; |
1310 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { | 1310 | for ( it = d->mManager->activeBegin(); it != d->mManager->activeEnd(); ++it ) { |
1311 | if ( !(*it)->readOnly() && (*it)->isOpen() ) | 1311 | if ( !(*it)->readOnly() && (*it)->isOpen() ) |
1312 | (*it)->cleanUp(); | 1312 | (*it)->cleanUp(); |
1313 | } | 1313 | } |
1314 | } | 1314 | } |
diff --git a/kabc/addressbook.h b/kabc/addressbook.h index a8a9fc1..56fce4d 100644 --- a/kabc/addressbook.h +++ b/kabc/addressbook.h | |||
@@ -1,351 +1,351 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_ADDRESSBOOK_H | 28 | #ifndef KABC_ADDRESSBOOK_H |
29 | #define KABC_ADDRESSBOOK_H | 29 | #define KABC_ADDRESSBOOK_H |
30 | 30 | ||
31 | #include <qobject.h> | 31 | #include <qobject.h> |
32 | 32 | ||
33 | #include <kresources/manager.h> | 33 | #include <kresources/manager.h> |
34 | #include <qptrlist.h> | 34 | #include <q3ptrlist.h> |
35 | 35 | ||
36 | #include "addressee.h" | 36 | #include "addressee.h" |
37 | #include "field.h" | 37 | #include "field.h" |
38 | 38 | ||
39 | namespace KABC { | 39 | namespace KABC { |
40 | 40 | ||
41 | class ErrorHandler; | 41 | class ErrorHandler; |
42 | class Resource; | 42 | class Resource; |
43 | class Ticket; | 43 | class Ticket; |
44 | 44 | ||
45 | /** | 45 | /** |
46 | @short Address Book | 46 | @short Address Book |
47 | 47 | ||
48 | This class provides access to a collection of address book entries. | 48 | This class provides access to a collection of address book entries. |
49 | */ | 49 | */ |
50 | class AddressBook : public QObject | 50 | class AddressBook : public QObject |
51 | { | 51 | { |
52 | Q_OBJECT | 52 | Q_OBJECT |
53 | 53 | ||
54 | friend QDataStream &operator<<( QDataStream &, const AddressBook & ); | 54 | friend QDataStream &operator<<( QDataStream &, const AddressBook & ); |
55 | friend QDataStream &operator>>( QDataStream &, AddressBook & ); | 55 | friend QDataStream &operator>>( QDataStream &, AddressBook & ); |
56 | friend class StdAddressBook; | 56 | friend class StdAddressBook; |
57 | 57 | ||
58 | public: | 58 | public: |
59 | /** | 59 | /** |
60 | @short Address Book Iterator | 60 | @short Address Book Iterator |
61 | 61 | ||
62 | This class provides an iterator for address book entries. | 62 | This class provides an iterator for address book entries. |
63 | */ | 63 | */ |
64 | class Iterator | 64 | class Iterator |
65 | { | 65 | { |
66 | public: | 66 | public: |
67 | Iterator(); | 67 | Iterator(); |
68 | Iterator( const Iterator & ); | 68 | Iterator( const Iterator & ); |
69 | ~Iterator(); | 69 | ~Iterator(); |
70 | 70 | ||
71 | Iterator &operator=( const Iterator & ); | 71 | Iterator &operator=( const Iterator & ); |
72 | const Addressee &operator*() const; | 72 | const Addressee &operator*() const; |
73 | Addressee &operator*(); | 73 | Addressee &operator*(); |
74 | Addressee* operator->(); | 74 | Addressee* operator->(); |
75 | Iterator &operator++(); | 75 | Iterator &operator++(); |
76 | Iterator &operator++(int); | 76 | Iterator &operator++(int); |
77 | Iterator &operator--(); | 77 | Iterator &operator--(); |
78 | Iterator &operator--(int); | 78 | Iterator &operator--(int); |
79 | bool operator==( const Iterator &it ); | 79 | bool operator==( const Iterator &it ); |
80 | bool operator!=( const Iterator &it ); | 80 | bool operator!=( const Iterator &it ); |
81 | 81 | ||
82 | struct IteratorData; | 82 | struct IteratorData; |
83 | IteratorData *d; | 83 | IteratorData *d; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | @short Address Book Const Iterator | 87 | @short Address Book Const Iterator |
88 | 88 | ||
89 | This class provides a const iterator for address book entries. | 89 | This class provides a const iterator for address book entries. |
90 | */ | 90 | */ |
91 | class ConstIterator | 91 | class ConstIterator |
92 | { | 92 | { |
93 | public: | 93 | public: |
94 | ConstIterator(); | 94 | ConstIterator(); |
95 | ConstIterator( const ConstIterator & ); | 95 | ConstIterator( const ConstIterator & ); |
96 | ~ConstIterator(); | 96 | ~ConstIterator(); |
97 | 97 | ||
98 | ConstIterator &operator=( const ConstIterator & ); | 98 | ConstIterator &operator=( const ConstIterator & ); |
99 | const Addressee &operator*() const; | 99 | const Addressee &operator*() const; |
100 | const Addressee* operator->() const; | 100 | const Addressee* operator->() const; |
101 | ConstIterator &operator++(); | 101 | ConstIterator &operator++(); |
102 | ConstIterator &operator++(int); | 102 | ConstIterator &operator++(int); |
103 | ConstIterator &operator--(); | 103 | ConstIterator &operator--(); |
104 | ConstIterator &operator--(int); | 104 | ConstIterator &operator--(int); |
105 | bool operator==( const ConstIterator &it ); | 105 | bool operator==( const ConstIterator &it ); |
106 | bool operator!=( const ConstIterator &it ); | 106 | bool operator!=( const ConstIterator &it ); |
107 | 107 | ||
108 | struct ConstIteratorData; | 108 | struct ConstIteratorData; |
109 | ConstIteratorData *d; | 109 | ConstIteratorData *d; |
110 | }; | 110 | }; |
111 | 111 | ||
112 | /** | 112 | /** |
113 | Constructs a address book object. | 113 | Constructs a address book object. |
114 | 114 | ||
115 | @param format File format class. | 115 | @param format File format class. |
116 | */ | 116 | */ |
117 | AddressBook(); | 117 | AddressBook(); |
118 | AddressBook( const QString &config ); | 118 | AddressBook( const QString &config ); |
119 | AddressBook( const QString &config, const QString &family ); | 119 | AddressBook( const QString &config, const QString &family ); |
120 | virtual ~AddressBook(); | 120 | virtual ~AddressBook(); |
121 | 121 | ||
122 | /** | 122 | /** |
123 | Requests a ticket for saving the addressbook. Calling this function locks | 123 | Requests a ticket for saving the addressbook. Calling this function locks |
124 | the addressbook for all other processes. If the address book is already | 124 | the addressbook for all other processes. If the address book is already |
125 | locked the function returns 0. You need the returned @ref Ticket object | 125 | locked the function returns 0. You need the returned @ref Ticket object |
126 | for calling the @ref save() function. | 126 | for calling the @ref save() function. |
127 | 127 | ||
128 | @see save() | 128 | @see save() |
129 | */ | 129 | */ |
130 | Ticket *requestSaveTicket( Resource *resource=0 ); | 130 | Ticket *requestSaveTicket( Resource *resource=0 ); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | Load address book from file. | 133 | Load address book from file. |
134 | */ | 134 | */ |
135 | bool load(); | 135 | bool load(); |
136 | 136 | ||
137 | /** | 137 | /** |
138 | Save address book. The address book is saved to the file, the Ticket | 138 | Save address book. The address book is saved to the file, the Ticket |
139 | object has been requested for by @ref requestSaveTicket(). | 139 | object has been requested for by @ref requestSaveTicket(). |
140 | 140 | ||
141 | @param ticket a ticket object returned by @ref requestSaveTicket() | 141 | @param ticket a ticket object returned by @ref requestSaveTicket() |
142 | */ | 142 | */ |
143 | bool save( Ticket *ticket ); | 143 | bool save( Ticket *ticket ); |
144 | bool saveAB( ); | 144 | bool saveAB( ); |
145 | bool saveABphone( QString fileName ); | 145 | bool saveABphone( QString fileName ); |
146 | void smplifyAddressees(); | 146 | void smplifyAddressees(); |
147 | void removeSyncInfo( QString syncProfile); | 147 | void removeSyncInfo( QString syncProfile); |
148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); | 148 | void preparePhoneSync( QString currentSyncDevice, bool isPreSync ); |
149 | void export2File( QString fileName, QString resourceName = "" ); | 149 | void export2File( QString fileName, QString resourceName = "" ); |
150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); | 150 | bool export2PhoneFormat( QStringList uids ,QString fileName ); |
151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false, QString resource = "" ); | 151 | int importFromFile( QString fileName, bool replaceLabel = false, bool removeOld = false, QString resource = "" ); |
152 | void setUntagged( bool setNonSyncTagged = false, QString resource = "" ); | 152 | void setUntagged( bool setNonSyncTagged = false, QString resource = "" ); |
153 | void removeUntagged(); | 153 | void removeUntagged(); |
154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); | 154 | void findNewExtIds( QString fileName, QString currentSyncDevice ); |
155 | /** | 155 | /** |
156 | Returns a iterator for first entry of address book. | 156 | Returns a iterator for first entry of address book. |
157 | */ | 157 | */ |
158 | Iterator begin(); | 158 | Iterator begin(); |
159 | 159 | ||
160 | /** | 160 | /** |
161 | Returns a const iterator for first entry of address book. | 161 | Returns a const iterator for first entry of address book. |
162 | */ | 162 | */ |
163 | ConstIterator begin() const; | 163 | ConstIterator begin() const; |
164 | 164 | ||
165 | /** | 165 | /** |
166 | Returns a iterator for first entry of address book. | 166 | Returns a iterator for first entry of address book. |
167 | */ | 167 | */ |
168 | Iterator end(); | 168 | Iterator end(); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | Returns a const iterator for first entry of address book. | 171 | Returns a const iterator for first entry of address book. |
172 | */ | 172 | */ |
173 | ConstIterator end() const; | 173 | ConstIterator end() const; |
174 | 174 | ||
175 | /** | 175 | /** |
176 | Removes all entries from address book. | 176 | Removes all entries from address book. |
177 | */ | 177 | */ |
178 | void clear(); | 178 | void clear(); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | Insert an Addressee object into address book. If an object with the same | 181 | Insert an Addressee object into address book. If an object with the same |
182 | unique id already exists in the address book it it replaced by the new | 182 | unique id already exists in the address book it it replaced by the new |
183 | one. If not the new object is appended to the address book. | 183 | one. If not the new object is appended to the address book. |
184 | */ | 184 | */ |
185 | void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); | 185 | void insertAddressee( const Addressee &, bool setRev = true, bool takeResource = false); |
186 | 186 | ||
187 | /** | 187 | /** |
188 | Removes entry from the address book. | 188 | Removes entry from the address book. |
189 | */ | 189 | */ |
190 | void removeAddressee( const Addressee & ); | 190 | void removeAddressee( const Addressee & ); |
191 | 191 | ||
192 | /** | 192 | /** |
193 | This is like @ref removeAddressee() just above, with the difference that | 193 | This is like @ref removeAddressee() just above, with the difference that |
194 | the first element is a iterator, returned by @ref begin(). | 194 | the first element is a iterator, returned by @ref begin(). |
195 | */ | 195 | */ |
196 | void removeAddressee( const Iterator & ); | 196 | void removeAddressee( const Iterator & ); |
197 | 197 | ||
198 | /** | 198 | /** |
199 | Find the specified entry in address book. Returns end(), if the entry | 199 | Find the specified entry in address book. Returns end(), if the entry |
200 | couldn't be found. | 200 | couldn't be found. |
201 | */ | 201 | */ |
202 | Iterator find( const Addressee & ); | 202 | Iterator find( const Addressee & ); |
203 | 203 | ||
204 | /** | 204 | /** |
205 | Find the entry specified by an unique id. Returns an empty Addressee | 205 | Find the entry specified by an unique id. Returns an empty Addressee |
206 | object, if the address book does not contain an entry with this id. | 206 | object, if the address book does not contain an entry with this id. |
207 | */ | 207 | */ |
208 | Addressee findByUid( const QString & ); | 208 | Addressee findByUid( const QString & ); |
209 | 209 | ||
210 | 210 | ||
211 | /** | 211 | /** |
212 | Returns a list of all addressees in the address book. This list can | 212 | Returns a list of all addressees in the address book. This list can |
213 | be sorted with @ref KABC::AddresseeList for example. | 213 | be sorted with @ref KABC::AddresseeList for example. |
214 | */ | 214 | */ |
215 | Addressee::List allAddressees(); | 215 | Addressee::List allAddressees(); |
216 | 216 | ||
217 | /** | 217 | /** |
218 | Find all entries with the specified name in the address book. Returns | 218 | Find all entries with the specified name in the address book. Returns |
219 | an empty list, if no entries could be found. | 219 | an empty list, if no entries could be found. |
220 | */ | 220 | */ |
221 | Addressee::List findByName( const QString & ); | 221 | Addressee::List findByName( const QString & ); |
222 | 222 | ||
223 | /** | 223 | /** |
224 | Find all entries with the specified email address in the address book. | 224 | Find all entries with the specified email address in the address book. |
225 | Returns an empty list, if no entries could be found. | 225 | Returns an empty list, if no entries could be found. |
226 | */ | 226 | */ |
227 | Addressee::List findByEmail( const QString & ); | 227 | Addressee::List findByEmail( const QString & ); |
228 | 228 | ||
229 | /** | 229 | /** |
230 | Find all entries wich have the specified category in the address book. | 230 | Find all entries wich have the specified category in the address book. |
231 | Returns an empty list, if no entries could be found. | 231 | Returns an empty list, if no entries could be found. |
232 | */ | 232 | */ |
233 | Addressee::List findByCategory( const QString & ); | 233 | Addressee::List findByCategory( const QString & ); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | Return a string identifying this addressbook. | 236 | Return a string identifying this addressbook. |
237 | */ | 237 | */ |
238 | virtual QString identifier(); | 238 | virtual QString identifier(); |
239 | 239 | ||
240 | /** | 240 | /** |
241 | Used for debug output. | 241 | Used for debug output. |
242 | */ | 242 | */ |
243 | void dump() const; | 243 | void dump() const; |
244 | 244 | ||
245 | void emitAddressBookLocked() { emit addressBookLocked( this ); } | 245 | void emitAddressBookLocked() { emit addressBookLocked( this ); } |
246 | void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } | 246 | void emitAddressBookUnlocked() { emit addressBookUnlocked( this ); } |
247 | void emitAddressBookChanged() { emit addressBookChanged( this ); } | 247 | void emitAddressBookChanged() { emit addressBookChanged( this ); } |
248 | 248 | ||
249 | /** | 249 | /** |
250 | Return list of all Fields known to the address book which are associated | 250 | Return list of all Fields known to the address book which are associated |
251 | with the given field category. | 251 | with the given field category. |
252 | */ | 252 | */ |
253 | Field::List fields( int category = Field::All ); | 253 | Field::List fields( int category = Field::All ); |
254 | 254 | ||
255 | /** | 255 | /** |
256 | Add custom field to address book. | 256 | Add custom field to address book. |
257 | 257 | ||
258 | @param label User visible label of the field. | 258 | @param label User visible label of the field. |
259 | @param category Ored list of field categories. | 259 | @param category Ored list of field categories. |
260 | @param key Identifier used as key for reading and writing the field. | 260 | @param key Identifier used as key for reading and writing the field. |
261 | @param app String used as application key for reading and writing | 261 | @param app String used as application key for reading and writing |
262 | the field. | 262 | the field. |
263 | */ | 263 | */ |
264 | bool addCustomField( const QString &label, int category = Field::All, | 264 | bool addCustomField( const QString &label, int category = Field::All, |
265 | const QString &key = QString::null, | 265 | const QString &key = QString::null, |
266 | const QString &app = QString::null ); | 266 | const QString &app = QString::null ); |
267 | 267 | ||
268 | 268 | ||
269 | /** | 269 | /** |
270 | Add address book resource. | 270 | Add address book resource. |
271 | */ | 271 | */ |
272 | bool addResource( Resource * ); | 272 | bool addResource( Resource * ); |
273 | 273 | ||
274 | /** | 274 | /** |
275 | Remove address book resource. | 275 | Remove address book resource. |
276 | */ | 276 | */ |
277 | void removeResources(); | 277 | void removeResources(); |
278 | bool removeResource( Resource * ); | 278 | bool removeResource( Resource * ); |
279 | 279 | ||
280 | /** | 280 | /** |
281 | Return pointer list of all resources. | 281 | Return pointer list of all resources. |
282 | */ | 282 | */ |
283 | QPtrList<Resource> resources(); | 283 | Q3PtrList<Resource> resources(); |
284 | 284 | ||
285 | /** | 285 | /** |
286 | Set the @p ErrorHandler, that is used by @ref error() to | 286 | Set the @p ErrorHandler, that is used by @ref error() to |
287 | provide gui-independend error messages. | 287 | provide gui-independend error messages. |
288 | */ | 288 | */ |
289 | void setErrorHandler( ErrorHandler * ); | 289 | void setErrorHandler( ErrorHandler * ); |
290 | 290 | ||
291 | /** | 291 | /** |
292 | Shows gui independend error messages. | 292 | Shows gui independend error messages. |
293 | */ | 293 | */ |
294 | void error( const QString& ); | 294 | void error( const QString& ); |
295 | 295 | ||
296 | /** | 296 | /** |
297 | Query all resources to clean up their lock files | 297 | Query all resources to clean up their lock files |
298 | */ | 298 | */ |
299 | void cleanUp(); | 299 | void cleanUp(); |
300 | 300 | ||
301 | // sync stuff | 301 | // sync stuff |
302 | //Addressee::List getExternLastSyncAddressees(); | 302 | //Addressee::List getExternLastSyncAddressees(); |
303 | void resetTempSyncStat(); | 303 | void resetTempSyncStat(); |
304 | QStringList uidList(); | 304 | QStringList uidList(); |
305 | void removeSyncAddressees( bool removeDeleted = false ); | 305 | void removeSyncAddressees( bool removeDeleted = false ); |
306 | void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); | 306 | void mergeAB( AddressBook *aBook, const QString& profile, bool isSubset ); |
307 | const Addressee findByExternUid( const QString& uid , const QString& profile ) const; | 307 | const Addressee findByExternUid( const QString& uid , const QString& profile ) const; |
308 | bool containsExternalUid( const QString& uid ); | 308 | bool containsExternalUid( const QString& uid ); |
309 | 309 | ||
310 | void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); | 310 | void preExternSync( AddressBook* aBook, const QString& csd, bool isSubset ); |
311 | void preOLSync( AddressBook* aBook, const QString& csd); | 311 | void preOLSync( AddressBook* aBook, const QString& csd); |
312 | void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); | 312 | void postExternSync( AddressBook* aBook, const QString& csd , bool setID ); |
313 | signals: | 313 | signals: |
314 | /** | 314 | /** |
315 | Emitted, when the address book has changed on disk. | 315 | Emitted, when the address book has changed on disk. |
316 | */ | 316 | */ |
317 | void addressBookChanged( AddressBook * ); | 317 | void addressBookChanged( AddressBook * ); |
318 | 318 | ||
319 | /** | 319 | /** |
320 | Emitted, when the address book has been locked for writing. | 320 | Emitted, when the address book has been locked for writing. |
321 | */ | 321 | */ |
322 | void addressBookLocked( AddressBook * ); | 322 | void addressBookLocked( AddressBook * ); |
323 | 323 | ||
324 | /** | 324 | /** |
325 | Emitted, when the address book has been unlocked. | 325 | Emitted, when the address book has been unlocked. |
326 | */ | 326 | */ |
327 | void addressBookUnlocked( AddressBook * ); | 327 | void addressBookUnlocked( AddressBook * ); |
328 | 328 | ||
329 | protected: | 329 | protected: |
330 | void deleteRemovedAddressees(); | 330 | void deleteRemovedAddressees(); |
331 | void setStandardResource( Resource * ); | 331 | void setStandardResource( Resource * ); |
332 | Resource *standardResource(); | 332 | Resource *standardResource(); |
333 | KRES::Manager<Resource> *resourceManager(); | 333 | KRES::Manager<Resource> *resourceManager(); |
334 | 334 | ||
335 | void init(const QString &config, const QString &family); | 335 | void init(const QString &config, const QString &family); |
336 | 336 | ||
337 | private: | 337 | private: |
338 | //US QPtrList<Resource> mDummy; // Remove in KDE 4 | 338 | //US QPtrList<Resource> mDummy; // Remove in KDE 4 |
339 | 339 | ||
340 | 340 | ||
341 | struct AddressBookData; | 341 | struct AddressBookData; |
342 | AddressBookData *d; | 342 | AddressBookData *d; |
343 | bool blockLSEchange; | 343 | bool blockLSEchange; |
344 | }; | 344 | }; |
345 | 345 | ||
346 | QDataStream &operator<<( QDataStream &, const AddressBook & ); | 346 | QDataStream &operator<<( QDataStream &, const AddressBook & ); |
347 | QDataStream &operator>>( QDataStream &, AddressBook & ); | 347 | QDataStream &operator>>( QDataStream &, AddressBook & ); |
348 | 348 | ||
349 | } | 349 | } |
350 | 350 | ||
351 | #endif | 351 | #endif |
diff --git a/kabc/addressee.cpp b/kabc/addressee.cpp index e8e440c..9994e29 100644 --- a/kabc/addressee.cpp +++ b/kabc/addressee.cpp | |||
@@ -1,906 +1,906 @@ | |||
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 <kmessagebox.h> | 35 | #include <kmessagebox.h> |
36 | #include <kidmanager.h> | 36 | #include <kidmanager.h> |
37 | //US | 37 | //US |
38 | #include <kstandarddirs.h> | 38 | #include <kstandarddirs.h> |
39 | #include <libkcal/syncdefines.h> | 39 | #include <libkcal/syncdefines.h> |
40 | 40 | ||
41 | //US #include "resource.h" | 41 | //US #include "resource.h" |
42 | #include "addressee.h" | 42 | #include "addressee.h" |
43 | 43 | ||
44 | using namespace KABC; | 44 | using namespace KABC; |
45 | 45 | ||
46 | static bool matchBinaryPattern( int value, int pattern ); | 46 | static bool matchBinaryPattern( int value, int pattern ); |
47 | static bool matchBinaryPatternA( int value, int pattern ); | 47 | static bool matchBinaryPatternA( int value, int pattern ); |
48 | static bool matchBinaryPatternP( int value, int pattern ); | 48 | static bool matchBinaryPatternP( int value, int pattern ); |
49 | 49 | ||
50 | struct Addressee::AddresseeData : public KShared | 50 | struct Addressee::AddresseeData : public KShared |
51 | { | 51 | { |
52 | QString uid; | 52 | QString uid; |
53 | QString name; | 53 | QString name; |
54 | QString formattedName; | 54 | QString formattedName; |
55 | QString familyName; | 55 | QString familyName; |
56 | QString givenName; | 56 | QString givenName; |
57 | QString additionalName; | 57 | QString additionalName; |
58 | QString prefix; | 58 | QString prefix; |
59 | QString suffix; | 59 | QString suffix; |
60 | QString nickName; | 60 | QString nickName; |
61 | QDateTime birthday; | 61 | QDateTime birthday; |
62 | QString mailer; | 62 | QString mailer; |
63 | TimeZone timeZone; | 63 | TimeZone timeZone; |
64 | Geo geo; | 64 | Geo geo; |
65 | QString title; | 65 | QString title; |
66 | QString role; | 66 | QString role; |
67 | QString organization; | 67 | QString organization; |
68 | QString note; | 68 | QString note; |
69 | QString productId; | 69 | QString productId; |
70 | QDateTime revision; | 70 | QDateTime revision; |
71 | QString sortString; | 71 | QString sortString; |
72 | QString externalUID; | 72 | QString externalUID; |
73 | QString originalExternalUID; | 73 | QString originalExternalUID; |
74 | KURL url; | 74 | KURL url; |
75 | Secrecy secrecy; | 75 | Secrecy secrecy; |
76 | Picture logo; | 76 | Picture logo; |
77 | Picture photo; | 77 | Picture photo; |
78 | Sound sound; | 78 | Sound sound; |
79 | Agent agent; | 79 | Agent agent; |
80 | QString mExternalId; | 80 | QString mExternalId; |
81 | PhoneNumber::List phoneNumbers; | 81 | PhoneNumber::List phoneNumbers; |
82 | Address::List addresses; | 82 | Address::List addresses; |
83 | Key::List keys; | 83 | Key::List keys; |
84 | QStringList emails; | 84 | QStringList emails; |
85 | QStringList categories; | 85 | QStringList categories; |
86 | QStringList custom; | 86 | QStringList custom; |
87 | int mTempSyncStat; | 87 | int mTempSyncStat; |
88 | Resource *resource; | 88 | Resource *resource; |
89 | 89 | ||
90 | bool empty :1; | 90 | bool empty :1; |
91 | bool changed :1; | 91 | bool changed :1; |
92 | bool tagged :1; | 92 | bool tagged :1; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | Addressee::Addressee() | 95 | Addressee::Addressee() |
96 | { | 96 | { |
97 | mData = new AddresseeData; | 97 | mData = new AddresseeData; |
98 | mData->empty = true; | 98 | mData->empty = true; |
99 | mData->changed = false; | 99 | mData->changed = false; |
100 | mData->resource = 0; | 100 | mData->resource = 0; |
101 | mData->mExternalId = ":"; | 101 | mData->mExternalId = ":"; |
102 | mData->revision = QDateTime ( QDate( 2003,1,1)); | 102 | mData->revision = QDateTime ( QDate( 2003,1,1)); |
103 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; | 103 | mData->mTempSyncStat = SYNC_TEMPSTATE_INITIAL; |
104 | } | 104 | } |
105 | 105 | ||
106 | Addressee::~Addressee() | 106 | Addressee::~Addressee() |
107 | { | 107 | { |
108 | } | 108 | } |
109 | 109 | ||
110 | Addressee::Addressee( const Addressee &a ) | 110 | Addressee::Addressee( const Addressee &a ) |
111 | { | 111 | { |
112 | mData = a.mData; | 112 | mData = a.mData; |
113 | } | 113 | } |
114 | 114 | ||
115 | Addressee &Addressee::operator=( const Addressee &a ) | 115 | Addressee &Addressee::operator=( const Addressee &a ) |
116 | { | 116 | { |
117 | mData = a.mData; | 117 | mData = a.mData; |
118 | return (*this); | 118 | return (*this); |
119 | } | 119 | } |
120 | 120 | ||
121 | Addressee Addressee::copy() | 121 | Addressee Addressee::copy() |
122 | { | 122 | { |
123 | Addressee a; | 123 | Addressee a; |
124 | *(a.mData) = *mData; | 124 | *(a.mData) = *mData; |
125 | return a; | 125 | return a; |
126 | } | 126 | } |
127 | 127 | ||
128 | void Addressee::detach() | 128 | void Addressee::detach() |
129 | { | 129 | { |
130 | if ( mData.count() == 1 ) return; | 130 | if ( mData.count() == 1 ) return; |
131 | *this = copy(); | 131 | *this = copy(); |
132 | } | 132 | } |
133 | 133 | ||
134 | bool Addressee::operator==( const Addressee &a ) const | 134 | bool Addressee::operator==( const Addressee &a ) const |
135 | { | 135 | { |
136 | if ( uid() != a.uid() ) return false; | 136 | if ( uid() != a.uid() ) return false; |
137 | if ( mData->name != a.mData->name ) return false; | 137 | if ( mData->name != a.mData->name ) return false; |
138 | if ( mData->formattedName != a.mData->formattedName ) return false; | 138 | if ( mData->formattedName != a.mData->formattedName ) return false; |
139 | if ( mData->familyName != a.mData->familyName ) return false; | 139 | if ( mData->familyName != a.mData->familyName ) return false; |
140 | if ( mData->givenName != a.mData->givenName ) return false; | 140 | if ( mData->givenName != a.mData->givenName ) return false; |
141 | if ( mData->additionalName != a.mData->additionalName ) return false; | 141 | if ( mData->additionalName != a.mData->additionalName ) return false; |
142 | if ( mData->prefix != a.mData->prefix ) return false; | 142 | if ( mData->prefix != a.mData->prefix ) return false; |
143 | if ( mData->suffix != a.mData->suffix ) return false; | 143 | if ( mData->suffix != a.mData->suffix ) return false; |
144 | if ( mData->nickName != a.mData->nickName ) return false; | 144 | if ( mData->nickName != a.mData->nickName ) return false; |
145 | if ( mData->birthday != a.mData->birthday ) return false; | 145 | if ( mData->birthday != a.mData->birthday ) return false; |
146 | if ( mData->mailer != a.mData->mailer ) return false; | 146 | if ( mData->mailer != a.mData->mailer ) return false; |
147 | if ( mData->timeZone != a.mData->timeZone ) return false; | 147 | if ( mData->timeZone != a.mData->timeZone ) return false; |
148 | if ( mData->geo != a.mData->geo ) return false; | 148 | if ( mData->geo != a.mData->geo ) return false; |
149 | if ( mData->title != a.mData->title ) return false; | 149 | if ( mData->title != a.mData->title ) return false; |
150 | if ( mData->role != a.mData->role ) return false; | 150 | if ( mData->role != a.mData->role ) return false; |
151 | if ( mData->organization != a.mData->organization ) return false; | 151 | if ( mData->organization != a.mData->organization ) return false; |
152 | if ( mData->note != a.mData->note ) return false; | 152 | if ( mData->note != a.mData->note ) return false; |
153 | if ( mData->productId != a.mData->productId ) return false; | 153 | if ( mData->productId != a.mData->productId ) return false; |
154 | //if ( mData->revision != a.mData->revision ) return false; | 154 | //if ( mData->revision != a.mData->revision ) return false; |
155 | if ( mData->sortString != a.mData->sortString ) return false; | 155 | if ( mData->sortString != a.mData->sortString ) return false; |
156 | if ( mData->secrecy != a.mData->secrecy ) return false; | 156 | if ( mData->secrecy != a.mData->secrecy ) return false; |
157 | if ( mData->logo != a.mData->logo ) return false; | 157 | if ( mData->logo != a.mData->logo ) return false; |
158 | if ( mData->photo != a.mData->photo ) return false; | 158 | if ( mData->photo != a.mData->photo ) return false; |
159 | if ( mData->sound != a.mData->sound ) return false; | 159 | if ( mData->sound != a.mData->sound ) return false; |
160 | if ( mData->agent != a.mData->agent ) return false; | 160 | if ( mData->agent != a.mData->agent ) return false; |
161 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && | 161 | if ( ( mData->url.isValid() || a.mData->url.isValid() ) && |
162 | ( mData->url != a.mData->url ) ) return false; | 162 | ( mData->url != a.mData->url ) ) return false; |
163 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; | 163 | if ( mData->phoneNumbers != a.mData->phoneNumbers ) return false; |
164 | if ( mData->addresses != a.mData->addresses ) return false; | 164 | if ( mData->addresses != a.mData->addresses ) return false; |
165 | if ( mData->keys != a.mData->keys ) return false; | 165 | if ( mData->keys != a.mData->keys ) return false; |
166 | if ( mData->emails != a.mData->emails ) return false; | 166 | if ( mData->emails != a.mData->emails ) return false; |
167 | if ( mData->categories != a.mData->categories ) return false; | 167 | if ( mData->categories != a.mData->categories ) return false; |
168 | if ( mData->custom != a.mData->custom ) return false; | 168 | if ( mData->custom != a.mData->custom ) return false; |
169 | 169 | ||
170 | return true; | 170 | return true; |
171 | } | 171 | } |
172 | 172 | ||
173 | bool Addressee::operator!=( const Addressee &a ) const | 173 | bool Addressee::operator!=( const Addressee &a ) const |
174 | { | 174 | { |
175 | return !( a == *this ); | 175 | return !( a == *this ); |
176 | } | 176 | } |
177 | 177 | ||
178 | bool Addressee::isEmpty() const | 178 | bool Addressee::isEmpty() const |
179 | { | 179 | { |
180 | return mData->empty; | 180 | return mData->empty; |
181 | } | 181 | } |
182 | ulong Addressee::getCsum4List( const QStringList & attList) | 182 | ulong Addressee::getCsum4List( const QStringList & attList) |
183 | { | 183 | { |
184 | int max = attList.count(); | 184 | int max = attList.count(); |
185 | ulong cSum = 0; | 185 | ulong cSum = 0; |
186 | int j,k,i; | 186 | int j,k,i; |
187 | int add; | 187 | int add; |
188 | for ( i = 0; i < max ; ++i ) { | 188 | for ( i = 0; i < max ; ++i ) { |
189 | QString s = attList[i]; | 189 | QString s = attList[i]; |
190 | if ( ! s.isEmpty() ){ | 190 | if ( ! s.isEmpty() ){ |
191 | j = s.length(); | 191 | j = s.length(); |
192 | for ( k = 0; k < j; ++k ) { | 192 | for ( k = 0; k < j; ++k ) { |
193 | int mul = k +1; | 193 | int mul = k +1; |
194 | add = s[k].unicode (); | 194 | add = s[k].unicode (); |
195 | if ( k < 16 ) | 195 | if ( k < 16 ) |
196 | mul = mul * mul; | 196 | mul = mul * mul; |
197 | int ii = i+1; | 197 | int ii = i+1; |
198 | add = add * mul *ii*ii*ii; | 198 | add = add * mul *ii*ii*ii; |
199 | cSum += add; | 199 | cSum += add; |
200 | //qDebug("csum: %d %d %d", i,k,cSum); | 200 | //qDebug("csum: %d %d %d", i,k,cSum); |
201 | } | 201 | } |
202 | } | 202 | } |
203 | 203 | ||
204 | } | 204 | } |
205 | //QString dump = attList.join(","); | 205 | //QString dump = attList.join(","); |
206 | //qDebug("csum: %d %s", cSum,dump.latin1()); | 206 | //qDebug("csum: %d %s", cSum,dump.latin1()); |
207 | 207 | ||
208 | return cSum; | 208 | return cSum; |
209 | 209 | ||
210 | } | 210 | } |
211 | void Addressee::computeCsum(const QString &dev) | 211 | void Addressee::computeCsum(const QString &dev) |
212 | { | 212 | { |
213 | QStringList l; | 213 | QStringList l; |
214 | //if ( !mData->name.isEmpty() ) l.append(mData->name); | 214 | //if ( !mData->name.isEmpty() ) l.append(mData->name); |
215 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); | 215 | if ( !mData->formattedName.isEmpty() ) l.append(mData->formattedName ); |
216 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); | 216 | if ( !mData->familyName.isEmpty() ) l.append( mData->familyName ); |
217 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); | 217 | if ( !mData->givenName.isEmpty() ) l.append(mData->givenName ); |
218 | if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); | 218 | if ( !mData->additionalName.isEmpty() ) l.append( mData->additionalName ); |
219 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); | 219 | if ( !mData->prefix.isEmpty() ) l.append( mData->prefix ); |
220 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); | 220 | if ( !mData->suffix.isEmpty() ) l.append( mData->suffix ); |
221 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); | 221 | if ( !mData->nickName.isEmpty() ) l.append( mData->nickName ); |
222 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); | 222 | if ( mData->birthday.isValid() ) l.append( mData->birthday.toString() ); |
223 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); | 223 | if ( !mData->mailer.isEmpty() ) l.append( mData->mailer ); |
224 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); | 224 | if ( mData->timeZone.isValid() ) l.append( mData->timeZone.asString() ); |
225 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); | 225 | if ( mData->geo.isValid() ) l.append( mData->geo.asString() ); |
226 | if ( !mData->title .isEmpty() ) l.append( mData->title ); | 226 | if ( !mData->title .isEmpty() ) l.append( mData->title ); |
227 | if ( !mData->role.isEmpty() ) l.append( mData->role ); | 227 | if ( !mData->role.isEmpty() ) l.append( mData->role ); |
228 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); | 228 | if ( !mData->organization.isEmpty() ) l.append( mData->organization ); |
229 | if ( !mData->note.isEmpty() ) l.append( mData->note ); | 229 | if ( !mData->note.isEmpty() ) l.append( mData->note ); |
230 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); | 230 | if ( !mData->productId.isEmpty() ) l.append(mData->productId ); |
231 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); | 231 | if ( !mData->sortString.isEmpty() ) l.append( mData->sortString ); |
232 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); | 232 | if ( mData->secrecy.isValid() ) l.append( mData->secrecy.asString()); |
233 | if ( !mData->logo.undefined() ) { | 233 | if ( !mData->logo.undefined() ) { |
234 | if ( !mData->logo.isIntern() ) | 234 | if ( !mData->logo.isIntern() ) |
235 | l.append( mData->logo.url() ); | 235 | l.append( mData->logo.url() ); |
236 | else | 236 | else |
237 | l.append( QString::number(mData->logo.data().width()* mData->logo.data().height())); | 237 | l.append( QString::number(mData->logo.data().width()* mData->logo.data().height())); |
238 | } else { | 238 | } else { |
239 | l.append( "nologo"); | 239 | l.append( "nologo"); |
240 | } | 240 | } |
241 | if ( !mData->photo.undefined() ) { | 241 | if ( !mData->photo.undefined() ) { |
242 | if ( !mData->photo.isIntern() ) | 242 | if ( !mData->photo.isIntern() ) |
243 | l.append( mData->photo.url() ); | 243 | l.append( mData->photo.url() ); |
244 | else | 244 | else |
245 | l.append( QString::number(mData->photo.data().width()* mData->photo.data().height())); | 245 | l.append( QString::number(mData->photo.data().width()* mData->photo.data().height())); |
246 | } else { | 246 | } else { |
247 | l.append( "nophoto"); | 247 | l.append( "nophoto"); |
248 | } | 248 | } |
249 | #if 0 | 249 | #if 0 |
250 | if ( !mData->sound.undefined() ) { | 250 | if ( !mData->sound.undefined() ) { |
251 | if ( !mData->sound.isIntern() ) | 251 | if ( !mData->sound.isIntern() ) |
252 | l.append( mData->sound.url() ); | 252 | l.append( mData->sound.url() ); |
253 | else | 253 | else |
254 | l.append( QString(mData->sound.data().with()* mData->sound.data().height())); | 254 | l.append( QString(mData->sound.data().with()* mData->sound.data().height())); |
255 | } else { | 255 | } else { |
256 | l.append( "nosound"); | 256 | l.append( "nosound"); |
257 | } | 257 | } |
258 | #endif | 258 | #endif |
259 | //if ( !mData->agent.isEmpty() ) l.append( ); | 259 | //if ( !mData->agent.isEmpty() ) l.append( ); |
260 | if ( mData->url.isValid() ) | 260 | if ( mData->url.isValid() ) |
261 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); | 261 | if ( ! mData->url.path().isEmpty()) l.append( mData->url.path() ); |
262 | KABC::PhoneNumber::List phoneNumbers; | 262 | KABC::PhoneNumber::List phoneNumbers; |
263 | KABC::PhoneNumber::List::Iterator phoneIter; | 263 | KABC::PhoneNumber::List::Iterator phoneIter; |
264 | 264 | ||
265 | QStringList t; | 265 | QStringList t; |
266 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 266 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
267 | ++phoneIter ) | 267 | ++phoneIter ) |
268 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); | 268 | t.append( ( *phoneIter ).number()+QString::number( ( *phoneIter ).type() ) ); |
269 | t.sort(); | 269 | t.sort(); |
270 | uint iii; | 270 | uint iii; |
271 | for ( iii = 0; iii < t.count(); ++iii) | 271 | for ( iii = 0; iii < t.count(); ++iii) |
272 | l.append( t[iii] ); | 272 | l.append( t[iii] ); |
273 | t = mData->emails; | 273 | t = mData->emails; |
274 | t.sort(); | 274 | t.sort(); |
275 | for ( iii = 0; iii < t.count(); ++iii) | 275 | for ( iii = 0; iii < t.count(); ++iii) |
276 | l.append( t[iii] ); | 276 | l.append( t[iii] ); |
277 | t = mData->categories; | 277 | t = mData->categories; |
278 | t.sort(); | 278 | t.sort(); |
279 | for ( iii = 0; iii < t.count(); ++iii) | 279 | for ( iii = 0; iii < t.count(); ++iii) |
280 | l.append( t[iii] ); | 280 | l.append( t[iii] ); |
281 | t = mData->custom; | 281 | t = mData->custom; |
282 | t.sort(); | 282 | t.sort(); |
283 | for ( iii = 0; iii < t.count(); ++iii) | 283 | for ( iii = 0; iii < t.count(); ++iii) |
284 | if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { | 284 | if ( t[iii].left( 25 ) != "KADDRESSBOOK-X-ExternalID" ) { |
285 | int find = t[iii].find (':')+1; | 285 | int find = t[iii].find (':')+1; |
286 | //qDebug("lennnn %d %d ", find, t[iii].length()); | 286 | //qDebug("lennnn %d %d ", find, t[iii].length()); |
287 | if ( find < t[iii].length()) | 287 | if ( find < t[iii].length()) |
288 | l.append( t[iii] ); | 288 | l.append( t[iii] ); |
289 | 289 | ||
290 | } | 290 | } |
291 | KABC::Address::List::Iterator addressIter; | 291 | KABC::Address::List::Iterator addressIter; |
292 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 292 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
293 | ++addressIter ) { | 293 | ++addressIter ) { |
294 | t = (*addressIter).asList(); | 294 | t = (*addressIter).asList(); |
295 | t.sort(); | 295 | t.sort(); |
296 | for ( iii = 0; iii < t.count(); ++iii) | 296 | for ( iii = 0; iii < t.count(); ++iii) |
297 | l.append( t[iii] ); | 297 | l.append( t[iii] ); |
298 | } | 298 | } |
299 | uint cs = getCsum4List(l); | 299 | uint cs = getCsum4List(l); |
300 | 300 | ||
301 | #if 0 | 301 | #if 0 |
302 | for ( iii = 0; iii < l.count(); ++iii) | 302 | for ( iii = 0; iii < l.count(); ++iii) |
303 | qDebug("%d***%s***",iii,l[iii].latin1()); | 303 | qDebug("%d***%s***",iii,l[iii].latin1()); |
304 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); | 304 | qDebug("CSUM computed %d %s %s", cs,QString::number (cs ).latin1(), uid().latin1() ); |
305 | #endif | 305 | #endif |
306 | 306 | ||
307 | 307 | ||
308 | setCsum( dev, QString::number (cs )); | 308 | setCsum( dev, QString::number (cs )); |
309 | } | 309 | } |
310 | bool Addressee::matchAddress( QRegExp* re ) const | 310 | bool Addressee::matchAddress( QRegExp* re ) const |
311 | { | 311 | { |
312 | KABC::Address::List::Iterator addressIter; | 312 | KABC::Address::List::Iterator addressIter; |
313 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 313 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
314 | ++addressIter ) { | 314 | ++addressIter ) { |
315 | if ( (*addressIter).matchAddress( re ) ) | 315 | if ( (*addressIter).matchAddress( re ) ) |
316 | return true; | 316 | return true; |
317 | } | 317 | } |
318 | return false; | 318 | return false; |
319 | } | 319 | } |
320 | bool Addressee::matchPhoneNumber( QRegExp* re ) const | 320 | bool Addressee::matchPhoneNumber( QRegExp* re ) const |
321 | { | 321 | { |
322 | KABC::PhoneNumber::List::Iterator phoneIter; | 322 | KABC::PhoneNumber::List::Iterator phoneIter; |
323 | 323 | ||
324 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) { | 324 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); ++phoneIter ) { |
325 | #if QT_VERSION >= 0x030000 | 325 | #if QT_VERSION >= 0x030000 |
326 | if (re->search( (*phoneIter).number() ) == 0) | 326 | if (re->search( (*phoneIter).number() ) == 0) |
327 | #else | 327 | #else |
328 | if (re->match( (*phoneIter).number() ) == 0) | 328 | if (re->match( (*phoneIter).number() ) == 0) |
329 | #endif | 329 | #endif |
330 | return true; | 330 | return true; |
331 | 331 | ||
332 | } | 332 | } |
333 | return false; | 333 | return false; |
334 | 334 | ||
335 | } | 335 | } |
336 | void Addressee::mergeOLContact( const Addressee& ad ) | 336 | void Addressee::mergeOLContact( const Addressee& ad ) |
337 | { | 337 | { |
338 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 338 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
339 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 339 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
340 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 340 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
341 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 341 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
342 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; | 342 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; |
343 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; | 343 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; |
344 | if ( !mData->sound.isIntern() ) { | 344 | if ( !mData->sound.isIntern() ) { |
345 | if ( mData->sound.url().isEmpty() ) { | 345 | if ( mData->sound.url().isEmpty() ) { |
346 | mData->sound = ad.mData->sound; | 346 | mData->sound = ad.mData->sound; |
347 | } | 347 | } |
348 | } | 348 | } |
349 | if ( !mData->agent.isIntern() ) { | 349 | if ( !mData->agent.isIntern() ) { |
350 | if ( mData->agent.url().isEmpty() ) { | 350 | if ( mData->agent.url().isEmpty() ) { |
351 | mData->agent = ad.mData->agent; | 351 | mData->agent = ad.mData->agent; |
352 | } | 352 | } |
353 | } | 353 | } |
354 | { | 354 | { |
355 | Key::List::Iterator itA; | 355 | Key::List::Iterator itA; |
356 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { | 356 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { |
357 | bool found = false; | 357 | bool found = false; |
358 | Key::List::Iterator it; | 358 | Key::List::Iterator it; |
359 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 359 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
360 | if ( (*it) == (*itA)) { | 360 | if ( (*it) == (*itA)) { |
361 | found = true; | 361 | found = true; |
362 | break; | 362 | break; |
363 | 363 | ||
364 | } | 364 | } |
365 | } | 365 | } |
366 | if ( ! found ) { | 366 | if ( ! found ) { |
367 | mData->keys.append( *itA ); | 367 | mData->keys.append( *itA ); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | } | 370 | } |
371 | 371 | ||
372 | KABC::Address addthis = otherAddress(); | 372 | KABC::Address addthis = otherAddress(); |
373 | KABC::Address addother = ad.otherAddress(); | 373 | KABC::Address addother = ad.otherAddress(); |
374 | if ( !addthis.isEmpty() && !addother.isEmpty() ) | 374 | if ( !addthis.isEmpty() && !addother.isEmpty() ) |
375 | addthis.setType( addother.type() ); | 375 | addthis.setType( addother.type() ); |
376 | //qDebug("merge contact %s ", ad.uid().latin1()); | 376 | //qDebug("merge contact %s ", ad.uid().latin1()); |
377 | setUid( ad.uid() ); | 377 | setUid( ad.uid() ); |
378 | setRevision( ad.revision() ); | 378 | setRevision( ad.revision() ); |
379 | 379 | ||
380 | 380 | ||
381 | } | 381 | } |
382 | 382 | ||
383 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) | 383 | void Addressee::mergeContact( const Addressee& ad , bool isSubSet) // = false) |
384 | { | 384 | { |
385 | // merge all standard non-outlook fields. | 385 | // merge all standard non-outlook fields. |
386 | //if isSubSet (e.g. mobile phone sync) merge all fields | 386 | //if isSubSet (e.g. mobile phone sync) merge all fields |
387 | 387 | ||
388 | detach(); | 388 | detach(); |
389 | if ( isSubSet ) { | 389 | if ( isSubSet ) { |
390 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; | 390 | if ( mData->name.isEmpty() ) mData->name = ad.mData->name; |
391 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; | 391 | if ( mData->formattedName.isEmpty() ) mData->formattedName = ad.mData->formattedName; |
392 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; | 392 | if ( mData->familyName.isEmpty() ) mData->familyName = ad.mData->familyName; |
393 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; | 393 | if ( mData->givenName.isEmpty() ) mData->givenName = ad.mData->givenName ; |
394 | if ( mData->additionalName ) mData->additionalName = ad.mData->additionalName; | 394 | if ( mData->additionalName.isEmpty() ) mData->additionalName = ad.mData->additionalName; |
395 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; | 395 | if ( mData->prefix.isEmpty() ) mData->prefix = ad.mData->prefix; |
396 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; | 396 | if ( mData->suffix.isEmpty() ) mData->suffix = ad.mData->suffix; |
397 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; | 397 | if ( mData->title .isEmpty() ) mData->title = ad.mData->title ; |
398 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; | 398 | if ( mData->role.isEmpty() ) mData->role = ad.mData->role ; |
399 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; | 399 | if ( mData->nickName.isEmpty() ) mData->nickName = ad.mData->nickName; |
400 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; | 400 | if ( mData->organization.isEmpty() ) mData->organization = ad.mData->organization ; |
401 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; | 401 | if ( mData->note.isEmpty() ) mData->note = ad.mData->note ; |
402 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; | 402 | if ( !mData->secrecy.isValid() ) mData->secrecy = ad.mData->secrecy; |
403 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; | 403 | if ( ( !mData->url.isValid() && ad.mData->url.isValid() ) ) mData->url = ad.mData->url ; |
404 | if ( !mData->birthday.isValid() ) | 404 | if ( !mData->birthday.isValid() ) |
405 | if ( ad.mData->birthday.isValid()) | 405 | if ( ad.mData->birthday.isValid()) |
406 | mData->birthday = ad.mData->birthday; | 406 | mData->birthday = ad.mData->birthday; |
407 | 407 | ||
408 | } | 408 | } |
409 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; | 409 | if ( mData->mailer.isEmpty() ) mData->mailer = ad.mData->mailer; |
410 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; | 410 | if ( !mData->timeZone.isValid() ) mData->timeZone = ad.mData->timeZone; |
411 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; | 411 | if ( !mData->geo.isValid() ) mData->geo = ad.mData->geo; |
412 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; | 412 | if ( mData->productId.isEmpty() ) mData->productId = ad.mData->productId; |
413 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; | 413 | if ( mData->sortString.isEmpty() ) mData->sortString = ad.mData->sortString; |
414 | QStringList t; | 414 | QStringList t; |
415 | QStringList tAD; | 415 | QStringList tAD; |
416 | uint iii; | 416 | uint iii; |
417 | 417 | ||
418 | // ********** phone numbers | 418 | // ********** phone numbers |
419 | if ( isSubSet ) { | 419 | if ( isSubSet ) { |
420 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 420 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
421 | PhoneNumber::List::Iterator phoneItAD; | 421 | PhoneNumber::List::Iterator phoneItAD; |
422 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 422 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
423 | bool found = false; | 423 | bool found = false; |
424 | PhoneNumber::List::Iterator it; | 424 | PhoneNumber::List::Iterator it; |
425 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 425 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
426 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 426 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
427 | found = true; | 427 | found = true; |
428 | (*it).setType( ( *phoneItAD ).type() ); | 428 | (*it).setType( ( *phoneItAD ).type() ); |
429 | (*it).setNumber( ( *phoneItAD ).number() ); | 429 | (*it).setNumber( ( *phoneItAD ).number() ); |
430 | break; | 430 | break; |
431 | } | 431 | } |
432 | } | 432 | } |
433 | // if ( isSubSet && ! found ) | 433 | // if ( isSubSet && ! found ) |
434 | if ( ! found ) // LR try this one... | 434 | if ( ! found ) // LR try this one... |
435 | mData->phoneNumbers.append( *phoneItAD ); | 435 | mData->phoneNumbers.append( *phoneItAD ); |
436 | } | 436 | } |
437 | } else { | 437 | } else { |
438 | PhoneNumber::List phoneAD = ad.phoneNumbers(); | 438 | PhoneNumber::List phoneAD = ad.phoneNumbers(); |
439 | PhoneNumber::List::Iterator phoneItAD; | 439 | PhoneNumber::List::Iterator phoneItAD; |
440 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { | 440 | for ( phoneItAD = phoneAD.begin(); phoneItAD != phoneAD.end(); ++phoneItAD ) { |
441 | bool found = false; | 441 | bool found = false; |
442 | PhoneNumber::List::Iterator it; | 442 | PhoneNumber::List::Iterator it; |
443 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { | 443 | for( it = mData->phoneNumbers.begin(); it != mData->phoneNumbers.end(); ++it ) { |
444 | if ( ( *phoneItAD ).contains( (*it) ) ) { | 444 | if ( ( *phoneItAD ).contains( (*it) ) ) { |
445 | found = true; | 445 | found = true; |
446 | (*it).setType( ( *phoneItAD ).type() ); | 446 | (*it).setType( ( *phoneItAD ).type() ); |
447 | (*it).setNumber( ( *phoneItAD ).number() ); | 447 | (*it).setNumber( ( *phoneItAD ).number() ); |
448 | break; | 448 | break; |
449 | } | 449 | } |
450 | } | 450 | } |
451 | if ( ! found ) { // append numbers which do not have work or home type | 451 | if ( ! found ) { // append numbers which do not have work or home type |
452 | if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) ) | 452 | if ( ! ( ( *phoneItAD ).type() & (PhoneNumber::Work | PhoneNumber::Home) ) ) |
453 | mData->phoneNumbers.append( *phoneItAD ); | 453 | mData->phoneNumbers.append( *phoneItAD ); |
454 | } | 454 | } |
455 | } | 455 | } |
456 | } | 456 | } |
457 | if ( isSubSet ) { | 457 | if ( isSubSet ) { |
458 | // ************* emails; | 458 | // ************* emails; |
459 | t = mData->emails; | 459 | t = mData->emails; |
460 | tAD = ad.mData->emails; | 460 | tAD = ad.mData->emails; |
461 | for ( iii = 0; iii < tAD.count(); ++iii) | 461 | for ( iii = 0; iii < tAD.count(); ++iii) |
462 | if ( !t.contains(tAD[iii] ) ) | 462 | if ( !t.contains(tAD[iii] ) ) |
463 | mData->emails.append( tAD[iii] ); | 463 | mData->emails.append( tAD[iii] ); |
464 | } | 464 | } |
465 | 465 | ||
466 | // ************* categories; | 466 | // ************* categories; |
467 | if ( isSubSet ) { | 467 | if ( isSubSet ) { |
468 | t = mData->categories; | 468 | t = mData->categories; |
469 | tAD = ad.mData->categories; | 469 | tAD = ad.mData->categories; |
470 | for ( iii = 0; iii < tAD.count(); ++iii) | 470 | for ( iii = 0; iii < tAD.count(); ++iii) |
471 | if ( !t.contains(tAD[iii] ) ) | 471 | if ( !t.contains(tAD[iii] ) ) |
472 | mData->categories.append( tAD[iii] ); | 472 | mData->categories.append( tAD[iii] ); |
473 | } | 473 | } |
474 | QStringList::ConstIterator it; | 474 | QStringList::ConstIterator it; |
475 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { | 475 | for( it = ad.mData->custom.begin(); it != ad.mData->custom.end(); ++it ) { |
476 | QString qualifiedName = (*it).left( (*it).find( ":" )); | 476 | QString qualifiedName = (*it).left( (*it).find( ":" )); |
477 | bool found = false; | 477 | bool found = false; |
478 | QStringList::ConstIterator itL; | 478 | QStringList::ConstIterator itL; |
479 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { | 479 | for( itL = mData->custom.begin(); itL != mData->custom.end(); ++itL ) { |
480 | if ( (*itL).startsWith( qualifiedName ) ) { | 480 | if ( (*itL).startsWith( qualifiedName ) ) { |
481 | found = true; | 481 | found = true; |
482 | break; | 482 | break; |
483 | } | 483 | } |
484 | } | 484 | } |
485 | if ( ! found ) { | 485 | if ( ! found ) { |
486 | mData->custom.append( *it ); | 486 | mData->custom.append( *it ); |
487 | } | 487 | } |
488 | } | 488 | } |
489 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; | 489 | if ( mData->logo.undefined() && !ad.mData->logo.undefined() ) mData->logo = ad.mData->logo; |
490 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; | 490 | if ( mData->photo.undefined() && !ad.mData->photo.undefined() ) mData->photo = ad.mData->photo; |
491 | if ( !mData->sound.isIntern() ) { | 491 | if ( !mData->sound.isIntern() ) { |
492 | if ( mData->sound.url().isEmpty() ) { | 492 | if ( mData->sound.url().isEmpty() ) { |
493 | mData->sound = ad.mData->sound; | 493 | mData->sound = ad.mData->sound; |
494 | } | 494 | } |
495 | } | 495 | } |
496 | if ( !mData->agent.isIntern() ) { | 496 | if ( !mData->agent.isIntern() ) { |
497 | if ( mData->agent.url().isEmpty() ) { | 497 | if ( mData->agent.url().isEmpty() ) { |
498 | mData->agent = ad.mData->agent; | 498 | mData->agent = ad.mData->agent; |
499 | } | 499 | } |
500 | } | 500 | } |
501 | { | 501 | { |
502 | Key::List::Iterator itA; | 502 | Key::List::Iterator itA; |
503 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { | 503 | for( itA = ad.mData->keys.begin(); itA != ad.mData->keys.end(); ++itA ) { |
504 | bool found = false; | 504 | bool found = false; |
505 | Key::List::Iterator it; | 505 | Key::List::Iterator it; |
506 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { | 506 | for( it = mData->keys.begin(); it != mData->keys.end(); ++it ) { |
507 | if ( (*it) == (*itA)) { | 507 | if ( (*it) == (*itA)) { |
508 | found = true; | 508 | found = true; |
509 | break; | 509 | break; |
510 | 510 | ||
511 | } | 511 | } |
512 | } | 512 | } |
513 | if ( ! found ) { | 513 | if ( ! found ) { |
514 | mData->keys.append( *itA ); | 514 | mData->keys.append( *itA ); |
515 | } | 515 | } |
516 | } | 516 | } |
517 | } | 517 | } |
518 | if ( isSubSet ) { | 518 | if ( isSubSet ) { |
519 | KABC::Address::List::Iterator addressIterA; | 519 | KABC::Address::List::Iterator addressIterA; |
520 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { | 520 | for ( addressIterA = ad.mData->addresses.begin(); addressIterA != ad.mData->addresses.end(); ++addressIterA ) { |
521 | bool found = false; | 521 | bool found = false; |
522 | KABC::Address::List::Iterator addressIter; | 522 | KABC::Address::List::Iterator addressIter; |
523 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); | 523 | for ( addressIter = mData->addresses.begin(); addressIter != mData->addresses.end(); |
524 | ++addressIter ) { | 524 | ++addressIter ) { |
525 | if ( (*addressIter) == (*addressIterA)) { | 525 | if ( (*addressIter) == (*addressIterA)) { |
526 | found = true; | 526 | found = true; |
527 | (*addressIter).setType( (*addressIterA).type() ); | 527 | (*addressIter).setType( (*addressIterA).type() ); |
528 | break; | 528 | break; |
529 | } | 529 | } |
530 | 530 | ||
531 | } | 531 | } |
532 | if ( isSubSet && ! found ) { | 532 | if ( isSubSet && ! found ) { |
533 | mData->addresses.append( *addressIterA ); | 533 | mData->addresses.append( *addressIterA ); |
534 | } | 534 | } |
535 | } | 535 | } |
536 | } | 536 | } |
537 | //qDebug("merge contact %s ", ad.uid().latin1()); | 537 | //qDebug("merge contact %s ", ad.uid().latin1()); |
538 | setUid( ad.uid() ); | 538 | setUid( ad.uid() ); |
539 | setRevision( ad.revision() ); | 539 | setRevision( ad.revision() ); |
540 | } | 540 | } |
541 | 541 | ||
542 | bool Addressee::removeVoice() | 542 | bool Addressee::removeVoice() |
543 | { | 543 | { |
544 | PhoneNumber::List phoneN = phoneNumbers(); | 544 | PhoneNumber::List phoneN = phoneNumbers(); |
545 | PhoneNumber::List::Iterator phoneIt; | 545 | PhoneNumber::List::Iterator phoneIt; |
546 | bool found = false; | 546 | bool found = false; |
547 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 547 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
548 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found | 548 | if ( (*phoneIt).type() & PhoneNumber::Voice) { // voice found |
549 | if ((*phoneIt).type() - PhoneNumber::Voice ) { | 549 | if ((*phoneIt).type() - PhoneNumber::Voice ) { |
550 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); | 550 | (*phoneIt).setType((*phoneIt).type() - PhoneNumber::Voice ); |
551 | insertPhoneNumber( (*phoneIt) ); | 551 | insertPhoneNumber( (*phoneIt) ); |
552 | found = true; | 552 | found = true; |
553 | } | 553 | } |
554 | } | 554 | } |
555 | 555 | ||
556 | } | 556 | } |
557 | return found; | 557 | return found; |
558 | } | 558 | } |
559 | 559 | ||
560 | bool Addressee::containsAdr(const Addressee& ad ) | 560 | bool Addressee::containsAdr(const Addressee& ad ) |
561 | { | 561 | { |
562 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; | 562 | if ( ! ad.mData->familyName.isEmpty() ) if ( mData->familyName != ad.mData->familyName) return false; |
563 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; | 563 | if ( ! ad.mData->givenName.isEmpty() )if ( mData->givenName != ad.mData->givenName ) return false; |
564 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; | 564 | if ( ad.mData->url.isValid() ) if (mData->url != ad.mData->url) return false ; |
565 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; | 565 | if ( ! ad.mData->role.isEmpty() ) if (mData->role != ad.mData->role) return false ; |
566 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; | 566 | if ( ! ad.mData->organization.isEmpty() ) if (mData->organization != ad.mData->organization) return false ; |
567 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; | 567 | if ( ! ad.mData->note.isEmpty() ) if (mData->note != ad.mData->note) return false ; |
568 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; | 568 | if ( ! ad.mData->title .isEmpty() ) if (mData->title != ad.mData->title ) return false ; |
569 | 569 | ||
570 | // compare phone numbers | 570 | // compare phone numbers |
571 | PhoneNumber::List phoneN = ad.phoneNumbers(); | 571 | PhoneNumber::List phoneN = ad.phoneNumbers(); |
572 | PhoneNumber::List::Iterator phoneIt; | 572 | PhoneNumber::List::Iterator phoneIt; |
573 | bool found = false; | 573 | bool found = false; |
574 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { | 574 | for ( phoneIt = phoneN.begin(); phoneIt != phoneN.end(); ++phoneIt ) { |
575 | bool found = false; | 575 | bool found = false; |
576 | PhoneNumber::List phoneL = ad.phoneNumbers(); | 576 | PhoneNumber::List phoneL = ad.phoneNumbers(); |
577 | PhoneNumber::List::Iterator phoneItL; | 577 | PhoneNumber::List::Iterator phoneItL; |
578 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { | 578 | for ( phoneItL = phoneL.begin(); phoneItL != phoneL.end(); ++phoneItL ) { |
579 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { | 579 | if ( ( *phoneItL ).number() == ( *phoneIt ).number() ) { |
580 | found = true; | 580 | found = true; |
581 | break; | 581 | break; |
582 | } | 582 | } |
583 | } | 583 | } |
584 | if ( ! found ) | 584 | if ( ! found ) |
585 | return false; | 585 | return false; |
586 | } | 586 | } |
587 | return true; | 587 | return true; |
588 | 588 | ||
589 | } | 589 | } |
590 | void Addressee::simplifyAddresses() | 590 | void Addressee::simplifyAddresses() |
591 | { | 591 | { |
592 | 592 | ||
593 | 593 | ||
594 | Address::List list; | 594 | Address::List list; |
595 | Address::List::Iterator it; | 595 | Address::List::Iterator it; |
596 | Address::List::Iterator it2; | 596 | Address::List::Iterator it2; |
597 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 597 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
598 | it2 = it; | 598 | it2 = it; |
599 | ++it2; | 599 | ++it2; |
600 | for( ; it2 != mData->addresses.end(); ++it2 ) { | 600 | for( ; it2 != mData->addresses.end(); ++it2 ) { |
601 | if ( (*it) == (*it2) ) { | 601 | if ( (*it) == (*it2) ) { |
602 | list.append( *it ); | 602 | list.append( *it ); |
603 | break; | 603 | break; |
604 | } | 604 | } |
605 | } | 605 | } |
606 | } | 606 | } |
607 | for( it = list.begin(); it != list.end(); ++it ) { | 607 | for( it = list.begin(); it != list.end(); ++it ) { |
608 | removeAddress( (*it) ); | 608 | removeAddress( (*it) ); |
609 | } | 609 | } |
610 | 610 | ||
611 | list.clear(); | 611 | list.clear(); |
612 | int max = 2; | 612 | int max = 2; |
613 | if ( mData->url.isValid() ) | 613 | if ( mData->url.isValid() ) |
614 | max = 1; | 614 | max = 1; |
615 | if ( mData->addresses.count() <= max ) return ; | 615 | if ( mData->addresses.count() <= max ) return ; |
616 | int count = 0; | 616 | int count = 0; |
617 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { | 617 | for( it = mData->addresses.begin(); it != mData->addresses.end(); ++it ) { |
618 | if ( count >= max ) | 618 | if ( count >= max ) |
619 | list.append( *it ); | 619 | list.append( *it ); |
620 | ++count; | 620 | ++count; |
621 | } | 621 | } |
622 | for( it = list.begin(); it != list.end(); ++it ) { | 622 | for( it = list.begin(); it != list.end(); ++it ) { |
623 | removeAddress( (*it) ); | 623 | removeAddress( (*it) ); |
624 | } | 624 | } |
625 | } | 625 | } |
626 | 626 | ||
627 | // removes all emails but the first | 627 | // removes all emails but the first |
628 | // needed by phone sync | 628 | // needed by phone sync |
629 | void Addressee::simplifyEmails() | 629 | void Addressee::simplifyEmails() |
630 | { | 630 | { |
631 | if ( mData->emails.count() == 0 ) return ; | 631 | if ( mData->emails.count() == 0 ) return ; |
632 | QString email = mData->emails.first(); | 632 | QString email = mData->emails.first(); |
633 | detach(); | 633 | detach(); |
634 | mData->emails.clear(); | 634 | mData->emails.clear(); |
635 | mData->emails.append( email ); | 635 | mData->emails.append( email ); |
636 | } | 636 | } |
637 | void Addressee::makePhoneNumbersOLcompatible() | 637 | void Addressee::makePhoneNumbersOLcompatible() |
638 | { | 638 | { |
639 | KABC::PhoneNumber::List::Iterator phoneIter; | 639 | KABC::PhoneNumber::List::Iterator phoneIter; |
640 | KABC::PhoneNumber::List::Iterator phoneIter2; | 640 | KABC::PhoneNumber::List::Iterator phoneIter2; |
641 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 641 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
642 | ++phoneIter ) { | 642 | ++phoneIter ) { |
643 | ( *phoneIter ).makeCompat(); | 643 | ( *phoneIter ).makeCompat(); |
644 | } | 644 | } |
645 | int hasHome = hasPhoneNumberType( PhoneNumber::Home | PhoneNumber::Pref ); | 645 | int hasHome = hasPhoneNumberType( PhoneNumber::Home | PhoneNumber::Pref ); |
646 | int hasHome2 = hasPhoneNumberType( PhoneNumber::Home ); | 646 | int hasHome2 = hasPhoneNumberType( PhoneNumber::Home ); |
647 | int hasWork = hasPhoneNumberType( PhoneNumber::Work | PhoneNumber::Pref ); | 647 | int hasWork = hasPhoneNumberType( PhoneNumber::Work | PhoneNumber::Pref ); |
648 | int hasWork2 = hasPhoneNumberType( PhoneNumber::Work ); | 648 | int hasWork2 = hasPhoneNumberType( PhoneNumber::Work ); |
649 | int hasCell = hasPhoneNumberType( PhoneNumber::Cell ); | 649 | int hasCell = hasPhoneNumberType( PhoneNumber::Cell ); |
650 | int hasCell2 = hasPhoneNumberType( PhoneNumber::Car ); | 650 | int hasCell2 = hasPhoneNumberType( PhoneNumber::Car ); |
651 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 651 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
652 | ++phoneIter ) { | 652 | ++phoneIter ) { |
653 | if ( (*phoneIter).type() == PhoneNumber::Home && ! hasHome ) { | 653 | if ( (*phoneIter).type() == PhoneNumber::Home && ! hasHome ) { |
654 | (*phoneIter).setType( PhoneNumber::Home | PhoneNumber::Pref ); | 654 | (*phoneIter).setType( PhoneNumber::Home | PhoneNumber::Pref ); |
655 | ++hasHome; | 655 | ++hasHome; |
656 | if ( hasHome2 ) --hasHome2; | 656 | if ( hasHome2 ) --hasHome2; |
657 | } else if ( ( (*phoneIter).type() == PhoneNumber::Home | PhoneNumber::Pref) && hasHome>1 && !hasHome2 ) { | 657 | } else if ( ( (*phoneIter).type() == PhoneNumber::Home | PhoneNumber::Pref) && hasHome>1 && !hasHome2 ) { |
658 | (*phoneIter).setType( PhoneNumber::Home ); | 658 | (*phoneIter).setType( PhoneNumber::Home ); |
659 | --hasHome; | 659 | --hasHome; |
660 | ++hasHome2; | 660 | ++hasHome2; |
661 | } else if ( (*phoneIter).type() == PhoneNumber::Work && ! hasWork ) { | 661 | } else if ( (*phoneIter).type() == PhoneNumber::Work && ! hasWork ) { |
662 | (*phoneIter).setType( PhoneNumber::Work | PhoneNumber::Pref ); | 662 | (*phoneIter).setType( PhoneNumber::Work | PhoneNumber::Pref ); |
663 | ++hasWork; | 663 | ++hasWork; |
664 | if ( hasWork2 ) --hasWork2; | 664 | if ( hasWork2 ) --hasWork2; |
665 | } else if ( ( (*phoneIter).type() == PhoneNumber::Work | PhoneNumber::Pref) && hasWork > 1 && ! hasWork2 ) { | 665 | } else if ( ( (*phoneIter).type() == PhoneNumber::Work | PhoneNumber::Pref) && hasWork > 1 && ! hasWork2 ) { |
666 | (*phoneIter).setType( PhoneNumber::Work ); | 666 | (*phoneIter).setType( PhoneNumber::Work ); |
667 | --hasWork; | 667 | --hasWork; |
668 | ++hasWork2; | 668 | ++hasWork2; |
669 | } else if ( (*phoneIter).type() == PhoneNumber::Cell && hasCell > 1 && !hasCell2) { | 669 | } else if ( (*phoneIter).type() == PhoneNumber::Cell && hasCell > 1 && !hasCell2) { |
670 | (*phoneIter).setType( PhoneNumber::Car ); | 670 | (*phoneIter).setType( PhoneNumber::Car ); |
671 | ++hasCell2; | 671 | ++hasCell2; |
672 | --hasCell; | 672 | --hasCell; |
673 | } else if ( (*phoneIter).type() == PhoneNumber::Car && hasCell2 > 1 && !hasCell) { | 673 | } else if ( (*phoneIter).type() == PhoneNumber::Car && hasCell2 > 1 && !hasCell) { |
674 | (*phoneIter).setType( PhoneNumber::Cell ); | 674 | (*phoneIter).setType( PhoneNumber::Cell ); |
675 | ++hasCell; | 675 | ++hasCell; |
676 | --hasCell2; | 676 | --hasCell2; |
677 | } else{ | 677 | } else{ |
678 | phoneIter2 = phoneIter; | 678 | phoneIter2 = phoneIter; |
679 | ++phoneIter2; | 679 | ++phoneIter2; |
680 | for ( ; phoneIter2 != mData->phoneNumbers.end(); | 680 | for ( ; phoneIter2 != mData->phoneNumbers.end(); |
681 | ++phoneIter2 ) { | 681 | ++phoneIter2 ) { |
682 | if ( (*phoneIter2).type() == (*phoneIter).type() ) { | 682 | if ( (*phoneIter2).type() == (*phoneIter).type() ) { |
683 | (*phoneIter2).setType( PhoneNumber::Voice ); | 683 | (*phoneIter2).setType( PhoneNumber::Voice ); |
684 | 684 | ||
685 | } | 685 | } |
686 | } | 686 | } |
687 | } | 687 | } |
688 | } | 688 | } |
689 | } | 689 | } |
690 | void Addressee::simplifyPhoneNumbers() | 690 | void Addressee::simplifyPhoneNumbers() |
691 | { | 691 | { |
692 | int max = 4; | 692 | int max = 4; |
693 | int inList = mData->phoneNumbers.count(); | 693 | int inList = mData->phoneNumbers.count(); |
694 | KABC::PhoneNumber::List removeNumbers; | 694 | KABC::PhoneNumber::List removeNumbers; |
695 | KABC::PhoneNumber::List::Iterator phoneIter; | 695 | KABC::PhoneNumber::List::Iterator phoneIter; |
696 | if ( inList > max ) { | 696 | if ( inList > max ) { |
697 | // delete non-preferred numbers | 697 | // delete non-preferred numbers |
698 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 698 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
699 | ++phoneIter ) { | 699 | ++phoneIter ) { |
700 | if ( inList > max ) { | 700 | if ( inList > max ) { |
701 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { | 701 | if ( ! (( *phoneIter ).type() & PhoneNumber::Pref )) { |
702 | removeNumbers.append( ( *phoneIter ) ); | 702 | removeNumbers.append( ( *phoneIter ) ); |
703 | --inList; | 703 | --inList; |
704 | } | 704 | } |
705 | } else | 705 | } else |
706 | break; | 706 | break; |
707 | } | 707 | } |
708 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 708 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
709 | ++phoneIter ) { | 709 | ++phoneIter ) { |
710 | removePhoneNumber(( *phoneIter )); | 710 | removePhoneNumber(( *phoneIter )); |
711 | } | 711 | } |
712 | // delete preferred numbers | 712 | // delete preferred numbers |
713 | if ( inList > max ) { | 713 | if ( inList > max ) { |
714 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 714 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
715 | ++phoneIter ) { | 715 | ++phoneIter ) { |
716 | if ( inList > max ) { | 716 | if ( inList > max ) { |
717 | removeNumbers.append( ( *phoneIter ) ); | 717 | removeNumbers.append( ( *phoneIter ) ); |
718 | --inList; | 718 | --inList; |
719 | } else | 719 | } else |
720 | break; | 720 | break; |
721 | } | 721 | } |
722 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 722 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
723 | ++phoneIter ) { | 723 | ++phoneIter ) { |
724 | removePhoneNumber(( *phoneIter )); | 724 | removePhoneNumber(( *phoneIter )); |
725 | } | 725 | } |
726 | } | 726 | } |
727 | } | 727 | } |
728 | // remove non-numeric characters | 728 | // remove non-numeric characters |
729 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 729 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
730 | ++phoneIter ) { | 730 | ++phoneIter ) { |
731 | if ( ! ( *phoneIter ).simplifyNumber() ) | 731 | if ( ! ( *phoneIter ).simplifyNumber() ) |
732 | removeNumbers.append( ( *phoneIter ) ); | 732 | removeNumbers.append( ( *phoneIter ) ); |
733 | } | 733 | } |
734 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); | 734 | for ( phoneIter = removeNumbers.begin(); phoneIter != removeNumbers.end(); |
735 | ++phoneIter ) { | 735 | ++phoneIter ) { |
736 | removePhoneNumber(( *phoneIter )); | 736 | removePhoneNumber(( *phoneIter )); |
737 | } | 737 | } |
738 | } | 738 | } |
739 | void Addressee::simplifyPhoneNumberTypes() | 739 | void Addressee::simplifyPhoneNumberTypes() |
740 | { | 740 | { |
741 | KABC::PhoneNumber::List::Iterator phoneIter; | 741 | KABC::PhoneNumber::List::Iterator phoneIter; |
742 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); | 742 | for ( phoneIter = mData->phoneNumbers.begin(); phoneIter != mData->phoneNumbers.end(); |
743 | ++phoneIter ) | 743 | ++phoneIter ) |
744 | ( *phoneIter ).simplifyType(); | 744 | ( *phoneIter ).simplifyType(); |
745 | } | 745 | } |
746 | void Addressee::removeID(const QString &prof) | 746 | void Addressee::removeID(const QString &prof) |
747 | { | 747 | { |
748 | detach(); | 748 | detach(); |
749 | if ( prof.isEmpty() ) | 749 | if ( prof.isEmpty() ) |
750 | mData->mExternalId = ":"; | 750 | mData->mExternalId = ":"; |
751 | else | 751 | else |
752 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); | 752 | mData->mExternalId = KIdManager::removeId ( mData->mExternalId, prof); |
753 | 753 | ||
754 | } | 754 | } |
755 | void Addressee::setID( const QString & prof , const QString & id ) | 755 | void Addressee::setID( const QString & prof , const QString & id ) |
756 | { | 756 | { |
757 | detach(); | 757 | detach(); |
758 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); | 758 | mData->mExternalId = KIdManager::setId ( mData->mExternalId, prof, id ); |
759 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 759 | //qDebug("setID2 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
760 | } | 760 | } |
761 | void Addressee::setTempSyncStat( int id ) | 761 | void Addressee::setTempSyncStat( int id ) |
762 | { | 762 | { |
763 | if ( mData->mTempSyncStat == id ) return; | 763 | if ( mData->mTempSyncStat == id ) return; |
764 | detach(); | 764 | detach(); |
765 | mData->mTempSyncStat = id; | 765 | mData->mTempSyncStat = id; |
766 | } | 766 | } |
767 | int Addressee::tempSyncStat() const | 767 | int Addressee::tempSyncStat() const |
768 | { | 768 | { |
769 | return mData->mTempSyncStat; | 769 | return mData->mTempSyncStat; |
770 | } | 770 | } |
771 | 771 | ||
772 | const QString Addressee::getID( const QString & prof) const | 772 | const QString Addressee::getID( const QString & prof) const |
773 | { | 773 | { |
774 | return KIdManager::getId ( mData->mExternalId, prof ); | 774 | return KIdManager::getId ( mData->mExternalId, prof ); |
775 | } | 775 | } |
776 | 776 | ||
777 | void Addressee::setCsum( const QString & prof , const QString & id ) | 777 | void Addressee::setCsum( const QString & prof , const QString & id ) |
778 | { | 778 | { |
779 | detach(); | 779 | detach(); |
780 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); | 780 | //qDebug("setcsum1 %s %s %s",mData->mExternalId.latin1(), prof.latin1(), id.latin1() ); |
781 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); | 781 | mData->mExternalId = KIdManager::setCsum ( mData->mExternalId, prof, id ); |
782 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); | 782 | //qDebug("setcsum2 %s ",mData->mExternalId.latin1() ); |
783 | } | 783 | } |
784 | 784 | ||
785 | const QString Addressee::getCsum( const QString & prof) const | 785 | const QString Addressee::getCsum( const QString & prof) const |
786 | { | 786 | { |
787 | return KIdManager::getCsum ( mData->mExternalId, prof ); | 787 | return KIdManager::getCsum ( mData->mExternalId, prof ); |
788 | } | 788 | } |
789 | 789 | ||
790 | void Addressee::setIDStr( const QString & s ) | 790 | void Addressee::setIDStr( const QString & s ) |
791 | { | 791 | { |
792 | detach(); | 792 | detach(); |
793 | mData->mExternalId = s; | 793 | mData->mExternalId = s; |
794 | } | 794 | } |
795 | 795 | ||
796 | const QString Addressee::IDStr() const | 796 | const QString Addressee::IDStr() const |
797 | { | 797 | { |
798 | return mData->mExternalId; | 798 | return mData->mExternalId; |
799 | } | 799 | } |
800 | 800 | ||
801 | void Addressee::setExternalUID( const QString &id ) | 801 | void Addressee::setExternalUID( const QString &id ) |
802 | { | 802 | { |
803 | if ( id == mData->externalUID ) return; | 803 | if ( id == mData->externalUID ) return; |
804 | detach(); | 804 | detach(); |
805 | mData->empty = false; | 805 | mData->empty = false; |
806 | mData->externalUID = id; | 806 | mData->externalUID = id; |
807 | } | 807 | } |
808 | 808 | ||
809 | const QString Addressee::externalUID() const | 809 | const QString Addressee::externalUID() const |
810 | { | 810 | { |
811 | return mData->externalUID; | 811 | return mData->externalUID; |
812 | } | 812 | } |
813 | void Addressee::setOriginalExternalUID( const QString &id ) | 813 | void Addressee::setOriginalExternalUID( const QString &id ) |
814 | { | 814 | { |
815 | if ( id == mData->originalExternalUID ) return; | 815 | if ( id == mData->originalExternalUID ) return; |
816 | detach(); | 816 | detach(); |
817 | mData->empty = false; | 817 | mData->empty = false; |
818 | //qDebug("*******Set orig uid %s ", id.latin1()); | 818 | //qDebug("*******Set orig uid %s ", id.latin1()); |
819 | mData->originalExternalUID = id; | 819 | mData->originalExternalUID = id; |
820 | } | 820 | } |
821 | 821 | ||
822 | QString Addressee::originalExternalUID() const | 822 | QString Addressee::originalExternalUID() const |
823 | { | 823 | { |
824 | return mData->originalExternalUID; | 824 | return mData->originalExternalUID; |
825 | } | 825 | } |
826 | 826 | ||
827 | void Addressee::setUid( const QString &id ) | 827 | void Addressee::setUid( const QString &id ) |
828 | { | 828 | { |
829 | if ( id == mData->uid ) return; | 829 | if ( id == mData->uid ) return; |
830 | detach(); | 830 | detach(); |
831 | //qDebug("****setuid %s ", id.latin1()); | 831 | //qDebug("****setuid %s ", id.latin1()); |
832 | mData->empty = false; | 832 | mData->empty = false; |
833 | mData->uid = id; | 833 | mData->uid = id; |
834 | } | 834 | } |
835 | 835 | ||
836 | const QString Addressee::uid() const | 836 | const QString Addressee::uid() const |
837 | { | 837 | { |
838 | if ( mData->uid.isEmpty() ) | 838 | if ( mData->uid.isEmpty() ) |
839 | mData->uid = KApplication::randomString( 10 ); | 839 | mData->uid = KApplication::randomString( 10 ); |
840 | 840 | ||
841 | return mData->uid; | 841 | return mData->uid; |
842 | } | 842 | } |
843 | 843 | ||
844 | QString Addressee::uidLabel() | 844 | QString Addressee::uidLabel() |
845 | { | 845 | { |
846 | return i18n("Unique Identifier"); | 846 | return i18n("Unique Identifier"); |
847 | } | 847 | } |
848 | 848 | ||
849 | void Addressee::setName( const QString &name ) | 849 | void Addressee::setName( const QString &name ) |
850 | { | 850 | { |
851 | if ( name == mData->name ) return; | 851 | if ( name == mData->name ) return; |
852 | detach(); | 852 | detach(); |
853 | mData->empty = false; | 853 | mData->empty = false; |
854 | mData->name = name; | 854 | mData->name = name; |
855 | } | 855 | } |
856 | 856 | ||
857 | QString Addressee::name() const | 857 | QString Addressee::name() const |
858 | { | 858 | { |
859 | return mData->name; | 859 | return mData->name; |
860 | } | 860 | } |
861 | 861 | ||
862 | QString Addressee::nameLabel() | 862 | QString Addressee::nameLabel() |
863 | { | 863 | { |
864 | return i18n("Name"); | 864 | return i18n("Name"); |
865 | } | 865 | } |
866 | 866 | ||
867 | 867 | ||
868 | void Addressee::setFormattedName( const QString &formattedName ) | 868 | void Addressee::setFormattedName( const QString &formattedName ) |
869 | { | 869 | { |
870 | if ( formattedName == mData->formattedName ) return; | 870 | if ( formattedName == mData->formattedName ) return; |
871 | detach(); | 871 | detach(); |
872 | mData->empty = false; | 872 | mData->empty = false; |
873 | mData->formattedName = formattedName; | 873 | mData->formattedName = formattedName; |
874 | } | 874 | } |
875 | 875 | ||
876 | QString Addressee::formattedName() const | 876 | QString Addressee::formattedName() const |
877 | { | 877 | { |
878 | return mData->formattedName; | 878 | return mData->formattedName; |
879 | } | 879 | } |
880 | 880 | ||
881 | QString Addressee::formattedNameLabel() | 881 | QString Addressee::formattedNameLabel() |
882 | { | 882 | { |
883 | return i18n("Formatted Name"); | 883 | return i18n("Formatted Name"); |
884 | } | 884 | } |
885 | 885 | ||
886 | 886 | ||
887 | void Addressee::setFamilyName( const QString &familyName ) | 887 | void Addressee::setFamilyName( const QString &familyName ) |
888 | { | 888 | { |
889 | if ( familyName == mData->familyName ) return; | 889 | if ( familyName == mData->familyName ) return; |
890 | detach(); | 890 | detach(); |
891 | mData->empty = false; | 891 | mData->empty = false; |
892 | mData->familyName = familyName; | 892 | mData->familyName = familyName; |
893 | } | 893 | } |
894 | 894 | ||
895 | QString Addressee::familyName() const | 895 | QString Addressee::familyName() const |
896 | { | 896 | { |
897 | return mData->familyName; | 897 | return mData->familyName; |
898 | } | 898 | } |
899 | 899 | ||
900 | QString Addressee::familyNameLabel() | 900 | QString Addressee::familyNameLabel() |
901 | { | 901 | { |
902 | return i18n("Family Name"); | 902 | return i18n("Family Name"); |
903 | } | 903 | } |
904 | 904 | ||
905 | 905 | ||
906 | void Addressee::setGivenName( const QString &givenName ) | 906 | void Addressee::setGivenName( const QString &givenName ) |
diff --git a/kabc/addressee.h b/kabc/addressee.h index 0ea1803..30dcd5d 100644 --- a/kabc/addressee.h +++ b/kabc/addressee.h | |||
@@ -1,599 +1,599 @@ | |||
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 | #ifndef KABC_ADDRESSEE_H | 29 | #ifndef KABC_ADDRESSEE_H |
30 | #define KABC_ADDRESSEE_H | 30 | #define KABC_ADDRESSEE_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <qstring.h> | 33 | #include <qstring.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | #include <qstringlist.h> | 35 | #include <qstringlist.h> |
36 | #include <qvaluelist.h> | 36 | #include <q3valuelist.h> |
37 | 37 | ||
38 | #include <ksharedptr.h> | 38 | #include <ksharedptr.h> |
39 | #include <kurl.h> | 39 | #include <kurl.h> |
40 | 40 | ||
41 | #include "address.h" | 41 | #include "address.h" |
42 | #include "agent.h" | 42 | #include "agent.h" |
43 | #include "geo.h" | 43 | #include "geo.h" |
44 | #include "key.h" | 44 | #include "key.h" |
45 | #include "phonenumber.h" | 45 | #include "phonenumber.h" |
46 | #include "picture.h" | 46 | #include "picture.h" |
47 | #include "secrecy.h" | 47 | #include "secrecy.h" |
48 | #include "sound.h" | 48 | #include "sound.h" |
49 | #include "timezone.h" | 49 | #include "timezone.h" |
50 | 50 | ||
51 | namespace KABC { | 51 | namespace KABC { |
52 | 52 | ||
53 | class Resource; | 53 | class Resource; |
54 | 54 | ||
55 | /** | 55 | /** |
56 | @short address book entry | 56 | @short address book entry |
57 | 57 | ||
58 | This class represents an entry in the address book. | 58 | This class represents an entry in the address book. |
59 | 59 | ||
60 | The data of this class is implicitly shared. You can pass this class by value. | 60 | The data of this class is implicitly shared. You can pass this class by value. |
61 | 61 | ||
62 | If you need the name of a field for presenting it to the user you should use | 62 | If you need the name of a field for presenting it to the user you should use |
63 | the functions ending in Label(). They return a translated string which can be | 63 | the functions ending in Label(). They return a translated string which can be |
64 | used as label for the corresponding field. | 64 | used as label for the corresponding field. |
65 | 65 | ||
66 | About the name fields: | 66 | About the name fields: |
67 | 67 | ||
68 | givenName() is the first name and familyName() the last name. In some | 68 | givenName() is the first name and familyName() the last name. In some |
69 | countries the family name comes first, that's the reason for the | 69 | countries the family name comes first, that's the reason for the |
70 | naming. formattedName() is the full name with the correct formatting. | 70 | naming. formattedName() is the full name with the correct formatting. |
71 | It is used as an override, when the correct formatting can't be generated | 71 | It is used as an override, when the correct formatting can't be generated |
72 | from the other name fields automatically. | 72 | from the other name fields automatically. |
73 | 73 | ||
74 | realName() returns a fully formatted name(). It uses formattedName, if set, | 74 | realName() returns a fully formatted name(). It uses formattedName, if set, |
75 | otherwise it constucts the name from the name fields. As fallback, if | 75 | otherwise it constucts the name from the name fields. As fallback, if |
76 | nothing else is set it uses name(). | 76 | nothing else is set it uses name(). |
77 | 77 | ||
78 | name() is the NAME type of RFC2426. It can be used as internal name for the | 78 | name() is the NAME type of RFC2426. It can be used as internal name for the |
79 | data enty, but shouldn't be used for displaying the data to the user. | 79 | data enty, but shouldn't be used for displaying the data to the user. |
80 | */ | 80 | */ |
81 | class Addressee | 81 | class Addressee |
82 | { | 82 | { |
83 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); | 83 | friend QDataStream &operator<<( QDataStream &, const Addressee & ); |
84 | friend QDataStream &operator>>( QDataStream &, Addressee & ); | 84 | friend QDataStream &operator>>( QDataStream &, Addressee & ); |
85 | 85 | ||
86 | public: | 86 | public: |
87 | typedef QValueList<Addressee> List; | 87 | typedef Q3ValueList<Addressee> List; |
88 | 88 | ||
89 | /** | 89 | /** |
90 | Construct an empty address book entry. | 90 | Construct an empty address book entry. |
91 | */ | 91 | */ |
92 | Addressee(); | 92 | Addressee(); |
93 | ~Addressee(); | 93 | ~Addressee(); |
94 | 94 | ||
95 | Addressee( const Addressee & ); | 95 | Addressee( const Addressee & ); |
96 | Addressee &operator=( const Addressee & ); | 96 | Addressee &operator=( const Addressee & ); |
97 | 97 | ||
98 | bool operator==( const Addressee & ) const; | 98 | bool operator==( const Addressee & ) const; |
99 | bool operator!=( const Addressee & ) const; | 99 | bool operator!=( const Addressee & ) const; |
100 | // sync stuff | 100 | // sync stuff |
101 | void setTempSyncStat(int id); | 101 | void setTempSyncStat(int id); |
102 | int tempSyncStat() const; | 102 | int tempSyncStat() const; |
103 | void setIDStr( const QString & ); | 103 | void setIDStr( const QString & ); |
104 | const QString IDStr() const; | 104 | const QString IDStr() const; |
105 | void setID( const QString &, const QString & ); | 105 | void setID( const QString &, const QString & ); |
106 | const QString getID( const QString & ) const; | 106 | const QString getID( const QString & ) const; |
107 | void setCsum( const QString &, const QString & ); | 107 | void setCsum( const QString &, const QString & ); |
108 | const QString getCsum( const QString & ) const ; | 108 | const QString getCsum( const QString & ) const ; |
109 | void removeID(const QString &); | 109 | void removeID(const QString &); |
110 | void computeCsum(const QString &dev); | 110 | void computeCsum(const QString &dev); |
111 | ulong getCsum4List( const QStringList & attList); | 111 | ulong getCsum4List( const QStringList & attList); |
112 | /** | 112 | /** |
113 | Return, if the address book entry is empty. | 113 | Return, if the address book entry is empty. |
114 | */ | 114 | */ |
115 | bool isEmpty() const; | 115 | bool isEmpty() const; |
116 | void setExternalUID( const QString &id ); | 116 | void setExternalUID( const QString &id ); |
117 | const QString externalUID() const; | 117 | const QString externalUID() const; |
118 | void setOriginalExternalUID( const QString &id ); | 118 | void setOriginalExternalUID( const QString &id ); |
119 | QString originalExternalUID() const; | 119 | QString originalExternalUID() const; |
120 | void mergeContact( const Addressee& ad, bool isSubSet ); | 120 | void mergeContact( const Addressee& ad, bool isSubSet ); |
121 | void mergeOLContact( const Addressee& ad ); | 121 | void mergeOLContact( const Addressee& ad ); |
122 | void simplifyEmails(); | 122 | void simplifyEmails(); |
123 | void simplifyAddresses(); | 123 | void simplifyAddresses(); |
124 | void simplifyPhoneNumbers(); | 124 | void simplifyPhoneNumbers(); |
125 | void simplifyPhoneNumberTypes(); | 125 | void simplifyPhoneNumberTypes(); |
126 | void makePhoneNumbersOLcompatible(); | 126 | void makePhoneNumbersOLcompatible(); |
127 | int hasPhoneNumberType( int type ); | 127 | int hasPhoneNumberType( int type ); |
128 | bool removeVoice(); | 128 | bool removeVoice(); |
129 | bool containsAdr(const Addressee& addr ); | 129 | bool containsAdr(const Addressee& addr ); |
130 | 130 | ||
131 | /** | 131 | /** |
132 | Set unique identifier. | 132 | Set unique identifier. |
133 | */ | 133 | */ |
134 | void setUid( const QString &uid ); | 134 | void setUid( const QString &uid ); |
135 | /** | 135 | /** |
136 | Return unique identifier. | 136 | Return unique identifier. |
137 | */ | 137 | */ |
138 | const QString uid() const; | 138 | const QString uid() const; |
139 | /** | 139 | /** |
140 | Return translated label for uid field. | 140 | Return translated label for uid field. |
141 | */ | 141 | */ |
142 | static QString uidLabel(); | 142 | static QString uidLabel(); |
143 | 143 | ||
144 | /** | 144 | /** |
145 | Set name. | 145 | Set name. |
146 | */ | 146 | */ |
147 | void setName( const QString &name ); | 147 | void setName( const QString &name ); |
148 | /** | 148 | /** |
149 | Return name. | 149 | Return name. |
150 | */ | 150 | */ |
151 | QString name() const; | 151 | QString name() const; |
152 | /** | 152 | /** |
153 | Return translated label for name field. | 153 | Return translated label for name field. |
154 | */ | 154 | */ |
155 | static QString nameLabel(); | 155 | static QString nameLabel(); |
156 | 156 | ||
157 | /** | 157 | /** |
158 | Set formatted name. | 158 | Set formatted name. |
159 | */ | 159 | */ |
160 | void setFormattedName( const QString &formattedName ); | 160 | void setFormattedName( const QString &formattedName ); |
161 | /** | 161 | /** |
162 | Return formatted name. | 162 | Return formatted name. |
163 | */ | 163 | */ |
164 | QString formattedName() const; | 164 | QString formattedName() const; |
165 | /** | 165 | /** |
166 | Return translated label for formattedName field. | 166 | Return translated label for formattedName field. |
167 | */ | 167 | */ |
168 | static QString formattedNameLabel(); | 168 | static QString formattedNameLabel(); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | Set family name. | 171 | Set family name. |
172 | */ | 172 | */ |
173 | void setFamilyName( const QString &familyName ); | 173 | void setFamilyName( const QString &familyName ); |
174 | /** | 174 | /** |
175 | Return family name. | 175 | Return family name. |
176 | */ | 176 | */ |
177 | QString familyName() const; | 177 | QString familyName() const; |
178 | /** | 178 | /** |
179 | Return translated label for familyName field. | 179 | Return translated label for familyName field. |
180 | */ | 180 | */ |
181 | static QString familyNameLabel(); | 181 | static QString familyNameLabel(); |
182 | 182 | ||
183 | /** | 183 | /** |
184 | Set given name. | 184 | Set given name. |
185 | */ | 185 | */ |
186 | void setGivenName( const QString &givenName ); | 186 | void setGivenName( const QString &givenName ); |
187 | /** | 187 | /** |
188 | Return given name. | 188 | Return given name. |
189 | */ | 189 | */ |
190 | QString givenName() const; | 190 | QString givenName() const; |
191 | /** | 191 | /** |
192 | Return translated label for givenName field. | 192 | Return translated label for givenName field. |
193 | */ | 193 | */ |
194 | static QString givenNameLabel(); | 194 | static QString givenNameLabel(); |
195 | 195 | ||
196 | /** | 196 | /** |
197 | Set additional names. | 197 | Set additional names. |
198 | */ | 198 | */ |
199 | void setAdditionalName( const QString &additionalName ); | 199 | void setAdditionalName( const QString &additionalName ); |
200 | /** | 200 | /** |
201 | Return additional names. | 201 | Return additional names. |
202 | */ | 202 | */ |
203 | QString additionalName() const; | 203 | QString additionalName() const; |
204 | /** | 204 | /** |
205 | Return translated label for additionalName field. | 205 | Return translated label for additionalName field. |
206 | */ | 206 | */ |
207 | static QString additionalNameLabel(); | 207 | static QString additionalNameLabel(); |
208 | 208 | ||
209 | /** | 209 | /** |
210 | Set honorific prefixes. | 210 | Set honorific prefixes. |
211 | */ | 211 | */ |
212 | void setPrefix( const QString &prefix ); | 212 | void setPrefix( const QString &prefix ); |
213 | /** | 213 | /** |
214 | Return honorific prefixes. | 214 | Return honorific prefixes. |
215 | */ | 215 | */ |
216 | QString prefix() const; | 216 | QString prefix() const; |
217 | /** | 217 | /** |
218 | Return translated label for prefix field. | 218 | Return translated label for prefix field. |
219 | */ | 219 | */ |
220 | static QString prefixLabel(); | 220 | static QString prefixLabel(); |
221 | 221 | ||
222 | /** | 222 | /** |
223 | Set honorific suffixes. | 223 | Set honorific suffixes. |
224 | */ | 224 | */ |
225 | void setSuffix( const QString &suffix ); | 225 | void setSuffix( const QString &suffix ); |
226 | /** | 226 | /** |
227 | Return honorific suffixes. | 227 | Return honorific suffixes. |
228 | */ | 228 | */ |
229 | QString suffix() const; | 229 | QString suffix() const; |
230 | /** | 230 | /** |
231 | Return translated label for suffix field. | 231 | Return translated label for suffix field. |
232 | */ | 232 | */ |
233 | static QString suffixLabel(); | 233 | static QString suffixLabel(); |
234 | 234 | ||
235 | /** | 235 | /** |
236 | Set nick name. | 236 | Set nick name. |
237 | */ | 237 | */ |
238 | void setNickName( const QString &nickName ); | 238 | void setNickName( const QString &nickName ); |
239 | /** | 239 | /** |
240 | Return nick name. | 240 | Return nick name. |
241 | */ | 241 | */ |
242 | QString nickName() const; | 242 | QString nickName() const; |
243 | /** | 243 | /** |
244 | Return translated label for nickName field. | 244 | Return translated label for nickName field. |
245 | */ | 245 | */ |
246 | static QString nickNameLabel(); | 246 | static QString nickNameLabel(); |
247 | 247 | ||
248 | /** | 248 | /** |
249 | Set birthday. | 249 | Set birthday. |
250 | */ | 250 | */ |
251 | void setBirthday( const QDateTime &birthday ); | 251 | void setBirthday( const QDateTime &birthday ); |
252 | /** | 252 | /** |
253 | Return birthday. | 253 | Return birthday. |
254 | */ | 254 | */ |
255 | QDateTime birthday() const; | 255 | QDateTime birthday() const; |
256 | /** | 256 | /** |
257 | Return translated label for birthday field. | 257 | Return translated label for birthday field. |
258 | */ | 258 | */ |
259 | static QString birthdayLabel(); | 259 | static QString birthdayLabel(); |
260 | 260 | ||
261 | /** | 261 | /** |
262 | Return translated label for homeAddressStreet field. | 262 | Return translated label for homeAddressStreet field. |
263 | */ | 263 | */ |
264 | static QString homeAddressStreetLabel(); | 264 | static QString homeAddressStreetLabel(); |
265 | 265 | ||
266 | /** | 266 | /** |
267 | Return translated label for homeAddressLocality field. | 267 | Return translated label for homeAddressLocality field. |
268 | */ | 268 | */ |
269 | static QString homeAddressLocalityLabel(); | 269 | static QString homeAddressLocalityLabel(); |
270 | 270 | ||
271 | /** | 271 | /** |
272 | Return translated label for homeAddressRegion field. | 272 | Return translated label for homeAddressRegion field. |
273 | */ | 273 | */ |
274 | static QString homeAddressRegionLabel(); | 274 | static QString homeAddressRegionLabel(); |
275 | 275 | ||
276 | /** | 276 | /** |
277 | Return translated label for homeAddressPostalCode field. | 277 | Return translated label for homeAddressPostalCode field. |
278 | */ | 278 | */ |
279 | static QString homeAddressPostalCodeLabel(); | 279 | static QString homeAddressPostalCodeLabel(); |
280 | 280 | ||
281 | /** | 281 | /** |
282 | Return translated label for homeAddressCountry field. | 282 | Return translated label for homeAddressCountry field. |
283 | */ | 283 | */ |
284 | static QString homeAddressCountryLabel(); | 284 | static QString homeAddressCountryLabel(); |
285 | 285 | ||
286 | /** | 286 | /** |
287 | Return translated label for homeAddressLabel field. | 287 | Return translated label for homeAddressLabel field. |
288 | */ | 288 | */ |
289 | static QString homeAddressLabelLabel(); | 289 | static QString homeAddressLabelLabel(); |
290 | 290 | ||
291 | /** | 291 | /** |
292 | Return translated label for businessAddressStreet field. | 292 | Return translated label for businessAddressStreet field. |
293 | */ | 293 | */ |
294 | static QString businessAddressStreetLabel(); | 294 | static QString businessAddressStreetLabel(); |
295 | 295 | ||
296 | /** | 296 | /** |
297 | Return translated label for businessAddressLocality field. | 297 | Return translated label for businessAddressLocality field. |
298 | */ | 298 | */ |
299 | static QString businessAddressLocalityLabel(); | 299 | static QString businessAddressLocalityLabel(); |
300 | 300 | ||
301 | /** | 301 | /** |
302 | Return translated label for businessAddressRegion field. | 302 | Return translated label for businessAddressRegion field. |
303 | */ | 303 | */ |
304 | static QString businessAddressRegionLabel(); | 304 | static QString businessAddressRegionLabel(); |
305 | 305 | ||
306 | /** | 306 | /** |
307 | Return translated label for businessAddressPostalCode field. | 307 | Return translated label for businessAddressPostalCode field. |
308 | */ | 308 | */ |
309 | static QString businessAddressPostalCodeLabel(); | 309 | static QString businessAddressPostalCodeLabel(); |
310 | 310 | ||
311 | /** | 311 | /** |
312 | Return translated label for businessAddressCountry field. | 312 | Return translated label for businessAddressCountry field. |
313 | */ | 313 | */ |
314 | static QString businessAddressCountryLabel(); | 314 | static QString businessAddressCountryLabel(); |
315 | 315 | ||
316 | /** | 316 | /** |
317 | Return translated label for businessAddressLabel field. | 317 | Return translated label for businessAddressLabel field. |
318 | */ | 318 | */ |
319 | static QString businessAddressLabelLabel(); | 319 | static QString businessAddressLabelLabel(); |
320 | 320 | ||
321 | /** | 321 | /** |
322 | Return translated label for homePhone field. | 322 | Return translated label for homePhone field. |
323 | */ | 323 | */ |
324 | static QString homePhoneLabel(); | 324 | static QString homePhoneLabel(); |
325 | 325 | ||
326 | /** | 326 | /** |
327 | Return translated label for businessPhone field. | 327 | Return translated label for businessPhone field. |
328 | */ | 328 | */ |
329 | static QString businessPhoneLabel(); | 329 | static QString businessPhoneLabel(); |
330 | 330 | ||
331 | /** | 331 | /** |
332 | Return translated label for mobilePhone field. | 332 | Return translated label for mobilePhone field. |
333 | */ | 333 | */ |
334 | static QString mobilePhoneLabel(); | 334 | static QString mobilePhoneLabel(); |
335 | static QString mobileWorkPhoneLabel(); | 335 | static QString mobileWorkPhoneLabel(); |
336 | 336 | ||
337 | /** | 337 | /** |
338 | Return translated label for homeFax field. | 338 | Return translated label for homeFax field. |
339 | */ | 339 | */ |
340 | static QString homeFaxLabel(); | 340 | static QString homeFaxLabel(); |
341 | 341 | ||
342 | /** | 342 | /** |
343 | Return translated label for businessFax field. | 343 | Return translated label for businessFax field. |
344 | */ | 344 | */ |
345 | static QString businessFaxLabel(); | 345 | static QString businessFaxLabel(); |
346 | 346 | ||
347 | 347 | ||
348 | /** | 348 | /** |
349 | Return translated label for isdn field. | 349 | Return translated label for isdn field. |
350 | */ | 350 | */ |
351 | static QString isdnLabel(); | 351 | static QString isdnLabel(); |
352 | 352 | ||
353 | /** | 353 | /** |
354 | Return translated label for pager field. | 354 | Return translated label for pager field. |
355 | */ | 355 | */ |
356 | static QString pagerLabel(); | 356 | static QString pagerLabel(); |
357 | static QString otherPhoneLabel(); | 357 | static QString otherPhoneLabel(); |
358 | /** | 358 | /** |
359 | Return translated label for sip field. | 359 | Return translated label for sip field. |
360 | */ | 360 | */ |
361 | static QString sipLabel(); | 361 | static QString sipLabel(); |
362 | 362 | ||
363 | /** | 363 | /** |
364 | Return translated label for email field. | 364 | Return translated label for email field. |
365 | */ | 365 | */ |
366 | static QString emailLabel(); | 366 | static QString emailLabel(); |
367 | 367 | ||
368 | /** | 368 | /** |
369 | Set mail client. | 369 | Set mail client. |
370 | */ | 370 | */ |
371 | void setMailer( const QString &mailer ); | 371 | void setMailer( const QString &mailer ); |
372 | /** | 372 | /** |
373 | Return mail client. | 373 | Return mail client. |
374 | */ | 374 | */ |
375 | QString mailer() const; | 375 | QString mailer() const; |
376 | /** | 376 | /** |
377 | Return translated label for mailer field. | 377 | Return translated label for mailer field. |
378 | */ | 378 | */ |
379 | static QString mailerLabel(); | 379 | static QString mailerLabel(); |
380 | 380 | ||
381 | /** | 381 | /** |
382 | Set time zone. | 382 | Set time zone. |
383 | */ | 383 | */ |
384 | void setTimeZone( const TimeZone &timeZone ); | 384 | void setTimeZone( const TimeZone &timeZone ); |
385 | /** | 385 | /** |
386 | Return time zone. | 386 | Return time zone. |
387 | */ | 387 | */ |
388 | TimeZone timeZone() const; | 388 | TimeZone timeZone() const; |
389 | /** | 389 | /** |
390 | Return translated label for timeZone field. | 390 | Return translated label for timeZone field. |
391 | */ | 391 | */ |
392 | static QString timeZoneLabel(); | 392 | static QString timeZoneLabel(); |
393 | 393 | ||
394 | /** | 394 | /** |
395 | Set geographic position. | 395 | Set geographic position. |
396 | */ | 396 | */ |
397 | void setGeo( const Geo &geo ); | 397 | void setGeo( const Geo &geo ); |
398 | /** | 398 | /** |
399 | Return geographic position. | 399 | Return geographic position. |
400 | */ | 400 | */ |
401 | Geo geo() const; | 401 | Geo geo() const; |
402 | /** | 402 | /** |
403 | Return translated label for geo field. | 403 | Return translated label for geo field. |
404 | */ | 404 | */ |
405 | static QString geoLabel(); | 405 | static QString geoLabel(); |
406 | 406 | ||
407 | /** | 407 | /** |
408 | Set title. | 408 | Set title. |
409 | */ | 409 | */ |
410 | void setTitle( const QString &title ); | 410 | void setTitle( const QString &title ); |
411 | /** | 411 | /** |
412 | Return title. | 412 | Return title. |
413 | */ | 413 | */ |
414 | QString title() const; | 414 | QString title() const; |
415 | /** | 415 | /** |
416 | Return translated label for title field. | 416 | Return translated label for title field. |
417 | */ | 417 | */ |
418 | static QString titleLabel(); | 418 | static QString titleLabel(); |
419 | 419 | ||
420 | /** | 420 | /** |
421 | Set role. | 421 | Set role. |
422 | */ | 422 | */ |
423 | void setRole( const QString &role ); | 423 | void setRole( const QString &role ); |
424 | /** | 424 | /** |
425 | Return role. | 425 | Return role. |
426 | */ | 426 | */ |
427 | QString role() const; | 427 | QString role() const; |
428 | /** | 428 | /** |
429 | Return translated label for role field. | 429 | Return translated label for role field. |
430 | */ | 430 | */ |
431 | static QString roleLabel(); | 431 | static QString roleLabel(); |
432 | 432 | ||
433 | /** | 433 | /** |
434 | Set organization. | 434 | Set organization. |
435 | */ | 435 | */ |
436 | void setOrganization( const QString &organization ); | 436 | void setOrganization( const QString &organization ); |
437 | /** | 437 | /** |
438 | Return organization. | 438 | Return organization. |
439 | */ | 439 | */ |
440 | QString organization() const; | 440 | QString organization() const; |
441 | /** | 441 | /** |
442 | Return translated label for organization field. | 442 | Return translated label for organization field. |
443 | */ | 443 | */ |
444 | static QString organizationLabel(); | 444 | static QString organizationLabel(); |
445 | 445 | ||
446 | /** | 446 | /** |
447 | Set note. | 447 | Set note. |
448 | */ | 448 | */ |
449 | void setNote( const QString ¬e ); | 449 | void setNote( const QString ¬e ); |
450 | /** | 450 | /** |
451 | Return note. | 451 | Return note. |
452 | */ | 452 | */ |
453 | QString note() const; | 453 | QString note() const; |
454 | /** | 454 | /** |
455 | Return translated label for note field. | 455 | Return translated label for note field. |
456 | */ | 456 | */ |
457 | static QString noteLabel(); | 457 | static QString noteLabel(); |
458 | 458 | ||
459 | /** | 459 | /** |
460 | Set product identifier. | 460 | Set product identifier. |
461 | */ | 461 | */ |
462 | void setProductId( const QString &productId ); | 462 | void setProductId( const QString &productId ); |
463 | /** | 463 | /** |
464 | Return product identifier. | 464 | Return product identifier. |
465 | */ | 465 | */ |
466 | QString productId() const; | 466 | QString productId() const; |
467 | /** | 467 | /** |
468 | Return translated label for productId field. | 468 | Return translated label for productId field. |
469 | */ | 469 | */ |
470 | static QString productIdLabel(); | 470 | static QString productIdLabel(); |
471 | 471 | ||
472 | /** | 472 | /** |
473 | Set revision date. | 473 | Set revision date. |
474 | */ | 474 | */ |
475 | void setRevision( const QDateTime &revision ); | 475 | void setRevision( const QDateTime &revision ); |
476 | /** | 476 | /** |
477 | Return revision date. | 477 | Return revision date. |
478 | */ | 478 | */ |
479 | QDateTime revision() const; | 479 | QDateTime revision() const; |
480 | /** | 480 | /** |
481 | Return translated label for revision field. | 481 | Return translated label for revision field. |
482 | */ | 482 | */ |
483 | static QString revisionLabel(); | 483 | static QString revisionLabel(); |
484 | 484 | ||
485 | /** | 485 | /** |
486 | Set sort string. | 486 | Set sort string. |
487 | */ | 487 | */ |
488 | void setSortString( const QString &sortString ); | 488 | void setSortString( const QString &sortString ); |
489 | /** | 489 | /** |
490 | Return sort string. | 490 | Return sort string. |
491 | */ | 491 | */ |
492 | QString sortString() const; | 492 | QString sortString() const; |
493 | /** | 493 | /** |
494 | Return translated label for sortString field. | 494 | Return translated label for sortString field. |
495 | */ | 495 | */ |
496 | static QString sortStringLabel(); | 496 | static QString sortStringLabel(); |
497 | 497 | ||
498 | /** | 498 | /** |
499 | Set URL. | 499 | Set URL. |
500 | */ | 500 | */ |
501 | void setUrl( const KURL &url ); | 501 | void setUrl( const KURL &url ); |
502 | /** | 502 | /** |
503 | Return URL. | 503 | Return URL. |
504 | */ | 504 | */ |
505 | KURL url() const; | 505 | KURL url() const; |
506 | /** | 506 | /** |
507 | Return translated label for url field. | 507 | Return translated label for url field. |
508 | */ | 508 | */ |
509 | static QString urlLabel(); | 509 | static QString urlLabel(); |
510 | 510 | ||
511 | /** | 511 | /** |
512 | Set security class. | 512 | Set security class. |
513 | */ | 513 | */ |
514 | void setSecrecy( const Secrecy &secrecy ); | 514 | void setSecrecy( const Secrecy &secrecy ); |
515 | /** | 515 | /** |
516 | Return security class. | 516 | Return security class. |
517 | */ | 517 | */ |
518 | Secrecy secrecy() const; | 518 | Secrecy secrecy() const; |
519 | /** | 519 | /** |
520 | Return translated label for secrecy field. | 520 | Return translated label for secrecy field. |
521 | */ | 521 | */ |
522 | static QString secrecyLabel(); | 522 | static QString secrecyLabel(); |
523 | 523 | ||
524 | /** | 524 | /** |
525 | Set logo. | 525 | Set logo. |
526 | */ | 526 | */ |
527 | void setLogo( const Picture &logo ); | 527 | void setLogo( const Picture &logo ); |
528 | /** | 528 | /** |
529 | Return logo. | 529 | Return logo. |
530 | */ | 530 | */ |
531 | Picture logo() const; | 531 | Picture logo() const; |
532 | /** | 532 | /** |
533 | Return translated label for logo field. | 533 | Return translated label for logo field. |
534 | */ | 534 | */ |
535 | static QString logoLabel(); | 535 | static QString logoLabel(); |
536 | 536 | ||
537 | /** | 537 | /** |
538 | Set photo. | 538 | Set photo. |
539 | */ | 539 | */ |
540 | void setPhoto( const Picture &photo ); | 540 | void setPhoto( const Picture &photo ); |
541 | /** | 541 | /** |
542 | Return photo. | 542 | Return photo. |
543 | */ | 543 | */ |
544 | Picture photo() const; | 544 | Picture photo() const; |
545 | /** | 545 | /** |
546 | Return translated label for photo field. | 546 | Return translated label for photo field. |
547 | */ | 547 | */ |
548 | static QString photoLabel(); | 548 | static QString photoLabel(); |
549 | 549 | ||
550 | /** | 550 | /** |
551 | Set sound. | 551 | Set sound. |
552 | */ | 552 | */ |
553 | void setSound( const Sound &sound ); | 553 | void setSound( const Sound &sound ); |
554 | /** | 554 | /** |
555 | Return sound. | 555 | Return sound. |
556 | */ | 556 | */ |
557 | Sound sound() const; | 557 | Sound sound() const; |
558 | /** | 558 | /** |
559 | Return translated label for sound field. | 559 | Return translated label for sound field. |
560 | */ | 560 | */ |
561 | static QString soundLabel(); | 561 | static QString soundLabel(); |
562 | 562 | ||
563 | /** | 563 | /** |
564 | Set agent. | 564 | Set agent. |
565 | */ | 565 | */ |
566 | void setAgent( const Agent &agent ); | 566 | void setAgent( const Agent &agent ); |
567 | /** | 567 | /** |
568 | Return agent. | 568 | Return agent. |
569 | */ | 569 | */ |
570 | Agent agent() const; | 570 | Agent agent() const; |
571 | /** | 571 | /** |
572 | Return translated label for agent field. | 572 | Return translated label for agent field. |
573 | */ | 573 | */ |
574 | static QString agentLabel(); | 574 | static QString agentLabel(); |
575 | 575 | ||
576 | /** | 576 | /** |
577 | Set name fields by parsing the given string and trying to associate the | 577 | Set name fields by parsing the given string and trying to associate the |
578 | parts of the string with according fields. This function should probably | 578 | parts of the string with according fields. This function should probably |
579 | be a bit more clever. | 579 | be a bit more clever. |
580 | */ | 580 | */ |
581 | void setNameFromString( const QString & ); | 581 | void setNameFromString( const QString & ); |
582 | 582 | ||
583 | /** | 583 | /** |
584 | Return the name of the addressee. This is calculated from all the name | 584 | Return the name of the addressee. This is calculated from all the name |
585 | fields. | 585 | fields. |
586 | */ | 586 | */ |
587 | QString realName() const; | 587 | QString realName() const; |
588 | 588 | ||
589 | /** | 589 | /** |
590 | Return the name that consists of all name parts. | 590 | Return the name that consists of all name parts. |
591 | */ | 591 | */ |
592 | QString assembledName() const; | 592 | QString assembledName() const; |
593 | 593 | ||
594 | /** | 594 | /** |
595 | Return email address including real name. | 595 | Return email address including real name. |
596 | 596 | ||
597 | @param email Email address to be used to construct the full email string. | 597 | @param email Email address to be used to construct the full email string. |
598 | If this is QString::null the preferred email address is used. | 598 | If this is QString::null the preferred email address is used. |
599 | */ | 599 | */ |
diff --git a/kabc/addresseedialog.cpp b/kabc/addresseedialog.cpp index 671787e..bda1b9e 100644 --- a/kabc/addresseedialog.cpp +++ b/kabc/addresseedialog.cpp | |||
@@ -1,351 +1,354 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qlayout.h> | 21 | #include <qlayout.h> |
22 | #include <qpushbutton.h> | 22 | #include <qpushbutton.h> |
23 | #include <qgroupbox.h> | 23 | #include <q3groupbox.h> |
24 | #include <qapplication.h> | 24 | #include <qapplication.h> |
25 | #include <qregexp.h> | 25 | #include <qregexp.h> |
26 | #include <qvbox.h> | 26 | #include <q3vbox.h> |
27 | #include <qlabel.h> | 27 | #include <qlabel.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3ValueList> | ||
30 | #include <Q3VBoxLayout> | ||
28 | 31 | ||
29 | #include <klocale.h> | 32 | #include <klocale.h> |
30 | #include <kdebug.h> | 33 | #include <kdebug.h> |
31 | #include <kglobalsettings.h> | 34 | #include <kglobalsettings.h> |
32 | 35 | ||
33 | #include "stdaddressbook.h" | 36 | #include "stdaddressbook.h" |
34 | 37 | ||
35 | #include "addresseedialog.h" | 38 | #include "addresseedialog.h" |
36 | #include "KDGanttMinimizeSplitter.h" | 39 | #include "KDGanttMinimizeSplitter.h" |
37 | //#include "addresseedialog.moc" | 40 | //#include "addresseedialog.moc" |
38 | 41 | ||
39 | using namespace KABC; | 42 | using namespace KABC; |
40 | 43 | ||
41 | AddresseeItem::AddresseeItem( QListView *parent, const Addressee &addressee ) : | 44 | AddresseeItem::AddresseeItem( Q3ListView *parent, const Addressee &addressee ) : |
42 | QListViewItem( parent ), | 45 | Q3ListViewItem( parent ), |
43 | mAddressee( addressee ) | 46 | mAddressee( addressee ) |
44 | { | 47 | { |
45 | setText( Name,addressee.realName()); | 48 | setText( Name,addressee.realName()); |
46 | setText( Email, addressee.preferredEmail() ); | 49 | setText( Email, addressee.preferredEmail() ); |
47 | setText( Category, addressee.categories().join(";") ); | 50 | setText( Category, addressee.categories().join(";") ); |
48 | } | 51 | } |
49 | 52 | ||
50 | QString AddresseeItem::key( int column, bool ) const | 53 | QString AddresseeItem::key( int column, bool ) const |
51 | { | 54 | { |
52 | 55 | ||
53 | if (column == Email) { | 56 | if (column == Email) { |
54 | QString value = text(Email); | 57 | QString value = text(Email); |
55 | int val = value.findRev("@"); | 58 | int val = value.findRev("@"); |
56 | return value.mid( val) + value.left( val ); | 59 | return value.mid( val) + value.left( val ); |
57 | } | 60 | } |
58 | return text(column).lower(); | 61 | return text(column).lower(); |
59 | } | 62 | } |
60 | 63 | ||
61 | AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : | 64 | AddresseeDialog::AddresseeDialog( QWidget *parent, bool multiple ) : |
62 | KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), | 65 | KDialogBase( KDialogBase::Plain, i18n("Select Addressee"), |
63 | Ok|Cancel, No, parent ), mMultiple( multiple ) | 66 | Ok|Cancel, No, parent ), mMultiple( multiple ) |
64 | { | 67 | { |
65 | qDebug("NEW AddresseeDialog "); | 68 | qDebug("NEW AddresseeDialog "); |
66 | 69 | ||
67 | 70 | ||
68 | KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this ); | 71 | KDGanttMinimizeSplitter* mMiniSplitter = new KDGanttMinimizeSplitter( Qt::Horizontal, this ); |
69 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); | 72 | mMiniSplitter->setMinimizeDirection ( KDGanttMinimizeSplitter::Right ); |
70 | setMainWidget( mMiniSplitter ); | 73 | setMainWidget( mMiniSplitter ); |
71 | 74 | ||
72 | QWidget *listWidget = new QWidget( mMiniSplitter ); | 75 | QWidget *listWidget = new QWidget( mMiniSplitter ); |
73 | 76 | ||
74 | QVBoxLayout *listLayout = new QVBoxLayout (listWidget) ; | 77 | Q3VBoxLayout *listLayout = new Q3VBoxLayout (listWidget) ; |
75 | //topLayout->addLayout( listLayout ); | 78 | //topLayout->addLayout( listLayout ); |
76 | 79 | ||
77 | mAddresseeList = new KListView( listWidget ); | 80 | mAddresseeList = new KListView( listWidget ); |
78 | mAddresseeList->addColumn( i18n("Name") ); | 81 | mAddresseeList->addColumn( i18n("Name") ); |
79 | mAddresseeList->addColumn( i18n("Email") ); | 82 | mAddresseeList->addColumn( i18n("Email") ); |
80 | mAddresseeList->addColumn( i18n("Category") ); | 83 | mAddresseeList->addColumn( i18n("Category") ); |
81 | mAddresseeList->setAllColumnsShowFocus( true ); | 84 | mAddresseeList->setAllColumnsShowFocus( true ); |
82 | mAddresseeList->setFullWidth( true ); | 85 | mAddresseeList->setFullWidth( true ); |
83 | listLayout->addWidget( mAddresseeList ); | 86 | listLayout->addWidget( mAddresseeList ); |
84 | connect( mAddresseeList, SIGNAL( doubleClicked( QListViewItem * ) ), | 87 | connect( mAddresseeList, SIGNAL( doubleClicked( Q3ListViewItem * ) ), |
85 | SLOT( slotOk() ) ); | 88 | SLOT( slotOk() ) ); |
86 | //QHBox* searchBox = new QHBox ( listWidget ); | 89 | //QHBox* searchBox = new QHBox ( listWidget ); |
87 | QHBox * hb = new QHBox ( listWidget ); | 90 | Q3HBox * hb = new Q3HBox ( listWidget ); |
88 | listLayout->addWidget ( hb ); | 91 | listLayout->addWidget ( hb ); |
89 | mAddresseeEdit = new QLineEdit( hb ); | 92 | mAddresseeEdit = new QLineEdit( hb ); |
90 | connect( mAddresseeEdit, SIGNAL( returnPressed() ), | 93 | connect( mAddresseeEdit, SIGNAL( returnPressed() ), |
91 | SLOT( loadAddressBook() ) ); | 94 | SLOT( loadAddressBook() ) ); |
92 | mAddresseeEdit->setFocus(); | 95 | mAddresseeEdit->setFocus(); |
93 | QPushButton *searchButton = new QPushButton( i18n("Search!"), hb ); | 96 | QPushButton *searchButton = new QPushButton( i18n("Search!"), hb ); |
94 | connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) ); | 97 | connect ( searchButton, SIGNAL( clicked() ), SLOT( loadAddressBook() ) ); |
95 | if ( mMultiple ) { | 98 | if ( mMultiple ) { |
96 | 99 | ||
97 | mSelectedList = new KListView( mMiniSplitter ); | 100 | mSelectedList = new KListView( mMiniSplitter ); |
98 | mSelectedList->addColumn( i18n("Selected Name") ); | 101 | mSelectedList->addColumn( i18n("Selected Name") ); |
99 | mSelectedList->addColumn( i18n("Email") ); | 102 | mSelectedList->addColumn( i18n("Email") ); |
100 | mSelectedList->setAllColumnsShowFocus( true ); | 103 | mSelectedList->setAllColumnsShowFocus( true ); |
101 | mSelectedList->setFullWidth( true ); | 104 | mSelectedList->setFullWidth( true ); |
102 | //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), | 105 | //connect( mSelectedList, SIGNAL( doubleClicked( QListViewItem * ) ), |
103 | // SLOT( removeSelected() ) ); | 106 | // SLOT( removeSelected() ) ); |
104 | connect( mSelectedList, SIGNAL( clicked( QListViewItem * ) ), | 107 | connect( mSelectedList, SIGNAL( clicked( Q3ListViewItem * ) ), |
105 | SLOT( removeSelected() ) ); | 108 | SLOT( removeSelected() ) ); |
106 | connect( mSelectedList, SIGNAL( returnPressed( QListViewItem *) ), | 109 | connect( mSelectedList, SIGNAL( returnPressed( Q3ListViewItem *) ), |
107 | SLOT( removeSelected() ) ); | 110 | SLOT( removeSelected() ) ); |
108 | 111 | ||
109 | #if 0 | 112 | #if 0 |
110 | QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); | 113 | QPushButton *unselectButton = new QPushButton( i18n("Unselect"), selectedGroup ); |
111 | connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); | 114 | connect ( unselectButton, SIGNAL( clicked() ), SLOT( removeSelected() ) ); |
112 | 115 | ||
113 | #endif | 116 | #endif |
114 | connect( mAddresseeList, SIGNAL( clicked( QListViewItem * ) ), | 117 | connect( mAddresseeList, SIGNAL( clicked( Q3ListViewItem * ) ), |
115 | SLOT( addSelected( QListViewItem * ) ) ); | 118 | SLOT( addSelected( Q3ListViewItem * ) ) ); |
116 | connect( mAddresseeList, SIGNAL( returnPressed( QListViewItem * ) ), | 119 | connect( mAddresseeList, SIGNAL( returnPressed( Q3ListViewItem * ) ), |
117 | SLOT( selectNextItem( QListViewItem * ) ) ); | 120 | SLOT( selectNextItem( Q3ListViewItem * ) ) ); |
118 | 121 | ||
119 | } | 122 | } |
120 | 123 | ||
121 | mAddressBook = StdAddressBook::self( true ); | 124 | mAddressBook = StdAddressBook::self( true ); |
122 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), | 125 | connect( mAddressBook, SIGNAL( addressBookChanged( AddressBook* ) ), |
123 | SLOT( addressBookChanged() ) ); | 126 | SLOT( addressBookChanged() ) ); |
124 | #if 0 | 127 | #if 0 |
125 | connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), | 128 | connect( mAddressBook, SIGNAL( loadingFinished( Resource* ) ), |
126 | SLOT( addressBookChanged() ) ); | 129 | SLOT( addressBookChanged() ) ); |
127 | #endif | 130 | #endif |
128 | loadAddressBook(); | 131 | loadAddressBook(); |
129 | QValueList<int> splitterSize; | 132 | Q3ValueList<int> splitterSize; |
130 | splitterSize.append( ( width() / 5 ) * 3 ); | 133 | splitterSize.append( ( width() / 5 ) * 3 ); |
131 | splitterSize.append( ( width() / 5 ) *2 ); | 134 | splitterSize.append( ( width() / 5 ) *2 ); |
132 | mMiniSplitter->setSizes( splitterSize ); | 135 | mMiniSplitter->setSizes( splitterSize ); |
133 | } | 136 | } |
134 | 137 | ||
135 | AddresseeDialog::~AddresseeDialog() | 138 | AddresseeDialog::~AddresseeDialog() |
136 | { | 139 | { |
137 | qDebug("DELETE AddresseeDialog "); | 140 | qDebug("DELETE AddresseeDialog "); |
138 | } | 141 | } |
139 | 142 | ||
140 | void AddresseeDialog::loadAddressBook() | 143 | void AddresseeDialog::loadAddressBook() |
141 | { | 144 | { |
142 | mAddresseeList->clear(); | 145 | mAddresseeList->clear(); |
143 | mItemDict.clear(); | 146 | mItemDict.clear(); |
144 | if ( mAddresseeEdit->text().isEmpty() ) { | 147 | if ( mAddresseeEdit->text().isEmpty() ) { |
145 | AddressBook::Iterator it; | 148 | AddressBook::Iterator it; |
146 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 149 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
147 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 150 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
148 | continue; | 151 | continue; |
149 | new AddresseeItem( mAddresseeList, (*it) ); | 152 | new AddresseeItem( mAddresseeList, (*it) ); |
150 | } | 153 | } |
151 | return; | 154 | return; |
152 | } | 155 | } |
153 | //mAddresseeEdit->completionObject()->clear(); | 156 | //mAddresseeEdit->completionObject()->clear(); |
154 | QRegExp re; | 157 | QRegExp re; |
155 | re.setWildcard(true); // most people understand these better. | 158 | re.setWildcard(true); // most people understand these better. |
156 | re.setCaseSensitive(false); | 159 | re.setCaseSensitive(false); |
157 | re.setPattern( "*"+ mAddresseeEdit->text() + "*"); | 160 | re.setPattern( "*"+ mAddresseeEdit->text() + "*"); |
158 | 161 | ||
159 | AddressBook::Iterator it; | 162 | AddressBook::Iterator it; |
160 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 163 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
161 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) | 164 | if ( (*it).uid().left(2) == "la" && (*it).uid().left(19) == QString("last-syncAddressee-") ) |
162 | continue; | 165 | continue; |
163 | QString name = (*it).realName(); | 166 | QString name = (*it).realName(); |
164 | name += (*it).preferredEmail(); | 167 | name += (*it).preferredEmail(); |
165 | name += (*it).categories().join(";"); | 168 | name += (*it).categories().join(";"); |
166 | #if QT_VERSION >= 0x030000 | 169 | #if QT_VERSION >= 0x030000 |
167 | if (re.search(name) != -1) | 170 | if (re.search(name) != -1) |
168 | #else | 171 | #else |
169 | if (re.match(name) != -1) | 172 | if (re.match(name) != -1) |
170 | #endif | 173 | #endif |
171 | AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) ); | 174 | AddresseeItem *item = new AddresseeItem( mAddresseeList, (*it) ); |
172 | } | 175 | } |
173 | } | 176 | } |
174 | 177 | ||
175 | void AddresseeDialog::addCompletionItem( const QString &str, QListViewItem *item ) | 178 | void AddresseeDialog::addCompletionItem( const QString &str, Q3ListViewItem *item ) |
176 | { | 179 | { |
177 | if ( str.isEmpty() ) return; | 180 | if ( str.isEmpty() ) return; |
178 | 181 | ||
179 | mItemDict.insert( str, item ); | 182 | mItemDict.insert( str, item ); |
180 | //mAddresseeEdit->completionObject()->addItem( str ); | 183 | //mAddresseeEdit->completionObject()->addItem( str ); |
181 | } | 184 | } |
182 | 185 | ||
183 | void AddresseeDialog::selectItem( const QString &str ) | 186 | void AddresseeDialog::selectItem( const QString &str ) |
184 | { | 187 | { |
185 | if ( str.isEmpty() ) return; | 188 | if ( str.isEmpty() ) return; |
186 | 189 | ||
187 | QListViewItem *item = mItemDict.find( str ); | 190 | Q3ListViewItem *item = mItemDict.find( str ); |
188 | if ( item ) { | 191 | if ( item ) { |
189 | mAddresseeList->blockSignals( true ); | 192 | mAddresseeList->blockSignals( true ); |
190 | mAddresseeList->setSelected( item, true ); | 193 | mAddresseeList->setSelected( item, true ); |
191 | mAddresseeList->ensureItemVisible( item ); | 194 | mAddresseeList->ensureItemVisible( item ); |
192 | mAddresseeList->blockSignals( false ); | 195 | mAddresseeList->blockSignals( false ); |
193 | } | 196 | } |
194 | } | 197 | } |
195 | 198 | ||
196 | void AddresseeDialog::updateEdit( QListViewItem *item ) | 199 | void AddresseeDialog::updateEdit( Q3ListViewItem *item ) |
197 | { | 200 | { |
198 | mAddresseeEdit->setText( item->text( 0 ) ); | 201 | mAddresseeEdit->setText( item->text( 0 ) ); |
199 | mAddresseeEdit->setSelection( 0, item->text( 0 ).length() ); | 202 | mAddresseeEdit->setSelection( 0, item->text( 0 ).length() ); |
200 | } | 203 | } |
201 | 204 | ||
202 | void AddresseeDialog::selectNextItem( QListViewItem *item ) | 205 | void AddresseeDialog::selectNextItem( Q3ListViewItem *item ) |
203 | { | 206 | { |
204 | addSelected( item ); | 207 | addSelected( item ); |
205 | QListViewItem *next = item->nextSibling(); | 208 | Q3ListViewItem *next = item->nextSibling(); |
206 | if ( next ) { | 209 | if ( next ) { |
207 | next->setSelected( true ); | 210 | next->setSelected( true ); |
208 | item->setSelected( false ); | 211 | item->setSelected( false ); |
209 | mAddresseeList->setCurrentItem( next ); | 212 | mAddresseeList->setCurrentItem( next ); |
210 | } | 213 | } |
211 | } | 214 | } |
212 | void AddresseeDialog::addSelected( QListViewItem *item ) | 215 | void AddresseeDialog::addSelected( Q3ListViewItem *item ) |
213 | { | 216 | { |
214 | AddresseeItem *addrItem = (AddresseeItem *)( item ); | 217 | AddresseeItem *addrItem = (AddresseeItem *)( item ); |
215 | if ( !addrItem ) return; | 218 | if ( !addrItem ) return; |
216 | 219 | ||
217 | Addressee a = addrItem->addressee(); | 220 | Addressee a = addrItem->addressee(); |
218 | 221 | ||
219 | QListViewItem *selectedItem = mSelectedDict.find( a.uid() ); | 222 | Q3ListViewItem *selectedItem = mSelectedDict.find( a.uid() ); |
220 | if ( !selectedItem ) { | 223 | if ( !selectedItem ) { |
221 | selectedItem = new AddresseeItem( mSelectedList, a ); | 224 | selectedItem = new AddresseeItem( mSelectedList, a ); |
222 | mSelectedDict.insert( a.uid(), selectedItem ); | 225 | mSelectedDict.insert( a.uid(), selectedItem ); |
223 | } | 226 | } |
224 | 227 | ||
225 | } | 228 | } |
226 | 229 | ||
227 | void AddresseeDialog::removeSelected() | 230 | void AddresseeDialog::removeSelected() |
228 | { | 231 | { |
229 | QListViewItem *item = mSelectedList->selectedItem(); | 232 | Q3ListViewItem *item = mSelectedList->selectedItem(); |
230 | AddresseeItem *addrItem = (AddresseeItem *)( item ); | 233 | AddresseeItem *addrItem = (AddresseeItem *)( item ); |
231 | if ( !addrItem ) return; | 234 | if ( !addrItem ) return; |
232 | QListViewItem *next = item->nextSibling(); | 235 | Q3ListViewItem *next = item->nextSibling(); |
233 | mSelectedDict.remove( addrItem->addressee().uid() ); | 236 | mSelectedDict.remove( addrItem->addressee().uid() ); |
234 | delete addrItem; | 237 | delete addrItem; |
235 | if ( next ) | 238 | if ( next ) |
236 | next->setSelected( true ); | 239 | next->setSelected( true ); |
237 | } | 240 | } |
238 | 241 | ||
239 | Addressee AddresseeDialog::addressee() | 242 | Addressee AddresseeDialog::addressee() |
240 | { | 243 | { |
241 | AddresseeItem *aItem = 0; | 244 | AddresseeItem *aItem = 0; |
242 | 245 | ||
243 | if ( mMultiple ) | 246 | if ( mMultiple ) |
244 | aItem = (AddresseeItem *)( mSelectedList->firstChild() ); | 247 | aItem = (AddresseeItem *)( mSelectedList->firstChild() ); |
245 | else | 248 | else |
246 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); | 249 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); |
247 | 250 | ||
248 | if (aItem) return aItem->addressee(); | 251 | if (aItem) return aItem->addressee(); |
249 | return Addressee(); | 252 | return Addressee(); |
250 | } | 253 | } |
251 | 254 | ||
252 | Addressee::List AddresseeDialog::addressees() | 255 | Addressee::List AddresseeDialog::addressees() |
253 | { | 256 | { |
254 | Addressee::List al; | 257 | Addressee::List al; |
255 | AddresseeItem *aItem = 0; | 258 | AddresseeItem *aItem = 0; |
256 | 259 | ||
257 | if ( mMultiple ) { | 260 | if ( mMultiple ) { |
258 | QListViewItem *item = mSelectedList->firstChild(); | 261 | Q3ListViewItem *item = mSelectedList->firstChild(); |
259 | while( item ) { | 262 | while( item ) { |
260 | aItem = (AddresseeItem *)( item ); | 263 | aItem = (AddresseeItem *)( item ); |
261 | if ( aItem ) al.append( aItem->addressee() ); | 264 | if ( aItem ) al.append( aItem->addressee() ); |
262 | item = item->nextSibling(); | 265 | item = item->nextSibling(); |
263 | } | 266 | } |
264 | } | 267 | } |
265 | else | 268 | else |
266 | { | 269 | { |
267 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); | 270 | aItem = (AddresseeItem *)( mAddresseeList->selectedItem() ); |
268 | if (aItem) al.append( aItem->addressee() ); | 271 | if (aItem) al.append( aItem->addressee() ); |
269 | } | 272 | } |
270 | 273 | ||
271 | return al; | 274 | return al; |
272 | } | 275 | } |
273 | 276 | ||
274 | Addressee AddresseeDialog::getAddressee( QWidget *parent ) | 277 | Addressee AddresseeDialog::getAddressee( QWidget *parent ) |
275 | { | 278 | { |
276 | AddresseeDialog *dlg = new AddresseeDialog( parent ); | 279 | AddresseeDialog *dlg = new AddresseeDialog( parent ); |
277 | Addressee addressee; | 280 | Addressee addressee; |
278 | #ifdef DESKTOP_VERSION | 281 | #ifdef DESKTOP_VERSION |
279 | static int geoX = 0; | 282 | static int geoX = 0; |
280 | static int geoY = 0; | 283 | static int geoY = 0; |
281 | static int geoW = 0; | 284 | static int geoW = 0; |
282 | static int geoH = 0; | 285 | static int geoH = 0; |
283 | if ( !geoX && ! geoY && !geoW &&!geoH ) { | 286 | if ( !geoX && ! geoY && !geoW &&!geoH ) { |
284 | geoX = dlg->geometry().x(); | 287 | geoX = dlg->geometry().x(); |
285 | geoY = dlg->geometry().y(); | 288 | geoY = dlg->geometry().y(); |
286 | geoW = dlg->width(); | 289 | geoW = dlg->width(); |
287 | geoH = dlg->height(); | 290 | geoH = dlg->height(); |
288 | } else { | 291 | } else { |
289 | dlg->show(); | 292 | dlg->show(); |
290 | dlg->setGeometry(geoX , geoY,geoW , geoH ); | 293 | dlg->setGeometry(geoX , geoY,geoW , geoH ); |
291 | 294 | ||
292 | } | 295 | } |
293 | #endif | 296 | #endif |
294 | int result = dlg->exec(); | 297 | int result = dlg->exec(); |
295 | #ifdef DESKTOP_VERSION | 298 | #ifdef DESKTOP_VERSION |
296 | geoX = dlg->geometry().x(); | 299 | geoX = dlg->geometry().x(); |
297 | geoY = dlg->geometry().y(); | 300 | geoY = dlg->geometry().y(); |
298 | geoW = dlg->width(); | 301 | geoW = dlg->width(); |
299 | geoH = dlg->height(); | 302 | geoH = dlg->height(); |
300 | #endif | 303 | #endif |
301 | if ( result == QDialog::Accepted ) { | 304 | if ( result == QDialog::Accepted ) { |
302 | addressee = dlg->addressee(); | 305 | addressee = dlg->addressee(); |
303 | } | 306 | } |
304 | 307 | ||
305 | delete dlg; | 308 | delete dlg; |
306 | return addressee; | 309 | return addressee; |
307 | } | 310 | } |
308 | 311 | ||
309 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) | 312 | Addressee::List AddresseeDialog::getAddressees( QWidget *parent ) |
310 | { | 313 | { |
311 | Addressee::List addressees; | 314 | Addressee::List addressees; |
312 | static bool running = false; | 315 | static bool running = false; |
313 | if ( running ) return addressees; | 316 | if ( running ) return addressees; |
314 | running = true; | 317 | running = true; |
315 | AddresseeDialog *dlg = new AddresseeDialog( parent, true ); | 318 | AddresseeDialog *dlg = new AddresseeDialog( parent, true ); |
316 | #ifdef DESKTOP_VERSION | 319 | #ifdef DESKTOP_VERSION |
317 | static int geoX = 0; | 320 | static int geoX = 0; |
318 | static int geoY = 0; | 321 | static int geoY = 0; |
319 | static int geoW = 0; | 322 | static int geoW = 0; |
320 | static int geoH = 0; | 323 | static int geoH = 0; |
321 | if ( !geoX && ! geoY && !geoW &&!geoH ) { | 324 | if ( !geoX && ! geoY && !geoW &&!geoH ) { |
322 | geoX = dlg->geometry().x(); | 325 | geoX = dlg->geometry().x(); |
323 | geoY = dlg->geometry().y(); | 326 | geoY = dlg->geometry().y(); |
324 | geoW = dlg->width(); | 327 | geoW = dlg->width(); |
325 | geoH = dlg->height(); | 328 | geoH = dlg->height(); |
326 | } | 329 | } |
327 | dlg->show(); | 330 | dlg->show(); |
328 | dlg->setGeometry(geoX , geoY,geoW , geoH ); | 331 | dlg->setGeometry(geoX , geoY,geoW , geoH ); |
329 | #else | 332 | #else |
330 | dlg->showMaximized(); | 333 | dlg->showMaximized(); |
331 | #endif | 334 | #endif |
332 | int result = dlg->exec(); | 335 | int result = dlg->exec(); |
333 | #ifdef DESKTOP_VERSION | 336 | #ifdef DESKTOP_VERSION |
334 | geoX = dlg->geometry().x(); | 337 | geoX = dlg->geometry().x(); |
335 | geoY = dlg->geometry().y(); | 338 | geoY = dlg->geometry().y(); |
336 | geoW = dlg->width(); | 339 | geoW = dlg->width(); |
337 | geoH = dlg->height(); | 340 | geoH = dlg->height(); |
338 | #endif | 341 | #endif |
339 | if ( result == QDialog::Accepted ) { | 342 | if ( result == QDialog::Accepted ) { |
340 | addressees = dlg->addressees(); | 343 | addressees = dlg->addressees(); |
341 | } | 344 | } |
342 | 345 | ||
343 | delete dlg; | 346 | delete dlg; |
344 | running = false; | 347 | running = false; |
345 | return addressees; | 348 | return addressees; |
346 | } | 349 | } |
347 | 350 | ||
348 | void AddresseeDialog::addressBookChanged() | 351 | void AddresseeDialog::addressBookChanged() |
349 | { | 352 | { |
350 | loadAddressBook(); | 353 | loadAddressBook(); |
351 | } | 354 | } |
diff --git a/kabc/addresseedialog.h b/kabc/addresseedialog.h index 6fab62d..be7bbb4 100644 --- a/kabc/addresseedialog.h +++ b/kabc/addresseedialog.h | |||
@@ -1,161 +1,161 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef KABC_ADDRESSEEDIALOG_H | 21 | #ifndef KABC_ADDRESSEEDIALOG_H |
22 | #define KABC_ADDRESSEEDIALOG_H | 22 | #define KABC_ADDRESSEEDIALOG_H |
23 | 23 | ||
24 | #include <qdict.h> | 24 | #include <q3dict.h> |
25 | 25 | ||
26 | #include <kdialogbase.h> | 26 | #include <kdialogbase.h> |
27 | #include <klineedit.h> | 27 | #include <klineedit.h> |
28 | #include <klistview.h> | 28 | #include <klistview.h> |
29 | 29 | ||
30 | #include "addressbook.h" | 30 | #include "addressbook.h" |
31 | 31 | ||
32 | namespace KABC { | 32 | namespace KABC { |
33 | 33 | ||
34 | /** | 34 | /** |
35 | @short Special ListViewItem, that is used by the AddresseeDialog. | 35 | @short Special ListViewItem, that is used by the AddresseeDialog. |
36 | */ | 36 | */ |
37 | class AddresseeItem : public QListViewItem | 37 | class AddresseeItem : public Q3ListViewItem |
38 | { | 38 | { |
39 | public: | 39 | public: |
40 | 40 | ||
41 | /** | 41 | /** |
42 | Type of column | 42 | Type of column |
43 | @li @p Name - Name in Addressee | 43 | @li @p Name - Name in Addressee |
44 | @li @p Email - Email in Addressee | 44 | @li @p Email - Email in Addressee |
45 | */ | 45 | */ |
46 | enum columns { Name = 0, Email = 1,Category = 2 }; | 46 | enum columns { Name = 0, Email = 1,Category = 2 }; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | Constructor. | 49 | Constructor. |
50 | 50 | ||
51 | @param parent The parent listview. | 51 | @param parent The parent listview. |
52 | @param addressee The associated addressee. | 52 | @param addressee The associated addressee. |
53 | */ | 53 | */ |
54 | AddresseeItem( QListView *parent, const Addressee &addressee ); | 54 | AddresseeItem( Q3ListView *parent, const Addressee &addressee ); |
55 | 55 | ||
56 | /** | 56 | /** |
57 | Returns the addressee. | 57 | Returns the addressee. |
58 | */ | 58 | */ |
59 | Addressee addressee() const { return mAddressee; } | 59 | Addressee addressee() const { return mAddressee; } |
60 | 60 | ||
61 | /** | 61 | /** |
62 | Method used by QListView to sort the items. | 62 | Method used by QListView to sort the items. |
63 | */ | 63 | */ |
64 | virtual QString key( int column, bool ascending ) const; | 64 | virtual QString key( int column, bool ascending ) const; |
65 | 65 | ||
66 | private: | 66 | private: |
67 | Addressee mAddressee; | 67 | Addressee mAddressee; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | /** | 70 | /** |
71 | @short Dialog for selecting address book entries. | 71 | @short Dialog for selecting address book entries. |
72 | 72 | ||
73 | This class provides a dialog for selecting entries from the standard KDE | 73 | This class provides a dialog for selecting entries from the standard KDE |
74 | address book. Use the getAddressee() function to open a modal dialog, | 74 | address book. Use the getAddressee() function to open a modal dialog, |
75 | returning an address book entry. | 75 | returning an address book entry. |
76 | 76 | ||
77 | In the dialog you can select an entry from the list with the mouse or type in | 77 | In the dialog you can select an entry from the list with the mouse or type in |
78 | the first letters of the name or email address you are searching for. The | 78 | the first letters of the name or email address you are searching for. The |
79 | entry matching best is automatically selected. Use double click, pressing | 79 | entry matching best is automatically selected. Use double click, pressing |
80 | return or pressing the ok button to return the selected addressee to the | 80 | return or pressing the ok button to return the selected addressee to the |
81 | application. | 81 | application. |
82 | */ | 82 | */ |
83 | class AddresseeDialog : public KDialogBase | 83 | class AddresseeDialog : public KDialogBase |
84 | { | 84 | { |
85 | Q_OBJECT | 85 | Q_OBJECT |
86 | 86 | ||
87 | public: | 87 | public: |
88 | /** | 88 | /** |
89 | Construct addressbook entry select dialog. | 89 | Construct addressbook entry select dialog. |
90 | 90 | ||
91 | @param parent parent widget | 91 | @param parent parent widget |
92 | */ | 92 | */ |
93 | AddresseeDialog( QWidget *parent=0, bool multiple=false ); | 93 | AddresseeDialog( QWidget *parent=0, bool multiple=false ); |
94 | 94 | ||
95 | /** | 95 | /** |
96 | Destructor. | 96 | Destructor. |
97 | */ | 97 | */ |
98 | virtual ~AddresseeDialog(); | 98 | virtual ~AddresseeDialog(); |
99 | 99 | ||
100 | /** | 100 | /** |
101 | Return the address chosen. | 101 | Return the address chosen. |
102 | 102 | ||
103 | If it is a multiple select, this will return only the first address chosen | 103 | If it is a multiple select, this will return only the first address chosen |
104 | */ | 104 | */ |
105 | Addressee addressee(); | 105 | Addressee addressee(); |
106 | 106 | ||
107 | /** | 107 | /** |
108 | Return the list of addresses chosen | 108 | Return the list of addresses chosen |
109 | */ | 109 | */ |
110 | Addressee::List addressees(); | 110 | Addressee::List addressees(); |
111 | 111 | ||
112 | /** | 112 | /** |
113 | Select a single address book entry. | 113 | Select a single address book entry. |
114 | 114 | ||
115 | Open addressee select dialog and return the entry selected by the user. | 115 | Open addressee select dialog and return the entry selected by the user. |
116 | If the user doesn't select an entry or presses cancel, the returned | 116 | If the user doesn't select an entry or presses cancel, the returned |
117 | addressee is empty. | 117 | addressee is empty. |
118 | */ | 118 | */ |
119 | static Addressee getAddressee( QWidget *parent ); | 119 | static Addressee getAddressee( QWidget *parent ); |
120 | 120 | ||
121 | /** | 121 | /** |
122 | Select multiple address book entries. | 122 | Select multiple address book entries. |
123 | 123 | ||
124 | Open addressee select dialog and return the entries selected by the user. | 124 | Open addressee select dialog and return the entries selected by the user. |
125 | If the user doesn't select an entry or presses cancel, the returned | 125 | If the user doesn't select an entry or presses cancel, the returned |
126 | addressee list is empty. | 126 | addressee list is empty. |
127 | */ | 127 | */ |
128 | static Addressee::List getAddressees( QWidget *parent ); | 128 | static Addressee::List getAddressees( QWidget *parent ); |
129 | 129 | ||
130 | private slots: | 130 | private slots: |
131 | void selectItem( const QString & ); | 131 | void selectItem( const QString & ); |
132 | void selectNextItem( QListViewItem *item ); | 132 | void selectNextItem( Q3ListViewItem *item ); |
133 | void updateEdit( QListViewItem *item ); | 133 | void updateEdit( Q3ListViewItem *item ); |
134 | void addSelected( QListViewItem *item ); | 134 | void addSelected( Q3ListViewItem *item ); |
135 | void removeSelected(); | 135 | void removeSelected(); |
136 | void loadAddressBook(); | 136 | void loadAddressBook(); |
137 | 137 | ||
138 | protected slots: | 138 | protected slots: |
139 | void addressBookChanged(); | 139 | void addressBookChanged(); |
140 | 140 | ||
141 | private: | 141 | private: |
142 | void addCompletionItem( const QString &str, QListViewItem *item ); | 142 | void addCompletionItem( const QString &str, Q3ListViewItem *item ); |
143 | 143 | ||
144 | bool mMultiple; | 144 | bool mMultiple; |
145 | 145 | ||
146 | KListView *mAddresseeList; | 146 | KListView *mAddresseeList; |
147 | QLineEdit *mAddresseeEdit; | 147 | QLineEdit *mAddresseeEdit; |
148 | 148 | ||
149 | KListView *mSelectedList; | 149 | KListView *mSelectedList; |
150 | 150 | ||
151 | AddressBook *mAddressBook; | 151 | AddressBook *mAddressBook; |
152 | 152 | ||
153 | QDict<QListViewItem> mItemDict; | 153 | Q3Dict<Q3ListViewItem> mItemDict; |
154 | QDict<QListViewItem> mSelectedDict; | 154 | Q3Dict<Q3ListViewItem> mSelectedDict; |
155 | 155 | ||
156 | class AddresseeDialogPrivate; | 156 | class AddresseeDialogPrivate; |
157 | AddresseeDialogPrivate *d; | 157 | AddresseeDialogPrivate *d; |
158 | }; | 158 | }; |
159 | 159 | ||
160 | } | 160 | } |
161 | #endif | 161 | #endif |
diff --git a/kabc/addresseelist.cpp b/kabc/addresseelist.cpp index 097e162..e1ba1ce 100644 --- a/kabc/addresseelist.cpp +++ b/kabc/addresseelist.cpp | |||
@@ -1,292 +1,294 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Jost Schenck <jost@schenck.de> | 3 | Copyright (c) 2002 Jost Schenck <jost@schenck.de> |
4 | 2003 Tobias Koenig <tokoe@kde.org> | 4 | 2003 Tobias Koenig <tokoe@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 <kdebug.h> | 29 | #include <kdebug.h> |
30 | //US | 30 | //US |
31 | #include <qtl.h> | 31 | #include <q3tl.h> |
32 | //Added by qt3to4: | ||
33 | #include <Q3ValueList> | ||
32 | 34 | ||
33 | 35 | ||
34 | #include "addresseelist.h" | 36 | #include "addresseelist.h" |
35 | #include "field.h" | 37 | #include "field.h" |
36 | 38 | ||
37 | using namespace KABC; | 39 | using namespace KABC; |
38 | 40 | ||
39 | // | 41 | // |
40 | // | 42 | // |
41 | // Traits | 43 | // Traits |
42 | // | 44 | // |
43 | // | 45 | // |
44 | 46 | ||
45 | bool SortingTraits::Uid::eq( const Addressee &a1, const Addressee &a2 ) | 47 | bool SortingTraits::Uid::eq( const Addressee &a1, const Addressee &a2 ) |
46 | { | 48 | { |
47 | // locale awareness doesn't make sense sorting ids | 49 | // locale awareness doesn't make sense sorting ids |
48 | return ( QString::compare( a1.uid(), a2.uid() ) == 0 ); | 50 | return ( QString::compare( a1.uid(), a2.uid() ) == 0 ); |
49 | } | 51 | } |
50 | 52 | ||
51 | bool SortingTraits::Uid::lt( const Addressee &a1, const Addressee &a2 ) | 53 | bool SortingTraits::Uid::lt( const Addressee &a1, const Addressee &a2 ) |
52 | { | 54 | { |
53 | // locale awareness doesn't make sense sorting ids | 55 | // locale awareness doesn't make sense sorting ids |
54 | return ( QString::compare( a1.uid(), a2.uid() ) < 0 ); | 56 | return ( QString::compare( a1.uid(), a2.uid() ) < 0 ); |
55 | } | 57 | } |
56 | 58 | ||
57 | bool SortingTraits::Name::eq( const Addressee &a1, const Addressee &a2 ) | 59 | bool SortingTraits::Name::eq( const Addressee &a1, const Addressee &a2 ) |
58 | { | 60 | { |
59 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare | 61 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare |
60 | return ( QString::compare( a1.name(), a2.name() ) == 0 ); | 62 | return ( QString::compare( a1.name(), a2.name() ) == 0 ); |
61 | } | 63 | } |
62 | 64 | ||
63 | bool SortingTraits::Name::lt( const Addressee &a1, const Addressee &a2 ) | 65 | bool SortingTraits::Name::lt( const Addressee &a1, const Addressee &a2 ) |
64 | { | 66 | { |
65 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare | 67 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare |
66 | return ( QString::compare( a1.name(), a2.name() ) < 0 ); | 68 | return ( QString::compare( a1.name(), a2.name() ) < 0 ); |
67 | } | 69 | } |
68 | 70 | ||
69 | bool SortingTraits::FormattedName::eq( const Addressee &a1, const Addressee &a2 ) | 71 | bool SortingTraits::FormattedName::eq( const Addressee &a1, const Addressee &a2 ) |
70 | { | 72 | { |
71 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare | 73 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare |
72 | return ( QString::compare( a1.formattedName(), a2.formattedName() ) == 0 ); | 74 | return ( QString::compare( a1.formattedName(), a2.formattedName() ) == 0 ); |
73 | } | 75 | } |
74 | 76 | ||
75 | bool SortingTraits::FormattedName::lt( const Addressee &a1, const Addressee &a2 ) | 77 | bool SortingTraits::FormattedName::lt( const Addressee &a1, const Addressee &a2 ) |
76 | { | 78 | { |
77 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare | 79 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare |
78 | return ( QString::compare( a1.formattedName(), a2.formattedName() ) < 0 ); | 80 | return ( QString::compare( a1.formattedName(), a2.formattedName() ) < 0 ); |
79 | } | 81 | } |
80 | 82 | ||
81 | bool SortingTraits::FamilyName::eq( const Addressee &a1, const Addressee &a2 ) | 83 | bool SortingTraits::FamilyName::eq( const Addressee &a1, const Addressee &a2 ) |
82 | { | 84 | { |
83 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare | 85 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare |
84 | return ( QString::compare( a1.familyName(), a2.familyName() ) == 0 | 86 | return ( QString::compare( a1.familyName(), a2.familyName() ) == 0 |
85 | && QString::compare( a1.givenName(), a2.givenName() ) == 0 ); | 87 | && QString::compare( a1.givenName(), a2.givenName() ) == 0 ); |
86 | } | 88 | } |
87 | 89 | ||
88 | bool SortingTraits::FamilyName::lt( const Addressee &a1, const Addressee &a2 ) | 90 | bool SortingTraits::FamilyName::lt( const Addressee &a1, const Addressee &a2 ) |
89 | { | 91 | { |
90 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare | 92 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare |
91 | int family = QString::compare( a1.familyName(), a2.familyName() ); | 93 | int family = QString::compare( a1.familyName(), a2.familyName() ); |
92 | if ( 0 == family ) { | 94 | if ( 0 == family ) { |
93 | return ( QString::compare( a1.givenName(), a2.givenName() ) < 0 ); | 95 | return ( QString::compare( a1.givenName(), a2.givenName() ) < 0 ); |
94 | } else { | 96 | } else { |
95 | return family < 0; | 97 | return family < 0; |
96 | } | 98 | } |
97 | } | 99 | } |
98 | 100 | ||
99 | bool SortingTraits::GivenName::eq( const Addressee &a1, const Addressee &a2 ) | 101 | bool SortingTraits::GivenName::eq( const Addressee &a1, const Addressee &a2 ) |
100 | { | 102 | { |
101 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare | 103 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare |
102 | return ( QString::compare( a1.givenName(), a2.givenName() ) == 0 | 104 | return ( QString::compare( a1.givenName(), a2.givenName() ) == 0 |
103 | && QString::compare( a1.familyName(), a2.familyName() ) == 0 ); | 105 | && QString::compare( a1.familyName(), a2.familyName() ) == 0 ); |
104 | } | 106 | } |
105 | 107 | ||
106 | bool SortingTraits::GivenName::lt( const Addressee &a1, const Addressee &a2 ) | 108 | bool SortingTraits::GivenName::lt( const Addressee &a1, const Addressee &a2 ) |
107 | { | 109 | { |
108 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare | 110 | //US QString::localeAwareCompare is not available in my distribution. Redefine it to compare |
109 | int given = QString::compare( a1.givenName(), a2.givenName() ); | 111 | int given = QString::compare( a1.givenName(), a2.givenName() ); |
110 | if ( 0 == given ) { | 112 | if ( 0 == given ) { |
111 | return ( QString::compare( a1.familyName(), a2.familyName() ) < 0 ); | 113 | return ( QString::compare( a1.familyName(), a2.familyName() ) < 0 ); |
112 | } else { | 114 | } else { |
113 | return given < 0; | 115 | return given < 0; |
114 | } | 116 | } |
115 | } | 117 | } |
116 | 118 | ||
117 | // | 119 | // |
118 | // | 120 | // |
119 | // AddresseeList | 121 | // AddresseeList |
120 | // | 122 | // |
121 | // | 123 | // |
122 | 124 | ||
123 | AddresseeList::AddresseeList() | 125 | AddresseeList::AddresseeList() |
124 | : QValueList<Addressee>() | 126 | : Q3ValueList<Addressee>() |
125 | { | 127 | { |
126 | mReverseSorting = false; | 128 | mReverseSorting = false; |
127 | mActiveSortingCriterion = FormattedName; | 129 | mActiveSortingCriterion = FormattedName; |
128 | mActiveSortingField = 0; | 130 | mActiveSortingField = 0; |
129 | } | 131 | } |
130 | 132 | ||
131 | AddresseeList::~AddresseeList() | 133 | AddresseeList::~AddresseeList() |
132 | { | 134 | { |
133 | } | 135 | } |
134 | 136 | ||
135 | AddresseeList::AddresseeList( const AddresseeList &l ) | 137 | AddresseeList::AddresseeList( const AddresseeList &l ) |
136 | : QValueList<Addressee>( l ) | 138 | : Q3ValueList<Addressee>( l ) |
137 | { | 139 | { |
138 | mReverseSorting = l.reverseSorting(); | 140 | mReverseSorting = l.reverseSorting(); |
139 | mActiveSortingCriterion = l.sortingCriterion(); | 141 | mActiveSortingCriterion = l.sortingCriterion(); |
140 | } | 142 | } |
141 | 143 | ||
142 | AddresseeList::AddresseeList( const QValueList<Addressee> &l ) | 144 | AddresseeList::AddresseeList( const Q3ValueList<Addressee> &l ) |
143 | : QValueList<Addressee>( l ) | 145 | : Q3ValueList<Addressee>( l ) |
144 | { | 146 | { |
145 | mReverseSorting = false; | 147 | mReverseSorting = false; |
146 | } | 148 | } |
147 | 149 | ||
148 | void AddresseeList::dump() const | 150 | void AddresseeList::dump() const |
149 | { | 151 | { |
150 | kdDebug(5700) << "AddresseeList {" << endl; | 152 | kdDebug(5700) << "AddresseeList {" << endl; |
151 | kdDebug(5700) << "reverse order: " << ( mReverseSorting ? "true" : "false" ) << endl; | 153 | kdDebug(5700) << "reverse order: " << ( mReverseSorting ? "true" : "false" ) << endl; |
152 | 154 | ||
153 | QString crit; | 155 | QString crit; |
154 | if ( Uid == mActiveSortingCriterion ) { | 156 | if ( Uid == mActiveSortingCriterion ) { |
155 | crit = "Uid"; | 157 | crit = "Uid"; |
156 | } else if ( Name == mActiveSortingCriterion ) { | 158 | } else if ( Name == mActiveSortingCriterion ) { |
157 | crit = "Name"; | 159 | crit = "Name"; |
158 | } else if ( FormattedName == mActiveSortingCriterion ) { | 160 | } else if ( FormattedName == mActiveSortingCriterion ) { |
159 | crit = "FormattedName"; | 161 | crit = "FormattedName"; |
160 | } else if ( FamilyName == mActiveSortingCriterion ) { | 162 | } else if ( FamilyName == mActiveSortingCriterion ) { |
161 | crit = "FamilyName"; | 163 | crit = "FamilyName"; |
162 | } else if ( GivenName == mActiveSortingCriterion ) { | 164 | } else if ( GivenName == mActiveSortingCriterion ) { |
163 | crit = "GivenName"; | 165 | crit = "GivenName"; |
164 | } else { | 166 | } else { |
165 | crit = "unknown -- update dump method"; | 167 | crit = "unknown -- update dump method"; |
166 | } | 168 | } |
167 | 169 | ||
168 | kdDebug(5700) << "sorting criterion: " << crit << endl; | 170 | kdDebug(5700) << "sorting criterion: " << crit << endl; |
169 | 171 | ||
170 | //US | 172 | //US |
171 | //US for ( const_iterator it = begin(); it != end(); ++it ) | 173 | //US for ( const_iterator it = begin(); it != end(); ++it ) |
172 | for ( ConstIterator it = begin(); it != end(); ++it ) | 174 | for ( ConstIterator it = begin(); it != end(); ++it ) |
173 | (*it).dump(); | 175 | (*it).dump(); |
174 | 176 | ||
175 | kdDebug(5700) << "}" << endl; | 177 | kdDebug(5700) << "}" << endl; |
176 | } | 178 | } |
177 | 179 | ||
178 | void AddresseeList::sortBy( SortingCriterion c ) | 180 | void AddresseeList::sortBy( SortingCriterion c ) |
179 | { | 181 | { |
180 | mActiveSortingCriterion = c; | 182 | mActiveSortingCriterion = c; |
181 | if ( Uid == c ) { | 183 | if ( Uid == c ) { |
182 | sortByTrait<SortingTraits::Uid>(); | 184 | sortByTrait<SortingTraits::Uid>(); |
183 | } else if ( Name == c ) { | 185 | } else if ( Name == c ) { |
184 | sortByTrait<SortingTraits::Name>(); | 186 | sortByTrait<SortingTraits::Name>(); |
185 | } else if ( FormattedName == c ) { | 187 | } else if ( FormattedName == c ) { |
186 | sortByTrait<SortingTraits::FormattedName>(); | 188 | sortByTrait<SortingTraits::FormattedName>(); |
187 | } else if ( FamilyName == c ) { | 189 | } else if ( FamilyName == c ) { |
188 | sortByTrait<SortingTraits::FamilyName>(); | 190 | sortByTrait<SortingTraits::FamilyName>(); |
189 | } else if ( GivenName==c ) { | 191 | } else if ( GivenName==c ) { |
190 | sortByTrait<SortingTraits::GivenName>(); | 192 | sortByTrait<SortingTraits::GivenName>(); |
191 | } else { | 193 | } else { |
192 | kdError(5700) << "AddresseeList sorting criterion passed for which a trait is not known. No sorting done." << endl; | 194 | kdError(5700) << "AddresseeList sorting criterion passed for which a trait is not known. No sorting done." << endl; |
193 | } | 195 | } |
194 | } | 196 | } |
195 | 197 | ||
196 | void AddresseeList::sort() | 198 | void AddresseeList::sort() |
197 | { | 199 | { |
198 | sortBy( mActiveSortingCriterion ); | 200 | sortBy( mActiveSortingCriterion ); |
199 | } | 201 | } |
200 | 202 | ||
201 | template<class Trait> | 203 | template<class Trait> |
202 | void AddresseeList::sortByTrait() | 204 | void AddresseeList::sortByTrait() |
203 | { | 205 | { |
204 | // FIXME: better sorting algorithm, bubblesort is not acceptable for larger lists. | 206 | // FIXME: better sorting algorithm, bubblesort is not acceptable for larger lists. |
205 | // | 207 | // |
206 | // for i := 1 to n - 1 | 208 | // for i := 1 to n - 1 |
207 | // do for j := 1 to n - i | 209 | // do for j := 1 to n - i |
208 | // do if A[j] > A[j+1] | 210 | // do if A[j] > A[j+1] |
209 | // then temp := A[j] | 211 | // then temp := A[j] |
210 | // A[j] := A[j + 1] | 212 | // A[j] := A[j + 1] |
211 | // A[j + 1 ] := temp | 213 | // A[j + 1 ] := temp |
212 | 214 | ||
213 | //US iterator i1 = begin(); | 215 | //US iterator i1 = begin(); |
214 | Iterator i1 = begin(); | 216 | Iterator i1 = begin(); |
215 | //US iterator endIt = end(); | 217 | //US iterator endIt = end(); |
216 | Iterator endIt = end(); | 218 | Iterator endIt = end(); |
217 | --endIt; | 219 | --endIt; |
218 | if ( i1 == endIt ) // don't need sorting | 220 | if ( i1 == endIt ) // don't need sorting |
219 | return; | 221 | return; |
220 | 222 | ||
221 | //US iterator i2 = endIt; | 223 | //US iterator i2 = endIt; |
222 | Iterator i2 = endIt; | 224 | Iterator i2 = endIt; |
223 | while( i1 != endIt ) { | 225 | while( i1 != endIt ) { |
224 | //US iterator j1 = begin(); | 226 | //US iterator j1 = begin(); |
225 | Iterator j1 = begin(); | 227 | Iterator j1 = begin(); |
226 | //US iterator j2 = j1; | 228 | //US iterator j2 = j1; |
227 | Iterator j2 = j1; | 229 | Iterator j2 = j1; |
228 | ++j2; | 230 | ++j2; |
229 | while( j1 != i2 ) { | 231 | while( j1 != i2 ) { |
230 | if ( !mReverseSorting && Trait::lt( *j2, *j1 ) | 232 | if ( !mReverseSorting && Trait::lt( *j2, *j1 ) |
231 | || mReverseSorting && Trait::lt( *j1, *j2 ) ) { | 233 | || mReverseSorting && Trait::lt( *j1, *j2 ) ) { |
232 | qSwap( *j1, *j2 ); | 234 | qSwap( *j1, *j2 ); |
233 | } | 235 | } |
234 | ++j1; | 236 | ++j1; |
235 | ++j2; | 237 | ++j2; |
236 | } | 238 | } |
237 | ++i1; | 239 | ++i1; |
238 | --i2; | 240 | --i2; |
239 | } | 241 | } |
240 | } | 242 | } |
241 | 243 | ||
242 | void AddresseeList::sortByField( Field *field ) | 244 | void AddresseeList::sortByField( Field *field ) |
243 | { | 245 | { |
244 | if ( field ) | 246 | if ( field ) |
245 | mActiveSortingField = field; | 247 | mActiveSortingField = field; |
246 | 248 | ||
247 | if ( !mActiveSortingField ) { | 249 | if ( !mActiveSortingField ) { |
248 | kdWarning(5700) << "sortByField called with no active sort field" << endl; | 250 | kdWarning(5700) << "sortByField called with no active sort field" << endl; |
249 | return; | 251 | return; |
250 | } | 252 | } |
251 | 253 | ||
252 | if ( count() == 0 ) | 254 | if ( count() == 0 ) |
253 | return; | 255 | return; |
254 | 256 | ||
255 | quickSortByField( 0, count() - 1 ); | 257 | quickSortByField( 0, count() - 1 ); |
256 | } | 258 | } |
257 | 259 | ||
258 | void AddresseeList::quickSortByField( int left, int right ) | 260 | void AddresseeList::quickSortByField( int left, int right ) |
259 | { | 261 | { |
260 | int i = left; | 262 | int i = left; |
261 | int j = right; | 263 | int j = right; |
262 | int mid = ( left + right ) / 2; | 264 | int mid = ( left + right ) / 2; |
263 | 265 | ||
264 | //US iterator x = at( mid ); | 266 | //US iterator x = at( mid ); |
265 | ConstIterator x = at( mid ); | 267 | ConstIterator x = at( mid ); |
266 | 268 | ||
267 | do { | 269 | do { |
268 | if ( !mReverseSorting ) { | 270 | if ( !mReverseSorting ) { |
269 | //US QString::localeAwareCompare was not available. Used compare instead. | 271 | //US QString::localeAwareCompare was not available. Used compare instead. |
270 | while ( QString::compare( mActiveSortingField->value( *at( i ) ).upper(), mActiveSortingField->value( *x ).upper() ) < 0 ) | 272 | while ( QString::compare( mActiveSortingField->value( *at( i ) ).upper(), mActiveSortingField->value( *x ).upper() ) < 0 ) |
271 | i++; | 273 | i++; |
272 | //US QString::localeAwareCompare was not available. Used compare instead. | 274 | //US QString::localeAwareCompare was not available. Used compare instead. |
273 | while ( QString::compare( mActiveSortingField->value( *at( j ) ).upper(), mActiveSortingField->value( *x ).upper() ) > 0 ) | 275 | while ( QString::compare( mActiveSortingField->value( *at( j ) ).upper(), mActiveSortingField->value( *x ).upper() ) > 0 ) |
274 | j--; | 276 | j--; |
275 | } else { | 277 | } else { |
276 | //US QString::localeAwareCompare was not available. Used compare instead. | 278 | //US QString::localeAwareCompare was not available. Used compare instead. |
277 | while ( QString::compare( mActiveSortingField->value( *at( i ) ).upper(), mActiveSortingField->value( *x ).upper() ) > 0 ) | 279 | while ( QString::compare( mActiveSortingField->value( *at( i ) ).upper(), mActiveSortingField->value( *x ).upper() ) > 0 ) |
278 | i++; | 280 | i++; |
279 | //US QString::localeAwareCompare was not available. Used compare instead. | 281 | //US QString::localeAwareCompare was not available. Used compare instead. |
280 | while ( QString::compare( mActiveSortingField->value( *at( j ) ).upper(), mActiveSortingField->value( *x ).upper() ) < 0 ) | 282 | while ( QString::compare( mActiveSortingField->value( *at( j ) ).upper(), mActiveSortingField->value( *x ).upper() ) < 0 ) |
281 | j--; | 283 | j--; |
282 | } | 284 | } |
283 | if ( i <= j ) { | 285 | if ( i <= j ) { |
284 | qSwap( *at( i ), *at( j ) ); | 286 | qSwap( *at( i ), *at( j ) ); |
285 | i++; | 287 | i++; |
286 | j--; | 288 | j--; |
287 | } | 289 | } |
288 | } while ( i <= j ); | 290 | } while ( i <= j ); |
289 | 291 | ||
290 | if ( left < j ) quickSortByField( left, j ); | 292 | if ( left < j ) quickSortByField( left, j ); |
291 | if ( right > i ) quickSortByField( i, right ); | 293 | if ( right > i ) quickSortByField( i, right ); |
292 | } | 294 | } |
diff --git a/kabc/addresseelist.h b/kabc/addresseelist.h index 2df252c..6106804 100644 --- a/kabc/addresseelist.h +++ b/kabc/addresseelist.h | |||
@@ -1,218 +1,218 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Jost Schenck <jost@schenck.de> | 3 | Copyright (c) 2002 Jost Schenck <jost@schenck.de> |
4 | 2003 Tobias Koenig <tokoe@kde.org> | 4 | 2003 Tobias Koenig <tokoe@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 | #ifndef KABC_ADDRESSEELIST_H | 29 | #ifndef KABC_ADDRESSEELIST_H |
30 | #define KABC_ADDRESSEELIST_H | 30 | #define KABC_ADDRESSEELIST_H |
31 | 31 | ||
32 | #include <qvaluelist.h> | 32 | #include <q3valuelist.h> |
33 | 33 | ||
34 | #include "addressee.h" | 34 | #include "addressee.h" |
35 | 35 | ||
36 | namespace KABC { | 36 | namespace KABC { |
37 | 37 | ||
38 | class Field; | 38 | class Field; |
39 | 39 | ||
40 | /** | 40 | /** |
41 | * Each trait must implement one static function for equality, one for "less | 41 | * Each trait must implement one static function for equality, one for "less |
42 | * than". Class name should be the field name. A trait does not necessarily | 42 | * than". Class name should be the field name. A trait does not necessarily |
43 | * have to stick to just one field: a trait sorting by family name can e.g. | 43 | * have to stick to just one field: a trait sorting by family name can e.g. |
44 | * sort addressees with equal family name by given name. | 44 | * sort addressees with equal family name by given name. |
45 | * | 45 | * |
46 | * If you want to implement reverse sorting, you do not have to write another | 46 | * If you want to implement reverse sorting, you do not have to write another |
47 | * trait, as AddresseeList takes care of that. | 47 | * trait, as AddresseeList takes care of that. |
48 | */ | 48 | */ |
49 | namespace SortingTraits | 49 | namespace SortingTraits |
50 | { | 50 | { |
51 | 51 | ||
52 | class Uid | 52 | class Uid |
53 | { | 53 | { |
54 | public: | 54 | public: |
55 | static bool eq( const Addressee &, const Addressee & ); | 55 | static bool eq( const Addressee &, const Addressee & ); |
56 | static bool lt( const Addressee &, const Addressee & ); | 56 | static bool lt( const Addressee &, const Addressee & ); |
57 | }; | 57 | }; |
58 | 58 | ||
59 | class Name | 59 | class Name |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | static bool eq( const Addressee &, const Addressee & ); | 62 | static bool eq( const Addressee &, const Addressee & ); |
63 | static bool lt( const Addressee &, const Addressee & ); | 63 | static bool lt( const Addressee &, const Addressee & ); |
64 | }; | 64 | }; |
65 | 65 | ||
66 | class FormattedName | 66 | class FormattedName |
67 | { | 67 | { |
68 | public: | 68 | public: |
69 | static bool eq( const Addressee &, const Addressee & ); | 69 | static bool eq( const Addressee &, const Addressee & ); |
70 | static bool lt( const Addressee &, const Addressee & ); | 70 | static bool lt( const Addressee &, const Addressee & ); |
71 | }; | 71 | }; |
72 | 72 | ||
73 | class FamilyName // fallback to given name | 73 | class FamilyName // fallback to given name |
74 | { | 74 | { |
75 | public: | 75 | public: |
76 | static bool eq( const Addressee &, const Addressee & ); | 76 | static bool eq( const Addressee &, const Addressee & ); |
77 | static bool lt( const Addressee &, const Addressee & ); | 77 | static bool lt( const Addressee &, const Addressee & ); |
78 | }; | 78 | }; |
79 | 79 | ||
80 | class GivenName // fallback to family name | 80 | class GivenName // fallback to family name |
81 | { | 81 | { |
82 | public: | 82 | public: |
83 | static bool eq( const Addressee &, const Addressee & ); | 83 | static bool eq( const Addressee &, const Addressee & ); |
84 | static bool lt( const Addressee &, const Addressee & ); | 84 | static bool lt( const Addressee &, const Addressee & ); |
85 | }; | 85 | }; |
86 | 86 | ||
87 | } | 87 | } |
88 | 88 | ||
89 | /** | 89 | /** |
90 | * Addressee attribute used for sorting. | 90 | * Addressee attribute used for sorting. |
91 | */ | 91 | */ |
92 | typedef enum { Uid, Name, FormattedName, FamilyName, GivenName } SortingCriterion; | 92 | typedef enum { Uid, Name, FormattedName, FamilyName, GivenName } SortingCriterion; |
93 | 93 | ||
94 | /** | 94 | /** |
95 | * @short a QValueList of Addressee, with sorting functionality | 95 | * @short a QValueList of Addressee, with sorting functionality |
96 | * | 96 | * |
97 | * This class extends the functionality of QValueList with | 97 | * This class extends the functionality of QValueList with |
98 | * sorting methods specific to the Addressee class. It can be used | 98 | * sorting methods specific to the Addressee class. It can be used |
99 | * just like any other QValueList but is no template class. | 99 | * just like any other QValueList but is no template class. |
100 | * | 100 | * |
101 | * An AddresseeList does not automatically keep sorted when addressees | 101 | * An AddresseeList does not automatically keep sorted when addressees |
102 | * are added or removed or the sorting order is changed, as this would | 102 | * are added or removed or the sorting order is changed, as this would |
103 | * slow down larger operations by sorting after every step. So after | 103 | * slow down larger operations by sorting after every step. So after |
104 | * such operations you have to call {@link #sort} or {@link #sortBy} to | 104 | * such operations you have to call {@link #sort} or {@link #sortBy} to |
105 | * create a defined order again. | 105 | * create a defined order again. |
106 | * | 106 | * |
107 | * Iterator usage is inherited by QValueList and extensively documented | 107 | * Iterator usage is inherited by QValueList and extensively documented |
108 | * there. Please remember that the state of an iterator is undefined | 108 | * there. Please remember that the state of an iterator is undefined |
109 | * after any sorting operation. | 109 | * after any sorting operation. |
110 | * | 110 | * |
111 | * For the enumeration Type SortingCriterion, which specifies the | 111 | * For the enumeration Type SortingCriterion, which specifies the |
112 | * field by the collection will be sorted, the following values exist: | 112 | * field by the collection will be sorted, the following values exist: |
113 | * Uid, Name, FormattedName, FamilyName, GivenName. | 113 | * Uid, Name, FormattedName, FamilyName, GivenName. |
114 | * | 114 | * |
115 | * @author Jost Schenck jost@schenck.de | 115 | * @author Jost Schenck jost@schenck.de |
116 | */ | 116 | */ |
117 | class AddresseeList : public QValueList<Addressee> | 117 | class AddresseeList : public Q3ValueList<Addressee> |
118 | { | 118 | { |
119 | public: | 119 | public: |
120 | AddresseeList(); | 120 | AddresseeList(); |
121 | ~AddresseeList(); | 121 | ~AddresseeList(); |
122 | AddresseeList( const AddresseeList & ); | 122 | AddresseeList( const AddresseeList & ); |
123 | AddresseeList( const QValueList<Addressee> & ); | 123 | AddresseeList( const Q3ValueList<Addressee> & ); |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * Debug output. | 126 | * Debug output. |
127 | */ | 127 | */ |
128 | void dump() const; | 128 | void dump() const; |
129 | 129 | ||
130 | /** | 130 | /** |
131 | * Determines the direction of sorting. On change, the list | 131 | * Determines the direction of sorting. On change, the list |
132 | * will <em>not</em> automatically be resorted. | 132 | * will <em>not</em> automatically be resorted. |
133 | * @param r <tt>true</tt> if sorting should be done reverse, <tt>false</tt> otherwise | 133 | * @param r <tt>true</tt> if sorting should be done reverse, <tt>false</tt> otherwise |
134 | */ | 134 | */ |
135 | void setReverseSorting( bool r = true ) { mReverseSorting = r; } | 135 | void setReverseSorting( bool r = true ) { mReverseSorting = r; } |
136 | 136 | ||
137 | /** | 137 | /** |
138 | * Returns the direction of sorting. | 138 | * Returns the direction of sorting. |
139 | * @return <tt>true</tt> if sorting is done reverse, <tt>false</tt> otherwise | 139 | * @return <tt>true</tt> if sorting is done reverse, <tt>false</tt> otherwise |
140 | */ | 140 | */ |
141 | bool reverseSorting() const { return mReverseSorting; } | 141 | bool reverseSorting() const { return mReverseSorting; } |
142 | 142 | ||
143 | /** | 143 | /** |
144 | * Sorts this list by a specific criterion. | 144 | * Sorts this list by a specific criterion. |
145 | * @param c the criterion by which should be sorted | 145 | * @param c the criterion by which should be sorted |
146 | */ | 146 | */ |
147 | void sortBy( SortingCriterion c ); | 147 | void sortBy( SortingCriterion c ); |
148 | 148 | ||
149 | /** | 149 | /** |
150 | * Sorts this list by a specific field. If no parameter is given, the | 150 | * Sorts this list by a specific field. If no parameter is given, the |
151 | * last used Field object will be used. | 151 | * last used Field object will be used. |
152 | * @param field pointer to the Field object to be sorted by | 152 | * @param field pointer to the Field object to be sorted by |
153 | */ | 153 | */ |
154 | void sortByField( Field *field = 0 ); | 154 | void sortByField( Field *field = 0 ); |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * Sorts this list by its active sorting criterion. This normally is the | 157 | * Sorts this list by its active sorting criterion. This normally is the |
158 | * criterion of the last sortBy operation or <tt>FormattedName</tt> if up | 158 | * criterion of the last sortBy operation or <tt>FormattedName</tt> if up |
159 | * to now there has been no sortBy operation. | 159 | * to now there has been no sortBy operation. |
160 | * | 160 | * |
161 | * Please note that the sorting trait of the last {@link #sortByTrait} | 161 | * Please note that the sorting trait of the last {@link #sortByTrait} |
162 | * method call is not remembered and thus the action can not be repeated | 162 | * method call is not remembered and thus the action can not be repeated |
163 | * by this method. | 163 | * by this method. |
164 | */ | 164 | */ |
165 | void sort(); | 165 | void sort(); |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * Templated sort function. You normally will not want to use this but | 168 | * Templated sort function. You normally will not want to use this but |
169 | * {@link #sortBy} and {@link #sort} instead as the existing sorting | 169 | * {@link #sortBy} and {@link #sort} instead as the existing sorting |
170 | * criteria completely suffice for most cases. | 170 | * criteria completely suffice for most cases. |
171 | * | 171 | * |
172 | * However, if you do want to use some special sorting criterion, you can | 172 | * However, if you do want to use some special sorting criterion, you can |
173 | * write a trait class that will be provided to this templated method. | 173 | * write a trait class that will be provided to this templated method. |
174 | * This trait class has to have a class declaration like the following: | 174 | * This trait class has to have a class declaration like the following: |
175 | * <pre> | 175 | * <pre> |
176 | * class MySortingTrait { | 176 | * class MySortingTrait { |
177 | * public: | 177 | * public: |
178 | * // eq returns true if a1 and a2 are equal | 178 | * // eq returns true if a1 and a2 are equal |
179 | * static bool eq(KABC::Addressee a1, KABC::Addressee a2); | 179 | * static bool eq(KABC::Addressee a1, KABC::Addressee a2); |
180 | * // lt returns true is a1 is "less than" a2 | 180 | * // lt returns true is a1 is "less than" a2 |
181 | * static bool lt(KABC::Addressee a1, KABC::Addressee a2); | 181 | * static bool lt(KABC::Addressee a1, KABC::Addressee a2); |
182 | * }; | 182 | * }; |
183 | * </pre> | 183 | * </pre> |
184 | * You can then pass this class to the sortByTrait method like this: | 184 | * You can then pass this class to the sortByTrait method like this: |
185 | * <pre> | 185 | * <pre> |
186 | * myAddresseelist.sortByTrait<MySortingTrait>(); | 186 | * myAddresseelist.sortByTrait<MySortingTrait>(); |
187 | * </pre> | 187 | * </pre> |
188 | * Please note that the {@link #sort} method can not be used to repeat the | 188 | * Please note that the {@link #sort} method can not be used to repeat the |
189 | * sorting of the last <tt>sortByTrait</tt> action. | 189 | * sorting of the last <tt>sortByTrait</tt> action. |
190 | * | 190 | * |
191 | * Right now this method uses the bubble sort algorithm. This should be | 191 | * Right now this method uses the bubble sort algorithm. This should be |
192 | * replaced for a better one when I have time. | 192 | * replaced for a better one when I have time. |
193 | */ | 193 | */ |
194 | template<class Trait> void sortByTrait(); | 194 | template<class Trait> void sortByTrait(); |
195 | 195 | ||
196 | /** | 196 | /** |
197 | * Returns the active sorting criterion, ie the sorting criterion that | 197 | * Returns the active sorting criterion, ie the sorting criterion that |
198 | * will be used by a {@link #sort} call. | 198 | * will be used by a {@link #sort} call. |
199 | */ | 199 | */ |
200 | SortingCriterion sortingCriterion() const { return mActiveSortingCriterion; } | 200 | SortingCriterion sortingCriterion() const { return mActiveSortingCriterion; } |
201 | 201 | ||
202 | /** | 202 | /** |
203 | * Returns the active sorting field, ie a pointer to the Field object | 203 | * Returns the active sorting field, ie a pointer to the Field object |
204 | * which was used for the last {@link #sortByField} operation. | 204 | * which was used for the last {@link #sortByField} operation. |
205 | */ | 205 | */ |
206 | Field* sortingField() const { return mActiveSortingField; } | 206 | Field* sortingField() const { return mActiveSortingField; } |
207 | 207 | ||
208 | private: | 208 | private: |
209 | void quickSortByField( int, int ); | 209 | void quickSortByField( int, int ); |
210 | 210 | ||
211 | bool mReverseSorting; | 211 | bool mReverseSorting; |
212 | SortingCriterion mActiveSortingCriterion; | 212 | SortingCriterion mActiveSortingCriterion; |
213 | Field* mActiveSortingField; | 213 | Field* mActiveSortingField; |
214 | }; | 214 | }; |
215 | 215 | ||
216 | } | 216 | } |
217 | 217 | ||
218 | #endif | 218 | #endif |
diff --git a/kabc/addresseeview.cpp b/kabc/addresseeview.cpp index cde19a1..425e67c 100644 --- a/kabc/addresseeview.cpp +++ b/kabc/addresseeview.cpp | |||
@@ -1,739 +1,744 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | 3 | ||
4 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 4 | Copyright (c) 2003 Tobias Koenig <tokoe@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 | #include <kabc/address.h> | 22 | #include <kabc/address.h> |
23 | #include <kabc/addressee.h> | 23 | #include <kabc/addressee.h> |
24 | #include <kabc/phonenumber.h> | 24 | #include <kabc/phonenumber.h> |
25 | #include <kglobal.h> | 25 | #include <kglobal.h> |
26 | //US#include <kglobalsettings.h> | 26 | //US#include <kglobalsettings.h> |
27 | #include <kiconloader.h> | 27 | #include <kiconloader.h> |
28 | #include <klocale.h> | 28 | #include <klocale.h> |
29 | //US #include <kstringhandler.h> | 29 | //US #include <kstringhandler.h> |
30 | #include <qscrollview.h> | 30 | #include <q3scrollview.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qfile.h> | 32 | #include <qfile.h> |
33 | #include <qvbox.h> | 33 | #include <q3vbox.h> |
34 | #include <qlabel.h> | 34 | #include <qlabel.h> |
35 | #include <qwidget.h> | 35 | #include <qwidget.h> |
36 | #include <qlayout.h> | 36 | #include <qlayout.h> |
37 | #include <qapplication.h> | 37 | #include <qapplication.h> |
38 | #include <qpushbutton.h> | 38 | #include <qpushbutton.h> |
39 | #ifdef DESKTOP_VERSION | 39 | #ifdef DESKTOP_VERSION |
40 | #include <qpaintdevicemetrics.h> | 40 | #include <q3paintdevicemetrics.h> |
41 | #include <qprinter.h> | 41 | #include <qprinter.h> |
42 | #include <qpainter.h> | 42 | #include <qpainter.h> |
43 | #endif | 43 | #endif |
44 | #include <QDesktopWidget> | ||
44 | 45 | ||
45 | 46 | ||
46 | #include <qstylesheet.h> | 47 | #include <q3stylesheet.h> |
48 | //Added by qt3to4: | ||
49 | #include <Q3HBoxLayout> | ||
50 | #include <QPixmap> | ||
51 | #include <Q3VBoxLayout> | ||
47 | #include "externalapphandler.h" | 52 | #include "externalapphandler.h" |
48 | #include <kabc/addresseeview.h> | 53 | #include <kabc/addresseeview.h> |
49 | 54 | ||
50 | 55 | ||
51 | //US #ifndef DESKTOP_VERSION | 56 | //US #ifndef DESKTOP_VERSION |
52 | //US #include <qtopia/qcopenvelope_qws.h> | 57 | //US #include <qtopia/qcopenvelope_qws.h> |
53 | //US #include <qpe/qpeapplication.h> | 58 | //US #include <qpe/qpeapplication.h> |
54 | //US #endif | 59 | //US #endif |
55 | 60 | ||
56 | //US static int kphoneInstalled = 0; | 61 | //US static int kphoneInstalled = 0; |
57 | 62 | ||
58 | using namespace KABC; | 63 | using namespace KABC; |
59 | bool AddresseeView::sFullDetailsMode = false; | 64 | bool AddresseeView::sFullDetailsMode = false; |
60 | 65 | ||
61 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) | 66 | AddresseeView::AddresseeView( QWidget *parent, const char *name ) |
62 | : QTextBrowser( parent, name ) | 67 | : Q3TextBrowser( parent, name ) |
63 | 68 | ||
64 | 69 | ||
65 | { | 70 | { |
66 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); | 71 | //US setWrapPolicy( QTextEdit::AtWordBoundary ); |
67 | setLinkUnderline( false ); | 72 | setLinkUnderline( false ); |
68 | // setVScrollBarMode( QScrollView::AlwaysOff ); | 73 | // setVScrollBarMode( QScrollView::AlwaysOff ); |
69 | //setHScrollBarMode( QScrollView::AlwaysOff ); | 74 | //setHScrollBarMode( QScrollView::AlwaysOff ); |
70 | 75 | ||
71 | //US QStyleSheet *sheet = styleSheet(); | 76 | //US QStyleSheet *sheet = styleSheet(); |
72 | //US QStyleSheetItem *link = sheet->item( "a" ); | 77 | //US QStyleSheetItem *link = sheet->item( "a" ); |
73 | //US link->setColor( KGlobalSettings::linkColor() ); | 78 | //US link->setColor( KGlobalSettings::linkColor() ); |
74 | 79 | ||
75 | 80 | ||
76 | } | 81 | } |
77 | void AddresseeView::printMe() | 82 | void AddresseeView::printMe() |
78 | { | 83 | { |
79 | #ifdef DESKTOP_VERSION | 84 | #ifdef DESKTOP_VERSION |
80 | QPrinter printer; | 85 | QPrinter printer; |
81 | if (!printer.setup() ) | 86 | if (!printer.setup() ) |
82 | return; | 87 | return; |
83 | QPainter p; | 88 | QPainter p; |
84 | p.begin ( &printer ); | 89 | p.begin ( &printer ); |
85 | QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); | 90 | Q3PaintDeviceMetrics m = Q3PaintDeviceMetrics ( &printer ); |
86 | float dx, dy; | 91 | float dx, dy; |
87 | int wid = (m.width() * 9)/10; | 92 | int wid = (m.width() * 9)/10; |
88 | dx = (float) wid/(float)contentsWidth (); | 93 | dx = (float) wid/(float)contentsWidth (); |
89 | dy = (float)(m.height()) / (float)contentsHeight (); | 94 | dy = (float)(m.height()) / (float)contentsHeight (); |
90 | float scale; | 95 | float scale; |
91 | // scale to fit the width or height of the paper | 96 | // scale to fit the width or height of the paper |
92 | if ( dx < dy ) | 97 | if ( dx < dy ) |
93 | scale = dx; | 98 | scale = dx; |
94 | else | 99 | else |
95 | scale = dy; | 100 | scale = dy; |
96 | p.translate( m.width()/10,0 ); | 101 | p.translate( m.width()/10,0 ); |
97 | p.scale( scale, scale ); | 102 | p.scale( scale, scale ); |
98 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); | 103 | drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); |
99 | p.end(); | 104 | p.end(); |
100 | #endif | 105 | #endif |
101 | } | 106 | } |
102 | void AddresseeView::setSource(const QString& n) | 107 | void AddresseeView::setSource(const QString& n) |
103 | { | 108 | { |
104 | //qDebug("********AddresseeView::setSource %s", n.latin1()); | 109 | //qDebug("********AddresseeView::setSource %s", n.latin1()); |
105 | 110 | ||
106 | if ( n == "allDetails" ) { | 111 | if ( n == "allDetails" ) { |
107 | sFullDetailsMode = true; | 112 | sFullDetailsMode = true; |
108 | setAddressee( mCurrentContact ); | 113 | setAddressee( mCurrentContact ); |
109 | } else if ( n == "notAllDetails" ) { | 114 | } else if ( n == "notAllDetails" ) { |
110 | sFullDetailsMode = false; | 115 | sFullDetailsMode = false; |
111 | setAddressee( mCurrentContact ); | 116 | setAddressee( mCurrentContact ); |
112 | } else if ( n.left( 6 ) == "mailto" ) | 117 | } else if ( n.left( 6 ) == "mailto" ) |
113 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); | 118 | ExternalAppHandler::instance()->mailToOneContact( n.mid(7) ); |
114 | else if ( n.left( 7 ) == "phoneto" ) | 119 | else if ( n.left( 7 ) == "phoneto" ) |
115 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); | 120 | ExternalAppHandler::instance()->callByPhone( n.mid(8) ); |
116 | else if ( n.left( 5 ) == "faxto" ) | 121 | else if ( n.left( 5 ) == "faxto" ) |
117 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); | 122 | ExternalAppHandler::instance()->callByFax( n.mid(6) ); |
118 | else if ( n.left( 5 ) == "smsto" ) | 123 | else if ( n.left( 5 ) == "smsto" ) |
119 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); | 124 | ExternalAppHandler::instance()->callBySMS( n.mid(6) ); |
120 | else if ( n.left( 7 ) == "pagerto" ) | 125 | else if ( n.left( 7 ) == "pagerto" ) |
121 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); | 126 | ExternalAppHandler::instance()->callByPager( n.mid(8) ); |
122 | else if ( n.left( 5 ) == "sipto" ) | 127 | else if ( n.left( 5 ) == "sipto" ) |
123 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); | 128 | ExternalAppHandler::instance()->callBySIP( n.mid(6) ); |
124 | 129 | ||
125 | } | 130 | } |
126 | void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) | 131 | void AddresseeView::setAddressee( const KABC::Addressee& mAddressee ) |
127 | { | 132 | { |
128 | bool kemailAvail = ExternalAppHandler::instance()->isEmailAppAvailable(); | 133 | bool kemailAvail = ExternalAppHandler::instance()->isEmailAppAvailable(); |
129 | // mAddressee = addr; | 134 | // mAddressee = addr; |
130 | // clear view | 135 | // clear view |
131 | //setText( QString::null ); | 136 | //setText( QString::null ); |
132 | mCurrentContact = mAddressee; | 137 | mCurrentContact = mAddressee; |
133 | if ( mAddressee.isEmpty() ) { | 138 | if ( mAddressee.isEmpty() ) { |
134 | setText( QString::null); | 139 | setText( QString::null); |
135 | return; | 140 | return; |
136 | } | 141 | } |
137 | #if 0 | 142 | #if 0 |
138 | QString name = ( mAddressee.assembledName().isEmpty() ? | 143 | QString name = ( mAddressee.assembledName().isEmpty() ? |
139 | mAddressee.formattedName() : mAddressee.assembledName() ); | 144 | mAddressee.formattedName() : mAddressee.assembledName() ); |
140 | #endif | 145 | #endif |
141 | 146 | ||
142 | QString name = mAddressee.realName(); | 147 | QString name = mAddressee.realName(); |
143 | QString assName = mAddressee.assembledName(); | 148 | QString assName = mAddressee.assembledName(); |
144 | if ( assName.isEmpty() ) | 149 | if ( assName.isEmpty() ) |
145 | assName = name; | 150 | assName = name; |
146 | QString dynamicPart; | 151 | QString dynamicPart; |
147 | 152 | ||
148 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); | 153 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(),true ); |
149 | QStringList emails = mAddressee.emails(); | 154 | QStringList emails = mAddressee.emails(); |
150 | QStringList::ConstIterator emailIt; | 155 | QStringList::ConstIterator emailIt; |
151 | QString type = i18n( "Email" ); | 156 | QString type = i18n( "Email" ); |
152 | emailIt = emails.begin(); | 157 | emailIt = emails.begin(); |
153 | if ( emailIt != emails.end() ) { | 158 | if ( emailIt != emails.end() ) { |
154 | if ( kemailAvail ) { | 159 | if ( kemailAvail ) { |
155 | dynamicPart += QString( | 160 | dynamicPart += QString( |
156 | "<tr><td align=\"right\"><b>%1</b></td>" | 161 | "<tr><td align=\"right\"><b>%1</b></td>" |
157 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 162 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
158 | .arg( type ) | 163 | .arg( type ) |
159 | .arg( assName ) | 164 | .arg( assName ) |
160 | .arg( *emailIt ) | 165 | .arg( *emailIt ) |
161 | .arg( *emailIt ); | 166 | .arg( *emailIt ); |
162 | ++emailIt; | 167 | ++emailIt; |
163 | } else { | 168 | } else { |
164 | dynamicPart += QString( | 169 | dynamicPart += QString( |
165 | "<tr><td align=\"right\"><b>%1</b></td>" | 170 | "<tr><td align=\"right\"><b>%1</b></td>" |
166 | "<td align=\"left\">%2</td></tr>" ) | 171 | "<td align=\"left\">%2</td></tr>" ) |
167 | .arg( type ) | 172 | .arg( type ) |
168 | .arg( *emailIt ); | 173 | .arg( *emailIt ); |
169 | ++emailIt; | 174 | ++emailIt; |
170 | } | 175 | } |
171 | } | 176 | } |
172 | if ( mAddressee.birthday().date().isValid() ) { | 177 | if ( mAddressee.birthday().date().isValid() ) { |
173 | dynamicPart += QString( | 178 | dynamicPart += QString( |
174 | "<tr><td align=\"right\"><b>%1</b></td>" | 179 | "<tr><td align=\"right\"><b>%1</b></td>" |
175 | "<td align=\"left\">%2</td></tr>" ) | 180 | "<td align=\"left\">%2</td></tr>" ) |
176 | .arg( i18n ("Birthday") ) | 181 | .arg( i18n ("Birthday") ) |
177 | .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); | 182 | .arg( KGlobal::locale()->formatDate( mAddressee.birthday().date() ,true) ); |
178 | } | 183 | } |
179 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false ); | 184 | dynamicPart += getPhoneNumbers( mAddressee.phoneNumbers(), false ); |
180 | 185 | ||
181 | for ( ; emailIt != emails.end(); ++emailIt ) { | 186 | for ( ; emailIt != emails.end(); ++emailIt ) { |
182 | if ( kemailAvail ) { | 187 | if ( kemailAvail ) { |
183 | dynamicPart += QString( | 188 | dynamicPart += QString( |
184 | "<tr><td align=\"right\"><b>%1</b></td>" | 189 | "<tr><td align=\"right\"><b>%1</b></td>" |
185 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) | 190 | "<td align=\"left\"><a href=\"mailto:%2 <%3> \">%4</a></td></tr>" ) |
186 | .arg( type ) | 191 | .arg( type ) |
187 | .arg( name ) | 192 | .arg( name ) |
188 | .arg( *emailIt ) | 193 | .arg( *emailIt ) |
189 | .arg( *emailIt ); | 194 | .arg( *emailIt ); |
190 | } else { | 195 | } else { |
191 | dynamicPart += QString( | 196 | dynamicPart += QString( |
192 | "<tr><td align=\"right\"><b>%1</b></td>" | 197 | "<tr><td align=\"right\"><b>%1</b></td>" |
193 | "<td align=\"left\">%2</td></tr>" ) | 198 | "<td align=\"left\">%2</td></tr>" ) |
194 | .arg( type ) | 199 | .arg( type ) |
195 | .arg( *emailIt ); | 200 | .arg( *emailIt ); |
196 | } | 201 | } |
197 | } | 202 | } |
198 | 203 | ||
199 | 204 | ||
200 | 205 | ||
201 | KABC::Address::List addresses = mAddressee.addresses(); | 206 | KABC::Address::List addresses = mAddressee.addresses(); |
202 | KABC::Address::List::ConstIterator addrIt; | 207 | KABC::Address::List::ConstIterator addrIt; |
203 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { | 208 | for ( addrIt = addresses.begin(); addrIt != addresses.end(); ++addrIt ) { |
204 | if ( true /*(*addrIt).label().isEmpty()*/ ) { | 209 | if ( true /*(*addrIt).label().isEmpty()*/ ) { |
205 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); | 210 | QString formattedAddress = (*addrIt).formattedAddress().stripWhiteSpace(); |
206 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); | 211 | //US formattedAddress = formattedAddress.replace( '\n', "<br>" ); |
207 | //qDebug("adresss %s ",formattedAddress.latin1() ); | 212 | //qDebug("adresss %s ",formattedAddress.latin1() ); |
208 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); | 213 | formattedAddress = formattedAddress.replace( QRegExp("\n"), "<br>" ); |
209 | //qDebug("AddresseeView::setAddressee has to be verified."); | 214 | //qDebug("AddresseeView::setAddressee has to be verified."); |
210 | 215 | ||
211 | dynamicPart += QString( | 216 | dynamicPart += QString( |
212 | "<tr><td align=\"right\"><b>%1</b></td>" | 217 | "<tr><td align=\"right\"><b>%1</b></td>" |
213 | "<td align=\"left\">%2</td></tr>" ) | 218 | "<td align=\"left\">%2</td></tr>" ) |
214 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 219 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
215 | .arg( formattedAddress ); | 220 | .arg( formattedAddress ); |
216 | } else { | 221 | } else { |
217 | 222 | ||
218 | dynamicPart += QString( | 223 | dynamicPart += QString( |
219 | "<tr><td align=\"right\"><b>%1</b></td>" | 224 | "<tr><td align=\"right\"><b>%1</b></td>" |
220 | "<td align=\"left\">%2</td></tr>" ) | 225 | "<td align=\"left\">%2</td></tr>" ) |
221 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) | 226 | .arg( KABC::Address::typeLabel( (*addrIt).type() ) ) |
222 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); | 227 | //US .arg( (*addrIt).label().replace( '\n', "<br>" ) ); |
223 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); | 228 | .arg( (*addrIt).label() /*replace( QRegExp("\n"), "<br>" )*/ ); |
224 | 229 | ||
225 | } | 230 | } |
226 | } | 231 | } |
227 | 232 | ||
228 | 233 | ||
229 | QString notes; | 234 | QString notes; |
230 | if ( sFullDetailsMode ) { | 235 | if ( sFullDetailsMode ) { |
231 | notes = QString( | 236 | notes = QString( |
232 | "<tr><td align=\"right\"><b>%1</b></td>" | 237 | "<tr><td align=\"right\"><b>%1</b></td>" |
233 | "<td align=\"left\"><a href=\"notAllDetails\">%4</a></td></tr>" ) | 238 | "<td align=\"left\"><a href=\"notAllDetails\">%4</a></td></tr>" ) |
234 | .arg( i18n("Details") ) | 239 | .arg( i18n("Details") ) |
235 | .arg( i18n("Hide!") ); | 240 | .arg( i18n("Hide!") ); |
236 | 241 | ||
237 | QString tempX = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); | 242 | QString tempX = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); |
238 | if ( !tempX.isEmpty() ) { | 243 | if ( !tempX.isEmpty() ) { |
239 | if ( tempX == "male" || tempX == "female" ) { | 244 | if ( tempX == "male" || tempX == "female" ) { |
240 | notes += QString( | 245 | notes += QString( |
241 | "<tr><td align=\"right\"><b>%1</b></td>" | 246 | "<tr><td align=\"right\"><b>%1</b></td>" |
242 | "<td align=\"left\">%2</td></tr>" ) | 247 | "<td align=\"left\">%2</td></tr>" ) |
243 | .arg( i18n( "" ) ) | 248 | .arg( i18n( "" ) ) |
244 | .arg( i18n(tempX) ); | 249 | .arg( i18n(tempX) ); |
245 | } | 250 | } |
246 | } | 251 | } |
247 | 252 | ||
248 | 253 | ||
249 | tempX = mAddressee.secrecy().asString(); | 254 | tempX = mAddressee.secrecy().asString(); |
250 | 255 | ||
251 | notes += QString( | 256 | notes += QString( |
252 | "<tr><td align=\"right\"><b>%1</b></td>" | 257 | "<tr><td align=\"right\"><b>%1</b></td>" |
253 | "<td align=\"left\">%2</td></tr>" ) | 258 | "<td align=\"left\">%2</td></tr>" ) |
254 | .arg( "" ) | 259 | .arg( "" ) |
255 | .arg( tempX ); | 260 | .arg( tempX ); |
256 | 261 | ||
257 | 262 | ||
258 | tempX = mAddressee.categories().join(" - "); | 263 | tempX = mAddressee.categories().join(" - "); |
259 | if ( !tempX.isEmpty() ) { | 264 | if ( !tempX.isEmpty() ) { |
260 | notes += QString( | 265 | notes += QString( |
261 | "<tr><td align=\"right\"><b>%1</b></td>" | 266 | "<tr><td align=\"right\"><b>%1</b></td>" |
262 | "<td align=\"left\">%2</td></tr>" ) | 267 | "<td align=\"left\">%2</td></tr>" ) |
263 | .arg( i18n( "Category" ) ) | 268 | .arg( i18n( "Category" ) ) |
264 | .arg( tempX ); | 269 | .arg( tempX ); |
265 | } | 270 | } |
266 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Profession" ); | 271 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Profession" ); |
267 | if ( !tempX.isEmpty() ) { | 272 | if ( !tempX.isEmpty() ) { |
268 | notes += QString( | 273 | notes += QString( |
269 | "<tr><td align=\"right\"><b>%1</b></td>" | 274 | "<tr><td align=\"right\"><b>%1</b></td>" |
270 | "<td align=\"left\">%2</td></tr>" ) | 275 | "<td align=\"left\">%2</td></tr>" ) |
271 | .arg( i18n( "Profession" ) ) | 276 | .arg( i18n( "Profession" ) ) |
272 | .arg( tempX ); | 277 | .arg( tempX ); |
273 | } | 278 | } |
274 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Office" ); | 279 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Office" ); |
275 | if ( !tempX.isEmpty() ) { | 280 | if ( !tempX.isEmpty() ) { |
276 | notes += QString( | 281 | notes += QString( |
277 | "<tr><td align=\"right\"><b>%1</b></td>" | 282 | "<tr><td align=\"right\"><b>%1</b></td>" |
278 | "<td align=\"left\">%2</td></tr>" ) | 283 | "<td align=\"left\">%2</td></tr>" ) |
279 | .arg( i18n( "Office" ) ) | 284 | .arg( i18n( "Office" ) ) |
280 | .arg( tempX ); | 285 | .arg( tempX ); |
281 | } | 286 | } |
282 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Department" ); | 287 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Department" ); |
283 | if ( !tempX.isEmpty() ) { | 288 | if ( !tempX.isEmpty() ) { |
284 | notes += QString( | 289 | notes += QString( |
285 | "<tr><td align=\"right\"><b>%1</b></td>" | 290 | "<tr><td align=\"right\"><b>%1</b></td>" |
286 | "<td align=\"left\">%2</td></tr>" ) | 291 | "<td align=\"left\">%2</td></tr>" ) |
287 | .arg( i18n( "Department" ) ) | 292 | .arg( i18n( "Department" ) ) |
288 | .arg( tempX ); | 293 | .arg( tempX ); |
289 | } | 294 | } |
290 | 295 | ||
291 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ); | 296 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-ManagersName" ); |
292 | if ( !tempX.isEmpty() ) { | 297 | if ( !tempX.isEmpty() ) { |
293 | notes += QString( | 298 | notes += QString( |
294 | "<tr><td align=\"right\"><b>%1</b></td>" | 299 | "<tr><td align=\"right\"><b>%1</b></td>" |
295 | "<td align=\"left\">%2</td></tr>" ) | 300 | "<td align=\"left\">%2</td></tr>" ) |
296 | .arg( i18n( "Manager" ) ) | 301 | .arg( i18n( "Manager" ) ) |
297 | .arg( tempX ); | 302 | .arg( tempX ); |
298 | } | 303 | } |
299 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ); | 304 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-AssistantsName" ); |
300 | if ( !tempX.isEmpty() ) { | 305 | if ( !tempX.isEmpty() ) { |
301 | notes += QString( | 306 | notes += QString( |
302 | "<tr><td align=\"right\"><b>%1</b></td>" | 307 | "<tr><td align=\"right\"><b>%1</b></td>" |
303 | "<td align=\"left\">%2</td></tr>" ) | 308 | "<td align=\"left\">%2</td></tr>" ) |
304 | .arg( i18n( "Assistant" ) ) | 309 | .arg( i18n( "Assistant" ) ) |
305 | .arg( tempX ); | 310 | .arg( tempX ); |
306 | } | 311 | } |
307 | if ( !mAddressee.url().url().isEmpty() ) { | 312 | if ( !mAddressee.url().url().isEmpty() ) { |
308 | notes += QString( | 313 | notes += QString( |
309 | "<tr><td align=\"right\"><b>%1</b></td>" | 314 | "<tr><td align=\"right\"><b>%1</b></td>" |
310 | "<td align=\"left\">%2</td></tr>" ) | 315 | "<td align=\"left\">%2</td></tr>" ) |
311 | .arg( i18n( "Homepage" ) ) | 316 | .arg( i18n( "Homepage" ) ) |
312 | .arg( mAddressee.url().url() ); | 317 | .arg( mAddressee.url().url() ); |
313 | } | 318 | } |
314 | tempX = mAddressee.nickName(); | 319 | tempX = mAddressee.nickName(); |
315 | if ( !tempX.isEmpty() ) { | 320 | if ( !tempX.isEmpty() ) { |
316 | notes += QString( | 321 | notes += QString( |
317 | "<tr><td align=\"right\"><b>%1</b></td>" | 322 | "<tr><td align=\"right\"><b>%1</b></td>" |
318 | "<td align=\"left\">%2</td></tr>" ) | 323 | "<td align=\"left\">%2</td></tr>" ) |
319 | .arg( i18n( "Nickname" ) ) | 324 | .arg( i18n( "Nickname" ) ) |
320 | .arg( tempX ); | 325 | .arg( tempX ); |
321 | } | 326 | } |
322 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ); | 327 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-IMAddress" ); |
323 | if ( !tempX.isEmpty() ) { | 328 | if ( !tempX.isEmpty() ) { |
324 | notes += QString( | 329 | notes += QString( |
325 | "<tr><td align=\"right\"><b>%1</b></td>" | 330 | "<tr><td align=\"right\"><b>%1</b></td>" |
326 | "<td align=\"left\">%2</td></tr>" ) | 331 | "<td align=\"left\">%2</td></tr>" ) |
327 | .arg( i18n( "Messanger" ) ) | 332 | .arg( i18n( "Messanger" ) ) |
328 | .arg( tempX ); | 333 | .arg( tempX ); |
329 | } | 334 | } |
330 | 335 | ||
331 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Anniversary" ); | 336 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Anniversary" ); |
332 | if ( !tempX.isEmpty() ) { | 337 | if ( !tempX.isEmpty() ) { |
333 | QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d"); | 338 | QDate dt = KGlobal::locale()->readDate( tempX, "%Y-%m-%d"); |
334 | if ( dt.isValid () ) { | 339 | if ( dt.isValid () ) { |
335 | tempX = KGlobal::locale()->formatDate(dt, true); | 340 | tempX = KGlobal::locale()->formatDate(dt, true); |
336 | notes += QString( | 341 | notes += QString( |
337 | "<tr><td align=\"right\"><b>%1</b></td>" | 342 | "<tr><td align=\"right\"><b>%1</b></td>" |
338 | "<td align=\"left\">%2</td></tr>" ) | 343 | "<td align=\"left\">%2</td></tr>" ) |
339 | .arg( i18n( "Anniversary" ) ) | 344 | .arg( i18n( "Anniversary" ) ) |
340 | .arg( tempX ); | 345 | .arg( tempX ); |
341 | } | 346 | } |
342 | } | 347 | } |
343 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ); | 348 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ); |
344 | if ( !tempX.isEmpty() ) { | 349 | if ( !tempX.isEmpty() ) { |
345 | notes += QString( | 350 | notes += QString( |
346 | "<tr><td align=\"right\"><b>%1</b></td>" | 351 | "<tr><td align=\"right\"><b>%1</b></td>" |
347 | "<td align=\"left\">%2</td></tr>" ) | 352 | "<td align=\"left\">%2</td></tr>" ) |
348 | .arg( i18n( "Spouse" ) ) | 353 | .arg( i18n( "Spouse" ) ) |
349 | .arg( tempX ); | 354 | .arg( tempX ); |
350 | } | 355 | } |
351 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" ); | 356 | tempX = mAddressee.custom( "KADDRESSBOOK", "X-Children" ); |
352 | if ( !tempX.isEmpty() ) { | 357 | if ( !tempX.isEmpty() ) { |
353 | notes += QString( | 358 | notes += QString( |
354 | "<tr><td align=\"right\"><b>%1</b></td>" | 359 | "<tr><td align=\"right\"><b>%1</b></td>" |
355 | "<td align=\"left\">%2</td></tr>" ) | 360 | "<td align=\"left\">%2</td></tr>" ) |
356 | .arg( i18n( "Children" ) ) | 361 | .arg( i18n( "Children" ) ) |
357 | .arg( tempX ); | 362 | .arg( tempX ); |
358 | } | 363 | } |
359 | 364 | ||
360 | if ( !mAddressee.note().isEmpty() ) { | 365 | if ( !mAddressee.note().isEmpty() ) { |
361 | notes += QString( | 366 | notes += QString( |
362 | "<tr>" | 367 | "<tr>" |
363 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label | 368 | "<td align=\"right\" valign=\"top\"><b>%1</b></td>" // note label |
364 | "<td align=\"left\">%2</td>" // note | 369 | "<td align=\"left\">%2</td>" // note |
365 | "</tr>" ).arg( i18n( "Notes" ) ) | 370 | "</tr>" ).arg( i18n( "Notes" ) ) |
366 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); | 371 | //US .arg( mAddressee.note().replace( '\n', "<br>" ) ); |
367 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); | 372 | .arg( mAddressee.note().replace( QRegExp("\n"), "<br>" ) ); |
368 | //qDebug("AddresseeView::setAddressee has to be verified."); | 373 | //qDebug("AddresseeView::setAddressee has to be verified."); |
369 | } | 374 | } |
370 | } else { | 375 | } else { |
371 | notes = QString( | 376 | notes = QString( |
372 | "<tr><td align=\"right\"><b>%1</b></td>" | 377 | "<tr><td align=\"right\"><b>%1</b></td>" |
373 | "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" ) | 378 | "<td align=\"left\"><a href=\"allDetails\">%4</a></td></tr>" ) |
374 | .arg( i18n("Details") ) | 379 | .arg( i18n("Details") ) |
375 | .arg( i18n("Show!") ); | 380 | .arg( i18n("Show!") ); |
376 | 381 | ||
377 | 382 | ||
378 | } | 383 | } |
379 | 384 | ||
380 | QString aRole = ""; | 385 | QString aRole = ""; |
381 | QString aOrga = ""; | 386 | QString aOrga = ""; |
382 | if ( true /*!mAddressee.role().isEmpty()*/ ) { | 387 | if ( true /*!mAddressee.role().isEmpty()*/ ) { |
383 | aRole = "<tr>" | 388 | aRole = "<tr>" |
384 | "<td align=\"left\">" + mAddressee.role() + "</td>" | 389 | "<td align=\"left\">" + mAddressee.role() + "</td>" |
385 | "</tr>"; | 390 | "</tr>"; |
386 | } | 391 | } |
387 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { | 392 | if ( true /*!mAddressee.organization().isEmpty()*/ ) { |
388 | aOrga = "<tr>" | 393 | aOrga = "<tr>" |
389 | "<td align=\"left\">" + mAddressee.organization() + "</td>" | 394 | "<td align=\"left\">" + mAddressee.organization() + "</td>" |
390 | "</tr>"; | 395 | "</tr>"; |
391 | } | 396 | } |
392 | mText = ""; | 397 | mText = ""; |
393 | QString picString = ""; | 398 | QString picString = ""; |
394 | KABC::Picture picture = mAddressee.photo(); | 399 | KABC::Picture picture = mAddressee.photo(); |
395 | if (picture.undefined() ) picture = mAddressee.logo(); | 400 | if (picture.undefined() ) picture = mAddressee.logo(); |
396 | bool picAvailintern = false; | 401 | bool picAvailintern = false; |
397 | bool picAvailUrl = false; | 402 | bool picAvailUrl = false; |
398 | if (! picture.undefined() ) { | 403 | if (! picture.undefined() ) { |
399 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); | 404 | picAvailintern = (picture.isIntern() && !picture.data().isNull()); |
400 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); | 405 | picAvailUrl = !picture.isIntern() && QFile::exists(picture.url() ); |
401 | } | 406 | } |
402 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { | 407 | if ( picAvailUrl || picAvailintern || QApplication::desktop()->width() > 320 ) { |
403 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; | 408 | picString = "<img src=\"myimage\" width=\"50\" height=\"70\">"; |
404 | if ( picAvailintern ) { | 409 | if ( picAvailintern ) { |
405 | QMimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); | 410 | Q3MimeSourceFactory::defaultFactory()->setImage( "myimage", picture.data() ); |
406 | int wid = picture.data().width(); | 411 | int wid = picture.data().width(); |
407 | int hei = picture.data().height(); | 412 | int hei = picture.data().height(); |
408 | if ( wid > 128 || hei > 128 ) { | 413 | if ( wid > 128 || hei > 128 ) { |
409 | if ( wid > hei ) { | 414 | if ( wid > hei ) { |
410 | hei = (hei*128)/wid; | 415 | hei = (hei*128)/wid; |
411 | wid = 128; | 416 | wid = 128; |
412 | } else { | 417 | } else { |
413 | wid = (wid*128)/hei; | 418 | wid = (wid*128)/hei; |
414 | hei = 128; | 419 | hei = 128; |
415 | } | 420 | } |
416 | } | 421 | } |
417 | picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); | 422 | picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); |
418 | } else { | 423 | } else { |
419 | if ( picAvailUrl ) { | 424 | if ( picAvailUrl ) { |
420 | QPixmap picPix( picture.url() ); | 425 | QPixmap picPix( picture.url() ); |
421 | QMimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix ); | 426 | Q3MimeSourceFactory::defaultFactory()->setPixmap( "myimage", picPix ); |
422 | int wid = picPix.width(); | 427 | int wid = picPix.width(); |
423 | int hei = picPix.height(); | 428 | int hei = picPix.height(); |
424 | if ( wid > 128 || hei > 128 ) { | 429 | if ( wid > 128 || hei > 128 ) { |
425 | if ( wid > hei ) { | 430 | if ( wid > hei ) { |
426 | hei = (hei*128)/wid; | 431 | hei = (hei*128)/wid; |
427 | wid = 128; | 432 | wid = 128; |
428 | } else { | 433 | } else { |
429 | wid = (wid*128)/hei; | 434 | wid = (wid*128)/hei; |
430 | hei = 128; | 435 | hei = 128; |
431 | } | 436 | } |
432 | } | 437 | } |
433 | picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); | 438 | picString = QString("<img src=\"myimage\" width=\"%1\" height=\"%2\">").arg(wid).arg(hei); |
434 | } else { | 439 | } else { |
435 | if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { | 440 | if ( !mAddressee.custom( "KADDRESSBOOK", "X-Children" ).isEmpty() ) { |
436 | static bool setDefaultImageChildren = false; | 441 | static bool setDefaultImageChildren = false; |
437 | if ( !setDefaultImageChildren ) { | 442 | if ( !setDefaultImageChildren ) { |
438 | QMimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); | 443 | Q3MimeSourceFactory::defaultFactory()->setPixmap( "familyIcon", KGlobal::iconLoader()->loadIcon( "ic_kids", KIcon::Desktop, 128 ) ); |
439 | setDefaultImageChildren = true; | 444 | setDefaultImageChildren = true; |
440 | } | 445 | } |
441 | picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; | 446 | picString = "<img src=\"familyIcon\" width=\"64\" height=\"64\">"; |
442 | 447 | ||
443 | } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) { | 448 | } else if ( !mAddressee.custom( "KADDRESSBOOK", "X-SpousesName" ).isEmpty() ) { |
444 | static bool setDefaultImagepouses = false; | 449 | static bool setDefaultImagepouses = false; |
445 | if ( !setDefaultImagepouses ) { | 450 | if ( !setDefaultImagepouses ) { |
446 | QMimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) ); | 451 | Q3MimeSourceFactory::defaultFactory()->setPixmap( "SpousesIcon", KGlobal::iconLoader()->loadIcon( "ic_family", KIcon::Desktop, 128 ) ); |
447 | setDefaultImagepouses = true; | 452 | setDefaultImagepouses = true; |
448 | } | 453 | } |
449 | picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">"; | 454 | picString = "<img src=\"SpousesIcon\" width=\"64\" height=\"64\">"; |
450 | } else { | 455 | } else { |
451 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); | 456 | QString gen = mAddressee.custom( "KADDRESSBOOK", "X-Gender" ); |
452 | if ( gen == "male" ) { | 457 | if ( gen == "male" ) { |
453 | static bool setDefaultImageMale = false; | 458 | static bool setDefaultImageMale = false; |
454 | if ( !setDefaultImageMale ) { | 459 | if ( !setDefaultImageMale ) { |
455 | QMimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) ); | 460 | Q3MimeSourceFactory::defaultFactory()->setPixmap( "MaleIcon", KGlobal::iconLoader()->loadIcon( "ic_male", KIcon::Desktop, 128 ) ); |
456 | setDefaultImageMale = true; | 461 | setDefaultImageMale = true; |
457 | } | 462 | } |
458 | picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">"; | 463 | picString = "<img src=\"MaleIcon\" width=\"64\" height=\"64\">"; |
459 | 464 | ||
460 | } else if ( gen == "female" ) { | 465 | } else if ( gen == "female" ) { |
461 | static bool setDefaultImageFemale = false; | 466 | static bool setDefaultImageFemale = false; |
462 | if ( !setDefaultImageFemale ) { | 467 | if ( !setDefaultImageFemale ) { |
463 | QMimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); | 468 | Q3MimeSourceFactory::defaultFactory()->setPixmap( "FemaleIcon", KGlobal::iconLoader()->loadIcon( "ic_female", KIcon::Desktop, 128 ) ); |
464 | setDefaultImageFemale = true; | 469 | setDefaultImageFemale = true; |
465 | } | 470 | } |
466 | picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; | 471 | picString = "<img src=\"FemaleIcon\" width=\"64\" height=\"64\">"; |
467 | 472 | ||
468 | } else { | 473 | } else { |
469 | static bool setDefaultImage = false; | 474 | static bool setDefaultImage = false; |
470 | if ( !setDefaultImage ) { | 475 | if ( !setDefaultImage ) { |
471 | //qDebug("Setting default pixmap "); | 476 | //qDebug("Setting default pixmap "); |
472 | QMimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); | 477 | Q3MimeSourceFactory::defaultFactory()->setPixmap( "defaultIcon", KGlobal::iconLoader()->loadIcon( "ic_penguin", KIcon::Desktop, 128 ) ); |
473 | setDefaultImage = true; | 478 | setDefaultImage = true; |
474 | } | 479 | } |
475 | picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; | 480 | picString = "<img src=\"defaultIcon\" width=\"64\" height=\"64\">"; |
476 | } | 481 | } |
477 | } | 482 | } |
478 | } | 483 | } |
479 | } | 484 | } |
480 | mText = QString::fromLatin1( | 485 | mText = QString::fromLatin1( |
481 | "<html>" | 486 | "<html>" |
482 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color | 487 | "<body text=\"%1\" bgcolor=\"%2\">" // text and background color |
483 | "<table>" | 488 | "<table>" |
484 | "<tr>" | 489 | "<tr>" |
485 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" | 490 | "<td rowspan=\"3\" align=\"right\" valign=\"top\">" |
486 | "%3" | 491 | "%3" |
487 | "</td>" | 492 | "</td>" |
488 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name | 493 | "<td align=\"left\"><font size=\"+2\"><b>%4</b></font></td>" // name |
489 | "</tr>" | 494 | "</tr>" |
490 | "%5" // role | 495 | "%5" // role |
491 | "%6" // organization | 496 | "%6" // organization |
492 | "<td colspan=\"2\"> </td>" | 497 | "<td colspan=\"2\"> </td>" |
493 | "%7" // dynamic part | 498 | "%7" // dynamic part |
494 | "%8" // notes | 499 | "%8" // notes |
495 | "</table>" | 500 | "</table>" |
496 | "</body>" | 501 | "</body>" |
497 | "</html>") | 502 | "</html>") |
498 | //US | 503 | //US |
499 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) | 504 | .arg( /*KGlobalSettings::textColor().name()*/ "black" ) |
500 | //US | 505 | //US |
501 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) | 506 | .arg( /*KGlobalSettings::baseColor().name()*/ "white" ) |
502 | .arg( picString ) | 507 | .arg( picString ) |
503 | .arg( name ) | 508 | .arg( name ) |
504 | .arg( aRole ) | 509 | .arg( aRole ) |
505 | .arg( aOrga ) | 510 | .arg( aOrga ) |
506 | .arg( dynamicPart ) | 511 | .arg( dynamicPart ) |
507 | .arg( notes ); | 512 | .arg( notes ); |
508 | 513 | ||
509 | } else { // no picture! | 514 | } else { // no picture! |
510 | 515 | ||
511 | mText = "<table width=\"100%\">\n"; | 516 | mText = "<table width=\"100%\">\n"; |
512 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 517 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
513 | #ifdef DESKTOP_VERSION | 518 | #ifdef DESKTOP_VERSION |
514 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; | 519 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h1>"; |
515 | mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; | 520 | mText += "<font color=\"#FFFFFF\">" + name +"</font></h1>"; |
516 | #else | 521 | #else |
517 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; | 522 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"left\"><h3>"; |
518 | mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; | 523 | mText += "<font color=\"#FFFFFF\"> " + name +"</font></h3>"; |
519 | #endif | 524 | #endif |
520 | 525 | ||
521 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 526 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
522 | 527 | ||
523 | mText += "<table><td colspan=\"2\"> </td>"; | 528 | mText += "<table><td colspan=\"2\"> </td>"; |
524 | /* | 529 | /* |
525 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" | 530 | mText += QString("<tr><td align=\"right\"><b2>%1</b2></td>" |
526 | "<td align=\"left\"><b>%2</b></td></tr>" ) | 531 | "<td align=\"left\"><b>%2</b></td></tr>" ) |
527 | .arg( i18n(" ") ) | 532 | .arg( i18n(" ") ) |
528 | .arg( name ); | 533 | .arg( name ); |
529 | */ | 534 | */ |
530 | if ( ! mAddressee.role().isEmpty() ) | 535 | if ( ! mAddressee.role().isEmpty() ) |
531 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 536 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
532 | "<td align=\"left\">%2</td></tr>" ) | 537 | "<td align=\"left\">%2</td></tr>" ) |
533 | .arg( i18n(" ") ) | 538 | .arg( i18n(" ") ) |
534 | .arg( mAddressee.role()); | 539 | .arg( mAddressee.role()); |
535 | if ( ! mAddressee.organization().isEmpty() ) | 540 | if ( ! mAddressee.organization().isEmpty() ) |
536 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" | 541 | mText += QString("<tr><td align=\"right\"><b>%1</b></td>" |
537 | "<td align=\"left\">%2</td></tr>" ) | 542 | "<td align=\"left\">%2</td></tr>" ) |
538 | .arg( i18n(" ") ) | 543 | .arg( i18n(" ") ) |
539 | .arg( mAddressee.organization()); | 544 | .arg( mAddressee.organization()); |
540 | mText += dynamicPart; | 545 | mText += dynamicPart; |
541 | mText += notes; | 546 | mText += notes; |
542 | mText += "</table>"; | 547 | mText += "</table>"; |
543 | 548 | ||
544 | } | 549 | } |
545 | 550 | ||
546 | // at last display it... | 551 | // at last display it... |
547 | setText( mText ); | 552 | setText( mText ); |
548 | 553 | ||
549 | } | 554 | } |
550 | 555 | ||
551 | QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones_unsorted ,bool preferred ) | 556 | QString AddresseeView::getPhoneNumbers( KABC::PhoneNumber::List phones_unsorted ,bool preferred ) |
552 | { | 557 | { |
553 | ExternalAppHandler* eah = ExternalAppHandler::instance(); | 558 | ExternalAppHandler* eah = ExternalAppHandler::instance(); |
554 | bool kphoneAvail = eah->isPhoneAppAvailable(); | 559 | bool kphoneAvail = eah->isPhoneAppAvailable(); |
555 | bool kfaxAvail = eah->isFaxAppAvailable(); | 560 | bool kfaxAvail = eah->isFaxAppAvailable(); |
556 | bool ksmsAvail = eah->isSMSAppAvailable(); | 561 | bool ksmsAvail = eah->isSMSAppAvailable(); |
557 | bool kpagerAvail = eah->isPagerAppAvailable(); | 562 | bool kpagerAvail = eah->isPagerAppAvailable(); |
558 | bool ksipAvail = eah->isSIPAppAvailable(); | 563 | bool ksipAvail = eah->isSIPAppAvailable(); |
559 | QString dynamicPart; | 564 | QString dynamicPart; |
560 | KABC::PhoneNumber::List::ConstIterator phoneIt; | 565 | KABC::PhoneNumber::List::ConstIterator phoneIt; |
561 | QString extension; | 566 | QString extension; |
562 | int phonetype; | 567 | int phonetype; |
563 | QString sms; | 568 | QString sms; |
564 | 569 | ||
565 | KABC::PhoneNumber::List::Iterator it; | 570 | KABC::PhoneNumber::List::Iterator it; |
566 | KABC::PhoneNumber::List phones ; | 571 | KABC::PhoneNumber::List phones ; |
567 | 572 | ||
568 | PhoneNumber::TypeList tList = PhoneNumber::supportedTypeList(); | 573 | PhoneNumber::TypeList tList = PhoneNumber::supportedTypeList(); |
569 | int i = 0; | 574 | int i = 0; |
570 | int max = tList.count(); | 575 | int max = tList.count(); |
571 | while ( i < max-1 ) { | 576 | while ( i < max-1 ) { |
572 | for ( it = phones_unsorted.begin(); it != phones_unsorted.end(); ++it ) { | 577 | for ( it = phones_unsorted.begin(); it != phones_unsorted.end(); ++it ) { |
573 | if ( (*it).type() == tList[i] ) { | 578 | if ( (*it).type() == tList[i] ) { |
574 | phones.append( (*it ) ); | 579 | phones.append( (*it ) ); |
575 | break; | 580 | break; |
576 | } | 581 | } |
577 | } | 582 | } |
578 | ++i; | 583 | ++i; |
579 | } | 584 | } |
580 | for ( it = phones_unsorted.begin(); it != phones_unsorted.end(); ++it ) { | 585 | for ( it = phones_unsorted.begin(); it != phones_unsorted.end(); ++it ) { |
581 | if ( (*it).type() == tList[ max-1 ] ) | 586 | if ( (*it).type() == tList[ max-1 ] ) |
582 | phones.append( (*it ) ); | 587 | phones.append( (*it ) ); |
583 | } | 588 | } |
584 | 589 | ||
585 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { | 590 | for ( phoneIt = phones.begin(); phoneIt != phones.end(); ++phoneIt ) { |
586 | phonetype = (*phoneIt).type(); | 591 | phonetype = (*phoneIt).type(); |
587 | bool con = false; | 592 | bool con = false; |
588 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) con = true; | 593 | if ( ((phonetype & KABC::PhoneNumber::Pref) == 0 ) == preferred ) con = true; |
589 | if ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell ) con = !preferred;; | 594 | if ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell ) con = !preferred;; |
590 | if ( con ) | 595 | if ( con ) |
591 | continue; | 596 | continue; |
592 | 597 | ||
593 | if (ksmsAvail && | 598 | if (ksmsAvail && |
594 | ( | 599 | ( |
595 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || | 600 | ((phonetype & KABC::PhoneNumber::Car) == KABC::PhoneNumber::Car) || |
596 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) | 601 | ((phonetype & KABC::PhoneNumber::Cell) == KABC::PhoneNumber::Cell) |
597 | ) | 602 | ) |
598 | ) | 603 | ) |
599 | { | 604 | { |
600 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) | 605 | sms = QString("<a href=\"smsto:%1 \">(sms)</a>" ) |
601 | .arg( (*phoneIt).number() ); | 606 | .arg( (*phoneIt).number() ); |
602 | 607 | ||
603 | } | 608 | } |
604 | else | 609 | else |
605 | sms = ""; | 610 | sms = ""; |
606 | 611 | ||
607 | extension = QString::null; | 612 | extension = QString::null; |
608 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { | 613 | if ((phonetype & KABC::PhoneNumber::Fax) == KABC::PhoneNumber::Fax) { |
609 | if (kfaxAvail) extension = "faxto:"; | 614 | if (kfaxAvail) extension = "faxto:"; |
610 | } | 615 | } |
611 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { | 616 | else if ((phonetype & KABC::PhoneNumber::Pager) == KABC::PhoneNumber::Pager) { |
612 | if (kpagerAvail) extension = "pagerto:"; | 617 | if (kpagerAvail) extension = "pagerto:"; |
613 | } | 618 | } |
614 | #if 0 | 619 | #if 0 |
615 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { | 620 | else if ((phonetype & KABC::PhoneNumber::Sip) == KABC::PhoneNumber::Sip) { |
616 | if (ksipAvail) extension = "sipto:"; | 621 | if (ksipAvail) extension = "sipto:"; |
617 | } | 622 | } |
618 | #endif | 623 | #endif |
619 | else if (kphoneAvail) { | 624 | else if (kphoneAvail) { |
620 | extension = "phoneto:"; | 625 | extension = "phoneto:"; |
621 | } | 626 | } |
622 | else | 627 | else |
623 | extension = QString::null; | 628 | extension = QString::null; |
624 | 629 | ||
625 | if ( !extension.isEmpty() ) { | 630 | if ( !extension.isEmpty() ) { |
626 | dynamicPart += QString( | 631 | dynamicPart += QString( |
627 | "<tr><td align=\"right\"><b>%1</b></td>" | 632 | "<tr><td align=\"right\"><b>%1</b></td>" |
628 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) | 633 | "<td align=\"left\"><a href=\"%2%3 \">%4</a> %5</td></tr>" ) |
629 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 634 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
630 | .arg( extension ) | 635 | .arg( extension ) |
631 | .arg( (*phoneIt).number() ) | 636 | .arg( (*phoneIt).number() ) |
632 | .arg( (*phoneIt).number() ) | 637 | .arg( (*phoneIt).number() ) |
633 | .arg( sms ); | 638 | .arg( sms ); |
634 | 639 | ||
635 | } else { | 640 | } else { |
636 | dynamicPart += QString( | 641 | dynamicPart += QString( |
637 | "<tr><td align=\"right\"><b>%1</b></td>" | 642 | "<tr><td align=\"right\"><b>%1</b></td>" |
638 | "<td align=\"left\">%2 %3</td></tr>" ) | 643 | "<td align=\"left\">%2 %3</td></tr>" ) |
639 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) | 644 | .arg( KABC::PhoneNumber::typeLabel( phonetype ) ) |
640 | .arg( (*phoneIt).number() ) | 645 | .arg( (*phoneIt).number() ) |
641 | .arg( sms ); | 646 | .arg( sms ); |
642 | } | 647 | } |
643 | } | 648 | } |
644 | return dynamicPart; | 649 | return dynamicPart; |
645 | } | 650 | } |
646 | /* | 651 | /* |
647 | KABC::Addressee AddresseeView::addressee() const | 652 | KABC::Addressee AddresseeView::addressee() const |
648 | { | 653 | { |
649 | return mAddressee; | 654 | return mAddressee; |
650 | } | 655 | } |
651 | */ | 656 | */ |
652 | void AddresseeView::addTag(const QString & tag,const QString & text) | 657 | void AddresseeView::addTag(const QString & tag,const QString & text) |
653 | { | 658 | { |
654 | if ( text.isEmpty() ) | 659 | if ( text.isEmpty() ) |
655 | return; | 660 | return; |
656 | int number=text.contains("\n"); | 661 | int number=text.count("\n"); |
657 | QString str = "<" + tag + ">"; | 662 | QString str = "<" + tag + ">"; |
658 | QString tmpText=text; | 663 | QString tmpText=text; |
659 | QString tmpStr=str; | 664 | QString tmpStr=str; |
660 | if(number !=-1) | 665 | if(number !=-1) |
661 | { | 666 | { |
662 | if (number > 0) { | 667 | if (number > 0) { |
663 | int pos=0; | 668 | int pos=0; |
664 | QString tmp; | 669 | QString tmp; |
665 | for(int i=0;i<=number;i++) { | 670 | for(int i=0;i<=number;i++) { |
666 | pos=tmpText.find("\n"); | 671 | pos=tmpText.find("\n"); |
667 | tmp=tmpText.left(pos); | 672 | tmp=tmpText.left(pos); |
668 | tmpText=tmpText.right(tmpText.length()-pos-1); | 673 | tmpText=tmpText.right(tmpText.length()-pos-1); |
669 | tmpStr+=tmp+"<br>"; | 674 | tmpStr+=tmp+"<br>"; |
670 | } | 675 | } |
671 | } | 676 | } |
672 | else tmpStr += tmpText; | 677 | else tmpStr += tmpText; |
673 | tmpStr+="</" + tag + ">"; | 678 | tmpStr+="</" + tag + ">"; |
674 | mText.append(tmpStr); | 679 | mText.append(tmpStr); |
675 | } | 680 | } |
676 | else | 681 | else |
677 | { | 682 | { |
678 | str += text + "</" + tag + ">"; | 683 | str += text + "</" + tag + ">"; |
679 | mText.append(str); | 684 | mText.append(str); |
680 | } | 685 | } |
681 | } | 686 | } |
682 | 687 | ||
683 | AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, | 688 | AddresseeChooser::AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent, const char *name ) : KDialogBase(parent,name, |
684 | true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) | 689 | true ,i18n("Conflict! Please choose Adressee!"),Ok|User1|Close,Close, false) |
685 | { | 690 | { |
686 | findButton( Close )->setText( i18n("Cancel Sync")); | 691 | findButton( Close )->setText( i18n("Cancel Sync")); |
687 | findButton( Ok )->setText( i18n("Remote")); | 692 | findButton( Ok )->setText( i18n("Remote")); |
688 | findButton( User1 )->setText( i18n("Local")); | 693 | findButton( User1 )->setText( i18n("Local")); |
689 | QWidget* topframe = new QWidget( this ); | 694 | QWidget* topframe = new QWidget( this ); |
690 | setMainWidget( topframe ); | 695 | setMainWidget( topframe ); |
691 | QBoxLayout* bl; | 696 | Q3BoxLayout* bl; |
692 | if ( QApplication::desktop()->width() < 640 ) { | 697 | if ( QApplication::desktop()->width() < 640 ) { |
693 | bl = new QVBoxLayout( topframe ); | 698 | bl = new Q3VBoxLayout( topframe ); |
694 | } else { | 699 | } else { |
695 | bl = new QHBoxLayout( topframe ); | 700 | bl = new Q3HBoxLayout( topframe ); |
696 | } | 701 | } |
697 | QVBox* subframe = new QVBox( topframe ); | 702 | Q3VBox* subframe = new Q3VBox( topframe ); |
698 | bl->addWidget(subframe ); | 703 | bl->addWidget(subframe ); |
699 | QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); | 704 | QLabel* lab = new QLabel( i18n("Local Addressee"), subframe ); |
700 | if ( takeloc ) | 705 | if ( takeloc ) |
701 | lab->setBackgroundColor(Qt::green.light() ); | 706 | lab->setBackgroundColor(QColor(Qt::green).light() ); |
702 | AddresseeView * av = new AddresseeView( subframe ); | 707 | AddresseeView * av = new AddresseeView( subframe ); |
703 | av->setAddressee( loc ); | 708 | av->setAddressee( loc ); |
704 | subframe = new QVBox( topframe ); | 709 | subframe = new Q3VBox( topframe ); |
705 | bl->addWidget(subframe ); | 710 | bl->addWidget(subframe ); |
706 | lab = new QLabel( i18n("Remote Addressee"), subframe ); | 711 | lab = new QLabel( i18n("Remote Addressee"), subframe ); |
707 | if ( !takeloc ) | 712 | if ( !takeloc ) |
708 | lab->setBackgroundColor(Qt::green.light() ); | 713 | lab->setBackgroundColor(QColor(Qt::green).light() ); |
709 | av = new AddresseeView( subframe ); | 714 | av = new AddresseeView( subframe ); |
710 | av->setAddressee( rem ); | 715 | av->setAddressee( rem ); |
711 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); | 716 | QObject::connect(findButton( Ok ),SIGNAL(clicked()),this, SLOT(slot_remote())); |
712 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); | 717 | QObject::connect(this,SIGNAL(user1Clicked()),this, SLOT(slot_local())); |
713 | #ifndef DESKTOP_VERSION | 718 | #ifndef DESKTOP_VERSION |
714 | showMaximized(); | 719 | showMaximized(); |
715 | #else | 720 | #else |
716 | resize ( 640, 400 ); | 721 | resize ( 640, 400 ); |
717 | #endif | 722 | #endif |
718 | } | 723 | } |
719 | 724 | ||
720 | int AddresseeChooser::executeD( bool local ) | 725 | int AddresseeChooser::executeD( bool local ) |
721 | { | 726 | { |
722 | mSyncResult = 3; | 727 | mSyncResult = 3; |
723 | if ( local ) | 728 | if ( local ) |
724 | findButton( User1 )->setFocus(); | 729 | findButton( User1 )->setFocus(); |
725 | else | 730 | else |
726 | findButton( Ok )->setFocus(); | 731 | findButton( Ok )->setFocus(); |
727 | exec(); | 732 | exec(); |
728 | return mSyncResult; | 733 | return mSyncResult; |
729 | } | 734 | } |
730 | void AddresseeChooser::slot_remote() | 735 | void AddresseeChooser::slot_remote() |
731 | { | 736 | { |
732 | mSyncResult = 2; | 737 | mSyncResult = 2; |
733 | accept(); | 738 | accept(); |
734 | } | 739 | } |
735 | void AddresseeChooser::slot_local() | 740 | void AddresseeChooser::slot_local() |
736 | { | 741 | { |
737 | mSyncResult = 1; | 742 | mSyncResult = 1; |
738 | accept(); | 743 | accept(); |
739 | } | 744 | } |
diff --git a/kabc/addresseeview.h b/kabc/addresseeview.h index a4de085..f7ce2e0 100644 --- a/kabc/addresseeview.h +++ b/kabc/addresseeview.h | |||
@@ -1,82 +1,82 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkdepim. | 2 | This file is part of libkdepim. |
3 | 3 | ||
4 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 4 | Copyright (c) 2003 Tobias Koenig <tokoe@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 | #ifndef KPIM_ADDRESSEEVIEW_H | 22 | #ifndef KPIM_ADDRESSEEVIEW_H |
23 | #define KPIM_ADDRESSEEVIEW_H | 23 | #define KPIM_ADDRESSEEVIEW_H |
24 | 24 | ||
25 | #include <kabc/addressee.h> | 25 | #include <kabc/addressee.h> |
26 | #include <kdialogbase.h> | 26 | #include <kdialogbase.h> |
27 | 27 | ||
28 | //US #include <ktextbrowser.h> | 28 | //US #include <ktextbrowser.h> |
29 | #include <qtextbrowser.h> | 29 | #include <q3textbrowser.h> |
30 | 30 | ||
31 | namespace KABC { | 31 | namespace KABC { |
32 | 32 | ||
33 | //US class AddresseeView : public KTextBrowser | 33 | //US class AddresseeView : public KTextBrowser |
34 | class AddresseeView : public QTextBrowser | 34 | class AddresseeView : public Q3TextBrowser |
35 | { | 35 | { |
36 | 36 | ||
37 | public: | 37 | public: |
38 | AddresseeView( QWidget *parent = 0, const char *name = 0 ); | 38 | AddresseeView( QWidget *parent = 0, const char *name = 0 ); |
39 | 39 | ||
40 | /** | 40 | /** |
41 | Sets the addressee object. The addressee is displayed immediately. | 41 | Sets the addressee object. The addressee is displayed immediately. |
42 | 42 | ||
43 | @param addr The addressee object. | 43 | @param addr The addressee object. |
44 | */ | 44 | */ |
45 | void setAddressee( const KABC::Addressee& addr ); | 45 | void setAddressee( const KABC::Addressee& addr ); |
46 | void setSource(const QString& n); | 46 | void setSource(const QString& n); |
47 | /** | 47 | /** |
48 | Returns the current addressee object. | 48 | Returns the current addressee object. |
49 | */ | 49 | */ |
50 | //KABC::Addressee addressee() const; | 50 | //KABC::Addressee addressee() const; |
51 | void printMe(); | 51 | void printMe(); |
52 | static bool sFullDetailsMode; | 52 | static bool sFullDetailsMode; |
53 | private: | 53 | private: |
54 | Addressee mCurrentContact; | 54 | Addressee mCurrentContact; |
55 | //KABC::Addressee mAddressee; | 55 | //KABC::Addressee mAddressee; |
56 | QString mText; | 56 | QString mText; |
57 | QString getPhoneNumbers( KABC::PhoneNumber::List phones, bool preferred ); | 57 | QString getPhoneNumbers( KABC::PhoneNumber::List phones, bool preferred ); |
58 | void addTag(const QString & tag,const QString & text); | 58 | void addTag(const QString & tag,const QString & text); |
59 | //class AddresseeViewPrivate; | 59 | //class AddresseeViewPrivate; |
60 | //AddresseeViewPrivate *d; | 60 | //AddresseeViewPrivate *d; |
61 | }; | 61 | }; |
62 | class AddresseeChooser : public KDialogBase | 62 | class AddresseeChooser : public KDialogBase |
63 | { | 63 | { |
64 | Q_OBJECT | 64 | Q_OBJECT |
65 | 65 | ||
66 | public: | 66 | public: |
67 | AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent = 0, const char *name = 0 ); | 67 | AddresseeChooser( KABC::Addressee loc, KABC::Addressee rem, bool takeloc, QWidget *parent = 0, const char *name = 0 ); |
68 | 68 | ||
69 | int executeD( bool local ); | 69 | int executeD( bool local ); |
70 | 70 | ||
71 | private: | 71 | private: |
72 | int mSyncResult; | 72 | int mSyncResult; |
73 | 73 | ||
74 | private slots: | 74 | private slots: |
75 | void slot_remote(); | 75 | void slot_remote(); |
76 | void slot_local(); | 76 | void slot_local(); |
77 | 77 | ||
78 | }; | 78 | }; |
79 | 79 | ||
80 | } | 80 | } |
81 | 81 | ||
82 | #endif | 82 | #endif |
diff --git a/kabc/distributionlist.cpp b/kabc/distributionlist.cpp index d34ba0b..cf5afa6 100644 --- a/kabc/distributionlist.cpp +++ b/kabc/distributionlist.cpp | |||
@@ -1,292 +1,294 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <ksimpleconfig.h> | 21 | #include <ksimpleconfig.h> |
22 | #include <kstandarddirs.h> | 22 | #include <kstandarddirs.h> |
23 | #include <kdebug.h> | 23 | #include <kdebug.h> |
24 | 24 | ||
25 | #include "distributionlist.h" | 25 | #include "distributionlist.h" |
26 | //Added by qt3to4: | ||
27 | #include <Q3ValueList> | ||
26 | 28 | ||
27 | using namespace KABC; | 29 | using namespace KABC; |
28 | 30 | ||
29 | DistributionList::DistributionList( DistributionListManager *manager, | 31 | DistributionList::DistributionList( DistributionListManager *manager, |
30 | const QString &name ) : | 32 | const QString &name ) : |
31 | mManager( manager ), mName( name ) | 33 | mManager( manager ), mName( name ) |
32 | { | 34 | { |
33 | mManager->insert( this ); | 35 | mManager->insert( this ); |
34 | } | 36 | } |
35 | 37 | ||
36 | DistributionList::~DistributionList() | 38 | DistributionList::~DistributionList() |
37 | { | 39 | { |
38 | mManager->remove( this ); | 40 | mManager->remove( this ); |
39 | } | 41 | } |
40 | 42 | ||
41 | void DistributionList::setName( const QString &name ) | 43 | void DistributionList::setName( const QString &name ) |
42 | { | 44 | { |
43 | mName = name; | 45 | mName = name; |
44 | } | 46 | } |
45 | 47 | ||
46 | QString DistributionList::name() const | 48 | QString DistributionList::name() const |
47 | { | 49 | { |
48 | return mName; | 50 | return mName; |
49 | } | 51 | } |
50 | 52 | ||
51 | void DistributionList::insertEntry( const Addressee &a, const QString &email ) | 53 | void DistributionList::insertEntry( const Addressee &a, const QString &email ) |
52 | { | 54 | { |
53 | QString em = email; | 55 | QString em = email; |
54 | if (em.isNull() ) | 56 | if (em.isNull() ) |
55 | em = a.preferredEmail(); | 57 | em = a.preferredEmail(); |
56 | Entry e( a, em ); | 58 | Entry e( a, em ); |
57 | QValueList<Entry>::Iterator it; | 59 | Q3ValueList<Entry>::Iterator it; |
58 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { | 60 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { |
59 | if ( (*it).addressee.uid() == a.uid() ) { | 61 | if ( (*it).addressee.uid() == a.uid() ) { |
60 | /** | 62 | /** |
61 | We have to check if both email addresses contains no data, | 63 | We have to check if both email addresses contains no data, |
62 | a simple 'email1 == email2' wont work here | 64 | a simple 'email1 == email2' wont work here |
63 | */ | 65 | */ |
64 | if ( ( (*it).email.isNull() && em.isEmpty() ) || | 66 | if ( ( (*it).email.isNull() && em.isEmpty() ) || |
65 | ( (*it).email.isEmpty() && em.isNull() ) || | 67 | ( (*it).email.isEmpty() && em.isNull() ) || |
66 | ( (*it).email == em ) ) { | 68 | ( (*it).email == em ) ) { |
67 | //*it = e; | 69 | //*it = e; |
68 | return; | 70 | return; |
69 | } | 71 | } |
70 | } | 72 | } |
71 | } | 73 | } |
72 | mEntries.append( e ); | 74 | mEntries.append( e ); |
73 | } | 75 | } |
74 | 76 | ||
75 | void DistributionList::removeEntry( const Addressee &a, const QString &email ) | 77 | void DistributionList::removeEntry( const Addressee &a, const QString &email ) |
76 | { | 78 | { |
77 | QValueList<Entry>::Iterator it; | 79 | Q3ValueList<Entry>::Iterator it; |
78 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { | 80 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { |
79 | if ( (*it).addressee.uid() == a.uid() && (*it).email == email ) { | 81 | if ( (*it).addressee.uid() == a.uid() && (*it).email == email ) { |
80 | mEntries.remove( it ); | 82 | mEntries.remove( it ); |
81 | return; | 83 | return; |
82 | } | 84 | } |
83 | } | 85 | } |
84 | } | 86 | } |
85 | 87 | ||
86 | QStringList DistributionList::emails() const | 88 | QStringList DistributionList::emails() const |
87 | { | 89 | { |
88 | QStringList emails; | 90 | QStringList emails; |
89 | 91 | ||
90 | Entry::List::ConstIterator it; | 92 | Entry::List::ConstIterator it; |
91 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { | 93 | for( it = mEntries.begin(); it != mEntries.end(); ++it ) { |
92 | Addressee a = (*it).addressee; | 94 | Addressee a = (*it).addressee; |
93 | QString email = (*it).email.isEmpty() ? a.fullEmail() : | 95 | QString email = (*it).email.isEmpty() ? a.fullEmail() : |
94 | a.fullEmail( (*it).email ); | 96 | a.fullEmail( (*it).email ); |
95 | 97 | ||
96 | if ( !email.isEmpty() ) { | 98 | if ( !email.isEmpty() ) { |
97 | emails.append( email ); | 99 | emails.append( email ); |
98 | } | 100 | } |
99 | } | 101 | } |
100 | 102 | ||
101 | return emails; | 103 | return emails; |
102 | } | 104 | } |
103 | 105 | ||
104 | DistributionList::Entry::List DistributionList::entries() const | 106 | DistributionList::Entry::List DistributionList::entries() const |
105 | { | 107 | { |
106 | return mEntries; | 108 | return mEntries; |
107 | } | 109 | } |
108 | 110 | ||
109 | 111 | ||
110 | DistributionListManager::DistributionListManager( AddressBook *ab ) : | 112 | DistributionListManager::DistributionListManager( AddressBook *ab ) : |
111 | mAddressBook( ab ) | 113 | mAddressBook( ab ) |
112 | { | 114 | { |
113 | } | 115 | } |
114 | 116 | ||
115 | DistributionListManager::~DistributionListManager() | 117 | DistributionListManager::~DistributionListManager() |
116 | { | 118 | { |
117 | } | 119 | } |
118 | 120 | ||
119 | DistributionList *DistributionListManager::list( const QString &name ) | 121 | DistributionList *DistributionListManager::list( const QString &name ) |
120 | { | 122 | { |
121 | DistributionList *list; | 123 | DistributionList *list; |
122 | for( list = mLists.first(); list; list = mLists.next() ) { | 124 | for( list = mLists.first(); list; list = mLists.next() ) { |
123 | if ( list->name() == name ) return list; | 125 | if ( list->name() == name ) return list; |
124 | } | 126 | } |
125 | 127 | ||
126 | return 0; | 128 | return 0; |
127 | } | 129 | } |
128 | 130 | ||
129 | void DistributionListManager::insert( DistributionList *l ) | 131 | void DistributionListManager::insert( DistributionList *l ) |
130 | { | 132 | { |
131 | DistributionList *list; | 133 | DistributionList *list; |
132 | for( list = mLists.first(); list; list = mLists.next() ) { | 134 | for( list = mLists.first(); list; list = mLists.next() ) { |
133 | if ( list->name() == l->name() ) { | 135 | if ( list->name() == l->name() ) { |
134 | mLists.remove( list ); | 136 | mLists.remove( list ); |
135 | break; | 137 | break; |
136 | } | 138 | } |
137 | } | 139 | } |
138 | mLists.append( l ); | 140 | mLists.append( l ); |
139 | } | 141 | } |
140 | 142 | ||
141 | void DistributionListManager::remove( DistributionList *l ) | 143 | void DistributionListManager::remove( DistributionList *l ) |
142 | { | 144 | { |
143 | DistributionList *list; | 145 | DistributionList *list; |
144 | for( list = mLists.first(); list; list = mLists.next() ) { | 146 | for( list = mLists.first(); list; list = mLists.next() ) { |
145 | if ( list->name() == l->name() ) { | 147 | if ( list->name() == l->name() ) { |
146 | mLists.remove( list ); | 148 | mLists.remove( list ); |
147 | return; | 149 | return; |
148 | } | 150 | } |
149 | } | 151 | } |
150 | } | 152 | } |
151 | 153 | ||
152 | QStringList DistributionListManager::listNames() | 154 | QStringList DistributionListManager::listNames() |
153 | { | 155 | { |
154 | QStringList names; | 156 | QStringList names; |
155 | 157 | ||
156 | DistributionList *list; | 158 | DistributionList *list; |
157 | for( list = mLists.first(); list; list = mLists.next() ) { | 159 | for( list = mLists.first(); list; list = mLists.next() ) { |
158 | names.append( list->name() ); | 160 | names.append( list->name() ); |
159 | } | 161 | } |
160 | 162 | ||
161 | return names; | 163 | return names; |
162 | } | 164 | } |
163 | 165 | ||
164 | bool DistributionListManager::load() | 166 | bool DistributionListManager::load() |
165 | { | 167 | { |
166 | KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); | 168 | KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); |
167 | 169 | ||
168 | /*US | 170 | /*US |
169 | QMap<QString,QString> entryMap = cfg.entryMap( mAddressBook->identifier() ); | 171 | QMap<QString,QString> entryMap = cfg.entryMap( mAddressBook->identifier() ); |
170 | if ( entryMap.isEmpty() ) { | 172 | if ( entryMap.isEmpty() ) { |
171 | kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl; | 173 | kdDebug(5700) << "No distlists for '" << mAddressBook->identifier() << "'" << endl; |
172 | return false; | 174 | return false; |
173 | } | 175 | } |
174 | 176 | ||
175 | cfg.setGroup( mAddressBook->identifier() ); | 177 | cfg.setGroup( mAddressBook->identifier() ); |
176 | 178 | ||
177 | QMap<QString,QString>::ConstIterator it; | 179 | QMap<QString,QString>::ConstIterator it; |
178 | for( it = entryMap.begin(); it != entryMap.end(); ++it ) { | 180 | for( it = entryMap.begin(); it != entryMap.end(); ++it ) { |
179 | QString name = it.key(); | 181 | QString name = it.key(); |
180 | */ | 182 | */ |
181 | cfg.setGroup( mAddressBook->identifier() ); | 183 | cfg.setGroup( mAddressBook->identifier() ); |
182 | //US we work in microkde with a list of distributionlists | 184 | //US we work in microkde with a list of distributionlists |
183 | QStringList distlists = cfg.readListEntry( "__Lists__List__" ); | 185 | QStringList distlists = cfg.readListEntry( "__Lists__List__" ); |
184 | if ( distlists.isEmpty() ) { | 186 | if ( distlists.isEmpty() ) { |
185 | qDebug("no distlist for AB "); | 187 | qDebug("no distlist for AB "); |
186 | return false; | 188 | return false; |
187 | } | 189 | } |
188 | 190 | ||
189 | QStringList::ConstIterator it; | 191 | QStringList::ConstIterator it; |
190 | for( it = distlists.begin(); it != distlists.end(); ++it ) { | 192 | for( it = distlists.begin(); it != distlists.end(); ++it ) { |
191 | QString name = *it; | 193 | QString name = *it; |
192 | 194 | ||
193 | 195 | ||
194 | QStringList value = cfg.readListEntry( name ); | 196 | QStringList value = cfg.readListEntry( name ); |
195 | 197 | ||
196 | 198 | ||
197 | 199 | ||
198 | DistributionList *list = new DistributionList( this, name ); | 200 | DistributionList *list = new DistributionList( this, name ); |
199 | 201 | ||
200 | QStringList::ConstIterator it2 = value.begin(); | 202 | QStringList::ConstIterator it2 = value.begin(); |
201 | while( it2 != value.end() ) { | 203 | while( it2 != value.end() ) { |
202 | QString id = *it2++; | 204 | QString id = *it2++; |
203 | QString email = *it2; | 205 | QString email = *it2; |
204 | 206 | ||
205 | 207 | ||
206 | 208 | ||
207 | Addressee a = mAddressBook->findByUid( id ); | 209 | Addressee a = mAddressBook->findByUid( id ); |
208 | if ( !a.isEmpty() ) { | 210 | if ( !a.isEmpty() ) { |
209 | list->insertEntry( a, email ); | 211 | list->insertEntry( a, email ); |
210 | } | 212 | } |
211 | 213 | ||
212 | if ( it2 == value.end() ) break; | 214 | if ( it2 == value.end() ) break; |
213 | ++it2; | 215 | ++it2; |
214 | } | 216 | } |
215 | } | 217 | } |
216 | 218 | ||
217 | return true; | 219 | return true; |
218 | } | 220 | } |
219 | 221 | ||
220 | bool DistributionListManager::save() | 222 | bool DistributionListManager::save() |
221 | { | 223 | { |
222 | 224 | ||
223 | 225 | ||
224 | KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); | 226 | KSimpleConfig cfg( locateLocal( "data", "kabc/distlists" ) ); |
225 | 227 | ||
226 | cfg.deleteGroup( mAddressBook->identifier() ); | 228 | cfg.deleteGroup( mAddressBook->identifier() ); |
227 | cfg.setGroup( mAddressBook->identifier() ); | 229 | cfg.setGroup( mAddressBook->identifier() ); |
228 | 230 | ||
229 | DistributionList *list; | 231 | DistributionList *list; |
230 | for( list = mLists.first(); list; list = mLists.next() ) { | 232 | for( list = mLists.first(); list; list = mLists.next() ) { |
231 | kdDebug(5700) << " Saving '" << list->name() << "'" << endl; | 233 | kdDebug(5700) << " Saving '" << list->name() << "'" << endl; |
232 | QStringList value; | 234 | QStringList value; |
233 | DistributionList::Entry::List entries = list->entries(); | 235 | DistributionList::Entry::List entries = list->entries(); |
234 | DistributionList::Entry::List::ConstIterator it; | 236 | DistributionList::Entry::List::ConstIterator it; |
235 | for( it = entries.begin(); it != entries.end(); ++it ) { | 237 | for( it = entries.begin(); it != entries.end(); ++it ) { |
236 | value.append( (*it).addressee.uid() ); | 238 | value.append( (*it).addressee.uid() ); |
237 | if (( *it).email.isEmpty()) | 239 | if (( *it).email.isEmpty()) |
238 | value.append( " " ); | 240 | value.append( " " ); |
239 | else | 241 | else |
240 | value.append( (*it).email ); | 242 | value.append( (*it).email ); |
241 | // qDebug("uid *%s* email *%s* ", (*it).addressee.uid().latin1(),(*it).email.latin1() ); | 243 | // qDebug("uid *%s* email *%s* ", (*it).addressee.uid().latin1(),(*it).email.latin1() ); |
242 | } | 244 | } |
243 | cfg.writeEntry( list->name(), value ); | 245 | cfg.writeEntry( list->name(), value ); |
244 | } | 246 | } |
245 | 247 | ||
246 | //US for microKDE we have not yet sophisticated methods to load maps. | 248 | //US for microKDE we have not yet sophisticated methods to load maps. |
247 | // Because of that we store also a list of all distributionlists. | 249 | // Because of that we store also a list of all distributionlists. |
248 | QStringList namelist; | 250 | QStringList namelist; |
249 | for( list = mLists.first(); list; list = mLists.next() ) { | 251 | for( list = mLists.first(); list; list = mLists.next() ) { |
250 | namelist.append( list->name() ); | 252 | namelist.append( list->name() ); |
251 | } | 253 | } |
252 | cfg.writeEntry( "__Lists__List__", namelist ); | 254 | cfg.writeEntry( "__Lists__List__", namelist ); |
253 | 255 | ||
254 | 256 | ||
255 | 257 | ||
256 | 258 | ||
257 | 259 | ||
258 | 260 | ||
259 | cfg.sync(); | 261 | cfg.sync(); |
260 | 262 | ||
261 | return true; | 263 | return true; |
262 | } | 264 | } |
263 | #if 0 | 265 | #if 0 |
264 | DistributionListWatcher* DistributionListWatcher::mSelf = 0; | 266 | DistributionListWatcher* DistributionListWatcher::mSelf = 0; |
265 | 267 | ||
266 | DistributionListWatcher::DistributionListWatcher() | 268 | DistributionListWatcher::DistributionListWatcher() |
267 | : QObject( 0, "DistributionListWatcher" ) | 269 | : QObject( 0, "DistributionListWatcher" ) |
268 | { | 270 | { |
269 | 271 | ||
270 | mDirWatch = new KDirWatch; | 272 | mDirWatch = new KDirWatch; |
271 | mDirWatch->addFile( locateLocal( "data", "kabc/distlists" ) ); | 273 | mDirWatch->addFile( locateLocal( "data", "kabc/distlists" ) ); |
272 | 274 | ||
273 | connect( mDirWatch, SIGNAL( dirty( const QString& ) ), SIGNAL( changed() ) ); | 275 | connect( mDirWatch, SIGNAL( dirty( const QString& ) ), SIGNAL( changed() ) ); |
274 | mDirWatch->startScan(); | 276 | mDirWatch->startScan(); |
275 | } | 277 | } |
276 | 278 | ||
277 | DistributionListWatcher::~DistributionListWatcher() | 279 | DistributionListWatcher::~DistributionListWatcher() |
278 | { | 280 | { |
279 | delete mDirWatch; | 281 | delete mDirWatch; |
280 | mDirWatch = 0; | 282 | mDirWatch = 0; |
281 | } | 283 | } |
282 | 284 | ||
283 | DistributionListWatcher *DistributionListWatcher::self() | 285 | DistributionListWatcher *DistributionListWatcher::self() |
284 | { | 286 | { |
285 | if ( !mSelf ) | 287 | if ( !mSelf ) |
286 | mSelf = new DistributionListWatcher(); | 288 | mSelf = new DistributionListWatcher(); |
287 | 289 | ||
288 | return mSelf; | 290 | return mSelf; |
289 | } | 291 | } |
290 | #endif | 292 | #endif |
291 | //US #include "distributionlist.moc" | 293 | //US #include "distributionlist.moc" |
292 | 294 | ||
diff --git a/kabc/distributionlist.h b/kabc/distributionlist.h index c81e543..8d21a17 100644 --- a/kabc/distributionlist.h +++ b/kabc/distributionlist.h | |||
@@ -1,212 +1,215 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef KABC_DISTRIBUTIONLIST_H | 21 | #ifndef KABC_DISTRIBUTIONLIST_H |
22 | #define KABC_DISTRIBUTIONLIST_H | 22 | #define KABC_DISTRIBUTIONLIST_H |
23 | 23 | ||
24 | //#include <kdirwatch.h> | 24 | //#include <kdirwatch.h> |
25 | 25 | ||
26 | #include "addressbook.h" | 26 | #include "addressbook.h" |
27 | //Added by qt3to4: | ||
28 | #include <Q3ValueList> | ||
29 | #include <Q3PtrList> | ||
27 | 30 | ||
28 | namespace KABC { | 31 | namespace KABC { |
29 | 32 | ||
30 | class DistributionListManager; | 33 | class DistributionListManager; |
31 | 34 | ||
32 | /** | 35 | /** |
33 | @short Distribution list of email addresses | 36 | @short Distribution list of email addresses |
34 | 37 | ||
35 | This class represents a list of email addresses. Each email address is | 38 | This class represents a list of email addresses. Each email address is |
36 | associated with an address book entry. If the address book entry changes, the | 39 | associated with an address book entry. If the address book entry changes, the |
37 | entry in the distribution list is automatically updated. | 40 | entry in the distribution list is automatically updated. |
38 | */ | 41 | */ |
39 | class DistributionList | 42 | class DistributionList |
40 | { | 43 | { |
41 | public: | 44 | public: |
42 | /** | 45 | /** |
43 | @short Distribution List Entry | 46 | @short Distribution List Entry |
44 | 47 | ||
45 | This class represents an entry of a distribution list. It consists of an | 48 | This class represents an entry of a distribution list. It consists of an |
46 | addressee and an email address. If the email address is null, the | 49 | addressee and an email address. If the email address is null, the |
47 | preferred email address of the addressee is used. | 50 | preferred email address of the addressee is used. |
48 | */ | 51 | */ |
49 | struct Entry | 52 | struct Entry |
50 | { | 53 | { |
51 | typedef QValueList<Entry> List; | 54 | typedef Q3ValueList<Entry> List; |
52 | 55 | ||
53 | Entry() {} | 56 | Entry() {} |
54 | Entry( const Addressee &_addressee, const QString &_email ) : | 57 | Entry( const Addressee &_addressee, const QString &_email ) : |
55 | addressee( _addressee ), email( _email ) {} | 58 | addressee( _addressee ), email( _email ) {} |
56 | 59 | ||
57 | Addressee addressee; | 60 | Addressee addressee; |
58 | QString email; | 61 | QString email; |
59 | }; | 62 | }; |
60 | 63 | ||
61 | /** | 64 | /** |
62 | Create distribution list object. | 65 | Create distribution list object. |
63 | 66 | ||
64 | @param manager Managing object of this list. | 67 | @param manager Managing object of this list. |
65 | @param name Name of this list. | 68 | @param name Name of this list. |
66 | */ | 69 | */ |
67 | DistributionList( DistributionListManager *manager, const QString &name ); | 70 | DistributionList( DistributionListManager *manager, const QString &name ); |
68 | 71 | ||
69 | /** | 72 | /** |
70 | Destructor. | 73 | Destructor. |
71 | */ | 74 | */ |
72 | ~DistributionList(); | 75 | ~DistributionList(); |
73 | 76 | ||
74 | /** | 77 | /** |
75 | Set name of this list. The name is used as key by the | 78 | Set name of this list. The name is used as key by the |
76 | DistributinListManager. | 79 | DistributinListManager. |
77 | */ | 80 | */ |
78 | void setName( const QString & ); | 81 | void setName( const QString & ); |
79 | 82 | ||
80 | /** | 83 | /** |
81 | Get name of this list. | 84 | Get name of this list. |
82 | */ | 85 | */ |
83 | QString name() const; | 86 | QString name() const; |
84 | 87 | ||
85 | /** | 88 | /** |
86 | Insert an entry into this distribution list. If the entry already exists | 89 | Insert an entry into this distribution list. If the entry already exists |
87 | nothing happens. | 90 | nothing happens. |
88 | */ | 91 | */ |
89 | void insertEntry( const Addressee &, const QString &email=QString::null ); | 92 | void insertEntry( const Addressee &, const QString &email=QString::null ); |
90 | 93 | ||
91 | /** | 94 | /** |
92 | Remove an entry from this distribution list. If the entry doesn't exist | 95 | Remove an entry from this distribution list. If the entry doesn't exist |
93 | nothing happens. | 96 | nothing happens. |
94 | */ | 97 | */ |
95 | void removeEntry( const Addressee &, const QString &email=QString::null ); | 98 | void removeEntry( const Addressee &, const QString &email=QString::null ); |
96 | 99 | ||
97 | /** | 100 | /** |
98 | Return list of email addresses, which belong to this distributon list. | 101 | Return list of email addresses, which belong to this distributon list. |
99 | These addresses can be directly used by e.g. a mail client. | 102 | These addresses can be directly used by e.g. a mail client. |
100 | */ | 103 | */ |
101 | QStringList emails() const; | 104 | QStringList emails() const; |
102 | 105 | ||
103 | /** | 106 | /** |
104 | Return list of entries belonging to this distribution list. This function | 107 | Return list of entries belonging to this distribution list. This function |
105 | is mainly useful for a distribution list editor. | 108 | is mainly useful for a distribution list editor. |
106 | */ | 109 | */ |
107 | Entry::List entries() const; | 110 | Entry::List entries() const; |
108 | 111 | ||
109 | private: | 112 | private: |
110 | DistributionListManager *mManager; | 113 | DistributionListManager *mManager; |
111 | QString mName; | 114 | QString mName; |
112 | 115 | ||
113 | Entry::List mEntries; | 116 | Entry::List mEntries; |
114 | }; | 117 | }; |
115 | 118 | ||
116 | /** | 119 | /** |
117 | @short Manager of distribution lists | 120 | @short Manager of distribution lists |
118 | 121 | ||
119 | This class represents a collection of distribution lists, which are associated | 122 | This class represents a collection of distribution lists, which are associated |
120 | with a given address book. | 123 | with a given address book. |
121 | */ | 124 | */ |
122 | class DistributionListManager | 125 | class DistributionListManager |
123 | { | 126 | { |
124 | public: | 127 | public: |
125 | /** | 128 | /** |
126 | Create manager for given address book. | 129 | Create manager for given address book. |
127 | */ | 130 | */ |
128 | DistributionListManager( AddressBook * ); | 131 | DistributionListManager( AddressBook * ); |
129 | 132 | ||
130 | /** | 133 | /** |
131 | Destructor. | 134 | Destructor. |
132 | */ | 135 | */ |
133 | ~DistributionListManager(); | 136 | ~DistributionListManager(); |
134 | 137 | ||
135 | /** | 138 | /** |
136 | Return distribution list with given name. | 139 | Return distribution list with given name. |
137 | */ | 140 | */ |
138 | DistributionList *list( const QString &name ); | 141 | DistributionList *list( const QString &name ); |
139 | 142 | ||
140 | /** | 143 | /** |
141 | Insert distribution list. If a list with this name already exists, nothing | 144 | Insert distribution list. If a list with this name already exists, nothing |
142 | happens. | 145 | happens. |
143 | */ | 146 | */ |
144 | void insert( DistributionList * ); | 147 | void insert( DistributionList * ); |
145 | 148 | ||
146 | /** | 149 | /** |
147 | Remove distribution list. If a list with this name doesn't exist, nothing | 150 | Remove distribution list. If a list with this name doesn't exist, nothing |
148 | happens. | 151 | happens. |
149 | */ | 152 | */ |
150 | void remove( DistributionList * ); | 153 | void remove( DistributionList * ); |
151 | 154 | ||
152 | /** | 155 | /** |
153 | Return names of all distribution lists managed by this manager. | 156 | Return names of all distribution lists managed by this manager. |
154 | */ | 157 | */ |
155 | QStringList listNames(); | 158 | QStringList listNames(); |
156 | 159 | ||
157 | /** | 160 | /** |
158 | Load distribution lists form disk. | 161 | Load distribution lists form disk. |
159 | */ | 162 | */ |
160 | bool load(); | 163 | bool load(); |
161 | 164 | ||
162 | /** | 165 | /** |
163 | Save distribution lists to disk. | 166 | Save distribution lists to disk. |
164 | */ | 167 | */ |
165 | bool save(); | 168 | bool save(); |
166 | 169 | ||
167 | private: | 170 | private: |
168 | AddressBook *mAddressBook; | 171 | AddressBook *mAddressBook; |
169 | 172 | ||
170 | QPtrList<DistributionList> mLists; | 173 | Q3PtrList<DistributionList> mLists; |
171 | }; | 174 | }; |
172 | 175 | ||
173 | /** | 176 | /** |
174 | @short Watchdog for distribution lists | 177 | @short Watchdog for distribution lists |
175 | 178 | ||
176 | This class provides a @ref changed() signal that i emitted when the | 179 | This class provides a @ref changed() signal that i emitted when the |
177 | distribution lists has changed in some way. | 180 | distribution lists has changed in some way. |
178 | 181 | ||
179 | Exapmle: | 182 | Exapmle: |
180 | 183 | ||
181 | <pre> | 184 | <pre> |
182 | KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self() | 185 | KABC::DistributionListWatcher *watchdog = KABC::DistributionListWatcher::self() |
183 | 186 | ||
184 | connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) ); | 187 | connect( watchdog, SIGNAL( changed() ), SLOT( doSomething() ) ); |
185 | </pre> | 188 | </pre> |
186 | */ | 189 | */ |
187 | 190 | ||
188 | /* | 191 | /* |
189 | class DistributionListWatcher : public QObject | 192 | class DistributionListWatcher : public QObject |
190 | { | 193 | { |
191 | Q_OBJECT_XX | 194 | Q_OBJECT_XX |
192 | 195 | ||
193 | public: | 196 | public: |
194 | 197 | ||
195 | static DistributionListWatcher *self(); | 198 | static DistributionListWatcher *self(); |
196 | 199 | ||
197 | 200 | ||
198 | signals: | 201 | signals: |
199 | 202 | ||
200 | void changed(); | 203 | void changed(); |
201 | 204 | ||
202 | protected: | 205 | protected: |
203 | DistributionListWatcher(); | 206 | DistributionListWatcher(); |
204 | ~DistributionListWatcher(); | 207 | ~DistributionListWatcher(); |
205 | 208 | ||
206 | private: | 209 | private: |
207 | static DistributionListWatcher* mSelf; | 210 | static DistributionListWatcher* mSelf; |
208 | KDirWatch *mDirWatch; | 211 | KDirWatch *mDirWatch; |
209 | }; | 212 | }; |
210 | */ | 213 | */ |
211 | } | 214 | } |
212 | #endif | 215 | #endif |
diff --git a/kabc/distributionlistdialog.cpp b/kabc/distributionlistdialog.cpp index d2e1144..82883e6 100644 --- a/kabc/distributionlistdialog.cpp +++ b/kabc/distributionlistdialog.cpp | |||
@@ -1,394 +1,400 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qlistview.h> | 21 | #include <q3listview.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qlabel.h> | 23 | #include <qlabel.h> |
24 | #include <qpushbutton.h> | 24 | #include <qpushbutton.h> |
25 | #include <qcombobox.h> | 25 | #include <qcombobox.h> |
26 | //Added by qt3to4: | ||
27 | #include <Q3HBoxLayout> | ||
28 | #include <Q3GridLayout> | ||
29 | #include <Q3Frame> | ||
30 | #include <Q3VBoxLayout> | ||
26 | #include <klineeditdlg.h> | 31 | #include <klineeditdlg.h> |
27 | #include <qbuttongroup.h> | 32 | #include <q3buttongroup.h> |
33 | #include <Q3Button> | ||
28 | #include <qradiobutton.h> | 34 | #include <qradiobutton.h> |
29 | 35 | ||
30 | #include <klocale.h> | 36 | #include <klocale.h> |
31 | #include <kdebug.h> | 37 | #include <kdebug.h> |
32 | #include <kmessagebox.h> | 38 | #include <kmessagebox.h> |
33 | 39 | ||
34 | #include "addressbook.h" | 40 | #include "addressbook.h" |
35 | #include "addresseedialog.h" | 41 | #include "addresseedialog.h" |
36 | #include "distributionlist.h" | 42 | #include "distributionlist.h" |
37 | 43 | ||
38 | #include "distributionlistdialog.h" | 44 | #include "distributionlistdialog.h" |
39 | 45 | ||
40 | //US #include "distributionlistdialog.moc" | 46 | //US #include "distributionlistdialog.moc" |
41 | 47 | ||
42 | using namespace KABC; | 48 | using namespace KABC; |
43 | 49 | ||
44 | DistributionListDialog::DistributionListDialog( AddressBook *addressBook, QWidget *parent) | 50 | DistributionListDialog::DistributionListDialog( AddressBook *addressBook, QWidget *parent) |
45 | : KDialogBase( parent, "", true, i18n("Configure Distribution Lists"), Ok, Ok, true) | 51 | : KDialogBase( parent, "", true, i18n("Configure Distribution Lists"), Ok, Ok, true) |
46 | { | 52 | { |
47 | mEditor = new DistributionListEditorWidget( addressBook, this ); | 53 | mEditor = new DistributionListEditorWidget( addressBook, this ); |
48 | setMainWidget( mEditor ); | 54 | setMainWidget( mEditor ); |
49 | 55 | ||
50 | connect( this, SIGNAL( okClicked() ), mEditor, SLOT( save() ) ); | 56 | connect( this, SIGNAL( okClicked() ), mEditor, SLOT( save() ) ); |
51 | } | 57 | } |
52 | 58 | ||
53 | DistributionListDialog::~DistributionListDialog() | 59 | DistributionListDialog::~DistributionListDialog() |
54 | { | 60 | { |
55 | } | 61 | } |
56 | 62 | ||
57 | 63 | ||
58 | EmailSelector::EmailSelector( const QStringList &emails, const QString ¤t, | 64 | EmailSelector::EmailSelector( const QStringList &emails, const QString ¤t, |
59 | QWidget *parent ) : | 65 | QWidget *parent ) : |
60 | KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, | 66 | KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, |
61 | parent ) | 67 | parent ) |
62 | { | 68 | { |
63 | QFrame *topFrame = plainPage(); | 69 | Q3Frame *topFrame = plainPage(); |
64 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 70 | Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame ); |
65 | 71 | ||
66 | mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), | 72 | mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"), |
67 | topFrame ); | 73 | topFrame ); |
68 | topLayout->addWidget( mButtonGroup ); | 74 | topLayout->addWidget( mButtonGroup ); |
69 | 75 | ||
70 | QStringList::ConstIterator it; | 76 | QStringList::ConstIterator it; |
71 | for( it = emails.begin(); it != emails.end(); ++it ) { | 77 | for( it = emails.begin(); it != emails.end(); ++it ) { |
72 | QRadioButton *button = new QRadioButton( *it, mButtonGroup ); | 78 | QRadioButton *button = new QRadioButton( *it, mButtonGroup ); |
73 | if ( (*it) == current ) { | 79 | if ( (*it) == current ) { |
74 | button->setDown( true ); | 80 | button->setDown( true ); |
75 | } | 81 | } |
76 | } | 82 | } |
77 | } | 83 | } |
78 | 84 | ||
79 | QString EmailSelector::selected() | 85 | QString EmailSelector::selected() |
80 | { | 86 | { |
81 | QButton *button = mButtonGroup->selected(); | 87 | QAbstractButton *button = mButtonGroup->selected(); |
82 | if ( button ) return button->text(); | 88 | if ( button ) return button->text(); |
83 | return QString::null; | 89 | return QString::null; |
84 | } | 90 | } |
85 | 91 | ||
86 | QString EmailSelector::getEmail( const QStringList &emails, const QString ¤t, | 92 | QString EmailSelector::getEmail( const QStringList &emails, const QString ¤t, |
87 | QWidget *parent ) | 93 | QWidget *parent ) |
88 | { | 94 | { |
89 | EmailSelector *dlg = new EmailSelector( emails, current, parent ); | 95 | EmailSelector *dlg = new EmailSelector( emails, current, parent ); |
90 | dlg->exec(); | 96 | dlg->exec(); |
91 | 97 | ||
92 | QString result = dlg->selected(); | 98 | QString result = dlg->selected(); |
93 | 99 | ||
94 | delete dlg; | 100 | delete dlg; |
95 | 101 | ||
96 | return result; | 102 | return result; |
97 | } | 103 | } |
98 | 104 | ||
99 | class EntryItem : public QListViewItem | 105 | class EntryItem : public Q3ListViewItem |
100 | { | 106 | { |
101 | public: | 107 | public: |
102 | EntryItem( QListView *parent, const Addressee &addressee, | 108 | EntryItem( Q3ListView *parent, const Addressee &addressee, |
103 | const QString &email=QString::null ) : | 109 | const QString &email=QString::null ) : |
104 | QListViewItem( parent ), | 110 | Q3ListViewItem( parent ), |
105 | mAddressee( addressee ), | 111 | mAddressee( addressee ), |
106 | mEmail( email ) | 112 | mEmail( email ) |
107 | { | 113 | { |
108 | setText( 0, addressee.realName() ); | 114 | setText( 0, addressee.realName() ); |
109 | if( email.isEmpty() ) { | 115 | if( email.isEmpty() ) { |
110 | setText( 1, addressee.preferredEmail() ); | 116 | setText( 1, addressee.preferredEmail() ); |
111 | setText( 2, i18n("Yes") ); | 117 | setText( 2, i18n("Yes") ); |
112 | } else { | 118 | } else { |
113 | setText( 1, email ); | 119 | setText( 1, email ); |
114 | setText( 2, i18n("No") ); | 120 | setText( 2, i18n("No") ); |
115 | } | 121 | } |
116 | } | 122 | } |
117 | 123 | ||
118 | Addressee addressee() const | 124 | Addressee addressee() const |
119 | { | 125 | { |
120 | return mAddressee; | 126 | return mAddressee; |
121 | } | 127 | } |
122 | 128 | ||
123 | QString email() const | 129 | QString email() const |
124 | { | 130 | { |
125 | return mEmail; | 131 | return mEmail; |
126 | } | 132 | } |
127 | 133 | ||
128 | private: | 134 | private: |
129 | Addressee mAddressee; | 135 | Addressee mAddressee; |
130 | QString mEmail; | 136 | QString mEmail; |
131 | }; | 137 | }; |
132 | 138 | ||
133 | DistributionListEditorWidget::DistributionListEditorWidget( AddressBook *addressBook, QWidget *parent) : | 139 | DistributionListEditorWidget::DistributionListEditorWidget( AddressBook *addressBook, QWidget *parent) : |
134 | QWidget( parent ), | 140 | QWidget( parent ), |
135 | mAddressBook( addressBook ) | 141 | mAddressBook( addressBook ) |
136 | { | 142 | { |
137 | kdDebug(5700) << "DistributionListEditor()" << endl; | 143 | kdDebug(5700) << "DistributionListEditor()" << endl; |
138 | 144 | ||
139 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 145 | Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); |
140 | topLayout->setSpacing( KDialog::spacingHint() ); | 146 | topLayout->setSpacing( KDialog::spacingHint() ); |
141 | 147 | ||
142 | QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ; | 148 | Q3BoxLayout *nameLayout = new Q3HBoxLayout( topLayout) ; |
143 | 149 | ||
144 | mNameCombo = new QComboBox( this ); | 150 | mNameCombo = new QComboBox( this ); |
145 | nameLayout->addWidget( mNameCombo ); | 151 | nameLayout->addWidget( mNameCombo ); |
146 | connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) ); | 152 | connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) ); |
147 | 153 | ||
148 | mNewButton = new QPushButton( i18n("New List..."), this ); | 154 | mNewButton = new QPushButton( i18n("New List..."), this ); |
149 | nameLayout->addWidget( mNewButton ); | 155 | nameLayout->addWidget( mNewButton ); |
150 | connect( mNewButton, SIGNAL( clicked() ), SLOT( newList() ) ); | 156 | connect( mNewButton, SIGNAL( clicked() ), SLOT( newList() ) ); |
151 | 157 | ||
152 | mEditButton = new QPushButton( i18n("Rename List..."), this ); | 158 | mEditButton = new QPushButton( i18n("Rename List..."), this ); |
153 | nameLayout->addWidget( mEditButton ); | 159 | nameLayout->addWidget( mEditButton ); |
154 | connect( mEditButton, SIGNAL( clicked() ), SLOT( editList() ) ); | 160 | connect( mEditButton, SIGNAL( clicked() ), SLOT( editList() ) ); |
155 | 161 | ||
156 | mRemoveButton = new QPushButton( i18n("Remove List"), this ); | 162 | mRemoveButton = new QPushButton( i18n("Remove List"), this ); |
157 | nameLayout->addWidget( mRemoveButton ); | 163 | nameLayout->addWidget( mRemoveButton ); |
158 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeList() ) ); | 164 | connect( mRemoveButton, SIGNAL( clicked() ), SLOT( removeList() ) ); |
159 | 165 | ||
160 | QGridLayout *gridLayout = new QGridLayout( topLayout, 3, 3 ); | 166 | Q3GridLayout *gridLayout = new Q3GridLayout( topLayout, 3, 3 ); |
161 | gridLayout->setColStretch(1, 1); | 167 | gridLayout->setColStretch(1, 1); |
162 | 168 | ||
163 | QLabel *listLabel = new QLabel( i18n("Available addresses:"), this ); | 169 | QLabel *listLabel = new QLabel( i18n("Available addresses:"), this ); |
164 | gridLayout->addWidget( listLabel, 0, 0 ); | 170 | gridLayout->addWidget( listLabel, 0, 0 ); |
165 | 171 | ||
166 | mListLabel = new QLabel( this ); | 172 | mListLabel = new QLabel( this ); |
167 | gridLayout->addMultiCellWidget( mListLabel, 0, 0, 1, 2 ); | 173 | gridLayout->addMultiCellWidget( mListLabel, 0, 0, 1, 2 ); |
168 | 174 | ||
169 | mAddresseeView = new QListView( this ); | 175 | mAddresseeView = new Q3ListView( this ); |
170 | mAddresseeView->addColumn( i18n("Name") ); | 176 | mAddresseeView->addColumn( i18n("Name") ); |
171 | mAddresseeView->addColumn( i18n("Preferred Email") ); | 177 | mAddresseeView->addColumn( i18n("Preferred Email") ); |
172 | mAddresseeView->setAllColumnsShowFocus( true ); | 178 | mAddresseeView->setAllColumnsShowFocus( true ); |
173 | gridLayout->addWidget( mAddresseeView, 1, 0 ); | 179 | gridLayout->addWidget( mAddresseeView, 1, 0 ); |
174 | connect( mAddresseeView, SIGNAL( selectionChanged() ), | 180 | connect( mAddresseeView, SIGNAL( selectionChanged() ), |
175 | SLOT( slotSelectionAddresseeViewChanged() ) ); | 181 | SLOT( slotSelectionAddresseeViewChanged() ) ); |
176 | connect( mAddresseeView, SIGNAL( doubleClicked( QListViewItem * ) ), | 182 | connect( mAddresseeView, SIGNAL( doubleClicked( Q3ListViewItem * ) ), |
177 | SLOT( addEntry() ) ); | 183 | SLOT( addEntry() ) ); |
178 | 184 | ||
179 | mAddEntryButton = new QPushButton( i18n("Add Entry"), this ); | 185 | mAddEntryButton = new QPushButton( i18n("Add Entry"), this ); |
180 | mAddEntryButton->setEnabled(false); | 186 | mAddEntryButton->setEnabled(false); |
181 | gridLayout->addWidget( mAddEntryButton, 2, 0 ); | 187 | gridLayout->addWidget( mAddEntryButton, 2, 0 ); |
182 | connect( mAddEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) ); | 188 | connect( mAddEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) ); |
183 | 189 | ||
184 | mEntryView = new QListView( this ); | 190 | mEntryView = new Q3ListView( this ); |
185 | mEntryView->addColumn( i18n("Name") ); | 191 | mEntryView->addColumn( i18n("Name") ); |
186 | mEntryView->addColumn( i18n("Email") ); | 192 | mEntryView->addColumn( i18n("Email") ); |
187 | mEntryView->addColumn( i18n("Use Preferred") ); | 193 | mEntryView->addColumn( i18n("Use Preferred") ); |
188 | mEntryView->setEnabled(false); | 194 | mEntryView->setEnabled(false); |
189 | mEntryView->setAllColumnsShowFocus( true ); | 195 | mEntryView->setAllColumnsShowFocus( true ); |
190 | gridLayout->addMultiCellWidget( mEntryView, 1, 1, 1, 2 ); | 196 | gridLayout->addMultiCellWidget( mEntryView, 1, 1, 1, 2 ); |
191 | connect( mEntryView, SIGNAL( selectionChanged() ), | 197 | connect( mEntryView, SIGNAL( selectionChanged() ), |
192 | SLOT( slotSelectionEntryViewChanged() ) ); | 198 | SLOT( slotSelectionEntryViewChanged() ) ); |
193 | 199 | ||
194 | mChangeEmailButton = new QPushButton( i18n("Change Email..."), this ); | 200 | mChangeEmailButton = new QPushButton( i18n("Change Email..."), this ); |
195 | gridLayout->addWidget( mChangeEmailButton, 2, 1 ); | 201 | gridLayout->addWidget( mChangeEmailButton, 2, 1 ); |
196 | connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); | 202 | connect( mChangeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); |
197 | 203 | ||
198 | mRemoveEntryButton = new QPushButton( i18n("Remove Entry"), this ); | 204 | mRemoveEntryButton = new QPushButton( i18n("Remove Entry"), this ); |
199 | gridLayout->addWidget( mRemoveEntryButton, 2, 2 ); | 205 | gridLayout->addWidget( mRemoveEntryButton, 2, 2 ); |
200 | connect( mRemoveEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) ); | 206 | connect( mRemoveEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) ); |
201 | 207 | ||
202 | mManager = new DistributionListManager( mAddressBook ); | 208 | mManager = new DistributionListManager( mAddressBook ); |
203 | mManager->load(); | 209 | mManager->load(); |
204 | 210 | ||
205 | updateAddresseeView(); | 211 | updateAddresseeView(); |
206 | updateNameCombo(); | 212 | updateNameCombo(); |
207 | } | 213 | } |
208 | 214 | ||
209 | DistributionListEditorWidget::~DistributionListEditorWidget() | 215 | DistributionListEditorWidget::~DistributionListEditorWidget() |
210 | { | 216 | { |
211 | kdDebug(5700) << "~DistributionListEditor()" << endl; | 217 | kdDebug(5700) << "~DistributionListEditor()" << endl; |
212 | 218 | ||
213 | delete mManager; | 219 | delete mManager; |
214 | } | 220 | } |
215 | 221 | ||
216 | void DistributionListEditorWidget::save() | 222 | void DistributionListEditorWidget::save() |
217 | { | 223 | { |
218 | mManager->save(); | 224 | mManager->save(); |
219 | } | 225 | } |
220 | 226 | ||
221 | void DistributionListEditorWidget::slotSelectionEntryViewChanged() | 227 | void DistributionListEditorWidget::slotSelectionEntryViewChanged() |
222 | { | 228 | { |
223 | EntryItem *entryItem = static_cast<EntryItem *>( mEntryView->selectedItem() ); | 229 | EntryItem *entryItem = static_cast<EntryItem *>( mEntryView->selectedItem() ); |
224 | bool state=entryItem; | 230 | bool state=entryItem; |
225 | 231 | ||
226 | mChangeEmailButton->setEnabled(state); | 232 | mChangeEmailButton->setEnabled(state); |
227 | mRemoveEntryButton->setEnabled(state); | 233 | mRemoveEntryButton->setEnabled(state); |
228 | } | 234 | } |
229 | 235 | ||
230 | void DistributionListEditorWidget::newList() | 236 | void DistributionListEditorWidget::newList() |
231 | { | 237 | { |
232 | KLineEditDlg dlg(i18n("Please enter name:"), QString::null, this); | 238 | KLineEditDlg dlg(i18n("Please enter name:"), QString::null, this); |
233 | dlg.setCaption(i18n("New Distribution List")); | 239 | dlg.setCaption(i18n("New Distribution List")); |
234 | if (!dlg.exec()) return; | 240 | if (!dlg.exec()) return; |
235 | 241 | ||
236 | new DistributionList( mManager, dlg.text() ); | 242 | new DistributionList( mManager, dlg.text() ); |
237 | 243 | ||
238 | mNameCombo->clear(); | 244 | mNameCombo->clear(); |
239 | mNameCombo->insertStringList( mManager->listNames() ); | 245 | mNameCombo->insertStringList( mManager->listNames() ); |
240 | mNameCombo->setCurrentItem( mNameCombo->count() - 1 ); | 246 | mNameCombo->setCurrentItem( mNameCombo->count() - 1 ); |
241 | 247 | ||
242 | updateEntryView(); | 248 | updateEntryView(); |
243 | slotSelectionAddresseeViewChanged(); | 249 | slotSelectionAddresseeViewChanged(); |
244 | } | 250 | } |
245 | 251 | ||
246 | void DistributionListEditorWidget::editList() | 252 | void DistributionListEditorWidget::editList() |
247 | { | 253 | { |
248 | QString oldName = mNameCombo->currentText(); | 254 | QString oldName = mNameCombo->currentText(); |
249 | 255 | ||
250 | KLineEditDlg dlg(i18n("Please change name:"), oldName, this); | 256 | KLineEditDlg dlg(i18n("Please change name:"), oldName, this); |
251 | dlg.setCaption(i18n("Distribution List")); | 257 | dlg.setCaption(i18n("Distribution List")); |
252 | if (!dlg.exec()) return; | 258 | if (!dlg.exec()) return; |
253 | 259 | ||
254 | DistributionList *list = mManager->list( oldName ); | 260 | DistributionList *list = mManager->list( oldName ); |
255 | list->setName( dlg.text() ); | 261 | list->setName( dlg.text() ); |
256 | 262 | ||
257 | mNameCombo->clear(); | 263 | mNameCombo->clear(); |
258 | mNameCombo->insertStringList( mManager->listNames() ); | 264 | mNameCombo->insertStringList( mManager->listNames() ); |
259 | mNameCombo->setCurrentItem( mNameCombo->count() - 1 ); | 265 | mNameCombo->setCurrentItem( mNameCombo->count() - 1 ); |
260 | 266 | ||
261 | updateEntryView(); | 267 | updateEntryView(); |
262 | slotSelectionAddresseeViewChanged(); | 268 | slotSelectionAddresseeViewChanged(); |
263 | } | 269 | } |
264 | 270 | ||
265 | void DistributionListEditorWidget::removeList() | 271 | void DistributionListEditorWidget::removeList() |
266 | { | 272 | { |
267 | int result = KMessageBox::warningContinueCancel( this, | 273 | int result = KMessageBox::warningContinueCancel( this, |
268 | i18n("Delete distribution list '%1'?") .arg( mNameCombo->currentText() ), | 274 | i18n("Delete distribution list '%1'?") .arg( mNameCombo->currentText() ), |
269 | QString::null, i18n("Delete") ); | 275 | QString::null, i18n("Delete") ); |
270 | 276 | ||
271 | if ( result != KMessageBox::Continue ) return; | 277 | if ( result != KMessageBox::Continue ) return; |
272 | 278 | ||
273 | delete mManager->list( mNameCombo->currentText() ); | 279 | delete mManager->list( mNameCombo->currentText() ); |
274 | mNameCombo->removeItem( mNameCombo->currentItem() ); | 280 | mNameCombo->removeItem( mNameCombo->currentItem() ); |
275 | 281 | ||
276 | updateEntryView(); | 282 | updateEntryView(); |
277 | slotSelectionAddresseeViewChanged(); | 283 | slotSelectionAddresseeViewChanged(); |
278 | } | 284 | } |
279 | 285 | ||
280 | void DistributionListEditorWidget::addEntry() | 286 | void DistributionListEditorWidget::addEntry() |
281 | { | 287 | { |
282 | AddresseeItem *addresseeItem = | 288 | AddresseeItem *addresseeItem = |
283 | static_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); | 289 | static_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); |
284 | 290 | ||
285 | if( !addresseeItem ) { | 291 | if( !addresseeItem ) { |
286 | kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl; | 292 | kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl; |
287 | return; | 293 | return; |
288 | } | 294 | } |
289 | 295 | ||
290 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 296 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
291 | if ( !list ) { | 297 | if ( !list ) { |
292 | kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl; | 298 | kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl; |
293 | return; | 299 | return; |
294 | } | 300 | } |
295 | 301 | ||
296 | list->insertEntry( addresseeItem->addressee() ); | 302 | list->insertEntry( addresseeItem->addressee() ); |
297 | updateEntryView(); | 303 | updateEntryView(); |
298 | slotSelectionAddresseeViewChanged(); | 304 | slotSelectionAddresseeViewChanged(); |
299 | } | 305 | } |
300 | 306 | ||
301 | void DistributionListEditorWidget::removeEntry() | 307 | void DistributionListEditorWidget::removeEntry() |
302 | { | 308 | { |
303 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 309 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
304 | if ( !list ) return; | 310 | if ( !list ) return; |
305 | 311 | ||
306 | EntryItem *entryItem = | 312 | EntryItem *entryItem = |
307 | static_cast<EntryItem *>( mEntryView->selectedItem() ); | 313 | static_cast<EntryItem *>( mEntryView->selectedItem() ); |
308 | if ( !entryItem ) return; | 314 | if ( !entryItem ) return; |
309 | 315 | ||
310 | list->removeEntry( entryItem->addressee(), entryItem->email() ); | 316 | list->removeEntry( entryItem->addressee(), entryItem->email() ); |
311 | delete entryItem; | 317 | delete entryItem; |
312 | } | 318 | } |
313 | 319 | ||
314 | void DistributionListEditorWidget::changeEmail() | 320 | void DistributionListEditorWidget::changeEmail() |
315 | { | 321 | { |
316 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 322 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
317 | if ( !list ) return; | 323 | if ( !list ) return; |
318 | 324 | ||
319 | EntryItem *entryItem = | 325 | EntryItem *entryItem = |
320 | static_cast<EntryItem *>( mEntryView->selectedItem() ); | 326 | static_cast<EntryItem *>( mEntryView->selectedItem() ); |
321 | if ( !entryItem ) return; | 327 | if ( !entryItem ) return; |
322 | 328 | ||
323 | QString email = EmailSelector::getEmail( entryItem->addressee().emails(), | 329 | QString email = EmailSelector::getEmail( entryItem->addressee().emails(), |
324 | entryItem->email(), this ); | 330 | entryItem->email(), this ); |
325 | list->removeEntry( entryItem->addressee(), entryItem->email() ); | 331 | list->removeEntry( entryItem->addressee(), entryItem->email() ); |
326 | list->insertEntry( entryItem->addressee(), email ); | 332 | list->insertEntry( entryItem->addressee(), email ); |
327 | 333 | ||
328 | updateEntryView(); | 334 | updateEntryView(); |
329 | } | 335 | } |
330 | 336 | ||
331 | void DistributionListEditorWidget::updateEntryView() | 337 | void DistributionListEditorWidget::updateEntryView() |
332 | { | 338 | { |
333 | if ( mNameCombo->currentText().isEmpty() ) { | 339 | if ( mNameCombo->currentText().isEmpty() ) { |
334 | mListLabel->setText( i18n("Selected addressees:") ); | 340 | mListLabel->setText( i18n("Selected addressees:") ); |
335 | } else { | 341 | } else { |
336 | mListLabel->setText( i18n("Selected addresses in '%1':") | 342 | mListLabel->setText( i18n("Selected addresses in '%1':") |
337 | .arg( mNameCombo->currentText() ) ); | 343 | .arg( mNameCombo->currentText() ) ); |
338 | } | 344 | } |
339 | 345 | ||
340 | mEntryView->clear(); | 346 | mEntryView->clear(); |
341 | 347 | ||
342 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 348 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
343 | if ( !list ) { | 349 | if ( !list ) { |
344 | mEditButton->setEnabled(false); | 350 | mEditButton->setEnabled(false); |
345 | mRemoveButton->setEnabled(false); | 351 | mRemoveButton->setEnabled(false); |
346 | mChangeEmailButton->setEnabled(false); | 352 | mChangeEmailButton->setEnabled(false); |
347 | mRemoveEntryButton->setEnabled(false); | 353 | mRemoveEntryButton->setEnabled(false); |
348 | mAddresseeView->setEnabled(false); | 354 | mAddresseeView->setEnabled(false); |
349 | mEntryView->setEnabled(false); | 355 | mEntryView->setEnabled(false); |
350 | return; | 356 | return; |
351 | } else { | 357 | } else { |
352 | mEditButton->setEnabled(true); | 358 | mEditButton->setEnabled(true); |
353 | mRemoveButton->setEnabled(true); | 359 | mRemoveButton->setEnabled(true); |
354 | mAddresseeView->setEnabled(true); | 360 | mAddresseeView->setEnabled(true); |
355 | mEntryView->setEnabled(true); | 361 | mEntryView->setEnabled(true); |
356 | } | 362 | } |
357 | 363 | ||
358 | DistributionList::Entry::List entries = list->entries(); | 364 | DistributionList::Entry::List entries = list->entries(); |
359 | DistributionList::Entry::List::ConstIterator it; | 365 | DistributionList::Entry::List::ConstIterator it; |
360 | for( it = entries.begin(); it != entries.end(); ++it ) { | 366 | for( it = entries.begin(); it != entries.end(); ++it ) { |
361 | new EntryItem( mEntryView, (*it).addressee, (*it).email ); | 367 | new EntryItem( mEntryView, (*it).addressee, (*it).email ); |
362 | } | 368 | } |
363 | 369 | ||
364 | EntryItem *entryItem = static_cast<EntryItem *>( mEntryView->selectedItem() ); | 370 | EntryItem *entryItem = static_cast<EntryItem *>( mEntryView->selectedItem() ); |
365 | bool state=entryItem; | 371 | bool state=entryItem; |
366 | 372 | ||
367 | mChangeEmailButton->setEnabled(state); | 373 | mChangeEmailButton->setEnabled(state); |
368 | mRemoveEntryButton->setEnabled(state); | 374 | mRemoveEntryButton->setEnabled(state); |
369 | } | 375 | } |
370 | 376 | ||
371 | void DistributionListEditorWidget::updateAddresseeView() | 377 | void DistributionListEditorWidget::updateAddresseeView() |
372 | { | 378 | { |
373 | mAddresseeView->clear(); | 379 | mAddresseeView->clear(); |
374 | 380 | ||
375 | AddressBook::Iterator it; | 381 | AddressBook::Iterator it; |
376 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 382 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
377 | new AddresseeItem( mAddresseeView, *it ); | 383 | new AddresseeItem( mAddresseeView, *it ); |
378 | } | 384 | } |
379 | } | 385 | } |
380 | 386 | ||
381 | void DistributionListEditorWidget::updateNameCombo() | 387 | void DistributionListEditorWidget::updateNameCombo() |
382 | { | 388 | { |
383 | mNameCombo->insertStringList( mManager->listNames() ); | 389 | mNameCombo->insertStringList( mManager->listNames() ); |
384 | 390 | ||
385 | updateEntryView(); | 391 | updateEntryView(); |
386 | } | 392 | } |
387 | 393 | ||
388 | void DistributionListEditorWidget::slotSelectionAddresseeViewChanged() | 394 | void DistributionListEditorWidget::slotSelectionAddresseeViewChanged() |
389 | { | 395 | { |
390 | AddresseeItem *addresseeItem = | 396 | AddresseeItem *addresseeItem = |
391 | static_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); | 397 | static_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); |
392 | bool state=addresseeItem; | 398 | bool state=addresseeItem; |
393 | mAddEntryButton->setEnabled( state && !mNameCombo->currentText().isEmpty()); | 399 | mAddEntryButton->setEnabled( state && !mNameCombo->currentText().isEmpty()); |
394 | } | 400 | } |
diff --git a/kabc/distributionlistdialog.h b/kabc/distributionlistdialog.h index b6d3c80..3627431 100644 --- a/kabc/distributionlistdialog.h +++ b/kabc/distributionlistdialog.h | |||
@@ -1,140 +1,142 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef KABC_DISTRIBUTIONLISTDIALOG_H | 21 | #ifndef KABC_DISTRIBUTIONLISTDIALOG_H |
22 | #define KABC_DISTRIBUTIONLISTDIALOG_H | 22 | #define KABC_DISTRIBUTIONLISTDIALOG_H |
23 | 23 | ||
24 | #include <qwidget.h> | 24 | #include <qwidget.h> |
25 | //Added by qt3to4: | ||
26 | #include <QLabel> | ||
25 | 27 | ||
26 | #include <kdialogbase.h> | 28 | #include <kdialogbase.h> |
27 | 29 | ||
28 | class QListView; | 30 | class Q3ListView; |
29 | class QLabel; | 31 | class QLabel; |
30 | class QComboBox; | 32 | class QComboBox; |
31 | class QButtonGroup; | 33 | class Q3ButtonGroup; |
32 | 34 | ||
33 | namespace KABC { | 35 | namespace KABC { |
34 | 36 | ||
35 | class AddressBook; | 37 | class AddressBook; |
36 | class DistributionListEditorWidget; | 38 | class DistributionListEditorWidget; |
37 | class DistributionListManager; | 39 | class DistributionListManager; |
38 | 40 | ||
39 | /** | 41 | /** |
40 | @short Frontend to create distribution lists | 42 | @short Frontend to create distribution lists |
41 | 43 | ||
42 | Creating a new DistributionListDialog does automatically | 44 | Creating a new DistributionListDialog does automatically |
43 | load all addressees and distribution lists from the config | 45 | load all addressees and distribution lists from the config |
44 | files. The changes will be saved when clicking the 'OK' | 46 | files. The changes will be saved when clicking the 'OK' |
45 | button. | 47 | button. |
46 | 48 | ||
47 | Example: | 49 | Example: |
48 | 50 | ||
49 | <pre> | 51 | <pre> |
50 | KABC::DistributionListDialog *dlg = new | 52 | KABC::DistributionListDialog *dlg = new |
51 | KABC::DistributionListDialog( KABC::StdAddressBook::self(), this ); | 53 | KABC::DistributionListDialog( KABC::StdAddressBook::self(), this ); |
52 | 54 | ||
53 | dlg->exec(); | 55 | dlg->exec(); |
54 | </pre> | 56 | </pre> |
55 | */ | 57 | */ |
56 | class DistributionListDialog : public KDialogBase | 58 | class DistributionListDialog : public KDialogBase |
57 | { | 59 | { |
58 | Q_OBJECT | 60 | Q_OBJECT |
59 | 61 | ||
60 | public: | 62 | public: |
61 | /** | 63 | /** |
62 | Constructor. | 64 | Constructor. |
63 | 65 | ||
64 | @param ab The addressbook, the addressees should be used from | 66 | @param ab The addressbook, the addressees should be used from |
65 | @param parent The parent widget | 67 | @param parent The parent widget |
66 | */ | 68 | */ |
67 | DistributionListDialog( AddressBook *ab, QWidget *parent ); | 69 | DistributionListDialog( AddressBook *ab, QWidget *parent ); |
68 | 70 | ||
69 | /** | 71 | /** |
70 | Destructor. | 72 | Destructor. |
71 | */ | 73 | */ |
72 | virtual ~DistributionListDialog(); | 74 | virtual ~DistributionListDialog(); |
73 | 75 | ||
74 | private: | 76 | private: |
75 | DistributionListEditorWidget *mEditor; | 77 | DistributionListEditorWidget *mEditor; |
76 | 78 | ||
77 | struct Data; | 79 | struct Data; |
78 | Data *d; | 80 | Data *d; |
79 | }; | 81 | }; |
80 | 82 | ||
81 | /** | 83 | /** |
82 | @short Helper class | 84 | @short Helper class |
83 | */ | 85 | */ |
84 | class EmailSelector : public KDialogBase | 86 | class EmailSelector : public KDialogBase |
85 | { | 87 | { |
86 | public: | 88 | public: |
87 | EmailSelector( const QStringList &emails, const QString ¤t, | 89 | EmailSelector( const QStringList &emails, const QString ¤t, |
88 | QWidget *parent ); | 90 | QWidget *parent ); |
89 | 91 | ||
90 | QString selected(); | 92 | QString selected(); |
91 | 93 | ||
92 | static QString getEmail( const QStringList &emails, const QString ¤t, | 94 | static QString getEmail( const QStringList &emails, const QString ¤t, |
93 | QWidget *parent ); | 95 | QWidget *parent ); |
94 | 96 | ||
95 | private: | 97 | private: |
96 | QButtonGroup *mButtonGroup; | 98 | Q3ButtonGroup *mButtonGroup; |
97 | }; | 99 | }; |
98 | 100 | ||
99 | /** | 101 | /** |
100 | @short Helper class | 102 | @short Helper class |
101 | */ | 103 | */ |
102 | class DistributionListEditorWidget : public QWidget | 104 | class DistributionListEditorWidget : public QWidget |
103 | { | 105 | { |
104 | Q_OBJECT | 106 | Q_OBJECT |
105 | 107 | ||
106 | public: | 108 | public: |
107 | DistributionListEditorWidget( AddressBook *, QWidget *parent ); | 109 | DistributionListEditorWidget( AddressBook *, QWidget *parent ); |
108 | virtual ~DistributionListEditorWidget(); | 110 | virtual ~DistributionListEditorWidget(); |
109 | 111 | ||
110 | private slots: | 112 | private slots: |
111 | void newList(); | 113 | void newList(); |
112 | void editList(); | 114 | void editList(); |
113 | void removeList(); | 115 | void removeList(); |
114 | void addEntry(); | 116 | void addEntry(); |
115 | void removeEntry(); | 117 | void removeEntry(); |
116 | void changeEmail(); | 118 | void changeEmail(); |
117 | void updateEntryView(); | 119 | void updateEntryView(); |
118 | void updateAddresseeView(); | 120 | void updateAddresseeView(); |
119 | void updateNameCombo(); | 121 | void updateNameCombo(); |
120 | void slotSelectionEntryViewChanged(); | 122 | void slotSelectionEntryViewChanged(); |
121 | void slotSelectionAddresseeViewChanged(); | 123 | void slotSelectionAddresseeViewChanged(); |
122 | void save(); | 124 | void save(); |
123 | 125 | ||
124 | private: | 126 | private: |
125 | QComboBox *mNameCombo; | 127 | QComboBox *mNameCombo; |
126 | QLabel *mListLabel; | 128 | QLabel *mListLabel; |
127 | QListView *mEntryView; | 129 | Q3ListView *mEntryView; |
128 | QListView *mAddresseeView; | 130 | Q3ListView *mAddresseeView; |
129 | 131 | ||
130 | AddressBook *mAddressBook; | 132 | AddressBook *mAddressBook; |
131 | DistributionListManager *mManager; | 133 | DistributionListManager *mManager; |
132 | QPushButton *mNewButton, *mEditButton, *mRemoveButton; | 134 | QPushButton *mNewButton, *mEditButton, *mRemoveButton; |
133 | QPushButton *mChangeEmailButton, *mRemoveEntryButton, *mAddEntryButton; | 135 | QPushButton *mChangeEmailButton, *mRemoveEntryButton, *mAddEntryButton; |
134 | 136 | ||
135 | struct Data; | 137 | struct Data; |
136 | Data *d; | 138 | Data *d; |
137 | }; | 139 | }; |
138 | 140 | ||
139 | } | 141 | } |
140 | #endif | 142 | #endif |
diff --git a/kabc/distributionlisteditor.cpp b/kabc/distributionlisteditor.cpp index 9f5840b..ca5ecb7 100644 --- a/kabc/distributionlisteditor.cpp +++ b/kabc/distributionlisteditor.cpp | |||
@@ -1,322 +1,326 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qlistview.h> | 21 | #include <q3listview.h> |
22 | #include <qlayout.h> | 22 | #include <qlayout.h> |
23 | #include <qpushbutton.h> | 23 | #include <qpushbutton.h> |
24 | #include <qcombobox.h> | 24 | #include <qcombobox.h> |
25 | #ifdef DESKTOP_VERSION | 25 | #ifdef DESKTOP_VERSION |
26 | #include <qinputdialog.h> | 26 | #include <qinputdialog.h> |
27 | #else | 27 | #else |
28 | #include <qtcompat/qinputdialog.h> | 28 | #include <qtcompat/qinputdialog.h> |
29 | #endif | 29 | #endif |
30 | #include <qbuttongroup.h> | 30 | #include <q3buttongroup.h> |
31 | #include <qradiobutton.h> | 31 | #include <qradiobutton.h> |
32 | //Added by qt3to4: | ||
33 | #include <Q3HBoxLayout> | ||
34 | #include <Q3Frame> | ||
35 | #include <Q3VBoxLayout> | ||
32 | 36 | ||
33 | #include <klocale.h> | 37 | #include <klocale.h> |
34 | #include <kdebug.h> | 38 | #include <kdebug.h> |
35 | 39 | ||
36 | #include "addressbook.h" | 40 | #include "addressbook.h" |
37 | #include "addresseedialog.h" | 41 | #include "addresseedialog.h" |
38 | #include "distributionlist.h" | 42 | #include "distributionlist.h" |
39 | 43 | ||
40 | #include "distributionlisteditor.h" | 44 | #include "distributionlisteditor.h" |
41 | 45 | ||
42 | //US #include "distributionlisteditor.moc" | 46 | //US #include "distributionlisteditor.moc" |
43 | 47 | ||
44 | using namespace KABC; | 48 | using namespace KABC; |
45 | 49 | ||
46 | EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString ¤t, | 50 | EmailSelectDialog::EmailSelectDialog( const QStringList &emails, const QString ¤t, |
47 | QWidget *parent ) : | 51 | QWidget *parent ) : |
48 | KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, | 52 | KDialogBase( KDialogBase::Plain, i18n("Select Email Address"), Ok, Ok, |
49 | parent ) | 53 | parent ) |
50 | { | 54 | { |
51 | QFrame *topFrame = plainPage(); | 55 | Q3Frame *topFrame = plainPage(); |
52 | QBoxLayout *topLayout = new QVBoxLayout( topFrame ); | 56 | Q3BoxLayout *topLayout = new Q3VBoxLayout( topFrame ); |
53 | 57 | ||
54 | mButtonGroup = new QButtonGroup( 1, Horizontal, i18n("Email Addresses"), | 58 | mButtonGroup = new Q3ButtonGroup( 1, Qt::Horizontal, i18n("Email Addresses"), |
55 | topFrame ); | 59 | topFrame ); |
56 | topLayout->addWidget( mButtonGroup ); | 60 | topLayout->addWidget( mButtonGroup ); |
57 | 61 | ||
58 | QStringList::ConstIterator it; | 62 | QStringList::ConstIterator it; |
59 | for( it = emails.begin(); it != emails.end(); ++it ) { | 63 | for( it = emails.begin(); it != emails.end(); ++it ) { |
60 | QRadioButton *button = new QRadioButton( *it, mButtonGroup ); | 64 | QRadioButton *button = new QRadioButton( *it, mButtonGroup ); |
61 | if ( (*it) == current ) { | 65 | if ( (*it) == current ) { |
62 | button->setDown( true ); | 66 | button->setDown( true ); |
63 | } | 67 | } |
64 | } | 68 | } |
65 | } | 69 | } |
66 | 70 | ||
67 | QString EmailSelectDialog::selected() | 71 | QString EmailSelectDialog::selected() |
68 | { | 72 | { |
69 | QButton *button = mButtonGroup->selected(); | 73 | QAbstractButton *button = mButtonGroup->selected(); |
70 | if ( button ) return button->text(); | 74 | if ( button ) return button->text(); |
71 | return QString::null; | 75 | return QString::null; |
72 | } | 76 | } |
73 | 77 | ||
74 | QString EmailSelectDialog::getEmail( const QStringList &emails, const QString ¤t, | 78 | QString EmailSelectDialog::getEmail( const QStringList &emails, const QString ¤t, |
75 | QWidget *parent ) | 79 | QWidget *parent ) |
76 | { | 80 | { |
77 | 81 | ||
78 | EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); | 82 | EmailSelectDialog *dlg = new EmailSelectDialog( emails, current, parent ); |
79 | dlg->exec(); | 83 | dlg->exec(); |
80 | 84 | ||
81 | QString result = dlg->selected(); | 85 | QString result = dlg->selected(); |
82 | 86 | ||
83 | delete dlg; | 87 | delete dlg; |
84 | 88 | ||
85 | return result; | 89 | return result; |
86 | } | 90 | } |
87 | 91 | ||
88 | class EditEntryItem : public QListViewItem | 92 | class EditEntryItem : public Q3ListViewItem |
89 | { | 93 | { |
90 | public: | 94 | public: |
91 | EditEntryItem( QListView *parent, const Addressee &addressee, | 95 | EditEntryItem( Q3ListView *parent, const Addressee &addressee, |
92 | const QString &email=QString::null ) : | 96 | const QString &email=QString::null ) : |
93 | QListViewItem( parent ), | 97 | Q3ListViewItem( parent ), |
94 | mAddressee( addressee ), | 98 | mAddressee( addressee ), |
95 | mEmail( email ) | 99 | mEmail( email ) |
96 | { | 100 | { |
97 | setText( 0, addressee.realName() ); | 101 | setText( 0, addressee.realName() ); |
98 | if( email.isEmpty() ) { | 102 | if( email.isEmpty() ) { |
99 | setText( 1, addressee.preferredEmail() ); | 103 | setText( 1, addressee.preferredEmail() ); |
100 | setText( 2, i18n("Yes") ); | 104 | setText( 2, i18n("Yes") ); |
101 | } else { | 105 | } else { |
102 | setText( 1, email ); | 106 | setText( 1, email ); |
103 | setText( 2, i18n("No") ); | 107 | setText( 2, i18n("No") ); |
104 | } | 108 | } |
105 | } | 109 | } |
106 | 110 | ||
107 | Addressee addressee() const | 111 | Addressee addressee() const |
108 | { | 112 | { |
109 | return mAddressee; | 113 | return mAddressee; |
110 | } | 114 | } |
111 | 115 | ||
112 | QString email() const | 116 | QString email() const |
113 | { | 117 | { |
114 | return mEmail; | 118 | return mEmail; |
115 | } | 119 | } |
116 | 120 | ||
117 | private: | 121 | private: |
118 | Addressee mAddressee; | 122 | Addressee mAddressee; |
119 | QString mEmail; | 123 | QString mEmail; |
120 | }; | 124 | }; |
121 | 125 | ||
122 | DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) : | 126 | DistributionListEditor::DistributionListEditor( AddressBook *addressBook, QWidget *parent) : |
123 | QWidget( parent ), | 127 | QWidget( parent ), |
124 | mAddressBook( addressBook ) | 128 | mAddressBook( addressBook ) |
125 | { | 129 | { |
126 | kdDebug(5700) << "DistributionListEditor()" << endl; | 130 | kdDebug(5700) << "DistributionListEditor()" << endl; |
127 | 131 | ||
128 | QBoxLayout *topLayout = new QVBoxLayout( this ); | 132 | Q3BoxLayout *topLayout = new Q3VBoxLayout( this ); |
129 | topLayout->setMargin( KDialog::marginHint() ); | 133 | topLayout->setMargin( KDialog::marginHint() ); |
130 | topLayout->setSpacing( KDialog::spacingHint() ); | 134 | topLayout->setSpacing( KDialog::spacingHint() ); |
131 | 135 | ||
132 | QBoxLayout *nameLayout = new QHBoxLayout( topLayout) ; | 136 | Q3BoxLayout *nameLayout = new Q3HBoxLayout( topLayout) ; |
133 | 137 | ||
134 | mNameCombo = new QComboBox( this ); | 138 | mNameCombo = new QComboBox( this ); |
135 | nameLayout->addWidget( mNameCombo ); | 139 | nameLayout->addWidget( mNameCombo ); |
136 | connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) ); | 140 | connect( mNameCombo, SIGNAL( activated( int ) ), SLOT( updateEntryView() ) ); |
137 | 141 | ||
138 | newButton = new QPushButton( i18n("New List"), this ); | 142 | newButton = new QPushButton( i18n("New List"), this ); |
139 | nameLayout->addWidget( newButton ); | 143 | nameLayout->addWidget( newButton ); |
140 | connect( newButton, SIGNAL( clicked() ), SLOT( newList() ) ); | 144 | connect( newButton, SIGNAL( clicked() ), SLOT( newList() ) ); |
141 | 145 | ||
142 | removeButton = new QPushButton( i18n("Remove List"), this ); | 146 | removeButton = new QPushButton( i18n("Remove List"), this ); |
143 | nameLayout->addWidget( removeButton ); | 147 | nameLayout->addWidget( removeButton ); |
144 | connect( removeButton, SIGNAL( clicked() ), SLOT( removeList() ) ); | 148 | connect( removeButton, SIGNAL( clicked() ), SLOT( removeList() ) ); |
145 | 149 | ||
146 | mEntryView = new QListView( this ); | 150 | mEntryView = new Q3ListView( this ); |
147 | mEntryView->addColumn( i18n("Name") ); | 151 | mEntryView->addColumn( i18n("Name") ); |
148 | mEntryView->addColumn( i18n("Email") ); | 152 | mEntryView->addColumn( i18n("Email") ); |
149 | mEntryView->addColumn( i18n("Use Preferred") ); | 153 | mEntryView->addColumn( i18n("Use Preferred") ); |
150 | topLayout->addWidget( mEntryView ); | 154 | topLayout->addWidget( mEntryView ); |
151 | connect(mEntryView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionEntryViewChanged())); | 155 | connect(mEntryView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionEntryViewChanged())); |
152 | 156 | ||
153 | changeEmailButton = new QPushButton( i18n("Change Email"), this ); | 157 | changeEmailButton = new QPushButton( i18n("Change Email"), this ); |
154 | topLayout->addWidget( changeEmailButton ); | 158 | topLayout->addWidget( changeEmailButton ); |
155 | connect( changeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); | 159 | connect( changeEmailButton, SIGNAL( clicked() ), SLOT( changeEmail() ) ); |
156 | 160 | ||
157 | removeEntryButton = new QPushButton( i18n("Remove Entry"), this ); | 161 | removeEntryButton = new QPushButton( i18n("Remove Entry"), this ); |
158 | topLayout->addWidget( removeEntryButton ); | 162 | topLayout->addWidget( removeEntryButton ); |
159 | connect( removeEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) ); | 163 | connect( removeEntryButton, SIGNAL( clicked() ), SLOT( removeEntry() ) ); |
160 | 164 | ||
161 | addEntryButton = new QPushButton( i18n("Add Entry"), this ); | 165 | addEntryButton = new QPushButton( i18n("Add Entry"), this ); |
162 | topLayout->addWidget( addEntryButton ); | 166 | topLayout->addWidget( addEntryButton ); |
163 | connect( addEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) ); | 167 | connect( addEntryButton, SIGNAL( clicked() ), SLOT( addEntry() ) ); |
164 | 168 | ||
165 | mAddresseeView = new QListView( this ); | 169 | mAddresseeView = new Q3ListView( this ); |
166 | mAddresseeView->addColumn( i18n("Name") ); | 170 | mAddresseeView->addColumn( i18n("Name") ); |
167 | mAddresseeView->addColumn( i18n("Preferred Email") ); | 171 | mAddresseeView->addColumn( i18n("Preferred Email") ); |
168 | topLayout->addWidget( mAddresseeView ); | 172 | topLayout->addWidget( mAddresseeView ); |
169 | 173 | ||
170 | 174 | ||
171 | connect(mAddresseeView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionAddresseeViewChanged())); | 175 | connect(mAddresseeView,SIGNAL(selectionChanged ()),this, SLOT(slotSelectionAddresseeViewChanged())); |
172 | 176 | ||
173 | mManager = new DistributionListManager( mAddressBook ); | 177 | mManager = new DistributionListManager( mAddressBook ); |
174 | mManager->load(); | 178 | mManager->load(); |
175 | 179 | ||
176 | updateAddresseeView(); | 180 | updateAddresseeView(); |
177 | updateNameCombo(); | 181 | updateNameCombo(); |
178 | removeButton->setEnabled(!mManager->listNames().isEmpty()); | 182 | removeButton->setEnabled(!mManager->listNames().isEmpty()); |
179 | } | 183 | } |
180 | 184 | ||
181 | DistributionListEditor::~DistributionListEditor() | 185 | DistributionListEditor::~DistributionListEditor() |
182 | { | 186 | { |
183 | kdDebug(5700) << "~DistributionListEditor()" << endl; | 187 | kdDebug(5700) << "~DistributionListEditor()" << endl; |
184 | 188 | ||
185 | mManager->save(); | 189 | mManager->save(); |
186 | delete mManager; | 190 | delete mManager; |
187 | } | 191 | } |
188 | 192 | ||
189 | void DistributionListEditor::slotSelectionEntryViewChanged() | 193 | void DistributionListEditor::slotSelectionEntryViewChanged() |
190 | { | 194 | { |
191 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); | 195 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); |
192 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); | 196 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); |
193 | bool state = (entryItem != 0L); | 197 | bool state = (entryItem != 0L); |
194 | 198 | ||
195 | changeEmailButton->setEnabled(state); | 199 | changeEmailButton->setEnabled(state); |
196 | removeEntryButton->setEnabled(state); | 200 | removeEntryButton->setEnabled(state); |
197 | } | 201 | } |
198 | 202 | ||
199 | void DistributionListEditor::newList() | 203 | void DistributionListEditor::newList() |
200 | { | 204 | { |
201 | bool ok = false; | 205 | bool ok = false; |
202 | QString name = QInputDialog::getText( i18n("New Distribution List"), | 206 | QString name = QInputDialog::getText( i18n("New Distribution List"), |
203 | i18n("Please enter name:"), | 207 | i18n("Please enter name:"), |
204 | QLineEdit::Normal, QString::null, &ok, | 208 | QLineEdit::Normal, QString::null, &ok, |
205 | this ); | 209 | this ); |
206 | if ( !ok || name.isEmpty() ) return; | 210 | if ( !ok || name.isEmpty() ) return; |
207 | 211 | ||
208 | new DistributionList( mManager, name ); | 212 | new DistributionList( mManager, name ); |
209 | 213 | ||
210 | mNameCombo->insertItem( name ); | 214 | mNameCombo->insertItem( name ); |
211 | removeButton->setEnabled(true); | 215 | removeButton->setEnabled(true); |
212 | updateEntryView(); | 216 | updateEntryView(); |
213 | } | 217 | } |
214 | 218 | ||
215 | void DistributionListEditor::removeList() | 219 | void DistributionListEditor::removeList() |
216 | { | 220 | { |
217 | delete mManager->list( mNameCombo->currentText() ); | 221 | delete mManager->list( mNameCombo->currentText() ); |
218 | mNameCombo->removeItem( mNameCombo->currentItem() ); | 222 | mNameCombo->removeItem( mNameCombo->currentItem() ); |
219 | removeButton->setEnabled(!mManager->listNames().isEmpty()); | 223 | removeButton->setEnabled(!mManager->listNames().isEmpty()); |
220 | addEntryButton->setEnabled( !mNameCombo->currentText().isEmpty()); | 224 | addEntryButton->setEnabled( !mNameCombo->currentText().isEmpty()); |
221 | updateEntryView(); | 225 | updateEntryView(); |
222 | } | 226 | } |
223 | 227 | ||
224 | void DistributionListEditor::addEntry() | 228 | void DistributionListEditor::addEntry() |
225 | { | 229 | { |
226 | /*US | 230 | /*US |
227 | AddresseeItem *addresseeItem = | 231 | AddresseeItem *addresseeItem = |
228 | dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); | 232 | dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); |
229 | */ | 233 | */ |
230 | AddresseeItem *addresseeItem = | 234 | AddresseeItem *addresseeItem = |
231 | (AddresseeItem *)( mAddresseeView->selectedItem() ); | 235 | (AddresseeItem *)( mAddresseeView->selectedItem() ); |
232 | 236 | ||
233 | 237 | ||
234 | if( !addresseeItem ) { | 238 | if( !addresseeItem ) { |
235 | kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl; | 239 | kdDebug(5700) << "DLE::addEntry(): No addressee selected." << endl; |
236 | return; | 240 | return; |
237 | } | 241 | } |
238 | 242 | ||
239 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 243 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
240 | if ( !list ) { | 244 | if ( !list ) { |
241 | kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl; | 245 | kdDebug(5700) << "DLE::addEntry(): No dist list '" << mNameCombo->currentText() << "'" << endl; |
242 | return; | 246 | return; |
243 | } | 247 | } |
244 | 248 | ||
245 | list->insertEntry( addresseeItem->addressee() ); | 249 | list->insertEntry( addresseeItem->addressee() ); |
246 | updateEntryView(); | 250 | updateEntryView(); |
247 | slotSelectionAddresseeViewChanged(); | 251 | slotSelectionAddresseeViewChanged(); |
248 | } | 252 | } |
249 | 253 | ||
250 | void DistributionListEditor::removeEntry() | 254 | void DistributionListEditor::removeEntry() |
251 | { | 255 | { |
252 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 256 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
253 | if ( !list ) return; | 257 | if ( !list ) return; |
254 | 258 | ||
255 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); | 259 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); |
256 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); | 260 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); |
257 | if ( !entryItem ) return; | 261 | if ( !entryItem ) return; |
258 | 262 | ||
259 | list->removeEntry( entryItem->addressee(), entryItem->email() ); | 263 | list->removeEntry( entryItem->addressee(), entryItem->email() ); |
260 | delete entryItem; | 264 | delete entryItem; |
261 | } | 265 | } |
262 | 266 | ||
263 | void DistributionListEditor::changeEmail() | 267 | void DistributionListEditor::changeEmail() |
264 | { | 268 | { |
265 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 269 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
266 | if ( !list ) return; | 270 | if ( !list ) return; |
267 | 271 | ||
268 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); | 272 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); |
269 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); | 273 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); |
270 | if ( !entryItem ) return; | 274 | if ( !entryItem ) return; |
271 | 275 | ||
272 | QString email = EmailSelectDialog::getEmail( entryItem->addressee().emails(), | 276 | QString email = EmailSelectDialog::getEmail( entryItem->addressee().emails(), |
273 | entryItem->email(), this ); | 277 | entryItem->email(), this ); |
274 | list->removeEntry( entryItem->addressee(), entryItem->email() ); | 278 | list->removeEntry( entryItem->addressee(), entryItem->email() ); |
275 | list->insertEntry( entryItem->addressee(), email ); | 279 | list->insertEntry( entryItem->addressee(), email ); |
276 | 280 | ||
277 | updateEntryView(); | 281 | updateEntryView(); |
278 | } | 282 | } |
279 | 283 | ||
280 | void DistributionListEditor::updateEntryView() | 284 | void DistributionListEditor::updateEntryView() |
281 | { | 285 | { |
282 | DistributionList *list = mManager->list( mNameCombo->currentText() ); | 286 | DistributionList *list = mManager->list( mNameCombo->currentText() ); |
283 | if ( !list ) return; | 287 | if ( !list ) return; |
284 | 288 | ||
285 | mEntryView->clear(); | 289 | mEntryView->clear(); |
286 | DistributionList::Entry::List entries = list->entries(); | 290 | DistributionList::Entry::List entries = list->entries(); |
287 | DistributionList::Entry::List::ConstIterator it; | 291 | DistributionList::Entry::List::ConstIterator it; |
288 | for( it = entries.begin(); it != entries.end(); ++it ) { | 292 | for( it = entries.begin(); it != entries.end(); ++it ) { |
289 | new EditEntryItem( mEntryView, (*it).addressee, (*it).email ); | 293 | new EditEntryItem( mEntryView, (*it).addressee, (*it).email ); |
290 | } | 294 | } |
291 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); | 295 | //US EditEntryItem *entryItem = dynamic_cast<EditEntryItem *>( mEntryView->selectedItem() ); |
292 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); | 296 | EditEntryItem *entryItem = (EditEntryItem *)( mEntryView->selectedItem() ); |
293 | bool state = (entryItem != 0L); | 297 | bool state = (entryItem != 0L); |
294 | 298 | ||
295 | changeEmailButton->setEnabled(state); | 299 | changeEmailButton->setEnabled(state); |
296 | removeEntryButton->setEnabled(state); | 300 | removeEntryButton->setEnabled(state); |
297 | } | 301 | } |
298 | 302 | ||
299 | void DistributionListEditor::updateAddresseeView() | 303 | void DistributionListEditor::updateAddresseeView() |
300 | { | 304 | { |
301 | mAddresseeView->clear(); | 305 | mAddresseeView->clear(); |
302 | 306 | ||
303 | AddressBook::Iterator it; | 307 | AddressBook::Iterator it; |
304 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { | 308 | for( it = mAddressBook->begin(); it != mAddressBook->end(); ++it ) { |
305 | new AddresseeItem( mAddresseeView, *it ); | 309 | new AddresseeItem( mAddresseeView, *it ); |
306 | } | 310 | } |
307 | } | 311 | } |
308 | 312 | ||
309 | void DistributionListEditor::updateNameCombo() | 313 | void DistributionListEditor::updateNameCombo() |
310 | { | 314 | { |
311 | mNameCombo->insertStringList( mManager->listNames() ); | 315 | mNameCombo->insertStringList( mManager->listNames() ); |
312 | 316 | ||
313 | updateEntryView(); | 317 | updateEntryView(); |
314 | } | 318 | } |
315 | 319 | ||
316 | void DistributionListEditor::slotSelectionAddresseeViewChanged() | 320 | void DistributionListEditor::slotSelectionAddresseeViewChanged() |
317 | { | 321 | { |
318 | //US AddresseeItem *addresseeItem = dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); | 322 | //US AddresseeItem *addresseeItem = dynamic_cast<AddresseeItem *>( mAddresseeView->selectedItem() ); |
319 | AddresseeItem *addresseeItem = (AddresseeItem *)( mAddresseeView->selectedItem() ); | 323 | AddresseeItem *addresseeItem = (AddresseeItem *)( mAddresseeView->selectedItem() ); |
320 | bool state = (addresseeItem != 0L); | 324 | bool state = (addresseeItem != 0L); |
321 | addEntryButton->setEnabled( state && !mNameCombo->currentText().isEmpty()); | 325 | addEntryButton->setEnabled( state && !mNameCombo->currentText().isEmpty()); |
322 | } | 326 | } |
diff --git a/kabc/distributionlisteditor.h b/kabc/distributionlisteditor.h index e0b4221..e672a14 100644 --- a/kabc/distributionlisteditor.h +++ b/kabc/distributionlisteditor.h | |||
@@ -1,86 +1,86 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | #ifndef KABC_DISTRIBUTIONLISTEDITOR_H | 20 | #ifndef KABC_DISTRIBUTIONLISTEDITOR_H |
21 | #define KABC_DISTRIBUTIONLISTEDITOR_H | 21 | #define KABC_DISTRIBUTIONLISTEDITOR_H |
22 | 22 | ||
23 | #include <qwidget.h> | 23 | #include <qwidget.h> |
24 | 24 | ||
25 | #include <kdialogbase.h> | 25 | #include <kdialogbase.h> |
26 | 26 | ||
27 | class QListView; | 27 | class Q3ListView; |
28 | class QComboBox; | 28 | class QComboBox; |
29 | class QButtonGroup; | 29 | class Q3ButtonGroup; |
30 | 30 | ||
31 | namespace KABC { | 31 | namespace KABC { |
32 | 32 | ||
33 | class AddressBook; | 33 | class AddressBook; |
34 | class DistributionListManager; | 34 | class DistributionListManager; |
35 | 35 | ||
36 | class EmailSelectDialog : public KDialogBase | 36 | class EmailSelectDialog : public KDialogBase |
37 | { | 37 | { |
38 | public: | 38 | public: |
39 | EmailSelectDialog( const QStringList &emails, const QString ¤t, | 39 | EmailSelectDialog( const QStringList &emails, const QString ¤t, |
40 | QWidget *parent ); | 40 | QWidget *parent ); |
41 | 41 | ||
42 | QString selected(); | 42 | QString selected(); |
43 | 43 | ||
44 | static QString getEmail( const QStringList &emails, const QString ¤t, | 44 | static QString getEmail( const QStringList &emails, const QString ¤t, |
45 | QWidget *parent ); | 45 | QWidget *parent ); |
46 | 46 | ||
47 | private: | 47 | private: |
48 | QButtonGroup *mButtonGroup; | 48 | Q3ButtonGroup *mButtonGroup; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | /** | 51 | /** |
52 | @obsolete | 52 | @obsolete |
53 | */ | 53 | */ |
54 | class DistributionListEditor : public QWidget | 54 | class DistributionListEditor : public QWidget |
55 | { | 55 | { |
56 | Q_OBJECT | 56 | Q_OBJECT |
57 | public: | 57 | public: |
58 | DistributionListEditor( AddressBook *, QWidget *parent ); | 58 | DistributionListEditor( AddressBook *, QWidget *parent ); |
59 | virtual ~DistributionListEditor(); | 59 | virtual ~DistributionListEditor(); |
60 | 60 | ||
61 | private slots: | 61 | private slots: |
62 | void newList(); | 62 | void newList(); |
63 | void removeList(); | 63 | void removeList(); |
64 | void addEntry(); | 64 | void addEntry(); |
65 | void removeEntry(); | 65 | void removeEntry(); |
66 | void changeEmail(); | 66 | void changeEmail(); |
67 | void updateEntryView(); | 67 | void updateEntryView(); |
68 | void updateAddresseeView(); | 68 | void updateAddresseeView(); |
69 | void updateNameCombo(); | 69 | void updateNameCombo(); |
70 | void slotSelectionEntryViewChanged(); | 70 | void slotSelectionEntryViewChanged(); |
71 | void slotSelectionAddresseeViewChanged(); | 71 | void slotSelectionAddresseeViewChanged(); |
72 | 72 | ||
73 | private: | 73 | private: |
74 | QComboBox *mNameCombo; | 74 | QComboBox *mNameCombo; |
75 | QListView *mEntryView; | 75 | Q3ListView *mEntryView; |
76 | QListView *mAddresseeView; | 76 | Q3ListView *mAddresseeView; |
77 | 77 | ||
78 | AddressBook *mAddressBook; | 78 | AddressBook *mAddressBook; |
79 | DistributionListManager *mManager; | 79 | DistributionListManager *mManager; |
80 | QPushButton *newButton, *removeButton; | 80 | QPushButton *newButton, *removeButton; |
81 | QPushButton *changeEmailButton,*removeEntryButton,*addEntryButton; | 81 | QPushButton *changeEmailButton,*removeEntryButton,*addEntryButton; |
82 | }; | 82 | }; |
83 | 83 | ||
84 | } | 84 | } |
85 | 85 | ||
86 | #endif | 86 | #endif |
diff --git a/kabc/field.cpp b/kabc/field.cpp index 7c6d7a9..203f696 100644 --- a/kabc/field.cpp +++ b/kabc/field.cpp | |||
@@ -1,584 +1,586 @@ | |||
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) 2002 Cornelius Schumacher <schumacher@kde.org> | 4 | Copyright (c) 2002 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 <klocale.h> | 29 | #include <klocale.h> |
30 | #include <kconfig.h> | 30 | #include <kconfig.h> |
31 | #include <kconfigbase.h> | 31 | #include <kconfigbase.h> |
32 | #include <kglobal.h> | 32 | #include <kglobal.h> |
33 | 33 | ||
34 | #include "field.h" | 34 | #include "field.h" |
35 | #include "resource.h" | 35 | #include "resource.h" |
36 | //Added by qt3to4: | ||
37 | #include <Q3ValueList> | ||
36 | 38 | ||
37 | using namespace KABC; | 39 | using namespace KABC; |
38 | 40 | ||
39 | class Field::FieldImpl | 41 | class Field::FieldImpl |
40 | { | 42 | { |
41 | public: | 43 | public: |
42 | FieldImpl( int fieldId, int category = 0, | 44 | FieldImpl( int fieldId, int category = 0, |
43 | const QString &label = QString::null, | 45 | const QString &label = QString::null, |
44 | const QString &key = QString::null, | 46 | const QString &key = QString::null, |
45 | const QString &app = QString::null ) | 47 | const QString &app = QString::null ) |
46 | : mFieldId( fieldId ), mCategory( category ), mLabel( label ), | 48 | : mFieldId( fieldId ), mCategory( category ), mLabel( label ), |
47 | mKey( key ), mApp( app ) {} | 49 | mKey( key ), mApp( app ) {} |
48 | 50 | ||
49 | enum FieldId | 51 | enum FieldId |
50 | { | 52 | { |
51 | CustomField, | 53 | CustomField, |
52 | FormattedName, | 54 | FormattedName, |
53 | FamilyName, | 55 | FamilyName, |
54 | GivenName, | 56 | GivenName, |
55 | AdditionalName, | 57 | AdditionalName, |
56 | Prefix, | 58 | Prefix, |
57 | Suffix, | 59 | Suffix, |
58 | NickName, | 60 | NickName, |
59 | Birthday, | 61 | Birthday, |
60 | Category, | 62 | Category, |
61 | HomeAddressStreet, | 63 | HomeAddressStreet, |
62 | HomeAddressLocality, | 64 | HomeAddressLocality, |
63 | HomeAddressRegion, | 65 | HomeAddressRegion, |
64 | HomeAddressPostalCode, | 66 | HomeAddressPostalCode, |
65 | HomeAddressCountry, | 67 | HomeAddressCountry, |
66 | HomeAddressLabel, | 68 | HomeAddressLabel, |
67 | BusinessAddressStreet, | 69 | BusinessAddressStreet, |
68 | BusinessAddressLocality, | 70 | BusinessAddressLocality, |
69 | BusinessAddressRegion, | 71 | BusinessAddressRegion, |
70 | BusinessAddressPostalCode, | 72 | BusinessAddressPostalCode, |
71 | BusinessAddressCountry, | 73 | BusinessAddressCountry, |
72 | BusinessAddressLabel, | 74 | BusinessAddressLabel, |
73 | HomePhone, | 75 | HomePhone, |
74 | BusinessPhone, | 76 | BusinessPhone, |
75 | MobilePhone, | 77 | MobilePhone, |
76 | HomeFax, | 78 | HomeFax, |
77 | BusinessFax, | 79 | BusinessFax, |
78 | Isdn, | 80 | Isdn, |
79 | Pager, | 81 | Pager, |
80 | Email, | 82 | Email, |
81 | Mailer, | 83 | Mailer, |
82 | Title, | 84 | Title, |
83 | Role, | 85 | Role, |
84 | Organization, | 86 | Organization, |
85 | Note, | 87 | Note, |
86 | Url, | 88 | Url, |
87 | Resource, | 89 | Resource, |
88 | Sip, | 90 | Sip, |
89 | MobileWorkPhone, | 91 | MobileWorkPhone, |
90 | OtherPhone | 92 | OtherPhone |
91 | }; | 93 | }; |
92 | 94 | ||
93 | int fieldId() { return mFieldId; } | 95 | int fieldId() { return mFieldId; } |
94 | int category() { return mCategory; } | 96 | int category() { return mCategory; } |
95 | 97 | ||
96 | QString label() { return mLabel; } | 98 | QString label() { return mLabel; } |
97 | QString key() { return mKey; } | 99 | QString key() { return mKey; } |
98 | QString app() { return mApp; } | 100 | QString app() { return mApp; } |
99 | 101 | ||
100 | private: | 102 | private: |
101 | int mFieldId; | 103 | int mFieldId; |
102 | int mCategory; | 104 | int mCategory; |
103 | 105 | ||
104 | QString mLabel; | 106 | QString mLabel; |
105 | QString mKey; | 107 | QString mKey; |
106 | QString mApp; | 108 | QString mApp; |
107 | }; | 109 | }; |
108 | 110 | ||
109 | 111 | ||
110 | Field::List Field::mAllFields; | 112 | Field::List Field::mAllFields; |
111 | Field::List Field::mDefaultFields; | 113 | Field::List Field::mDefaultFields; |
112 | Field::List Field::mCustomFields; | 114 | Field::List Field::mCustomFields; |
113 | 115 | ||
114 | 116 | ||
115 | Field::Field( FieldImpl *impl ) | 117 | Field::Field( FieldImpl *impl ) |
116 | { | 118 | { |
117 | mImpl = impl; | 119 | mImpl = impl; |
118 | } | 120 | } |
119 | 121 | ||
120 | Field::~Field() | 122 | Field::~Field() |
121 | { | 123 | { |
122 | delete mImpl; | 124 | delete mImpl; |
123 | } | 125 | } |
124 | 126 | ||
125 | QString Field::label() | 127 | QString Field::label() |
126 | { | 128 | { |
127 | switch ( mImpl->fieldId() ) { | 129 | switch ( mImpl->fieldId() ) { |
128 | case FieldImpl::FormattedName: | 130 | case FieldImpl::FormattedName: |
129 | return Addressee::formattedNameLabel(); | 131 | return Addressee::formattedNameLabel(); |
130 | case FieldImpl::FamilyName: | 132 | case FieldImpl::FamilyName: |
131 | return Addressee::familyNameLabel(); | 133 | return Addressee::familyNameLabel(); |
132 | case FieldImpl::GivenName: | 134 | case FieldImpl::GivenName: |
133 | return Addressee::givenNameLabel(); | 135 | return Addressee::givenNameLabel(); |
134 | case FieldImpl::AdditionalName: | 136 | case FieldImpl::AdditionalName: |
135 | return Addressee::additionalNameLabel(); | 137 | return Addressee::additionalNameLabel(); |
136 | case FieldImpl::Prefix: | 138 | case FieldImpl::Prefix: |
137 | return Addressee::prefixLabel(); | 139 | return Addressee::prefixLabel(); |
138 | case FieldImpl::Suffix: | 140 | case FieldImpl::Suffix: |
139 | return Addressee::suffixLabel(); | 141 | return Addressee::suffixLabel(); |
140 | case FieldImpl::NickName: | 142 | case FieldImpl::NickName: |
141 | return Addressee::nickNameLabel(); | 143 | return Addressee::nickNameLabel(); |
142 | case FieldImpl::Birthday: | 144 | case FieldImpl::Birthday: |
143 | return Addressee::birthdayLabel(); | 145 | return Addressee::birthdayLabel(); |
144 | case FieldImpl::HomeAddressStreet: | 146 | case FieldImpl::HomeAddressStreet: |
145 | return Addressee::homeAddressStreetLabel(); | 147 | return Addressee::homeAddressStreetLabel(); |
146 | case FieldImpl::HomeAddressLocality: | 148 | case FieldImpl::HomeAddressLocality: |
147 | return Addressee::homeAddressLocalityLabel(); | 149 | return Addressee::homeAddressLocalityLabel(); |
148 | case FieldImpl::HomeAddressRegion: | 150 | case FieldImpl::HomeAddressRegion: |
149 | return Addressee::homeAddressRegionLabel(); | 151 | return Addressee::homeAddressRegionLabel(); |
150 | case FieldImpl::HomeAddressPostalCode: | 152 | case FieldImpl::HomeAddressPostalCode: |
151 | return Addressee::homeAddressPostalCodeLabel(); | 153 | return Addressee::homeAddressPostalCodeLabel(); |
152 | case FieldImpl::HomeAddressCountry: | 154 | case FieldImpl::HomeAddressCountry: |
153 | return Addressee::homeAddressCountryLabel(); | 155 | return Addressee::homeAddressCountryLabel(); |
154 | case FieldImpl::HomeAddressLabel: | 156 | case FieldImpl::HomeAddressLabel: |
155 | return Addressee::homeAddressLabelLabel(); | 157 | return Addressee::homeAddressLabelLabel(); |
156 | case FieldImpl::BusinessAddressStreet: | 158 | case FieldImpl::BusinessAddressStreet: |
157 | return Addressee::businessAddressStreetLabel(); | 159 | return Addressee::businessAddressStreetLabel(); |
158 | case FieldImpl::BusinessAddressLocality: | 160 | case FieldImpl::BusinessAddressLocality: |
159 | return Addressee::businessAddressLocalityLabel(); | 161 | return Addressee::businessAddressLocalityLabel(); |
160 | case FieldImpl::BusinessAddressRegion: | 162 | case FieldImpl::BusinessAddressRegion: |
161 | return Addressee::businessAddressRegionLabel(); | 163 | return Addressee::businessAddressRegionLabel(); |
162 | case FieldImpl::BusinessAddressPostalCode: | 164 | case FieldImpl::BusinessAddressPostalCode: |
163 | return Addressee::businessAddressPostalCodeLabel(); | 165 | return Addressee::businessAddressPostalCodeLabel(); |
164 | case FieldImpl::BusinessAddressCountry: | 166 | case FieldImpl::BusinessAddressCountry: |
165 | return Addressee::businessAddressCountryLabel(); | 167 | return Addressee::businessAddressCountryLabel(); |
166 | case FieldImpl::BusinessAddressLabel: | 168 | case FieldImpl::BusinessAddressLabel: |
167 | return Addressee::businessAddressLabelLabel(); | 169 | return Addressee::businessAddressLabelLabel(); |
168 | case FieldImpl::HomePhone: | 170 | case FieldImpl::HomePhone: |
169 | return Addressee::homePhoneLabel(); | 171 | return Addressee::homePhoneLabel(); |
170 | case FieldImpl::BusinessPhone: | 172 | case FieldImpl::BusinessPhone: |
171 | return Addressee::businessPhoneLabel(); | 173 | return Addressee::businessPhoneLabel(); |
172 | case FieldImpl::MobilePhone: | 174 | case FieldImpl::MobilePhone: |
173 | return Addressee::mobilePhoneLabel(); | 175 | return Addressee::mobilePhoneLabel(); |
174 | case FieldImpl::MobileWorkPhone: | 176 | case FieldImpl::MobileWorkPhone: |
175 | return Addressee::mobileWorkPhoneLabel(); | 177 | return Addressee::mobileWorkPhoneLabel(); |
176 | case FieldImpl::HomeFax: | 178 | case FieldImpl::HomeFax: |
177 | return Addressee::homeFaxLabel(); | 179 | return Addressee::homeFaxLabel(); |
178 | case FieldImpl::BusinessFax: | 180 | case FieldImpl::BusinessFax: |
179 | return Addressee::businessFaxLabel(); | 181 | return Addressee::businessFaxLabel(); |
180 | case FieldImpl::Isdn: | 182 | case FieldImpl::Isdn: |
181 | return Addressee::isdnLabel(); | 183 | return Addressee::isdnLabel(); |
182 | case FieldImpl::Pager: | 184 | case FieldImpl::Pager: |
183 | return Addressee::pagerLabel(); | 185 | return Addressee::pagerLabel(); |
184 | case FieldImpl::Email: | 186 | case FieldImpl::Email: |
185 | return Addressee::emailLabel(); | 187 | return Addressee::emailLabel(); |
186 | case FieldImpl::Mailer: | 188 | case FieldImpl::Mailer: |
187 | return Addressee::mailerLabel(); | 189 | return Addressee::mailerLabel(); |
188 | case FieldImpl::Title: | 190 | case FieldImpl::Title: |
189 | return Addressee::titleLabel(); | 191 | return Addressee::titleLabel(); |
190 | case FieldImpl::Role: | 192 | case FieldImpl::Role: |
191 | return Addressee::roleLabel(); | 193 | return Addressee::roleLabel(); |
192 | case FieldImpl::Organization: | 194 | case FieldImpl::Organization: |
193 | return Addressee::organizationLabel(); | 195 | return Addressee::organizationLabel(); |
194 | case FieldImpl::Note: | 196 | case FieldImpl::Note: |
195 | return Addressee::noteLabel(); | 197 | return Addressee::noteLabel(); |
196 | case FieldImpl::Url: | 198 | case FieldImpl::Url: |
197 | return Addressee::urlLabel(); | 199 | return Addressee::urlLabel(); |
198 | case FieldImpl::Resource: | 200 | case FieldImpl::Resource: |
199 | return Addressee::resourceLabel(); | 201 | return Addressee::resourceLabel(); |
200 | case FieldImpl::Category: | 202 | case FieldImpl::Category: |
201 | return Addressee::categoryLabel(); | 203 | return Addressee::categoryLabel(); |
202 | case FieldImpl::Sip: | 204 | case FieldImpl::Sip: |
203 | return Addressee::sipLabel(); | 205 | return Addressee::sipLabel(); |
204 | case FieldImpl::OtherPhone: | 206 | case FieldImpl::OtherPhone: |
205 | return Addressee::otherPhoneLabel(); | 207 | return Addressee::otherPhoneLabel(); |
206 | case FieldImpl::CustomField: | 208 | case FieldImpl::CustomField: |
207 | return mImpl->label(); | 209 | return mImpl->label(); |
208 | default: | 210 | default: |
209 | return i18n("Unknown Field"); | 211 | return i18n("Unknown Field"); |
210 | } | 212 | } |
211 | } | 213 | } |
212 | 214 | ||
213 | int Field::category() | 215 | int Field::category() |
214 | { | 216 | { |
215 | return mImpl->category(); | 217 | return mImpl->category(); |
216 | } | 218 | } |
217 | 219 | ||
218 | QString Field::categoryLabel( int category ) | 220 | QString Field::categoryLabel( int category ) |
219 | { | 221 | { |
220 | switch ( category ) { | 222 | switch ( category ) { |
221 | case All: | 223 | case All: |
222 | return i18n("All"); | 224 | return i18n("All"); |
223 | case Frequent: | 225 | case Frequent: |
224 | return i18n("Frequent"); | 226 | return i18n("Frequent"); |
225 | case Address: | 227 | case Address: |
226 | return i18n("Address"); | 228 | return i18n("Address"); |
227 | case Email: | 229 | case Email: |
228 | return i18n("Email"); | 230 | return i18n("Email"); |
229 | case Personal: | 231 | case Personal: |
230 | return i18n("Personal"); | 232 | return i18n("Personal"); |
231 | case Organization: | 233 | case Organization: |
232 | return i18n("Organization"); | 234 | return i18n("Organization"); |
233 | case CustomCategory: | 235 | case CustomCategory: |
234 | return i18n("Custom"); | 236 | return i18n("Custom"); |
235 | default: | 237 | default: |
236 | return i18n("Undefined"); | 238 | return i18n("Undefined"); |
237 | } | 239 | } |
238 | } | 240 | } |
239 | 241 | ||
240 | QString Field::value( const KABC::Addressee &a ) | 242 | QString Field::value( const KABC::Addressee &a ) |
241 | { | 243 | { |
242 | switch ( mImpl->fieldId() ) { | 244 | switch ( mImpl->fieldId() ) { |
243 | case FieldImpl::FormattedName: | 245 | case FieldImpl::FormattedName: |
244 | return a.formattedName(); | 246 | return a.formattedName(); |
245 | case FieldImpl::FamilyName: | 247 | case FieldImpl::FamilyName: |
246 | return a.familyName(); | 248 | return a.familyName(); |
247 | case FieldImpl::GivenName: | 249 | case FieldImpl::GivenName: |
248 | return a.givenName(); | 250 | return a.givenName(); |
249 | case FieldImpl::AdditionalName: | 251 | case FieldImpl::AdditionalName: |
250 | return a.additionalName(); | 252 | return a.additionalName(); |
251 | case FieldImpl::Prefix: | 253 | case FieldImpl::Prefix: |
252 | return a.prefix(); | 254 | return a.prefix(); |
253 | case FieldImpl::Suffix: | 255 | case FieldImpl::Suffix: |
254 | return a.suffix(); | 256 | return a.suffix(); |
255 | case FieldImpl::NickName: | 257 | case FieldImpl::NickName: |
256 | return a.nickName(); | 258 | return a.nickName(); |
257 | case FieldImpl::Mailer: | 259 | case FieldImpl::Mailer: |
258 | return a.mailer(); | 260 | return a.mailer(); |
259 | case FieldImpl::Title: | 261 | case FieldImpl::Title: |
260 | return a.title(); | 262 | return a.title(); |
261 | case FieldImpl::Role: | 263 | case FieldImpl::Role: |
262 | return a.role(); | 264 | return a.role(); |
263 | case FieldImpl::Organization: | 265 | case FieldImpl::Organization: |
264 | return a.organization(); | 266 | return a.organization(); |
265 | case FieldImpl::Note: | 267 | case FieldImpl::Note: |
266 | return a.note(); | 268 | return a.note(); |
267 | case FieldImpl::Email: | 269 | case FieldImpl::Email: |
268 | return a.preferredEmail(); | 270 | return a.preferredEmail(); |
269 | case FieldImpl::Birthday: | 271 | case FieldImpl::Birthday: |
270 | if ( a.birthday().isValid() ) { | 272 | if ( a.birthday().isValid() ) { |
271 | //the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); | 273 | //the generated code had the following format: return a.birthday().date().toString( Qt::ISODate ); |
272 | // But Qt::IsoDate was not specified. | 274 | // But Qt::IsoDate was not specified. |
273 | // QString _oldFormat = KGlobal::locale()->dateFormat(); | 275 | // QString _oldFormat = KGlobal::locale()->dateFormat(); |
274 | // KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate | 276 | // KGlobal::locale()->setDateFormat("%Y-%m-%d"); // = Qt::ISODate |
275 | QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate); | 277 | QString dt = KGlobal::locale()->formatDate(a.birthday().date(), false, KLocale::ISODate); |
276 | // KGlobal::locale()->setDateFormat(_oldFormat); | 278 | // KGlobal::locale()->setDateFormat(_oldFormat); |
277 | return dt; | 279 | return dt; |
278 | } | 280 | } |
279 | else | 281 | else |
280 | return QString::null; | 282 | return QString::null; |
281 | case FieldImpl::Url: | 283 | case FieldImpl::Url: |
282 | return a.url().prettyURL(); | 284 | return a.url().prettyURL(); |
283 | //US | 285 | //US |
284 | case FieldImpl::Resource: | 286 | case FieldImpl::Resource: |
285 | return a.resource()->resourceName(); | 287 | return a.resource()->resourceName(); |
286 | case FieldImpl::Category: | 288 | case FieldImpl::Category: |
287 | return a.categories().join(","); | 289 | return a.categories().join(","); |
288 | case FieldImpl::HomePhone: | 290 | case FieldImpl::HomePhone: |
289 | return a.phoneNumber( PhoneNumber::Home| PhoneNumber::Pref ).number(); | 291 | return a.phoneNumber( PhoneNumber::Home| PhoneNumber::Pref ).number(); |
290 | case FieldImpl::BusinessPhone: | 292 | case FieldImpl::BusinessPhone: |
291 | return a.phoneNumber( PhoneNumber::Work| PhoneNumber::Pref ).number(); | 293 | return a.phoneNumber( PhoneNumber::Work| PhoneNumber::Pref ).number(); |
292 | case FieldImpl::MobilePhone: | 294 | case FieldImpl::MobilePhone: |
293 | return a.phoneNumber( PhoneNumber::Cell ).number(); | 295 | return a.phoneNumber( PhoneNumber::Cell ).number(); |
294 | case FieldImpl::MobileWorkPhone: | 296 | case FieldImpl::MobileWorkPhone: |
295 | return a.phoneNumber( PhoneNumber::Car ).number(); | 297 | return a.phoneNumber( PhoneNumber::Car ).number(); |
296 | case FieldImpl::HomeFax: | 298 | case FieldImpl::HomeFax: |
297 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); | 299 | return a.phoneNumber( PhoneNumber::Home | PhoneNumber::Fax ).number(); |
298 | case FieldImpl::BusinessFax: | 300 | case FieldImpl::BusinessFax: |
299 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); | 301 | return a.phoneNumber( PhoneNumber::Work | PhoneNumber::Fax ).number(); |
300 | case FieldImpl::Isdn: | 302 | case FieldImpl::Isdn: |
301 | return a.phoneNumber( PhoneNumber::Isdn ).number(); | 303 | return a.phoneNumber( PhoneNumber::Isdn ).number(); |
302 | case FieldImpl::Pager: | 304 | case FieldImpl::Pager: |
303 | return a.phoneNumber( PhoneNumber::Pager ).number(); | 305 | return a.phoneNumber( PhoneNumber::Pager ).number(); |
304 | case FieldImpl::Sip: | 306 | case FieldImpl::Sip: |
305 | return a.phoneNumber( PhoneNumber::Pcs | PhoneNumber::Pref ).number(); | 307 | return a.phoneNumber( PhoneNumber::Pcs | PhoneNumber::Pref ).number(); |
306 | case FieldImpl::OtherPhone: | 308 | case FieldImpl::OtherPhone: |
307 | return a.phoneNumber( PhoneNumber::Voice ).number(); | 309 | return a.phoneNumber( PhoneNumber::Voice ).number(); |
308 | case FieldImpl::HomeAddressStreet: | 310 | case FieldImpl::HomeAddressStreet: |
309 | return a.address( Address::Home ).street(); | 311 | return a.address( Address::Home ).street(); |
310 | case FieldImpl::HomeAddressLocality: | 312 | case FieldImpl::HomeAddressLocality: |
311 | return a.address( Address::Home ).locality(); | 313 | return a.address( Address::Home ).locality(); |
312 | case FieldImpl::HomeAddressRegion: | 314 | case FieldImpl::HomeAddressRegion: |
313 | return a.address( Address::Home ).region(); | 315 | return a.address( Address::Home ).region(); |
314 | case FieldImpl::HomeAddressPostalCode: | 316 | case FieldImpl::HomeAddressPostalCode: |
315 | return a.address( Address::Home ).postalCode(); | 317 | return a.address( Address::Home ).postalCode(); |
316 | case FieldImpl::HomeAddressCountry: | 318 | case FieldImpl::HomeAddressCountry: |
317 | return a.address( Address::Home ).country(); | 319 | return a.address( Address::Home ).country(); |
318 | case FieldImpl::BusinessAddressStreet: | 320 | case FieldImpl::BusinessAddressStreet: |
319 | return a.address( Address::Work ).street(); | 321 | return a.address( Address::Work ).street(); |
320 | case FieldImpl::BusinessAddressLocality: | 322 | case FieldImpl::BusinessAddressLocality: |
321 | return a.address( Address::Work ).locality(); | 323 | return a.address( Address::Work ).locality(); |
322 | case FieldImpl::BusinessAddressRegion: | 324 | case FieldImpl::BusinessAddressRegion: |
323 | return a.address( Address::Work ).region(); | 325 | return a.address( Address::Work ).region(); |
324 | case FieldImpl::BusinessAddressPostalCode: | 326 | case FieldImpl::BusinessAddressPostalCode: |
325 | return a.address( Address::Work ).postalCode(); | 327 | return a.address( Address::Work ).postalCode(); |
326 | case FieldImpl::BusinessAddressCountry: | 328 | case FieldImpl::BusinessAddressCountry: |
327 | return a.address( Address::Work ).country(); | 329 | return a.address( Address::Work ).country(); |
328 | case FieldImpl::CustomField: | 330 | case FieldImpl::CustomField: |
329 | return a.custom( mImpl->app(), mImpl->key() ); | 331 | return a.custom( mImpl->app(), mImpl->key() ); |
330 | default: | 332 | default: |
331 | return QString::null; | 333 | return QString::null; |
332 | } | 334 | } |
333 | } | 335 | } |
334 | 336 | ||
335 | bool Field::setValue( KABC::Addressee &a, const QString &value ) | 337 | bool Field::setValue( KABC::Addressee &a, const QString &value ) |
336 | { | 338 | { |
337 | switch ( mImpl->fieldId() ) { | 339 | switch ( mImpl->fieldId() ) { |
338 | case FieldImpl::FormattedName: | 340 | case FieldImpl::FormattedName: |
339 | a.setFormattedName( value ); | 341 | a.setFormattedName( value ); |
340 | return true; | 342 | return true; |
341 | case FieldImpl::FamilyName: | 343 | case FieldImpl::FamilyName: |
342 | a.setFamilyName( value ); | 344 | a.setFamilyName( value ); |
343 | return true; | 345 | return true; |
344 | case FieldImpl::GivenName: | 346 | case FieldImpl::GivenName: |
345 | a.setGivenName( value ); | 347 | a.setGivenName( value ); |
346 | return true; | 348 | return true; |
347 | case FieldImpl::AdditionalName: | 349 | case FieldImpl::AdditionalName: |
348 | a.setAdditionalName( value ); | 350 | a.setAdditionalName( value ); |
349 | return true; | 351 | return true; |
350 | case FieldImpl::Prefix: | 352 | case FieldImpl::Prefix: |
351 | a.setPrefix( value ); | 353 | a.setPrefix( value ); |
352 | return true; | 354 | return true; |
353 | case FieldImpl::Suffix: | 355 | case FieldImpl::Suffix: |
354 | a.setSuffix( value ); | 356 | a.setSuffix( value ); |
355 | return true; | 357 | return true; |
356 | case FieldImpl::NickName: | 358 | case FieldImpl::NickName: |
357 | a.setNickName( value ); | 359 | a.setNickName( value ); |
358 | return true; | 360 | return true; |
359 | case FieldImpl::Mailer: | 361 | case FieldImpl::Mailer: |
360 | a.setMailer( value ); | 362 | a.setMailer( value ); |
361 | return true; | 363 | return true; |
362 | case FieldImpl::Title: | 364 | case FieldImpl::Title: |
363 | a.setTitle( value ); | 365 | a.setTitle( value ); |
364 | return true; | 366 | return true; |
365 | case FieldImpl::Role: | 367 | case FieldImpl::Role: |
366 | a.setRole( value ); | 368 | a.setRole( value ); |
367 | return true; | 369 | return true; |
368 | case FieldImpl::Organization: | 370 | case FieldImpl::Organization: |
369 | a.setOrganization( value ); | 371 | a.setOrganization( value ); |
370 | return true; | 372 | return true; |
371 | case FieldImpl::Note: | 373 | case FieldImpl::Note: |
372 | a.setNote( value ); | 374 | a.setNote( value ); |
373 | return true; | 375 | return true; |
374 | case FieldImpl::Birthday: | 376 | case FieldImpl::Birthday: |
375 | //US | 377 | //US |
376 | //the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); | 378 | //the generated code had the following format: return a.setBirthday( QDate::fromString( value, Qt::ISODate ) ); |
377 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? | 379 | // But Qt::IsoDate and QDate::fromString was not specified. Do I have the wrong QT version ? |
378 | { | 380 | { |
379 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate | 381 | QDate dt = KGlobal::locale()->readDate( value, "%Y-%m-%d"); // = Qt::ISODate |
380 | a.setBirthday(dt); | 382 | a.setBirthday((QDateTime)dt); |
381 | } | 383 | } |
382 | return true; | 384 | return true; |
383 | case FieldImpl::CustomField: | 385 | case FieldImpl::CustomField: |
384 | a.insertCustom( mImpl->app(), mImpl->key(), value ); | 386 | a.insertCustom( mImpl->app(), mImpl->key(), value ); |
385 | //US never copy the resourcename back to the adressee. | 387 | //US never copy the resourcename back to the adressee. |
386 | case FieldImpl::Resource: | 388 | case FieldImpl::Resource: |
387 | default: | 389 | default: |
388 | return false; | 390 | return false; |
389 | } | 391 | } |
390 | } | 392 | } |
391 | 393 | ||
392 | bool Field::isCustom() | 394 | bool Field::isCustom() |
393 | { | 395 | { |
394 | return mImpl->fieldId() == FieldImpl::CustomField; | 396 | return mImpl->fieldId() == FieldImpl::CustomField; |
395 | } | 397 | } |
396 | 398 | ||
397 | Field::List Field::allFields() | 399 | Field::List Field::allFields() |
398 | { | 400 | { |
399 | if ( mAllFields.isEmpty() ) { | 401 | if ( mAllFields.isEmpty() ) { |
400 | createField( FieldImpl::FormattedName, Frequent ); | 402 | createField( FieldImpl::FormattedName, Frequent ); |
401 | createField( FieldImpl::FamilyName, Frequent ); | 403 | createField( FieldImpl::FamilyName, Frequent ); |
402 | createField( FieldImpl::GivenName, Frequent ); | 404 | createField( FieldImpl::GivenName, Frequent ); |
403 | createField( FieldImpl::AdditionalName ); | 405 | createField( FieldImpl::AdditionalName ); |
404 | createField( FieldImpl::Prefix ); | 406 | createField( FieldImpl::Prefix ); |
405 | createField( FieldImpl::Suffix ); | 407 | createField( FieldImpl::Suffix ); |
406 | createField( FieldImpl::NickName, Personal ); | 408 | createField( FieldImpl::NickName, Personal ); |
407 | createField( FieldImpl::Birthday, Personal ); | 409 | createField( FieldImpl::Birthday, Personal ); |
408 | createField( FieldImpl::Category ); | 410 | createField( FieldImpl::Category ); |
409 | createField( FieldImpl::HomeAddressStreet, Address|Personal ); | 411 | createField( FieldImpl::HomeAddressStreet, Address|Personal ); |
410 | createField( FieldImpl::HomeAddressLocality, Address|Personal ); | 412 | createField( FieldImpl::HomeAddressLocality, Address|Personal ); |
411 | createField( FieldImpl::HomeAddressRegion, Address|Personal ); | 413 | createField( FieldImpl::HomeAddressRegion, Address|Personal ); |
412 | createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); | 414 | createField( FieldImpl::HomeAddressPostalCode, Address|Personal ); |
413 | createField( FieldImpl::HomeAddressCountry, Address|Personal ); | 415 | createField( FieldImpl::HomeAddressCountry, Address|Personal ); |
414 | createField( FieldImpl::HomeAddressLabel, Address|Personal ); | 416 | createField( FieldImpl::HomeAddressLabel, Address|Personal ); |
415 | createField( FieldImpl::BusinessAddressStreet, Address|Organization ); | 417 | createField( FieldImpl::BusinessAddressStreet, Address|Organization ); |
416 | createField( FieldImpl::BusinessAddressLocality, Address|Organization ); | 418 | createField( FieldImpl::BusinessAddressLocality, Address|Organization ); |
417 | createField( FieldImpl::BusinessAddressRegion, Address|Organization ); | 419 | createField( FieldImpl::BusinessAddressRegion, Address|Organization ); |
418 | createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); | 420 | createField( FieldImpl::BusinessAddressPostalCode, Address|Organization ); |
419 | createField( FieldImpl::BusinessAddressCountry, Address|Organization ); | 421 | createField( FieldImpl::BusinessAddressCountry, Address|Organization ); |
420 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); | 422 | createField( FieldImpl::BusinessAddressLabel, Address|Organization ); |
421 | createField( FieldImpl::HomePhone, Personal|Frequent ); | 423 | createField( FieldImpl::HomePhone, Personal|Frequent ); |
422 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); | 424 | createField( FieldImpl::BusinessPhone, Organization|Frequent ); |
423 | createField( FieldImpl::MobilePhone, Frequent ); | 425 | createField( FieldImpl::MobilePhone, Frequent ); |
424 | createField( FieldImpl::MobileWorkPhone, Frequent ); | 426 | createField( FieldImpl::MobileWorkPhone, Frequent ); |
425 | createField( FieldImpl::HomeFax ); | 427 | createField( FieldImpl::HomeFax ); |
426 | createField( FieldImpl::BusinessFax ); | 428 | createField( FieldImpl::BusinessFax ); |
427 | createField( FieldImpl::Isdn ); | 429 | createField( FieldImpl::Isdn ); |
428 | createField( FieldImpl::Pager ); | 430 | createField( FieldImpl::Pager ); |
429 | createField( FieldImpl::Email, Email|Frequent ); | 431 | createField( FieldImpl::Email, Email|Frequent ); |
430 | createField( FieldImpl::Mailer, Email ); | 432 | createField( FieldImpl::Mailer, Email ); |
431 | createField( FieldImpl::Title, Organization ); | 433 | createField( FieldImpl::Title, Organization ); |
432 | createField( FieldImpl::Role, Organization ); | 434 | createField( FieldImpl::Role, Organization ); |
433 | createField( FieldImpl::Organization, Organization ); | 435 | createField( FieldImpl::Organization, Organization ); |
434 | createField( FieldImpl::Note ); | 436 | createField( FieldImpl::Note ); |
435 | createField( FieldImpl::Url ); | 437 | createField( FieldImpl::Url ); |
436 | createField( FieldImpl::Resource ); | 438 | createField( FieldImpl::Resource ); |
437 | createField( FieldImpl::Sip ); | 439 | createField( FieldImpl::Sip ); |
438 | createField( FieldImpl::OtherPhone ); | 440 | createField( FieldImpl::OtherPhone ); |
439 | } | 441 | } |
440 | 442 | ||
441 | return mAllFields; | 443 | return mAllFields; |
442 | } | 444 | } |
443 | 445 | ||
444 | Field::List Field::defaultFields() | 446 | Field::List Field::defaultFields() |
445 | { | 447 | { |
446 | if ( mDefaultFields.isEmpty() ) { | 448 | if ( mDefaultFields.isEmpty() ) { |
447 | createDefaultField( FieldImpl::GivenName ); | 449 | createDefaultField( FieldImpl::GivenName ); |
448 | createDefaultField( FieldImpl::FamilyName ); | 450 | createDefaultField( FieldImpl::FamilyName ); |
449 | createDefaultField( FieldImpl::Email ); | 451 | createDefaultField( FieldImpl::Email ); |
450 | } | 452 | } |
451 | 453 | ||
452 | return mDefaultFields; | 454 | return mDefaultFields; |
453 | } | 455 | } |
454 | 456 | ||
455 | void Field::createField( int id, int category ) | 457 | void Field::createField( int id, int category ) |
456 | { | 458 | { |
457 | mAllFields.append( new Field( new FieldImpl( id, category ) ) ); | 459 | mAllFields.append( new Field( new FieldImpl( id, category ) ) ); |
458 | } | 460 | } |
459 | 461 | ||
460 | void Field::createDefaultField( int id, int category ) | 462 | void Field::createDefaultField( int id, int category ) |
461 | { | 463 | { |
462 | mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); | 464 | mDefaultFields.append( new Field( new FieldImpl( id, category ) ) ); |
463 | } | 465 | } |
464 | 466 | ||
465 | void Field::deleteFields() | 467 | void Field::deleteFields() |
466 | { | 468 | { |
467 | Field::List::ConstIterator it; | 469 | Field::List::ConstIterator it; |
468 | 470 | ||
469 | for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { | 471 | for( it = mAllFields.begin(); it != mAllFields.end(); ++it ) { |
470 | delete (*it); | 472 | delete (*it); |
471 | } | 473 | } |
472 | mAllFields.clear(); | 474 | mAllFields.clear(); |
473 | 475 | ||
474 | for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) { | 476 | for( it = mDefaultFields.begin(); it != mDefaultFields.end(); ++it ) { |
475 | delete (*it); | 477 | delete (*it); |
476 | } | 478 | } |
477 | mDefaultFields.clear(); | 479 | mDefaultFields.clear(); |
478 | 480 | ||
479 | for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) { | 481 | for( it = mCustomFields.begin(); it != mCustomFields.end(); ++it ) { |
480 | delete (*it); | 482 | delete (*it); |
481 | } | 483 | } |
482 | mCustomFields.clear(); | 484 | mCustomFields.clear(); |
483 | } | 485 | } |
484 | 486 | ||
485 | void Field::saveFields( const QString &identifier, | 487 | void Field::saveFields( const QString &identifier, |
486 | const Field::List &fields ) | 488 | const Field::List &fields ) |
487 | { | 489 | { |
488 | KConfig *cfg = KGlobal::config(); | 490 | KConfig *cfg = KGlobal::config(); |
489 | KConfigGroupSaver( cfg, "KABCFields" ); | 491 | KConfigGroupSaver( cfg, "KABCFields" ); |
490 | saveFields( cfg, identifier, fields ); | 492 | saveFields( cfg, identifier, fields ); |
491 | } | 493 | } |
492 | 494 | ||
493 | void Field::saveFields( KConfig *cfg, const QString &identifier, | 495 | void Field::saveFields( KConfig *cfg, const QString &identifier, |
494 | const Field::List &fields ) | 496 | const Field::List &fields ) |
495 | { | 497 | { |
496 | QValueList<int> fieldIds; | 498 | Q3ValueList<int> fieldIds; |
497 | 499 | ||
498 | //US | 500 | //US |
499 | // qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1()); | 501 | // qDebug("Field::saveFields to %s %s", cfg->getFileName().latin1(), identifier.latin1()); |
500 | 502 | ||
501 | int custom = 0; | 503 | int custom = 0; |
502 | Field::List::ConstIterator it; | 504 | Field::List::ConstIterator it; |
503 | for( it = fields.begin(); it != fields.end(); ++it ) { | 505 | for( it = fields.begin(); it != fields.end(); ++it ) { |
504 | //US | 506 | //US |
505 | // qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId()); | 507 | // qDebug("Field::saveFields field:%i", (*it)->mImpl->fieldId()); |
506 | 508 | ||
507 | fieldIds.append( (*it)->mImpl->fieldId() ); | 509 | fieldIds.append( (*it)->mImpl->fieldId() ); |
508 | if( (*it)->isCustom() ) { | 510 | if( (*it)->isCustom() ) { |
509 | QStringList customEntry; | 511 | QStringList customEntry; |
510 | customEntry << (*it)->mImpl->label(); | 512 | customEntry << (*it)->mImpl->label(); |
511 | customEntry << (*it)->mImpl->key(); | 513 | customEntry << (*it)->mImpl->key(); |
512 | customEntry << (*it)->mImpl->app(); | 514 | customEntry << (*it)->mImpl->app(); |
513 | cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" + | 515 | cfg->writeEntry( "KABC_CustomEntry_" + identifier + "_" + |
514 | QString::number( custom++ ), customEntry ); | 516 | QString::number( custom++ ), customEntry ); |
515 | } | 517 | } |
516 | } | 518 | } |
517 | cfg->writeEntry( identifier, fieldIds ); | 519 | cfg->writeEntry( identifier, fieldIds ); |
518 | } | 520 | } |
519 | 521 | ||
520 | Field::List Field::restoreFields( const QString &identifier ) | 522 | Field::List Field::restoreFields( const QString &identifier ) |
521 | { | 523 | { |
522 | //US | 524 | //US |
523 | // qDebug("Field::restoreFields, identifier: %s", identifier.latin1()); | 525 | // qDebug("Field::restoreFields, identifier: %s", identifier.latin1()); |
524 | 526 | ||
525 | KConfig *cfg = KGlobal::config(); | 527 | KConfig *cfg = KGlobal::config(); |
526 | KConfigGroupSaver( cfg, "KABCFields" ); | 528 | KConfigGroupSaver( cfg, "KABCFields" ); |
527 | cfg->setGroup( "KABCFields" ); | 529 | cfg->setGroup( "KABCFields" ); |
528 | 530 | ||
529 | Field::List l = restoreFields( cfg, identifier ); | 531 | Field::List l = restoreFields( cfg, identifier ); |
530 | 532 | ||
531 | return l; | 533 | return l; |
532 | } | 534 | } |
533 | 535 | ||
534 | Field::List Field::restoreFields( KConfig *cfg, const QString &identifier ) | 536 | Field::List Field::restoreFields( KConfig *cfg, const QString &identifier ) |
535 | { | 537 | { |
536 | QValueList<int> fieldIds = cfg->readIntListEntry( identifier); | 538 | Q3ValueList<int> fieldIds = cfg->readIntListEntry( identifier); |
537 | //US | 539 | //US |
538 | // qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1()); | 540 | // qDebug("Field::restoreFields from %s, identifier: %s", cfg->getFileName().latin1(), identifier.latin1()); |
539 | 541 | ||
540 | Field::List fields; | 542 | Field::List fields; |
541 | 543 | ||
542 | int custom = 0; | 544 | int custom = 0; |
543 | QValueList<int>::ConstIterator it; | 545 | Q3ValueList<int>::ConstIterator it; |
544 | for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) { | 546 | for( it = fieldIds.begin(); it != fieldIds.end(); ++it ) { |
545 | FieldImpl *f = 0; | 547 | FieldImpl *f = 0; |
546 | if ( (*it) == FieldImpl::CustomField ) { | 548 | if ( (*it) == FieldImpl::CustomField ) { |
547 | QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" + | 549 | QStringList customEntry = cfg->readListEntry( "KABC_CustomEntry_" + |
548 | identifier + "_" + | 550 | identifier + "_" + |
549 | QString::number( custom++ ) ); | 551 | QString::number( custom++ ) ); |
550 | f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ], | 552 | f = new FieldImpl( *it, CustomCategory, customEntry[ 0 ], |
551 | customEntry[ 1 ], customEntry[ 2 ] ); | 553 | customEntry[ 1 ], customEntry[ 2 ] ); |
552 | } else { | 554 | } else { |
553 | f = new FieldImpl( *it ); | 555 | f = new FieldImpl( *it ); |
554 | } | 556 | } |
555 | fields.append( new Field( f ) ); | 557 | fields.append( new Field( f ) ); |
556 | } | 558 | } |
557 | 559 | ||
558 | return fields; | 560 | return fields; |
559 | } | 561 | } |
560 | 562 | ||
561 | bool Field::equals( Field *field ) | 563 | bool Field::equals( Field *field ) |
562 | { | 564 | { |
563 | bool sameId = ( mImpl->fieldId() == field->mImpl->fieldId() ); | 565 | bool sameId = ( mImpl->fieldId() == field->mImpl->fieldId() ); |
564 | 566 | ||
565 | if ( !sameId ) return false; | 567 | if ( !sameId ) return false; |
566 | 568 | ||
567 | if ( mImpl->fieldId() != FieldImpl::CustomField ) return true; | 569 | if ( mImpl->fieldId() != FieldImpl::CustomField ) return true; |
568 | 570 | ||
569 | return mImpl->key() == field->mImpl->key(); | 571 | return mImpl->key() == field->mImpl->key(); |
570 | } | 572 | } |
571 | 573 | ||
572 | Field *Field::createCustomField( const QString &label, int category, | 574 | Field *Field::createCustomField( const QString &label, int category, |
573 | const QString &key, const QString &app ) | 575 | const QString &key, const QString &app ) |
574 | { | 576 | { |
575 | Field *field = new Field( new FieldImpl( FieldImpl::CustomField, | 577 | Field *field = new Field( new FieldImpl( FieldImpl::CustomField, |
576 | category | CustomCategory, | 578 | category | CustomCategory, |
577 | label, key, app ) ); | 579 | label, key, app ) ); |
578 | //US | 580 | //US |
579 | // qDebug("Field::createCustomField label %s", label.latin1() ); | 581 | // qDebug("Field::createCustomField label %s", label.latin1() ); |
580 | 582 | ||
581 | mCustomFields.append( field ); | 583 | mCustomFields.append( field ); |
582 | 584 | ||
583 | return field; | 585 | return field; |
584 | } | 586 | } |
diff --git a/kabc/field.h b/kabc/field.h index 9e06597..55cc705 100644 --- a/kabc/field.h +++ b/kabc/field.h | |||
@@ -1,178 +1,178 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2002 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_FIELD_H | 28 | #ifndef KABC_FIELD_H |
29 | #define KABC_FIELD_H | 29 | #define KABC_FIELD_H |
30 | 30 | ||
31 | #include <qstring.h> | 31 | #include <qstring.h> |
32 | #include <qvaluelist.h> | 32 | #include <q3valuelist.h> |
33 | 33 | ||
34 | #include "addressee.h" | 34 | #include "addressee.h" |
35 | 35 | ||
36 | class KConfig; | 36 | class KConfig; |
37 | 37 | ||
38 | namespace KABC { | 38 | namespace KABC { |
39 | 39 | ||
40 | class Field | 40 | class Field |
41 | { | 41 | { |
42 | class FieldImpl; | 42 | class FieldImpl; |
43 | friend class FieldImpl; | 43 | friend class FieldImpl; |
44 | 44 | ||
45 | public: | 45 | public: |
46 | typedef QValueList<Field *> List; | 46 | typedef Q3ValueList<Field *> List; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * @li @p All - | 49 | * @li @p All - |
50 | * @li @p Frequent - | 50 | * @li @p Frequent - |
51 | * @li @p Address - | 51 | * @li @p Address - |
52 | * @li @p Email - | 52 | * @li @p Email - |
53 | * @li @p Personal - | 53 | * @li @p Personal - |
54 | * @li @p Organization - | 54 | * @li @p Organization - |
55 | * @li @p CustomCategory - | 55 | * @li @p CustomCategory - |
56 | */ | 56 | */ |
57 | enum FieldCategory | 57 | enum FieldCategory |
58 | { | 58 | { |
59 | All = 0x0, | 59 | All = 0x0, |
60 | Frequent = 0x01, | 60 | Frequent = 0x01, |
61 | Address = 0x02, | 61 | Address = 0x02, |
62 | Email = 0x04, | 62 | Email = 0x04, |
63 | Personal = 0x08, | 63 | Personal = 0x08, |
64 | Organization = 0x10, | 64 | Organization = 0x10, |
65 | CustomCategory = 0x20 | 65 | CustomCategory = 0x20 |
66 | }; | 66 | }; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Returns the translated label for this field. | 69 | * Returns the translated label for this field. |
70 | */ | 70 | */ |
71 | virtual QString label(); | 71 | virtual QString label(); |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Returns the ored categories the field belongs to. | 74 | * Returns the ored categories the field belongs to. |
75 | */ | 75 | */ |
76 | virtual int category(); | 76 | virtual int category(); |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * Returns the translated label for field category. | 79 | * Returns the translated label for field category. |
80 | */ | 80 | */ |
81 | static QString categoryLabel( int category ); | 81 | static QString categoryLabel( int category ); |
82 | 82 | ||
83 | /** | 83 | /** |
84 | * Returns a string representation of the value the field has in the given | 84 | * Returns a string representation of the value the field has in the given |
85 | * Addressee. Returns QString::null, if it is not possible to convert the | 85 | * Addressee. Returns QString::null, if it is not possible to convert the |
86 | * value to a string. | 86 | * value to a string. |
87 | */ | 87 | */ |
88 | virtual QString value( const KABC::Addressee & ); | 88 | virtual QString value( const KABC::Addressee & ); |
89 | 89 | ||
90 | /** | 90 | /** |
91 | * Sets the value of the field in the given Addressee. Returns true on success | 91 | * Sets the value of the field in the given Addressee. Returns true on success |
92 | * or false, if the given string couldn't be converted to a valid value. | 92 | * or false, if the given string couldn't be converted to a valid value. |
93 | */ | 93 | */ |
94 | virtual bool setValue( KABC::Addressee &, const QString & ); | 94 | virtual bool setValue( KABC::Addressee &, const QString & ); |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Returns, if the field is a user-defined field. | 97 | * Returns, if the field is a user-defined field. |
98 | */ | 98 | */ |
99 | virtual bool isCustom(); | 99 | virtual bool isCustom(); |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Returns, if the field is equal with @param field. | 102 | * Returns, if the field is equal with @param field. |
103 | */ | 103 | */ |
104 | virtual bool equals( Field *field ); | 104 | virtual bool equals( Field *field ); |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Returns a list of all fields. | 107 | * Returns a list of all fields. |
108 | */ | 108 | */ |
109 | static Field::List allFields(); | 109 | static Field::List allFields(); |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Returns a list of the default fields. | 112 | * Returns a list of the default fields. |
113 | */ | 113 | */ |
114 | static Field::List defaultFields(); | 114 | static Field::List defaultFields(); |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Creates a custom field. | 117 | * Creates a custom field. |
118 | * | 118 | * |
119 | * @param label The label for this field | 119 | * @param label The label for this field |
120 | * @param category The category of this field | 120 | * @param category The category of this field |
121 | * @param key Unique key for this field | 121 | * @param key Unique key for this field |
122 | * @param app Unique app name for this field | 122 | * @param app Unique app name for this field |
123 | */ | 123 | */ |
124 | static Field *createCustomField( const QString &label, int category, | 124 | static Field *createCustomField( const QString &label, int category, |
125 | const QString &key, const QString &app ); | 125 | const QString &key, const QString &app ); |
126 | 126 | ||
127 | /** | 127 | /** |
128 | * Delete all fields from list. | 128 | * Delete all fields from list. |
129 | */ | 129 | */ |
130 | static void deleteFields(); | 130 | static void deleteFields(); |
131 | 131 | ||
132 | /** | 132 | /** |
133 | * Save the field settings to a config file. | 133 | * Save the field settings to a config file. |
134 | * | 134 | * |
135 | * @param cfg The config file object | 135 | * @param cfg The config file object |
136 | * @param identifier The unique identifier | 136 | * @param identifier The unique identifier |
137 | * @param fields The list of the fields | 137 | * @param fields The list of the fields |
138 | */ | 138 | */ |
139 | static void saveFields( KConfig *cfg, const QString &identifier, | 139 | static void saveFields( KConfig *cfg, const QString &identifier, |
140 | const Field::List &fields ); | 140 | const Field::List &fields ); |
141 | /** | 141 | /** |
142 | * This is the same as above, with the difference, that | 142 | * This is the same as above, with the difference, that |
143 | * the list is stored in KGlobal::config() in group "KABCFields". | 143 | * the list is stored in KGlobal::config() in group "KABCFields". |
144 | */ | 144 | */ |
145 | static void saveFields( const QString &identifier, | 145 | static void saveFields( const QString &identifier, |
146 | const Field::List &fields ); | 146 | const Field::List &fields ); |
147 | 147 | ||
148 | /** | 148 | /** |
149 | * Load the field settings from a config file. | 149 | * Load the field settings from a config file. |
150 | * | 150 | * |
151 | * @param cfg The config file object | 151 | * @param cfg The config file object |
152 | * @param identifier The unique identifier | 152 | * @param identifier The unique identifier |
153 | */ | 153 | */ |
154 | static Field::List restoreFields( KConfig *cfg, const QString &identifier ); | 154 | static Field::List restoreFields( KConfig *cfg, const QString &identifier ); |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * This is the same as above, with the difference, that | 157 | * This is the same as above, with the difference, that |
158 | * the list is loaded from KGlobal::config() from group "KABCFields". | 158 | * the list is loaded from KGlobal::config() from group "KABCFields". |
159 | */ | 159 | */ |
160 | static Field::List restoreFields( const QString &identifier ); | 160 | static Field::List restoreFields( const QString &identifier ); |
161 | 161 | ||
162 | protected: | 162 | protected: |
163 | static void createField( int id, int category = 0 ); | 163 | static void createField( int id, int category = 0 ); |
164 | static void createDefaultField( int id, int category = 0 ); | 164 | static void createDefaultField( int id, int category = 0 ); |
165 | 165 | ||
166 | private: | 166 | private: |
167 | Field( FieldImpl * ); | 167 | Field( FieldImpl * ); |
168 | virtual ~Field(); | 168 | virtual ~Field(); |
169 | 169 | ||
170 | FieldImpl *mImpl; | 170 | FieldImpl *mImpl; |
171 | 171 | ||
172 | static Field::List mAllFields; | 172 | static Field::List mAllFields; |
173 | static Field::List mDefaultFields; | 173 | static Field::List mDefaultFields; |
174 | static Field::List mCustomFields; | 174 | static Field::List mCustomFields; |
175 | }; | 175 | }; |
176 | 176 | ||
177 | } | 177 | } |
178 | #endif | 178 | #endif |
diff --git a/kabc/formatfactory.cpp b/kabc/formatfactory.cpp index 3ae1c27..cbb97a2 100644 --- a/kabc/formatfactory.cpp +++ b/kabc/formatfactory.cpp | |||
@@ -1,181 +1,181 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <kdebug.h> | 21 | #include <kdebug.h> |
22 | #include <klocale.h> | 22 | #include <klocale.h> |
23 | #include <ksimpleconfig.h> | 23 | #include <ksimpleconfig.h> |
24 | #include <kstandarddirs.h> | 24 | #include <kstandarddirs.h> |
25 | #include <kstaticdeleter.h> | 25 | #include <kstaticdeleter.h> |
26 | 26 | ||
27 | #include <qfile.h> | 27 | #include <qfile.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | 29 | ||
30 | #include "vcardformatplugin.h" | 30 | #include "vcardformatplugin.h" |
31 | 31 | ||
32 | #include "formatfactory.h" | 32 | #include "formatfactory.h" |
33 | 33 | ||
34 | using namespace KABC; | 34 | using namespace KABC; |
35 | 35 | ||
36 | FormatFactory *FormatFactory::mSelf = 0; | 36 | FormatFactory *FormatFactory::mSelf = 0; |
37 | static KStaticDeleter<FormatFactory> factoryDeleter; | 37 | static KStaticDeleter<FormatFactory> factoryDeleter; |
38 | 38 | ||
39 | FormatFactory *FormatFactory::self() | 39 | FormatFactory *FormatFactory::self() |
40 | { | 40 | { |
41 | if ( !mSelf ) { | 41 | if ( !mSelf ) { |
42 | //US factoryDeleter.setObject( mSelf, new FormatFactory ); | 42 | //US factoryDeleter.setObject( mSelf, new FormatFactory ); |
43 | mSelf = factoryDeleter.setObject( new FormatFactory ); | 43 | mSelf = factoryDeleter.setObject( new FormatFactory ); |
44 | } | 44 | } |
45 | return mSelf; | 45 | return mSelf; |
46 | } | 46 | } |
47 | 47 | ||
48 | FormatFactory::FormatFactory() | 48 | FormatFactory::FormatFactory() |
49 | { | 49 | { |
50 | mFormatList.setAutoDelete( true ); | 50 | mFormatList.setAutoDelete( true ); |
51 | 51 | ||
52 | // dummy entry for default format | 52 | // dummy entry for default format |
53 | FormatInfo *info = new FormatInfo; | 53 | FormatInfo *info = new FormatInfo; |
54 | info->library = "<NoLibrary>"; | 54 | info->library = "<NoLibrary>"; |
55 | info->nameLabel = i18n( "vCard" ); | 55 | info->nameLabel = i18n( "vCard" ); |
56 | info->descriptionLabel = i18n( "vCard Format" ); | 56 | info->descriptionLabel = i18n( "vCard Format" ); |
57 | mFormatList.insert( "vcard", info ); | 57 | mFormatList.insert( "vcard", info ); |
58 | 58 | ||
59 | #if 0 | 59 | #if 0 |
60 | US lets enter all resources directly instead of using teh desktopfiles. | 60 | US lets enter all resources directly instead of using teh desktopfiles. |
61 | 61 | ||
62 | QStringList list = KGlobal::dirs()->findAllResources( "data" ,"kabc/formats/*.desktop", true, true ); | 62 | QStringList list = KGlobal::dirs()->findAllResources( "data" ,"kabc/formats/*.desktop", true, true ); |
63 | for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) | 63 | for ( QStringList::ConstIterator it = list.begin(); it != list.end(); ++it ) |
64 | { | 64 | { |
65 | //US KSimpleConfig config( *it, true ); | 65 | //US KSimpleConfig config( *it, true ); |
66 | KConfig config( *it ); | 66 | KConfig config( *it ); |
67 | 67 | ||
68 | if ( !config.hasGroup( "Misc" ) || !config.hasGroup( "Plugin" ) ) | 68 | if ( !config.hasGroup( "Misc" ) || !config.hasGroup( "Plugin" ) ) |
69 | continue; | 69 | continue; |
70 | 70 | ||
71 | info = new FormatInfo; | 71 | info = new FormatInfo; |
72 | 72 | ||
73 | config.setGroup( "Plugin" ); | 73 | config.setGroup( "Plugin" ); |
74 | QString type = config.readEntry( "Type" ); | 74 | QString type = config.readEntry( "Type" ); |
75 | info->library = config.readEntry( "X-KDE-Library" ); | 75 | info->library = config.readEntry( "X-KDE-Library" ); |
76 | 76 | ||
77 | config.setGroup( "Misc" ); | 77 | config.setGroup( "Misc" ); |
78 | info->nameLabel = config.readEntry( "Name" ); | 78 | info->nameLabel = config.readEntry( "Name" ); |
79 | info->descriptionLabel = config.readEntry( "Comment", i18n( "No description available." ) ); | 79 | info->descriptionLabel = config.readEntry( "Comment", i18n( "No description available." ) ); |
80 | 80 | ||
81 | mFormatList.insert( type, info ); | 81 | mFormatList.insert( type, info ); |
82 | } | 82 | } |
83 | #endif | 83 | #endif |
84 | //US we already have vcard as default format. | 84 | //US we already have vcard as default format. |
85 | info = new FormatInfo; | 85 | info = new FormatInfo; |
86 | info->library = i18n("microkabcformat_binary"); | 86 | info->library = i18n("microkabcformat_binary"); |
87 | info->nameLabel = i18n( "Binary" ); | 87 | info->nameLabel = i18n( "Binary" ); |
88 | info->descriptionLabel = i18n( "No description available." ); | 88 | info->descriptionLabel = i18n( "No description available." ); |
89 | mFormatList.insert( "binary", info ); | 89 | mFormatList.insert( "binary", info ); |
90 | 90 | ||
91 | } | 91 | } |
92 | 92 | ||
93 | FormatFactory::~FormatFactory() | 93 | FormatFactory::~FormatFactory() |
94 | { | 94 | { |
95 | mFormatList.clear(); | 95 | mFormatList.clear(); |
96 | } | 96 | } |
97 | 97 | ||
98 | QStringList FormatFactory::formats() | 98 | QStringList FormatFactory::formats() |
99 | { | 99 | { |
100 | QStringList retval; | 100 | QStringList retval; |
101 | 101 | ||
102 | // make sure 'vcard' is the first entry | 102 | // make sure 'vcard' is the first entry |
103 | retval << "vcard"; | 103 | retval << "vcard"; |
104 | 104 | ||
105 | QDictIterator<FormatInfo> it( mFormatList ); | 105 | Q3DictIterator<FormatInfo> it( mFormatList ); |
106 | for ( ; it.current(); ++it ) | 106 | for ( ; it.current(); ++it ) |
107 | if ( it.currentKey() != "vcard" ) | 107 | if ( it.currentKey() != "vcard" ) |
108 | retval << it.currentKey(); | 108 | retval << it.currentKey(); |
109 | 109 | ||
110 | return retval; | 110 | return retval; |
111 | } | 111 | } |
112 | 112 | ||
113 | FormatInfo *FormatFactory::info( const QString &type ) | 113 | FormatInfo *FormatFactory::info( const QString &type ) |
114 | { | 114 | { |
115 | if ( type.isEmpty() ) | 115 | if ( type.isEmpty() ) |
116 | return 0; | 116 | return 0; |
117 | else | 117 | else |
118 | return mFormatList[ type ]; | 118 | return mFormatList[ type ]; |
119 | } | 119 | } |
120 | 120 | ||
121 | FormatPlugin *FormatFactory::format( const QString& type ) | 121 | FormatPlugin *FormatFactory::format( const QString& type ) |
122 | { | 122 | { |
123 | FormatPlugin *format = 0; | 123 | FormatPlugin *format = 0; |
124 | 124 | ||
125 | if ( type.isEmpty() ) | 125 | if ( type.isEmpty() ) |
126 | return 0; | 126 | return 0; |
127 | 127 | ||
128 | if ( type == "vcard" ) { | 128 | if ( type == "vcard" ) { |
129 | format = new VCardFormatPlugin; | 129 | format = new VCardFormatPlugin; |
130 | format->setType( type ); | 130 | format->setType( type ); |
131 | format->setNameLabel( i18n( "vCard" ) ); | 131 | format->setNameLabel( i18n( "vCard" ) ); |
132 | format->setDescriptionLabel( i18n( "vCard Format" ) ); | 132 | format->setDescriptionLabel( i18n( "vCard Format" ) ); |
133 | return format; | 133 | return format; |
134 | } | 134 | } |
135 | 135 | ||
136 | FormatInfo *fi = mFormatList[ type ]; | 136 | FormatInfo *fi = mFormatList[ type ]; |
137 | if (!fi) | 137 | if (!fi) |
138 | return 0; | 138 | return 0; |
139 | QString libName = fi->library; | 139 | QString libName = fi->library; |
140 | #ifndef DESKTOP_VERSION | 140 | #ifndef DESKTOP_VERSION |
141 | KLibrary *library = openLibrary( libName ); | 141 | KLibrary *library = openLibrary( libName ); |
142 | if ( !library ) | 142 | if ( !library ) |
143 | return 0; | 143 | return 0; |
144 | 144 | ||
145 | void *format_func = library->symbol( "format"); | 145 | void *format_func = library->symbol( "format"); |
146 | 146 | ||
147 | if ( format_func ) { | 147 | if ( format_func ) { |
148 | format = ((FormatPlugin* (*)())format_func)(); | 148 | format = ((FormatPlugin* (*)())format_func)(); |
149 | format->setType( type ); | 149 | format->setType( type ); |
150 | format->setNameLabel( fi->nameLabel ); | 150 | format->setNameLabel( fi->nameLabel ); |
151 | format->setDescriptionLabel( fi->descriptionLabel ); | 151 | format->setDescriptionLabel( fi->descriptionLabel ); |
152 | } else { | 152 | } else { |
153 | kdDebug( 5700 ) << "'" << libName << "' is not a format plugin." << endl; | 153 | kdDebug( 5700 ) << "'" << libName << "' is not a format plugin." << endl; |
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | #endif | 156 | #endif |
157 | return format; | 157 | return format; |
158 | } | 158 | } |
159 | 159 | ||
160 | #ifndef DESKTOP_VERSION | 160 | #ifndef DESKTOP_VERSION |
161 | KLibrary *FormatFactory::openLibrary( const QString& libName ) | 161 | KLibrary *FormatFactory::openLibrary( const QString& libName ) |
162 | { | 162 | { |
163 | KLibrary *library = 0; | 163 | KLibrary *library = 0; |
164 | 164 | ||
165 | QString path = KLibLoader::findLibrary( QFile::encodeName( libName ) ); | 165 | QString path = KLibLoader::findLibrary( QFile::encodeName( libName ) ); |
166 | 166 | ||
167 | if ( path.isEmpty() ) { | 167 | if ( path.isEmpty() ) { |
168 | kdDebug( 5700 ) << "No format plugin library was found!" << endl; | 168 | kdDebug( 5700 ) << "No format plugin library was found!" << endl; |
169 | return 0; | 169 | return 0; |
170 | } | 170 | } |
171 | 171 | ||
172 | library = KLibLoader::self()->library( QFile::encodeName( path ) ); | 172 | library = KLibLoader::self()->library( QFile::encodeName( path ) ); |
173 | 173 | ||
174 | if ( !library ) { | 174 | if ( !library ) { |
175 | kdDebug( 5700 ) << "Could not load library '" << libName << "'" << endl; | 175 | kdDebug( 5700 ) << "Could not load library '" << libName << "'" << endl; |
176 | return 0; | 176 | return 0; |
177 | } | 177 | } |
178 | 178 | ||
179 | return library; | 179 | return library; |
180 | } | 180 | } |
181 | #endif | 181 | #endif |
diff --git a/kabc/formatfactory.h b/kabc/formatfactory.h index 9612374..de15b17 100644 --- a/kabc/formatfactory.h +++ b/kabc/formatfactory.h | |||
@@ -1,104 +1,104 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef KABC_FORMATFACTORY_H | 21 | #ifndef KABC_FORMATFACTORY_H |
22 | #define KABC_FORMATFACTORY_H | 22 | #define KABC_FORMATFACTORY_H |
23 | 23 | ||
24 | #include <qdict.h> | 24 | #include <q3dict.h> |
25 | #include <qstring.h> | 25 | #include <qstring.h> |
26 | 26 | ||
27 | #include <kconfig.h> | 27 | #include <kconfig.h> |
28 | #ifndef DESKTOP_VERSION | 28 | #ifndef DESKTOP_VERSION |
29 | #include <klibloader.h> | 29 | #include <klibloader.h> |
30 | #endif | 30 | #endif |
31 | 31 | ||
32 | #include "formatplugin.h" | 32 | #include "formatplugin.h" |
33 | 33 | ||
34 | namespace KABC { | 34 | namespace KABC { |
35 | 35 | ||
36 | struct FormatInfo | 36 | struct FormatInfo |
37 | { | 37 | { |
38 | QString library; | 38 | QString library; |
39 | QString nameLabel; | 39 | QString nameLabel; |
40 | QString descriptionLabel; | 40 | QString descriptionLabel; |
41 | }; | 41 | }; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Class for loading format plugins. | 44 | * Class for loading format plugins. |
45 | * | 45 | * |
46 | * Example: | 46 | * Example: |
47 | * | 47 | * |
48 | * <pre> | 48 | * <pre> |
49 | * KABC::FormatFactory *factory = KABC::FormatFactory::self(); | 49 | * KABC::FormatFactory *factory = KABC::FormatFactory::self(); |
50 | * | 50 | * |
51 | * QStringList list = factory->formats(); | 51 | * QStringList list = factory->formats(); |
52 | * QStringList::Iterator it; | 52 | * QStringList::Iterator it; |
53 | * for ( it = list.begin(); it != list.end(); ++it ) { | 53 | * for ( it = list.begin(); it != list.end(); ++it ) { |
54 | * KABC::FormatPlugin *format = factory->format( (*it) ); | 54 | * KABC::FormatPlugin *format = factory->format( (*it) ); |
55 | * // do something with format | 55 | * // do something with format |
56 | * } | 56 | * } |
57 | * </pre> | 57 | * </pre> |
58 | */ | 58 | */ |
59 | class FormatFactory | 59 | class FormatFactory |
60 | { | 60 | { |
61 | public: | 61 | public: |
62 | 62 | ||
63 | /** | 63 | /** |
64 | Destructor. | 64 | Destructor. |
65 | */ | 65 | */ |
66 | ~FormatFactory(); | 66 | ~FormatFactory(); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Returns the global format factory. | 69 | * Returns the global format factory. |
70 | */ | 70 | */ |
71 | static FormatFactory *self(); | 71 | static FormatFactory *self(); |
72 | 72 | ||
73 | /** | 73 | /** |
74 | * Returns a pointer to a format object or a null pointer | 74 | * Returns a pointer to a format object or a null pointer |
75 | * if format type doesn't exist. | 75 | * if format type doesn't exist. |
76 | * | 76 | * |
77 | * @param type The type of the format, returned by @ref formats() | 77 | * @param type The type of the format, returned by @ref formats() |
78 | */ | 78 | */ |
79 | FormatPlugin *format( const QString &type ); | 79 | FormatPlugin *format( const QString &type ); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Returns a list of all available format types. | 82 | * Returns a list of all available format types. |
83 | */ | 83 | */ |
84 | QStringList formats(); | 84 | QStringList formats(); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Returns the info structure for a special type. | 87 | * Returns the info structure for a special type. |
88 | */ | 88 | */ |
89 | FormatInfo *info( const QString &type ); | 89 | FormatInfo *info( const QString &type ); |
90 | 90 | ||
91 | protected: | 91 | protected: |
92 | FormatFactory(); | 92 | FormatFactory(); |
93 | 93 | ||
94 | private: | 94 | private: |
95 | #ifndef DESKTOP_VERSION | 95 | #ifndef DESKTOP_VERSION |
96 | KLibrary *openLibrary( const QString& libName ); | 96 | KLibrary *openLibrary( const QString& libName ); |
97 | #endif | 97 | #endif |
98 | static FormatFactory *mSelf; | 98 | static FormatFactory *mSelf; |
99 | 99 | ||
100 | QDict<FormatInfo> mFormatList; | 100 | Q3Dict<FormatInfo> mFormatList; |
101 | }; | 101 | }; |
102 | 102 | ||
103 | } | 103 | } |
104 | #endif | 104 | #endif |
diff --git a/kabc/formats/binary/kabcformat_binaryE.pro b/kabc/formats/binary/kabcformat_binaryE.pro index 2d9594d..c71197e 100644 --- a/kabc/formats/binary/kabcformat_binaryE.pro +++ b/kabc/formats/binary/kabcformat_binaryE.pro | |||
@@ -1,21 +1,21 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabcformat_binary | 5 | TARGET = microkabcformat_binary |
6 | #INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../qtcompat | 6 | #INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kdeui ../microkde/kio/kfile ../qtcompat |
7 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../qtcompat | 7 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../qtcompat |
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc | 9 | MOC_DIR = moc |
10 | DESTDIR = $(QPEDIR)/lib | 10 | DESTDIR = $(QPEDIR)/lib |
11 | LIBS += -lmicrokde -lmicrokabc | 11 | LIBS += -lxmicrokde -lxmicrokabc |
12 | LIBS += -L$(QPEDIR)/lib | 12 | LIBS += -L$(QPEDIR)/lib |
13 | DEFINES += KAB_EMBEDDED | 13 | DEFINES += KAB_EMBEDDED |
14 | 14 | ||
15 | INTERFACES = \ | 15 | INTERFACES = \ |
16 | 16 | ||
17 | HEADERS = \ | 17 | HEADERS = \ |
18 | binaryformat.h | 18 | binaryformat.h |
19 | 19 | ||
20 | SOURCES = \ | 20 | SOURCES = \ |
21 | binaryformat.cpp | 21 | binaryformat.cpp |
diff --git a/kabc/formats/vcardformatplugin2.cpp b/kabc/formats/vcardformatplugin2.cpp index 41b0c9a..fbebe92 100644 --- a/kabc/formats/vcardformatplugin2.cpp +++ b/kabc/formats/vcardformatplugin2.cpp | |||
@@ -1,124 +1,124 @@ | |||
1 | /* | 1 | /* |
2 | Enhanced Version of the file for platform independent KDE tools. | 2 | Enhanced Version of the file for platform independent KDE tools. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | $Id$ | 5 | $Id$ |
6 | */ | 6 | */ |
7 | 7 | ||
8 | #include "vcardformatplugin2.h" | 8 | #include "vcardformatplugin2.h" |
9 | 9 | ||
10 | #include "address.h" | 10 | #include "address.h" |
11 | #include "addressee.h" | 11 | #include "addressee.h" |
12 | #include "vcardparser/vcardtool.h" | 12 | #include "vcardparser/vcardtool.h" |
13 | 13 | ||
14 | #include <qtextstream.h> | 14 | #include <q3textstream.h> |
15 | #include <qfile.h> | 15 | #include <qfile.h> |
16 | 16 | ||
17 | using namespace KABC; | 17 | using namespace KABC; |
18 | 18 | ||
19 | extern "C" | 19 | extern "C" |
20 | { | 20 | { |
21 | FormatPlugin *format() | 21 | FormatPlugin *format() |
22 | { | 22 | { |
23 | return new VCardFormatPlugin2(); | 23 | return new VCardFormatPlugin2(); |
24 | } | 24 | } |
25 | } | 25 | } |
26 | 26 | ||
27 | VCardFormatPlugin2::VCardFormatPlugin2() | 27 | VCardFormatPlugin2::VCardFormatPlugin2() |
28 | { | 28 | { |
29 | } | 29 | } |
30 | 30 | ||
31 | VCardFormatPlugin2::~VCardFormatPlugin2() | 31 | VCardFormatPlugin2::~VCardFormatPlugin2() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file ) | 35 | bool VCardFormatPlugin2::load( Addressee &addressee, QFile *file ) |
36 | { | 36 | { |
37 | qDebug("VCardFormatPlugin2::load"); | 37 | qDebug("VCardFormatPlugin2::load"); |
38 | QString data; | 38 | QString data; |
39 | 39 | ||
40 | QTextStream t( file ); | 40 | Q3TextStream t( file ); |
41 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 41 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
42 | data = t.read(); | 42 | data = t.read(); |
43 | 43 | ||
44 | VCardTool tool; | 44 | VCardTool tool; |
45 | 45 | ||
46 | Addressee::List l = tool.parseVCards( data ); | 46 | Addressee::List l = tool.parseVCards( data ); |
47 | 47 | ||
48 | if ( ! l.first().isEmpty() ) { | 48 | if ( ! l.first().isEmpty() ) { |
49 | addressee = l.first(); | 49 | addressee = l.first(); |
50 | return true; | 50 | return true; |
51 | } | 51 | } |
52 | 52 | ||
53 | return false; | 53 | return false; |
54 | } | 54 | } |
55 | 55 | ||
56 | bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 56 | bool VCardFormatPlugin2::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
57 | { | 57 | { |
58 | qDebug("VCardFormatPlugin2::loadAll"); | 58 | qDebug("VCardFormatPlugin2::loadAll"); |
59 | QString data; | 59 | QString data; |
60 | 60 | ||
61 | QTextStream t( file ); | 61 | Q3TextStream t( file ); |
62 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 62 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
63 | data = t.read(); | 63 | data = t.read(); |
64 | 64 | ||
65 | VCardTool tool; | 65 | VCardTool tool; |
66 | 66 | ||
67 | Addressee::List l = tool.parseVCards( data ); | 67 | Addressee::List l = tool.parseVCards( data ); |
68 | 68 | ||
69 | Addressee::List::Iterator itr; | 69 | Addressee::List::Iterator itr; |
70 | 70 | ||
71 | for ( itr = l.begin(); itr != l.end(); ++itr) { | 71 | for ( itr = l.begin(); itr != l.end(); ++itr) { |
72 | Addressee addressee = *itr; | 72 | Addressee addressee = *itr; |
73 | addressee.setResource( resource ); | 73 | addressee.setResource( resource ); |
74 | addressBook->insertAddressee( addressee ); | 74 | addressBook->insertAddressee( addressee ); |
75 | } | 75 | } |
76 | 76 | ||
77 | return true; | 77 | return true; |
78 | } | 78 | } |
79 | 79 | ||
80 | void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file ) | 80 | void VCardFormatPlugin2::save( const Addressee &addressee, QFile *file ) |
81 | { | 81 | { |
82 | qDebug("VCardFormatPlugin2::save"); | 82 | qDebug("VCardFormatPlugin2::save"); |
83 | VCardTool tool; | 83 | VCardTool tool; |
84 | Addressee::List vcardlist; | 84 | Addressee::List vcardlist; |
85 | 85 | ||
86 | 86 | ||
87 | vcardlist.append( addressee ); | 87 | vcardlist.append( addressee ); |
88 | 88 | ||
89 | QTextStream t( file ); | 89 | Q3TextStream t( file ); |
90 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 90 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
91 | t << tool.createVCards( vcardlist ); | 91 | t << tool.createVCards( vcardlist ); |
92 | } | 92 | } |
93 | 93 | ||
94 | void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file ) | 94 | void VCardFormatPlugin2::saveAll( AddressBook *ab, Resource *resource, QFile *file ) |
95 | { | 95 | { |
96 | qDebug("VCardFormatPlugin2::saveAll"); | 96 | qDebug("VCardFormatPlugin2::saveAll"); |
97 | VCardTool tool; | 97 | VCardTool tool; |
98 | Addressee::List vcardlist; | 98 | Addressee::List vcardlist; |
99 | 99 | ||
100 | AddressBook::Iterator it; | 100 | AddressBook::Iterator it; |
101 | for ( it = ab->begin(); it != ab->end(); ++it ) { | 101 | for ( it = ab->begin(); it != ab->end(); ++it ) { |
102 | if ( (*it).resource() == resource ) { | 102 | if ( (*it).resource() == resource ) { |
103 | (*it).setChanged( false ); | 103 | (*it).setChanged( false ); |
104 | vcardlist.append( *it ); | 104 | vcardlist.append( *it ); |
105 | } | 105 | } |
106 | } | 106 | } |
107 | 107 | ||
108 | QTextStream t( file ); | 108 | Q3TextStream t( file ); |
109 | t.setEncoding( QTextStream::UnicodeUTF8 ); | 109 | t.setEncoding( Q3TextStream::UnicodeUTF8 ); |
110 | t << tool.createVCards( vcardlist ); | 110 | t << tool.createVCards( vcardlist ); |
111 | } | 111 | } |
112 | 112 | ||
113 | bool VCardFormatPlugin2::checkFormat( QFile *file ) const | 113 | bool VCardFormatPlugin2::checkFormat( QFile *file ) const |
114 | { | 114 | { |
115 | QString line; | 115 | QString line; |
116 | 116 | ||
117 | file->readLine( line, 1024 ); | 117 | char tmp[1024]; file->readLine( tmp, 1024 ); line = tmp; |
118 | line = line.stripWhiteSpace(); | 118 | line = line.stripWhiteSpace(); |
119 | if ( line == "BEGIN:VCARD" ) | 119 | if ( line == "BEGIN:VCARD" ) |
120 | return true; | 120 | return true; |
121 | else | 121 | else |
122 | return false; | 122 | return false; |
123 | } | 123 | } |
124 | 124 | ||
diff --git a/kabc/kabc.pro b/kabc/kabc.pro index 17ebff8..846ed8a 100644 --- a/kabc/kabc.pro +++ b/kabc/kabc.pro | |||
@@ -1,218 +1,222 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | #release debug | 3 | #release debug |
4 | DESTDIR=../bin | 4 | DESTDIR=../bin |
5 | 5 | ||
6 | TARGET = microkabc | 6 | TARGET = xmicrokabc |
7 | 7 | ||
8 | include( ../variables.pri ) | 8 | include( ../variables.pri ) |
9 | 9 | ||
10 | INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui .. | 10 | INCLUDEPATH += . ./vcard/include ./vcard/include/generated ../microkde ../microkde/kdecore ../microkde/kio/kfile ../microkde/kio/kio ../libkdepim ../qtcompat ../microkde/kdeui .. |
11 | 11 | ||
12 | #LIBS += -lmicrokde -lldap | 12 | #LIBS += -lxmicrokde -lldap |
13 | LIBS += -L$(QPEDIR)/lib | 13 | LIBS += -L$(QPEDIR)/lib |
14 | DEFINES += KAB_EMBEDDED DESKTOP_VERSION | 14 | DEFINES += KAB_EMBEDDED DESKTOP_VERSION |
15 | unix : { | 15 | unix : { |
16 | 16 | ||
17 | OBJECTS_DIR = obj/unix | 17 | OBJECTS_DIR = obj/unix |
18 | MOC_DIR = moc/unix | 18 | MOC_DIR = moc/unix |
19 | } | 19 | } |
20 | win32: { | 20 | win32: { |
21 | DEFINES += _WIN32_ | 21 | DEFINES += _WIN32_ |
22 | OBJECTS_DIR = obj/win | 22 | OBJECTS_DIR = obj/win |
23 | MOC_DIR = moc/win | 23 | MOC_DIR = moc/win |
24 | } | 24 | } |
25 | INTERFACES = \ | 25 | INTERFACES = \ |
26 | 26 | ||
27 | 27 | ||
28 | HEADERS = \ | 28 | HEADERS = \ |
29 | resource.h \ | 29 | resource.h \ |
30 | stdaddressbook.h \ | 30 | stdaddressbook.h \ |
31 | agent.h \ | 31 | agent.h \ |
32 | geo.h \ | 32 | geo.h \ |
33 | key.h \ | 33 | key.h \ |
34 | field.h \ | 34 | field.h \ |
35 | plugin.h \ | 35 | plugin.h \ |
36 | address.h \ | 36 | address.h \ |
37 | addresseelist.h \ | 37 | addresseelist.h \ |
38 | addresseeview.h \ | 38 | addresseeview.h \ |
39 | formatfactory.h \ | 39 | formatfactory.h \ |
40 | formatplugin.h \ | 40 | formatplugin.h \ |
41 | phonenumber.h \ | 41 | phonenumber.h \ |
42 | distributionlist.h \ | 42 | distributionlist.h \ |
43 | distributionlistdialog.h \ | 43 | distributionlistdialog.h \ |
44 | distributionlisteditor.h \ | 44 | distributionlisteditor.h \ |
45 | vcardformatplugin.h \ | 45 | vcardformatplugin.h \ |
46 | formats/vcardformatplugin2.h \ | 46 | formats/vcardformatplugin2.h \ |
47 | picture.h \ | 47 | picture.h \ |
48 | secrecy.h \ | 48 | secrecy.h \ |
49 | sound.h \ | 49 | sound.h \ |
50 | addressbook.h \ | 50 | addressbook.h \ |
51 | timezone.h \ | 51 | timezone.h \ |
52 | tmpaddressbook.h \ | 52 | tmpaddressbook.h \ |
53 | addressee.h \ | 53 | addressee.h \ |
54 | addresseedialog.h \ | 54 | addresseedialog.h \ |
55 | vcardconverter.h \ | 55 | vcardconverter.h \ |
56 | vcard21parser.h \ | 56 | vcard21parser.h \ |
57 | vcardformatimpl.h \ | 57 | vcardformatimpl.h \ |
58 | plugins/file/resourcefile.h \ | 58 | plugins/file/resourcefile.h \ |
59 | plugins/file/resourcefileconfig.h \ | 59 | plugins/file/resourcefileconfig.h \ |
60 | plugins/dir/resourcedir.h \ | 60 | plugins/dir/resourcedir.h \ |
61 | plugins/dir/resourcedirconfig.h \ | 61 | plugins/dir/resourcedirconfig.h \ |
62 | vcardparser/vcardline.h \ | 62 | vcardparser/vcardline.h \ |
63 | vcardparser/vcard.h \ | 63 | vcardparser/vcard.h \ |
64 | vcardparser/vcardtool.h \ | 64 | vcardparser/vcardtool.h \ |
65 | vcardparser/vcardparser.h \ | 65 | vcardparser/vcardparser.h \ |
66 | vcard/include/VCardAdrParam.h \ | 66 | vcard/include/VCardAdrParam.h \ |
67 | vcard/include/VCardAdrValue.h \ | 67 | vcard/include/VCardAdrValue.h \ |
68 | vcard/include/VCardAgentParam.h \ | 68 | vcard/include/VCardAgentParam.h \ |
69 | vcard/include/VCardContentLine.h \ | 69 | vcard/include/VCardContentLine.h \ |
70 | vcard/include/VCardDateParam.h \ | 70 | vcard/include/VCardDateParam.h \ |
71 | vcard/include/VCardDateValue.h \ | 71 | vcard/include/VCardDateValue.h \ |
72 | vcard/include/VCardEmailParam.h \ | 72 | vcard/include/VCardEmailParam.h \ |
73 | vcard/include/VCardGeoValue.h \ | 73 | vcard/include/VCardGeoValue.h \ |
74 | vcard/include/VCardGroup.h \ | 74 | vcard/include/VCardGroup.h \ |
75 | vcard/include/VCardImageParam.h \ | 75 | vcard/include/VCardImageParam.h \ |
76 | vcard/include/VCardImageValue.h \ | 76 | vcard/include/VCardImageValue.h \ |
77 | vcard/include/VCardLangValue.h \ | 77 | vcard/include/VCardLangValue.h \ |
78 | vcard/include/VCardNValue.h \ | 78 | vcard/include/VCardNValue.h \ |
79 | vcard/include/VCardParam.h \ | 79 | vcard/include/VCardParam.h \ |
80 | vcard/include/VCardPhoneNumberValue.h \ | 80 | vcard/include/VCardPhoneNumberValue.h \ |
81 | vcard/include/VCardSourceParam.h \ | 81 | vcard/include/VCardSourceParam.h \ |
82 | vcard/include/VCardTelParam.h \ | 82 | vcard/include/VCardTelParam.h \ |
83 | vcard/include/VCardTextParam.h \ | 83 | vcard/include/VCardTextParam.h \ |
84 | vcard/include/VCardTextValue.h \ | 84 | vcard/include/VCardTextValue.h \ |
85 | vcard/include/VCardTextBinParam.h \ | 85 | vcard/include/VCardTextBinParam.h \ |
86 | vcard/include/VCardURIValue.h \ | 86 | vcard/include/VCardURIValue.h \ |
87 | vcard/include/VCardVCard.h \ | 87 | vcard/include/VCardVCard.h \ |
88 | vcard/include/VCardEntity.h \ | 88 | vcard/include/VCardEntity.h \ |
89 | vcard/include/VCardValue.h \ | 89 | vcard/include/VCardValue.h \ |
90 | vcard/include/VCardSoundValue.h \ | 90 | vcard/include/VCardSoundValue.h \ |
91 | vcard/include/VCardAgentValue.h \ | 91 | vcard/include/VCardAgentValue.h \ |
92 | vcard/include/VCardTelValue.h \ | 92 | vcard/include/VCardTelValue.h \ |
93 | vcard/include/VCardTextBinValue.h \ | 93 | vcard/include/VCardTextBinValue.h \ |
94 | vcard/include/VCardOrgValue.h \ | 94 | vcard/include/VCardOrgValue.h \ |
95 | vcard/include/VCardUTCValue.h \ | 95 | vcard/include/VCardUTCValue.h \ |
96 | vcard/include/VCardClassValue.h \ | 96 | vcard/include/VCardClassValue.h \ |
97 | vcard/include/VCardFloatValue.h \ | 97 | vcard/include/VCardFloatValue.h \ |
98 | vcard/include/VCardTextListValue.h \ | 98 | vcard/include/VCardTextListValue.h \ |
99 | vcard/include/generated/AdrParam-generated.h \ | 99 | vcard/include/generated/AdrParam-generated.h \ |
100 | vcard/include/generated/AdrValue-generated.h \ | 100 | vcard/include/generated/AdrValue-generated.h \ |
101 | vcard/include/generated/AgentParam-generated.h \ | 101 | vcard/include/generated/AgentParam-generated.h \ |
102 | vcard/include/generated/ContentLine-generated.h \ | 102 | vcard/include/generated/ContentLine-generated.h \ |
103 | vcard/include/generated/DateParam-generated.h \ | 103 | vcard/include/generated/DateParam-generated.h \ |
104 | vcard/include/generated/DateValue-generated.h \ | 104 | vcard/include/generated/DateValue-generated.h \ |
105 | vcard/include/generated/EmailParam-generated.h \ | 105 | vcard/include/generated/EmailParam-generated.h \ |
106 | vcard/include/generated/GeoValue-generated.h \ | 106 | vcard/include/generated/GeoValue-generated.h \ |
107 | vcard/include/generated/Group-generated.h \ | 107 | vcard/include/generated/Group-generated.h \ |
108 | vcard/include/generated/ImageParam-generated.h \ | 108 | vcard/include/generated/ImageParam-generated.h \ |
109 | vcard/include/generated/ImageValue-generated.h \ | 109 | vcard/include/generated/ImageValue-generated.h \ |
110 | vcard/include/generated/LangValue-generated.h \ | 110 | vcard/include/generated/LangValue-generated.h \ |
111 | vcard/include/generated/NValue-generated.h \ | 111 | vcard/include/generated/NValue-generated.h \ |
112 | vcard/include/generated/Param-generated.h \ | 112 | vcard/include/generated/Param-generated.h \ |
113 | vcard/include/generated/PhoneNumberValue-generated.h \ | 113 | vcard/include/generated/PhoneNumberValue-generated.h \ |
114 | vcard/include/generated/SourceParam-generated.h \ | 114 | vcard/include/generated/SourceParam-generated.h \ |
115 | vcard/include/generated/TelParam-generated.h \ | 115 | vcard/include/generated/TelParam-generated.h \ |
116 | vcard/include/generated/TextParam-generated.h \ | 116 | vcard/include/generated/TextParam-generated.h \ |
117 | vcard/include/generated/TextNSParam-generated.h \ | 117 | vcard/include/generated/TextNSParam-generated.h \ |
118 | vcard/include/generated/TextValue-generated.h \ | 118 | vcard/include/generated/TextValue-generated.h \ |
119 | vcard/include/generated/TextBinParam-generated.h \ | 119 | vcard/include/generated/TextBinParam-generated.h \ |
120 | vcard/include/generated/URIValue-generated.h \ | 120 | vcard/include/generated/URIValue-generated.h \ |
121 | vcard/include/generated/VCard-generated.h \ | 121 | vcard/include/generated/VCard-generated.h \ |
122 | vcard/include/generated/VCardEntity-generated.h \ | 122 | vcard/include/generated/VCardEntity-generated.h \ |
123 | vcard/include/generated/Value-generated.h \ | 123 | vcard/include/generated/Value-generated.h \ |
124 | vcard/include/generated/SoundValue-generated.h \ | 124 | vcard/include/generated/SoundValue-generated.h \ |
125 | vcard/include/generated/AgentValue-generated.h \ | 125 | vcard/include/generated/AgentValue-generated.h \ |
126 | vcard/include/generated/TelValue-generated.h \ | 126 | vcard/include/generated/TelValue-generated.h \ |
127 | vcard/include/generated/TextBinValue-generated.h \ | 127 | vcard/include/generated/TextBinValue-generated.h \ |
128 | vcard/include/generated/OrgValue-generated.h \ | 128 | vcard/include/generated/OrgValue-generated.h \ |
129 | vcard/include/generated/UTCValue-generated.h \ | 129 | vcard/include/generated/UTCValue-generated.h \ |
130 | vcard/include/generated/ClassValue-generated.h \ | 130 | vcard/include/generated/ClassValue-generated.h \ |
131 | vcard/include/generated/FloatValue-generated.h \ | 131 | vcard/include/generated/FloatValue-generated.h \ |
132 | vcard/include/generated/TextListValue-generated.h | 132 | vcard/include/generated/TextListValue-generated.h |
133 | 133 | ||
134 | 134 | ||
135 | # plugins/ldap/resourceldap.h \ | 135 | # plugins/ldap/resourceldap.h \ |
136 | # plugins/ldap/resourceldapconfig.h \ | 136 | # plugins/ldap/resourceldapconfig.h \ |
137 | #formats/binary/binaryformat.h \ | 137 | #formats/binary/binaryformat.h \ |
138 | 138 | ||
139 | #vcard/include/VCardTextNSParam.h \ | 139 | #vcard/include/VCardTextNSParam.h \ |
140 | 140 | ||
141 | SOURCES = \ | 141 | SOURCES = \ |
142 | distributionlist.cpp \ | 142 | distributionlist.cpp \ |
143 | distributionlistdialog.cpp \ | 143 | distributionlistdialog.cpp \ |
144 | distributionlisteditor.cpp \ | 144 | distributionlisteditor.cpp \ |
145 | vcardformatplugin.cpp \ | 145 | vcardformatplugin.cpp \ |
146 | formats/vcardformatplugin2.cpp \ | 146 | formats/vcardformatplugin2.cpp \ |
147 | formatfactory.cpp \ | 147 | formatfactory.cpp \ |
148 | resource.cpp \ | 148 | resource.cpp \ |
149 | stdaddressbook.cpp \ | 149 | stdaddressbook.cpp \ |
150 | plugin.cpp \ | 150 | plugin.cpp \ |
151 | agent.cpp \ | 151 | agent.cpp \ |
152 | geo.cpp \ | 152 | geo.cpp \ |
153 | key.cpp \ | 153 | key.cpp \ |
154 | field.cpp \ | 154 | field.cpp \ |
155 | addresseeview.cpp \ | 155 | addresseeview.cpp \ |
156 | address.cpp \ | 156 | address.cpp \ |
157 | phonenumber.cpp \ | 157 | phonenumber.cpp \ |
158 | picture.cpp \ | 158 | picture.cpp \ |
159 | secrecy.cpp \ | 159 | secrecy.cpp \ |
160 | sound.cpp \ | 160 | sound.cpp \ |
161 | addressbook.cpp \ | 161 | addressbook.cpp \ |
162 | timezone.cpp \ | 162 | timezone.cpp \ |
163 | tmpaddressbook.cpp \ | 163 | tmpaddressbook.cpp \ |
164 | addressee.cpp \ | 164 | addressee.cpp \ |
165 | addresseelist.cpp \ | 165 | addresseelist.cpp \ |
166 | addresseedialog.cpp \ | 166 | addresseedialog.cpp \ |
167 | vcardconverter.cpp \ | 167 | vcardconverter.cpp \ |
168 | vcard21parser.cpp \ | 168 | vcard21parser.cpp \ |
169 | vcardformatimpl.cpp \ | 169 | vcardformatimpl.cpp \ |
170 | plugins/file/resourcefile.cpp \ | 170 | plugins/file/resourcefile.cpp \ |
171 | plugins/file/resourcefileconfig.cpp \ | 171 | plugins/file/resourcefileconfig.cpp \ |
172 | plugins/dir/resourcedir.cpp \ | 172 | plugins/dir/resourcedir.cpp \ |
173 | plugins/dir/resourcedirconfig.cpp \ | 173 | plugins/dir/resourcedirconfig.cpp \ |
174 | vcardparser/vcardline.cpp \ | 174 | vcardparser/vcardline.cpp \ |
175 | vcardparser/vcard.cpp \ | 175 | vcardparser/vcard.cpp \ |
176 | vcardparser/vcardtool.cpp \ | 176 | vcardparser/vcardtool.cpp \ |
177 | vcardparser/vcardparser.cpp \ | 177 | vcardparser/vcardparser.cpp \ |
178 | vcard/AdrParam.cpp \ | 178 | vcard/AdrParam.cpp \ |
179 | vcard/AdrValue.cpp \ | 179 | vcard/AdrValue.cpp \ |
180 | vcard/AgentParam.cpp \ | 180 | vcard/AgentParam.cpp \ |
181 | vcard/ContentLine.cpp \ | 181 | vcard/ContentLine.cpp \ |
182 | vcard/DateParam.cpp \ | 182 | vcard/DateParam.cpp \ |
183 | vcard/DateValue.cpp \ | 183 | vcard/DateValue.cpp \ |
184 | vcard/EmailParam.cpp \ | 184 | vcard/EmailParam.cpp \ |
185 | vcard/Entity.cpp \ | 185 | vcard/Entity.cpp \ |
186 | vcard/Enum.cpp \ | 186 | vcard/Enum.cpp \ |
187 | vcard/GeoValue.cpp \ | 187 | vcard/GeoValue.cpp \ |
188 | vcard/ImageParam.cpp \ | 188 | vcard/ImageParam.cpp \ |
189 | vcard/ImageValue.cpp \ | 189 | vcard/ImageValue.cpp \ |
190 | vcard/LangValue.cpp \ | 190 | vcard/LangValue.cpp \ |
191 | vcard/NValue.cpp \ | 191 | vcard/NValue.cpp \ |
192 | vcard/Param.cpp \ | 192 | vcard/Param.cpp \ |
193 | vcard/PhoneNumberValue.cpp \ | 193 | vcard/PhoneNumberValue.cpp \ |
194 | vcard/RToken.cpp \ | 194 | vcard/RToken.cpp \ |
195 | vcard/SourceParam.cpp \ | 195 | vcard/SourceParam.cpp \ |
196 | vcard/TelParam.cpp \ | 196 | vcard/TelParam.cpp \ |
197 | vcard/TextParam.cpp \ | 197 | vcard/TextParam.cpp \ |
198 | vcard/TextValue.cpp \ | 198 | vcard/TextValue.cpp \ |
199 | vcard/TextBinParam.cpp \ | 199 | vcard/TextBinParam.cpp \ |
200 | vcard/URIValue.cpp \ | 200 | vcard/URIValue.cpp \ |
201 | vcard/VCardv.cpp \ | 201 | vcard/VCardv.cpp \ |
202 | vcard/VCardEntity.cpp \ | 202 | vcard/VCardEntity.cpp \ |
203 | vcard/Value.cpp \ | 203 | vcard/Value.cpp \ |
204 | vcard/SoundValue.cpp \ | 204 | vcard/SoundValue.cpp \ |
205 | vcard/AgentValue.cpp \ | 205 | vcard/AgentValue.cpp \ |
206 | vcard/TelValue.cpp \ | 206 | vcard/TelValue.cpp \ |
207 | vcard/TextBinValue.cpp \ | 207 | vcard/TextBinValue.cpp \ |
208 | vcard/OrgValue.cpp \ | 208 | vcard/OrgValue.cpp \ |
209 | vcard/UTCValue.cpp \ | 209 | vcard/UTCValue.cpp \ |
210 | vcard/ClassValue.cpp \ | 210 | vcard/ClassValue.cpp \ |
211 | vcard/FloatValue.cpp \ | 211 | vcard/FloatValue.cpp \ |
212 | vcard/TextListValue.cpp | 212 | vcard/TextListValue.cpp |
213 | 213 | ||
214 | 214 | ||
215 | # plugins/ldap/resourceldap.cpp \ | 215 | # plugins/ldap/resourceldap.cpp \ |
216 | # plugins/ldap/resourceldapconfig.cpp \ | 216 | # plugins/ldap/resourceldapconfig.cpp \ |
217 | 217 | ||
218 | #formats/binary/binaryformat.cpp \ | 218 | #formats/binary/binaryformat.cpp \ |
219 | #The following line was inserted by qt3to4 | ||
220 | QT += xml qt3support | ||
221 | #The following line was inserted by qt3to4 | ||
222 | QT += | ||
diff --git a/kabc/kabcE.pro b/kabc/kabcE.pro index 1d28a4d..6045b68 100644 --- a/kabc/kabcE.pro +++ b/kabc/kabcE.pro | |||
@@ -1,196 +1,198 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = microkabc | 3 | TARGET = xmicrokabc |
4 | 4 | ||
5 | 5 | ||
6 | INCLUDEPATH += . $(KDEPIMDIR) vcard/include vcard/include/generated $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(QPEDIR)/include | 6 | INCLUDEPATH += . $(KDEPIMDIR) vcard/include vcard/include/generated $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kdeui $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/libkdepim $(KDEPIMDIR)/qtcompat $(QPEDIR)/include |
7 | OBJECTS_DIR = obj/$(PLATFORM) | 7 | OBJECTS_DIR = obj/$(PLATFORM) |
8 | MOC_DIR = moc/$(PLATFORM) | 8 | MOC_DIR = moc/$(PLATFORM) |
9 | DESTDIR = $(QPEDIR)/lib | 9 | DESTDIR = $(QPEDIR)/lib |
10 | LIBS += -lmicrokde | 10 | LIBS += -lxmicrokde |
11 | LIBS += -lmicrokdepim | 11 | LIBS += -lxmicrokdepim |
12 | #LIBS += -lldap | 12 | #LIBS += -lldap |
13 | LIBS += -L$(QPEDIR)/lib | 13 | LIBS += -L$(QPEDIR)/lib |
14 | DEFINES += KAB_EMBEDDED | 14 | DEFINES += KAB_EMBEDDED |
15 | 15 | ||
16 | #enable the following line if you want to get debugoutput while loading adresses | 16 | #enable the following line if you want to get debugoutput while loading adresses |
17 | #DEFINES += VCARD_DEBUG | 17 | #DEFINES += VCARD_DEBUG |
18 | 18 | ||
19 | INTERFACES = \ | 19 | INTERFACES = \ |
20 | 20 | ||
21 | HEADERS = \ | 21 | HEADERS = \ |
22 | address.h \ | 22 | address.h \ |
23 | addressbook.h \ | 23 | addressbook.h \ |
24 | addressee.h \ | 24 | addressee.h \ |
25 | addresseedialog.h \ | 25 | addresseedialog.h \ |
26 | addresseelist.h \ | 26 | addresseelist.h \ |
27 | addresseeview.h \ | 27 | addresseeview.h \ |
28 | agent.h \ | 28 | agent.h \ |
29 | distributionlist.h \ | 29 | distributionlist.h \ |
30 | distributionlistdialog.h \ | 30 | distributionlistdialog.h \ |
31 | distributionlisteditor.h \ | 31 | distributionlisteditor.h \ |
32 | field.h \ | 32 | field.h \ |
33 | formatfactory.h \ | 33 | formatfactory.h \ |
34 | formatplugin.h \ | 34 | formatplugin.h \ |
35 | geo.h \ | 35 | geo.h \ |
36 | key.h \ | 36 | key.h \ |
37 | phonenumber.h \ | 37 | phonenumber.h \ |
38 | picture.h \ | 38 | picture.h \ |
39 | plugin.h \ | 39 | plugin.h \ |
40 | resource.h \ | 40 | resource.h \ |
41 | secrecy.h \ | 41 | secrecy.h \ |
42 | sound.h \ | 42 | sound.h \ |
43 | stdaddressbook.h \ | 43 | stdaddressbook.h \ |
44 | timezone.h \ | 44 | timezone.h \ |
45 | tmpaddressbook.h \ | 45 | tmpaddressbook.h \ |
46 | vcardconverter.h \ | 46 | vcardconverter.h \ |
47 | vcard21parser.h \ | 47 | vcard21parser.h \ |
48 | vcardformatimpl.h \ | 48 | vcardformatimpl.h \ |
49 | vcardformatplugin.h \ | 49 | vcardformatplugin.h \ |
50 | vcardparser/vcardline.h \ | 50 | vcardparser/vcardline.h \ |
51 | vcardparser/vcard.h \ | 51 | vcardparser/vcard.h \ |
52 | vcardparser/vcardtool.h \ | 52 | vcardparser/vcardtool.h \ |
53 | vcardparser/vcardparser.h \ | 53 | vcardparser/vcardparser.h \ |
54 | vcard/include/VCardAdrParam.h \ | 54 | vcard/include/VCardAdrParam.h \ |
55 | vcard/include/VCardAdrValue.h \ | 55 | vcard/include/VCardAdrValue.h \ |
56 | vcard/include/VCardAgentParam.h \ | 56 | vcard/include/VCardAgentParam.h \ |
57 | vcard/include/VCardContentLine.h \ | 57 | vcard/include/VCardContentLine.h \ |
58 | vcard/include/VCardDateParam.h \ | 58 | vcard/include/VCardDateParam.h \ |
59 | vcard/include/VCardDateValue.h \ | 59 | vcard/include/VCardDateValue.h \ |
60 | vcard/include/VCardEmailParam.h \ | 60 | vcard/include/VCardEmailParam.h \ |
61 | vcard/include/VCardGeoValue.h \ | 61 | vcard/include/VCardGeoValue.h \ |
62 | vcard/include/VCardGroup.h \ | 62 | vcard/include/VCardGroup.h \ |
63 | vcard/include/VCardImageParam.h \ | 63 | vcard/include/VCardImageParam.h \ |
64 | vcard/include/VCardImageValue.h \ | 64 | vcard/include/VCardImageValue.h \ |
65 | vcard/include/VCardLangValue.h \ | 65 | vcard/include/VCardLangValue.h \ |
66 | vcard/include/VCardNValue.h \ | 66 | vcard/include/VCardNValue.h \ |
67 | vcard/include/VCardParam.h \ | 67 | vcard/include/VCardParam.h \ |
68 | vcard/include/VCardPhoneNumberValue.h \ | 68 | vcard/include/VCardPhoneNumberValue.h \ |
69 | vcard/include/VCardSourceParam.h \ | 69 | vcard/include/VCardSourceParam.h \ |
70 | vcard/include/VCardTelParam.h \ | 70 | vcard/include/VCardTelParam.h \ |
71 | vcard/include/VCardTextParam.h \ | 71 | vcard/include/VCardTextParam.h \ |
72 | vcard/include/VCardTextNSParam.h \ | 72 | vcard/include/VCardTextNSParam.h \ |
73 | vcard/include/VCardTextValue.h \ | 73 | vcard/include/VCardTextValue.h \ |
74 | vcard/include/VCardTextBinParam.h \ | 74 | vcard/include/VCardTextBinParam.h \ |
75 | vcard/include/VCardURIValue.h \ | 75 | vcard/include/VCardURIValue.h \ |
76 | vcard/include/VCardVCard.h \ | 76 | vcard/include/VCardVCard.h \ |
77 | vcard/include/VCardEntity.h \ | 77 | vcard/include/VCardEntity.h \ |
78 | vcard/include/VCardValue.h \ | 78 | vcard/include/VCardValue.h \ |
79 | vcard/include/VCardSoundValue.h \ | 79 | vcard/include/VCardSoundValue.h \ |
80 | vcard/include/VCardAgentValue.h \ | 80 | vcard/include/VCardAgentValue.h \ |
81 | vcard/include/VCardTelValue.h \ | 81 | vcard/include/VCardTelValue.h \ |
82 | vcard/include/VCardTextBinValue.h \ | 82 | vcard/include/VCardTextBinValue.h \ |
83 | vcard/include/VCardOrgValue.h \ | 83 | vcard/include/VCardOrgValue.h \ |
84 | vcard/include/VCardUTCValue.h \ | 84 | vcard/include/VCardUTCValue.h \ |
85 | vcard/include/VCardClassValue.h \ | 85 | vcard/include/VCardClassValue.h \ |
86 | vcard/include/VCardFloatValue.h \ | 86 | vcard/include/VCardFloatValue.h \ |
87 | vcard/include/VCardTextListValue.h \ | 87 | vcard/include/VCardTextListValue.h \ |
88 | vcard/include/generated/AdrParam-generated.h \ | 88 | vcard/include/generated/AdrParam-generated.h \ |
89 | vcard/include/generated/AdrValue-generated.h \ | 89 | vcard/include/generated/AdrValue-generated.h \ |
90 | vcard/include/generated/AgentParam-generated.h \ | 90 | vcard/include/generated/AgentParam-generated.h \ |
91 | vcard/include/generated/ContentLine-generated.h \ | 91 | vcard/include/generated/ContentLine-generated.h \ |
92 | vcard/include/generated/DateParam-generated.h \ | 92 | vcard/include/generated/DateParam-generated.h \ |
93 | vcard/include/generated/DateValue-generated.h \ | 93 | vcard/include/generated/DateValue-generated.h \ |
94 | vcard/include/generated/EmailParam-generated.h \ | 94 | vcard/include/generated/EmailParam-generated.h \ |
95 | vcard/include/generated/GeoValue-generated.h \ | 95 | vcard/include/generated/GeoValue-generated.h \ |
96 | vcard/include/generated/Group-generated.h \ | 96 | vcard/include/generated/Group-generated.h \ |
97 | vcard/include/generated/ImageParam-generated.h \ | 97 | vcard/include/generated/ImageParam-generated.h \ |
98 | vcard/include/generated/ImageValue-generated.h \ | 98 | vcard/include/generated/ImageValue-generated.h \ |
99 | vcard/include/generated/LangValue-generated.h \ | 99 | vcard/include/generated/LangValue-generated.h \ |
100 | vcard/include/generated/NValue-generated.h \ | 100 | vcard/include/generated/NValue-generated.h \ |
101 | vcard/include/generated/Param-generated.h \ | 101 | vcard/include/generated/Param-generated.h \ |
102 | vcard/include/generated/PhoneNumberValue-generated.h \ | 102 | vcard/include/generated/PhoneNumberValue-generated.h \ |
103 | vcard/include/generated/SourceParam-generated.h \ | 103 | vcard/include/generated/SourceParam-generated.h \ |
104 | vcard/include/generated/TelParam-generated.h \ | 104 | vcard/include/generated/TelParam-generated.h \ |
105 | vcard/include/generated/TextParam-generated.h \ | 105 | vcard/include/generated/TextParam-generated.h \ |
106 | vcard/include/generated/TextNSParam-generated.h \ | 106 | vcard/include/generated/TextNSParam-generated.h \ |
107 | vcard/include/generated/TextValue-generated.h \ | 107 | vcard/include/generated/TextValue-generated.h \ |
108 | vcard/include/generated/TextBinParam-generated.h \ | 108 | vcard/include/generated/TextBinParam-generated.h \ |
109 | vcard/include/generated/URIValue-generated.h \ | 109 | vcard/include/generated/URIValue-generated.h \ |
110 | vcard/include/generated/VCard-generated.h \ | 110 | vcard/include/generated/VCard-generated.h \ |
111 | vcard/include/generated/VCardEntity-generated.h \ | 111 | vcard/include/generated/VCardEntity-generated.h \ |
112 | vcard/include/generated/Value-generated.h \ | 112 | vcard/include/generated/Value-generated.h \ |
113 | vcard/include/generated/SoundValue-generated.h \ | 113 | vcard/include/generated/SoundValue-generated.h \ |
114 | vcard/include/generated/AgentValue-generated.h \ | 114 | vcard/include/generated/AgentValue-generated.h \ |
115 | vcard/include/generated/TelValue-generated.h \ | 115 | vcard/include/generated/TelValue-generated.h \ |
116 | vcard/include/generated/TextBinValue-generated.h \ | 116 | vcard/include/generated/TextBinValue-generated.h \ |
117 | vcard/include/generated/OrgValue-generated.h \ | 117 | vcard/include/generated/OrgValue-generated.h \ |
118 | vcard/include/generated/UTCValue-generated.h \ | 118 | vcard/include/generated/UTCValue-generated.h \ |
119 | vcard/include/generated/ClassValue-generated.h \ | 119 | vcard/include/generated/ClassValue-generated.h \ |
120 | vcard/include/generated/FloatValue-generated.h \ | 120 | vcard/include/generated/FloatValue-generated.h \ |
121 | vcard/include/generated/TextListValue-generated.h | 121 | vcard/include/generated/TextListValue-generated.h |
122 | 122 | ||
123 | 123 | ||
124 | 124 | ||
125 | 125 | ||
126 | SOURCES = \ | 126 | SOURCES = \ |
127 | address.cpp \ | 127 | address.cpp \ |
128 | addressbook.cpp \ | 128 | addressbook.cpp \ |
129 | addressee.cpp \ | 129 | addressee.cpp \ |
130 | addresseedialog.cpp \ | 130 | addresseedialog.cpp \ |
131 | addresseelist.cpp \ | 131 | addresseelist.cpp \ |
132 | addresseeview.cpp \ | 132 | addresseeview.cpp \ |
133 | agent.cpp \ | 133 | agent.cpp \ |
134 | distributionlist.cpp \ | 134 | distributionlist.cpp \ |
135 | distributionlistdialog.cpp \ | 135 | distributionlistdialog.cpp \ |
136 | distributionlisteditor.cpp \ | 136 | distributionlisteditor.cpp \ |
137 | field.cpp \ | 137 | field.cpp \ |
138 | formatfactory.cpp \ | 138 | formatfactory.cpp \ |
139 | geo.cpp \ | 139 | geo.cpp \ |
140 | key.cpp \ | 140 | key.cpp \ |
141 | phonenumber.cpp \ | 141 | phonenumber.cpp \ |
142 | picture.cpp \ | 142 | picture.cpp \ |
143 | plugin.cpp \ | 143 | plugin.cpp \ |
144 | resource.cpp \ | 144 | resource.cpp \ |
145 | secrecy.cpp \ | 145 | secrecy.cpp \ |
146 | sound.cpp \ | 146 | sound.cpp \ |
147 | stdaddressbook.cpp \ | 147 | stdaddressbook.cpp \ |
148 | timezone.cpp \ | 148 | timezone.cpp \ |
149 | tmpaddressbook.cpp \ | 149 | tmpaddressbook.cpp \ |
150 | vcardconverter.cpp \ | 150 | vcardconverter.cpp \ |
151 | vcard21parser.cpp \ | 151 | vcard21parser.cpp \ |
152 | vcardformatimpl.cpp \ | 152 | vcardformatimpl.cpp \ |
153 | vcardformatplugin.cpp \ | 153 | vcardformatplugin.cpp \ |
154 | vcardparser/vcardline.cpp \ | 154 | vcardparser/vcardline.cpp \ |
155 | vcardparser/vcard.cpp \ | 155 | vcardparser/vcard.cpp \ |
156 | vcardparser/vcardtool.cpp \ | 156 | vcardparser/vcardtool.cpp \ |
157 | vcardparser/vcardparser.cpp \ | 157 | vcardparser/vcardparser.cpp \ |
158 | vcard/AdrParam.cpp \ | 158 | vcard/AdrParam.cpp \ |
159 | vcard/AdrValue.cpp \ | 159 | vcard/AdrValue.cpp \ |
160 | vcard/AgentParam.cpp \ | 160 | vcard/AgentParam.cpp \ |
161 | vcard/ContentLine.cpp \ | 161 | vcard/ContentLine.cpp \ |
162 | vcard/DateParam.cpp \ | 162 | vcard/DateParam.cpp \ |
163 | vcard/DateValue.cpp \ | 163 | vcard/DateValue.cpp \ |
164 | vcard/EmailParam.cpp \ | 164 | vcard/EmailParam.cpp \ |
165 | vcard/Entity.cpp \ | 165 | vcard/Entity.cpp \ |
166 | vcard/Enum.cpp \ | 166 | vcard/Enum.cpp \ |
167 | vcard/GeoValue.cpp \ | 167 | vcard/GeoValue.cpp \ |
168 | vcard/ImageParam.cpp \ | 168 | vcard/ImageParam.cpp \ |
169 | vcard/ImageValue.cpp \ | 169 | vcard/ImageValue.cpp \ |
170 | vcard/LangValue.cpp \ | 170 | vcard/LangValue.cpp \ |
171 | vcard/NValue.cpp \ | 171 | vcard/NValue.cpp \ |
172 | vcard/Param.cpp \ | 172 | vcard/Param.cpp \ |
173 | vcard/PhoneNumberValue.cpp \ | 173 | vcard/PhoneNumberValue.cpp \ |
174 | vcard/RToken.cpp \ | 174 | vcard/RToken.cpp \ |
175 | vcard/SourceParam.cpp \ | 175 | vcard/SourceParam.cpp \ |
176 | vcard/TelParam.cpp \ | 176 | vcard/TelParam.cpp \ |
177 | vcard/TextParam.cpp \ | 177 | vcard/TextParam.cpp \ |
178 | vcard/TextValue.cpp \ | 178 | vcard/TextValue.cpp \ |
179 | vcard/TextBinParam.cpp \ | 179 | vcard/TextBinParam.cpp \ |
180 | vcard/URIValue.cpp \ | 180 | vcard/URIValue.cpp \ |
181 | vcard/VCardv.cpp \ | 181 | vcard/VCardv.cpp \ |
182 | vcard/VCardEntity.cpp \ | 182 | vcard/VCardEntity.cpp \ |
183 | vcard/Value.cpp \ | 183 | vcard/Value.cpp \ |
184 | vcard/SoundValue.cpp \ | 184 | vcard/SoundValue.cpp \ |
185 | vcard/AgentValue.cpp \ | 185 | vcard/AgentValue.cpp \ |
186 | vcard/TelValue.cpp \ | 186 | vcard/TelValue.cpp \ |
187 | vcard/TextBinValue.cpp \ | 187 | vcard/TextBinValue.cpp \ |
188 | vcard/OrgValue.cpp \ | 188 | vcard/OrgValue.cpp \ |
189 | vcard/UTCValue.cpp \ | 189 | vcard/UTCValue.cpp \ |
190 | vcard/ClassValue.cpp \ | 190 | vcard/ClassValue.cpp \ |
191 | vcard/FloatValue.cpp \ | 191 | vcard/FloatValue.cpp \ |
192 | vcard/TextListValue.cpp | 192 | vcard/TextListValue.cpp |
193 | 193 | ||
194 | 194 | ||
195 | # plugins/ldap/resourceldap.cpp \ | 195 | # plugins/ldap/resourceldap.cpp \ |
196 | # plugins/ldap/resourceldapconfig.cpp \ | 196 | # plugins/ldap/resourceldapconfig.cpp \ |
197 | #The following line was inserted by qt3to4 | ||
198 | QT += qt3support | ||
@@ -1,155 +1,155 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_KEY_H | 28 | #ifndef KABC_KEY_H |
29 | #define KABC_KEY_H | 29 | #define KABC_KEY_H |
30 | 30 | ||
31 | #include <qvaluelist.h> | 31 | #include <q3valuelist.h> |
32 | 32 | ||
33 | namespace KABC { | 33 | namespace KABC { |
34 | 34 | ||
35 | /** | 35 | /** |
36 | * @short A class to store an encryption key. | 36 | * @short A class to store an encryption key. |
37 | */ | 37 | */ |
38 | class Key | 38 | class Key |
39 | { | 39 | { |
40 | friend QDataStream &operator<<( QDataStream &, const Key & ); | 40 | friend QDataStream &operator<<( QDataStream &, const Key & ); |
41 | friend QDataStream &operator>>( QDataStream &, Key & ); | 41 | friend QDataStream &operator>>( QDataStream &, Key & ); |
42 | 42 | ||
43 | public: | 43 | public: |
44 | typedef QValueList<Key> List; | 44 | typedef Q3ValueList<Key> List; |
45 | typedef QValueList<int> TypeList; | 45 | typedef Q3ValueList<int> TypeList; |
46 | 46 | ||
47 | /** | 47 | /** |
48 | * Key types | 48 | * Key types |
49 | * | 49 | * |
50 | * @li X509 - X509 key | 50 | * @li X509 - X509 key |
51 | * @li PGP - Pretty Good Privacy key | 51 | * @li PGP - Pretty Good Privacy key |
52 | * @li Custom - Custom or IANA conform key | 52 | * @li Custom - Custom or IANA conform key |
53 | */ | 53 | */ |
54 | enum Types { | 54 | enum Types { |
55 | X509, | 55 | X509, |
56 | PGP, | 56 | PGP, |
57 | Custom | 57 | Custom |
58 | }; | 58 | }; |
59 | 59 | ||
60 | /** | 60 | /** |
61 | * Constructor. | 61 | * Constructor. |
62 | * | 62 | * |
63 | * @param text The text data. | 63 | * @param text The text data. |
64 | * @param type The key type, @see Types. | 64 | * @param type The key type, @see Types. |
65 | */ | 65 | */ |
66 | Key( const QString &text = QString::null, int type = PGP ); | 66 | Key( const QString &text = QString::null, int type = PGP ); |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Destructor. | 69 | * Destructor. |
70 | */ | 70 | */ |
71 | ~Key(); | 71 | ~Key(); |
72 | 72 | ||
73 | bool operator==( const Key & ) const; | 73 | bool operator==( const Key & ) const; |
74 | bool operator!=( const Key & ) const; | 74 | bool operator!=( const Key & ) const; |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Sets the unique identifier. | 77 | * Sets the unique identifier. |
78 | */ | 78 | */ |
79 | void setId( const QString &id ); | 79 | void setId( const QString &id ); |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Returns the unique identifier. | 82 | * Returns the unique identifier. |
83 | */ | 83 | */ |
84 | QString id() const; | 84 | QString id() const; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Sets binary data. | 87 | * Sets binary data. |
88 | */ | 88 | */ |
89 | void setBinaryData( const QByteArray &binary ); | 89 | void setBinaryData( const QByteArray &binary ); |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Returns the binary data. | 92 | * Returns the binary data. |
93 | */ | 93 | */ |
94 | QByteArray binaryData() const; | 94 | QByteArray binaryData() const; |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Sets text data. | 97 | * Sets text data. |
98 | */ | 98 | */ |
99 | void setTextData( const QString &text ); | 99 | void setTextData( const QString &text ); |
100 | 100 | ||
101 | /** | 101 | /** |
102 | * Returns the text data. | 102 | * Returns the text data. |
103 | */ | 103 | */ |
104 | QString textData() const; | 104 | QString textData() const; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Returns whether the key contains binary or text data. | 107 | * Returns whether the key contains binary or text data. |
108 | */ | 108 | */ |
109 | bool isBinary() const; | 109 | bool isBinary() const; |
110 | 110 | ||
111 | /** | 111 | /** |
112 | * Sets the type, @see Type. | 112 | * Sets the type, @see Type. |
113 | */ | 113 | */ |
114 | void setType( int type ); | 114 | void setType( int type ); |
115 | 115 | ||
116 | /** | 116 | /** |
117 | * Sets custom type string. | 117 | * Sets custom type string. |
118 | */ | 118 | */ |
119 | void setCustomTypeString( const QString &custom ); | 119 | void setCustomTypeString( const QString &custom ); |
120 | 120 | ||
121 | /** | 121 | /** |
122 | * Returns the type, @see Type. | 122 | * Returns the type, @see Type. |
123 | */ | 123 | */ |
124 | int type() const; | 124 | int type() const; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | * Returns the custom type string. | 127 | * Returns the custom type string. |
128 | */ | 128 | */ |
129 | QString customTypeString() const; | 129 | QString customTypeString() const; |
130 | 130 | ||
131 | /** | 131 | /** |
132 | * Returns a list of all available key types. | 132 | * Returns a list of all available key types. |
133 | */ | 133 | */ |
134 | static TypeList typeList(); | 134 | static TypeList typeList(); |
135 | 135 | ||
136 | /** | 136 | /** |
137 | * Returns a translated label for a given key type. | 137 | * Returns a translated label for a given key type. |
138 | */ | 138 | */ |
139 | static QString typeLabel( int type ); | 139 | static QString typeLabel( int type ); |
140 | 140 | ||
141 | private: | 141 | private: |
142 | QByteArray mBinaryData; | 142 | QByteArray mBinaryData; |
143 | QString mId; | 143 | QString mId; |
144 | QString mTextData; | 144 | QString mTextData; |
145 | QString mCustomTypeString; | 145 | QString mCustomTypeString; |
146 | 146 | ||
147 | int mIsBinary; | 147 | int mIsBinary; |
148 | int mType; | 148 | int mType; |
149 | }; | 149 | }; |
150 | 150 | ||
151 | QDataStream &operator<<( QDataStream &, const Key & ); | 151 | QDataStream &operator<<( QDataStream &, const Key & ); |
152 | QDataStream &operator>>( QDataStream &, Key & ); | 152 | QDataStream &operator>>( QDataStream &, Key & ); |
153 | 153 | ||
154 | } | 154 | } |
155 | #endif | 155 | #endif |
diff --git a/kabc/phonenumber.h b/kabc/phonenumber.h index feeba6c..6bc89d3 100644 --- a/kabc/phonenumber.h +++ b/kabc/phonenumber.h | |||
@@ -1,173 +1,173 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_PHONENUMBER_H | 28 | #ifndef KABC_PHONENUMBER_H |
29 | #define KABC_PHONENUMBER_H | 29 | #define KABC_PHONENUMBER_H |
30 | 30 | ||
31 | #include <qvaluelist.h> | 31 | #include <q3valuelist.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | 33 | ||
34 | namespace KABC { | 34 | namespace KABC { |
35 | 35 | ||
36 | /** | 36 | /** |
37 | @short Phonenumber information. | 37 | @short Phonenumber information. |
38 | 38 | ||
39 | This class provides phone number information. A phone number is classified by | 39 | This class provides phone number information. A phone number is classified by |
40 | a type. The following types are available, it's possible to use multiple types | 40 | a type. The following types are available, it's possible to use multiple types |
41 | @ref Types for a number by combining them through a logical or. | 41 | @ref Types for a number by combining them through a logical or. |
42 | */ | 42 | */ |
43 | class PhoneNumber | 43 | class PhoneNumber |
44 | { | 44 | { |
45 | friend QDataStream &operator<<( QDataStream &, const PhoneNumber & ); | 45 | friend QDataStream &operator<<( QDataStream &, const PhoneNumber & ); |
46 | friend QDataStream &operator>>( QDataStream &, PhoneNumber & ); | 46 | friend QDataStream &operator>>( QDataStream &, PhoneNumber & ); |
47 | 47 | ||
48 | public: | 48 | public: |
49 | typedef QValueList<PhoneNumber> List; | 49 | typedef Q3ValueList<PhoneNumber> List; |
50 | typedef QValueList<int> TypeList; | 50 | typedef Q3ValueList<int> TypeList; |
51 | 51 | ||
52 | /** | 52 | /** |
53 | @li @p Home - Home number | 53 | @li @p Home - Home number |
54 | @li @p Work - Office number | 54 | @li @p Work - Office number |
55 | @li @p Msg - Messaging | 55 | @li @p Msg - Messaging |
56 | @li @p Pref - Preferred number | 56 | @li @p Pref - Preferred number |
57 | @li @p Voice - Voice | 57 | @li @p Voice - Voice |
58 | @li @p Fax - Fax machine | 58 | @li @p Fax - Fax machine |
59 | @li @p Cell - Cell phone | 59 | @li @p Cell - Cell phone |
60 | @li @p Video - Video phone | 60 | @li @p Video - Video phone |
61 | @li @p Bbs - Mailbox | 61 | @li @p Bbs - Mailbox |
62 | @li @p Modem - Modem | 62 | @li @p Modem - Modem |
63 | @li @p Car - Car phone | 63 | @li @p Car - Car phone |
64 | @li @p Isdn - ISDN connection | 64 | @li @p Isdn - ISDN connection |
65 | @li @p Pcs - Personal Communication Service | 65 | @li @p Pcs - Personal Communication Service |
66 | @li @p Pager - Pager | 66 | @li @p Pager - Pager |
67 | */ | 67 | */ |
68 | enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32, | 68 | enum Types { Home = 1, Work = 2, Msg = 4, Pref = 8, Voice = 16, Fax = 32, |
69 | Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024, | 69 | Cell = 64, Video = 128, Bbs = 256, Modem = 512, Car = 1024, |
70 | Isdn = 2048, Pcs = 4096, Pager = 8192 }; | 70 | Isdn = 2048, Pcs = 4096, Pager = 8192 }; |
71 | 71 | ||
72 | /** | 72 | /** |
73 | Create an empty phone number object. | 73 | Create an empty phone number object. |
74 | */ | 74 | */ |
75 | PhoneNumber(); | 75 | PhoneNumber(); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | Create a phonenumber object. | 78 | Create a phonenumber object. |
79 | 79 | ||
80 | @param number Number | 80 | @param number Number |
81 | @param type Type as defined in enum. Multiple types can be | 81 | @param type Type as defined in enum. Multiple types can be |
82 | specified by combining them by a logical or. | 82 | specified by combining them by a logical or. |
83 | */ | 83 | */ |
84 | PhoneNumber( const QString &number, int type = Home ); | 84 | PhoneNumber( const QString &number, int type = Home ); |
85 | 85 | ||
86 | /** | 86 | /** |
87 | Destructor. | 87 | Destructor. |
88 | */ | 88 | */ |
89 | ~PhoneNumber(); | 89 | ~PhoneNumber(); |
90 | 90 | ||
91 | bool operator==( const PhoneNumber & ) const; | 91 | bool operator==( const PhoneNumber & ) const; |
92 | bool operator!=( const PhoneNumber & ) const; | 92 | bool operator!=( const PhoneNumber & ) const; |
93 | 93 | ||
94 | bool contains( const PhoneNumber &p ); | 94 | bool contains( const PhoneNumber &p ); |
95 | /** | 95 | /** |
96 | Sets the unique identifier. | 96 | Sets the unique identifier. |
97 | */ | 97 | */ |
98 | void setId( const QString &id ); | 98 | void setId( const QString &id ); |
99 | 99 | ||
100 | /** | 100 | /** |
101 | Returns the unique identifier. | 101 | Returns the unique identifier. |
102 | */ | 102 | */ |
103 | QString id() const; | 103 | QString id() const; |
104 | 104 | ||
105 | /** | 105 | /** |
106 | Sets the number. | 106 | Sets the number. |
107 | */ | 107 | */ |
108 | void setNumber( const QString & ); | 108 | void setNumber( const QString & ); |
109 | 109 | ||
110 | /** | 110 | /** |
111 | Returns the number. | 111 | Returns the number. |
112 | */ | 112 | */ |
113 | QString number() const; | 113 | QString number() const; |
114 | 114 | ||
115 | /** | 115 | /** |
116 | Sets the type. Multiple types can be specified by combining them by | 116 | Sets the type. Multiple types can be specified by combining them by |
117 | a logical or. | 117 | a logical or. |
118 | */ | 118 | */ |
119 | void setType( int ); | 119 | void setType( int ); |
120 | 120 | ||
121 | /** | 121 | /** |
122 | Returns the type. Can be a multiple types combined by a logical or. | 122 | Returns the type. Can be a multiple types combined by a logical or. |
123 | */ | 123 | */ |
124 | int type() const; | 124 | int type() const; |
125 | 125 | ||
126 | /** | 126 | /** |
127 | Returns a translated string of all types the address has. | 127 | Returns a translated string of all types the address has. |
128 | */ | 128 | */ |
129 | QString typeLabel() const; | 129 | QString typeLabel() const; |
130 | 130 | ||
131 | /** | 131 | /** |
132 | Returns the translated label for phone number depending on its type. | 132 | Returns the translated label for phone number depending on its type. |
133 | */ | 133 | */ |
134 | QString label() const; | 134 | QString label() const; |
135 | 135 | ||
136 | /** | 136 | /** |
137 | Returns a list of all available types | 137 | Returns a list of all available types |
138 | */ | 138 | */ |
139 | static TypeList typeList(); | 139 | static TypeList typeList(); |
140 | 140 | ||
141 | /** | 141 | /** |
142 | Returns the translated label for phone number type. | 142 | Returns the translated label for phone number type. |
143 | */ | 143 | */ |
144 | static QString typeLabel( int type ); | 144 | static QString typeLabel( int type ); |
145 | 145 | ||
146 | /** | 146 | /** |
147 | Returns the translated label for phone number type. | 147 | Returns the translated label for phone number type. |
148 | @obsolete | 148 | @obsolete |
149 | */ | 149 | */ |
150 | static QString label( int type ); | 150 | static QString label( int type ); |
151 | static TypeList supportedTypeList(); | 151 | static TypeList supportedTypeList(); |
152 | static QStringList supportedTypeListNames(); | 152 | static QStringList supportedTypeListNames(); |
153 | static int typeListIndex4Type(int type ); | 153 | static int typeListIndex4Type(int type ); |
154 | bool simplifyNumber(); | 154 | bool simplifyNumber(); |
155 | void simplifyType(); | 155 | void simplifyType(); |
156 | void makeCompat(); | 156 | void makeCompat(); |
157 | int getCompatType( int type ); | 157 | int getCompatType( int type ); |
158 | 158 | ||
159 | private: | 159 | private: |
160 | void init(); | 160 | void init(); |
161 | 161 | ||
162 | QString mId; | 162 | QString mId; |
163 | 163 | ||
164 | int mType; | 164 | int mType; |
165 | QString mNumber; | 165 | QString mNumber; |
166 | }; | 166 | }; |
167 | 167 | ||
168 | QDataStream &operator<<( QDataStream &, const PhoneNumber & ); | 168 | QDataStream &operator<<( QDataStream &, const PhoneNumber & ); |
169 | QDataStream &operator>>( QDataStream &, PhoneNumber & ); | 169 | QDataStream &operator>>( QDataStream &, PhoneNumber & ); |
170 | 170 | ||
171 | } | 171 | } |
172 | 172 | ||
173 | #endif | 173 | #endif |
diff --git a/kabc/picture.cpp b/kabc/picture.cpp index 57aa297..0c59937 100644 --- a/kabc/picture.cpp +++ b/kabc/picture.cpp | |||
@@ -1,167 +1,169 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include "picture.h" | 28 | #include "picture.h" |
29 | //Added by qt3to4: | ||
30 | #include <QPixmap> | ||
29 | 31 | ||
30 | using namespace KABC; | 32 | using namespace KABC; |
31 | 33 | ||
32 | Picture::Picture() | 34 | Picture::Picture() |
33 | : mIntern( false ) | 35 | : mIntern( false ) |
34 | { | 36 | { |
35 | mUndefined = true; | 37 | mUndefined = true; |
36 | } | 38 | } |
37 | 39 | ||
38 | Picture::Picture( const QString &url ) | 40 | Picture::Picture( const QString &url ) |
39 | : mUrl( url ), mIntern( false ) | 41 | : mUrl( url ), mIntern( false ) |
40 | { | 42 | { |
41 | mUndefined = false; | 43 | mUndefined = false; |
42 | } | 44 | } |
43 | 45 | ||
44 | Picture::Picture( const QImage &data ) | 46 | Picture::Picture( const QImage &data ) |
45 | : mData( data ), mIntern( true ) | 47 | : mData( data ), mIntern( true ) |
46 | { | 48 | { |
47 | mUndefined = false; | 49 | mUndefined = false; |
48 | } | 50 | } |
49 | 51 | ||
50 | Picture::~Picture() | 52 | Picture::~Picture() |
51 | { | 53 | { |
52 | } | 54 | } |
53 | 55 | ||
54 | bool Picture::operator==( const Picture &p ) const | 56 | bool Picture::operator==( const Picture &p ) const |
55 | { | 57 | { |
56 | //qDebug("compare PIC "); | 58 | //qDebug("compare PIC "); |
57 | if ( mUndefined && p.mUndefined ) { | 59 | if ( mUndefined && p.mUndefined ) { |
58 | //qDebug("compare PIC true 1 "); | 60 | //qDebug("compare PIC true 1 "); |
59 | return true; | 61 | return true; |
60 | } | 62 | } |
61 | if ( mUndefined || p.mUndefined ) { | 63 | if ( mUndefined || p.mUndefined ) { |
62 | //qDebug("compare PIC false 1"); | 64 | //qDebug("compare PIC false 1"); |
63 | return false; | 65 | return false; |
64 | } | 66 | } |
65 | // now we should deal with two defined pics! | 67 | // now we should deal with two defined pics! |
66 | if ( mIntern != p.mIntern ) { | 68 | if ( mIntern != p.mIntern ) { |
67 | //qDebug("compare PIC false 2"); | 69 | //qDebug("compare PIC false 2"); |
68 | return false; | 70 | return false; |
69 | } | 71 | } |
70 | if ( mIntern ) { | 72 | if ( mIntern ) { |
71 | //qDebug("mIntern "); | 73 | //qDebug("mIntern "); |
72 | if ( mData.isNull() && p.mData.isNull() ) { | 74 | if ( mData.isNull() && p.mData.isNull() ) { |
73 | //qDebug("compare PIC true 2 "); | 75 | //qDebug("compare PIC true 2 "); |
74 | return true; | 76 | return true; |
75 | } | 77 | } |
76 | if ( mData.isNull() || p.mData.isNull() ){ | 78 | if ( mData.isNull() || p.mData.isNull() ){ |
77 | //qDebug("compare PIC false 3-1"); | 79 | //qDebug("compare PIC false 3-1"); |
78 | 80 | ||
79 | return false; | 81 | return false; |
80 | } | 82 | } |
81 | if ( mData != p.mData ) { | 83 | if ( mData != p.mData ) { |
82 | //qDebug("compare PIC false 3"); | 84 | //qDebug("compare PIC false 3"); |
83 | return false; | 85 | return false; |
84 | } | 86 | } |
85 | } else { | 87 | } else { |
86 | if ( mUrl != p.mUrl ) { | 88 | if ( mUrl != p.mUrl ) { |
87 | //qDebug("compare PIC false 4"); | 89 | //qDebug("compare PIC false 4"); |
88 | return false; | 90 | return false; |
89 | } | 91 | } |
90 | } | 92 | } |
91 | //qDebug("compare PIC true "); | 93 | //qDebug("compare PIC true "); |
92 | return true; | 94 | return true; |
93 | } | 95 | } |
94 | 96 | ||
95 | bool Picture::operator!=( const Picture &p ) const | 97 | bool Picture::operator!=( const Picture &p ) const |
96 | { | 98 | { |
97 | return !( p == *this ); | 99 | return !( p == *this ); |
98 | } | 100 | } |
99 | 101 | ||
100 | void Picture::setUrl( const QString &url ) | 102 | void Picture::setUrl( const QString &url ) |
101 | { | 103 | { |
102 | mUrl = url; | 104 | mUrl = url; |
103 | mIntern = false; | 105 | mIntern = false; |
104 | mUndefined = false; | 106 | mUndefined = false; |
105 | } | 107 | } |
106 | 108 | ||
107 | void Picture::setData( const QImage &data ) | 109 | void Picture::setData( const QImage &data ) |
108 | { | 110 | { |
109 | mData = data; | 111 | mData = data; |
110 | mIntern = true; | 112 | mIntern = true; |
111 | mUndefined = false; | 113 | mUndefined = false; |
112 | } | 114 | } |
113 | 115 | ||
114 | void Picture::setType( const QString &type ) | 116 | void Picture::setType( const QString &type ) |
115 | { | 117 | { |
116 | mType = type; | 118 | mType = type; |
117 | } | 119 | } |
118 | 120 | ||
119 | bool Picture::isIntern() const | 121 | bool Picture::isIntern() const |
120 | { | 122 | { |
121 | return mIntern; | 123 | return mIntern; |
122 | } | 124 | } |
123 | 125 | ||
124 | QString Picture::url() const | 126 | QString Picture::url() const |
125 | { | 127 | { |
126 | return mUrl; | 128 | return mUrl; |
127 | } | 129 | } |
128 | 130 | ||
129 | QImage Picture::data() const | 131 | QImage Picture::data() const |
130 | { | 132 | { |
131 | return mData; | 133 | return mData; |
132 | } | 134 | } |
133 | QPixmap Picture::pixmap() const | 135 | QPixmap Picture::pixmap() const |
134 | { | 136 | { |
135 | QPixmap p; | 137 | QPixmap p; |
136 | p.convertFromImage ( mData ); | 138 | p.convertFromImage ( mData ); |
137 | return p; | 139 | return p; |
138 | } | 140 | } |
139 | 141 | ||
140 | QString Picture::type() const | 142 | QString Picture::type() const |
141 | { | 143 | { |
142 | return mType; | 144 | return mType; |
143 | } | 145 | } |
144 | bool Picture::undefined() const | 146 | bool Picture::undefined() const |
145 | { | 147 | { |
146 | return mUndefined; | 148 | return mUndefined; |
147 | } | 149 | } |
148 | 150 | ||
149 | 151 | ||
150 | QString Picture::asString() const | 152 | QString Picture::asString() const |
151 | { | 153 | { |
152 | if ( mIntern ) | 154 | if ( mIntern ) |
153 | return "intern picture"; | 155 | return "intern picture"; |
154 | else | 156 | else |
155 | return mUrl; | 157 | return mUrl; |
156 | } | 158 | } |
157 | 159 | ||
158 | QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture ) | 160 | QDataStream &KABC::operator<<( QDataStream &s, const Picture &picture ) |
159 | { | 161 | { |
160 | return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData; | 162 | return s << picture.mIntern << picture.mUrl << picture.mType << picture.mData; |
161 | } | 163 | } |
162 | 164 | ||
163 | QDataStream &KABC::operator>>( QDataStream &s, Picture &picture ) | 165 | QDataStream &KABC::operator>>( QDataStream &s, Picture &picture ) |
164 | { | 166 | { |
165 | s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData; | 167 | s >> picture.mIntern >> picture.mUrl >> picture.mType >> picture.mData; |
166 | return s; | 168 | return s; |
167 | } | 169 | } |
diff --git a/kabc/picture.h b/kabc/picture.h index 714d1e2..1b63610 100644 --- a/kabc/picture.h +++ b/kabc/picture.h | |||
@@ -1,134 +1,136 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_PICTURE_H | 28 | #ifndef KABC_PICTURE_H |
29 | #define KABC_PICTURE_H | 29 | #define KABC_PICTURE_H |
30 | 30 | ||
31 | #include <qimage.h> | 31 | #include <qimage.h> |
32 | //Added by qt3to4: | ||
33 | #include <QPixmap> | ||
32 | 34 | ||
33 | namespace KABC { | 35 | namespace KABC { |
34 | 36 | ||
35 | class Picture | 37 | class Picture |
36 | { | 38 | { |
37 | friend QDataStream &operator<<( QDataStream &, const Picture & ); | 39 | friend QDataStream &operator<<( QDataStream &, const Picture & ); |
38 | friend QDataStream &operator>>( QDataStream &, Picture & ); | 40 | friend QDataStream &operator>>( QDataStream &, Picture & ); |
39 | 41 | ||
40 | public: | 42 | public: |
41 | 43 | ||
42 | /** | 44 | /** |
43 | * Consturctor. Creates an empty object. | 45 | * Consturctor. Creates an empty object. |
44 | */ | 46 | */ |
45 | Picture(); | 47 | Picture(); |
46 | 48 | ||
47 | /** | 49 | /** |
48 | * Consturctor. | 50 | * Consturctor. |
49 | * | 51 | * |
50 | * @param url A URL that describes the position of the picture file. | 52 | * @param url A URL that describes the position of the picture file. |
51 | */ | 53 | */ |
52 | Picture( const QString &url ); | 54 | Picture( const QString &url ); |
53 | 55 | ||
54 | /** | 56 | /** |
55 | * Consturctor. | 57 | * Consturctor. |
56 | * | 58 | * |
57 | * @param data The raw data of the picture. | 59 | * @param data The raw data of the picture. |
58 | */ | 60 | */ |
59 | Picture( const QImage &data ); | 61 | Picture( const QImage &data ); |
60 | 62 | ||
61 | /** | 63 | /** |
62 | * Destructor. | 64 | * Destructor. |
63 | */ | 65 | */ |
64 | ~Picture(); | 66 | ~Picture(); |
65 | 67 | ||
66 | bool undefined() const; | 68 | bool undefined() const; |
67 | bool operator==( const Picture & ) const; | 69 | bool operator==( const Picture & ) const; |
68 | bool operator!=( const Picture & ) const; | 70 | bool operator!=( const Picture & ) const; |
69 | 71 | ||
70 | /** | 72 | /** |
71 | * Sets a URL for the location of the picture file. When using this | 73 | * Sets a URL for the location of the picture file. When using this |
72 | * function, @ref isIntern() will return 'false' until you use | 74 | * function, @ref isIntern() will return 'false' until you use |
73 | * @ref setData(). | 75 | * @ref setData(). |
74 | * | 76 | * |
75 | * @param url The location URL of the picture file. | 77 | * @param url The location URL of the picture file. |
76 | */ | 78 | */ |
77 | void setUrl( const QString &url ); | 79 | void setUrl( const QString &url ); |
78 | 80 | ||
79 | /** | 81 | /** |
80 | * Sets the raw data of the picture. When using this function, | 82 | * Sets the raw data of the picture. When using this function, |
81 | * @ref isIntern() will return 'true' until you use @ref setUrl(). | 83 | * @ref isIntern() will return 'true' until you use @ref setUrl(). |
82 | * | 84 | * |
83 | * @param data The raw data of the picture. | 85 | * @param data The raw data of the picture. |
84 | */ | 86 | */ |
85 | void setData( const QImage &data ); | 87 | void setData( const QImage &data ); |
86 | 88 | ||
87 | /** | 89 | /** |
88 | * Sets the type of the picture. | 90 | * Sets the type of the picture. |
89 | */ | 91 | */ |
90 | void setType( const QString &type ); | 92 | void setType( const QString &type ); |
91 | 93 | ||
92 | /** | 94 | /** |
93 | * Returns whether the picture is described by a URL (extern) or | 95 | * Returns whether the picture is described by a URL (extern) or |
94 | * by the raw data (intern). | 96 | * by the raw data (intern). |
95 | * When this method returns 'true' you can use @ref data() to | 97 | * When this method returns 'true' you can use @ref data() to |
96 | * get the raw data. Otherwise you can request the URL of this | 98 | * get the raw data. Otherwise you can request the URL of this |
97 | * picture by @ref url() and load the raw data from that location. | 99 | * picture by @ref url() and load the raw data from that location. |
98 | */ | 100 | */ |
99 | bool isIntern() const; | 101 | bool isIntern() const; |
100 | 102 | ||
101 | /** | 103 | /** |
102 | * Returns the location URL of this picture. | 104 | * Returns the location URL of this picture. |
103 | */ | 105 | */ |
104 | QString url() const; | 106 | QString url() const; |
105 | 107 | ||
106 | /** | 108 | /** |
107 | * Returns the raw data of this picture. | 109 | * Returns the raw data of this picture. |
108 | */ | 110 | */ |
109 | QImage data() const; | 111 | QImage data() const; |
110 | QPixmap pixmap() const; | 112 | QPixmap pixmap() const; |
111 | /** | 113 | /** |
112 | * Returns the type of this picture. | 114 | * Returns the type of this picture. |
113 | */ | 115 | */ |
114 | QString type() const; | 116 | QString type() const; |
115 | 117 | ||
116 | /** | 118 | /** |
117 | * Returns string representation of the picture. | 119 | * Returns string representation of the picture. |
118 | */ | 120 | */ |
119 | QString asString() const; | 121 | QString asString() const; |
120 | 122 | ||
121 | private: | 123 | private: |
122 | QString mUrl; | 124 | QString mUrl; |
123 | QString mType; | 125 | QString mType; |
124 | QImage mData; | 126 | QImage mData; |
125 | bool mUndefined; | 127 | bool mUndefined; |
126 | 128 | ||
127 | int mIntern; | 129 | int mIntern; |
128 | }; | 130 | }; |
129 | 131 | ||
130 | QDataStream &operator<<( QDataStream &, const Picture & ); | 132 | QDataStream &operator<<( QDataStream &, const Picture & ); |
131 | QDataStream &operator>>( QDataStream &, Picture & ); | 133 | QDataStream &operator>>( QDataStream &, Picture & ); |
132 | 134 | ||
133 | } | 135 | } |
134 | #endif | 136 | #endif |
diff --git a/kabc/plugins/dir/dir.pro b/kabc/plugins/dir/dir.pro index 3e18594..9b3b894 100644 --- a/kabc/plugins/dir/dir.pro +++ b/kabc/plugins/dir/dir.pro | |||
@@ -1,36 +1,40 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | include( ../../../variables.pri ) | 5 | include( ../../../variables.pri ) |
6 | 6 | ||
7 | TARGET = microkabc_dir | 7 | TARGET = xmicrokabc_dir |
8 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat | 8 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat |
9 | DESTDIR = ../../../bin | 9 | DESTDIR = ../../../bin |
10 | #LIBS += -lmicrokde -lmicrokabc | 10 | #LIBS += -lxmicrokde -lxmicrokabc |
11 | #LIBS += -L$(QPEDIR)/lib | 11 | #LIBS += -L$(QPEDIR)/lib |
12 | 12 | ||
13 | INTERFACES = \ | 13 | INTERFACES = \ |
14 | 14 | ||
15 | HEADERS = \ | 15 | HEADERS = \ |
16 | resourcedir.h \ | 16 | resourcedir.h \ |
17 | resourcedirconfig.h | 17 | resourcedirconfig.h |
18 | 18 | ||
19 | SOURCES = \ | 19 | SOURCES = \ |
20 | resourcedir.cpp \ | 20 | resourcedir.cpp \ |
21 | resourcedirconfig.cpp | 21 | resourcedirconfig.cpp |
22 | 22 | ||
23 | unix : { | 23 | unix : { |
24 | OBJECTS_DIR = obj/unix | 24 | OBJECTS_DIR = obj/unix |
25 | MOC_DIR = moc/unix | 25 | MOC_DIR = moc/unix |
26 | } | 26 | } |
27 | win32: { | 27 | win32: { |
28 | CONFIG += dll | 28 | CONFIG += dll |
29 | DEFINES += _WIN32_ | 29 | DEFINES += _WIN32_ |
30 | OBJECTS_DIR = obj/win | 30 | OBJECTS_DIR = obj/win |
31 | MOC_DIR = moc/win | 31 | MOC_DIR = moc/win |
32 | LIBS += ../../../bin/microkdepim.lib | 32 | LIBS += ../../../bin/xmicrokdepim.lib |
33 | LIBS += ../../../bin/microkcal.lib | 33 | LIBS += ../../../bin/xmicrokcal.lib |
34 | LIBS += ../../../bin/microkde.lib | 34 | LIBS += ../../../bin/xmicrokde.lib |
35 | LIBS += ../../../bin/microkabc.lib | 35 | LIBS += ../../../bin/microkabc.lib |
36 | } | 36 | } |
37 | #The following line was inserted by qt3to4 | ||
38 | QT += qt3support | ||
39 | #The following line was inserted by qt3to4 | ||
40 | QT += xml | ||
diff --git a/kabc/plugins/dir/dirE.pro b/kabc/plugins/dir/dirE.pro index cda4e2f..75332a0 100644 --- a/kabc/plugins/dir/dirE.pro +++ b/kabc/plugins/dir/dirE.pro | |||
@@ -1,21 +1,21 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabc_dir | 5 | TARGET = xmicrokabc_dir |
6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat | 6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat |
7 | OBJECTS_DIR = obj/$(PLATFORM) | 7 | OBJECTS_DIR = obj/$(PLATFORM) |
8 | MOC_DIR = moc/$(PLATFORM) | 8 | MOC_DIR = moc/$(PLATFORM) |
9 | DESTDIR = $(QPEDIR)/lib | 9 | DESTDIR = $(QPEDIR)/lib |
10 | LIBS += -lmicrokde -lmicrokabc | 10 | LIBS += -lxmicrokde -lxmicrokabc |
11 | LIBS += -L$(QPEDIR)/lib | 11 | LIBS += -L$(QPEDIR)/lib |
12 | 12 | ||
13 | INTERFACES = \ | 13 | INTERFACES = \ |
14 | 14 | ||
15 | HEADERS = \ | 15 | HEADERS = \ |
16 | resourcedir.h \ | 16 | resourcedir.h \ |
17 | resourcedirconfig.h | 17 | resourcedirconfig.h |
18 | 18 | ||
19 | SOURCES = \ | 19 | SOURCES = \ |
20 | resourcedir.cpp \ | 20 | resourcedir.cpp \ |
21 | resourcedirconfig.cpp | 21 | resourcedirconfig.cpp |
diff --git a/kabc/plugins/dir/resourcedir.cpp b/kabc/plugins/dir/resourcedir.cpp index c61664b..cc4afee 100644 --- a/kabc/plugins/dir/resourcedir.cpp +++ b/kabc/plugins/dir/resourcedir.cpp | |||
@@ -1,381 +1,381 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | 28 | ||
29 | #include <sys/types.h> | 29 | #include <sys/types.h> |
30 | #include <sys/stat.h> | 30 | #include <sys/stat.h> |
31 | #ifndef _WIN32_ | 31 | #ifndef _WIN32_ |
32 | #include <unistd.h> | 32 | #include <unistd.h> |
33 | #endif | 33 | #endif |
34 | 34 | ||
35 | #include <qregexp.h> | 35 | #include <qregexp.h> |
36 | #include <qtimer.h> | 36 | #include <qtimer.h> |
37 | #include <qwidget.h> | 37 | #include <qwidget.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | //US #include <kgenericfactory.h> | 42 | //US #include <kgenericfactory.h> |
43 | #include <kglobal.h> | 43 | #include <kglobal.h> |
44 | #include <klocale.h> | 44 | #include <klocale.h> |
45 | #include <kstandarddirs.h> | 45 | #include <kstandarddirs.h> |
46 | #include <kurlrequester.h> | 46 | #include <kurlrequester.h> |
47 | #include <kmessagebox.h> | 47 | #include <kmessagebox.h> |
48 | 48 | ||
49 | #include "addressbook.h" | 49 | #include "addressbook.h" |
50 | 50 | ||
51 | #include "formatfactory.h" | 51 | #include "formatfactory.h" |
52 | 52 | ||
53 | #include "resourcedirconfig.h" | 53 | #include "resourcedirconfig.h" |
54 | #include "stdaddressbook.h" | 54 | #include "stdaddressbook.h" |
55 | 55 | ||
56 | //US | 56 | //US |
57 | #include <qdir.h> | 57 | #include <qdir.h> |
58 | 58 | ||
59 | #define NO_DIRWATCH | 59 | #define NO_DIRWATCH |
60 | #include "resourcedir.h" | 60 | #include "resourcedir.h" |
61 | 61 | ||
62 | //#define ALLOW_LOCKING | 62 | //#define ALLOW_LOCKING |
63 | 63 | ||
64 | using namespace KABC; | 64 | using namespace KABC; |
65 | 65 | ||
66 | extern "C" | 66 | extern "C" |
67 | #ifdef _WIN32_ | 67 | #ifdef _WIN32_ |
68 | __declspec(dllexport) | 68 | __declspec(dllexport) |
69 | #else | 69 | #else |
70 | { | 70 | { |
71 | #endif | 71 | #endif |
72 | 72 | ||
73 | //US void *init_kabc_dir() | 73 | //US void *init_kabc_dir() |
74 | void *init_microkabc_dir() | 74 | void *init_microkabc_dir() |
75 | { | 75 | { |
76 | return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); | 76 | return new KRES::PluginFactory<ResourceDir,ResourceDirConfig>(); |
77 | } | 77 | } |
78 | #ifndef _WIN32_ | 78 | #ifndef _WIN32_ |
79 | } | 79 | } |
80 | #endif | 80 | #endif |
81 | 81 | ||
82 | ResourceDir::ResourceDir( const KConfig *config ) | 82 | ResourceDir::ResourceDir( const KConfig *config ) |
83 | : Resource( config ) | 83 | : Resource( config ) |
84 | { | 84 | { |
85 | QString path; | 85 | QString path; |
86 | 86 | ||
87 | KConfig *cfg = (KConfig *)config; | 87 | KConfig *cfg = (KConfig *)config; |
88 | if ( cfg ) { | 88 | if ( cfg ) { |
89 | #ifdef _WIN32_ | 89 | #ifdef _WIN32_ |
90 | // we use plugins on win32. the group is stored in a static variable | 90 | // we use plugins on win32. the group is stored in a static variable |
91 | // such that group info not available on win32 plugins | 91 | // such that group info not available on win32 plugins |
92 | // to fix that, it would be a looooot of work | 92 | // to fix that, it would be a looooot of work |
93 | if ( !cfg->tempGroup().isEmpty() ) | 93 | if ( !cfg->tempGroup().isEmpty() ) |
94 | cfg->setGroup( cfg->tempGroup() ); | 94 | cfg->setGroup( cfg->tempGroup() ); |
95 | #endif | 95 | #endif |
96 | //US path = config->readEntry( "FilePath" ); | 96 | //US path = config->readEntry( "FilePath" ); |
97 | path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); | 97 | path = cfg->readEntry( "FilePath", StdAddressBook::directoryName() ); |
98 | //US mFormatName = config->readEntry( "FileFormat" ); | 98 | //US mFormatName = config->readEntry( "FileFormat" ); |
99 | mFormatName = cfg->readEntry( "FileFormat", "vcard" ); | 99 | mFormatName = cfg->readEntry( "FileFormat", "vcard" ); |
100 | } else { | 100 | } else { |
101 | path = StdAddressBook::directoryName(); | 101 | path = StdAddressBook::directoryName(); |
102 | mFormatName = "vcard"; | 102 | mFormatName = "vcard"; |
103 | } | 103 | } |
104 | 104 | ||
105 | 105 | ||
106 | FormatFactory *factory = FormatFactory::self(); | 106 | FormatFactory *factory = FormatFactory::self(); |
107 | mFormat = factory->format( mFormatName ); | 107 | mFormat = factory->format( mFormatName ); |
108 | 108 | ||
109 | if ( !mFormat ) { | 109 | if ( !mFormat ) { |
110 | mFormatName = "vcard"; | 110 | mFormatName = "vcard"; |
111 | mFormat = factory->format( mFormatName ); | 111 | mFormat = factory->format( mFormatName ); |
112 | } | 112 | } |
113 | 113 | ||
114 | /*US | 114 | /*US |
115 | //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); | 115 | //US qDebug("ResourceDir::ResourceDir initialized with format %s ", mFormatName.latin1()); |
116 | if (mFormatName == "vcard") | 116 | if (mFormatName == "vcard") |
117 | mFormat = new VCardFormatPlugin2(); | 117 | mFormat = new VCardFormatPlugin2(); |
118 | else if (mFormatName == "binary") | 118 | else if (mFormatName == "binary") |
119 | mFormat = new BinaryFormat(); | 119 | mFormat = new BinaryFormat(); |
120 | else | 120 | else |
121 | qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); | 121 | qDebug("ResourceFile::init format unknown !!! %s ", mFormatName.latin1()); |
122 | */ | 122 | */ |
123 | #ifndef NO_DIRWATCH | 123 | #ifndef NO_DIRWATCH |
124 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); | 124 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( pathChanged() ) ); |
125 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); | 125 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( pathChanged() ) ); |
126 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); | 126 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( pathChanged() ) ); |
127 | #endif | 127 | #endif |
128 | setPath( path ); | 128 | setPath( path ); |
129 | } | 129 | } |
130 | 130 | ||
131 | ResourceDir::~ResourceDir() | 131 | ResourceDir::~ResourceDir() |
132 | { | 132 | { |
133 | delete mFormat; | 133 | delete mFormat; |
134 | mFormat = 0; | 134 | mFormat = 0; |
135 | } | 135 | } |
136 | 136 | ||
137 | void ResourceDir::writeConfig( KConfig *config ) | 137 | void ResourceDir::writeConfig( KConfig *config ) |
138 | { | 138 | { |
139 | config->setGroup( "Resource_" + identifier() ); | 139 | config->setGroup( "Resource_" + identifier() ); |
140 | Resource::writeConfig( config ); | 140 | Resource::writeConfig( config ); |
141 | 141 | ||
142 | config->writeEntry( "FilePath", mPath ); | 142 | config->writeEntry( "FilePath", mPath ); |
143 | config->writeEntry( "FileFormat", mFormatName ); | 143 | config->writeEntry( "FileFormat", mFormatName ); |
144 | } | 144 | } |
145 | 145 | ||
146 | Ticket *ResourceDir::requestSaveTicket() | 146 | Ticket *ResourceDir::requestSaveTicket() |
147 | { | 147 | { |
148 | 148 | ||
149 | 149 | ||
150 | if ( !addressBook() ) return 0; | 150 | if ( !addressBook() ) return 0; |
151 | #ifdef ALLOW_LOCKING | 151 | #ifdef ALLOW_LOCKING |
152 | if ( !lock( mPath ) ) { | 152 | if ( !lock( mPath ) ) { |
153 | 153 | ||
154 | return 0; | 154 | return 0; |
155 | } | 155 | } |
156 | #endif | 156 | #endif |
157 | return createTicket( this ); | 157 | return createTicket( this ); |
158 | 158 | ||
159 | } | 159 | } |
160 | 160 | ||
161 | 161 | ||
162 | bool ResourceDir::doOpen() | 162 | bool ResourceDir::doOpen() |
163 | { | 163 | { |
164 | QDir dir( mPath ); | 164 | QDir dir( mPath ); |
165 | if ( !dir.exists() ) { // no directory available | 165 | if ( !dir.exists() ) { // no directory available |
166 | return dir.mkdir( dir.path() ); | 166 | return dir.mkdir( dir.path() ); |
167 | } else { | 167 | } else { |
168 | QString testName = dir.entryList( QDir::Files )[0]; | 168 | QString testName = dir.entryList( QDir::Files )[0]; |
169 | if ( testName.isNull() || testName.isEmpty() ) // no file in directory | 169 | if ( testName.isNull() || testName.isEmpty() ) // no file in directory |
170 | return true; | 170 | return true; |
171 | 171 | ||
172 | QFile file( mPath + "/" + testName ); | 172 | QFile file( mPath + "/" + testName ); |
173 | if ( file.open( IO_ReadOnly ) ) | 173 | if ( file.open( QIODevice::ReadOnly ) ) |
174 | return true; | 174 | return true; |
175 | 175 | ||
176 | if ( file.size() == 0 ) | 176 | if ( file.size() == 0 ) |
177 | return true; | 177 | return true; |
178 | 178 | ||
179 | bool ok = mFormat->checkFormat( &file ); | 179 | bool ok = mFormat->checkFormat( &file ); |
180 | file.close(); | 180 | file.close(); |
181 | return ok; | 181 | return ok; |
182 | } | 182 | } |
183 | } | 183 | } |
184 | 184 | ||
185 | void ResourceDir::doClose() | 185 | void ResourceDir::doClose() |
186 | { | 186 | { |
187 | } | 187 | } |
188 | 188 | ||
189 | bool ResourceDir::load() | 189 | bool ResourceDir::load() |
190 | { | 190 | { |
191 | QDir dir( mPath ); | 191 | QDir dir( mPath ); |
192 | QStringList files = dir.entryList( QDir::Files ); | 192 | QStringList files = dir.entryList( QDir::Files ); |
193 | 193 | ||
194 | QStringList::Iterator it; | 194 | QStringList::Iterator it; |
195 | bool ok = true; | 195 | bool ok = true; |
196 | for ( it = files.begin(); it != files.end(); ++it ) { | 196 | for ( it = files.begin(); it != files.end(); ++it ) { |
197 | QFile file( mPath + "/" + (*it) ); | 197 | QFile file( mPath + "/" + (*it) ); |
198 | 198 | ||
199 | if ( !file.open( IO_ReadOnly ) ) { | 199 | if ( !file.open( QIODevice::ReadOnly ) ) { |
200 | addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) ); | 200 | addressBook()->error( i18n( "Unable to open file '%1' for reading" ).arg( file.name() ) ); |
201 | ok = false; | 201 | ok = false; |
202 | continue; | 202 | continue; |
203 | } | 203 | } |
204 | 204 | ||
205 | if ( !mFormat->loadAll( addressBook(), this, &file ) ) | 205 | if ( !mFormat->loadAll( addressBook(), this, &file ) ) |
206 | ok = false; | 206 | ok = false; |
207 | 207 | ||
208 | file.close(); | 208 | file.close(); |
209 | } | 209 | } |
210 | 210 | ||
211 | return ok; | 211 | return ok; |
212 | } | 212 | } |
213 | 213 | ||
214 | bool ResourceDir::save( Ticket *ticket ) | 214 | bool ResourceDir::save( Ticket *ticket ) |
215 | { | 215 | { |
216 | AddressBook::Iterator it; | 216 | AddressBook::Iterator it; |
217 | bool ok = true; | 217 | bool ok = true; |
218 | #ifndef NO_DIRWATCH | 218 | #ifndef NO_DIRWATCH |
219 | mDirWatch.stopScan(); | 219 | mDirWatch.stopScan(); |
220 | #endif | 220 | #endif |
221 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { | 221 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { |
222 | if ( (*it).resource() != this || !(*it).changed() ) | 222 | if ( (*it).resource() != this || !(*it).changed() ) |
223 | continue; | 223 | continue; |
224 | 224 | ||
225 | QFile file( mPath + "/" + (*it).uid() ); | 225 | QFile file( mPath + "/" + (*it).uid() ); |
226 | if ( !file.open( IO_WriteOnly ) ) { | 226 | if ( !file.open( QIODevice::WriteOnly ) ) { |
227 | addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) ); | 227 | addressBook()->error( i18n( "Unable to open file '%1' for writing" ).arg( file.name() ) ); |
228 | continue; | 228 | continue; |
229 | } | 229 | } |
230 | 230 | ||
231 | mFormat->save( *it, &file ); | 231 | mFormat->save( *it, &file ); |
232 | 232 | ||
233 | // mark as unchanged | 233 | // mark as unchanged |
234 | (*it).setChanged( false ); | 234 | (*it).setChanged( false ); |
235 | 235 | ||
236 | file.close(); | 236 | file.close(); |
237 | } | 237 | } |
238 | #ifndef NO_DIRWATCH | 238 | #ifndef NO_DIRWATCH |
239 | mDirWatch.startScan(); | 239 | mDirWatch.startScan(); |
240 | #endif | 240 | #endif |
241 | delete ticket; | 241 | delete ticket; |
242 | #ifdef ALLOW_LOCKING | 242 | #ifdef ALLOW_LOCKING |
243 | unlock( mPath ); | 243 | unlock( mPath ); |
244 | #endif | 244 | #endif |
245 | return ok; | 245 | return ok; |
246 | } | 246 | } |
247 | 247 | ||
248 | bool ResourceDir::lock( const QString &path ) | 248 | bool ResourceDir::lock( const QString &path ) |
249 | { | 249 | { |
250 | #ifdef ALLOW_LOCKING | 250 | #ifdef ALLOW_LOCKING |
251 | QString p = path; | 251 | QString p = path; |
252 | //US change the implementation how the lockfilename is getting created | 252 | //US change the implementation how the lockfilename is getting created |
253 | //US p.replace( QRegExp("/"), "_" ); | 253 | //US p.replace( QRegExp("/"), "_" ); |
254 | //US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" ); | 254 | //US QString lockName = locateLocal( "data", "kabc/lock/" + p + ".lock" ); |
255 | KURL url(p); | 255 | KURL url(p); |
256 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 256 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
257 | 257 | ||
258 | 258 | ||
259 | if ( QFile::exists( lockName ) ) return false; | 259 | if ( QFile::exists( lockName ) ) return false; |
260 | 260 | ||
261 | QString lockUniqueName; | 261 | QString lockUniqueName; |
262 | lockUniqueName = p + KApplication::randomString( 8 ); | 262 | lockUniqueName = p + KApplication::randomString( 8 ); |
263 | 263 | ||
264 | url = lockUniqueName; | 264 | url = lockUniqueName; |
265 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); | 265 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); |
266 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 266 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
267 | 267 | ||
268 | // Create unique file | 268 | // Create unique file |
269 | QFile file( mLockUniqueName ); | 269 | QFile file( mLockUniqueName ); |
270 | file.open( IO_WriteOnly ); | 270 | file.open( QIODevice::WriteOnly ); |
271 | file.close(); | 271 | file.close(); |
272 | 272 | ||
273 | // Create lock file | 273 | // Create lock file |
274 | int result = 0; | 274 | int result = 0; |
275 | #ifndef _WIN32_ | 275 | #ifndef _WIN32_ |
276 | result = ::link( QFile::encodeName( mLockUniqueName ), | 276 | result = ::link( QFile::encodeName( mLockUniqueName ), |
277 | QFile::encodeName( lockName ) ); | 277 | QFile::encodeName( lockName ) ); |
278 | #endif | 278 | #endif |
279 | if ( result == 0 ) { | 279 | if ( result == 0 ) { |
280 | addressBook()->emitAddressBookLocked(); | 280 | addressBook()->emitAddressBookLocked(); |
281 | return true; | 281 | return true; |
282 | } | 282 | } |
283 | 283 | ||
284 | // TODO: check stat | 284 | // TODO: check stat |
285 | 285 | ||
286 | return false; | 286 | return false; |
287 | #else | 287 | #else |
288 | return true; | 288 | return true; |
289 | #endif | 289 | #endif |
290 | } | 290 | } |
291 | 291 | ||
292 | void ResourceDir::unlock( const QString &path ) | 292 | void ResourceDir::unlock( const QString &path ) |
293 | { | 293 | { |
294 | #ifdef ALLOW_LOCKING | 294 | #ifdef ALLOW_LOCKING |
295 | QString p = path; | 295 | QString p = path; |
296 | //US change the implementation how the lockfilename is getting created | 296 | //US change the implementation how the lockfilename is getting created |
297 | //US p.replace( QRegExp( "/" ), "_" ); | 297 | //US p.replace( QRegExp( "/" ), "_" ); |
298 | //US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" ); | 298 | //US QString lockName = locate( "data", "kabc/lock/" + p + ".lock" ); |
299 | KURL url(p); | 299 | KURL url(p); |
300 | QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 300 | QString lockName = locate( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
301 | 301 | ||
302 | ::unlink( QFile::encodeName( lockName ) ); | 302 | ::unlink( QFile::encodeName( lockName ) ); |
303 | QFile::remove( mLockUniqueName ); | 303 | QFile::remove( mLockUniqueName ); |
304 | addressBook()->emitAddressBookUnlocked(); | 304 | addressBook()->emitAddressBookUnlocked(); |
305 | #else | 305 | #else |
306 | return; | 306 | return; |
307 | #endif | 307 | #endif |
308 | } | 308 | } |
309 | 309 | ||
310 | void ResourceDir::setPath( const QString &path ) | 310 | void ResourceDir::setPath( const QString &path ) |
311 | { | 311 | { |
312 | #ifndef NO_DIRWATCH | 312 | #ifndef NO_DIRWATCH |
313 | mDirWatch.stopScan(); | 313 | mDirWatch.stopScan(); |
314 | mDirWatch.removeDir( mPath ); | 314 | mDirWatch.removeDir( mPath ); |
315 | 315 | ||
316 | mPath = path; | 316 | mPath = path; |
317 | 317 | ||
318 | mDirWatch.addDir( mPath, true ); | 318 | mDirWatch.addDir( mPath, true ); |
319 | mDirWatch.startScan(); | 319 | mDirWatch.startScan(); |
320 | #else | 320 | #else |
321 | mPath = path; | 321 | mPath = path; |
322 | #endif | 322 | #endif |
323 | //US simulate KDirWatch event | 323 | //US simulate KDirWatch event |
324 | //US pathChanged(); | 324 | //US pathChanged(); |
325 | 325 | ||
326 | } | 326 | } |
327 | 327 | ||
328 | QString ResourceDir::path() const | 328 | QString ResourceDir::path() const |
329 | { | 329 | { |
330 | return mPath; | 330 | return mPath; |
331 | } | 331 | } |
332 | 332 | ||
333 | void ResourceDir::setFormat( const QString &format ) | 333 | void ResourceDir::setFormat( const QString &format ) |
334 | { | 334 | { |
335 | mFormatName = format; | 335 | mFormatName = format; |
336 | 336 | ||
337 | if ( mFormat ) | 337 | if ( mFormat ) |
338 | delete mFormat; | 338 | delete mFormat; |
339 | 339 | ||
340 | FormatFactory *factory = FormatFactory::self(); | 340 | FormatFactory *factory = FormatFactory::self(); |
341 | mFormat = factory->format( mFormatName ); | 341 | mFormat = factory->format( mFormatName ); |
342 | /*US | 342 | /*US |
343 | qDebug("ResourceDir::setFormat initialized with format %s ", format.latin1()); | 343 | qDebug("ResourceDir::setFormat initialized with format %s ", format.latin1()); |
344 | if (mFormatName == "vcard") | 344 | if (mFormatName == "vcard") |
345 | mFormat = new VCardFormatPlugin2(); | 345 | mFormat = new VCardFormatPlugin2(); |
346 | else if (mFormatName == "binary") | 346 | else if (mFormatName == "binary") |
347 | mFormat = new BinaryFormat(); | 347 | mFormat = new BinaryFormat(); |
348 | else | 348 | else |
349 | qDebug("ResourceDir::setFormat format unknown !!! %s ", format.latin1()); | 349 | qDebug("ResourceDir::setFormat format unknown !!! %s ", format.latin1()); |
350 | */ | 350 | */ |
351 | 351 | ||
352 | } | 352 | } |
353 | 353 | ||
354 | QString ResourceDir::format() const | 354 | QString ResourceDir::format() const |
355 | { | 355 | { |
356 | return mFormatName; | 356 | return mFormatName; |
357 | } | 357 | } |
358 | 358 | ||
359 | void ResourceDir::pathChanged() | 359 | void ResourceDir::pathChanged() |
360 | { | 360 | { |
361 | if ( !addressBook() ) | 361 | if ( !addressBook() ) |
362 | return; | 362 | return; |
363 | 363 | ||
364 | QString text( i18n( "Dir resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mPath ) ); | 364 | QString text( i18n( "Dir resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( mPath ) ); |
365 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { | 365 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { |
366 | load(); | 366 | load(); |
367 | addressBook()->emitAddressBookChanged(); | 367 | addressBook()->emitAddressBookChanged(); |
368 | } | 368 | } |
369 | } | 369 | } |
370 | 370 | ||
371 | void ResourceDir::removeAddressee( const Addressee& addr ) | 371 | void ResourceDir::removeAddressee( const Addressee& addr ) |
372 | { | 372 | { |
373 | QFile::remove( mPath + "/" + addr.uid() ); | 373 | QFile::remove( mPath + "/" + addr.uid() ); |
374 | } | 374 | } |
375 | 375 | ||
376 | void ResourceDir::cleanUp() | 376 | void ResourceDir::cleanUp() |
377 | { | 377 | { |
378 | unlock( mPath ); | 378 | unlock( mPath ); |
379 | } | 379 | } |
380 | 380 | ||
381 | //US #include "resourcedir.moc" | 381 | //US #include "resourcedir.moc" |
diff --git a/kabc/plugins/dir/resourcedirconfig.cpp b/kabc/plugins/dir/resourcedirconfig.cpp index 98d18fe..8fa48d0 100644 --- a/kabc/plugins/dir/resourcedirconfig.cpp +++ b/kabc/plugins/dir/resourcedirconfig.cpp | |||
@@ -1,123 +1,125 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3GridLayout> | ||
30 | 32 | ||
31 | #include <kdebug.h> | 33 | #include <kdebug.h> |
32 | #include <klocale.h> | 34 | #include <klocale.h> |
33 | #include <kstandarddirs.h> | 35 | #include <kstandarddirs.h> |
34 | #include <kdialog.h> | 36 | #include <kdialog.h> |
35 | 37 | ||
36 | //US #include "formatfactory.h" | 38 | //US #include "formatfactory.h" |
37 | #include "resourcedir.h" | 39 | #include "resourcedir.h" |
38 | #include "stdaddressbook.h" | 40 | #include "stdaddressbook.h" |
39 | 41 | ||
40 | #include "resourcedirconfig.h" | 42 | #include "resourcedirconfig.h" |
41 | 43 | ||
42 | using namespace KABC; | 44 | using namespace KABC; |
43 | 45 | ||
44 | ResourceDirConfig::ResourceDirConfig( QWidget* parent, const char* name ) | 46 | ResourceDirConfig::ResourceDirConfig( QWidget* parent, const char* name ) |
45 | : KRES::ConfigWidget( parent, name ) | 47 | : KRES::ConfigWidget( parent, name ) |
46 | { | 48 | { |
47 | QGridLayout *mainLayout = new QGridLayout( this, 2, 2, 0, | 49 | Q3GridLayout *mainLayout = new Q3GridLayout( this, 2, 2, 0, |
48 | KDialog::spacingHint() ); | 50 | KDialog::spacingHint() ); |
49 | 51 | ||
50 | QLabel *label = new QLabel( i18n( "Format:" ), this ); | 52 | QLabel *label = new QLabel( i18n( "Format:" ), this ); |
51 | mFormatBox = new KComboBox( this ); | 53 | mFormatBox = new KComboBox( this ); |
52 | 54 | ||
53 | mainLayout->addWidget( label, 0, 0 ); | 55 | mainLayout->addWidget( label, 0, 0 ); |
54 | mainLayout->addWidget( mFormatBox, 0, 1 ); | 56 | mainLayout->addWidget( mFormatBox, 0, 1 ); |
55 | 57 | ||
56 | label = new QLabel( i18n( "Location:" ), this ); | 58 | label = new QLabel( i18n( "Location:" ), this ); |
57 | mFileNameEdit = new KURLRequester( this ); | 59 | mFileNameEdit = new KURLRequester( this ); |
58 | //US mFileNameEdit->setMode( KFile::Directory ); | 60 | //US mFileNameEdit->setMode( KFile::Directory ); |
59 | 61 | ||
60 | mainLayout->addWidget( label, 1, 0 ); | 62 | mainLayout->addWidget( label, 1, 0 ); |
61 | mainLayout->addWidget( mFileNameEdit, 1, 1 ); | 63 | mainLayout->addWidget( mFileNameEdit, 1, 1 ); |
62 | 64 | ||
63 | /*US lets hardcode the formats instead of using a factory | 65 | /*US lets hardcode the formats instead of using a factory |
64 | FormatFactory *factory = FormatFactory::self(); | 66 | FormatFactory *factory = FormatFactory::self(); |
65 | QStringList formats = factory->formats(); | 67 | QStringList formats = factory->formats(); |
66 | QStringList::Iterator it; | 68 | QStringList::Iterator it; |
67 | for ( it = formats.begin(); it != formats.end(); ++it ) { | 69 | for ( it = formats.begin(); it != formats.end(); ++it ) { |
68 | FormatInfo *info = factory->info( *it ); | 70 | FormatInfo *info = factory->info( *it ); |
69 | if ( info ) { | 71 | if ( info ) { |
70 | mFormatTypes << (*it); | 72 | mFormatTypes << (*it); |
71 | mFormatBox->insertItem( info->nameLabel ); | 73 | mFormatBox->insertItem( info->nameLabel ); |
72 | } | 74 | } |
73 | } | 75 | } |
74 | */ | 76 | */ |
75 | mFormatTypes << "vcard"; | 77 | mFormatTypes << "vcard"; |
76 | mFormatTypes << "binary"; | 78 | mFormatTypes << "binary"; |
77 | mFormatBox->insertItem( "vcard" ); | 79 | mFormatBox->insertItem( "vcard" ); |
78 | mFormatBox->insertItem( "binary" ); | 80 | mFormatBox->insertItem( "binary" ); |
79 | 81 | ||
80 | 82 | ||
81 | mInEditMode = false; | 83 | mInEditMode = false; |
82 | } | 84 | } |
83 | 85 | ||
84 | void ResourceDirConfig::setEditMode( bool value ) | 86 | void ResourceDirConfig::setEditMode( bool value ) |
85 | { | 87 | { |
86 | mFormatBox->setEnabled( !value ); | 88 | mFormatBox->setEnabled( !value ); |
87 | mInEditMode = value; | 89 | mInEditMode = value; |
88 | } | 90 | } |
89 | 91 | ||
90 | void ResourceDirConfig::loadSettings( KRES::Resource *res ) | 92 | void ResourceDirConfig::loadSettings( KRES::Resource *res ) |
91 | { | 93 | { |
92 | //US ResourceDir *resource = dynamic_cast<ResourceDir*>( res ); | 94 | //US ResourceDir *resource = dynamic_cast<ResourceDir*>( res ); |
93 | ResourceDir *resource = (ResourceDir*)( res ); | 95 | ResourceDir *resource = (ResourceDir*)( res ); |
94 | 96 | ||
95 | if ( !resource ) { | 97 | if ( !resource ) { |
96 | kdDebug(5700) << "ResourceDirConfig::loadSettings(): cast failed" << endl; | 98 | kdDebug(5700) << "ResourceDirConfig::loadSettings(): cast failed" << endl; |
97 | return; | 99 | return; |
98 | } | 100 | } |
99 | 101 | ||
100 | mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) ); | 102 | mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) ); |
101 | 103 | ||
102 | mFileNameEdit->setURL( resource->path() ); | 104 | mFileNameEdit->setURL( resource->path() ); |
103 | if ( mFileNameEdit->url().isEmpty() ) | 105 | if ( mFileNameEdit->url().isEmpty() ) |
104 | mFileNameEdit->setURL( KABC::StdAddressBook::directoryName() ); | 106 | mFileNameEdit->setURL( KABC::StdAddressBook::directoryName() ); |
105 | } | 107 | } |
106 | 108 | ||
107 | void ResourceDirConfig::saveSettings( KRES::Resource *res ) | 109 | void ResourceDirConfig::saveSettings( KRES::Resource *res ) |
108 | { | 110 | { |
109 | //US ResourceDir *resource = dynamic_cast<ResourceDir*>( res ); | 111 | //US ResourceDir *resource = dynamic_cast<ResourceDir*>( res ); |
110 | ResourceDir *resource = (ResourceDir*)( res ); | 112 | ResourceDir *resource = (ResourceDir*)( res ); |
111 | 113 | ||
112 | if ( !resource ) { | 114 | if ( !resource ) { |
113 | kdDebug(5700) << "ResourceDirConfig::loadSettings(): cast failed" << endl; | 115 | kdDebug(5700) << "ResourceDirConfig::loadSettings(): cast failed" << endl; |
114 | return; | 116 | return; |
115 | } | 117 | } |
116 | 118 | ||
117 | if ( mInEditMode ) | 119 | if ( mInEditMode ) |
118 | resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] ); | 120 | resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] ); |
119 | 121 | ||
120 | resource->setPath( mFileNameEdit->url() ); | 122 | resource->setPath( mFileNameEdit->url() ); |
121 | } | 123 | } |
122 | 124 | ||
123 | //US #include "resourcedirconfig.moc" | 125 | //US #include "resourcedirconfig.moc" |
diff --git a/kabc/plugins/file/file.pro b/kabc/plugins/file/file.pro index 2d17313..e4f1270 100644 --- a/kabc/plugins/file/file.pro +++ b/kabc/plugins/file/file.pro | |||
@@ -1,37 +1,41 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | include( ../../../variables.pri ) | 5 | include( ../../../variables.pri ) |
6 | 6 | ||
7 | TARGET = microkabc_file | 7 | TARGET = xmicrokabc_file |
8 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat | 8 | INCLUDEPATH += ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat |
9 | 9 | ||
10 | DESTDIR = ../../../bin | 10 | DESTDIR = ../../../bin |
11 | #LIBS += -lmicrokde -lmicrokabc | 11 | #LIBS += -lxmicrokde -lxmicrokabc |
12 | #LIBS += -L$(QPEDIR)/lib | 12 | #LIBS += -L$(QPEDIR)/lib |
13 | 13 | ||
14 | INTERFACES = \ | 14 | INTERFACES = \ |
15 | 15 | ||
16 | HEADERS = \ | 16 | HEADERS = \ |
17 | resourcefile.h \ | 17 | resourcefile.h \ |
18 | resourcefileconfig.h | 18 | resourcefileconfig.h |
19 | 19 | ||
20 | SOURCES = \ | 20 | SOURCES = \ |
21 | resourcefile.cpp \ | 21 | resourcefile.cpp \ |
22 | resourcefileconfig.cpp | 22 | resourcefileconfig.cpp |
23 | 23 | ||
24 | unix : { | 24 | unix : { |
25 | OBJECTS_DIR = obj/unix | 25 | OBJECTS_DIR = obj/unix |
26 | MOC_DIR = moc/unix | 26 | MOC_DIR = moc/unix |
27 | } | 27 | } |
28 | win32: { | 28 | win32: { |
29 | CONFIG += dll | 29 | CONFIG += dll |
30 | DEFINES += _WIN32_ | 30 | DEFINES += _WIN32_ |
31 | OBJECTS_DIR = obj/win | 31 | OBJECTS_DIR = obj/win |
32 | MOC_DIR = moc/win | 32 | MOC_DIR = moc/win |
33 | LIBS += ../../../bin/microkdepim.lib | 33 | LIBS += ../../../bin/xmicrokdepim.lib |
34 | LIBS += ../../../bin/microkcal.lib | 34 | LIBS += ../../../bin/xmicrokcal.lib |
35 | LIBS += ../../../bin/microkde.lib | 35 | LIBS += ../../../bin/xmicrokde.lib |
36 | LIBS += ../../../bin/microkabc.lib | 36 | LIBS += ../../../bin/microkabc.lib |
37 | } | 37 | } |
38 | #The following line was inserted by qt3to4 | ||
39 | QT += qt3support | ||
40 | #The following line was inserted by qt3to4 | ||
41 | QT += xml | ||
diff --git a/kabc/plugins/file/fileE.pro b/kabc/plugins/file/fileE.pro index 16707e5..5044cd9 100644 --- a/kabc/plugins/file/fileE.pro +++ b/kabc/plugins/file/fileE.pro | |||
@@ -1,21 +1,21 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabc_file | 5 | TARGET = xmicrokabc_file |
6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat | 6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat |
7 | OBJECTS_DIR = obj/$(PLATFORM) | 7 | OBJECTS_DIR = obj/$(PLATFORM) |
8 | MOC_DIR = moc/$(PLATFORM) | 8 | MOC_DIR = moc/$(PLATFORM) |
9 | DESTDIR = $(QPEDIR)/lib | 9 | DESTDIR = $(QPEDIR)/lib |
10 | LIBS += -lmicrokde -lmicrokabc | 10 | LIBS += -lxmicrokde -lxmicrokabc |
11 | LIBS += -L$(QPEDIR)/lib | 11 | LIBS += -L$(QPEDIR)/lib |
12 | 12 | ||
13 | INTERFACES = \ | 13 | INTERFACES = \ |
14 | 14 | ||
15 | HEADERS = \ | 15 | HEADERS = \ |
16 | resourcefile.h \ | 16 | resourcefile.h \ |
17 | resourcefileconfig.h | 17 | resourcefileconfig.h |
18 | 18 | ||
19 | SOURCES = \ | 19 | SOURCES = \ |
20 | resourcefile.cpp \ | 20 | resourcefile.cpp \ |
21 | resourcefileconfig.cpp | 21 | resourcefileconfig.cpp |
diff --git a/kabc/plugins/file/resourcefile.cpp b/kabc/plugins/file/resourcefile.cpp index dad4571..3ed850c 100644 --- a/kabc/plugins/file/resourcefile.cpp +++ b/kabc/plugins/file/resourcefile.cpp | |||
@@ -1,485 +1,485 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <sys/types.h> | 28 | #include <sys/types.h> |
29 | #include <sys/stat.h> | 29 | #include <sys/stat.h> |
30 | #ifndef _WIN32_ | 30 | #ifndef _WIN32_ |
31 | #include <unistd.h> | 31 | #include <unistd.h> |
32 | #endif | 32 | #endif |
33 | 33 | ||
34 | #include <qfile.h> | 34 | #include <qfile.h> |
35 | #include <qfileinfo.h> | 35 | #include <qfileinfo.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | #include <qtimer.h> | 37 | #include <qtimer.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | //US #include <ksavefile.h> | 43 | //US #include <ksavefile.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
46 | #include <kglobalsettings.h> | 46 | #include <kglobalsettings.h> |
47 | 47 | ||
48 | #include "formatfactory.h" | 48 | #include "formatfactory.h" |
49 | 49 | ||
50 | #include "resource.h" | 50 | #include "resource.h" |
51 | #include "resourcefileconfig.h" | 51 | #include "resourcefileconfig.h" |
52 | #include "stdaddressbook.h" | 52 | #include "stdaddressbook.h" |
53 | #define NO_DIRWATCH | 53 | #define NO_DIRWATCH |
54 | #include "resourcefile.h" | 54 | #include "resourcefile.h" |
55 | 55 | ||
56 | //#define ALLOW_LOCKING | 56 | //#define ALLOW_LOCKING |
57 | 57 | ||
58 | 58 | ||
59 | using namespace KABC; | 59 | using namespace KABC; |
60 | 60 | ||
61 | extern "C" | 61 | extern "C" |
62 | #ifdef _WIN32_ | 62 | #ifdef _WIN32_ |
63 | __declspec(dllexport) | 63 | __declspec(dllexport) |
64 | #else | 64 | #else |
65 | { | 65 | { |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | //US void *init_kabc_file() | 68 | //US void *init_kabc_file() |
69 | void *init_microkabc_file() | 69 | void *init_microkabc_file() |
70 | { | 70 | { |
71 | return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); | 71 | return new KRES::PluginFactory<ResourceFile,ResourceFileConfig>(); |
72 | } | 72 | } |
73 | #ifndef _WIN32_ | 73 | #ifndef _WIN32_ |
74 | } | 74 | } |
75 | #endif | 75 | #endif |
76 | 76 | ||
77 | ResourceFile::ResourceFile( const KConfig *config ) | 77 | ResourceFile::ResourceFile( const KConfig *config ) |
78 | : Resource( config ) , mFormat( 0 ) | 78 | : Resource( config ) , mFormat( 0 ) |
79 | { | 79 | { |
80 | QString fileName, formatName, default_fileName; | 80 | QString fileName, formatName, default_fileName; |
81 | 81 | ||
82 | default_fileName = StdAddressBook::fileName(); | 82 | default_fileName = StdAddressBook::fileName(); |
83 | mLastBackupDate = -1; | 83 | mLastBackupDate = -1; |
84 | KConfig *cfg = (KConfig *)config; | 84 | KConfig *cfg = (KConfig *)config; |
85 | if ( cfg ) { | 85 | if ( cfg ) { |
86 | #ifdef _WIN32_ | 86 | #ifdef _WIN32_ |
87 | // we use plugins on win32. the group is stored in a static variable | 87 | // we use plugins on win32. the group is stored in a static variable |
88 | // such that group info not available on win32 plugins | 88 | // such that group info not available on win32 plugins |
89 | // to fix that, it would be a looooot of work | 89 | // to fix that, it would be a looooot of work |
90 | if ( !cfg->tempGroup().isEmpty() ) | 90 | if ( !cfg->tempGroup().isEmpty() ) |
91 | cfg->setGroup( cfg->tempGroup() ); | 91 | cfg->setGroup( cfg->tempGroup() ); |
92 | #endif | 92 | #endif |
93 | fileName = cfg->readEntry( "FileName", default_fileName ); | 93 | fileName = cfg->readEntry( "FileName", default_fileName ); |
94 | formatName = cfg->readEntry( "FileFormat", "vcard" ); | 94 | formatName = cfg->readEntry( "FileFormat", "vcard" ); |
95 | mFamily = cfg->readEntry( "ResourceName", "std" ); | 95 | mFamily = cfg->readEntry( "ResourceName", "std" ); |
96 | mLastBackupDate = cfg->readNumEntry( "LastBackupDate", 0 ); | 96 | mLastBackupDate = cfg->readNumEntry( "LastBackupDate", 0 ); |
97 | } else { | 97 | } else { |
98 | fileName = default_fileName; | 98 | fileName = default_fileName; |
99 | formatName = "vcard"; | 99 | formatName = "vcard"; |
100 | } | 100 | } |
101 | 101 | ||
102 | init( fileName, formatName ); | 102 | init( fileName, formatName ); |
103 | } | 103 | } |
104 | 104 | ||
105 | ResourceFile::ResourceFile( const QString &fileName , | 105 | ResourceFile::ResourceFile( const QString &fileName , |
106 | const QString &formatName ) | 106 | const QString &formatName ) |
107 | : Resource( 0 ) | 107 | : Resource( 0 ) |
108 | { | 108 | { |
109 | // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); | 109 | // qDebug("ResourceFile::ResourceFile : 3 %s, %s", fileName.latin1(), formatName.latin1()); |
110 | 110 | ||
111 | 111 | ||
112 | mLastBackupDate = -1; | 112 | mLastBackupDate = -1; |
113 | init( fileName, formatName ); | 113 | init( fileName, formatName ); |
114 | } | 114 | } |
115 | 115 | ||
116 | void ResourceFile::init( const QString &fileName, const QString &formatName ) | 116 | void ResourceFile::init( const QString &fileName, const QString &formatName ) |
117 | { | 117 | { |
118 | mFormatName = formatName; | 118 | mFormatName = formatName; |
119 | 119 | ||
120 | FormatFactory *factory = FormatFactory::self(); | 120 | FormatFactory *factory = FormatFactory::self(); |
121 | mFormat = factory->format( mFormatName ); | 121 | mFormat = factory->format( mFormatName ); |
122 | 122 | ||
123 | if ( !mFormat ) { | 123 | if ( !mFormat ) { |
124 | mFormatName = "vcard"; | 124 | mFormatName = "vcard"; |
125 | mFormat = factory->format( mFormatName ); | 125 | mFormat = factory->format( mFormatName ); |
126 | } | 126 | } |
127 | 127 | ||
128 | #ifndef NO_DIRWATCH | 128 | #ifndef NO_DIRWATCH |
129 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 129 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
130 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 130 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
131 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 131 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
132 | #endif | 132 | #endif |
133 | 133 | ||
134 | QString localKdeDir; | 134 | QString localKdeDir; |
135 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); | 135 | localKdeDir = readEnvPath("LOCALMICROKDEHOME"); |
136 | if ( ! localKdeDir.isEmpty() ) { | 136 | if ( ! localKdeDir.isEmpty() ) { |
137 | qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() ); | 137 | qDebug("LOCALMICROKDEHOME is set to: %s",localKdeDir.latin1() ); |
138 | QFileInfo fi ( fileName ); | 138 | QFileInfo fi ( fileName ); |
139 | QString localname = localKdeDir + "/apps/kabc/" + fi.fileName (); | 139 | QString localname = localKdeDir + "/apps/kabc/" + fi.fileName (); |
140 | QFileInfo fi2 ( localname ); | 140 | QFileInfo fi2 ( localname ); |
141 | if ( ! fi2.exists() || mFamily == "sync_res" ) { | 141 | if ( ! fi2.exists() || mFamily == "sync_res" ) { |
142 | if ( fi.exists() && mFamily == "sync_res") { | 142 | if ( fi.exists() && mFamily == "sync_res") { |
143 | qDebug("LOCAL mode SYNC mode using absolute file path "); | 143 | qDebug("LOCAL mode SYNC mode using absolute file path "); |
144 | setFileName( fileName ); | 144 | setFileName( fileName ); |
145 | return; | 145 | return; |
146 | } else { | 146 | } else { |
147 | KMessageBox::error(0,i18n("Addressbook resource file not found:\n '%1'.\nIn LOCAL mode only resource files in\n'%2'\nare supported.\n(i.e. in the dir ./apps/kabc/ relative to the kapi(.exe) binary.)\n\nIf you are starting KA/Pi for the very first time\nyou will get this error message as well.\nIt will create the missing file automatically for you.").arg(localname).arg(localKdeDir+"/apps/kabc/") ); | 147 | KMessageBox::error(0,i18n("Addressbook resource file not found:\n '%1'.\nIn LOCAL mode only resource files in\n'%2'\nare supported.\n(i.e. in the dir ./apps/kabc/ relative to the kapi(.exe) binary.)\n\nIf you are starting KA/Pi for the very first time\nyou will get this error message as well.\nIt will create the missing file automatically for you.").arg(localname).arg(localKdeDir+"/apps/kabc/") ); |
148 | setFileName( localname ); | 148 | setFileName( localname ); |
149 | return; | 149 | return; |
150 | } | 150 | } |
151 | 151 | ||
152 | } else { | 152 | } else { |
153 | qDebug("Local resource file found. Changing filename to: %s",localname.latin1() ); | 153 | qDebug("Local resource file found. Changing filename to: %s",localname.latin1() ); |
154 | setFileName( localname ); | 154 | setFileName( localname ); |
155 | return; | 155 | return; |
156 | } | 156 | } |
157 | 157 | ||
158 | } | 158 | } |
159 | setFileName( fileName ); | 159 | setFileName( fileName ); |
160 | } | 160 | } |
161 | 161 | ||
162 | ResourceFile::~ResourceFile() | 162 | ResourceFile::~ResourceFile() |
163 | { | 163 | { |
164 | delete mFormat; | 164 | delete mFormat; |
165 | mFormat = 0; | 165 | mFormat = 0; |
166 | } | 166 | } |
167 | 167 | ||
168 | void ResourceFile::writeConfig( KConfig *config ) | 168 | void ResourceFile::writeConfig( KConfig *config ) |
169 | { | 169 | { |
170 | 170 | ||
171 | config->setGroup( "Resource_" + identifier() ); | 171 | config->setGroup( "Resource_" + identifier() ); |
172 | Resource::writeConfig( config ); | 172 | Resource::writeConfig( config ); |
173 | 173 | ||
174 | config->writeEntry( "FileName", fileName() ); | 174 | config->writeEntry( "FileName", fileName() ); |
175 | config->writeEntry( "FileFormat", mFormatName ); | 175 | config->writeEntry( "FileFormat", mFormatName ); |
176 | 176 | ||
177 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 177 | // qDebug("ResourceFile::writeConfig format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
178 | 178 | ||
179 | } | 179 | } |
180 | 180 | ||
181 | Ticket *ResourceFile::requestSaveTicket() | 181 | Ticket *ResourceFile::requestSaveTicket() |
182 | { | 182 | { |
183 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; | 183 | kdDebug(5700) << "ResourceFile::requestSaveTicket()" << endl; |
184 | 184 | ||
185 | if ( !addressBook() ) return 0; | 185 | if ( !addressBook() ) return 0; |
186 | 186 | ||
187 | #ifdef ALLOW_LOCKING | 187 | #ifdef ALLOW_LOCKING |
188 | if ( !lock( mFileName ) ) { | 188 | if ( !lock( mFileName ) ) { |
189 | qDebug("unablt to lock file "); | 189 | qDebug("unablt to lock file "); |
190 | return 0; | 190 | return 0; |
191 | } | 191 | } |
192 | #endif | 192 | #endif |
193 | return createTicket( this ); | 193 | return createTicket( this ); |
194 | } | 194 | } |
195 | 195 | ||
196 | 196 | ||
197 | bool ResourceFile::doOpen() | 197 | bool ResourceFile::doOpen() |
198 | { | 198 | { |
199 | QFile file( fileName() ); | 199 | QFile file( fileName() ); |
200 | qDebug("ResourceFile::openfile %s ", fileName().latin1()); | 200 | qDebug("ResourceFile::openfile %s ", fileName().latin1()); |
201 | 201 | ||
202 | if ( !file.exists() ) { | 202 | if ( !file.exists() ) { |
203 | // try to create the file | 203 | // try to create the file |
204 | bool ok = file.open( IO_WriteOnly ); | 204 | bool ok = file.open( QIODevice::WriteOnly ); |
205 | if ( ok ) | 205 | if ( ok ) |
206 | file.close(); | 206 | file.close(); |
207 | 207 | ||
208 | return ok; | 208 | return ok; |
209 | } else { | 209 | } else { |
210 | if ( !file.open( IO_ReadWrite ) ) | 210 | if ( !file.open( QIODevice::ReadWrite ) ) |
211 | return false; | 211 | return false; |
212 | 212 | ||
213 | if ( file.size() < 10 ) { | 213 | if ( file.size() < 10 ) { |
214 | file.close(); | 214 | file.close(); |
215 | return true; | 215 | return true; |
216 | } | 216 | } |
217 | 217 | ||
218 | bool ok = mFormat->checkFormat( &file ); | 218 | bool ok = mFormat->checkFormat( &file ); |
219 | file.close(); | 219 | file.close(); |
220 | 220 | ||
221 | return ok; | 221 | return ok; |
222 | } | 222 | } |
223 | } | 223 | } |
224 | 224 | ||
225 | void ResourceFile::doClose() | 225 | void ResourceFile::doClose() |
226 | { | 226 | { |
227 | } | 227 | } |
228 | 228 | ||
229 | bool ResourceFile::load() | 229 | bool ResourceFile::load() |
230 | { | 230 | { |
231 | 231 | ||
232 | QFile file( fileName() ); | 232 | QFile file( fileName() ); |
233 | if ( !file.open( IO_ReadOnly ) ) { | 233 | if ( !file.open( QIODevice::ReadOnly ) ) { |
234 | addressBook()->error( i18n( "Unable to open file '%1'." ).arg( fileName() ) ); | 234 | addressBook()->error( i18n( "Unable to open file '%1'." ).arg( fileName() ) ); |
235 | return false; | 235 | return false; |
236 | } | 236 | } |
237 | 237 | ||
238 | // qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 238 | // qDebug("ResourceFile::load format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
239 | 239 | ||
240 | return mFormat->loadAll( addressBook(), this, &file ); | 240 | return mFormat->loadAll( addressBook(), this, &file ); |
241 | } | 241 | } |
242 | 242 | ||
243 | bool ResourceFile::save( Ticket *ticket ) | 243 | bool ResourceFile::save( Ticket *ticket ) |
244 | { | 244 | { |
245 | // qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1()); | 245 | // qDebug("ResourceFile::save format %s, %s", mFileName.latin1(), mFormatName.latin1()); |
246 | 246 | ||
247 | 247 | ||
248 | // create backup file | 248 | // create backup file |
249 | QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); | 249 | QString extension = "_" + QString::number( QDate::currentDate().dayOfWeek() ); |
250 | 250 | ||
251 | /*US we use a simpler method to create a backupfile | 251 | /*US we use a simpler method to create a backupfile |
252 | 252 | ||
253 | (void) KSaveFile::backupFile( mFileName, QString::null | 253 | (void) KSaveFile::backupFile( mFileName, QString::null |
254 | ,extension ); | 254 | ,extension ); |
255 | 255 | ||
256 | KSaveFile saveFile( mFileName ); | 256 | KSaveFile saveFile( mFileName ); |
257 | bool ok = false; | 257 | bool ok = false; |
258 | if ( saveFile.status() == 0 && saveFile.file() ) | 258 | if ( saveFile.status() == 0 && saveFile.file() ) |
259 | { | 259 | { |
260 | mFormat->saveAll( addressBook(), this, saveFile.file() ); | 260 | mFormat->saveAll( addressBook(), this, saveFile.file() ); |
261 | ok = saveFile.close(); | 261 | ok = saveFile.close(); |
262 | } | 262 | } |
263 | */ | 263 | */ |
264 | 264 | ||
265 | //US ToDo: write backupfile | 265 | //US ToDo: write backupfile |
266 | #ifndef NO_DIRWATCH | 266 | #ifndef NO_DIRWATCH |
267 | mDirWatch.stopScan(); | 267 | mDirWatch.stopScan(); |
268 | #endif | 268 | #endif |
269 | if ( mLastBackupDate >= 0 && mFamily != "sync_res") { | 269 | if ( mLastBackupDate >= 0 && mFamily != "sync_res") { |
270 | KConfig conf (locateLocal("config","microkdeglobalrc")); | 270 | KConfig conf (locateLocal("config","microkdeglobalrc")); |
271 | conf.setGroup( "BackupSettings" ); | 271 | conf.setGroup( "BackupSettings" ); |
272 | bool b_enabled = conf.readBoolEntry( "BackupEnabled" ); | 272 | bool b_enabled = conf.readBoolEntry( "BackupEnabled" ); |
273 | if ( b_enabled ) { | 273 | if ( b_enabled ) { |
274 | int num = conf.readNumEntry( "BackupNumbers" ); | 274 | int num = conf.readNumEntry( "BackupNumbers" ); |
275 | int d_count = conf.readNumEntry( "BackupDayCount" ); | 275 | int d_count = conf.readNumEntry( "BackupDayCount" ); |
276 | bool stdDir = conf.readBoolEntry( "BackupUseDefaultDir" ); | 276 | bool stdDir = conf.readBoolEntry( "BackupUseDefaultDir" ); |
277 | QString bupDir = conf.readEntry( "BackupDatadir" ); | 277 | QString bupDir = conf.readEntry( "BackupDatadir" ); |
278 | QDate reference ( 2000,1,1 ); | 278 | QDate reference ( 2000,1,1 ); |
279 | int daysTo = reference.daysTo ( QDate::currentDate() ); | 279 | int daysTo = reference.daysTo ( QDate::currentDate() ); |
280 | bool saveDate = false; | 280 | bool saveDate = false; |
281 | if ( daysTo - d_count >= mLastBackupDate ) { | 281 | if ( daysTo - d_count >= mLastBackupDate ) { |
282 | qDebug("KA: Last backup was %d days ago ", daysTo - mLastBackupDate ); | 282 | qDebug("KA: Last backup was %d days ago ", daysTo - mLastBackupDate ); |
283 | if ( stdDir ) | 283 | if ( stdDir ) |
284 | bupDir = KGlobalSettings::backupDataDir(); | 284 | bupDir = KGlobalSettings::backupDataDir(); |
285 | int retval = KApplication::createBackup( fileName(), bupDir, num ); | 285 | int retval = KApplication::createBackup( fileName(), bupDir, num ); |
286 | if ( retval == 0 ) { | 286 | if ( retval == 0 ) { |
287 | qDebug("KO: Backup cancelled. Will try again tomorrow "); | 287 | qDebug("KO: Backup cancelled. Will try again tomorrow "); |
288 | // retval == 0 : backup skipped for today, try again tomorrow | 288 | // retval == 0 : backup skipped for today, try again tomorrow |
289 | mLastBackupDate = daysTo - d_count+1; | 289 | mLastBackupDate = daysTo - d_count+1; |
290 | saveDate = true; | 290 | saveDate = true; |
291 | } else if ( retval == 1 ){ | 291 | } else if ( retval == 1 ){ |
292 | qDebug("KO: Backup created."); | 292 | qDebug("KO: Backup created."); |
293 | // backup ok | 293 | // backup ok |
294 | mLastBackupDate = daysTo; | 294 | mLastBackupDate = daysTo; |
295 | saveDate = true; | 295 | saveDate = true; |
296 | } else if ( retval == 2 ){ | 296 | } else if ( retval == 2 ){ |
297 | qDebug("KO: Backup globally cancelled."); | 297 | qDebug("KO: Backup globally cancelled."); |
298 | // backup globally cancelled | 298 | // backup globally cancelled |
299 | b_enabled = false; | 299 | b_enabled = false; |
300 | } | 300 | } |
301 | if ( !b_enabled ) { | 301 | if ( !b_enabled ) { |
302 | conf.writeEntry( "mBackupEnabled", false ); | 302 | conf.writeEntry( "mBackupEnabled", false ); |
303 | } | 303 | } |
304 | if ( saveDate ) { | 304 | if ( saveDate ) { |
305 | KConfig config ( locateLocal("config","kabcrc") ); | 305 | KConfig config ( locateLocal("config","kabcrc") ); |
306 | config.setGroup( "Resource_" + identifier() ); | 306 | config.setGroup( "Resource_" + identifier() ); |
307 | config.writeEntry( "LastBackupDate", mLastBackupDate ); | 307 | config.writeEntry( "LastBackupDate", mLastBackupDate ); |
308 | } | 308 | } |
309 | } | 309 | } |
310 | } | 310 | } |
311 | } | 311 | } |
312 | QFile info; | 312 | QFile info; |
313 | info.setName( fileName() ); | 313 | info.setName( fileName() ); |
314 | bool ok = info.open( IO_WriteOnly ); | 314 | bool ok = info.open( QIODevice::WriteOnly ); |
315 | if ( ok ) { | 315 | if ( ok ) { |
316 | mFormat->saveAll( addressBook(), this, &info ); | 316 | mFormat->saveAll( addressBook(), this, &info ); |
317 | 317 | ||
318 | info.close(); | 318 | info.close(); |
319 | ok = true; | 319 | ok = true; |
320 | } | 320 | } |
321 | else { | 321 | else { |
322 | 322 | ||
323 | } | 323 | } |
324 | 324 | ||
325 | if ( !ok ) | 325 | if ( !ok ) |
326 | addressBook()->error( i18n( "Unable to save file '%1'." ).arg( fileName() ) ); | 326 | addressBook()->error( i18n( "Unable to save file '%1'." ).arg( fileName() ) ); |
327 | #ifndef NO_DIRWATCH | 327 | #ifndef NO_DIRWATCH |
328 | mDirWatch.startScan(); | 328 | mDirWatch.startScan(); |
329 | #endif | 329 | #endif |
330 | delete ticket; | 330 | delete ticket; |
331 | #ifdef ALLOW_LOCKING | 331 | #ifdef ALLOW_LOCKING |
332 | unlock( mFileName ); | 332 | unlock( mFileName ); |
333 | #endif | 333 | #endif |
334 | 334 | ||
335 | return ok; | 335 | return ok; |
336 | } | 336 | } |
337 | 337 | ||
338 | bool ResourceFile::lock( const QString &fileName ) | 338 | bool ResourceFile::lock( const QString &fileName ) |
339 | { | 339 | { |
340 | #ifdef ALLOW_LOCKING | 340 | #ifdef ALLOW_LOCKING |
341 | 341 | ||
342 | 342 | ||
343 | QString fn = fileName; | 343 | QString fn = fileName; |
344 | 344 | ||
345 | //US change the implementation how the lockfilename is getting created | 345 | //US change the implementation how the lockfilename is getting created |
346 | //US fn.replace( QRegExp("/"), "_" ); | 346 | //US fn.replace( QRegExp("/"), "_" ); |
347 | //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); | 347 | //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); |
348 | 348 | ||
349 | KURL url(fn); | 349 | KURL url(fn); |
350 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 350 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
351 | 351 | ||
352 | 352 | ||
353 | 353 | ||
354 | if (QFile::exists( lockName )) return false; | 354 | if (QFile::exists( lockName )) return false; |
355 | 355 | ||
356 | QString lockUniqueName; | 356 | QString lockUniqueName; |
357 | lockUniqueName = fn + KApplication::randomString( 8 ); | 357 | lockUniqueName = fn + KApplication::randomString( 8 ); |
358 | 358 | ||
359 | url = lockUniqueName; | 359 | url = lockUniqueName; |
360 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); | 360 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); |
361 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 361 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
362 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; | 362 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; |
363 | 363 | ||
364 | // Create unique file | 364 | // Create unique file |
365 | QFile file( mLockUniqueName ); | 365 | QFile file( mLockUniqueName ); |
366 | file.open( IO_WriteOnly ); | 366 | file.open( QIODevice::WriteOnly ); |
367 | file.close(); | 367 | file.close(); |
368 | 368 | ||
369 | // Create lock file | 369 | // Create lock file |
370 | int result = 0; | 370 | int result = 0; |
371 | #ifndef _WIN32_ | 371 | #ifndef _WIN32_ |
372 | result = ::link( QFile::encodeName( mLockUniqueName ), | 372 | result = ::link( QFile::encodeName( mLockUniqueName ), |
373 | QFile::encodeName( lockName ) ); | 373 | QFile::encodeName( lockName ) ); |
374 | #endif | 374 | #endif |
375 | if ( result == 0 ) { | 375 | if ( result == 0 ) { |
376 | addressBook()->emitAddressBookLocked(); | 376 | addressBook()->emitAddressBookLocked(); |
377 | return true; | 377 | return true; |
378 | } | 378 | } |
379 | 379 | ||
380 | // TODO: check stat | 380 | // TODO: check stat |
381 | 381 | ||
382 | return false; | 382 | return false; |
383 | #else | 383 | #else |
384 | return true; | 384 | return true; |
385 | #endif | 385 | #endif |
386 | } | 386 | } |
387 | 387 | ||
388 | void ResourceFile::unlock( const QString &fileName ) | 388 | void ResourceFile::unlock( const QString &fileName ) |
389 | { | 389 | { |
390 | #ifdef ALLOW_LOCKING | 390 | #ifdef ALLOW_LOCKING |
391 | QString fn = fileName; | 391 | QString fn = fileName; |
392 | //US change the implementation how the lockfilename is getting created | 392 | //US change the implementation how the lockfilename is getting created |
393 | //US fn.replace( QRegExp( "/" ), "_" ); | 393 | //US fn.replace( QRegExp( "/" ), "_" ); |
394 | //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); | 394 | //US QString lockName = locateLocal( "data", "kabc/lock/" + fn + ".lock" ); |
395 | //US QString lockName = fn + ".lock"; | 395 | //US QString lockName = fn + ".lock"; |
396 | KURL url(fn); | 396 | KURL url(fn); |
397 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 397 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
398 | 398 | ||
399 | QFile::remove( lockName ); | 399 | QFile::remove( lockName ); |
400 | QFile::remove( mLockUniqueName ); | 400 | QFile::remove( mLockUniqueName ); |
401 | addressBook()->emitAddressBookUnlocked(); | 401 | addressBook()->emitAddressBookUnlocked(); |
402 | #else | 402 | #else |
403 | return; | 403 | return; |
404 | #endif | 404 | #endif |
405 | } | 405 | } |
406 | 406 | ||
407 | void ResourceFile::setFileName( const QString &fileName ) | 407 | void ResourceFile::setFileName( const QString &fileName ) |
408 | { | 408 | { |
409 | #ifndef NO_DIRWATCH | 409 | #ifndef NO_DIRWATCH |
410 | mDirWatch.stopScan(); | 410 | mDirWatch.stopScan(); |
411 | mDirWatch.removeFile( mFileName ); | 411 | mDirWatch.removeFile( mFileName ); |
412 | mFileName = fileName; | 412 | mFileName = fileName; |
413 | 413 | ||
414 | 414 | ||
415 | mDirWatch.addFile( mFileName ); | 415 | mDirWatch.addFile( mFileName ); |
416 | mDirWatch.startScan(); | 416 | mDirWatch.startScan(); |
417 | #else | 417 | #else |
418 | mFileName2 = fileName; | 418 | mFileName2 = fileName; |
419 | #endif | 419 | #endif |
420 | 420 | ||
421 | //US simulate KDirWatch event | 421 | //US simulate KDirWatch event |
422 | //US fileChanged(); | 422 | //US fileChanged(); |
423 | } | 423 | } |
424 | 424 | ||
425 | QString ResourceFile::fileName() const | 425 | QString ResourceFile::fileName() const |
426 | { | 426 | { |
427 | return mFileName2; | 427 | return mFileName2; |
428 | } | 428 | } |
429 | 429 | ||
430 | void ResourceFile::setFormat( const QString &format ) | 430 | void ResourceFile::setFormat( const QString &format ) |
431 | { | 431 | { |
432 | mFormatName = format; | 432 | mFormatName = format; |
433 | delete mFormat; | 433 | delete mFormat; |
434 | 434 | ||
435 | FormatFactory *factory = FormatFactory::self(); | 435 | FormatFactory *factory = FormatFactory::self(); |
436 | mFormat = factory->format( mFormatName ); | 436 | mFormat = factory->format( mFormatName ); |
437 | /*US | 437 | /*US |
438 | //qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1()); | 438 | //qDebug("ResourceFile::setFormat initialized with format %s ", format.latin1()); |
439 | if (mFormatName == "vcard") { | 439 | if (mFormatName == "vcard") { |
440 | mFormat = new VCardFormatPlugin2(); | 440 | mFormat = new VCardFormatPlugin2(); |
441 | // qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); | 441 | // qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); |
442 | } | 442 | } |
443 | else if (mFormatName == "binary") { | 443 | else if (mFormatName == "binary") { |
444 | mFormat = new BinaryFormat(); | 444 | mFormat = new BinaryFormat(); |
445 | // qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); | 445 | // qDebug("ResourceFile::setFormat format %s", mFormatName.latin1()); |
446 | } | 446 | } |
447 | else | 447 | else |
448 | qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1()); | 448 | qDebug("ResourceFile::setFormat format unknown !!! %s ", format.latin1()); |
449 | */ | 449 | */ |
450 | 450 | ||
451 | } | 451 | } |
452 | 452 | ||
453 | QString ResourceFile::format() const | 453 | QString ResourceFile::format() const |
454 | { | 454 | { |
455 | return mFormatName; | 455 | return mFormatName; |
456 | } | 456 | } |
457 | 457 | ||
458 | void ResourceFile::fileChanged() | 458 | void ResourceFile::fileChanged() |
459 | { | 459 | { |
460 | // There is a small theoretical chance that KDirWatch calls us before | 460 | // There is a small theoretical chance that KDirWatch calls us before |
461 | // we are fully constructed | 461 | // we are fully constructed |
462 | if (!addressBook()) | 462 | if (!addressBook()) |
463 | return; | 463 | return; |
464 | 464 | ||
465 | 465 | ||
466 | QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) ); | 466 | QString text( i18n( "File resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) ); |
467 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { | 467 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { |
468 | load(); | 468 | load(); |
469 | addressBook()->emitAddressBookChanged(); | 469 | addressBook()->emitAddressBookChanged(); |
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | void ResourceFile::removeAddressee( const Addressee &addr ) | 473 | void ResourceFile::removeAddressee( const Addressee &addr ) |
474 | { | 474 | { |
475 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); | 475 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/photos/" ) + addr.uid() ) ); |
476 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) ); | 476 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/logos/" ) + addr.uid() ) ); |
477 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) ); | 477 | QFile::remove( QFile::encodeName( locateLocal( "data", "kabc/sounds/" ) + addr.uid() ) ); |
478 | } | 478 | } |
479 | 479 | ||
480 | void ResourceFile::cleanUp() | 480 | void ResourceFile::cleanUp() |
481 | { | 481 | { |
482 | unlock( fileName() ); | 482 | unlock( fileName() ); |
483 | } | 483 | } |
484 | 484 | ||
485 | //US #include "resourcefile.moc" | 485 | //US #include "resourcefile.moc" |
diff --git a/kabc/plugins/file/resourcefileconfig.cpp b/kabc/plugins/file/resourcefileconfig.cpp index b63775d..70b0bac 100644 --- a/kabc/plugins/file/resourcefileconfig.cpp +++ b/kabc/plugins/file/resourcefileconfig.cpp | |||
@@ -1,144 +1,146 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | #include <qfileinfo.h> | 30 | #include <qfileinfo.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3GridLayout> | ||
31 | 33 | ||
32 | #include <kdebug.h> | 34 | #include <kdebug.h> |
33 | #include <klocale.h> | 35 | #include <klocale.h> |
34 | #include <kstandarddirs.h> | 36 | #include <kstandarddirs.h> |
35 | #include <kdialog.h> | 37 | #include <kdialog.h> |
36 | #ifndef _WIN32_ | 38 | #ifndef _WIN32_ |
37 | #include <unistd.h> | 39 | #include <unistd.h> |
38 | #endif | 40 | #endif |
39 | //US #include "formatfactory.h" | 41 | //US #include "formatfactory.h" |
40 | #include <qfile.h> | 42 | #include <qfile.h> |
41 | #include "resourcefile.h" | 43 | #include "resourcefile.h" |
42 | #include "stdaddressbook.h" | 44 | #include "stdaddressbook.h" |
43 | 45 | ||
44 | #include "resourcefileconfig.h" | 46 | #include "resourcefileconfig.h" |
45 | 47 | ||
46 | using namespace KABC; | 48 | using namespace KABC; |
47 | 49 | ||
48 | ResourceFileConfig::ResourceFileConfig( QWidget* parent, const char* name ) | 50 | ResourceFileConfig::ResourceFileConfig( QWidget* parent, const char* name ) |
49 | : ConfigWidget( parent, name ) | 51 | : ConfigWidget( parent, name ) |
50 | { | 52 | { |
51 | //qDebug("ResourceFileConfig::ResourceFileConfig"); | 53 | //qDebug("ResourceFileConfig::ResourceFileConfig"); |
52 | 54 | ||
53 | QGridLayout *mainLayout = new QGridLayout( this, 2, 2, 0, | 55 | Q3GridLayout *mainLayout = new Q3GridLayout( this, 2, 2, 0, |
54 | KDialog::spacingHint() ); | 56 | KDialog::spacingHint() ); |
55 | 57 | ||
56 | QLabel *label = new QLabel( i18n( "Format:" ), this ); | 58 | QLabel *label = new QLabel( i18n( "Format:" ), this ); |
57 | mFormatBox = new KComboBox( this ); | 59 | mFormatBox = new KComboBox( this ); |
58 | 60 | ||
59 | mainLayout->addWidget( label, 0, 0 ); | 61 | mainLayout->addWidget( label, 0, 0 ); |
60 | mainLayout->addWidget( mFormatBox, 0, 1 ); | 62 | mainLayout->addWidget( mFormatBox, 0, 1 ); |
61 | 63 | ||
62 | label = new QLabel( i18n( "Location:" ), this ); | 64 | label = new QLabel( i18n( "Location:" ), this ); |
63 | mFileNameEdit = new KURLRequester( this ); | 65 | mFileNameEdit = new KURLRequester( this ); |
64 | 66 | ||
65 | connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), | 67 | connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), |
66 | SLOT( checkFilePermissions( const QString & ) ) ); | 68 | SLOT( checkFilePermissions( const QString & ) ) ); |
67 | 69 | ||
68 | mainLayout->addWidget( label, 1, 0 ); | 70 | mainLayout->addWidget( label, 1, 0 ); |
69 | mainLayout->addWidget( mFileNameEdit, 1, 1 ); | 71 | mainLayout->addWidget( mFileNameEdit, 1, 1 ); |
70 | 72 | ||
71 | 73 | ||
72 | /*US lets hardcode the formats instead of using a factory | 74 | /*US lets hardcode the formats instead of using a factory |
73 | FormatFactory *factory = FormatFactory::self(); | 75 | FormatFactory *factory = FormatFactory::self(); |
74 | QStringList formats = factory->formats(); | 76 | QStringList formats = factory->formats(); |
75 | QStringList::Iterator it; | 77 | QStringList::Iterator it; |
76 | 78 | ||
77 | for ( it = formats.begin(); it != formats.end(); ++it ) { | 79 | for ( it = formats.begin(); it != formats.end(); ++it ) { |
78 | FormatInfo *info = factory->info( *it ); | 80 | FormatInfo *info = factory->info( *it ); |
79 | if ( info ) { | 81 | if ( info ) { |
80 | mFormatTypes << (*it); | 82 | mFormatTypes << (*it); |
81 | mFormatBox->insertItem( info->nameLabel ); | 83 | mFormatBox->insertItem( info->nameLabel ); |
82 | } | 84 | } |
83 | } | 85 | } |
84 | */ | 86 | */ |
85 | mFormatTypes << "vcard"; | 87 | mFormatTypes << "vcard"; |
86 | mFormatTypes << "binary"; | 88 | mFormatTypes << "binary"; |
87 | mFormatBox->insertItem( "vcard" ); | 89 | mFormatBox->insertItem( "vcard" ); |
88 | mFormatBox->insertItem( "binary" ); | 90 | mFormatBox->insertItem( "binary" ); |
89 | 91 | ||
90 | mInEditMode = false; | 92 | mInEditMode = false; |
91 | } | 93 | } |
92 | 94 | ||
93 | void ResourceFileConfig::setEditMode( bool value ) | 95 | void ResourceFileConfig::setEditMode( bool value ) |
94 | { | 96 | { |
95 | mFormatBox->setEnabled( !value ); | 97 | mFormatBox->setEnabled( !value ); |
96 | mInEditMode = value; | 98 | mInEditMode = value; |
97 | } | 99 | } |
98 | 100 | ||
99 | void ResourceFileConfig::loadSettings( KRES::Resource *res ) | 101 | void ResourceFileConfig::loadSettings( KRES::Resource *res ) |
100 | { | 102 | { |
101 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); | 103 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); |
102 | ResourceFile *resource = (ResourceFile*)( res ); | 104 | ResourceFile *resource = (ResourceFile*)( res ); |
103 | 105 | ||
104 | if ( !resource ) { | 106 | if ( !resource ) { |
105 | kdDebug(5700) << "ResourceFileConfig::loadSettings(): cast failed" << endl; | 107 | kdDebug(5700) << "ResourceFileConfig::loadSettings(): cast failed" << endl; |
106 | return; | 108 | return; |
107 | } | 109 | } |
108 | 110 | ||
109 | mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) ); | 111 | mFormatBox->setCurrentItem( mFormatTypes.findIndex( resource->format() ) ); |
110 | 112 | ||
111 | mFileNameEdit->setURL( resource->fileName() ); | 113 | mFileNameEdit->setURL( resource->fileName() ); |
112 | if ( mFileNameEdit->url().isEmpty() ) | 114 | if ( mFileNameEdit->url().isEmpty() ) |
113 | mFileNameEdit->setURL( KABC::StdAddressBook::fileName() ); | 115 | mFileNameEdit->setURL( KABC::StdAddressBook::fileName() ); |
114 | } | 116 | } |
115 | 117 | ||
116 | void ResourceFileConfig::saveSettings( KRES::Resource *res ) | 118 | void ResourceFileConfig::saveSettings( KRES::Resource *res ) |
117 | { | 119 | { |
118 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); | 120 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); |
119 | ResourceFile *resource = (ResourceFile*)( res ); | 121 | ResourceFile *resource = (ResourceFile*)( res ); |
120 | 122 | ||
121 | if ( !resource ) { | 123 | if ( !resource ) { |
122 | kdDebug(5700) << "ResourceFileConfig::saveSettings(): cast failed" << endl; | 124 | kdDebug(5700) << "ResourceFileConfig::saveSettings(): cast failed" << endl; |
123 | return; | 125 | return; |
124 | } | 126 | } |
125 | 127 | ||
126 | if ( !mInEditMode ) | 128 | if ( !mInEditMode ) |
127 | resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] ); | 129 | resource->setFormat( mFormatTypes[ mFormatBox->currentItem() ] ); |
128 | 130 | ||
129 | resource->setFileName( mFileNameEdit->url() ); | 131 | resource->setFileName( mFileNameEdit->url() ); |
130 | } | 132 | } |
131 | void ResourceFileConfig::checkFilePermissions( const QString& fileName ) | 133 | void ResourceFileConfig::checkFilePermissions( const QString& fileName ) |
132 | { | 134 | { |
133 | // If file exist but is not writeable... | 135 | // If file exist but is not writeable... |
134 | #ifdef _WIN32_ | 136 | #ifdef _WIN32_ |
135 | QFileInfo fi ( QFile::encodeName( fileName ) ); | 137 | QFileInfo fi ( QFile::encodeName( fileName ) ); |
136 | if ( fi.exists() ) | 138 | if ( fi.exists() ) |
137 | emit setReadOnly(!fi.isReadable() ); | 139 | emit setReadOnly(!fi.isReadable() ); |
138 | #else | 140 | #else |
139 | if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) | 141 | if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) |
140 | emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 ); | 142 | emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 ); |
141 | #endif | 143 | #endif |
142 | } | 144 | } |
143 | 145 | ||
144 | //US #include "resourcefileconfig.moc" | 146 | //US #include "resourcefileconfig.moc" |
diff --git a/kabc/plugins/ldap/ldapE.pro b/kabc/plugins/ldap/ldapE.pro index 57b6f84..c56d24d 100644 --- a/kabc/plugins/ldap/ldapE.pro +++ b/kabc/plugins/ldap/ldapE.pro | |||
@@ -1,21 +1,21 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | #release debug | 3 | #release debug |
4 | 4 | ||
5 | TARGET = microkabc_ldap | 5 | TARGET = xmicrokabc_ldap |
6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include | 6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include |
7 | OBJECTS_DIR = obj/$(PLATFORM) | 7 | OBJECTS_DIR = obj/$(PLATFORM) |
8 | MOC_DIR = moc/$(PLATFORM) | 8 | MOC_DIR = moc/$(PLATFORM) |
9 | DESTDIR = $(QPEDIR)/lib | 9 | DESTDIR = $(QPEDIR)/lib |
10 | LIBS += -lmicrokde -lmicrokabc | 10 | LIBS += -lxmicrokde -lxmicrokabc |
11 | LIBS += -L$(QPEDIR)/lib | 11 | LIBS += -L$(QPEDIR)/lib |
12 | 12 | ||
13 | INTERFACES = \ | 13 | INTERFACES = \ |
14 | 14 | ||
15 | HEADERS = \ | 15 | HEADERS = \ |
16 | resourceldap.h \ | 16 | resourceldap.h \ |
17 | resourceldapconfig.h | 17 | resourceldapconfig.h |
18 | 18 | ||
19 | SOURCES = \ | 19 | SOURCES = \ |
20 | resourceldap.cpp \ | 20 | resourceldap.cpp \ |
21 | resourceldapconfig.cpp | 21 | resourceldapconfig.cpp |
diff --git a/kabc/plugins/olaccess/olaccess.pro b/kabc/plugins/olaccess/olaccess.pro index 9b95015..ad7e1ef 100644 --- a/kabc/plugins/olaccess/olaccess.pro +++ b/kabc/plugins/olaccess/olaccess.pro | |||
@@ -1,35 +1,35 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = microkabc_olaccess | 3 | TARGET = xmicrokabc_olaccess |
4 | 4 | ||
5 | include( ../../../variables.pri ) | 5 | include( ../../../variables.pri ) |
6 | 6 | ||
7 | INCLUDEPATH += ../../.. ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat | 7 | INCLUDEPATH += ../../.. ../.. ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources ../../../qtcompat |
8 | 8 | ||
9 | INTERFACES = \ | 9 | INTERFACES = \ |
10 | 10 | ||
11 | DESTDIR = ../../../bin | 11 | DESTDIR = ../../../bin |
12 | HEADERS = \ | 12 | HEADERS = \ |
13 | resourceolaccess.h \ | 13 | resourceolaccess.h \ |
14 | resourceolaccessconfig.h \ | 14 | resourceolaccessconfig.h \ |
15 | olaccessconverter.h | 15 | olaccessconverter.h |
16 | 16 | ||
17 | SOURCES = \ | 17 | SOURCES = \ |
18 | resourceolaccess.cpp \ | 18 | resourceolaccess.cpp \ |
19 | resourceolaccessconfig.cpp \ | 19 | resourceolaccessconfig.cpp \ |
20 | olaccessconverter.cpp | 20 | olaccessconverter.cpp |
21 | 21 | ||
22 | unix : { | 22 | unix : { |
23 | OBJECTS_DIR = obj/unix | 23 | OBJECTS_DIR = obj/unix |
24 | MOC_DIR = moc/unix | 24 | MOC_DIR = moc/unix |
25 | } | 25 | } |
26 | win32: { | 26 | win32: { |
27 | CONFIG += dll | 27 | CONFIG += dll |
28 | DEFINES += _WIN32_ | 28 | DEFINES += _WIN32_ |
29 | OBJECTS_DIR = obj/win | 29 | OBJECTS_DIR = obj/win |
30 | MOC_DIR = moc/win | 30 | MOC_DIR = moc/win |
31 | LIBS += ../../../bin/microkdepim.lib | 31 | LIBS += ../../../bin/xmicrokdepim.lib |
32 | LIBS += ../../../bin/microkcal.lib | 32 | LIBS += ../../../bin/xmicrokcal.lib |
33 | LIBS += ../../../bin/microkde.lib | 33 | LIBS += ../../../bin/xmicrokde.lib |
34 | LIBS += ../../../bin/microkabc.lib | 34 | LIBS += ../../../bin/microkabc.lib |
35 | } | 35 | } |
diff --git a/kabc/plugins/opie/opieE.pro b/kabc/plugins/opie/opieE.pro index b7ecbc0..aa6b8ea 100644 --- a/kabc/plugins/opie/opieE.pro +++ b/kabc/plugins/opie/opieE.pro | |||
@@ -1,31 +1,31 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | #release debug | 3 | #release debug |
4 | TARGET = microkabc_opie | 4 | TARGET = xmicrokabc_opie |
5 | 5 | ||
6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include $(OPIEDIR)/include | 6 | INCLUDEPATH += $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include $(OPIEDIR)/include |
7 | 7 | ||
8 | 8 | ||
9 | OBJECTS_DIR = obj/$(PLATFORM) | 9 | OBJECTS_DIR = obj/$(PLATFORM) |
10 | MOC_DIR = moc/$(PLATFORM) | 10 | MOC_DIR = moc/$(PLATFORM) |
11 | DESTDIR = $(QPEDIR)/lib | 11 | DESTDIR = $(QPEDIR)/lib |
12 | LIBS += -lmicrokde | 12 | LIBS += -lxmicrokde |
13 | LIBS += -lmicrokabc | 13 | LIBS += -lxmicrokabc |
14 | LIBS += -L$(QPEDIR)/lib | 14 | LIBS += -L$(QPEDIR)/lib |
15 | LIBS += -L$(OPIEDIR)/lib | 15 | LIBS += -L$(OPIEDIR)/lib |
16 | LIBS += -lopie | 16 | LIBS += -lopie |
17 | LIBS += -lqpe | 17 | LIBS += -lqpe |
18 | LIBS += -lqte | 18 | LIBS += -lqte |
19 | 19 | ||
20 | INTERFACES = \ | 20 | INTERFACES = \ |
21 | 21 | ||
22 | HEADERS = \ | 22 | HEADERS = \ |
23 | resourceopie.h \ | 23 | resourceopie.h \ |
24 | resourceopieconfig.h \ | 24 | resourceopieconfig.h \ |
25 | opieconverter.h \ | 25 | opieconverter.h \ |
26 | 26 | ||
27 | SOURCES = \ | 27 | SOURCES = \ |
28 | resourceopie.cpp \ | 28 | resourceopie.cpp \ |
29 | resourceopieconfig.cpp \ | 29 | resourceopieconfig.cpp \ |
30 | opieconverter.cpp \ | 30 | opieconverter.cpp \ |
31 | 31 | ||
diff --git a/kabc/plugins/qtopia/qtopia.pro b/kabc/plugins/qtopia/qtopia.pro index 64d1abc..d91a2e3 100644 --- a/kabc/plugins/qtopia/qtopia.pro +++ b/kabc/plugins/qtopia/qtopia.pro | |||
@@ -1,43 +1,47 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on release | 2 | CONFIG += qt warn_on release |
3 | 3 | ||
4 | include( ../../../variables.pri ) | 4 | include( ../../../variables.pri ) |
5 | 5 | ||
6 | TARGET = microkabc_qtopia | 6 | TARGET = xmicrokabc_qtopia |
7 | 7 | ||
8 | INCLUDEPATH += ../.. ../../.. ../../../kabc ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources | 8 | INCLUDEPATH += ../.. ../../.. ../../../kabc ../../../microkde ../../../microkde/kdecore ../../../microkde/kio/kfile ../../../microkde/kio/kio ../../../microkde/kresources |
9 | 9 | ||
10 | DESTDIR = ../../../bin | 10 | DESTDIR = ../../../bin |
11 | #LIBS += -lmicrokde | 11 | #LIBS += -lxmicrokde |
12 | #LIBS += -lkamicrokabc | 12 | #LIBS += -lxkamicrokabc |
13 | 13 | ||
14 | DEFINES += KAB_EMBEDDED DESKTOP_VERSION | 14 | DEFINES += KAB_EMBEDDED DESKTOP_VERSION |
15 | 15 | ||
16 | INTERFACES = \ | 16 | INTERFACES = \ |
17 | 17 | ||
18 | HEADERS = \ | 18 | HEADERS = \ |
19 | resourceqtopia.h \ | 19 | resourceqtopia.h \ |
20 | resourceqtopiaconfig.h \ | 20 | resourceqtopiaconfig.h \ |
21 | qtopiaconverter.h | 21 | qtopiaconverter.h |
22 | 22 | ||
23 | SOURCES = \ | 23 | SOURCES = \ |
24 | resourceqtopia.cpp \ | 24 | resourceqtopia.cpp \ |
25 | resourceqtopiaconfig.cpp \ | 25 | resourceqtopiaconfig.cpp \ |
26 | qtopiaconverter.cpp | 26 | qtopiaconverter.cpp |
27 | 27 | ||
28 | 28 | ||
29 | 29 | ||
30 | unix : { | 30 | unix : { |
31 | OBJECTS_DIR = obj/unix | 31 | OBJECTS_DIR = obj/unix |
32 | MOC_DIR = moc/unix | 32 | MOC_DIR = moc/unix |
33 | } | 33 | } |
34 | win32: { | 34 | win32: { |
35 | CONFIG += dll | 35 | CONFIG += dll |
36 | DEFINES += _WIN32_ | 36 | DEFINES += _WIN32_ |
37 | OBJECTS_DIR = obj/win | 37 | OBJECTS_DIR = obj/win |
38 | MOC_DIR = moc/win | 38 | MOC_DIR = moc/win |
39 | LIBS += ../../../bin/microkdepim.lib | 39 | LIBS += ../../../bin/xmicrokdepim.lib |
40 | LIBS += ../../../bin/microkcal.lib | 40 | LIBS += ../../../bin/xmicrokcal.lib |
41 | LIBS += ../../../bin/microkde.lib | 41 | LIBS += ../../../bin/xmicrokde.lib |
42 | LIBS += ../../../bin/microkabc.lib | 42 | LIBS += ../../../bin/microkabc.lib |
43 | } | 43 | } |
44 | #The following line was inserted by qt3to4 | ||
45 | QT += xml qt3support | ||
46 | #The following line was inserted by qt3to4 | ||
47 | QT += | ||
diff --git a/kabc/plugins/qtopia/qtopiaE.pro b/kabc/plugins/qtopia/qtopiaE.pro index 700057b..4b174b2 100644 --- a/kabc/plugins/qtopia/qtopiaE.pro +++ b/kabc/plugins/qtopia/qtopiaE.pro | |||
@@ -1,26 +1,26 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | 3 | ||
4 | TARGET = microkabc_qtopia | 4 | TARGET = xmicrokabc_qtopia |
5 | 5 | ||
6 | INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include | 6 | INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include |
7 | 7 | ||
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc/$(PLATFORM) | 9 | MOC_DIR = moc/$(PLATFORM) |
10 | DESTDIR = $(QPEDIR)/lib | 10 | DESTDIR = $(QPEDIR)/lib |
11 | LIBS += -lmicrokde | 11 | LIBS += -lxmicrokde |
12 | LIBS += -lmicrokabc | 12 | LIBS += -lxmicrokabc |
13 | LIBS += -L$(QPEDIR)/lib | 13 | LIBS += -L$(QPEDIR)/lib |
14 | LIBS += -lqpe | 14 | LIBS += -lqpe |
15 | 15 | ||
16 | INTERFACES = \ | 16 | INTERFACES = \ |
17 | 17 | ||
18 | HEADERS = \ | 18 | HEADERS = \ |
19 | resourceqtopia.h \ | 19 | resourceqtopia.h \ |
20 | resourceqtopiaconfig.h \ | 20 | resourceqtopiaconfig.h \ |
21 | qtopiaconverter.h | 21 | qtopiaconverter.h |
22 | 22 | ||
23 | SOURCES = \ | 23 | SOURCES = \ |
24 | resourceqtopia.cpp \ | 24 | resourceqtopia.cpp \ |
25 | resourceqtopiaconfig.cpp \ | 25 | resourceqtopiaconfig.cpp \ |
26 | qtopiaconverter.cpp | 26 | qtopiaconverter.cpp |
diff --git a/kabc/plugins/qtopia/qtopiaconverter.cpp b/kabc/plugins/qtopia/qtopiaconverter.cpp index 9693a68..9b3903b 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.cpp +++ b/kabc/plugins/qtopia/qtopiaconverter.cpp | |||
@@ -1,673 +1,675 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | //US | 28 | //US |
29 | #include "kglobal.h" | 29 | #include "kglobal.h" |
30 | #include "klocale.h" | 30 | #include "klocale.h" |
31 | 31 | ||
32 | 32 | ||
33 | #include "qtopiaconverter.h" | 33 | #include "qtopiaconverter.h" |
34 | 34 | ||
35 | #include <qfile.h> | 35 | #include <qfile.h> |
36 | #include <qdir.h> | 36 | #include <qdir.h> |
37 | #include <qtextstream.h> | 37 | #include <q3textstream.h> |
38 | //Added by qt3to4: | ||
39 | #include <Q3ValueList> | ||
38 | //#include <.h> | 40 | //#include <.h> |
39 | 41 | ||
40 | #include <libkdepim/ksyncprofile.h> | 42 | #include <libkdepim/ksyncprofile.h> |
41 | 43 | ||
42 | 44 | ||
43 | using namespace KABC; | 45 | using namespace KABC; |
44 | 46 | ||
45 | QtopiaConverter::QtopiaConverter() | 47 | QtopiaConverter::QtopiaConverter() |
46 | { | 48 | { |
47 | m_edit = 0; | 49 | m_edit = 0; |
48 | } | 50 | } |
49 | 51 | ||
50 | QtopiaConverter::~QtopiaConverter() | 52 | QtopiaConverter::~QtopiaConverter() |
51 | { | 53 | { |
52 | deinit(); | 54 | deinit(); |
53 | } | 55 | } |
54 | 56 | ||
55 | bool QtopiaConverter::init() | 57 | bool QtopiaConverter::init() |
56 | { | 58 | { |
57 | QString fn = QDir::homeDirPath() +"/Settings/Categories.xml"; | 59 | QString fn = QDir::homeDirPath() +"/Settings/Categories.xml"; |
58 | m_edit = new CategoryEdit( fn); | 60 | m_edit = new CategoryEdit( fn); |
59 | return true; | 61 | return true; |
60 | } | 62 | } |
61 | 63 | ||
62 | void QtopiaConverter::deinit() | 64 | void QtopiaConverter::deinit() |
63 | { | 65 | { |
64 | if (m_edit) | 66 | if (m_edit) |
65 | { | 67 | { |
66 | delete m_edit; | 68 | delete m_edit; |
67 | m_edit = 0; | 69 | m_edit = 0; |
68 | } | 70 | } |
69 | } | 71 | } |
70 | QString QtopiaConverter::categoriesToNumber( const QStringList &list, const QString &app ) | 72 | QString QtopiaConverter::categoriesToNumber( const QStringList &list, const QString &app ) |
71 | { | 73 | { |
72 | startover: | 74 | startover: |
73 | QStringList dummy; | 75 | QStringList dummy; |
74 | QValueList<OpieCategories>::ConstIterator catIt; | 76 | Q3ValueList<OpieCategories>::ConstIterator catIt; |
75 | QValueList<OpieCategories> categories = m_edit->categories(); | 77 | Q3ValueList<OpieCategories> categories = m_edit->categories(); |
76 | bool found = false; | 78 | bool found = false; |
77 | for ( QStringList::ConstIterator listIt = list.begin(); listIt != list.end(); ++listIt ) { | 79 | for ( QStringList::ConstIterator listIt = list.begin(); listIt != list.end(); ++listIt ) { |
78 | /* skip empty category name */ | 80 | /* skip empty category name */ |
79 | if ( (*listIt).isEmpty() ) continue; | 81 | if ( (*listIt).isEmpty() ) continue; |
80 | 82 | ||
81 | found = false; | 83 | found = false; |
82 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { | 84 | for ( catIt = categories.begin(); catIt != categories.end(); ++catIt ) { |
83 | /* | 85 | /* |
84 | * We currently do not take app into account | 86 | * We currently do not take app into account |
85 | * if name matches and the id isn't already in dummy we'll add it | 87 | * if name matches and the id isn't already in dummy we'll add it |
86 | */ | 88 | */ |
87 | if ( (*catIt).name() == (*listIt) && !dummy.contains(( *catIt).id() ) ) { // the same name | 89 | if ( (*catIt).name() == (*listIt) && !dummy.contains(( *catIt).id() ) ) { // the same name |
88 | found= true; | 90 | found= true; |
89 | dummy << (*catIt).id(); | 91 | dummy << (*catIt).id(); |
90 | } | 92 | } |
91 | } | 93 | } |
92 | /* if not found and the category is not empty | 94 | /* if not found and the category is not empty |
93 | * | 95 | * |
94 | * generate a new category and start over again | 96 | * generate a new category and start over again |
95 | * ugly goto to reiterate | 97 | * ugly goto to reiterate |
96 | */ | 98 | */ |
97 | 99 | ||
98 | if ( !found && !(*listIt).isEmpty() ){ | 100 | if ( !found && !(*listIt).isEmpty() ){ |
99 | m_edit->addCategory( app, (*listIt) ); // generate a new category | 101 | m_edit->addCategory( app, (*listIt) ); // generate a new category |
100 | goto startover; | 102 | goto startover; |
101 | } | 103 | } |
102 | } | 104 | } |
103 | 105 | ||
104 | return dummy.join(";"); | 106 | return dummy.join(";"); |
105 | } | 107 | } |
106 | 108 | ||
107 | 109 | ||
108 | // FROM TT timeconversion.cpp GPLed | 110 | // FROM TT timeconversion.cpp GPLed |
109 | QDate QtopiaConverter::fromString( const QString &datestr ) | 111 | QDate QtopiaConverter::fromString( const QString &datestr ) |
110 | { | 112 | { |
111 | if (datestr.isEmpty() ) | 113 | if (datestr.isEmpty() ) |
112 | return QDate(); | 114 | return QDate(); |
113 | 115 | ||
114 | int monthPos = datestr.find('.'); | 116 | int monthPos = datestr.find('.'); |
115 | int yearPos = datestr.find('.', monthPos+1 ); | 117 | int yearPos = datestr.find('.', monthPos+1 ); |
116 | if ( monthPos == -1 || yearPos == -1 ) { | 118 | if ( monthPos == -1 || yearPos == -1 ) { |
117 | return QDate(); | 119 | return QDate(); |
118 | } | 120 | } |
119 | int d = datestr.left( monthPos ).toInt(); | 121 | int d = datestr.left( monthPos ).toInt(); |
120 | int m = datestr.mid( monthPos+1, yearPos - monthPos - 1 ).toInt(); | 122 | int m = datestr.mid( monthPos+1, yearPos - monthPos - 1 ).toInt(); |
121 | int y = datestr.mid( yearPos+1 ).toInt(); | 123 | int y = datestr.mid( yearPos+1 ).toInt(); |
122 | QDate date ( y,m,d ); | 124 | QDate date ( y,m,d ); |
123 | 125 | ||
124 | 126 | ||
125 | return date; | 127 | return date; |
126 | } | 128 | } |
127 | 129 | ||
128 | QDate QtopiaConverter::dateFromString( const QString& s ) | 130 | QDate QtopiaConverter::dateFromString( const QString& s ) |
129 | { | 131 | { |
130 | QDate date; | 132 | QDate date; |
131 | 133 | ||
132 | if ( s.isEmpty() ) | 134 | if ( s.isEmpty() ) |
133 | return date; | 135 | return date; |
134 | 136 | ||
135 | // Be backward compatible to old Opie format: | 137 | // Be backward compatible to old Opie format: |
136 | // Try to load old format. If it fails, try new ISO-Format! | 138 | // Try to load old format. If it fails, try new ISO-Format! |
137 | date = fromString ( s ); | 139 | date = fromString ( s ); |
138 | if ( date.isValid() ) | 140 | if ( date.isValid() ) |
139 | return date; | 141 | return date; |
140 | 142 | ||
141 | // Read ISO-Format (YYYYMMDD) | 143 | // Read ISO-Format (YYYYMMDD) |
142 | int year = s.mid(0, 4).toInt(); | 144 | int year = s.mid(0, 4).toInt(); |
143 | int month = s.mid(4,2).toInt(); | 145 | int month = s.mid(4,2).toInt(); |
144 | int day = s.mid(6,2).toInt(); | 146 | int day = s.mid(6,2).toInt(); |
145 | 147 | ||
146 | // do some quick sanity checking | 148 | // do some quick sanity checking |
147 | if ( year < 1900 || year > 3000 ) | 149 | if ( year < 1900 || year > 3000 ) |
148 | return date; | 150 | return date; |
149 | 151 | ||
150 | if ( month < 0 || month > 12 ) | 152 | if ( month < 0 || month > 12 ) |
151 | return date; | 153 | return date; |
152 | 154 | ||
153 | if ( day < 0 || day > 31 ) | 155 | if ( day < 0 || day > 31 ) |
154 | return date; | 156 | return date; |
155 | 157 | ||
156 | 158 | ||
157 | date.setYMD( year, month, day ); | 159 | date.setYMD( year, month, day ); |
158 | 160 | ||
159 | if ( !date.isValid() ) | 161 | if ( !date.isValid() ) |
160 | return QDate(); | 162 | return QDate(); |
161 | 163 | ||
162 | 164 | ||
163 | return date; | 165 | return date; |
164 | } | 166 | } |
165 | QString QtopiaConverter::dateToString( const QDate &d ) | 167 | QString QtopiaConverter::dateToString( const QDate &d ) |
166 | { | 168 | { |
167 | if ( d.isNull() || !d.isValid() ) | 169 | if ( d.isNull() || !d.isValid() ) |
168 | return QString::null; | 170 | return QString::null; |
169 | 171 | ||
170 | // ISO format in year, month, day (YYYYMMDD); e.g. 20021231 | 172 | // ISO format in year, month, day (YYYYMMDD); e.g. 20021231 |
171 | QString year = QString::number( d.year() ); | 173 | QString year = QString::number( d.year() ); |
172 | QString month = QString::number( d.month() ); | 174 | QString month = QString::number( d.month() ); |
173 | month = month.rightJustify( 2, '0' ); | 175 | month = month.rightJustify( 2, '0' ); |
174 | QString day = QString::number( d.day() ); | 176 | QString day = QString::number( d.day() ); |
175 | day = day.rightJustify( 2, '0' ); | 177 | day = day.rightJustify( 2, '0' ); |
176 | 178 | ||
177 | QString str = year + month + day; | 179 | QString str = year + month + day; |
178 | 180 | ||
179 | return str; | 181 | return str; |
180 | } | 182 | } |
181 | 183 | ||
182 | bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr ) | 184 | bool QtopiaConverter::qtopiaToAddressee( const QDomElement& el, Addressee &adr ) |
183 | { | 185 | { |
184 | { //LR | 186 | { //LR |
185 | 187 | ||
186 | adr.setUid( el.attribute("Uid" ) ); | 188 | adr.setUid( el.attribute("Uid" ) ); |
187 | adr.setFamilyName( el.attribute( "LastName" ) ); | 189 | adr.setFamilyName( el.attribute( "LastName" ) ); |
188 | adr.setGivenName( el.attribute( "FirstName" ) ); | 190 | adr.setGivenName( el.attribute( "FirstName" ) ); |
189 | adr.setAdditionalName( el.attribute( "MiddleName" ) ); | 191 | adr.setAdditionalName( el.attribute( "MiddleName" ) ); |
190 | adr.setSuffix( el.attribute( "Suffix" ) ); | 192 | adr.setSuffix( el.attribute( "Suffix" ) ); |
191 | adr.setNickName( el.attribute( "Nickname" ) ); | 193 | adr.setNickName( el.attribute( "Nickname" ) ); |
192 | 194 | ||
193 | QDate date = dateFromString( el.attribute( "Birthday" ) ); | 195 | QDate date = dateFromString( el.attribute( "Birthday" ) ); |
194 | if ( date.isValid() ) | 196 | if ( date.isValid() ) |
195 | adr.setBirthday( date ); | 197 | adr.setBirthday( (QDateTime)date ); |
196 | 198 | ||
197 | adr.setRole( el.attribute( "JobTitle" ) ); | 199 | adr.setRole( el.attribute( "JobTitle" ) ); |
198 | if ( !el.attribute( "FileAs" ).isEmpty() ) | 200 | if ( !el.attribute( "FileAs" ).isEmpty() ) |
199 | adr.setFormattedName( el.attribute( "FileAs" ) ); | 201 | adr.setFormattedName( el.attribute( "FileAs" ) ); |
200 | 202 | ||
201 | adr.setOrganization( el.attribute( "Company" ) ); | 203 | adr.setOrganization( el.attribute( "Company" ) ); |
202 | 204 | ||
203 | KABC::PhoneNumber businessPhoneNum( el.attribute( "BusinessPhone" ), | 205 | KABC::PhoneNumber businessPhoneNum( el.attribute( "BusinessPhone" ), |
204 | KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); | 206 | KABC::PhoneNumber::Work | KABC::PhoneNumber::Pref ); |
205 | KABC::PhoneNumber businessFaxNum( el.attribute( "BusinessFax" ), | 207 | KABC::PhoneNumber businessFaxNum( el.attribute( "BusinessFax" ), |
206 | KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); | 208 | KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); |
207 | KABC::PhoneNumber businessMobile( el.attribute( "BusinessMobile" ), | 209 | KABC::PhoneNumber businessMobile( el.attribute( "BusinessMobile" ), |
208 | KABC::PhoneNumber::Car ); | 210 | KABC::PhoneNumber::Car ); |
209 | KABC::PhoneNumber businessPager( el.attribute( "BusinessPager" ), | 211 | KABC::PhoneNumber businessPager( el.attribute( "BusinessPager" ), |
210 | KABC::PhoneNumber::Pager ); | 212 | KABC::PhoneNumber::Pager ); |
211 | if ( !businessPhoneNum.number().isEmpty() ) | 213 | if ( !businessPhoneNum.number().isEmpty() ) |
212 | adr.insertPhoneNumber( businessPhoneNum ); | 214 | adr.insertPhoneNumber( businessPhoneNum ); |
213 | if ( !businessFaxNum.number().isEmpty() ) | 215 | if ( !businessFaxNum.number().isEmpty() ) |
214 | adr.insertPhoneNumber( businessFaxNum ); | 216 | adr.insertPhoneNumber( businessFaxNum ); |
215 | if ( !businessMobile.number().isEmpty() ) | 217 | if ( !businessMobile.number().isEmpty() ) |
216 | adr.insertPhoneNumber( businessMobile ); | 218 | adr.insertPhoneNumber( businessMobile ); |
217 | if ( !businessPager.number().isEmpty() ) | 219 | if ( !businessPager.number().isEmpty() ) |
218 | adr.insertPhoneNumber( businessPager ); | 220 | adr.insertPhoneNumber( businessPager ); |
219 | 221 | ||
220 | // Handle multiple mail addresses | 222 | // Handle multiple mail addresses |
221 | QString DefaultEmail = el.attribute( "DefaultEmail" ); | 223 | QString DefaultEmail = el.attribute( "DefaultEmail" ); |
222 | if ( !DefaultEmail.isEmpty() ) | 224 | if ( !DefaultEmail.isEmpty() ) |
223 | adr.insertEmail( DefaultEmail, true ); // preferred | 225 | adr.insertEmail( DefaultEmail, true ); // preferred |
224 | 226 | ||
225 | QStringList Emails = QStringList::split(" ",el.attribute("Emails")); | 227 | QStringList Emails = QStringList::split(" ",el.attribute("Emails")); |
226 | int i; | 228 | int i; |
227 | for (i = 0;i < Emails.count();++i) { | 229 | for (i = 0;i < Emails.count();++i) { |
228 | if ( Emails[i] != DefaultEmail ) | 230 | if ( Emails[i] != DefaultEmail ) |
229 | adr.insertEmail( Emails[i], false ); | 231 | adr.insertEmail( Emails[i], false ); |
230 | } | 232 | } |
231 | 233 | ||
232 | KABC::PhoneNumber homePhoneNum( el.attribute( "HomePhone" ), | 234 | KABC::PhoneNumber homePhoneNum( el.attribute( "HomePhone" ), |
233 | KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref); | 235 | KABC::PhoneNumber::Home | KABC::PhoneNumber::Pref); |
234 | KABC::PhoneNumber homeFax( el.attribute( "HomeFax" ), | 236 | KABC::PhoneNumber homeFax( el.attribute( "HomeFax" ), |
235 | KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); | 237 | KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); |
236 | 238 | ||
237 | KABC::PhoneNumber homeMobile( el.attribute( "HomeMobile" ), | 239 | KABC::PhoneNumber homeMobile( el.attribute( "HomeMobile" ), |
238 | KABC::PhoneNumber::Cell ); | 240 | KABC::PhoneNumber::Cell ); |
239 | 241 | ||
240 | if ( !homePhoneNum.number().isEmpty() ) | 242 | if ( !homePhoneNum.number().isEmpty() ) |
241 | adr.insertPhoneNumber( homePhoneNum ); | 243 | adr.insertPhoneNumber( homePhoneNum ); |
242 | if ( !homeFax.number().isEmpty() ) | 244 | if ( !homeFax.number().isEmpty() ) |
243 | adr.insertPhoneNumber( homeFax ); | 245 | adr.insertPhoneNumber( homeFax ); |
244 | if ( !homeMobile.number().isEmpty() ) | 246 | if ( !homeMobile.number().isEmpty() ) |
245 | adr.insertPhoneNumber( homeMobile ); | 247 | adr.insertPhoneNumber( homeMobile ); |
246 | 248 | ||
247 | KABC::Address business( KABC::Address::Work ); | 249 | KABC::Address business( KABC::Address::Work ); |
248 | business.setStreet( el.attribute( "BusinessStreet" ) ); | 250 | business.setStreet( el.attribute( "BusinessStreet" ) ); |
249 | business.setLocality( el.attribute( "BusinessCity" ) ); | 251 | business.setLocality( el.attribute( "BusinessCity" ) ); |
250 | business.setRegion( el.attribute( "BusinessState" ) ); | 252 | business.setRegion( el.attribute( "BusinessState" ) ); |
251 | business.setPostalCode( el.attribute( "BusinessZip" ) ); | 253 | business.setPostalCode( el.attribute( "BusinessZip" ) ); |
252 | business.setCountry( el.attribute( "BusinessCountry" ) ); | 254 | business.setCountry( el.attribute( "BusinessCountry" ) ); |
253 | 255 | ||
254 | if ( !business.isEmpty() ) | 256 | if ( !business.isEmpty() ) |
255 | adr.insertAddress( business ); | 257 | adr.insertAddress( business ); |
256 | 258 | ||
257 | KABC::Address home( KABC::Address::Home ); | 259 | KABC::Address home( KABC::Address::Home ); |
258 | home.setStreet( el.attribute( "HomeStreet" ) ); | 260 | home.setStreet( el.attribute( "HomeStreet" ) ); |
259 | home.setLocality( el.attribute( "HomeCity" ) ); | 261 | home.setLocality( el.attribute( "HomeCity" ) ); |
260 | home.setRegion( el.attribute( "HomeState" ) ); | 262 | home.setRegion( el.attribute( "HomeState" ) ); |
261 | home.setPostalCode( el.attribute( "HomeZip" ) ); | 263 | home.setPostalCode( el.attribute( "HomeZip" ) ); |
262 | home.setCountry( el.attribute( "HomeCountry" ) ); | 264 | home.setCountry( el.attribute( "HomeCountry" ) ); |
263 | 265 | ||
264 | if ( !home.isEmpty() ) | 266 | if ( !home.isEmpty() ) |
265 | adr.insertAddress( home ); | 267 | adr.insertAddress( home ); |
266 | 268 | ||
267 | adr.setNickName( el.attribute( "Nickname" ) ); | 269 | adr.setNickName( el.attribute( "Nickname" ) ); |
268 | adr.setNote( el.attribute( "Notes" ) ); | 270 | adr.setNote( el.attribute( "Notes" ) ); |
269 | 271 | ||
270 | { | 272 | { |
271 | QStringList categories = QStringList::split(";", el.attribute("Categories" ) ); | 273 | QStringList categories = QStringList::split(";", el.attribute("Categories" ) ); |
272 | QString cat; | 274 | QString cat; |
273 | QStringList added; | 275 | QStringList added; |
274 | for ( uint i = 0; i < categories.count(); i++ ) { | 276 | for ( uint i = 0; i < categories.count(); i++ ) { |
275 | cat = m_edit->categoryById( categories[ i ], "Contacts" ); | 277 | cat = m_edit->categoryById( categories[ i ], "Contacts" ); |
276 | 278 | ||
277 | // if name is not empty and we did not add the | 279 | // if name is not empty and we did not add the |
278 | // cat try to repair broken files | 280 | // cat try to repair broken files |
279 | if ( !cat.isEmpty() && !added.contains( cat ) ) { | 281 | if ( !cat.isEmpty() && !added.contains( cat ) ) { |
280 | adr.insertCategory( cat ); | 282 | adr.insertCategory( cat ); |
281 | added << cat; | 283 | added << cat; |
282 | } | 284 | } |
283 | } | 285 | } |
284 | } | 286 | } |
285 | 287 | ||
286 | if ( !el.attribute( "Department" ).isEmpty() ) | 288 | if ( !el.attribute( "Department" ).isEmpty() ) |
287 | adr.insertCustom( "KADDRESSBOOK", "X-Department", el.attribute( "Department" ) ); | 289 | adr.insertCustom( "KADDRESSBOOK", "X-Department", el.attribute( "Department" ) ); |
288 | if ( !el.attribute( "HomeWebPage" ).isEmpty() ) | 290 | if ( !el.attribute( "HomeWebPage" ).isEmpty() ) |
289 | adr.insertCustom( "opie", "HomeWebPage", el.attribute( "HomeWebPage" ) ); | 291 | adr.insertCustom( "opie", "HomeWebPage", el.attribute( "HomeWebPage" ) ); |
290 | if ( !el.attribute( "Spouse" ).isEmpty() ) | 292 | if ( !el.attribute( "Spouse" ).isEmpty() ) |
291 | adr.insertCustom( "KADDRESSBOOK", "X-SpousesName", el.attribute( "Spouse" ) ); | 293 | adr.insertCustom( "KADDRESSBOOK", "X-SpousesName", el.attribute( "Spouse" ) ); |
292 | if ( !el.attribute( "Gender" ).isEmpty() ) { | 294 | if ( !el.attribute( "Gender" ).isEmpty() ) { |
293 | if ( el.attribute( "Gender" ) == "1" ) | 295 | if ( el.attribute( "Gender" ) == "1" ) |
294 | adr.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); | 296 | adr.insertCustom( "KADDRESSBOOK", "X-Gender", "male" ); |
295 | else if ( el.attribute( "Gender" ) == "2" ) | 297 | else if ( el.attribute( "Gender" ) == "2" ) |
296 | adr.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); | 298 | adr.insertCustom( "KADDRESSBOOK", "X-Gender", "female" ); |
297 | } | 299 | } |
298 | QDate ann = dateFromString( el.attribute( "Anniversary" ) ); | 300 | QDate ann = dateFromString( el.attribute( "Anniversary" ) ); |
299 | if ( ann.isValid() ) { | 301 | if ( ann.isValid() ) { |
300 | QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate); | 302 | QString dt = KGlobal::locale()->formatDate(ann, true, KLocale::ISODate); |
301 | adr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt ); | 303 | adr.insertCustom( "KADDRESSBOOK", "X-Anniversary", dt ); |
302 | } | 304 | } |
303 | 305 | ||
304 | if ( !el.attribute( "Children" ).isEmpty() ) | 306 | if ( !el.attribute( "Children" ).isEmpty() ) |
305 | adr.insertCustom("KADDRESSBOOK", "X-Children", el.attribute("Children") ); | 307 | adr.insertCustom("KADDRESSBOOK", "X-Children", el.attribute("Children") ); |
306 | if ( !el.attribute( "Office" ).isEmpty() ) | 308 | if ( !el.attribute( "Office" ).isEmpty() ) |
307 | adr.insertCustom("KADDRESSBOOK", "X-Office", el.attribute("Office") ); | 309 | adr.insertCustom("KADDRESSBOOK", "X-Office", el.attribute("Office") ); |
308 | if ( !el.attribute( "Profession" ).isEmpty() ) | 310 | if ( !el.attribute( "Profession" ).isEmpty() ) |
309 | adr.insertCustom("KADDRESSBOOK", "X-Profession", el.attribute("Profession") ); | 311 | adr.insertCustom("KADDRESSBOOK", "X-Profession", el.attribute("Profession") ); |
310 | if ( !el.attribute( "Assistant" ).isEmpty() ) | 312 | if ( !el.attribute( "Assistant" ).isEmpty() ) |
311 | adr.insertCustom("KADDRESSBOOK", "X-AssistantsName", el.attribute("Assistant") ); | 313 | adr.insertCustom("KADDRESSBOOK", "X-AssistantsName", el.attribute("Assistant") ); |
312 | if ( !el.attribute( "Manager" ).isEmpty() ) | 314 | if ( !el.attribute( "Manager" ).isEmpty() ) |
313 | adr.insertCustom("KADDRESSBOOK", "X-ManagersName", el.attribute("Manager") ); | 315 | adr.insertCustom("KADDRESSBOOK", "X-ManagersName", el.attribute("Manager") ); |
314 | 316 | ||
315 | 317 | ||
316 | } | 318 | } |
317 | return true; | 319 | return true; |
318 | } | 320 | } |
319 | 321 | ||
320 | bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, QTextStream *stream ) | 322 | bool QtopiaConverter::addresseeToQtopia( const Addressee &ab, Q3TextStream *stream ) |
321 | { | 323 | { |
322 | *stream << "<Contact "; | 324 | *stream << "<Contact "; |
323 | *stream << "FirstName=\"" << escape(ab.givenName()) << "\" "; | 325 | *stream << "FirstName=\"" << escape(ab.givenName()) << "\" "; |
324 | *stream << "MiddleName=\"" << escape(ab.additionalName()) << "\" "; | 326 | *stream << "MiddleName=\"" << escape(ab.additionalName()) << "\" "; |
325 | *stream << "LastName=\"" << escape(ab.familyName()) << "\" "; | 327 | *stream << "LastName=\"" << escape(ab.familyName()) << "\" "; |
326 | *stream << "Suffix=\"" << escape(ab.suffix()) << "\" "; | 328 | *stream << "Suffix=\"" << escape(ab.suffix()) << "\" "; |
327 | 329 | ||
328 | QString sortStr; | 330 | QString sortStr; |
329 | sortStr = ab.formattedName(); | 331 | sortStr = ab.formattedName(); |
330 | /* is formattedName is empty we use the assembled name as fallback */ | 332 | /* is formattedName is empty we use the assembled name as fallback */ |
331 | if (sortStr.isEmpty() ) | 333 | if (sortStr.isEmpty() ) |
332 | sortStr = ab.assembledName(); | 334 | sortStr = ab.assembledName(); |
333 | *stream << "FileAs=\"" << escape(sortStr) << "\" "; | 335 | *stream << "FileAs=\"" << escape(sortStr) << "\" "; |
334 | 336 | ||
335 | *stream << "JobTitle=\"" << escape(ab.role()) << "\" "; | 337 | *stream << "JobTitle=\"" << escape(ab.role()) << "\" "; |
336 | *stream << "Department=\"" << escape(ab.custom( "KADDRESSBOOK", "X-Department" )) << "\" "; | 338 | *stream << "Department=\"" << escape(ab.custom( "KADDRESSBOOK", "X-Department" )) << "\" "; |
337 | *stream << "Company=\"" << escape(ab.organization()) << "\" "; | 339 | *stream << "Company=\"" << escape(ab.organization()) << "\" "; |
338 | 340 | ||
339 | KABC::PhoneNumber businessPhoneNum = ab.phoneNumber(KABC::PhoneNumber::Work ); | 341 | KABC::PhoneNumber businessPhoneNum = ab.phoneNumber(KABC::PhoneNumber::Work ); |
340 | *stream << "BusinessPhone=\"" << escape( businessPhoneNum.number() ) << "\" "; | 342 | *stream << "BusinessPhone=\"" << escape( businessPhoneNum.number() ) << "\" "; |
341 | 343 | ||
342 | KABC::PhoneNumber businessFaxNum = ab.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); | 344 | KABC::PhoneNumber businessFaxNum = ab.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Fax ); |
343 | *stream << "BusinessFax=\"" << escape( businessFaxNum.number() )<< "\" "; | 345 | *stream << "BusinessFax=\"" << escape( businessFaxNum.number() )<< "\" "; |
344 | 346 | ||
345 | KABC::PhoneNumber businessMobile = ab.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Cell ); | 347 | KABC::PhoneNumber businessMobile = ab.phoneNumber(KABC::PhoneNumber::Work | KABC::PhoneNumber::Cell ); |
346 | *stream << "BusinessMobile=\"" << escape( businessMobile.number() ) << "\" "; | 348 | *stream << "BusinessMobile=\"" << escape( businessMobile.number() ) << "\" "; |
347 | 349 | ||
348 | *stream << "DefaultEmail=\"" << escape( ab.preferredEmail() ) << "\" "; | 350 | *stream << "DefaultEmail=\"" << escape( ab.preferredEmail() ) << "\" "; |
349 | QStringList list = ab.emails(); | 351 | QStringList list = ab.emails(); |
350 | if ( list.count() > 0 ) { | 352 | if ( list.count() > 0 ) { |
351 | QStringList::Iterator it = list.begin(); | 353 | QStringList::Iterator it = list.begin(); |
352 | *stream << "Emails=\"" << escape( *it ); | 354 | *stream << "Emails=\"" << escape( *it ); |
353 | while (++it != list.end()) | 355 | while (++it != list.end()) |
354 | *stream << ' ' << escape( *it ); | 356 | *stream << ' ' << escape( *it ); |
355 | *stream << "\" "; | 357 | *stream << "\" "; |
356 | } | 358 | } |
357 | 359 | ||
358 | KABC::PhoneNumber homePhoneNum = ab.phoneNumber(KABC::PhoneNumber::Home ); | 360 | KABC::PhoneNumber homePhoneNum = ab.phoneNumber(KABC::PhoneNumber::Home ); |
359 | *stream << "HomePhone=\"" << escape( homePhoneNum.number() ) << "\" "; | 361 | *stream << "HomePhone=\"" << escape( homePhoneNum.number() ) << "\" "; |
360 | 362 | ||
361 | KABC::PhoneNumber homeFax = ab.phoneNumber( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); | 363 | KABC::PhoneNumber homeFax = ab.phoneNumber( KABC::PhoneNumber::Home | KABC::PhoneNumber::Fax ); |
362 | *stream << "HomeFax=\"" << escape( homeFax.number() ) << "\" "; | 364 | *stream << "HomeFax=\"" << escape( homeFax.number() ) << "\" "; |
363 | 365 | ||
364 | KABC::PhoneNumber homeMobile = ab.phoneNumber( KABC::PhoneNumber::Cell ); | 366 | KABC::PhoneNumber homeMobile = ab.phoneNumber( KABC::PhoneNumber::Cell ); |
365 | *stream << "HomeMobile=\"" << escape( homeMobile.number() ) << "\" "; | 367 | *stream << "HomeMobile=\"" << escape( homeMobile.number() ) << "\" "; |
366 | 368 | ||
367 | KABC::Address business = ab.address(KABC::Address::Work ); | 369 | KABC::Address business = ab.address(KABC::Address::Work ); |
368 | *stream << "BusinessStreet=\"" << escape( business.street() ) << "\" "; | 370 | *stream << "BusinessStreet=\"" << escape( business.street() ) << "\" "; |
369 | *stream << "BusinessCity=\"" << escape( business.locality() ) << "\" "; | 371 | *stream << "BusinessCity=\"" << escape( business.locality() ) << "\" "; |
370 | *stream << "BusinessZip=\"" << escape( business.postalCode() ) << "\" "; | 372 | *stream << "BusinessZip=\"" << escape( business.postalCode() ) << "\" "; |
371 | *stream << "BusinessCountry=\"" << escape( business.country() ) << "\" "; | 373 | *stream << "BusinessCountry=\"" << escape( business.country() ) << "\" "; |
372 | *stream << "BusinessState=\"" << escape( business.region() ) << "\" "; | 374 | *stream << "BusinessState=\"" << escape( business.region() ) << "\" "; |
373 | //stream << "BusinessPager=\"" << << "\" "; | 375 | //stream << "BusinessPager=\"" << << "\" "; |
374 | *stream << "Office=\"" << escape( ab.custom( "KADDRESSBOOK", "X-Office" ) ) << "\" "; | 376 | *stream << "Office=\"" << escape( ab.custom( "KADDRESSBOOK", "X-Office" ) ) << "\" "; |
375 | *stream << "Profession=\"" << escape( ab.custom( "KADDRESSBOOK", "X-Profession" ) ) << "\" "; | 377 | *stream << "Profession=\"" << escape( ab.custom( "KADDRESSBOOK", "X-Profession" ) ) << "\" "; |
376 | *stream << "Assistant=\"" << escape( ab.custom( "KADDRESSBOOK", "X-AssistantsName") ) << "\" "; | 378 | *stream << "Assistant=\"" << escape( ab.custom( "KADDRESSBOOK", "X-AssistantsName") ) << "\" "; |
377 | *stream << "Manager=\"" << escape( ab.custom( "KADDRESSBOOK", "X-ManagersName" ) ) << "\" "; | 379 | *stream << "Manager=\"" << escape( ab.custom( "KADDRESSBOOK", "X-ManagersName" ) ) << "\" "; |
378 | 380 | ||
379 | KABC::Address home = ab.address( KABC::Address::Home ); | 381 | KABC::Address home = ab.address( KABC::Address::Home ); |
380 | *stream << "HomeStreet=\"" << escape( home.street() ) << "\" "; | 382 | *stream << "HomeStreet=\"" << escape( home.street() ) << "\" "; |
381 | *stream << "HomeCity=\"" << escape( home.locality() ) << "\" "; | 383 | *stream << "HomeCity=\"" << escape( home.locality() ) << "\" "; |
382 | *stream << "HomeState=\"" << escape( home.region() ) << "\" "; | 384 | *stream << "HomeState=\"" << escape( home.region() ) << "\" "; |
383 | *stream << "HomeZip=\"" << escape( home.postalCode() ) << "\" "; | 385 | *stream << "HomeZip=\"" << escape( home.postalCode() ) << "\" "; |
384 | *stream << "HomeCountry=\"" << escape( home.country() ) << "\" "; | 386 | *stream << "HomeCountry=\"" << escape( home.country() ) << "\" "; |
385 | 387 | ||
386 | *stream << "HomeWebPage=\"" << escape( ab.custom( "opie", "HomeWebPage" ) ) << "\" "; | 388 | *stream << "HomeWebPage=\"" << escape( ab.custom( "opie", "HomeWebPage" ) ) << "\" "; |
387 | *stream << "Spouse=\"" << escape( ab.custom( "KADDRESSBOOK", "X-SpousesName") ) << "\" "; | 389 | *stream << "Spouse=\"" << escape( ab.custom( "KADDRESSBOOK", "X-SpousesName") ) << "\" "; |
388 | QString gen = "0"; | 390 | QString gen = "0"; |
389 | if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "male" ) | 391 | if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "male" ) |
390 | gen = "1"; | 392 | gen = "1"; |
391 | else if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "female" ) | 393 | else if ( ab.custom( "KADDRESSBOOK", "X-Gender") == "female" ) |
392 | gen = "2"; | 394 | gen = "2"; |
393 | *stream << "Gender=\"" << escape( gen ) << "\" "; | 395 | *stream << "Gender=\"" << escape( gen ) << "\" "; |
394 | 396 | ||
395 | if ( ab.birthday().date().isValid() ) | 397 | if ( ab.birthday().date().isValid() ) |
396 | *stream << "Birthday=\"" << escape( dateToString(ab.birthday().date() ) ) << "\" "; | 398 | *stream << "Birthday=\"" << escape( dateToString(ab.birthday().date() ) ) << "\" "; |
397 | 399 | ||
398 | { | 400 | { |
399 | QDate ann = KGlobal::locale()->readDate( ab.custom("KADDRESSBOOK", "X-Anniversary" ), | 401 | QDate ann = KGlobal::locale()->readDate( ab.custom("KADDRESSBOOK", "X-Anniversary" ), |
400 | "%Y-%m-%d"); | 402 | "%Y-%m-%d"); |
401 | if (ann.isValid() ) { | 403 | if (ann.isValid() ) { |
402 | *stream << "Anniversary=\"" << escape( dateToString( ann ) ) << "\" "; | 404 | *stream << "Anniversary=\"" << escape( dateToString( ann ) ) << "\" "; |
403 | } | 405 | } |
404 | } | 406 | } |
405 | *stream << "Nickname=\"" << escape( ab.nickName() ) << "\" "; | 407 | *stream << "Nickname=\"" << escape( ab.nickName() ) << "\" "; |
406 | *stream << "Children=\"" << escape( ab.custom("KADDRESSBOOK", "X-Children" ) ) << "\" "; | 408 | *stream << "Children=\"" << escape( ab.custom("KADDRESSBOOK", "X-Children" ) ) << "\" "; |
407 | *stream << "Notes=\"" << escape( ab.note() ) << "\" "; | 409 | *stream << "Notes=\"" << escape( ab.note() ) << "\" "; |
408 | *stream << "Categories=\"" << categoriesToNumber( ab.categories(), "Contacts") << "\" "; | 410 | *stream << "Categories=\"" << categoriesToNumber( ab.categories(), "Contacts") << "\" "; |
409 | 411 | ||
410 | QString uid = ab.uid(); | 412 | QString uid = ab.uid(); |
411 | *stream << "Uid=\"" << uid << "\" "; | 413 | *stream << "Uid=\"" << uid << "\" "; |
412 | //*stream << map.toString( "addressbook", uid ); | 414 | //*stream << map.toString( "addressbook", uid ); |
413 | *stream << " />" << "\n"; | 415 | *stream << " />" << "\n"; |
414 | 416 | ||
415 | return true; | 417 | return true; |
416 | } | 418 | } |
417 | 419 | ||
418 | 420 | ||
419 | #if 0 | 421 | #if 0 |
420 | 422 | ||
421 | KTempFile* AddressBook::fromKDE( KSync::AddressBookSyncee *syncee, ExtraMap& map ) | 423 | KTempFile* AddressBook::fromKDE( KSync::AddressBookSyncee *syncee, ExtraMap& map ) |
422 | { | 424 | { |
423 | 425 | ||
424 | } | 426 | } |
425 | 427 | ||
426 | QStringList AddressBook::attributes()const { | 428 | QStringList AddressBook::attributes()const { |
427 | QStringList lst; | 429 | QStringList lst; |
428 | lst << "FirstName"; | 430 | lst << "FirstName"; |
429 | lst << "MiddleName"; | 431 | lst << "MiddleName"; |
430 | lst << "LastName"; | 432 | lst << "LastName"; |
431 | lst << "Suffix"; | 433 | lst << "Suffix"; |
432 | lst << "FileAs"; | 434 | lst << "FileAs"; |
433 | lst << "JobTitle"; | 435 | lst << "JobTitle"; |
434 | lst << "Department"; | 436 | lst << "Department"; |
435 | lst << "Company"; | 437 | lst << "Company"; |
436 | lst << "BusinessPhone"; | 438 | lst << "BusinessPhone"; |
437 | lst << "BusinessFax"; | 439 | lst << "BusinessFax"; |
438 | lst << "BusinessMobile"; | 440 | lst << "BusinessMobile"; |
439 | lst << "DefaultEmail"; | 441 | lst << "DefaultEmail"; |
440 | lst << "Emails"; | 442 | lst << "Emails"; |
441 | lst << "HomePhone"; | 443 | lst << "HomePhone"; |
442 | lst << "HomeFax"; | 444 | lst << "HomeFax"; |
443 | lst << "HomeMobile"; | 445 | lst << "HomeMobile"; |
444 | lst << "BusinessStreet"; | 446 | lst << "BusinessStreet"; |
445 | lst << "BusinessCity"; | 447 | lst << "BusinessCity"; |
446 | lst << "BusinessZip"; | 448 | lst << "BusinessZip"; |
447 | lst << "BusinessCountry"; | 449 | lst << "BusinessCountry"; |
448 | lst << "BusinessState"; | 450 | lst << "BusinessState"; |
449 | lst << "Office"; | 451 | lst << "Office"; |
450 | lst << "Profession"; | 452 | lst << "Profession"; |
451 | lst << "Assistant"; | 453 | lst << "Assistant"; |
452 | lst << "Manager"; | 454 | lst << "Manager"; |
453 | lst << "HomeStreet"; | 455 | lst << "HomeStreet"; |
454 | lst << "HomeCity"; | 456 | lst << "HomeCity"; |
455 | lst << "HomeState"; | 457 | lst << "HomeState"; |
456 | lst << "HomeZip"; | 458 | lst << "HomeZip"; |
457 | lst << "HomeCountry"; | 459 | lst << "HomeCountry"; |
458 | lst << "HomeWebPage"; | 460 | lst << "HomeWebPage"; |
459 | lst << "Spouse"; | 461 | lst << "Spouse"; |
460 | lst << "Gender"; | 462 | lst << "Gender"; |
461 | lst << "Anniversary"; | 463 | lst << "Anniversary"; |
462 | lst << "Nickname"; | 464 | lst << "Nickname"; |
463 | lst << "Children"; | 465 | lst << "Children"; |
464 | lst << "Notes"; | 466 | lst << "Notes"; |
465 | lst << "Categories"; | 467 | lst << "Categories"; |
466 | lst << "Uid"; | 468 | lst << "Uid"; |
467 | lst << "Birthday"; | 469 | lst << "Birthday"; |
468 | 470 | ||
469 | return lst; | 471 | return lst; |
470 | } | 472 | } |
471 | 473 | ||
472 | 474 | ||
473 | 475 | ||
474 | #endif | 476 | #endif |
475 | 477 | ||
476 | 478 | ||
477 | CategoryEdit::CategoryEdit(){ | 479 | CategoryEdit::CategoryEdit(){ |
478 | } | 480 | } |
479 | CategoryEdit::CategoryEdit(const QString &fileName){ | 481 | CategoryEdit::CategoryEdit(const QString &fileName){ |
480 | parse( fileName ); | 482 | parse( fileName ); |
481 | } | 483 | } |
482 | CategoryEdit::~CategoryEdit(){ | 484 | CategoryEdit::~CategoryEdit(){ |
483 | } | 485 | } |
484 | void CategoryEdit::save(const QString& fileName)const{ | 486 | void CategoryEdit::save(const QString& fileName)const{ |
485 | QFile file( fileName ); | 487 | QFile file( fileName ); |
486 | QString endl = "\n"; | 488 | QString endl = "\n"; |
487 | if ( file.open( IO_WriteOnly ) ) { | 489 | if ( file.open( QIODevice::WriteOnly ) ) { |
488 | QTextStream stream( &file ); | 490 | Q3TextStream stream( &file ); |
489 | stream.setEncoding( QTextStream::UnicodeUTF8 ); | 491 | stream.setEncoding( Q3TextStream::UnicodeUTF8 ); |
490 | stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; | 492 | stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?>" << endl; |
491 | stream << "<!DOCTYPE CategoryList>" << endl; | 493 | stream << "<!DOCTYPE CategoryList>" << endl; |
492 | stream << "<Categories>" << endl; | 494 | stream << "<Categories>" << endl; |
493 | for ( QValueList<OpieCategories>::ConstIterator it = m_categories.begin(); | 495 | for ( Q3ValueList<OpieCategories>::ConstIterator it = m_categories.begin(); |
494 | it != m_categories.end(); ++it ) | 496 | it != m_categories.end(); ++it ) |
495 | { | 497 | { |
496 | stream << "<Category id=\""<< ( (*it).id() ) << "\" "; | 498 | stream << "<Category id=\""<< ( (*it).id() ) << "\" "; |
497 | 499 | ||
498 | if ( !(*it).app().isEmpty() ) | 500 | if ( !(*it).app().isEmpty() ) |
499 | stream << " app=\""<< ( (*it).app() ) << "\" "; | 501 | stream << " app=\""<< ( (*it).app() ) << "\" "; |
500 | 502 | ||
501 | stream << "name=\"" << ( (*it).name() ) << "\" "; | 503 | stream << "name=\"" << ( (*it).name() ) << "\" "; |
502 | stream << " />" << endl; | 504 | stream << " />" << endl; |
503 | } | 505 | } |
504 | stream << "</Categories>" << endl; | 506 | stream << "</Categories>" << endl; |
505 | file.close(); | 507 | file.close(); |
506 | } | 508 | } |
507 | } | 509 | } |
508 | int CategoryEdit::addCategory( const QString &name, int id ){ | 510 | int CategoryEdit::addCategory( const QString &name, int id ){ |
509 | return addCategory( QString::null, name, id ); | 511 | return addCategory( QString::null, name, id ); |
510 | } | 512 | } |
511 | int CategoryEdit::addCategory( const QString &appName, const QString &name, int id ){ | 513 | int CategoryEdit::addCategory( const QString &appName, const QString &name, int id ){ |
512 | if ( id == 0 ) { | 514 | if ( id == 0 ) { |
513 | // code from tt | 515 | // code from tt |
514 | //generate uid | 516 | //generate uid |
515 | QDateTime dt = QDateTime::currentDateTime(); | 517 | QDateTime dt = QDateTime::currentDateTime(); |
516 | id = -1 * (int) dt.secsTo( QDateTime(QDate( 2000,1,1)) ); | 518 | id = -1 * (int) dt.secsTo( QDateTime(QDate( 2000,1,1)) ); |
517 | while ( ids.contains( id ) ){ | 519 | while ( ids.contains( id ) ){ |
518 | id += -1; | 520 | id += -1; |
519 | if ( id > 0 ) | 521 | if ( id > 0 ) |
520 | id = -1; | 522 | id = -1; |
521 | } | 523 | } |
522 | } | 524 | } |
523 | ids.insert( id, TRUE ); | 525 | ids.insert( id, TRUE ); |
524 | OpieCategories categories(QString::number(id), name, appName); | 526 | OpieCategories categories(QString::number(id), name, appName); |
525 | //pending FIXME LR m_categories.remove( categories); | 527 | //pending FIXME LR m_categories.remove( categories); |
526 | m_categories.append( categories); | 528 | m_categories.append( categories); |
527 | return id; | 529 | return id; |
528 | } | 530 | } |
529 | /* | 531 | /* |
530 | * we parse the simple Category File here | 532 | * we parse the simple Category File here |
531 | * We also keep track of global Cats | 533 | * We also keep track of global Cats |
532 | * and Of Organizer and Contact cats and then | 534 | * and Of Organizer and Contact cats and then |
533 | * we will add them to the kde side... | 535 | * we will add them to the kde side... |
534 | */ | 536 | */ |
535 | void CategoryEdit::parse( const QString &tempFile ){ | 537 | void CategoryEdit::parse( const QString &tempFile ){ |
536 | clear(); | 538 | clear(); |
537 | 539 | ||
538 | QDomDocument doc( "mydocument" ); | 540 | QDomDocument doc( "mydocument" ); |
539 | QFile f( tempFile ); | 541 | QFile f( tempFile ); |
540 | if ( !f.open( IO_ReadOnly ) ) | 542 | if ( !f.open( QIODevice::ReadOnly ) ) |
541 | return; | 543 | return; |
542 | 544 | ||
543 | if ( !doc.setContent( &f ) ) { | 545 | if ( !doc.setContent( &f ) ) { |
544 | f.close(); | 546 | f.close(); |
545 | return; | 547 | return; |
546 | } | 548 | } |
547 | f.close(); | 549 | f.close(); |
548 | 550 | ||
549 | QStringList global, contact, organizer; | 551 | QStringList global, contact, organizer; |
550 | 552 | ||
551 | // print out the element names of all elements that are a direct child | 553 | // print out the element names of all elements that are a direct child |
552 | // of the outermost element. | 554 | // of the outermost element. |
553 | QDomElement docElem = doc.documentElement(); | 555 | QDomElement docElem = doc.documentElement(); |
554 | QDomNode n = docElem.firstChild(); | 556 | QDomNode n = docElem.firstChild(); |
555 | if( docElem.nodeName() == QString::fromLatin1("Categories") ){ | 557 | if( docElem.nodeName() == QString::fromLatin1("Categories") ){ |
556 | while( !n.isNull() ) { | 558 | while( !n.isNull() ) { |
557 | QDomElement e = n.toElement(); // try to convert the node to an element. | 559 | QDomElement e = n.toElement(); // try to convert the node to an element. |
558 | if( !e.isNull() ) { // the node was really an element. | 560 | if( !e.isNull() ) { // the node was really an element. |
559 | QString id = e.attribute("id" ); | 561 | QString id = e.attribute("id" ); |
560 | QString app = e.attribute("app" ); | 562 | QString app = e.attribute("app" ); |
561 | QString name = e.attribute("name"); | 563 | QString name = e.attribute("name"); |
562 | 564 | ||
563 | /* | 565 | /* |
564 | * see where it belongs default to global | 566 | * see where it belongs default to global |
565 | */ | 567 | */ |
566 | if (app == QString::fromLatin1("Calendar") || app == QString::fromLatin1("Todo List") ) | 568 | if (app == QString::fromLatin1("Calendar") || app == QString::fromLatin1("Todo List") ) |
567 | organizer.append( name ); | 569 | organizer.append( name ); |
568 | else if ( app == QString::fromLatin1("Contacts") ) | 570 | else if ( app == QString::fromLatin1("Contacts") ) |
569 | contact.append( name ); | 571 | contact.append( name ); |
570 | else | 572 | else |
571 | global.append( name ); | 573 | global.append( name ); |
572 | 574 | ||
573 | OpieCategories category( id, name, app ); | 575 | OpieCategories category( id, name, app ); |
574 | m_categories.append( category ); // cheater | 576 | m_categories.append( category ); // cheater |
575 | } | 577 | } |
576 | n = n.nextSibling(); | 578 | n = n.nextSibling(); |
577 | } | 579 | } |
578 | } | 580 | } |
579 | updateKDE( "kaddressbookrc", global + contact ); | 581 | updateKDE( "kaddressbookrc", global + contact ); |
580 | updateKDE( "korganizerrc", global + organizer ); | 582 | updateKDE( "korganizerrc", global + organizer ); |
581 | 583 | ||
582 | } | 584 | } |
583 | void CategoryEdit::clear() | 585 | void CategoryEdit::clear() |
584 | { | 586 | { |
585 | ids.clear(); | 587 | ids.clear(); |
586 | m_categories.clear(); | 588 | m_categories.clear(); |
587 | } | 589 | } |
588 | QString CategoryEdit::categoryById( const QString &id, const QString &app )const | 590 | QString CategoryEdit::categoryById( const QString &id, const QString &app )const |
589 | { | 591 | { |
590 | QValueList<OpieCategories>::ConstIterator it; | 592 | Q3ValueList<OpieCategories>::ConstIterator it; |
591 | QString category; | 593 | QString category; |
592 | QString fallback; | 594 | QString fallback; |
593 | for( it = m_categories.begin(); it != m_categories.end(); ++it ){ | 595 | for( it = m_categories.begin(); it != m_categories.end(); ++it ){ |
594 | if( id.stripWhiteSpace() == (*it).id().stripWhiteSpace() ){ | 596 | if( id.stripWhiteSpace() == (*it).id().stripWhiteSpace() ){ |
595 | if( app == (*it).app() ){ | 597 | if( app == (*it).app() ){ |
596 | category = (*it).name(); | 598 | category = (*it).name(); |
597 | break; | 599 | break; |
598 | }else{ | 600 | }else{ |
599 | fallback = (*it).name(); | 601 | fallback = (*it).name(); |
600 | } | 602 | } |
601 | } | 603 | } |
602 | } | 604 | } |
603 | return category.isEmpty() ? fallback : category; | 605 | return category.isEmpty() ? fallback : category; |
604 | } | 606 | } |
605 | QStringList CategoryEdit::categoriesByIds( const QStringList& ids, | 607 | QStringList CategoryEdit::categoriesByIds( const QStringList& ids, |
606 | const QString& app) { | 608 | const QString& app) { |
607 | 609 | ||
608 | QStringList list; | 610 | QStringList list; |
609 | QStringList::ConstIterator it; | 611 | QStringList::ConstIterator it; |
610 | QString temp; | 612 | QString temp; |
611 | for ( it = ids.begin(); it != ids.end(); ++it ) { | 613 | for ( it = ids.begin(); it != ids.end(); ++it ) { |
612 | temp = categoryById( (*it), app ); | 614 | temp = categoryById( (*it), app ); |
613 | if (!temp.isEmpty() ) | 615 | if (!temp.isEmpty() ) |
614 | list << temp; | 616 | list << temp; |
615 | } | 617 | } |
616 | 618 | ||
617 | return list; | 619 | return list; |
618 | } | 620 | } |
619 | void CategoryEdit::updateKDE( const QString& configFile, const QStringList& cats ) { | 621 | void CategoryEdit::updateKDE( const QString& configFile, const QStringList& cats ) { |
620 | KConfig conf(configFile); | 622 | KConfig conf(configFile); |
621 | conf.setGroup("General"); | 623 | conf.setGroup("General"); |
622 | QStringList avail = conf.readListEntry("Custom Categories"); | 624 | QStringList avail = conf.readListEntry("Custom Categories"); |
623 | for (QStringList::ConstIterator it = cats.begin(); it != cats.end(); ++it ) { | 625 | for (QStringList::ConstIterator it = cats.begin(); it != cats.end(); ++it ) { |
624 | if (!avail.contains( (*it) ) ) | 626 | if (!avail.contains( (*it) ) ) |
625 | avail << (*it); | 627 | avail << (*it); |
626 | } | 628 | } |
627 | conf.writeEntry("Custom Categories", avail ); | 629 | conf.writeEntry("Custom Categories", avail ); |
628 | } | 630 | } |
629 | 631 | ||
630 | 632 | ||
631 | 633 | ||
632 | OpieCategories::OpieCategories() | 634 | OpieCategories::OpieCategories() |
633 | { | 635 | { |
634 | 636 | ||
635 | } | 637 | } |
636 | OpieCategories::OpieCategories(const QString &id, const QString &name, const QString &app ) | 638 | OpieCategories::OpieCategories(const QString &id, const QString &name, const QString &app ) |
637 | { | 639 | { |
638 | m_name = name; | 640 | m_name = name; |
639 | m_id = id; | 641 | m_id = id; |
640 | m_app = app; | 642 | m_app = app; |
641 | } | 643 | } |
642 | OpieCategories::OpieCategories(const OpieCategories &op ) | 644 | OpieCategories::OpieCategories(const OpieCategories &op ) |
643 | { | 645 | { |
644 | (*this) = op; | 646 | (*this) = op; |
645 | } | 647 | } |
646 | QString OpieCategories::id() const | 648 | QString OpieCategories::id() const |
647 | { | 649 | { |
648 | return m_id; | 650 | return m_id; |
649 | } | 651 | } |
650 | QString OpieCategories::name() const | 652 | QString OpieCategories::name() const |
651 | { | 653 | { |
652 | return m_name; | 654 | return m_name; |
653 | } | 655 | } |
654 | QString OpieCategories::app() const | 656 | QString OpieCategories::app() const |
655 | { | 657 | { |
656 | return m_app; | 658 | return m_app; |
657 | } | 659 | } |
658 | OpieCategories &OpieCategories::operator=(const OpieCategories &op ) | 660 | OpieCategories &OpieCategories::operator=(const OpieCategories &op ) |
659 | { | 661 | { |
660 | m_name = op.m_name; | 662 | m_name = op.m_name; |
661 | m_app = op.m_app; | 663 | m_app = op.m_app; |
662 | m_id = op.m_id; | 664 | m_id = op.m_id; |
663 | return (*this); | 665 | return (*this); |
664 | } | 666 | } |
665 | 667 | ||
666 | 668 | ||
667 | bool operator== (const OpieCategories& a, const OpieCategories &b ) | 669 | bool operator== (const OpieCategories& a, const OpieCategories &b ) |
668 | { | 670 | { |
669 | if ( a.id() == b.id() && a.name() == b.name() && a.app() == b.app() ) | 671 | if ( a.id() == b.id() && a.name() == b.name() && a.app() == b.app() ) |
670 | return true; | 672 | return true; |
671 | return false; | 673 | return false; |
672 | } | 674 | } |
673 | 675 | ||
diff --git a/kabc/plugins/qtopia/qtopiaconverter.h b/kabc/plugins/qtopia/qtopiaconverter.h index 744dd41..389926c 100644 --- a/kabc/plugins/qtopia/qtopiaconverter.h +++ b/kabc/plugins/qtopia/qtopiaconverter.h | |||
@@ -1,133 +1,136 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | $Id$ | 24 | $Id$ |
25 | */ | 25 | */ |
26 | 26 | ||
27 | #ifndef KABC_QTOPIACONVERTER_H | 27 | #ifndef KABC_QTOPIACONVERTER_H |
28 | #define KABC_QTOPIACONVERTER_H | 28 | #define KABC_QTOPIACONVERTER_H |
29 | 29 | ||
30 | #include <qstring.h> | 30 | #include <qstring.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3ValueList> | ||
33 | #include <Q3TextStream> | ||
31 | 34 | ||
32 | #include "addressee.h" | 35 | #include "addressee.h" |
33 | #ifdef DESKTOP_VERSION | 36 | #ifdef DESKTOP_VERSION |
34 | #include <qdom.h> | 37 | #include <qdom.h> |
35 | #else | 38 | #else |
36 | #include <xml/qdom.h> | 39 | #include <xml/qdom.h> |
37 | #endif | 40 | #endif |
38 | class Categories; | 41 | class Categories; |
39 | 42 | ||
40 | namespace KABC { | 43 | namespace KABC { |
41 | 44 | ||
42 | 45 | ||
43 | 46 | ||
44 | class OpieCategories { | 47 | class OpieCategories { |
45 | public: | 48 | public: |
46 | //friend class KSync::OpieSocket; | 49 | //friend class KSync::OpieSocket; |
47 | friend bool operator== ( const OpieCategories &a, const OpieCategories &b ); | 50 | friend bool operator== ( const OpieCategories &a, const OpieCategories &b ); |
48 | OpieCategories(); | 51 | OpieCategories(); |
49 | OpieCategories(const QString &id, const QString &name, const QString &app ); | 52 | OpieCategories(const QString &id, const QString &name, const QString &app ); |
50 | OpieCategories(const OpieCategories & ); | 53 | OpieCategories(const OpieCategories & ); |
51 | ~OpieCategories() {}; | 54 | ~OpieCategories() {}; |
52 | OpieCategories &operator=(const OpieCategories & ); | 55 | OpieCategories &operator=(const OpieCategories & ); |
53 | QString id()const; | 56 | QString id()const; |
54 | QString name()const; | 57 | QString name()const; |
55 | QString app()const; | 58 | QString app()const; |
56 | 59 | ||
57 | private: | 60 | private: |
58 | QString m_name; | 61 | QString m_name; |
59 | QString m_app; | 62 | QString m_app; |
60 | QString m_id; | 63 | QString m_id; |
61 | }; | 64 | }; |
62 | 65 | ||
63 | 66 | ||
64 | class CategoryEdit { | 67 | class CategoryEdit { |
65 | public: | 68 | public: |
66 | CategoryEdit(); | 69 | CategoryEdit(); |
67 | CategoryEdit(const QString &fileName); | 70 | CategoryEdit(const QString &fileName); |
68 | ~CategoryEdit(); | 71 | ~CategoryEdit(); |
69 | 72 | ||
70 | void save(const QString&) const; | 73 | void save(const QString&) const; |
71 | int addCategory( const QString &name, int id = 0 ); | 74 | int addCategory( const QString &name, int id = 0 ); |
72 | int addCategory(const QString &appName, const QString &name, int id = 0); | 75 | int addCategory(const QString &appName, const QString &name, int id = 0); |
73 | void parse( const QString &fileName ); | 76 | void parse( const QString &fileName ); |
74 | 77 | ||
75 | QString categoryById(const QString &id, const QString &app )const; | 78 | QString categoryById(const QString &id, const QString &app )const; |
76 | QStringList categoriesByIds( const QStringList& ids, const QString& app ); | 79 | QStringList categoriesByIds( const QStringList& ids, const QString& app ); |
77 | 80 | ||
78 | void clear(); | 81 | void clear(); |
79 | QValueList<OpieCategories> categories()const { return m_categories; }; | 82 | Q3ValueList<OpieCategories> categories()const { return m_categories; }; |
80 | private: | 83 | private: |
81 | /** | 84 | /** |
82 | * this function will be used internally to update the kde categories... | 85 | * this function will be used internally to update the kde categories... |
83 | */ | 86 | */ |
84 | void updateKDE( const QString& app, const QStringList& categories ); | 87 | void updateKDE( const QString& app, const QStringList& categories ); |
85 | QMap<int, bool> ids; // from tt Qtopia::UidGen | 88 | QMap<int, bool> ids; // from tt Qtopia::UidGen |
86 | QValueList<OpieCategories> m_categories; | 89 | Q3ValueList<OpieCategories> m_categories; |
87 | }; | 90 | }; |
88 | 91 | ||
89 | 92 | ||
90 | class QtopiaConverter | 93 | class QtopiaConverter |
91 | { | 94 | { |
92 | public: | 95 | public: |
93 | 96 | ||
94 | /** | 97 | /** |
95 | * Constructor. | 98 | * Constructor. |
96 | */ | 99 | */ |
97 | QtopiaConverter(); | 100 | QtopiaConverter(); |
98 | 101 | ||
99 | /** | 102 | /** |
100 | * Destructor. | 103 | * Destructor. |
101 | */ | 104 | */ |
102 | virtual ~QtopiaConverter(); | 105 | virtual ~QtopiaConverter(); |
103 | 106 | ||
104 | bool init(); | 107 | bool init(); |
105 | void deinit(); | 108 | void deinit(); |
106 | 109 | ||
107 | /** | 110 | /** |
108 | * Converts a vcard string to an addressee. | 111 | * Converts a vcard string to an addressee. |
109 | * | 112 | * |
110 | * @param contact The qtopia contact. | 113 | * @param contact The qtopia contact. |
111 | * @param addr The addressee. | 114 | * @param addr The addressee. |
112 | */ | 115 | */ |
113 | bool qtopiaToAddressee( const QDomElement& el, Addressee &adr ); | 116 | bool qtopiaToAddressee( const QDomElement& el, Addressee &adr ); |
114 | /** | 117 | /** |
115 | * Converts an addressee to a vcard string. | 118 | * Converts an addressee to a vcard string. |
116 | * | 119 | * |
117 | * @param addr The addressee. | 120 | * @param addr The addressee. |
118 | * @param contact The qtopia contact. | 121 | * @param contact The qtopia contact. |
119 | */ | 122 | */ |
120 | bool addresseeToQtopia( const Addressee &ab, QTextStream *stream ); | 123 | bool addresseeToQtopia( const Addressee &ab, Q3TextStream *stream ); |
121 | 124 | ||
122 | private: | 125 | private: |
123 | QString categoriesToNumber( const QStringList &list, const QString &app ); | 126 | QString categoriesToNumber( const QStringList &list, const QString &app ); |
124 | QString escape( const QString& s){ return s;}; | 127 | QString escape( const QString& s){ return s;}; |
125 | CategoryEdit *m_edit; | 128 | CategoryEdit *m_edit; |
126 | QDate fromString( const QString& ); | 129 | QDate fromString( const QString& ); |
127 | QDate dateFromString( const QString& ); | 130 | QDate dateFromString( const QString& ); |
128 | QString dateToString( const QDate& ); | 131 | QString dateToString( const QDate& ); |
129 | 132 | ||
130 | 133 | ||
131 | }; | 134 | }; |
132 | } | 135 | } |
133 | #endif | 136 | #endif |
diff --git a/kabc/plugins/qtopia/resourceqtopia.cpp b/kabc/plugins/qtopia/resourceqtopia.cpp index 79ddaea..a36eb8f 100644 --- a/kabc/plugins/qtopia/resourceqtopia.cpp +++ b/kabc/plugins/qtopia/resourceqtopia.cpp | |||
@@ -1,336 +1,336 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | #include <sys/types.h> | 27 | #include <sys/types.h> |
28 | #include <sys/stat.h> | 28 | #include <sys/stat.h> |
29 | #ifndef _WIN32_ | 29 | #ifndef _WIN32_ |
30 | #include <unistd.h> | 30 | #include <unistd.h> |
31 | #endif | 31 | #endif |
32 | #include <qdir.h> | 32 | #include <qdir.h> |
33 | #include <qfile.h> | 33 | #include <qfile.h> |
34 | #include <qtextstream.h> | 34 | #include <q3textstream.h> |
35 | #include <qfileinfo.h> | 35 | #include <qfileinfo.h> |
36 | #include <qregexp.h> | 36 | #include <qregexp.h> |
37 | //US #include <qtimer.h> | 37 | //US #include <qtimer.h> |
38 | 38 | ||
39 | #include <kapplication.h> | 39 | #include <kapplication.h> |
40 | #include <kconfig.h> | 40 | #include <kconfig.h> |
41 | #include <kdebug.h> | 41 | #include <kdebug.h> |
42 | #include <klocale.h> | 42 | #include <klocale.h> |
43 | //US #include <ksavefile.h> | 43 | //US #include <ksavefile.h> |
44 | #include <kstandarddirs.h> | 44 | #include <kstandarddirs.h> |
45 | #include <kmessagebox.h> | 45 | #include <kmessagebox.h> |
46 | 46 | ||
47 | 47 | ||
48 | #include "resourceqtopiaconfig.h" | 48 | #include "resourceqtopiaconfig.h" |
49 | #include "stdaddressbook.h" | 49 | #include "stdaddressbook.h" |
50 | 50 | ||
51 | #include "qtopiaconverter.h" | 51 | #include "qtopiaconverter.h" |
52 | 52 | ||
53 | #include "resourceqtopia.h" | 53 | #include "resourceqtopia.h" |
54 | 54 | ||
55 | using namespace KABC; | 55 | using namespace KABC; |
56 | 56 | ||
57 | extern "C" | 57 | extern "C" |
58 | #ifdef _WIN32_ | 58 | #ifdef _WIN32_ |
59 | __declspec(dllexport) | 59 | __declspec(dllexport) |
60 | #else | 60 | #else |
61 | { | 61 | { |
62 | #endif | 62 | #endif |
63 | void *init_microkabc_qtopia() | 63 | void *init_microkabc_qtopia() |
64 | { | 64 | { |
65 | return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>(); | 65 | return new KRES::PluginFactory<ResourceQtopia,ResourceQtopiaConfig>(); |
66 | } | 66 | } |
67 | #ifndef _WIN32_ | 67 | #ifndef _WIN32_ |
68 | } | 68 | } |
69 | #endif | 69 | #endif |
70 | 70 | ||
71 | ResourceQtopia::ResourceQtopia( const KConfig *config ) | 71 | ResourceQtopia::ResourceQtopia( const KConfig *config ) |
72 | : Resource( config ), mConverter (0) | 72 | : Resource( config ), mConverter (0) |
73 | { | 73 | { |
74 | // we can not choose the filename. Therefore use the default to display | 74 | // we can not choose the filename. Therefore use the default to display |
75 | QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; | 75 | QString fileName = QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml"; |
76 | init( fileName ); | 76 | init( fileName ); |
77 | } | 77 | } |
78 | 78 | ||
79 | ResourceQtopia::ResourceQtopia( const QString &fileName ) | 79 | ResourceQtopia::ResourceQtopia( const QString &fileName ) |
80 | : Resource( 0 ) | 80 | : Resource( 0 ) |
81 | { | 81 | { |
82 | init( fileName ); | 82 | init( fileName ); |
83 | } | 83 | } |
84 | 84 | ||
85 | void ResourceQtopia::init( const QString &fileName ) | 85 | void ResourceQtopia::init( const QString &fileName ) |
86 | { | 86 | { |
87 | #ifdef _USE_DIRWATCH_ | 87 | #ifdef _USE_DIRWATCH_ |
88 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); | 88 | connect( &mDirWatch, SIGNAL( dirty(const QString&) ), SLOT( fileChanged() ) ); |
89 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); | 89 | connect( &mDirWatch, SIGNAL( created(const QString&) ), SLOT( fileChanged() ) ); |
90 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); | 90 | connect( &mDirWatch, SIGNAL( deleted(const QString&) ), SLOT( fileChanged() ) ); |
91 | #endif | 91 | #endif |
92 | setFileName( fileName ); | 92 | setFileName( fileName ); |
93 | } | 93 | } |
94 | 94 | ||
95 | ResourceQtopia::~ResourceQtopia() | 95 | ResourceQtopia::~ResourceQtopia() |
96 | { | 96 | { |
97 | if (mConverter != 0) | 97 | if (mConverter != 0) |
98 | delete mConverter; | 98 | delete mConverter; |
99 | 99 | ||
100 | } | 100 | } |
101 | 101 | ||
102 | void ResourceQtopia::writeConfig( KConfig *config ) | 102 | void ResourceQtopia::writeConfig( KConfig *config ) |
103 | { | 103 | { |
104 | Resource::writeConfig( config ); | 104 | Resource::writeConfig( config ); |
105 | } | 105 | } |
106 | 106 | ||
107 | Ticket *ResourceQtopia::requestSaveTicket() | 107 | Ticket *ResourceQtopia::requestSaveTicket() |
108 | { | 108 | { |
109 | kdDebug(5700) << "ResourceQtopia::requestSaveTicket()" << endl; | 109 | kdDebug(5700) << "ResourceQtopia::requestSaveTicket()" << endl; |
110 | 110 | ||
111 | qDebug("ResourceQtopia::requestSaveTicket: %s", fileName().latin1()); | 111 | qDebug("ResourceQtopia::requestSaveTicket: %s", fileName().latin1()); |
112 | 112 | ||
113 | if ( !addressBook() ) return 0; | 113 | if ( !addressBook() ) return 0; |
114 | 114 | ||
115 | if ( !lock( fileName() ) ) { | 115 | if ( !lock( fileName() ) ) { |
116 | kdDebug(5700) << "ResourceQtopia::requestSaveTicket(): Unable to lock file '" | 116 | kdDebug(5700) << "ResourceQtopia::requestSaveTicket(): Unable to lock file '" |
117 | << fileName() << "'" << endl; | 117 | << fileName() << "'" << endl; |
118 | return 0; | 118 | return 0; |
119 | } | 119 | } |
120 | return createTicket( this ); | 120 | return createTicket( this ); |
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | bool ResourceQtopia::doOpen() | 124 | bool ResourceQtopia::doOpen() |
125 | { | 125 | { |
126 | qDebug("ResourceQtopia::doOpen(): %s", fileName().latin1()); | 126 | qDebug("ResourceQtopia::doOpen(): %s", fileName().latin1()); |
127 | 127 | ||
128 | 128 | ||
129 | if (mConverter == 0) | 129 | if (mConverter == 0) |
130 | { | 130 | { |
131 | mConverter = new QtopiaConverter(); | 131 | mConverter = new QtopiaConverter(); |
132 | bool res = mConverter->init(); | 132 | bool res = mConverter->init(); |
133 | if ( !res ) | 133 | if ( !res ) |
134 | { | 134 | { |
135 | QString msg("Unable to initialize qtopia converter. Most likely a problem with the category file"); | 135 | QString msg("Unable to initialize qtopia converter. Most likely a problem with the category file"); |
136 | qDebug(msg); | 136 | qDebug(msg); |
137 | return false; | 137 | return false; |
138 | } | 138 | } |
139 | } | 139 | } |
140 | 140 | ||
141 | return true; | 141 | return true; |
142 | } | 142 | } |
143 | 143 | ||
144 | void ResourceQtopia::doClose() | 144 | void ResourceQtopia::doClose() |
145 | { | 145 | { |
146 | qDebug("ResourceQtopia::doClose: %s", fileName().latin1()); | 146 | qDebug("ResourceQtopia::doClose: %s", fileName().latin1()); |
147 | 147 | ||
148 | 148 | ||
149 | // it seems so, that deletion of access deletes backend as well | 149 | // it seems so, that deletion of access deletes backend as well |
150 | //delete backend; | 150 | //delete backend; |
151 | 151 | ||
152 | return; | 152 | return; |
153 | } | 153 | } |
154 | 154 | ||
155 | bool ResourceQtopia::load() | 155 | bool ResourceQtopia::load() |
156 | { | 156 | { |
157 | 157 | ||
158 | QFile file( fileName() ); | 158 | QFile file( fileName() ); |
159 | if ( !file.open(IO_ReadOnly ) ) { | 159 | if ( !file.open(QIODevice::ReadOnly ) ) { |
160 | return false; | 160 | return false; |
161 | } | 161 | } |
162 | 162 | ||
163 | QDomDocument doc("mydocument" ); | 163 | QDomDocument doc("mydocument" ); |
164 | if ( !doc.setContent( &file ) ) { | 164 | if ( !doc.setContent( &file ) ) { |
165 | file.close(); | 165 | file.close(); |
166 | return false; | 166 | return false; |
167 | } | 167 | } |
168 | bool res; | 168 | bool res; |
169 | QDomElement docElem = doc.documentElement( ); | 169 | QDomElement docElem = doc.documentElement( ); |
170 | QDomNode n = docElem.firstChild(); | 170 | QDomNode n = docElem.firstChild(); |
171 | while ( !n.isNull() ) { | 171 | while ( !n.isNull() ) { |
172 | QDomElement e = n.toElement(); | 172 | QDomElement e = n.toElement(); |
173 | if ( !e.isNull() ) { | 173 | if ( !e.isNull() ) { |
174 | if ( e.tagName() == QString::fromLatin1( "Contacts" ) ) { | 174 | if ( e.tagName() == QString::fromLatin1( "Contacts" ) ) { |
175 | QDomNode no = e.firstChild(); | 175 | QDomNode no = e.firstChild(); |
176 | while ( !no.isNull() ) { | 176 | while ( !no.isNull() ) { |
177 | QDomElement el = no.toElement(); | 177 | QDomElement el = no.toElement(); |
178 | if ( !el.isNull() ) { | 178 | if ( !el.isNull() ) { |
179 | KABC::Addressee addressee; | 179 | KABC::Addressee addressee; |
180 | res = mConverter->qtopiaToAddressee( el, addressee ); | 180 | res = mConverter->qtopiaToAddressee( el, addressee ); |
181 | if ( !addressee.isEmpty() && res ) | 181 | if ( !addressee.isEmpty() && res ) |
182 | { | 182 | { |
183 | addressee.setResource( this ); | 183 | addressee.setResource( this ); |
184 | addressBook()->insertAddressee( addressee ); | 184 | addressBook()->insertAddressee( addressee ); |
185 | } | 185 | } |
186 | } | 186 | } |
187 | 187 | ||
188 | no = no.nextSibling(); | 188 | no = no.nextSibling(); |
189 | } | 189 | } |
190 | } | 190 | } |
191 | } | 191 | } |
192 | 192 | ||
193 | n = n.nextSibling(); | 193 | n = n.nextSibling(); |
194 | } | 194 | } |
195 | return true; | 195 | return true; |
196 | } | 196 | } |
197 | 197 | ||
198 | bool ResourceQtopia::save( Ticket *ticket ) | 198 | bool ResourceQtopia::save( Ticket *ticket ) |
199 | { | 199 | { |
200 | #ifdef _USE_DIRWATCH_ | 200 | #ifdef _USE_DIRWATCH_ |
201 | mDirWatch.stopScan(); | 201 | mDirWatch.stopScan(); |
202 | #endif | 202 | #endif |
203 | KABC::AddressBook::Iterator it; | 203 | KABC::AddressBook::Iterator it; |
204 | bool res; | 204 | bool res; |
205 | QFile file( fileName() ); | 205 | QFile file( fileName() ); |
206 | if (!file.open( IO_WriteOnly ) ) { | 206 | if (!file.open( QIODevice::WriteOnly ) ) { |
207 | return false; | 207 | return false; |
208 | } | 208 | } |
209 | QTextStream ts( &file ); | 209 | Q3TextStream ts( &file ); |
210 | QTextStream *stream = &ts; | 210 | Q3TextStream *stream = &ts; |
211 | stream->setEncoding( QTextStream::UnicodeUTF8 ); | 211 | stream->setEncoding( Q3TextStream::UnicodeUTF8 ); |
212 | *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl; | 212 | *stream << "<?xml version=\"1.0\" encoding=\"UTF-8\"?><!DOCTYPE Addressbook ><AddressBook>" << endl; |
213 | *stream << " <Groups>" << endl; | 213 | *stream << " <Groups>" << endl; |
214 | *stream << " </Groups>" << endl; | 214 | *stream << " </Groups>" << endl; |
215 | *stream << " <Contacts> " << endl; | 215 | *stream << " <Contacts> " << endl; |
216 | // for all entries | 216 | // for all entries |
217 | KABC::Addressee ab; | 217 | KABC::Addressee ab; |
218 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { | 218 | for ( it = addressBook()->begin(); it != addressBook()->end(); ++it ) { |
219 | KABC::Addressee addressee = (*it); | 219 | KABC::Addressee addressee = (*it); |
220 | res = mConverter->addresseeToQtopia( addressee, stream ); | 220 | res = mConverter->addresseeToQtopia( addressee, stream ); |
221 | if (!res == true) | 221 | if (!res == true) |
222 | { | 222 | { |
223 | qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); | 223 | qDebug("Unable to convert Addressee %s", addressee.formattedName().latin1()); |
224 | } | 224 | } |
225 | } | 225 | } |
226 | *stream << "</Contacts>" << endl; | 226 | *stream << "</Contacts>" << endl; |
227 | *stream << "</AddressBook>" << endl; | 227 | *stream << "</AddressBook>" << endl; |
228 | file.close(); | 228 | file.close(); |
229 | #ifdef _USE_DIRWATCH_ | 229 | #ifdef _USE_DIRWATCH_ |
230 | mDirWatch.startScan(); | 230 | mDirWatch.startScan(); |
231 | #endif | 231 | #endif |
232 | delete ticket; | 232 | delete ticket; |
233 | unlock( fileName() ); | 233 | unlock( fileName() ); |
234 | return true; | 234 | return true; |
235 | } | 235 | } |
236 | 236 | ||
237 | bool ResourceQtopia::lock( const QString &lockfileName ) | 237 | bool ResourceQtopia::lock( const QString &lockfileName ) |
238 | { | 238 | { |
239 | //disabled | 239 | //disabled |
240 | return true; | 240 | return true; |
241 | qDebug("ResourceQtopia::lock: %s", fileName().latin1()); | 241 | qDebug("ResourceQtopia::lock: %s", fileName().latin1()); |
242 | QString fn = lockfileName; | 242 | QString fn = lockfileName; |
243 | 243 | ||
244 | KURL url(fn); | 244 | KURL url(fn); |
245 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 245 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
246 | 246 | ||
247 | if (QFile::exists( lockName )) | 247 | if (QFile::exists( lockName )) |
248 | { | 248 | { |
249 | qDebug("ResourceOpie::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName().latin1()); | 249 | qDebug("ResourceOpie::lock: lockfile %s already exists. (Delete it before continuing if nobody else is accessing the resourcefile %s)", lockName.latin1(), fileName().latin1()); |
250 | return false; | 250 | return false; |
251 | } | 251 | } |
252 | 252 | ||
253 | QString lockUniqueName; | 253 | QString lockUniqueName; |
254 | lockUniqueName = fn + KApplication::randomString( 8 ); | 254 | lockUniqueName = fn + KApplication::randomString( 8 ); |
255 | 255 | ||
256 | url = lockUniqueName; | 256 | url = lockUniqueName; |
257 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); | 257 | //US mLockUniqueName = locateLocal( "data", "kabc/lock/" + lockUniqueName ); |
258 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); | 258 | mLockUniqueName = locateLocal( "data", "kabc/lock/" + url.fileName() ); |
259 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; | 259 | kdDebug(5700) << "-- lock unique name: " << mLockUniqueName << endl; |
260 | 260 | ||
261 | // Create unique file | 261 | // Create unique file |
262 | QFile file( mLockUniqueName ); | 262 | QFile file( mLockUniqueName ); |
263 | file.open( IO_WriteOnly ); | 263 | file.open( QIODevice::WriteOnly ); |
264 | file.close(); | 264 | file.close(); |
265 | 265 | ||
266 | // Create lock file | 266 | // Create lock file |
267 | int result = 0; | 267 | int result = 0; |
268 | #ifndef _WIN32_ | 268 | #ifndef _WIN32_ |
269 | result = ::link( QFile::encodeName( mLockUniqueName ), | 269 | result = ::link( QFile::encodeName( mLockUniqueName ), |
270 | QFile::encodeName( lockName ) ); | 270 | QFile::encodeName( lockName ) ); |
271 | #endif | 271 | #endif |
272 | if ( result == 0 ) { | 272 | if ( result == 0 ) { |
273 | addressBook()->emitAddressBookLocked(); | 273 | addressBook()->emitAddressBookLocked(); |
274 | return true; | 274 | return true; |
275 | } | 275 | } |
276 | 276 | ||
277 | // TODO: check stat | 277 | // TODO: check stat |
278 | 278 | ||
279 | return false; | 279 | return false; |
280 | } | 280 | } |
281 | 281 | ||
282 | void ResourceQtopia::unlock( const QString &fileName ) | 282 | void ResourceQtopia::unlock( const QString &fileName ) |
283 | { | 283 | { |
284 | //disabled | 284 | //disabled |
285 | return; | 285 | return; |
286 | qDebug("ResourceQtopia::unlock() %s", fileName.latin1()); | 286 | qDebug("ResourceQtopia::unlock() %s", fileName.latin1()); |
287 | 287 | ||
288 | QString fn = fileName; | 288 | QString fn = fileName; |
289 | KURL url(fn); | 289 | KURL url(fn); |
290 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); | 290 | QString lockName = locateLocal( "data", "kabc/lock/" + url.fileName() + ".lock" ); |
291 | 291 | ||
292 | QFile::remove( lockName ); | 292 | QFile::remove( lockName ); |
293 | QFile::remove( mLockUniqueName ); | 293 | QFile::remove( mLockUniqueName ); |
294 | addressBook()->emitAddressBookUnlocked(); | 294 | addressBook()->emitAddressBookUnlocked(); |
295 | } | 295 | } |
296 | 296 | ||
297 | void ResourceQtopia::setFileName( const QString &newFileName ) | 297 | void ResourceQtopia::setFileName( const QString &newFileName ) |
298 | { | 298 | { |
299 | #ifdef _USE_DIRWATCH_ | 299 | #ifdef _USE_DIRWATCH_ |
300 | mDirWatch.stopScan(); | 300 | mDirWatch.stopScan(); |
301 | #endif | 301 | #endif |
302 | mDirWatch.removeFile( fileName() ); | 302 | mDirWatch.removeFile( fileName() ); |
303 | 303 | ||
304 | Resource::setFileName( newFileName ); | 304 | Resource::setFileName( newFileName ); |
305 | 305 | ||
306 | mDirWatch.addFile( fileName() ); | 306 | mDirWatch.addFile( fileName() ); |
307 | #ifdef _USE_DIRWATCH_ | 307 | #ifdef _USE_DIRWATCH_ |
308 | mDirWatch.startScan(); | 308 | mDirWatch.startScan(); |
309 | #endif | 309 | #endif |
310 | } | 310 | } |
311 | 311 | ||
312 | 312 | ||
313 | void ResourceQtopia::fileChanged() | 313 | void ResourceQtopia::fileChanged() |
314 | { | 314 | { |
315 | // There is a small theoretical chance that KDirWatch calls us before | 315 | // There is a small theoretical chance that KDirWatch calls us before |
316 | // we are fully constructed | 316 | // we are fully constructed |
317 | if (!addressBook()) | 317 | if (!addressBook()) |
318 | return; | 318 | return; |
319 | 319 | ||
320 | QString text( i18n( "Qtopia resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) ); | 320 | QString text( i18n( "Qtopia resource '%1'<br> has been changed by third party.<br>Do you want to reload?").arg( fileName() ) ); |
321 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { | 321 | if ( readOnly() || KMessageBox::questionYesNo( 0, text ) == KMessageBox::Yes ) { |
322 | load(); | 322 | load(); |
323 | addressBook()->emitAddressBookChanged(); | 323 | addressBook()->emitAddressBookChanged(); |
324 | } | 324 | } |
325 | } | 325 | } |
326 | 326 | ||
327 | void ResourceQtopia::removeAddressee( const Addressee &addr ) | 327 | void ResourceQtopia::removeAddressee( const Addressee &addr ) |
328 | { | 328 | { |
329 | } | 329 | } |
330 | 330 | ||
331 | void ResourceQtopia::cleanUp() | 331 | void ResourceQtopia::cleanUp() |
332 | { | 332 | { |
333 | unlock( fileName() ); | 333 | unlock( fileName() ); |
334 | } | 334 | } |
335 | 335 | ||
336 | //US #include "resourceqtopia.moc" | 336 | //US #include "resourceqtopia.moc" |
diff --git a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp index d5d6141..42fd428 100644 --- a/kabc/plugins/qtopia/resourceqtopiaconfig.cpp +++ b/kabc/plugins/qtopia/resourceqtopiaconfig.cpp | |||
@@ -1,107 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qlabel.h> | 28 | #include <qlabel.h> |
29 | #include <qlayout.h> | 29 | #include <qlayout.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3GridLayout> | ||
30 | 32 | ||
31 | #include <kdebug.h> | 33 | #include <kdebug.h> |
32 | #include <klocale.h> | 34 | #include <klocale.h> |
33 | #include <kstandarddirs.h> | 35 | #include <kstandarddirs.h> |
34 | #include <kdialog.h> | 36 | #include <kdialog.h> |
35 | 37 | ||
36 | //#include <unistd.h> | 38 | //#include <unistd.h> |
37 | 39 | ||
38 | #include <qdir.h> | 40 | #include <qdir.h> |
39 | #include <qfile.h> | 41 | #include <qfile.h> |
40 | #include "resourceqtopia.h" | 42 | #include "resourceqtopia.h" |
41 | 43 | ||
42 | #include "resourceqtopiaconfig.h" | 44 | #include "resourceqtopiaconfig.h" |
43 | 45 | ||
44 | using namespace KABC; | 46 | using namespace KABC; |
45 | 47 | ||
46 | ResourceQtopiaConfig::ResourceQtopiaConfig( QWidget* parent, const char* name ) | 48 | ResourceQtopiaConfig::ResourceQtopiaConfig( QWidget* parent, const char* name ) |
47 | : ConfigWidget( parent, name ) | 49 | : ConfigWidget( parent, name ) |
48 | { | 50 | { |
49 | QGridLayout *mainLayout = new QGridLayout( this, 1, 2, 0, | 51 | Q3GridLayout *mainLayout = new Q3GridLayout( this, 1, 2, 0, |
50 | KDialog::spacingHint() ); | 52 | KDialog::spacingHint() ); |
51 | 53 | ||
52 | QLabel *label = new QLabel( i18n( "Location:" ), this ); | 54 | QLabel *label = new QLabel( i18n( "Location:" ), this ); |
53 | mFileNameEdit = new KURLRequester( this ); | 55 | mFileNameEdit = new KURLRequester( this ); |
54 | 56 | ||
55 | connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), | 57 | connect( mFileNameEdit, SIGNAL( textChanged( const QString & ) ), |
56 | SLOT( checkFilePermissions( const QString & ) ) ); | 58 | SLOT( checkFilePermissions( const QString & ) ) ); |
57 | 59 | ||
58 | mainLayout->addWidget( label, 0, 0 ); | 60 | mainLayout->addWidget( label, 0, 0 ); |
59 | mainLayout->addWidget( mFileNameEdit, 0, 1 ); | 61 | mainLayout->addWidget( mFileNameEdit, 0, 1 ); |
60 | 62 | ||
61 | } | 63 | } |
62 | 64 | ||
63 | void ResourceQtopiaConfig::loadSettings( KRES::Resource *res ) | 65 | void ResourceQtopiaConfig::loadSettings( KRES::Resource *res ) |
64 | { | 66 | { |
65 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); | 67 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); |
66 | ResourceQtopia *resource = (ResourceQtopia*)( res ); | 68 | ResourceQtopia *resource = (ResourceQtopia*)( res ); |
67 | 69 | ||
68 | if ( !resource ) { | 70 | if ( !resource ) { |
69 | kdDebug(5700) << "ResourceQtopiaConfig::loadSettings(): cast failed" << endl; | 71 | kdDebug(5700) << "ResourceQtopiaConfig::loadSettings(): cast failed" << endl; |
70 | return; | 72 | return; |
71 | } | 73 | } |
72 | 74 | ||
73 | mFileNameEdit->setURL( resource->fileName() ); | 75 | mFileNameEdit->setURL( resource->fileName() ); |
74 | if ( mFileNameEdit->url().isEmpty() ) | 76 | if ( mFileNameEdit->url().isEmpty() ) |
75 | mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" ); | 77 | mFileNameEdit->setURL( QDir::homeDirPath() + "/Applications/addressbook/addressbook.xml" ); |
76 | 78 | ||
77 | //US Qtopia resources are ReadOnly by definition | 79 | //US Qtopia resources are ReadOnly by definition |
78 | emit setPersistentReadOnly( true ); | 80 | emit setPersistentReadOnly( true ); |
79 | 81 | ||
80 | //US we can not choose the filename for the qtopia backend => make it readonly. | 82 | //US we can not choose the filename for the qtopia backend => make it readonly. |
81 | mFileNameEdit->setEnabled( false ); | 83 | mFileNameEdit->setEnabled( false ); |
82 | 84 | ||
83 | } | 85 | } |
84 | 86 | ||
85 | void ResourceQtopiaConfig::saveSettings( KRES::Resource *res ) | 87 | void ResourceQtopiaConfig::saveSettings( KRES::Resource *res ) |
86 | { | 88 | { |
87 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); | 89 | //US ResourceFile *resource = dynamic_cast<ResourceFile*>( res ); |
88 | ResourceQtopia *resource = (ResourceQtopia*)( res ); | 90 | ResourceQtopia *resource = (ResourceQtopia*)( res ); |
89 | 91 | ||
90 | if ( !resource ) { | 92 | if ( !resource ) { |
91 | kdDebug(5700) << "ResourceQtopiaConfig::saveSettings(): cast failed" << endl; | 93 | kdDebug(5700) << "ResourceQtopiaConfig::saveSettings(): cast failed" << endl; |
92 | return; | 94 | return; |
93 | } | 95 | } |
94 | 96 | ||
95 | resource->setFileName( mFileNameEdit->url() ); | 97 | resource->setFileName( mFileNameEdit->url() ); |
96 | } | 98 | } |
97 | 99 | ||
98 | void ResourceQtopiaConfig::checkFilePermissions( const QString& fileName ) | 100 | void ResourceQtopiaConfig::checkFilePermissions( const QString& fileName ) |
99 | { | 101 | { |
100 | // If file exist but is not writeable... | 102 | // If file exist but is not writeable... |
101 | /*US | 103 | /*US |
102 | if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) | 104 | if ( access( QFile::encodeName( fileName ), F_OK ) == 0 ) |
103 | emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 ); | 105 | emit setReadOnly( access( QFile::encodeName( fileName ), W_OK ) < 0 ); |
104 | */ | 106 | */ |
105 | } | 107 | } |
106 | 108 | ||
107 | //US #include "resourceopieconfig.moc" | 109 | //US #include "resourceopieconfig.moc" |
diff --git a/kabc/plugins/sharpdtm/sharpdtmE.pro b/kabc/plugins/sharpdtm/sharpdtmE.pro index 23b0b76..7fc8ba8 100644 --- a/kabc/plugins/sharpdtm/sharpdtmE.pro +++ b/kabc/plugins/sharpdtm/sharpdtmE.pro | |||
@@ -1,35 +1,35 @@ | |||
1 | TEMPLATE= lib | 1 | TEMPLATE= lib |
2 | CONFIG += qt warn_on | 2 | CONFIG += qt warn_on |
3 | TARGET = microkabc_sharpdtm | 3 | TARGET = xmicrokabc_sharpdtm |
4 | 4 | ||
5 | INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(SHARPDTMSDK)/include $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include | 5 | INCLUDEPATH += $(KDEPIMDIR) $(KDEPIMDIR)/kabc $(SHARPDTMSDK)/include $(KDEPIMDIR)/microkde $(KDEPIMDIR)/microkde/kdecore $(KDEPIMDIR)/microkde/kio/kfile $(KDEPIMDIR)/microkde/kio/kio $(KDEPIMDIR)/microkde/kresources $(KDEPIMDIR)/qtcompat $(QPEDIR)/include |
6 | 6 | ||
7 | 7 | ||
8 | OBJECTS_DIR = obj/$(PLATFORM) | 8 | OBJECTS_DIR = obj/$(PLATFORM) |
9 | MOC_DIR = moc/$(PLATFORM) | 9 | MOC_DIR = moc/$(PLATFORM) |
10 | DESTDIR = $(QPEDIR)/lib | 10 | DESTDIR = $(QPEDIR)/lib |
11 | LIBS += -lmicrokde | 11 | LIBS += -lxmicrokde |
12 | LIBS += -lmicrokabc | 12 | LIBS += -lxmicrokabc |
13 | LIBS += -lmicrokdepim | 13 | LIBS += -lxmicrokdepim |
14 | LIBS += -lmicroqtcompat | 14 | LIBS += -lmicroqtcompat |
15 | LIBS += -L$(QPEDIR)/lib | 15 | LIBS += -L$(QPEDIR)/lib |
16 | LIBS += -ljpeg | 16 | LIBS += -ljpeg |
17 | LIBS += -lqpe | 17 | LIBS += -lqpe |
18 | LIBS += -lqte | 18 | LIBS += -lqte |
19 | LIBS += -lzdtm | 19 | LIBS += -lzdtm |
20 | LIBS += -lsl | 20 | LIBS += -lsl |
21 | 21 | ||
22 | 22 | ||
23 | 23 | ||
24 | INTERFACES = \ | 24 | INTERFACES = \ |
25 | 25 | ||
26 | HEADERS = \ | 26 | HEADERS = \ |
27 | resourcesharpdtm.h \ | 27 | resourcesharpdtm.h \ |
28 | resourcesharpdtmconfig.h \ | 28 | resourcesharpdtmconfig.h \ |
29 | sharpdtmconverter.h | 29 | sharpdtmconverter.h |
30 | 30 | ||
31 | SOURCES = \ | 31 | SOURCES = \ |
32 | resourcesharpdtm.cpp \ | 32 | resourcesharpdtm.cpp \ |
33 | resourcesharpdtmconfig.cpp \ | 33 | resourcesharpdtmconfig.cpp \ |
34 | sharpdtmconverter.cpp | 34 | sharpdtmconverter.cpp |
35 | 35 | ||
diff --git a/kabc/secrecy.h b/kabc/secrecy.h index b2ff565..0fe956e 100644 --- a/kabc/secrecy.h +++ b/kabc/secrecy.h | |||
@@ -1,102 +1,102 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_SECRECY_H | 28 | #ifndef KABC_SECRECY_H |
29 | #define KABC_SECRECY_H | 29 | #define KABC_SECRECY_H |
30 | 30 | ||
31 | #include <qvaluelist.h> | 31 | #include <q3valuelist.h> |
32 | 32 | ||
33 | namespace KABC { | 33 | namespace KABC { |
34 | 34 | ||
35 | class Secrecy | 35 | class Secrecy |
36 | { | 36 | { |
37 | friend QDataStream &operator<<( QDataStream &, const Secrecy & ); | 37 | friend QDataStream &operator<<( QDataStream &, const Secrecy & ); |
38 | friend QDataStream &operator>>( QDataStream &, Secrecy & ); | 38 | friend QDataStream &operator>>( QDataStream &, Secrecy & ); |
39 | 39 | ||
40 | public: | 40 | public: |
41 | typedef QValueList<int> TypeList; | 41 | typedef Q3ValueList<int> TypeList; |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Secrecy types | 44 | * Secrecy types |
45 | * | 45 | * |
46 | * @li Public - for public access | 46 | * @li Public - for public access |
47 | * @li Private - only private access | 47 | * @li Private - only private access |
48 | * @li Confidential - access for confidential persons | 48 | * @li Confidential - access for confidential persons |
49 | */ | 49 | */ |
50 | enum Types { | 50 | enum Types { |
51 | Public, | 51 | Public, |
52 | Private, | 52 | Private, |
53 | Confidential, | 53 | Confidential, |
54 | Invalid | 54 | Invalid |
55 | }; | 55 | }; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Constructor. | 58 | * Constructor. |
59 | * | 59 | * |
60 | * @param type The secrecy type, @see Types. | 60 | * @param type The secrecy type, @see Types. |
61 | */ | 61 | */ |
62 | Secrecy( int type = Public ); | 62 | Secrecy( int type = Public ); |
63 | 63 | ||
64 | bool operator==( const Secrecy & ) const; | 64 | bool operator==( const Secrecy & ) const; |
65 | bool operator!=( const Secrecy & ) const; | 65 | bool operator!=( const Secrecy & ) const; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | Returns if the Secrecy object has a valid value. | 68 | Returns if the Secrecy object has a valid value. |
69 | */ | 69 | */ |
70 | bool isValid() const; | 70 | bool isValid() const; |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Sets the type, @see Types. | 73 | * Sets the type, @see Types. |
74 | */ | 74 | */ |
75 | void setType( int type ); | 75 | void setType( int type ); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Returns the type, @see Types. | 78 | * Returns the type, @see Types. |
79 | */ | 79 | */ |
80 | int type() const; | 80 | int type() const; |
81 | 81 | ||
82 | /** | 82 | /** |
83 | * Returns a list of all available secrecy types. | 83 | * Returns a list of all available secrecy types. |
84 | */ | 84 | */ |
85 | static TypeList typeList(); | 85 | static TypeList typeList(); |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * Returns a translated label for a given secrecy type. | 88 | * Returns a translated label for a given secrecy type. |
89 | */ | 89 | */ |
90 | static QString typeLabel( int type ); | 90 | static QString typeLabel( int type ); |
91 | 91 | ||
92 | /** | 92 | /** |
93 | * For debug. | 93 | * For debug. |
94 | */ | 94 | */ |
95 | QString asString() const; | 95 | QString asString() const; |
96 | 96 | ||
97 | private: | 97 | private: |
98 | int mType; | 98 | int mType; |
99 | }; | 99 | }; |
100 | 100 | ||
101 | } | 101 | } |
102 | #endif | 102 | #endif |
diff --git a/kabc/sound.h b/kabc/sound.h index 0ec5ec8..9777054 100644 --- a/kabc/sound.h +++ b/kabc/sound.h | |||
@@ -1,123 +1,123 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #ifndef KABC_SOUND_H | 28 | #ifndef KABC_SOUND_H |
29 | #define KABC_SOUND_H | 29 | #define KABC_SOUND_H |
30 | 30 | ||
31 | #include <qcstring.h> | 31 | #include <q3cstring.h> |
32 | #include <qstring.h> | 32 | #include <qstring.h> |
33 | 33 | ||
34 | namespace KABC { | 34 | namespace KABC { |
35 | 35 | ||
36 | class Sound | 36 | class Sound |
37 | { | 37 | { |
38 | friend QDataStream &operator<<( QDataStream &, const Sound & ); | 38 | friend QDataStream &operator<<( QDataStream &, const Sound & ); |
39 | friend QDataStream &operator>>( QDataStream &, Sound & ); | 39 | friend QDataStream &operator>>( QDataStream &, Sound & ); |
40 | 40 | ||
41 | public: | 41 | public: |
42 | 42 | ||
43 | /** | 43 | /** |
44 | * Consturctor. Creates an empty object. | 44 | * Consturctor. Creates an empty object. |
45 | */ | 45 | */ |
46 | Sound(); | 46 | Sound(); |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Consturctor. | 49 | * Consturctor. |
50 | * | 50 | * |
51 | * @param url A URL that describes the position of the sound file. | 51 | * @param url A URL that describes the position of the sound file. |
52 | */ | 52 | */ |
53 | Sound( const QString &url ); | 53 | Sound( const QString &url ); |
54 | 54 | ||
55 | /** | 55 | /** |
56 | * Consturctor. | 56 | * Consturctor. |
57 | * | 57 | * |
58 | * @param data The raw data of the sound. | 58 | * @param data The raw data of the sound. |
59 | */ | 59 | */ |
60 | Sound( const QByteArray &data ); | 60 | Sound( const QByteArray &data ); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Destructor. | 63 | * Destructor. |
64 | */ | 64 | */ |
65 | ~Sound(); | 65 | ~Sound(); |
66 | 66 | ||
67 | 67 | ||
68 | bool operator==( const Sound & ) const; | 68 | bool operator==( const Sound & ) const; |
69 | bool operator!=( const Sound & ) const; | 69 | bool operator!=( const Sound & ) const; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Sets a URL for the location of the sound file. When using this | 72 | * Sets a URL for the location of the sound file. When using this |
73 | * function, @ref isIntern() will return 'false' until you use | 73 | * function, @ref isIntern() will return 'false' until you use |
74 | * @ref setData(). | 74 | * @ref setData(). |
75 | * | 75 | * |
76 | * @param url The location URL of the sound file. | 76 | * @param url The location URL of the sound file. |
77 | */ | 77 | */ |
78 | void setUrl( const QString &url ); | 78 | void setUrl( const QString &url ); |
79 | 79 | ||
80 | /** | 80 | /** |
81 | * Sets the raw data of the sound. When using this function, | 81 | * Sets the raw data of the sound. When using this function, |
82 | * @ref isIntern() will return 'true' until you use @ref setUrl(). | 82 | * @ref isIntern() will return 'true' until you use @ref setUrl(). |
83 | * | 83 | * |
84 | * @param data The raw data of the sound. | 84 | * @param data The raw data of the sound. |
85 | */ | 85 | */ |
86 | void setData( const QByteArray &data ); | 86 | void setData( const QByteArray &data ); |
87 | 87 | ||
88 | /** | 88 | /** |
89 | * Returns whether the sound is described by a URL (extern) or | 89 | * Returns whether the sound is described by a URL (extern) or |
90 | * by the raw data (intern). | 90 | * by the raw data (intern). |
91 | * When this method returns 'true' you can use @ref data() to | 91 | * When this method returns 'true' you can use @ref data() to |
92 | * get the raw data. Otherwise you can request the URL of this | 92 | * get the raw data. Otherwise you can request the URL of this |
93 | * sound by @ref url() and load the raw data from that location. | 93 | * sound by @ref url() and load the raw data from that location. |
94 | */ | 94 | */ |
95 | bool isIntern() const; | 95 | bool isIntern() const; |
96 | 96 | ||
97 | /** | 97 | /** |
98 | * Returns the location URL of this sound. | 98 | * Returns the location URL of this sound. |
99 | */ | 99 | */ |
100 | QString url() const; | 100 | QString url() const; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * Returns the raw data of this sound. | 103 | * Returns the raw data of this sound. |
104 | */ | 104 | */ |
105 | QByteArray data() const; | 105 | QByteArray data() const; |
106 | 106 | ||
107 | /** | 107 | /** |
108 | * Returns string representation of the sound. | 108 | * Returns string representation of the sound. |
109 | */ | 109 | */ |
110 | QString asString() const; | 110 | QString asString() const; |
111 | 111 | ||
112 | private: | 112 | private: |
113 | QString mUrl; | 113 | QString mUrl; |
114 | QByteArray mData; | 114 | QByteArray mData; |
115 | 115 | ||
116 | int mIntern; | 116 | int mIntern; |
117 | }; | 117 | }; |
118 | 118 | ||
119 | QDataStream &operator<<( QDataStream &, const Sound & ); | 119 | QDataStream &operator<<( QDataStream &, const Sound & ); |
120 | QDataStream &operator>>( QDataStream &, Sound & ); | 120 | QDataStream &operator>>( QDataStream &, Sound & ); |
121 | 121 | ||
122 | } | 122 | } |
123 | #endif | 123 | #endif |
diff --git a/kabc/tmpaddressbook.cpp b/kabc/tmpaddressbook.cpp index cfa57e3..5152e00 100644 --- a/kabc/tmpaddressbook.cpp +++ b/kabc/tmpaddressbook.cpp | |||
@@ -1,49 +1,49 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2004 Ulf Schenk | 3 | Copyright (c) 2004 Ulf Schenk |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | #include <qptrlist.h> | 27 | #include <q3ptrlist.h> |
28 | 28 | ||
29 | #include "tmpaddressbook.h" | 29 | #include "tmpaddressbook.h" |
30 | 30 | ||
31 | using namespace KABC; | 31 | using namespace KABC; |
32 | 32 | ||
33 | #include "resource.h" | 33 | #include "resource.h" |
34 | 34 | ||
35 | TmpAddressBook::TmpAddressBook() | 35 | TmpAddressBook::TmpAddressBook() |
36 | : AddressBook(0, "tmpcontact") | 36 | : AddressBook(0, "tmpcontact") |
37 | { | 37 | { |
38 | } | 38 | } |
39 | 39 | ||
40 | TmpAddressBook::TmpAddressBook( const QString &config ) | 40 | TmpAddressBook::TmpAddressBook( const QString &config ) |
41 | : AddressBook( config, "tmpcontact" ) | 41 | : AddressBook( config, "tmpcontact" ) |
42 | { | 42 | { |
43 | } | 43 | } |
44 | 44 | ||
45 | TmpAddressBook::~TmpAddressBook() | 45 | TmpAddressBook::~TmpAddressBook() |
46 | { | 46 | { |
47 | removeResources(); | 47 | removeResources(); |
48 | } | 48 | } |
49 | 49 | ||
diff --git a/kabc/vcard/AdrParam.cpp b/kabc/vcard/AdrParam.cpp index fa46499..33d358c 100644 --- a/kabc/vcard/AdrParam.cpp +++ b/kabc/vcard/AdrParam.cpp | |||
@@ -1,126 +1,128 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardRToken.h> | 24 | #include <VCardRToken.h> |
25 | #include <VCardAdrParam.h> | 25 | #include <VCardAdrParam.h> |
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | AdrParam::AdrParam() | 32 | AdrParam::AdrParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | AdrParam::AdrParam(const AdrParam & x) | 37 | AdrParam::AdrParam(const AdrParam & x) |
36 | :Param(x), | 38 | :Param(x), |
37 | adrTypeList_(x.adrTypeList_) | 39 | adrTypeList_(x.adrTypeList_) |
38 | { | 40 | { |
39 | } | 41 | } |
40 | 42 | ||
41 | AdrParam::AdrParam(const QCString & s) | 43 | AdrParam::AdrParam(const Q3CString & s) |
42 | :Param(s) | 44 | :Param(s) |
43 | { | 45 | { |
44 | } | 46 | } |
45 | 47 | ||
46 | AdrParam & | 48 | AdrParam & |
47 | AdrParam::operator = (AdrParam & x) | 49 | AdrParam::operator = (AdrParam & x) |
48 | { | 50 | { |
49 | if (*this == x) return *this; | 51 | if (*this == x) return *this; |
50 | 52 | ||
51 | adrTypeList_= x.adrTypeList(); | 53 | adrTypeList_= x.adrTypeList(); |
52 | textParam_ = x.textParam(); | 54 | textParam_ = x.textParam(); |
53 | 55 | ||
54 | Param::operator = (x); | 56 | Param::operator = (x); |
55 | return *this; | 57 | return *this; |
56 | } | 58 | } |
57 | 59 | ||
58 | AdrParam & | 60 | AdrParam & |
59 | AdrParam::operator = (const QCString & s) | 61 | AdrParam::operator = (const Q3CString & s) |
60 | { | 62 | { |
61 | Param::operator = (s); | 63 | Param::operator = (s); |
62 | 64 | ||
63 | adrTypeList_.clear(); | 65 | adrTypeList_.clear(); |
64 | textParam_.truncate(0); | 66 | textParam_.truncate(0); |
65 | 67 | ||
66 | return *this; | 68 | return *this; |
67 | } | 69 | } |
68 | 70 | ||
69 | bool | 71 | bool |
70 | AdrParam::operator == (AdrParam & x) | 72 | AdrParam::operator == (AdrParam & x) |
71 | { | 73 | { |
72 | parse(); | 74 | parse(); |
73 | 75 | ||
74 | if (!x.textParam().isEmpty()) | 76 | if (!x.textParam().isEmpty()) |
75 | return (x.textParam_ == textParam_); | 77 | return (x.textParam_ == textParam_); |
76 | 78 | ||
77 | if (x.adrTypeList().count() != adrTypeList_.count()) | 79 | if (x.adrTypeList().count() != adrTypeList_.count()) |
78 | return false; | 80 | return false; |
79 | 81 | ||
80 | QStrListIterator it(x.adrTypeList_); | 82 | Q3StrListIterator it(x.adrTypeList_); |
81 | 83 | ||
82 | for (; it.current(); ++it) | 84 | for (; it.current(); ++it) |
83 | if (!adrTypeList_.find(it.current())) | 85 | if (!adrTypeList_.find(it.current())) |
84 | return false; | 86 | return false; |
85 | 87 | ||
86 | return true; | 88 | return true; |
87 | } | 89 | } |
88 | 90 | ||
89 | AdrParam::~AdrParam() | 91 | AdrParam::~AdrParam() |
90 | { | 92 | { |
91 | } | 93 | } |
92 | 94 | ||
93 | void | 95 | void |
94 | AdrParam::_parse() | 96 | AdrParam::_parse() |
95 | { | 97 | { |
96 | adrTypeList_.clear(); | 98 | adrTypeList_.clear(); |
97 | 99 | ||
98 | if (strRep_.left(4) != "TYPE") { | 100 | if (strRep_.left(4) != "TYPE") { |
99 | textParam_ = strRep_; | 101 | textParam_ = strRep_; |
100 | return; | 102 | return; |
101 | } | 103 | } |
102 | 104 | ||
103 | if (!strRep_.contains('=')) | 105 | if (!strRep_.contains('=')) |
104 | return; | 106 | return; |
105 | 107 | ||
106 | RTokenise(strRep_, ",", adrTypeList_); | 108 | RTokenise(strRep_, ",", adrTypeList_); |
107 | } | 109 | } |
108 | 110 | ||
109 | void | 111 | void |
110 | AdrParam::_assemble() | 112 | AdrParam::_assemble() |
111 | { | 113 | { |
112 | if (!textParam_.isEmpty()) { | 114 | if (!textParam_.isEmpty()) { |
113 | strRep_ = textParam_; | 115 | strRep_ = textParam_; |
114 | return; | 116 | return; |
115 | } | 117 | } |
116 | 118 | ||
117 | QStrListIterator it(adrTypeList_); | 119 | Q3StrListIterator it(adrTypeList_); |
118 | 120 | ||
119 | for (; it.current(); ++it) { | 121 | for (; it.current(); ++it) { |
120 | 122 | ||
121 | strRep_ += it.current(); | 123 | strRep_ += it.current(); |
122 | 124 | ||
123 | if (it.current() != adrTypeList_.last()) | 125 | if (it.current() != adrTypeList_.last()) |
124 | strRep_ += ','; | 126 | strRep_ += ','; |
125 | } | 127 | } |
126 | } | 128 | } |
diff --git a/kabc/vcard/AdrValue.cpp b/kabc/vcard/AdrValue.cpp index 7ecef33..51ca12a 100644 --- a/kabc/vcard/AdrValue.cpp +++ b/kabc/vcard/AdrValue.cpp | |||
@@ -1,140 +1,143 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardRToken.h> | 24 | #include <VCardRToken.h> |
25 | #include <VCardAdrValue.h> | 25 | #include <VCardAdrValue.h> |
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | #include <VCardDefines.h> | 27 | #include <VCardDefines.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3StrList> | ||
30 | #include <Q3CString> | ||
28 | 31 | ||
29 | using namespace VCARD; | 32 | using namespace VCARD; |
30 | 33 | ||
31 | AdrValue::AdrValue() | 34 | AdrValue::AdrValue() |
32 | :Value() | 35 | :Value() |
33 | { | 36 | { |
34 | } | 37 | } |
35 | 38 | ||
36 | AdrValue::AdrValue(const AdrValue & x) | 39 | AdrValue::AdrValue(const AdrValue & x) |
37 | :Value(x), | 40 | :Value(x), |
38 | poBox_ (x.poBox_), | 41 | poBox_ (x.poBox_), |
39 | extAddress_(x.extAddress_), | 42 | extAddress_(x.extAddress_), |
40 | street_ (x.street_), | 43 | street_ (x.street_), |
41 | locality_(x.locality_), | 44 | locality_(x.locality_), |
42 | region_ (x.region_), | 45 | region_ (x.region_), |
43 | postCode_(x.postCode_), | 46 | postCode_(x.postCode_), |
44 | countryName_(x.countryName_) | 47 | countryName_(x.countryName_) |
45 | { | 48 | { |
46 | } | 49 | } |
47 | 50 | ||
48 | AdrValue::AdrValue(const QCString & s) | 51 | AdrValue::AdrValue(const Q3CString & s) |
49 | :Value(s) | 52 | :Value(s) |
50 | { | 53 | { |
51 | } | 54 | } |
52 | 55 | ||
53 | AdrValue & | 56 | AdrValue & |
54 | AdrValue::operator = (AdrValue & x) | 57 | AdrValue::operator = (AdrValue & x) |
55 | { | 58 | { |
56 | if (*this == x) return *this; | 59 | if (*this == x) return *this; |
57 | 60 | ||
58 | poBox_ = x.poBox_; | 61 | poBox_ = x.poBox_; |
59 | extAddress_= x.extAddress_; | 62 | extAddress_= x.extAddress_; |
60 | street_ = x.street_; | 63 | street_ = x.street_; |
61 | locality_= x.locality_; | 64 | locality_= x.locality_; |
62 | region_ = x.region_; | 65 | region_ = x.region_; |
63 | postCode_= x.postCode_; | 66 | postCode_= x.postCode_; |
64 | countryName_= x.countryName_; | 67 | countryName_= x.countryName_; |
65 | 68 | ||
66 | Value::operator = (x); | 69 | Value::operator = (x); |
67 | return *this; | 70 | return *this; |
68 | } | 71 | } |
69 | 72 | ||
70 | AdrValue & | 73 | AdrValue & |
71 | AdrValue::operator = (const QCString & s) | 74 | AdrValue::operator = (const Q3CString & s) |
72 | { | 75 | { |
73 | Value::operator = (s); | 76 | Value::operator = (s); |
74 | return *this; | 77 | return *this; |
75 | } | 78 | } |
76 | 79 | ||
77 | bool | 80 | bool |
78 | AdrValue::operator == (AdrValue & x) | 81 | AdrValue::operator == (AdrValue & x) |
79 | { | 82 | { |
80 | parse(); | 83 | parse(); |
81 | x.parse(); | 84 | x.parse(); |
82 | 85 | ||
83 | return ( | 86 | return ( |
84 | poBox_ == x.poBox_ && | 87 | poBox_ == x.poBox_ && |
85 | extAddress_ == x.extAddress_&& | 88 | extAddress_ == x.extAddress_&& |
86 | street_ == x.street_ && | 89 | street_ == x.street_ && |
87 | locality_ == x.locality_ && | 90 | locality_ == x.locality_ && |
88 | region_ == x.region_ && | 91 | region_ == x.region_ && |
89 | postCode_ == x.postCode_ && | 92 | postCode_ == x.postCode_ && |
90 | countryName_== x.countryName_); | 93 | countryName_== x.countryName_); |
91 | } | 94 | } |
92 | 95 | ||
93 | AdrValue::~AdrValue() | 96 | AdrValue::~AdrValue() |
94 | { | 97 | { |
95 | } | 98 | } |
96 | 99 | ||
97 | AdrValue * | 100 | AdrValue * |
98 | AdrValue::clone() | 101 | AdrValue::clone() |
99 | { | 102 | { |
100 | return new AdrValue( *this ); | 103 | return new AdrValue( *this ); |
101 | } | 104 | } |
102 | 105 | ||
103 | void | 106 | void |
104 | AdrValue::_parse() | 107 | AdrValue::_parse() |
105 | { | 108 | { |
106 | vDebug("AdrValue::_parse()"); | 109 | vDebug("AdrValue::_parse()"); |
107 | 110 | ||
108 | QStrList l; | 111 | Q3StrList l; |
109 | RTokenise(strRep_, ";", l); | 112 | RTokenise(strRep_, ";", l); |
110 | 113 | ||
111 | for (unsigned int i = 0; i < l.count(); i++) { | 114 | for (unsigned int i = 0; i < l.count(); i++) { |
112 | 115 | ||
113 | switch (i) { | 116 | switch (i) { |
114 | 117 | ||
115 | case 0: poBox_ = l.at(0);break; | 118 | case 0: poBox_ = l.at(0);break; |
116 | case 1: extAddress_ = l.at(1);break; | 119 | case 1: extAddress_ = l.at(1);break; |
117 | case 2: street_ = l.at(2);break; | 120 | case 2: street_ = l.at(2);break; |
118 | case 3: locality_ = l.at(3);break; | 121 | case 3: locality_ = l.at(3);break; |
119 | case 4: region_ = l.at(4);break; | 122 | case 4: region_ = l.at(4);break; |
120 | case 5: postCode_ = l.at(5);break; | 123 | case 5: postCode_ = l.at(5);break; |
121 | case 6: countryName_ = l.at(6);break; | 124 | case 6: countryName_ = l.at(6);break; |
122 | default: break; | 125 | default: break; |
123 | } | 126 | } |
124 | } | 127 | } |
125 | } | 128 | } |
126 | 129 | ||
127 | void | 130 | void |
128 | AdrValue::_assemble() | 131 | AdrValue::_assemble() |
129 | { | 132 | { |
130 | vDebug("AdrValue::_assemble"); | 133 | vDebug("AdrValue::_assemble"); |
131 | 134 | ||
132 | strRep_ = poBox_; | 135 | strRep_ = poBox_; |
133 | strRep_ += ";" +extAddress_; | 136 | strRep_ += ";" +extAddress_; |
134 | strRep_ += ";" +street_; | 137 | strRep_ += ";" +street_; |
135 | strRep_ += ";" +locality_; | 138 | strRep_ += ";" +locality_; |
136 | strRep_ += ";" +region_; | 139 | strRep_ += ";" +region_; |
137 | strRep_ += ";" +postCode_; | 140 | strRep_ += ";" +postCode_; |
138 | strRep_ += ";" +countryName_; | 141 | strRep_ += ";" +countryName_; |
139 | } | 142 | } |
140 | 143 | ||
diff --git a/kabc/vcard/AgentParam.cpp b/kabc/vcard/AgentParam.cpp index 5625e00..aae35ac 100644 --- a/kabc/vcard/AgentParam.cpp +++ b/kabc/vcard/AgentParam.cpp | |||
@@ -1,103 +1,105 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardAgentParam.h> | 24 | #include <VCardAgentParam.h> |
25 | 25 | ||
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | AgentParam::AgentParam() | 32 | AgentParam::AgentParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | AgentParam::AgentParam(const AgentParam & x) | 37 | AgentParam::AgentParam(const AgentParam & x) |
36 | :Param(x), | 38 | :Param(x), |
37 | refer_(x.refer_), | 39 | refer_(x.refer_), |
38 | uri_(x.uri_) | 40 | uri_(x.uri_) |
39 | { | 41 | { |
40 | } | 42 | } |
41 | 43 | ||
42 | AgentParam::AgentParam(const QCString & s) | 44 | AgentParam::AgentParam(const Q3CString & s) |
43 | :Param(s) | 45 | :Param(s) |
44 | { | 46 | { |
45 | } | 47 | } |
46 | 48 | ||
47 | AgentParam & | 49 | AgentParam & |
48 | AgentParam::operator = (AgentParam & x) | 50 | AgentParam::operator = (AgentParam & x) |
49 | { | 51 | { |
50 | if (*this == x) return *this; | 52 | if (*this == x) return *this; |
51 | 53 | ||
52 | refer_= x.refer_; | 54 | refer_= x.refer_; |
53 | uri_= x.uri_; | 55 | uri_= x.uri_; |
54 | 56 | ||
55 | Param::operator = (x); | 57 | Param::operator = (x); |
56 | return *this; | 58 | return *this; |
57 | } | 59 | } |
58 | 60 | ||
59 | AgentParam & | 61 | AgentParam & |
60 | AgentParam::operator = (const QCString & s) | 62 | AgentParam::operator = (const Q3CString & s) |
61 | { | 63 | { |
62 | Param::operator = (s); | 64 | Param::operator = (s); |
63 | return *this; | 65 | return *this; |
64 | } | 66 | } |
65 | 67 | ||
66 | bool | 68 | bool |
67 | AgentParam::operator == (AgentParam & x) | 69 | AgentParam::operator == (AgentParam & x) |
68 | { | 70 | { |
69 | parse(); | 71 | parse(); |
70 | 72 | ||
71 | if (refer_) | 73 | if (refer_) |
72 | return (x.refer() && uri_ == x.uri_); | 74 | return (x.refer() && uri_ == x.uri_); |
73 | 75 | ||
74 | return !x.refer(); | 76 | return !x.refer(); |
75 | } | 77 | } |
76 | 78 | ||
77 | AgentParam::~AgentParam() | 79 | AgentParam::~AgentParam() |
78 | { | 80 | { |
79 | } | 81 | } |
80 | 82 | ||
81 | void | 83 | void |
82 | AgentParam::_parse() | 84 | AgentParam::_parse() |
83 | { | 85 | { |
84 | if (strRep_.isEmpty()) { | 86 | if (strRep_.isEmpty()) { |
85 | refer_ = false; | 87 | refer_ = false; |
86 | return; | 88 | return; |
87 | } | 89 | } |
88 | 90 | ||
89 | refer_= true; | 91 | refer_= true; |
90 | uri_= strRep_; | 92 | uri_= strRep_; |
91 | } | 93 | } |
92 | 94 | ||
93 | void | 95 | void |
94 | AgentParam::_assemble() | 96 | AgentParam::_assemble() |
95 | { | 97 | { |
96 | if (!refer_) { | 98 | if (!refer_) { |
97 | strRep_.truncate(0); | 99 | strRep_.truncate(0); |
98 | return; | 100 | return; |
99 | } | 101 | } |
100 | 102 | ||
101 | strRep_ = uri_.asString(); | 103 | strRep_ = uri_.asString(); |
102 | return; | 104 | return; |
103 | } | 105 | } |
diff --git a/kabc/vcard/AgentValue.cpp b/kabc/vcard/AgentValue.cpp index bccde80..14e73b1 100644 --- a/kabc/vcard/AgentValue.cpp +++ b/kabc/vcard/AgentValue.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardAgentValue.h> | 24 | #include <VCardAgentValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | AgentValue::AgentValue() | 32 | AgentValue::AgentValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | AgentValue::AgentValue(const AgentValue & x) | 37 | AgentValue::AgentValue(const AgentValue & x) |
36 | :Value(x) | 38 | :Value(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | AgentValue::AgentValue(const QCString & s) | 42 | AgentValue::AgentValue(const Q3CString & s) |
41 | :Value(s) | 43 | :Value(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | AgentValue & | 47 | AgentValue & |
46 | AgentValue::operator = (AgentValue & x) | 48 | AgentValue::operator = (AgentValue & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Value::operator = (x); | 52 | Value::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | AgentValue & | 56 | AgentValue & |
55 | AgentValue::operator = (const QCString & s) | 57 | AgentValue::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Value::operator = (s); | 59 | Value::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | AgentValue::operator == (AgentValue & x) | 64 | AgentValue::operator == (AgentValue & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | AgentValue::~AgentValue() | 70 | AgentValue::~AgentValue() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | AgentValue::_parse() | 75 | AgentValue::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | AgentValue::_assemble() | 80 | AgentValue::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/ClassValue.cpp b/kabc/vcard/ClassValue.cpp index f01e5a6..c088d7c 100644 --- a/kabc/vcard/ClassValue.cpp +++ b/kabc/vcard/ClassValue.cpp | |||
@@ -1,120 +1,122 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardClassValue.h> | 24 | #include <VCardClassValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | 27 | ||
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3CString> | ||
29 | 31 | ||
30 | using namespace VCARD; | 32 | using namespace VCARD; |
31 | 33 | ||
32 | ClassValue::ClassValue() | 34 | ClassValue::ClassValue() |
33 | :Value() | 35 | :Value() |
34 | { | 36 | { |
35 | } | 37 | } |
36 | 38 | ||
37 | ClassValue::ClassValue(const ClassValue & x) | 39 | ClassValue::ClassValue(const ClassValue & x) |
38 | :Value(x), | 40 | :Value(x), |
39 | classType_(x.classType_) | 41 | classType_(x.classType_) |
40 | { | 42 | { |
41 | } | 43 | } |
42 | 44 | ||
43 | ClassValue::ClassValue(const QCString & s) | 45 | ClassValue::ClassValue(const Q3CString & s) |
44 | :Value(s) | 46 | :Value(s) |
45 | { | 47 | { |
46 | } | 48 | } |
47 | 49 | ||
48 | ClassValue & | 50 | ClassValue & |
49 | ClassValue::operator = (ClassValue & x) | 51 | ClassValue::operator = (ClassValue & x) |
50 | { | 52 | { |
51 | if (*this == x) return *this; | 53 | if (*this == x) return *this; |
52 | x.parse(); | 54 | x.parse(); |
53 | 55 | ||
54 | classType_ = x.classType_; | 56 | classType_ = x.classType_; |
55 | 57 | ||
56 | Value::operator = (x); | 58 | Value::operator = (x); |
57 | return *this; | 59 | return *this; |
58 | } | 60 | } |
59 | 61 | ||
60 | ClassValue & | 62 | ClassValue & |
61 | ClassValue::operator = (const QCString & s) | 63 | ClassValue::operator = (const Q3CString & s) |
62 | { | 64 | { |
63 | Value::operator = (s); | 65 | Value::operator = (s); |
64 | return *this; | 66 | return *this; |
65 | } | 67 | } |
66 | 68 | ||
67 | bool | 69 | bool |
68 | ClassValue::operator == (ClassValue & x) | 70 | ClassValue::operator == (ClassValue & x) |
69 | { | 71 | { |
70 | x.parse(); | 72 | x.parse(); |
71 | return ( classType_ == x.classType_ ); | 73 | return ( classType_ == x.classType_ ); |
72 | } | 74 | } |
73 | 75 | ||
74 | ClassValue::~ClassValue() | 76 | ClassValue::~ClassValue() |
75 | { | 77 | { |
76 | } | 78 | } |
77 | 79 | ||
78 | ClassValue * | 80 | ClassValue * |
79 | ClassValue::clone() | 81 | ClassValue::clone() |
80 | { | 82 | { |
81 | return new ClassValue( *this ); | 83 | return new ClassValue( *this ); |
82 | } | 84 | } |
83 | 85 | ||
84 | void | 86 | void |
85 | ClassValue::_parse() | 87 | ClassValue::_parse() |
86 | { | 88 | { |
87 | if (qstricmp(strRep_, "PUBLIC") == 0) | 89 | if (qstricmp(strRep_, "PUBLIC") == 0) |
88 | classType_ = Public; | 90 | classType_ = Public; |
89 | 91 | ||
90 | else if (qstricmp(strRep_, "PRIVATE") == 0) | 92 | else if (qstricmp(strRep_, "PRIVATE") == 0) |
91 | classType_ = Private; | 93 | classType_ = Private; |
92 | 94 | ||
93 | else if (qstricmp(strRep_, "CONFIDENTIAL") == 0) | 95 | else if (qstricmp(strRep_, "CONFIDENTIAL") == 0) |
94 | classType_ = Confidential; | 96 | classType_ = Confidential; |
95 | 97 | ||
96 | else classType_ = Other; | 98 | else classType_ = Other; |
97 | } | 99 | } |
98 | 100 | ||
99 | void | 101 | void |
100 | ClassValue::_assemble() | 102 | ClassValue::_assemble() |
101 | { | 103 | { |
102 | switch (classType_) { | 104 | switch (classType_) { |
103 | 105 | ||
104 | case Public: | 106 | case Public: |
105 | strRep_ = "PUBLIC"; | 107 | strRep_ = "PUBLIC"; |
106 | break; | 108 | break; |
107 | 109 | ||
108 | case Private: | 110 | case Private: |
109 | strRep_ = "PRIVATE"; | 111 | strRep_ = "PRIVATE"; |
110 | break; | 112 | break; |
111 | 113 | ||
112 | case Confidential: | 114 | case Confidential: |
113 | strRep_ = "CONFIDENTIAL"; | 115 | strRep_ = "CONFIDENTIAL"; |
114 | break; | 116 | break; |
115 | 117 | ||
116 | default: | 118 | default: |
117 | break; | 119 | break; |
118 | } | 120 | } |
119 | } | 121 | } |
120 | 122 | ||
diff --git a/kabc/vcard/ContentLine.cpp b/kabc/vcard/ContentLine.cpp index 0a2f97d..1d4886c 100644 --- a/kabc/vcard/ContentLine.cpp +++ b/kabc/vcard/ContentLine.cpp | |||
@@ -1,355 +1,355 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcstring.h> | 24 | #include <q3cstring.h> |
25 | #include <qstrlist.h> | 25 | #include <q3strlist.h> |
26 | #include <qregexp.h> | 26 | #include <qregexp.h> |
27 | 27 | ||
28 | #include <kdebug.h> | 28 | #include <kdebug.h> |
29 | 29 | ||
30 | #include <VCardAdrParam.h> | 30 | #include <VCardAdrParam.h> |
31 | #include <VCardAgentParam.h> | 31 | #include <VCardAgentParam.h> |
32 | #include <VCardDateParam.h> | 32 | #include <VCardDateParam.h> |
33 | #include <VCardEmailParam.h> | 33 | #include <VCardEmailParam.h> |
34 | #include <VCardImageParam.h> | 34 | #include <VCardImageParam.h> |
35 | #include <VCardSourceParam.h> | 35 | #include <VCardSourceParam.h> |
36 | #include <VCardTelParam.h> | 36 | #include <VCardTelParam.h> |
37 | #include <VCardTextBinParam.h> | 37 | #include <VCardTextBinParam.h> |
38 | #include <VCardTextParam.h> | 38 | #include <VCardTextParam.h> |
39 | 39 | ||
40 | #include <VCardAdrValue.h> | 40 | #include <VCardAdrValue.h> |
41 | #include <VCardAgentValue.h> | 41 | #include <VCardAgentValue.h> |
42 | #include <VCardDateValue.h> | 42 | #include <VCardDateValue.h> |
43 | #include <VCardImageValue.h> | 43 | #include <VCardImageValue.h> |
44 | #include <VCardTextValue.h> | 44 | #include <VCardTextValue.h> |
45 | #include <VCardTextBinValue.h> | 45 | #include <VCardTextBinValue.h> |
46 | #include <VCardLangValue.h> | 46 | #include <VCardLangValue.h> |
47 | #include <VCardNValue.h> | 47 | #include <VCardNValue.h> |
48 | #include <VCardURIValue.h> | 48 | #include <VCardURIValue.h> |
49 | #include <VCardSoundValue.h> | 49 | #include <VCardSoundValue.h> |
50 | #include <VCardClassValue.h> | 50 | #include <VCardClassValue.h> |
51 | #include <VCardFloatValue.h> | 51 | #include <VCardFloatValue.h> |
52 | #include <VCardOrgValue.h> | 52 | #include <VCardOrgValue.h> |
53 | #include <VCardTelValue.h> | 53 | #include <VCardTelValue.h> |
54 | #include <VCardTextListValue.h> | 54 | #include <VCardTextListValue.h> |
55 | #include <VCardUTCValue.h> | 55 | #include <VCardUTCValue.h> |
56 | #include <VCardGeoValue.h> | 56 | #include <VCardGeoValue.h> |
57 | 57 | ||
58 | #include <VCardRToken.h> | 58 | #include <VCardRToken.h> |
59 | #include <VCardContentLine.h> | 59 | #include <VCardContentLine.h> |
60 | 60 | ||
61 | #include <VCardEntity.h> | 61 | #include <VCardEntity.h> |
62 | #include <VCardEnum.h> | 62 | #include <VCardEnum.h> |
63 | #include <VCardDefines.h> | 63 | #include <VCardDefines.h> |
64 | 64 | ||
65 | using namespace VCARD; | 65 | using namespace VCARD; |
66 | 66 | ||
67 | ContentLine::ContentLine() | 67 | ContentLine::ContentLine() |
68 | :Entity(), | 68 | :Entity(), |
69 | value_(0), | 69 | value_(0), |
70 | paramType_( ParamUnknown ), | 70 | paramType_( ParamUnknown ), |
71 | valueType_( ValueUnknown ), | 71 | valueType_( ValueUnknown ), |
72 | entityType_( EntityUnknown ) | 72 | entityType_( EntityUnknown ) |
73 | { | 73 | { |
74 | paramList_.setAutoDelete( TRUE ); | 74 | paramList_.setAutoDelete( TRUE ); |
75 | } | 75 | } |
76 | 76 | ||
77 | ContentLine::ContentLine(const ContentLine & x) | 77 | ContentLine::ContentLine(const ContentLine & x) |
78 | :Entity(x), | 78 | :Entity(x), |
79 | group_ (x.group_), | 79 | group_ (x.group_), |
80 | name_ (x.name_), | 80 | name_ (x.name_), |
81 | /*US paramList_(x.paramList_),*/ | 81 | /*US paramList_(x.paramList_),*/ |
82 | value_(x.value_->clone()), | 82 | value_(x.value_->clone()), |
83 | paramType_(x.paramType_), | 83 | paramType_(x.paramType_), |
84 | valueType_(x.valueType_), | 84 | valueType_(x.valueType_), |
85 | entityType_(x.entityType_) | 85 | entityType_(x.entityType_) |
86 | { | 86 | { |
87 | paramList_.setAutoDelete( TRUE ); | 87 | paramList_.setAutoDelete( TRUE ); |
88 | 88 | ||
89 | 89 | ||
90 | ParamListIterator it(x.paramList_); | 90 | ParamListIterator it(x.paramList_); |
91 | for (; it.current(); ++it) | 91 | for (; it.current(); ++it) |
92 | { | 92 | { |
93 | Param *p = new Param; | 93 | Param *p = new Param; |
94 | p->setName( it.current()->name() ); | 94 | p->setName( it.current()->name() ); |
95 | p->setValue( it.current()->value() ); | 95 | p->setValue( it.current()->value() ); |
96 | paramList_.append(p); | 96 | paramList_.append(p); |
97 | } | 97 | } |
98 | 98 | ||
99 | } | 99 | } |
100 | 100 | ||
101 | ContentLine::ContentLine(const QCString & s) | 101 | ContentLine::ContentLine(const Q3CString & s) |
102 | :Entity(s), | 102 | :Entity(s), |
103 | value_(0), | 103 | value_(0), |
104 | paramType_( ParamUnknown ), | 104 | paramType_( ParamUnknown ), |
105 | valueType_( ValueUnknown ), | 105 | valueType_( ValueUnknown ), |
106 | entityType_( EntityUnknown ) | 106 | entityType_( EntityUnknown ) |
107 | { | 107 | { |
108 | paramList_.setAutoDelete( TRUE ); | 108 | paramList_.setAutoDelete( TRUE ); |
109 | } | 109 | } |
110 | 110 | ||
111 | ContentLine & | 111 | ContentLine & |
112 | ContentLine::operator = (ContentLine & x) | 112 | ContentLine::operator = (ContentLine & x) |
113 | { | 113 | { |
114 | if (*this == x) return *this; | 114 | if (*this == x) return *this; |
115 | 115 | ||
116 | ParamListIterator it(x.paramList_); | 116 | ParamListIterator it(x.paramList_); |
117 | for (; it.current(); ++it) | 117 | for (; it.current(); ++it) |
118 | { | 118 | { |
119 | Param *p = new Param; | 119 | Param *p = new Param; |
120 | p->setName( it.current()->name() ); | 120 | p->setName( it.current()->name() ); |
121 | p->setValue( it.current()->value() ); | 121 | p->setValue( it.current()->value() ); |
122 | paramList_.append(p); | 122 | paramList_.append(p); |
123 | } | 123 | } |
124 | 124 | ||
125 | value_ = x.value_->clone(); | 125 | value_ = x.value_->clone(); |
126 | 126 | ||
127 | Entity::operator = (x); | 127 | Entity::operator = (x); |
128 | return *this; | 128 | return *this; |
129 | } | 129 | } |
130 | 130 | ||
131 | ContentLine & | 131 | ContentLine & |
132 | ContentLine::operator = (const QCString & s) | 132 | ContentLine::operator = (const Q3CString & s) |
133 | { | 133 | { |
134 | Entity::operator = (s); | 134 | Entity::operator = (s); |
135 | delete value_; | 135 | delete value_; |
136 | value_ = 0; | 136 | value_ = 0; |
137 | return *this; | 137 | return *this; |
138 | } | 138 | } |
139 | 139 | ||
140 | bool | 140 | bool |
141 | ContentLine::operator == (ContentLine & x) | 141 | ContentLine::operator == (ContentLine & x) |
142 | { | 142 | { |
143 | x.parse(); | 143 | x.parse(); |
144 | 144 | ||
145 | QPtrListIterator<Param> it(x.paramList()); | 145 | Q3PtrListIterator<Param> it(x.paramList()); |
146 | 146 | ||
147 | if (!paramList_.find(it.current())) | 147 | if (!paramList_.find(it.current())) |
148 | return false; | 148 | return false; |
149 | 149 | ||
150 | return true; | 150 | return true; |
151 | } | 151 | } |
152 | 152 | ||
153 | ContentLine::~ContentLine() | 153 | ContentLine::~ContentLine() |
154 | { | 154 | { |
155 | delete value_; | 155 | delete value_; |
156 | value_ = 0; | 156 | value_ = 0; |
157 | } | 157 | } |
158 | 158 | ||
159 | void | 159 | void |
160 | ContentLine::_parse() | 160 | ContentLine::_parse() |
161 | { | 161 | { |
162 | vDebug("parse"); | 162 | vDebug("parse"); |
163 | 163 | ||
164 | // Unfold folded lines | 164 | // Unfold folded lines |
165 | // NLR | 165 | // NLR |
166 | strRep_ = strRep_.replace( QRegExp( "\\r" ), "" ); | 166 | strRep_ = strRep_.replace( "\\r" , "" ); |
167 | // Unqote newlines | 167 | // Unqote newlines |
168 | strRep_ = strRep_.replace( QRegExp( "\\\\n" ), "\n" ); | 168 | strRep_ = strRep_.replace( "\\\\n", "\n" ); |
169 | //NLR | 169 | //NLR |
170 | strRep_ = strRep_.replace( QRegExp( "\\\\r" ), "\r" ); | 170 | strRep_ = strRep_.replace( "\\\\r" , "\r" ); |
171 | 171 | ||
172 | int split = strRep_.find(':'); | 172 | int split = strRep_.find(':'); |
173 | 173 | ||
174 | if (split == -1) { // invalid content line | 174 | if (split == -1) { // invalid content line |
175 | vDebug("No ':'"); | 175 | vDebug("No ':'"); |
176 | return; | 176 | return; |
177 | } | 177 | } |
178 | 178 | ||
179 | QCString firstPart(strRep_.left(split)); | 179 | Q3CString firstPart(strRep_.left(split)); |
180 | QCString valuePart(strRep_.mid(split + 1)); | 180 | Q3CString valuePart(strRep_.mid(split + 1)); |
181 | 181 | ||
182 | split = firstPart.find('.'); | 182 | split = firstPart.find('.'); |
183 | 183 | ||
184 | if (split != -1) { | 184 | if (split != -1) { |
185 | group_ = firstPart.left(split); | 185 | group_ = firstPart.left(split); |
186 | firstPart= firstPart.mid(split + 1); | 186 | firstPart= firstPart.mid(split + 1); |
187 | } | 187 | } |
188 | 188 | ||
189 | vDebug("Group == " + group_); | 189 | vDebug("Group == " + group_); |
190 | vDebug("firstPart == " + firstPart); | 190 | vDebug("firstPart == " + firstPart); |
191 | vDebug("valuePart == " + valuePart); | 191 | vDebug("valuePart == " + valuePart); |
192 | 192 | ||
193 | // Now we have the group, the name and param list together and the value. | 193 | // Now we have the group, the name and param list together and the value. |
194 | 194 | ||
195 | QStrList l; | 195 | Q3StrList l; |
196 | 196 | ||
197 | RTokenise(firstPart, ";", l); | 197 | RTokenise(firstPart, ";", l); |
198 | 198 | ||
199 | if (l.count() == 0) {// invalid - no name ! | 199 | if (l.count() == 0) {// invalid - no name ! |
200 | vDebug("No name for this content line !"); | 200 | vDebug("No name for this content line !"); |
201 | return; | 201 | return; |
202 | } | 202 | } |
203 | 203 | ||
204 | name_ = l.at(0); | 204 | name_ = l.at(0); |
205 | 205 | ||
206 | // Now we have the name, so the rest of 'l' is the params. | 206 | // Now we have the name, so the rest of 'l' is the params. |
207 | // Remove the name part. | 207 | // Remove the name part. |
208 | l.remove(0u); | 208 | l.remove(0u); |
209 | 209 | ||
210 | entityType_= EntityNameToEntityType(name_); | 210 | entityType_= EntityNameToEntityType(name_); |
211 | paramType_= EntityTypeToParamType(entityType_); | 211 | paramType_= EntityTypeToParamType(entityType_); |
212 | 212 | ||
213 | unsigned int i = 0; | 213 | unsigned int i = 0; |
214 | 214 | ||
215 | // For each parameter, create a new parameter of the correct type. | 215 | // For each parameter, create a new parameter of the correct type. |
216 | 216 | ||
217 | QStrListIterator it(l); | 217 | Q3StrListIterator it(l); |
218 | 218 | ||
219 | for (; it.current(); ++it, i++) { | 219 | for (; it.current(); ++it, i++) { |
220 | 220 | ||
221 | QCString str = *it; | 221 | Q3CString str = *it; |
222 | 222 | ||
223 | split = str.find("="); | 223 | split = str.find("="); |
224 | if (split < 0 ) { | 224 | if (split < 0 ) { |
225 | vDebug("No '=' in paramter."); | 225 | vDebug("No '=' in paramter."); |
226 | continue; | 226 | continue; |
227 | } | 227 | } |
228 | 228 | ||
229 | QCString paraName = str.left(split); | 229 | Q3CString paraName = str.left(split); |
230 | QCString paraValue = str.mid(split + 1); | 230 | Q3CString paraValue = str.mid(split + 1); |
231 | 231 | ||
232 | QStrList paraValues; | 232 | Q3StrList paraValues; |
233 | RTokenise(paraValue, ",", paraValues); | 233 | RTokenise(paraValue, ",", paraValues); |
234 | 234 | ||
235 | QStrListIterator it2( paraValues ); | 235 | Q3StrListIterator it2( paraValues ); |
236 | 236 | ||
237 | for(; it2.current(); ++it2) { | 237 | for(; it2.current(); ++it2) { |
238 | 238 | ||
239 | Param *p = new Param; | 239 | Param *p = new Param; |
240 | p->setName( paraName ); | 240 | p->setName( paraName ); |
241 | p->setValue( *it2 ); | 241 | p->setValue( *it2 ); |
242 | 242 | ||
243 | paramList_.append(p); | 243 | paramList_.append(p); |
244 | } | 244 | } |
245 | } | 245 | } |
246 | 246 | ||
247 | // Create a new value of the correct type. | 247 | // Create a new value of the correct type. |
248 | 248 | ||
249 | valueType_ = EntityTypeToValueType(entityType_); | 249 | valueType_ = EntityTypeToValueType(entityType_); |
250 | 250 | ||
251 | //kdDebug(5710) << "valueType: " << valueType_ << endl; | 251 | //kdDebug(5710) << "valueType: " << valueType_ << endl; |
252 | 252 | ||
253 | switch (valueType_) { | 253 | switch (valueType_) { |
254 | 254 | ||
255 | case ValueSound: value_ = new SoundValue;break; | 255 | case ValueSound: value_ = new SoundValue;break; |
256 | case ValueAgent: value_ = new AgentValue;break; | 256 | case ValueAgent: value_ = new AgentValue;break; |
257 | case ValueAddress: value_ = new AdrValue; break; | 257 | case ValueAddress: value_ = new AdrValue; break; |
258 | case ValueTel: value_ = new TelValue; break; | 258 | case ValueTel: value_ = new TelValue; break; |
259 | case ValueTextBin: value_ = new TextBinValue;break; | 259 | case ValueTextBin: value_ = new TextBinValue;break; |
260 | case ValueOrg: value_ = new OrgValue; break; | 260 | case ValueOrg: value_ = new OrgValue; break; |
261 | case ValueN: value_ = new NValue; break; | 261 | case ValueN: value_ = new NValue; break; |
262 | case ValueUTC: value_ = new UTCValue; break; | 262 | case ValueUTC: value_ = new UTCValue; break; |
263 | case ValueURI: value_ = new URIValue; break; | 263 | case ValueURI: value_ = new URIValue; break; |
264 | case ValueClass: value_ = new ClassValue;break; | 264 | case ValueClass: value_ = new ClassValue;break; |
265 | case ValueFloat: value_ = new FloatValue;break; | 265 | case ValueFloat: value_ = new FloatValue;break; |
266 | case ValueImage: value_ = new ImageValue;break; | 266 | case ValueImage: value_ = new ImageValue;break; |
267 | case ValueDate: value_ = new DateValue; break; | 267 | case ValueDate: value_ = new DateValue; break; |
268 | case ValueTextList: value_ = new TextListValue;break; | 268 | case ValueTextList: value_ = new TextListValue;break; |
269 | case ValueGeo: value_ = new GeoValue; break; | 269 | case ValueGeo: value_ = new GeoValue; break; |
270 | case ValueText: | 270 | case ValueText: |
271 | case ValueUnknown: | 271 | case ValueUnknown: |
272 | default: value_ = new TextValue; break; | 272 | default: value_ = new TextValue; break; |
273 | } | 273 | } |
274 | 274 | ||
275 | *value_ = valuePart; | 275 | *value_ = valuePart; |
276 | } | 276 | } |
277 | 277 | ||
278 | void | 278 | void |
279 | ContentLine::_assemble() | 279 | ContentLine::_assemble() |
280 | { | 280 | { |
281 | //strRep_.truncate(0); | 281 | //strRep_.truncate(0); |
282 | QString line; | 282 | QString line; |
283 | if (!group_.isEmpty()) | 283 | if (!group_.isEmpty()) |
284 | line = group_ + '.'; | 284 | line = group_ + '.'; |
285 | line += name_; | 285 | line += name_; |
286 | ParamListIterator it(paramList_); | 286 | ParamListIterator it(paramList_); |
287 | for (; it.current(); ++it) | 287 | for (; it.current(); ++it) |
288 | line += ";" + it.current()->asString(); | 288 | line += ";" + it.current()->asString(); |
289 | 289 | ||
290 | if (value_ != 0) | 290 | if (value_ != 0) |
291 | line += ":" + value_->asString(); | 291 | line += ":" + value_->asString(); |
292 | 292 | ||
293 | line = line.replace( QRegExp( "\r" ), "\\r" ); | 293 | line = line.replace( QRegExp( "\r" ), "\\r" ); |
294 | line = line.replace( QRegExp( "\n" ), "\\n" ); | 294 | line = line.replace( QRegExp( "\n" ), "\\n" ); |
295 | 295 | ||
296 | // Fold lines longer than 72 chars | 296 | // Fold lines longer than 72 chars |
297 | const int maxLen = 72; | 297 | const int maxLen = 72; |
298 | uint cursor = 0; | 298 | uint cursor = 0; |
299 | QString cut; | 299 | QString cut; |
300 | while( line.length() > ( cursor + 1 ) * maxLen ) { | 300 | while( line.length() > ( cursor + 1 ) * maxLen ) { |
301 | cut += line.mid( cursor * maxLen, maxLen ); | 301 | cut += line.mid( cursor * maxLen, maxLen ); |
302 | cut += "\r\n "; | 302 | cut += "\r\n "; |
303 | ++cursor; | 303 | ++cursor; |
304 | } | 304 | } |
305 | cut += line.mid( cursor * maxLen ); | 305 | cut += line.mid( cursor * maxLen ); |
306 | strRep_ = cut.latin1(); | 306 | strRep_ = cut.latin1(); |
307 | //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); | 307 | //qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); |
308 | #if 0 | 308 | #if 0 |
309 | vDebug("Assemble (argl) - my name is \"" + name_ + "\""); | 309 | vDebug("Assemble (argl) - my name is \"" + name_ + "\""); |
310 | strRep_.truncate(0); | 310 | strRep_.truncate(0); |
311 | 311 | ||
312 | QCString line; | 312 | Q3CString line; |
313 | 313 | ||
314 | if (!group_.isEmpty()) | 314 | if (!group_.isEmpty()) |
315 | line += group_ + '.'; | 315 | line += group_ + '.'; |
316 | 316 | ||
317 | line += name_; | 317 | line += name_; |
318 | 318 | ||
319 | vDebug("Adding parameters"); | 319 | vDebug("Adding parameters"); |
320 | ParamListIterator it(paramList_); | 320 | ParamListIterator it(paramList_); |
321 | 321 | ||
322 | for (; it.current(); ++it) | 322 | for (; it.current(); ++it) |
323 | line += ";" + it.current()->asString(); | 323 | line += ";" + it.current()->asString(); |
324 | 324 | ||
325 | vDebug("Adding value"); | 325 | vDebug("Adding value"); |
326 | if (value_ != 0) | 326 | if (value_ != 0) |
327 | line += ":" + value_->asString(); | 327 | line += ":" + value_->asString(); |
328 | else | 328 | else |
329 | vDebug("No value"); | 329 | vDebug("No value"); |
330 | 330 | ||
331 | // Quote newlines | 331 | // Quote newlines |
332 | line = line.replace( QRegExp( "\n" ), "\\n" ); | 332 | line = line.replace( QRegExp( "\n" ), "\\n" ); |
333 | 333 | ||
334 | // Fold lines longer than 72 chars | 334 | // Fold lines longer than 72 chars |
335 | const int maxLen = 72; | 335 | const int maxLen = 72; |
336 | uint cursor = 0; | 336 | uint cursor = 0; |
337 | while( line.length() > ( cursor + 1 ) * maxLen ) { | 337 | while( line.length() > ( cursor + 1 ) * maxLen ) { |
338 | strRep_ += line.mid( cursor * maxLen, maxLen ); | 338 | strRep_ += line.mid( cursor * maxLen, maxLen ); |
339 | strRep_ += "\r\n "; | 339 | strRep_ += "\r\n "; |
340 | ++cursor; | 340 | ++cursor; |
341 | } | 341 | } |
342 | strRep_ += line.mid( cursor * maxLen ); | 342 | strRep_ += line.mid( cursor * maxLen ); |
343 | qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); | 343 | qDebug("ContentLine::_assemble()\n%s*****", strRep_.data()); |
344 | #endif | 344 | #endif |
345 | } | 345 | } |
346 | 346 | ||
347 | void | 347 | void |
348 | ContentLine::clear() | 348 | ContentLine::clear() |
349 | { | 349 | { |
350 | group_.truncate(0); | 350 | group_.truncate(0); |
351 | name_.truncate(0); | 351 | name_.truncate(0); |
352 | paramList_.clear(); | 352 | paramList_.clear(); |
353 | delete value_; | 353 | delete value_; |
354 | value_ = 0; | 354 | value_ = 0; |
355 | } | 355 | } |
diff --git a/kabc/vcard/DateParam.cpp b/kabc/vcard/DateParam.cpp index 52af089..52fb828 100644 --- a/kabc/vcard/DateParam.cpp +++ b/kabc/vcard/DateParam.cpp | |||
@@ -1,82 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardDateParam.h> | 24 | #include <VCardDateParam.h> |
25 | 25 | ||
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | DateParam::DateParam() | 32 | DateParam::DateParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | DateParam::DateParam(const DateParam & x) | 37 | DateParam::DateParam(const DateParam & x) |
36 | :Param(x) | 38 | :Param(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | DateParam::DateParam(const QCString & s) | 42 | DateParam::DateParam(const Q3CString & s) |
41 | :Param(s) | 43 | :Param(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | DateParam & | 47 | DateParam & |
46 | DateParam::operator = (DateParam & x) | 48 | DateParam::operator = (DateParam & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Param::operator = (x); | 52 | Param::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | DateParam & | 56 | DateParam & |
55 | DateParam::operator = (const QCString & s) | 57 | DateParam::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Param::operator = (s); | 59 | Param::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | DateParam::operator == (DateParam & x) | 64 | DateParam::operator == (DateParam & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | 67 | ||
66 | return false; | 68 | return false; |
67 | } | 69 | } |
68 | 70 | ||
69 | DateParam::~DateParam() | 71 | DateParam::~DateParam() |
70 | { | 72 | { |
71 | } | 73 | } |
72 | 74 | ||
73 | void | 75 | void |
74 | DateParam::_parse() | 76 | DateParam::_parse() |
75 | { | 77 | { |
76 | } | 78 | } |
77 | 79 | ||
78 | void | 80 | void |
79 | DateParam::_assemble() | 81 | DateParam::_assemble() |
80 | { | 82 | { |
81 | } | 83 | } |
82 | 84 | ||
diff --git a/kabc/vcard/DateValue.cpp b/kabc/vcard/DateValue.cpp index c5c5c85..87c7007 100644 --- a/kabc/vcard/DateValue.cpp +++ b/kabc/vcard/DateValue.cpp | |||
@@ -1,434 +1,436 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qregexp.h> | 24 | #include <qregexp.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3CString> | ||
25 | 27 | ||
26 | #include <kdebug.h> | 28 | #include <kdebug.h> |
27 | 29 | ||
28 | #include <VCardDefines.h> | 30 | #include <VCardDefines.h> |
29 | #include <VCardDateValue.h> | 31 | #include <VCardDateValue.h> |
30 | #include <VCardValue.h> | 32 | #include <VCardValue.h> |
31 | 33 | ||
32 | using namespace VCARD; | 34 | using namespace VCARD; |
33 | 35 | ||
34 | DateValue::DateValue() | 36 | DateValue::DateValue() |
35 | :Value() | 37 | :Value() |
36 | { | 38 | { |
37 | vDebug("DateValue::DateValue()"); | 39 | vDebug("DateValue::DateValue()"); |
38 | } | 40 | } |
39 | 41 | ||
40 | DateValue::DateValue( | 42 | DateValue::DateValue( |
41 | unsigned intyear, | 43 | unsigned intyear, |
42 | unsigned intmonth, | 44 | unsigned intmonth, |
43 | unsigned intday, | 45 | unsigned intday, |
44 | unsigned inthour, | 46 | unsigned inthour, |
45 | unsigned intminute, | 47 | unsigned intminute, |
46 | unsigned intsecond, | 48 | unsigned intsecond, |
47 | double secFrac, | 49 | double secFrac, |
48 | bool zonePositive, | 50 | bool zonePositive, |
49 | unsigned intzoneHour, | 51 | unsigned intzoneHour, |
50 | unsigned intzoneMinute) | 52 | unsigned intzoneMinute) |
51 | : Value (), | 53 | : Value (), |
52 | year_ (year), | 54 | year_ (year), |
53 | month_ (month), | 55 | month_ (month), |
54 | day_ (day), | 56 | day_ (day), |
55 | hour_ (hour), | 57 | hour_ (hour), |
56 | minute_ (minute), | 58 | minute_ (minute), |
57 | second_ (second), | 59 | second_ (second), |
58 | zoneHour_ (zoneHour), | 60 | zoneHour_ (zoneHour), |
59 | zoneMinute_ (zoneMinute), | 61 | zoneMinute_ (zoneMinute), |
60 | secFrac_ (secFrac), | 62 | secFrac_ (secFrac), |
61 | zonePositive_(zonePositive), | 63 | zonePositive_(zonePositive), |
62 | hasTime_(true) | 64 | hasTime_(true) |
63 | { | 65 | { |
64 | parsed_ = true; | 66 | parsed_ = true; |
65 | assembled_ = false; | 67 | assembled_ = false; |
66 | } | 68 | } |
67 | 69 | ||
68 | DateValue::DateValue(const QDate & d) | 70 | DateValue::DateValue(const QDate & d) |
69 | : Value (), | 71 | : Value (), |
70 | year_ (d.year()), | 72 | year_ (d.year()), |
71 | month_ (d.month()), | 73 | month_ (d.month()), |
72 | day_ (d.day()), | 74 | day_ (d.day()), |
73 | hasTime_(false) | 75 | hasTime_(false) |
74 | { | 76 | { |
75 | parsed_ = true; | 77 | parsed_ = true; |
76 | assembled_ = false; | 78 | assembled_ = false; |
77 | } | 79 | } |
78 | 80 | ||
79 | DateValue::DateValue(const QDateTime & d) | 81 | DateValue::DateValue(const QDateTime & d) |
80 | : Value (), | 82 | : Value (), |
81 | year_ (d.date().year()), | 83 | year_ (d.date().year()), |
82 | month_ (d.date().month()), | 84 | month_ (d.date().month()), |
83 | day_ (d.date().day()), | 85 | day_ (d.date().day()), |
84 | hour_ (d.time().hour()), | 86 | hour_ (d.time().hour()), |
85 | minute_ (d.time().minute()), | 87 | minute_ (d.time().minute()), |
86 | second_ (d.time().second()), | 88 | second_ (d.time().second()), |
87 | hasTime_(true) | 89 | hasTime_(true) |
88 | { | 90 | { |
89 | parsed_ = true; | 91 | parsed_ = true; |
90 | assembled_ = false; | 92 | assembled_ = false; |
91 | } | 93 | } |
92 | 94 | ||
93 | DateValue::DateValue(const DateValue & x) | 95 | DateValue::DateValue(const DateValue & x) |
94 | :Value(x) | 96 | :Value(x) |
95 | { | 97 | { |
96 | year_ = x.year_; | 98 | year_ = x.year_; |
97 | month_ = x.month_; | 99 | month_ = x.month_; |
98 | day_ = x.day_; | 100 | day_ = x.day_; |
99 | hour_ = x.hour_; | 101 | hour_ = x.hour_; |
100 | minute_ = x.minute_; | 102 | minute_ = x.minute_; |
101 | second_ = x.second_; | 103 | second_ = x.second_; |
102 | zoneHour_ = x.zoneHour_; | 104 | zoneHour_ = x.zoneHour_; |
103 | zoneMinute_ = x.zoneMinute_; | 105 | zoneMinute_ = x.zoneMinute_; |
104 | secFrac_ = x.secFrac_; | 106 | secFrac_ = x.secFrac_; |
105 | hasTime_ = x.hasTime_; | 107 | hasTime_ = x.hasTime_; |
106 | } | 108 | } |
107 | 109 | ||
108 | DateValue::DateValue(const QCString & s) | 110 | DateValue::DateValue(const Q3CString & s) |
109 | :Value(s) | 111 | :Value(s) |
110 | { | 112 | { |
111 | } | 113 | } |
112 | 114 | ||
113 | DateValue & | 115 | DateValue & |
114 | DateValue::operator = (DateValue & x) | 116 | DateValue::operator = (DateValue & x) |
115 | { | 117 | { |
116 | if (*this == x) return *this; | 118 | if (*this == x) return *this; |
117 | 119 | ||
118 | Value::operator = (x); | 120 | Value::operator = (x); |
119 | return *this; | 121 | return *this; |
120 | } | 122 | } |
121 | 123 | ||
122 | DateValue & | 124 | DateValue & |
123 | DateValue::operator = (const QCString & s) | 125 | DateValue::operator = (const Q3CString & s) |
124 | { | 126 | { |
125 | Value::operator = (s); | 127 | Value::operator = (s); |
126 | return *this; | 128 | return *this; |
127 | } | 129 | } |
128 | 130 | ||
129 | bool | 131 | bool |
130 | DateValue::operator == (DateValue & x) | 132 | DateValue::operator == (DateValue & x) |
131 | { | 133 | { |
132 | x.parse(); | 134 | x.parse(); |
133 | return false; | 135 | return false; |
134 | } | 136 | } |
135 | 137 | ||
136 | DateValue::~DateValue() | 138 | DateValue::~DateValue() |
137 | { | 139 | { |
138 | } | 140 | } |
139 | 141 | ||
140 | DateValue * | 142 | DateValue * |
141 | DateValue::clone() | 143 | DateValue::clone() |
142 | { | 144 | { |
143 | return new DateValue( *this ); | 145 | return new DateValue( *this ); |
144 | } | 146 | } |
145 | 147 | ||
146 | void | 148 | void |
147 | DateValue::_parse() | 149 | DateValue::_parse() |
148 | { | 150 | { |
149 | vDebug("DateValue::_parse()"); | 151 | vDebug("DateValue::_parse()"); |
150 | 152 | ||
151 | // date = date-full-year ["-"] date-month ["-"] date-mday | 153 | // date = date-full-year ["-"] date-month ["-"] date-mday |
152 | // time = time-hour [":"] time-minute [":"] time-second [":"] | 154 | // time = time-hour [":"] time-minute [":"] time-second [":"] |
153 | // [time-secfrac] [time-zone] | 155 | // [time-secfrac] [time-zone] |
154 | 156 | ||
155 | int timeSep = strRep_.find('T'); | 157 | int timeSep = strRep_.find('T'); |
156 | 158 | ||
157 | QCString dateStr; | 159 | Q3CString dateStr; |
158 | QCString timeStr; | 160 | Q3CString timeStr; |
159 | 161 | ||
160 | if (timeSep == -1) { | 162 | if (timeSep == -1) { |
161 | 163 | ||
162 | dateStr = strRep_; | 164 | dateStr = strRep_; |
163 | vDebug("Has date string \"" + dateStr + "\""); | 165 | vDebug("Has date string \"" + dateStr + "\""); |
164 | 166 | ||
165 | } else { | 167 | } else { |
166 | 168 | ||
167 | dateStr = strRep_.left(timeSep); | 169 | dateStr = strRep_.left(timeSep); |
168 | vDebug("Has date string \"" + dateStr + "\""); | 170 | vDebug("Has date string \"" + dateStr + "\""); |
169 | 171 | ||
170 | timeStr = strRep_.mid(timeSep + 1); | 172 | timeStr = strRep_.mid(timeSep + 1); |
171 | vDebug("Has time string \"" + timeStr + "\""); | 173 | vDebug("Has time string \"" + timeStr + "\""); |
172 | } | 174 | } |
173 | 175 | ||
174 | /////////////////////////////////////////////////////////////// DATE | 176 | /////////////////////////////////////////////////////////////// DATE |
175 | 177 | ||
176 | dateStr.replace(QRegExp("-"), ""); | 178 | dateStr.replace("-", ""); |
177 | 179 | ||
178 | kdDebug(5710) << "dateStr: " << dateStr << endl; | 180 | kdDebug(5710) << "dateStr: " << dateStr << endl; |
179 | 181 | ||
180 | year_= dateStr.left(4).toInt(); | 182 | year_= dateStr.left(4).toInt(); |
181 | month_= dateStr.mid(4, 2).toInt(); | 183 | month_= dateStr.mid(4, 2).toInt(); |
182 | day_= dateStr.right(2).toInt(); | 184 | day_= dateStr.right(2).toInt(); |
183 | 185 | ||
184 | if (timeSep == -1) { | 186 | if (timeSep == -1) { |
185 | hasTime_ = false; | 187 | hasTime_ = false; |
186 | return; // No time, done. | 188 | return; // No time, done. |
187 | } | 189 | } |
188 | else | 190 | else |
189 | hasTime_ = true; | 191 | hasTime_ = true; |
190 | 192 | ||
191 | /////////////////////////////////////////////////////////////// TIME | 193 | /////////////////////////////////////////////////////////////// TIME |
192 | 194 | ||
193 | /////////////////////////////////////////////////////////////// ZONE | 195 | /////////////////////////////////////////////////////////////// ZONE |
194 | 196 | ||
195 | int zoneSep = timeStr.find('Z'); | 197 | int zoneSep = timeStr.find('Z'); |
196 | 198 | ||
197 | if (zoneSep != -1 && timeStr.length() - zoneSep > 3) { | 199 | if (zoneSep != -1 && timeStr.length() - zoneSep > 3) { |
198 | 200 | ||
199 | QCString zoneStr(timeStr.mid(zoneSep + 1)); | 201 | Q3CString zoneStr(timeStr.mid(zoneSep + 1)); |
200 | vDebug("zoneStr == " + zoneStr); | 202 | vDebug("zoneStr == " + zoneStr); |
201 | 203 | ||
202 | zonePositive_= (zoneStr[0] == '+'); | 204 | zonePositive_= (zoneStr[0] == '+'); |
203 | zoneHour_ = zoneStr.mid(1, 2).toInt(); | 205 | zoneHour_ = zoneStr.mid(1, 2).toInt(); |
204 | zoneMinute_ = zoneStr.right(2).toInt(); | 206 | zoneMinute_ = zoneStr.right(2).toInt(); |
205 | 207 | ||
206 | timeStr.remove(zoneSep, timeStr.length() - zoneSep); | 208 | timeStr.remove(zoneSep, timeStr.length() - zoneSep); |
207 | } | 209 | } |
208 | 210 | ||
209 | //////////////////////////////////////////////////// SECOND FRACTION | 211 | //////////////////////////////////////////////////// SECOND FRACTION |
210 | 212 | ||
211 | int secFracSep = timeStr.findRev(','); | 213 | int secFracSep = timeStr.findRev(','); |
212 | 214 | ||
213 | if (secFracSep != -1 && zoneSep != -1) { // zoneSep checked to avoid errors. | 215 | if (secFracSep != -1 && zoneSep != -1) { // zoneSep checked to avoid errors. |
214 | QCString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep); | 216 | Q3CString quirkafleeg = "0." + timeStr.mid(secFracSep + 1, zoneSep); |
215 | secFrac_ = quirkafleeg.toDouble(); | 217 | secFrac_ = quirkafleeg.toDouble(); |
216 | } | 218 | } |
217 | 219 | ||
218 | /////////////////////////////////////////////////////////////// HMS | 220 | /////////////////////////////////////////////////////////////// HMS |
219 | 221 | ||
220 | timeStr.replace(QRegExp(":"), ""); | 222 | timeStr.replace(":", ""); |
221 | 223 | ||
222 | hour_= timeStr.left(2).toInt(); | 224 | hour_= timeStr.left(2).toInt(); |
223 | minute_= timeStr.mid(2, 2).toInt(); | 225 | minute_= timeStr.mid(2, 2).toInt(); |
224 | second_= timeStr.mid(4, 2).toInt(); | 226 | second_= timeStr.mid(4, 2).toInt(); |
225 | } | 227 | } |
226 | 228 | ||
227 | void | 229 | void |
228 | DateValue::_assemble() | 230 | DateValue::_assemble() |
229 | { | 231 | { |
230 | vDebug("DateValue::_assemble"); | 232 | vDebug("DateValue::_assemble"); |
231 | 233 | ||
232 | QCString year; | 234 | Q3CString year; |
233 | QCString month; | 235 | Q3CString month; |
234 | QCString day; | 236 | Q3CString day; |
235 | 237 | ||
236 | year.setNum( year_ ); | 238 | year.setNum( year_ ); |
237 | month.setNum( month_ ); | 239 | month.setNum( month_ ); |
238 | day.setNum( day_ ); | 240 | day.setNum( day_ ); |
239 | 241 | ||
240 | if ( month.length() < 2 ) month.prepend( "0" ); | 242 | if ( month.length() < 2 ) month.prepend( "0" ); |
241 | if ( day.length() < 2 ) day.prepend( "0" ); | 243 | if ( day.length() < 2 ) day.prepend( "0" ); |
242 | 244 | ||
243 | strRep_ = year + '-' + month + '-' + day; | 245 | strRep_ = year + '-' + month + '-' + day; |
244 | 246 | ||
245 | if ( hasTime_ ) { | 247 | if ( hasTime_ ) { |
246 | QCString hour; | 248 | Q3CString hour; |
247 | QCString minute; | 249 | Q3CString minute; |
248 | QCString second; | 250 | Q3CString second; |
249 | 251 | ||
250 | hour.setNum( hour_ ); | 252 | hour.setNum( hour_ ); |
251 | minute.setNum( minute_ ); | 253 | minute.setNum( minute_ ); |
252 | second.setNum( second_ ); | 254 | second.setNum( second_ ); |
253 | 255 | ||
254 | if ( hour.length() < 2 ) hour.prepend( "0" ); | 256 | if ( hour.length() < 2 ) hour.prepend( "0" ); |
255 | if ( minute.length() < 2 ) minute.prepend( "0" ); | 257 | if ( minute.length() < 2 ) minute.prepend( "0" ); |
256 | if ( second.length() < 2 ) second.prepend( "0" ); | 258 | if ( second.length() < 2 ) second.prepend( "0" ); |
257 | 259 | ||
258 | strRep_ += 'T' + hour + ':' + minute + ':' + second + 'Z'; | 260 | strRep_ += 'T' + hour + ':' + minute + ':' + second + 'Z'; |
259 | } | 261 | } |
260 | } | 262 | } |
261 | 263 | ||
262 | unsigned int | 264 | unsigned int |
263 | DateValue::year() | 265 | DateValue::year() |
264 | { | 266 | { |
265 | parse(); | 267 | parse(); |
266 | return year_; | 268 | return year_; |
267 | } | 269 | } |
268 | 270 | ||
269 | unsigned int | 271 | unsigned int |
270 | DateValue::month() | 272 | DateValue::month() |
271 | { | 273 | { |
272 | parse(); | 274 | parse(); |
273 | return month_; | 275 | return month_; |
274 | } | 276 | } |
275 | 277 | ||
276 | unsigned int | 278 | unsigned int |
277 | DateValue::day() | 279 | DateValue::day() |
278 | { | 280 | { |
279 | parse(); | 281 | parse(); |
280 | return day_; | 282 | return day_; |
281 | } | 283 | } |
282 | unsigned int | 284 | unsigned int |
283 | DateValue::hour() | 285 | DateValue::hour() |
284 | { | 286 | { |
285 | parse(); | 287 | parse(); |
286 | return hour_; | 288 | return hour_; |
287 | } | 289 | } |
288 | 290 | ||
289 | unsigned int | 291 | unsigned int |
290 | DateValue::minute() | 292 | DateValue::minute() |
291 | { | 293 | { |
292 | parse(); | 294 | parse(); |
293 | return minute_; | 295 | return minute_; |
294 | } | 296 | } |
295 | 297 | ||
296 | unsigned int | 298 | unsigned int |
297 | DateValue::second() | 299 | DateValue::second() |
298 | { | 300 | { |
299 | parse(); | 301 | parse(); |
300 | return second_; | 302 | return second_; |
301 | } | 303 | } |
302 | 304 | ||
303 | double | 305 | double |
304 | DateValue::secondFraction() | 306 | DateValue::secondFraction() |
305 | { | 307 | { |
306 | parse(); | 308 | parse(); |
307 | return secFrac_; | 309 | return secFrac_; |
308 | } | 310 | } |
309 | 311 | ||
310 | bool | 312 | bool |
311 | DateValue::zonePositive() | 313 | DateValue::zonePositive() |
312 | { | 314 | { |
313 | parse(); | 315 | parse(); |
314 | return zonePositive_; | 316 | return zonePositive_; |
315 | } | 317 | } |
316 | 318 | ||
317 | unsigned int | 319 | unsigned int |
318 | DateValue::zoneHour() | 320 | DateValue::zoneHour() |
319 | { | 321 | { |
320 | parse(); | 322 | parse(); |
321 | return zoneHour_; | 323 | return zoneHour_; |
322 | } | 324 | } |
323 | 325 | ||
324 | unsigned int | 326 | unsigned int |
325 | DateValue::zoneMinute() | 327 | DateValue::zoneMinute() |
326 | { | 328 | { |
327 | parse(); | 329 | parse(); |
328 | return zoneMinute_; | 330 | return zoneMinute_; |
329 | } | 331 | } |
330 | 332 | ||
331 | void | 333 | void |
332 | DateValue::setYear(unsigned int i) | 334 | DateValue::setYear(unsigned int i) |
333 | { | 335 | { |
334 | year_ = i; | 336 | year_ = i; |
335 | assembled_ = false; | 337 | assembled_ = false; |
336 | } | 338 | } |
337 | 339 | ||
338 | void | 340 | void |
339 | DateValue::setMonth(unsigned int i) | 341 | DateValue::setMonth(unsigned int i) |
340 | { | 342 | { |
341 | month_ = i; | 343 | month_ = i; |
342 | assembled_ = false; | 344 | assembled_ = false; |
343 | } | 345 | } |
344 | 346 | ||
345 | void | 347 | void |
346 | DateValue::setDay(unsigned int i) | 348 | DateValue::setDay(unsigned int i) |
347 | { | 349 | { |
348 | day_ = i; | 350 | day_ = i; |
349 | assembled_ = false; | 351 | assembled_ = false; |
350 | } | 352 | } |
351 | 353 | ||
352 | void | 354 | void |
353 | DateValue::setHour(unsigned int i) | 355 | DateValue::setHour(unsigned int i) |
354 | { | 356 | { |
355 | hour_ = i; | 357 | hour_ = i; |
356 | assembled_ = false; | 358 | assembled_ = false; |
357 | } | 359 | } |
358 | 360 | ||
359 | void | 361 | void |
360 | DateValue::setMinute(unsigned int i) | 362 | DateValue::setMinute(unsigned int i) |
361 | { | 363 | { |
362 | minute_ = i; | 364 | minute_ = i; |
363 | assembled_ = false; | 365 | assembled_ = false; |
364 | } | 366 | } |
365 | 367 | ||
366 | void | 368 | void |
367 | DateValue::setSecond(unsigned int i) | 369 | DateValue::setSecond(unsigned int i) |
368 | { | 370 | { |
369 | second_ = i; | 371 | second_ = i; |
370 | assembled_ = false; | 372 | assembled_ = false; |
371 | } | 373 | } |
372 | 374 | ||
373 | void | 375 | void |
374 | DateValue::setSecondFraction(double d) | 376 | DateValue::setSecondFraction(double d) |
375 | { | 377 | { |
376 | secFrac_ = d; | 378 | secFrac_ = d; |
377 | assembled_ = false; | 379 | assembled_ = false; |
378 | } | 380 | } |
379 | 381 | ||
380 | void | 382 | void |
381 | DateValue::setZonePositive(bool b) | 383 | DateValue::setZonePositive(bool b) |
382 | { | 384 | { |
383 | zonePositive_ = b; | 385 | zonePositive_ = b; |
384 | assembled_ = false; | 386 | assembled_ = false; |
385 | } | 387 | } |
386 | 388 | ||
387 | void | 389 | void |
388 | DateValue::setZoneHour(unsigned int i) | 390 | DateValue::setZoneHour(unsigned int i) |
389 | { | 391 | { |
390 | zoneHour_ = i; | 392 | zoneHour_ = i; |
391 | assembled_ = false; | 393 | assembled_ = false; |
392 | } | 394 | } |
393 | 395 | ||
394 | void | 396 | void |
395 | DateValue::setZoneMinute(unsigned int i) | 397 | DateValue::setZoneMinute(unsigned int i) |
396 | { | 398 | { |
397 | zoneMinute_ = i; | 399 | zoneMinute_ = i; |
398 | assembled_ = false; | 400 | assembled_ = false; |
399 | } | 401 | } |
400 | 402 | ||
401 | QDate | 403 | QDate |
402 | DateValue::qdate() | 404 | DateValue::qdate() |
403 | { | 405 | { |
404 | parse(); | 406 | parse(); |
405 | QDate d(year_, month_, day_); | 407 | QDate d(year_, month_, day_); |
406 | return d; | 408 | return d; |
407 | } | 409 | } |
408 | 410 | ||
409 | QTime | 411 | QTime |
410 | DateValue::qtime() | 412 | DateValue::qtime() |
411 | { | 413 | { |
412 | parse(); | 414 | parse(); |
413 | QTime t(hour_, minute_, second_); | 415 | QTime t(hour_, minute_, second_); |
414 | //t.setMs(1 / secFrac_); | 416 | //t.setMs(1 / secFrac_); |
415 | return t; | 417 | return t; |
416 | } | 418 | } |
417 | 419 | ||
418 | QDateTime | 420 | QDateTime |
419 | DateValue::qdt() | 421 | DateValue::qdt() |
420 | { | 422 | { |
421 | parse(); | 423 | parse(); |
422 | QDateTime dt; | 424 | QDateTime dt; |
423 | dt.setDate(qdate()); | 425 | dt.setDate(qdate()); |
424 | dt.setTime(qtime()); | 426 | dt.setTime(qtime()); |
425 | return dt; | 427 | return dt; |
426 | } | 428 | } |
427 | 429 | ||
428 | bool | 430 | bool |
429 | DateValue::hasTime() | 431 | DateValue::hasTime() |
430 | { | 432 | { |
431 | parse(); | 433 | parse(); |
432 | return hasTime_; | 434 | return hasTime_; |
433 | } | 435 | } |
434 | 436 | ||
diff --git a/kabc/vcard/EmailParam.cpp b/kabc/vcard/EmailParam.cpp index 8c87477..877af60 100644 --- a/kabc/vcard/EmailParam.cpp +++ b/kabc/vcard/EmailParam.cpp | |||
@@ -1,116 +1,118 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardEmailParam.h> | 24 | #include <VCardEmailParam.h> |
25 | #include <VCardParam.h> | 25 | #include <VCardParam.h> |
26 | #include <VCardDefines.h> | 26 | #include <VCardDefines.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | EmailParam::EmailParam() | 32 | EmailParam::EmailParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | vDebug("ctor"); | 35 | vDebug("ctor"); |
34 | } | 36 | } |
35 | 37 | ||
36 | EmailParam::EmailParam(const EmailParam & x) | 38 | EmailParam::EmailParam(const EmailParam & x) |
37 | :Param(x), | 39 | :Param(x), |
38 | emailType_(x.emailType_), | 40 | emailType_(x.emailType_), |
39 | pref_ (x.pref_) | 41 | pref_ (x.pref_) |
40 | { | 42 | { |
41 | } | 43 | } |
42 | 44 | ||
43 | EmailParam::EmailParam(const QCString & s) | 45 | EmailParam::EmailParam(const Q3CString & s) |
44 | :Param(s) | 46 | :Param(s) |
45 | { | 47 | { |
46 | } | 48 | } |
47 | 49 | ||
48 | EmailParam & | 50 | EmailParam & |
49 | EmailParam::operator = (EmailParam & x) | 51 | EmailParam::operator = (EmailParam & x) |
50 | { | 52 | { |
51 | if (*this == x) return *this; | 53 | if (*this == x) return *this; |
52 | 54 | ||
53 | emailType_= x.emailType(); | 55 | emailType_= x.emailType(); |
54 | pref_ = x.pref_; | 56 | pref_ = x.pref_; |
55 | 57 | ||
56 | Param::operator = (x); | 58 | Param::operator = (x); |
57 | return *this; | 59 | return *this; |
58 | } | 60 | } |
59 | 61 | ||
60 | EmailParam & | 62 | EmailParam & |
61 | EmailParam::operator = (const QCString & s) | 63 | EmailParam::operator = (const Q3CString & s) |
62 | { | 64 | { |
63 | Param::operator = (s); | 65 | Param::operator = (s); |
64 | return *this; | 66 | return *this; |
65 | } | 67 | } |
66 | 68 | ||
67 | bool | 69 | bool |
68 | EmailParam::operator == (EmailParam & x) | 70 | EmailParam::operator == (EmailParam & x) |
69 | { | 71 | { |
70 | parse(); | 72 | parse(); |
71 | 73 | ||
72 | if (pref_) | 74 | if (pref_) |
73 | return (x.pref_ && x.emailType() == emailType_); | 75 | return (x.pref_ && x.emailType() == emailType_); |
74 | 76 | ||
75 | return !x.pref(); | 77 | return !x.pref(); |
76 | } | 78 | } |
77 | 79 | ||
78 | EmailParam::~EmailParam() | 80 | EmailParam::~EmailParam() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
82 | void | 84 | void |
83 | EmailParam::_parse() | 85 | EmailParam::_parse() |
84 | { | 86 | { |
85 | #if 0 | 87 | #if 0 |
86 | Param::parseToList(); | 88 | Param::parseToList(); |
87 | 89 | ||
88 | SubParamListIterator it(subParamList_); | 90 | SubParamListIterator it(subParamList_); |
89 | 91 | ||
90 | pref_ = true; | 92 | pref_ = true; |
91 | emailType_ = ""; | 93 | emailType_ = ""; |
92 | 94 | ||
93 | for (; it.current(); ++it) { | 95 | for (; it.current(); ++it) { |
94 | 96 | ||
95 | if (qstricmp(it.current()->name(), "TYPE") == 0) { | 97 | if (qstricmp(it.current()->name(), "TYPE") == 0) { |
96 | emailType_ = it.current()->value(); | 98 | emailType_ = it.current()->value(); |
97 | continue; | 99 | continue; |
98 | } | 100 | } |
99 | 101 | ||
100 | if (qstricmp(it.current()->name(), "PREF") == 0) { | 102 | if (qstricmp(it.current()->name(), "PREF") == 0) { |
101 | pref_ = true; | 103 | pref_ = true; |
102 | } | 104 | } |
103 | } | 105 | } |
104 | #endif | 106 | #endif |
105 | } | 107 | } |
106 | 108 | ||
107 | void | 109 | void |
108 | EmailParam::_assemble() | 110 | EmailParam::_assemble() |
109 | { | 111 | { |
110 | strRep_ = "TYPE="; | 112 | strRep_ = "TYPE="; |
111 | strRep_ += emailType_; | 113 | strRep_ += emailType_; |
112 | 114 | ||
113 | if (pref_) | 115 | if (pref_) |
114 | strRep_ += ",PREF"; | 116 | strRep_ += ",PREF"; |
115 | } | 117 | } |
116 | 118 | ||
diff --git a/kabc/vcard/Entity.cpp b/kabc/vcard/Entity.cpp index b7d09e0..e38fa11 100644 --- a/kabc/vcard/Entity.cpp +++ b/kabc/vcard/Entity.cpp | |||
@@ -1,134 +1,136 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardEntity.h> | 24 | #include <VCardEntity.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3CString> | ||
25 | 27 | ||
26 | using namespace VCARD; | 28 | using namespace VCARD; |
27 | 29 | ||
28 | Entity::Entity() | 30 | Entity::Entity() |
29 | : parsed_ (false), | 31 | : parsed_ (false), |
30 | assembled_(true) | 32 | assembled_(true) |
31 | { | 33 | { |
32 | // empty | 34 | // empty |
33 | } | 35 | } |
34 | 36 | ||
35 | Entity::Entity(const Entity & e) | 37 | Entity::Entity(const Entity & e) |
36 | : strRep_ (e.strRep_), | 38 | : strRep_ (e.strRep_), |
37 | parsed_ (e.parsed_), | 39 | parsed_ (e.parsed_), |
38 | assembled_(e.assembled_) | 40 | assembled_(e.assembled_) |
39 | { | 41 | { |
40 | // empty | 42 | // empty |
41 | } | 43 | } |
42 | 44 | ||
43 | Entity::Entity(const QCString & s) | 45 | Entity::Entity(const Q3CString & s) |
44 | : strRep_ (s), | 46 | : strRep_ (s), |
45 | parsed_ (false), | 47 | parsed_ (false), |
46 | assembled_(true) | 48 | assembled_(true) |
47 | { | 49 | { |
48 | // empty | 50 | // empty |
49 | } | 51 | } |
50 | 52 | ||
51 | Entity & | 53 | Entity & |
52 | Entity::operator = (const Entity & e) | 54 | Entity::operator = (const Entity & e) |
53 | { | 55 | { |
54 | if (this == &e) return *this; | 56 | if (this == &e) return *this; |
55 | 57 | ||
56 | strRep_ = e.strRep_; | 58 | strRep_ = e.strRep_; |
57 | parsed_ = e.parsed_; | 59 | parsed_ = e.parsed_; |
58 | assembled_= e.assembled_; | 60 | assembled_= e.assembled_; |
59 | 61 | ||
60 | return *this; | 62 | return *this; |
61 | } | 63 | } |
62 | 64 | ||
63 | Entity & | 65 | Entity & |
64 | Entity::operator = (const QCString & s) | 66 | Entity::operator = (const Q3CString & s) |
65 | { | 67 | { |
66 | strRep_ = s; | 68 | strRep_ = s; |
67 | parsed_ = false; | 69 | parsed_ = false; |
68 | assembled_= true; | 70 | assembled_= true; |
69 | 71 | ||
70 | return *this; | 72 | return *this; |
71 | } | 73 | } |
72 | 74 | ||
73 | bool | 75 | bool |
74 | Entity::operator == (Entity & e) | 76 | Entity::operator == (Entity & e) |
75 | { | 77 | { |
76 | return asString() == e.asString(); | 78 | return asString() == e.asString(); |
77 | } | 79 | } |
78 | 80 | ||
79 | bool | 81 | bool |
80 | Entity::operator != (Entity & e) | 82 | Entity::operator != (Entity & e) |
81 | { | 83 | { |
82 | return !(*this == e); | 84 | return !(*this == e); |
83 | } | 85 | } |
84 | 86 | ||
85 | bool | 87 | bool |
86 | Entity::operator == (const QCString & s) | 88 | Entity::operator == (const Q3CString & s) |
87 | { | 89 | { |
88 | return asString() == s; | 90 | return asString() == s; |
89 | } | 91 | } |
90 | 92 | ||
91 | bool | 93 | bool |
92 | Entity::operator != (const QCString & s) | 94 | Entity::operator != (const Q3CString & s) |
93 | { | 95 | { |
94 | return !(*this == s); | 96 | return !(*this == s); |
95 | } | 97 | } |
96 | 98 | ||
97 | Entity::~Entity() | 99 | Entity::~Entity() |
98 | { | 100 | { |
99 | // empty | 101 | // empty |
100 | } | 102 | } |
101 | 103 | ||
102 | QCString | 104 | Q3CString |
103 | Entity::asString() | 105 | Entity::asString() |
104 | { | 106 | { |
105 | //vDebug("Entity::asString()"); | 107 | //vDebug("Entity::asString()"); |
106 | assemble(); | 108 | assemble(); |
107 | 109 | ||
108 | return strRep_; | 110 | return strRep_; |
109 | } | 111 | } |
110 | 112 | ||
111 | void | 113 | void |
112 | Entity::parse() | 114 | Entity::parse() |
113 | { | 115 | { |
114 | //vDebug( "Entity::parse()" ); | 116 | //vDebug( "Entity::parse()" ); |
115 | 117 | ||
116 | if (!parsed_) _parse(); | 118 | if (!parsed_) _parse(); |
117 | 119 | ||
118 | parsed_ = true; | 120 | parsed_ = true; |
119 | assembled_= false; | 121 | assembled_= false; |
120 | } | 122 | } |
121 | 123 | ||
122 | void | 124 | void |
123 | Entity::assemble() | 125 | Entity::assemble() |
124 | { | 126 | { |
125 | //vDebug( "Entity::assemble()" ); | 127 | //vDebug( "Entity::assemble()" ); |
126 | 128 | ||
127 | if (assembled_) return; | 129 | if (assembled_) return; |
128 | 130 | ||
129 | parse(); | 131 | parse(); |
130 | _assemble(); | 132 | _assemble(); |
131 | 133 | ||
132 | assembled_= true; | 134 | assembled_= true; |
133 | } | 135 | } |
134 | 136 | ||
diff --git a/kabc/vcard/Enum.cpp b/kabc/vcard/Enum.cpp index cc48b5a..036324c 100644 --- a/kabc/vcard/Enum.cpp +++ b/kabc/vcard/Enum.cpp | |||
@@ -1,482 +1,482 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcstring.h> | 24 | #include <q3cstring.h> |
25 | #include <ctype.h> | 25 | #include <ctype.h> |
26 | 26 | ||
27 | #include <VCardEnum.h> | 27 | #include <VCardEnum.h> |
28 | 28 | ||
29 | using namespace VCARD; | 29 | using namespace VCARD; |
30 | 30 | ||
31 | // There are 31 possible types, not including extensions. | 31 | // There are 31 possible types, not including extensions. |
32 | const QCString | 32 | const Q3CString |
33 | VCARD::paramNames [] = | 33 | VCARD::paramNames [] = |
34 | { | 34 | { |
35 | "NAME", | 35 | "NAME", |
36 | "PROFILE", | 36 | "PROFILE", |
37 | "SOURCE", | 37 | "SOURCE", |
38 | "FN", | 38 | "FN", |
39 | "N", | 39 | "N", |
40 | "NICKNAME", | 40 | "NICKNAME", |
41 | "PHOTO", | 41 | "PHOTO", |
42 | "BDAY", | 42 | "BDAY", |
43 | "ADR", | 43 | "ADR", |
44 | "LABEL", | 44 | "LABEL", |
45 | "TEL", | 45 | "TEL", |
46 | "EMAIL", | 46 | "EMAIL", |
47 | "MAILER", | 47 | "MAILER", |
48 | "TZ", | 48 | "TZ", |
49 | "GEO", | 49 | "GEO", |
50 | "TITLE", | 50 | "TITLE", |
51 | "ROLE", | 51 | "ROLE", |
52 | "LOGO", | 52 | "LOGO", |
53 | "AGENT", | 53 | "AGENT", |
54 | "ORG", | 54 | "ORG", |
55 | "CATEGORIES", | 55 | "CATEGORIES", |
56 | "NOTE", | 56 | "NOTE", |
57 | "PRODID", | 57 | "PRODID", |
58 | "REV", | 58 | "REV", |
59 | "SORT-STRING", | 59 | "SORT-STRING", |
60 | "SOUND", | 60 | "SOUND", |
61 | "UID", | 61 | "UID", |
62 | "URL", | 62 | "URL", |
63 | "VERSION", | 63 | "VERSION", |
64 | "CLASS", | 64 | "CLASS", |
65 | "KEY" | 65 | "KEY" |
66 | }; | 66 | }; |
67 | 67 | ||
68 | const ParamType | 68 | const ParamType |
69 | VCARD::paramTypesTable[] = { | 69 | VCARD::paramTypesTable[] = { |
70 | ParamNone, // NAME | 70 | ParamNone, // NAME |
71 | ParamNone, // PROFILE | 71 | ParamNone, // PROFILE |
72 | ParamSource, // SOURCE | 72 | ParamSource, // SOURCE |
73 | ParamText, // FN | 73 | ParamText, // FN |
74 | ParamText, // N | 74 | ParamText, // N |
75 | ParamText, // NICKNAME | 75 | ParamText, // NICKNAME |
76 | ParamImage, // PHOTO (inline/refer) | 76 | ParamImage, // PHOTO (inline/refer) |
77 | ParamDate, // BDAY ("VALUE = "date-time/date) | 77 | ParamDate, // BDAY ("VALUE = "date-time/date) |
78 | ParamAddrText, // ADR (adr-param/text-param) | 78 | ParamAddrText, // ADR (adr-param/text-param) |
79 | ParamAddrText, // LABEL (adr-param/text-param) | 79 | ParamAddrText, // LABEL (adr-param/text-param) |
80 | ParamTel, // TEL | 80 | ParamTel, // TEL |
81 | ParamEmail, // EMAIL | 81 | ParamEmail, // EMAIL |
82 | ParamText, // MAILER | 82 | ParamText, // MAILER |
83 | ParamNone, // TZ | 83 | ParamNone, // TZ |
84 | ParamNone, // GEO | 84 | ParamNone, // GEO |
85 | ParamText, // TITLE | 85 | ParamText, // TITLE |
86 | ParamText, // ROLE | 86 | ParamText, // ROLE |
87 | ParamImage, // LOGO | 87 | ParamImage, // LOGO |
88 | ParamAgent, // AGENT | 88 | ParamAgent, // AGENT |
89 | ParamText, // ORG | 89 | ParamText, // ORG |
90 | ParamText, // CATEGORIES | 90 | ParamText, // CATEGORIES |
91 | ParamText, // NOTE | 91 | ParamText, // NOTE |
92 | ParamNone, // PRODID | 92 | ParamNone, // PRODID |
93 | ParamDate, // REV | 93 | ParamDate, // REV |
94 | ParamText, // SORT-STRING | 94 | ParamText, // SORT-STRING |
95 | ParamSound, // SOUND | 95 | ParamSound, // SOUND |
96 | ParamNone, // UID | 96 | ParamNone, // UID |
97 | ParamNone, // URL | 97 | ParamNone, // URL |
98 | ParamNone, // VERSION | 98 | ParamNone, // VERSION |
99 | ParamNone, // CLASS | 99 | ParamNone, // CLASS |
100 | ParamTextBin, // KEY | 100 | ParamTextBin, // KEY |
101 | ParamTextNS // X | 101 | ParamTextNS // X |
102 | }; | 102 | }; |
103 | 103 | ||
104 | ParamType | 104 | ParamType |
105 | VCARD::EntityTypeToParamType(EntityType e) | 105 | VCARD::EntityTypeToParamType(EntityType e) |
106 | { | 106 | { |
107 | ParamType t(ParamUnknown); | 107 | ParamType t(ParamUnknown); |
108 | 108 | ||
109 | switch (e) { | 109 | switch (e) { |
110 | 110 | ||
111 | //---------------------------------------------------------------// | 111 | //---------------------------------------------------------------// |
112 | case EntityAgent: t = ParamAgent; break; | 112 | case EntityAgent: t = ParamAgent; break; |
113 | //---------------------------------------------------------------// | 113 | //---------------------------------------------------------------// |
114 | case EntitySound: t = ParamSound; break; | 114 | case EntitySound: t = ParamSound; break; |
115 | //---------------------------------------------------------------// | 115 | //---------------------------------------------------------------// |
116 | case EntitySource: t = ParamSource;break; | 116 | case EntitySource: t = ParamSource;break; |
117 | //---------------------------------------------------------------// | 117 | //---------------------------------------------------------------// |
118 | case EntityTelephone: t = ParamTel; break; | 118 | case EntityTelephone: t = ParamTel; break; |
119 | //---------------------------------------------------------------// | 119 | //---------------------------------------------------------------// |
120 | case EntityEmail: t = ParamEmail; break; | 120 | case EntityEmail: t = ParamEmail; break; |
121 | //---------------------------------------------------------------// | 121 | //---------------------------------------------------------------// |
122 | case EntityKey: t = ParamTextBin;break; | 122 | case EntityKey: t = ParamTextBin;break; |
123 | //---------------------------------------------------------------// | 123 | //---------------------------------------------------------------// |
124 | case EntityExtension: t = ParamTextNS;break; | 124 | case EntityExtension: t = ParamTextNS;break; |
125 | //---------------------------------------------------------------// | 125 | //---------------------------------------------------------------// |
126 | case EntityAddress: | 126 | case EntityAddress: |
127 | case EntityLabel: t = ParamAddrText;break; | 127 | case EntityLabel: t = ParamAddrText;break; |
128 | //---------------------------------------------------------------// | 128 | //---------------------------------------------------------------// |
129 | case EntityBirthday: | 129 | case EntityBirthday: |
130 | case EntityRevision: t = ParamDate; break; | 130 | case EntityRevision: t = ParamDate; break; |
131 | //---------------------------------------------------------------// | 131 | //---------------------------------------------------------------// |
132 | case EntityPhoto: | 132 | case EntityPhoto: |
133 | case EntityLogo: t = ParamImage; break; | 133 | case EntityLogo: t = ParamImage; break; |
134 | //---------------------------------------------------------------// | 134 | //---------------------------------------------------------------// |
135 | case EntityOrganisation: | 135 | case EntityOrganisation: |
136 | case EntityTitle: | 136 | case EntityTitle: |
137 | case EntityRole: | 137 | case EntityRole: |
138 | case EntityFullName: | 138 | case EntityFullName: |
139 | case EntityMailer: | 139 | case EntityMailer: |
140 | case EntityN: | 140 | case EntityN: |
141 | case EntitySortString: | 141 | case EntitySortString: |
142 | case EntityNickname: | 142 | case EntityNickname: |
143 | case EntityCategories: | 143 | case EntityCategories: |
144 | case EntityNote: t = ParamText; break; | 144 | case EntityNote: t = ParamText; break; |
145 | //---------------------------------------------------------------// | 145 | //---------------------------------------------------------------// |
146 | case EntityProductID: | 146 | case EntityProductID: |
147 | case EntityTimeZone: | 147 | case EntityTimeZone: |
148 | case EntityUID: | 148 | case EntityUID: |
149 | case EntityURL: | 149 | case EntityURL: |
150 | case EntityClass: | 150 | case EntityClass: |
151 | case EntityGeo: | 151 | case EntityGeo: |
152 | case EntityName: | 152 | case EntityName: |
153 | case EntityVersion: | 153 | case EntityVersion: |
154 | case EntityProfile: | 154 | case EntityProfile: |
155 | default: t = ParamNone; break; | 155 | default: t = ParamNone; break; |
156 | //---------------------------------------------------------------// | 156 | //---------------------------------------------------------------// |
157 | 157 | ||
158 | } | 158 | } |
159 | 159 | ||
160 | return t; | 160 | return t; |
161 | } | 161 | } |
162 | 162 | ||
163 | ValueType | 163 | ValueType |
164 | VCARD::EntityTypeToValueType(EntityType e) | 164 | VCARD::EntityTypeToValueType(EntityType e) |
165 | { | 165 | { |
166 | ValueType t(ValueUnknown); | 166 | ValueType t(ValueUnknown); |
167 | 167 | ||
168 | switch (e) { | 168 | switch (e) { |
169 | 169 | ||
170 | //---------------------------------------------------------------// | 170 | //---------------------------------------------------------------// |
171 | case EntitySound: t = ValueSound; break; | 171 | case EntitySound: t = ValueSound; break; |
172 | //---------------------------------------------------------------// | 172 | //---------------------------------------------------------------// |
173 | case EntityAgent: t = ValueAgent; break; | 173 | case EntityAgent: t = ValueAgent; break; |
174 | //---------------------------------------------------------------// | 174 | //---------------------------------------------------------------// |
175 | case EntityAddress: t = ValueAddress;break; | 175 | case EntityAddress: t = ValueAddress;break; |
176 | //---------------------------------------------------------------// | 176 | //---------------------------------------------------------------// |
177 | case EntityTelephone: t = ValueTel; break; | 177 | case EntityTelephone: t = ValueTel; break; |
178 | //---------------------------------------------------------------// | 178 | //---------------------------------------------------------------// |
179 | case EntityKey: t = ValueTextBin;break; | 179 | case EntityKey: t = ValueTextBin;break; |
180 | //---------------------------------------------------------------// | 180 | //---------------------------------------------------------------// |
181 | case EntityOrganisation: t = ValueOrg; break; | 181 | case EntityOrganisation: t = ValueOrg; break; |
182 | //---------------------------------------------------------------// | 182 | //---------------------------------------------------------------// |
183 | case EntityN: t = ValueN; break; | 183 | case EntityN: t = ValueN; break; |
184 | //---------------------------------------------------------------// | 184 | //---------------------------------------------------------------// |
185 | case EntityTimeZone: t = ValueUTC; break; | 185 | case EntityTimeZone: t = ValueUTC; break; |
186 | //---------------------------------------------------------------// | 186 | //---------------------------------------------------------------// |
187 | case EntityClass: t = ValueClass; break; | 187 | case EntityClass: t = ValueClass; break; |
188 | //---------------------------------------------------------------// | 188 | //---------------------------------------------------------------// |
189 | case EntityGeo: t = ValueGeo; break; | 189 | case EntityGeo: t = ValueGeo; break; |
190 | //---------------------------------------------------------------// | 190 | //---------------------------------------------------------------// |
191 | case EntitySource: | 191 | case EntitySource: |
192 | case EntityURL: t = ValueURI; break; | 192 | case EntityURL: t = ValueURI; break; |
193 | //---------------------------------------------------------------// | 193 | //---------------------------------------------------------------// |
194 | case EntityPhoto: | 194 | case EntityPhoto: |
195 | case EntityLogo: t = ValueImage; break; | 195 | case EntityLogo: t = ValueImage; break; |
196 | //---------------------------------------------------------------// | 196 | //---------------------------------------------------------------// |
197 | case EntityBirthday: | 197 | case EntityBirthday: |
198 | case EntityRevision: t = ValueDate; break; | 198 | case EntityRevision: t = ValueDate; break; |
199 | //---------------------------------------------------------------// | 199 | //---------------------------------------------------------------// |
200 | case EntityCategories: | 200 | case EntityCategories: |
201 | case EntityNickname: t = ValueTextList;break; | 201 | case EntityNickname: t = ValueTextList;break; |
202 | //---------------------------------------------------------------// | 202 | //---------------------------------------------------------------// |
203 | case EntityLabel: | 203 | case EntityLabel: |
204 | case EntityExtension: | 204 | case EntityExtension: |
205 | case EntityEmail: | 205 | case EntityEmail: |
206 | case EntityTitle: | 206 | case EntityTitle: |
207 | case EntityRole: | 207 | case EntityRole: |
208 | case EntityFullName: | 208 | case EntityFullName: |
209 | case EntityMailer: | 209 | case EntityMailer: |
210 | case EntityProductID: | 210 | case EntityProductID: |
211 | case EntityName: | 211 | case EntityName: |
212 | case EntitySortString: | 212 | case EntitySortString: |
213 | case EntityVersion: | 213 | case EntityVersion: |
214 | case EntityProfile: | 214 | case EntityProfile: |
215 | case EntityUID: | 215 | case EntityUID: |
216 | case EntityNote: | 216 | case EntityNote: |
217 | default: t = ValueText; break; | 217 | default: t = ValueText; break; |
218 | //---------------------------------------------------------------// | 218 | //---------------------------------------------------------------// |
219 | 219 | ||
220 | } | 220 | } |
221 | 221 | ||
222 | return t; | 222 | return t; |
223 | } | 223 | } |
224 | 224 | ||
225 | QCString | 225 | Q3CString |
226 | VCARD::EntityTypeToParamName(EntityType e) | 226 | VCARD::EntityTypeToParamName(EntityType e) |
227 | { | 227 | { |
228 | if ( e > EntityUnknown ) e = EntityUnknown; | 228 | if ( e > EntityUnknown ) e = EntityUnknown; |
229 | return paramNames[ int( e ) ]; | 229 | return paramNames[ int( e ) ]; |
230 | } | 230 | } |
231 | 231 | ||
232 | EntityType | 232 | EntityType |
233 | VCARD::EntityNameToEntityType(const QCString & s) | 233 | VCARD::EntityNameToEntityType(const Q3CString & s) |
234 | { | 234 | { |
235 | if (s.isEmpty()) return EntityUnknown; | 235 | if (s.isEmpty()) return EntityUnknown; |
236 | 236 | ||
237 | EntityType t(EntityUnknown); | 237 | EntityType t(EntityUnknown); |
238 | 238 | ||
239 | switch (s[0]) { | 239 | switch (s[0]) { |
240 | 240 | ||
241 | case 'A': | 241 | case 'A': |
242 | if (s == "ADR") | 242 | if (s == "ADR") |
243 | t = EntityAddress; | 243 | t = EntityAddress; |
244 | else if (s == "AGENT") | 244 | else if (s == "AGENT") |
245 | t = EntityAgent; | 245 | t = EntityAgent; |
246 | break; | 246 | break; |
247 | 247 | ||
248 | case 'B': | 248 | case 'B': |
249 | if (s == "BDAY") | 249 | if (s == "BDAY") |
250 | t = EntityBirthday; | 250 | t = EntityBirthday; |
251 | break; | 251 | break; |
252 | 252 | ||
253 | case 'C': | 253 | case 'C': |
254 | if (s == "CATEGORIES") | 254 | if (s == "CATEGORIES") |
255 | t = EntityCategories; | 255 | t = EntityCategories; |
256 | else if (s == "CLASS") | 256 | else if (s == "CLASS") |
257 | t = EntityClass; | 257 | t = EntityClass; |
258 | break; | 258 | break; |
259 | 259 | ||
260 | case 'E': | 260 | case 'E': |
261 | if (s == "EMAIL") | 261 | if (s == "EMAIL") |
262 | t = EntityEmail; | 262 | t = EntityEmail; |
263 | break; | 263 | break; |
264 | 264 | ||
265 | case 'F': | 265 | case 'F': |
266 | if (s == "FN") | 266 | if (s == "FN") |
267 | t = EntityFullName; | 267 | t = EntityFullName; |
268 | break; | 268 | break; |
269 | 269 | ||
270 | case 'G': | 270 | case 'G': |
271 | if (s == "GEO") | 271 | if (s == "GEO") |
272 | t = EntityGeo; | 272 | t = EntityGeo; |
273 | break; | 273 | break; |
274 | 274 | ||
275 | case 'K': | 275 | case 'K': |
276 | if (s == "KEY") | 276 | if (s == "KEY") |
277 | t = EntityKey; | 277 | t = EntityKey; |
278 | break; | 278 | break; |
279 | 279 | ||
280 | case 'L': | 280 | case 'L': |
281 | if (s == "LABEL") | 281 | if (s == "LABEL") |
282 | t = EntityLabel; | 282 | t = EntityLabel; |
283 | else if (s == "LOGO") | 283 | else if (s == "LOGO") |
284 | t = EntityLogo; | 284 | t = EntityLogo; |
285 | break; | 285 | break; |
286 | 286 | ||
287 | case 'M': | 287 | case 'M': |
288 | if (s == "MAILER") | 288 | if (s == "MAILER") |
289 | t = EntityMailer; | 289 | t = EntityMailer; |
290 | break; | 290 | break; |
291 | 291 | ||
292 | case 'N': | 292 | case 'N': |
293 | if (s == "N") | 293 | if (s == "N") |
294 | t = EntityN; | 294 | t = EntityN; |
295 | else if (s == "NAME") | 295 | else if (s == "NAME") |
296 | t = EntityName; | 296 | t = EntityName; |
297 | else if (s == "NICKNAME") | 297 | else if (s == "NICKNAME") |
298 | t = EntityNickname; | 298 | t = EntityNickname; |
299 | else if (s == "NOTE") | 299 | else if (s == "NOTE") |
300 | t = EntityNote; | 300 | t = EntityNote; |
301 | break; | 301 | break; |
302 | 302 | ||
303 | case 'O': | 303 | case 'O': |
304 | if (s == "ORG") | 304 | if (s == "ORG") |
305 | t = EntityOrganisation; | 305 | t = EntityOrganisation; |
306 | break; | 306 | break; |
307 | 307 | ||
308 | case 'P': | 308 | case 'P': |
309 | if (s == "PHOTO") | 309 | if (s == "PHOTO") |
310 | t = EntityPhoto; | 310 | t = EntityPhoto; |
311 | else if (s == "PRODID") | 311 | else if (s == "PRODID") |
312 | t = EntityProductID; | 312 | t = EntityProductID; |
313 | else if (s == "PROFILE") | 313 | else if (s == "PROFILE") |
314 | t = EntityProfile; | 314 | t = EntityProfile; |
315 | break; | 315 | break; |
316 | 316 | ||
317 | case 'R': | 317 | case 'R': |
318 | if (s == "REV") | 318 | if (s == "REV") |
319 | t = EntityRevision; | 319 | t = EntityRevision; |
320 | else if (s == "ROLE") | 320 | else if (s == "ROLE") |
321 | t = EntityRole; | 321 | t = EntityRole; |
322 | break; | 322 | break; |
323 | 323 | ||
324 | case 'S': | 324 | case 'S': |
325 | if (s == "SORT-STRING") | 325 | if (s == "SORT-STRING") |
326 | t = EntitySortString; | 326 | t = EntitySortString; |
327 | else if (s == "SOUND") | 327 | else if (s == "SOUND") |
328 | t = EntitySound; | 328 | t = EntitySound; |
329 | else if (s == "SOURCE") | 329 | else if (s == "SOURCE") |
330 | t = EntitySource; | 330 | t = EntitySource; |
331 | break; | 331 | break; |
332 | 332 | ||
333 | case 'T': | 333 | case 'T': |
334 | if (s == "TEL") | 334 | if (s == "TEL") |
335 | t = EntityTelephone; | 335 | t = EntityTelephone; |
336 | else if (s == "TITLE") | 336 | else if (s == "TITLE") |
337 | t = EntityTitle; | 337 | t = EntityTitle; |
338 | else if (s == "TZ") | 338 | else if (s == "TZ") |
339 | t = EntityTimeZone; | 339 | t = EntityTimeZone; |
340 | break; | 340 | break; |
341 | 341 | ||
342 | case 'U': | 342 | case 'U': |
343 | if (s == "UID") | 343 | if (s == "UID") |
344 | t = EntityUID; | 344 | t = EntityUID; |
345 | else if (s == "URL") | 345 | else if (s == "URL") |
346 | t = EntityURL; | 346 | t = EntityURL; |
347 | case 'V': | 347 | case 'V': |
348 | if (s == "VERSION") | 348 | if (s == "VERSION") |
349 | t = EntityVersion; | 349 | t = EntityVersion; |
350 | break; | 350 | break; |
351 | 351 | ||
352 | case 'X': | 352 | case 'X': |
353 | if (s.left(2) == "X-") | 353 | if (s.left(2) == "X-") |
354 | t = EntityExtension; | 354 | t = EntityExtension; |
355 | break; | 355 | break; |
356 | 356 | ||
357 | default: | 357 | default: |
358 | 358 | ||
359 | t = EntityUnknown; | 359 | t = EntityUnknown; |
360 | } | 360 | } |
361 | 361 | ||
362 | return t; | 362 | return t; |
363 | } | 363 | } |
364 | 364 | ||
365 | // The copyright notice below refers to the base64 codec functions used below, | 365 | // The copyright notice below refers to the base64 codec functions used below, |
366 | // which are modified from the original sources. | 366 | // which are modified from the original sources. |
367 | 367 | ||
368 | /* | 368 | /* |
369 | * Original version Copyright 1988 by The Leland Stanford Junior University | 369 | * Original version Copyright 1988 by The Leland Stanford Junior University |
370 | * Copyright 1998 by the University of Washington | 370 | * Copyright 1998 by the University of Washington |
371 | * | 371 | * |
372 | * Permission to use, copy, modify, and distribute this software and its | 372 | * Permission to use, copy, modify, and distribute this software and its |
373 | * documentation for any purpose and without fee is hereby granted, provided | 373 | * documentation for any purpose and without fee is hereby granted, provided |
374 | * that the above copyright notices appear in all copies and that both the | 374 | * that the above copyright notices appear in all copies and that both the |
375 | * above copyright notices and this permission notice appear in supporting | 375 | * above copyright notices and this permission notice appear in supporting |
376 | * documentation, and that the name of the University of Washington or The | 376 | * documentation, and that the name of the University of Washington or The |
377 | * Leland Stanford Junior University not be used in advertising or publicity | 377 | * Leland Stanford Junior University not be used in advertising or publicity |
378 | * pertaining to distribution of the software without specific, written prior | 378 | * pertaining to distribution of the software without specific, written prior |
379 | * permission. This software is made available "as is", and | 379 | * permission. This software is made available "as is", and |
380 | * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY | 380 | * THE UNIVERSITY OF WASHINGTON AND THE LELAND STANFORD JUNIOR UNIVERSITY |
381 | * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE, | 381 | * DISCLAIM ALL WARRANTIES, EXPRESS OR IMPLIED, WITH REGARD TO THIS SOFTWARE, |
382 | * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND | 382 | * INCLUDING WITHOUT LIMITATION ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND |
383 | * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF | 383 | * FITNESS FOR A PARTICULAR PURPOSE, AND IN NO EVENT SHALL THE UNIVERSITY OF |
384 | * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY | 384 | * WASHINGTON OR THE LELAND STANFORD JUNIOR UNIVERSITY BE LIABLE FOR ANY |
385 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER | 385 | * SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER |
386 | * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF | 386 | * RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF |
387 | * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF | 387 | * CONTRACT, TORT (INCLUDING NEGLIGENCE) OR STRICT LIABILITY, ARISING OUT OF |
388 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 388 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
389 | * | 389 | * |
390 | */ | 390 | */ |
391 | 391 | ||
392 | static char B64[] = | 392 | static char B64[] = |
393 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; | 393 | "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; |
394 | 394 | ||
395 | // the mime base64 disctionary used for decoding | 395 | // the mime base64 disctionary used for decoding |
396 | static signed char b64dec[] = { | 396 | static signed char b64dec[] = { |
397 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 | 397 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 0 |
398 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10 | 398 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 10 |
399 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20 | 399 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 20 |
400 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 30 | 400 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 30 |
401 | -1, -1, -1,-19, -1, -1, -1,-16, -4, -4, // 40 -19 == '+' -16 == '/' | 401 | -1, -1, -1,-19, -1, -1, -1,-16, -4, -4, // 40 -19 == '+' -16 == '/' |
402 | -4, -4, -4, -4, -4, -4, -4, -4, -1, -1, // 50 -4 == '0' | 402 | -4, -4, -4, -4, -4, -4, -4, -4, -1, -1, // 50 -4 == '0' |
403 | -1, 0, -1, -1, -1, 65, 65, 65, 65, 65, // 60 0 == '=' 65 == 'A' | 403 | -1, 0, -1, -1, -1, 65, 65, 65, 65, 65, // 60 0 == '=' 65 == 'A' |
404 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, // 70 | 404 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, // 70 |
405 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, // 80 | 405 | 65, 65, 65, 65, 65, 65, 65, 65, 65, 65, // 80 |
406 | 65, -1, -1, -1, -1, -1, -1, 71, 71, 71, // 90 71 == 'a' | 406 | 65, -1, -1, -1, -1, -1, -1, 71, 71, 71, // 90 71 == 'a' |
407 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, // 100 | 407 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, // 100 |
408 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, // 110 | 408 | 71, 71, 71, 71, 71, 71, 71, 71, 71, 71, // 110 |
409 | 71, 71, 71, -1, -1, -1, -1, -1, -1, -1, // 120 | 409 | 71, 71, 71, -1, -1, -1, -1, -1, -1, -1, // 120 |
410 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 130 | 410 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 130 |
411 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 140 | 411 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 140 |
412 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 150 | 412 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 150 |
413 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 160 | 413 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 160 |
414 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 170 | 414 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 170 |
415 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 180 | 415 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 180 |
416 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 190 | 416 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 190 |
417 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 200 | 417 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 200 |
418 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 210 | 418 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 210 |
419 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 220 | 419 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 220 |
420 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 230 | 420 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 230 |
421 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 240 | 421 | -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, // 240 |
422 | -1, -1, -1, -1, -1, -1, -1 // 250 | 422 | -1, -1, -1, -1, -1, -1, -1 // 250 |
423 | }; | 423 | }; |
424 | 424 | ||
425 | char * | 425 | char * |
426 | VCARD::decodeBase64(const char * s, unsigned long srcl, unsigned long & len) | 426 | VCARD::decodeBase64(const char * s, unsigned long srcl, unsigned long & len) |
427 | { | 427 | { |
428 | register unsigned char c; | 428 | register unsigned char c; |
429 | register unsigned long e(0); | 429 | register unsigned long e(0); |
430 | len = 0; | 430 | len = 0; |
431 | unsigned const char * src = (unsigned const char *)s; | 431 | unsigned const char * src = (unsigned const char *)s; |
432 | char * ret = new char[srcl + (srcl / 4 + 1)]; | 432 | char * ret = new char[srcl + (srcl / 4 + 1)]; |
433 | register char *d = ret; | 433 | register char *d = ret; |
434 | while (srcl--) { // Critical loop | 434 | while (srcl--) { // Critical loop |
435 | c = *src++; | 435 | c = *src++; |
436 | int dec = b64dec[c]; | 436 | int dec = b64dec[c]; |
437 | if (dec == -1) continue; | 437 | if (dec == -1) continue; |
438 | if (c == '=') { | 438 | if (c == '=') { |
439 | switch (e++) { | 439 | switch (e++) { |
440 | case 3: e = 0; break; | 440 | case 3: e = 0; break; |
441 | case 2: if (*src == '=') break; | 441 | case 2: if (*src == '=') break; |
442 | default: delete [] ret; ret = 0; return 0;break; | 442 | default: delete [] ret; ret = 0; return 0;break; |
443 | } | 443 | } |
444 | continue; | 444 | continue; |
445 | } | 445 | } |
446 | c -= dec; | 446 | c -= dec; |
447 | if (e == 0) { *d = c << 2; ++e; continue; } | 447 | if (e == 0) { *d = c << 2; ++e; continue; } |
448 | switch (e) { | 448 | switch (e) { |
449 | case 1: *d |= c >> 4; *++d = c << 4;break; | 449 | case 1: *d |= c >> 4; *++d = c << 4;break; |
450 | case 2: *d |= c >> 2; *++d = c << 6;break; | 450 | case 2: *d |= c >> 2; *++d = c << 6;break; |
451 | case 3: *d++ |= c; e = 0; continue; break; | 451 | case 3: *d++ |= c; e = 0; continue; break; |
452 | } | 452 | } |
453 | ++e; | 453 | ++e; |
454 | } | 454 | } |
455 | len = d - (char *)ret; | 455 | len = d - (char *)ret; |
456 | return ret; | 456 | return ret; |
457 | } | 457 | } |
458 | 458 | ||
459 | 459 | ||
460 | char * | 460 | char * |
461 | VCARD::encodeBase64(const char * src, unsigned long srcl, unsigned long & destl) | 461 | VCARD::encodeBase64(const char * src, unsigned long srcl, unsigned long & destl) |
462 | { | 462 | { |
463 | register const unsigned char *s = (unsigned char *)src; | 463 | register const unsigned char *s = (unsigned char *)src; |
464 | register unsigned long i = ((srcl + 2) / 3) * 4; | 464 | register unsigned long i = ((srcl + 2) / 3) * 4; |
465 | destl = i += 2 * ((i / 60) + 1); | 465 | destl = i += 2 * ((i / 60) + 1); |
466 | i = 0; | 466 | i = 0; |
467 | char * ret = new char[destl]; | 467 | char * ret = new char[destl]; |
468 | register unsigned char *d((unsigned char *)ret); | 468 | register unsigned char *d((unsigned char *)ret); |
469 | while (srcl != 0) { // Critical loop | 469 | while (srcl != 0) { // Critical loop |
470 | *d++ = B64[s[0] >> 2]; | 470 | *d++ = B64[s[0] >> 2]; |
471 | *d++ = B64[((s[0] << 4) + (--srcl == 0 ? 0 : s[1] >> 4)) & 0x3f]; | 471 | *d++ = B64[((s[0] << 4) + (--srcl == 0 ? 0 : s[1] >> 4)) & 0x3f]; |
472 | *d++ = srcl == 0 ? '=' : | 472 | *d++ = srcl == 0 ? '=' : |
473 | B64[((s[1] << 2) + (--srcl == 0 ? 0 : s[2] >> 6)) & 0x3f]; | 473 | B64[((s[1] << 2) + (--srcl == 0 ? 0 : s[2] >> 6)) & 0x3f]; |
474 | *d++ = srcl == 0 ?'=' : B64[s[2] & 0x3f]; | 474 | *d++ = srcl == 0 ?'=' : B64[s[2] & 0x3f]; |
475 | if (srcl != 0) srcl--; | 475 | if (srcl != 0) srcl--; |
476 | if (++i == 15) { i = 0; *d++ = '\r'; *d++ = '\n'; } | 476 | if (++i == 15) { i = 0; *d++ = '\r'; *d++ = '\n'; } |
477 | s += 3; | 477 | s += 3; |
478 | } | 478 | } |
479 | *d = '\r'; *++d = '\n'; *++d = '\0'; | 479 | *d = '\r'; *++d = '\n'; *++d = '\0'; |
480 | return ret; | 480 | return ret; |
481 | } | 481 | } |
482 | 482 | ||
diff --git a/kabc/vcard/FloatValue.cpp b/kabc/vcard/FloatValue.cpp index 15bb664..7065081 100644 --- a/kabc/vcard/FloatValue.cpp +++ b/kabc/vcard/FloatValue.cpp | |||
@@ -1,120 +1,122 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardFloatValue.h> | 24 | #include <VCardFloatValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | FloatValue::FloatValue() | 32 | FloatValue::FloatValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | FloatValue::FloatValue(float f) | 37 | FloatValue::FloatValue(float f) |
36 | : Value(), | 38 | : Value(), |
37 | value_(f) | 39 | value_(f) |
38 | { | 40 | { |
39 | parsed_ = true; | 41 | parsed_ = true; |
40 | } | 42 | } |
41 | 43 | ||
42 | FloatValue::FloatValue(const FloatValue & x) | 44 | FloatValue::FloatValue(const FloatValue & x) |
43 | :Value(x) | 45 | :Value(x) |
44 | { | 46 | { |
45 | value_ = x.value_; | 47 | value_ = x.value_; |
46 | } | 48 | } |
47 | 49 | ||
48 | FloatValue::FloatValue(const QCString & s) | 50 | FloatValue::FloatValue(const Q3CString & s) |
49 | :Value(s) | 51 | :Value(s) |
50 | { | 52 | { |
51 | } | 53 | } |
52 | 54 | ||
53 | FloatValue & | 55 | FloatValue & |
54 | FloatValue::operator = (FloatValue & x) | 56 | FloatValue::operator = (FloatValue & x) |
55 | { | 57 | { |
56 | if (*this == x) return *this; | 58 | if (*this == x) return *this; |
57 | 59 | ||
58 | x.parse(); | 60 | x.parse(); |
59 | value_ = x.value_; | 61 | value_ = x.value_; |
60 | 62 | ||
61 | Value::operator = (x); | 63 | Value::operator = (x); |
62 | return *this; | 64 | return *this; |
63 | } | 65 | } |
64 | 66 | ||
65 | FloatValue & | 67 | FloatValue & |
66 | FloatValue::operator = (const QCString & s) | 68 | FloatValue::operator = (const Q3CString & s) |
67 | { | 69 | { |
68 | Value::operator = (s); | 70 | Value::operator = (s); |
69 | return *this; | 71 | return *this; |
70 | } | 72 | } |
71 | 73 | ||
72 | bool | 74 | bool |
73 | FloatValue::operator == (FloatValue & x) | 75 | FloatValue::operator == (FloatValue & x) |
74 | { | 76 | { |
75 | x.parse(); | 77 | x.parse(); |
76 | return (value_ == x.value_); | 78 | return (value_ == x.value_); |
77 | } | 79 | } |
78 | 80 | ||
79 | FloatValue::~FloatValue() | 81 | FloatValue::~FloatValue() |
80 | { | 82 | { |
81 | } | 83 | } |
82 | 84 | ||
83 | void | 85 | void |
84 | FloatValue::_parse() | 86 | FloatValue::_parse() |
85 | { | 87 | { |
86 | bool negative(false); | 88 | bool negative(false); |
87 | 89 | ||
88 | if (strRep_[0] == '-' || strRep_[1] == '+') { | 90 | if (strRep_[0] == '-' || strRep_[1] == '+') { |
89 | 91 | ||
90 | if (strRep_[0] == '-') | 92 | if (strRep_[0] == '-') |
91 | negative = true; | 93 | negative = true; |
92 | 94 | ||
93 | strRep_.remove(0, 1); | 95 | strRep_.remove(0, 1); |
94 | } | 96 | } |
95 | 97 | ||
96 | value_ = strRep_.toFloat(); | 98 | value_ = strRep_.toFloat(); |
97 | if (negative) | 99 | if (negative) |
98 | value_ = -value_; | 100 | value_ = -value_; |
99 | } | 101 | } |
100 | 102 | ||
101 | void | 103 | void |
102 | FloatValue::_assemble() | 104 | FloatValue::_assemble() |
103 | { | 105 | { |
104 | strRep_ = QCString().setNum(value_); | 106 | strRep_ = Q3CString().setNum(value_); |
105 | } | 107 | } |
106 | 108 | ||
107 | float | 109 | float |
108 | FloatValue::value() | 110 | FloatValue::value() |
109 | { | 111 | { |
110 | parse(); | 112 | parse(); |
111 | return value_; | 113 | return value_; |
112 | } | 114 | } |
113 | 115 | ||
114 | void | 116 | void |
115 | FloatValue::setValue(float f) | 117 | FloatValue::setValue(float f) |
116 | { | 118 | { |
117 | parsed_ = true; | 119 | parsed_ = true; |
118 | value_ = f; | 120 | value_ = f; |
119 | } | 121 | } |
120 | 122 | ||
diff --git a/kabc/vcard/GeoValue.cpp b/kabc/vcard/GeoValue.cpp index e02b402..ba57a6b 100644 --- a/kabc/vcard/GeoValue.cpp +++ b/kabc/vcard/GeoValue.cpp | |||
@@ -1,100 +1,102 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libvcard. | 2 | This file is part of libvcard. |
3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2002 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <VCardGeoValue.h> | 21 | #include <VCardGeoValue.h> |
22 | 22 | ||
23 | #include <VCardValue.h> | 23 | #include <VCardValue.h> |
24 | 24 | ||
25 | #include <kdebug.h> | 25 | #include <kdebug.h> |
26 | //Added by qt3to4: | ||
27 | #include <Q3CString> | ||
26 | 28 | ||
27 | using namespace VCARD; | 29 | using namespace VCARD; |
28 | 30 | ||
29 | GeoValue::GeoValue() | 31 | GeoValue::GeoValue() |
30 | :Value() | 32 | :Value() |
31 | { | 33 | { |
32 | } | 34 | } |
33 | 35 | ||
34 | GeoValue::GeoValue(const GeoValue & x) | 36 | GeoValue::GeoValue(const GeoValue & x) |
35 | :Value(x), latitude_(x.latitude_), longitude_(x.longitude_) | 37 | :Value(x), latitude_(x.latitude_), longitude_(x.longitude_) |
36 | { | 38 | { |
37 | } | 39 | } |
38 | 40 | ||
39 | GeoValue::GeoValue(const QCString & s) | 41 | GeoValue::GeoValue(const Q3CString & s) |
40 | :Value(s) | 42 | :Value(s) |
41 | { | 43 | { |
42 | } | 44 | } |
43 | 45 | ||
44 | GeoValue & | 46 | GeoValue & |
45 | GeoValue::operator = (GeoValue & x) | 47 | GeoValue::operator = (GeoValue & x) |
46 | { | 48 | { |
47 | if (*this == x) return *this; | 49 | if (*this == x) return *this; |
48 | 50 | ||
49 | latitude_ = x.latitude_; | 51 | latitude_ = x.latitude_; |
50 | longitude_ = x.longitude_; | 52 | longitude_ = x.longitude_; |
51 | 53 | ||
52 | Value::operator = (x); | 54 | Value::operator = (x); |
53 | return *this; | 55 | return *this; |
54 | } | 56 | } |
55 | 57 | ||
56 | GeoValue & | 58 | GeoValue & |
57 | GeoValue::operator = (const QCString & s) | 59 | GeoValue::operator = (const Q3CString & s) |
58 | { | 60 | { |
59 | Value::operator = (s); | 61 | Value::operator = (s); |
60 | return *this; | 62 | return *this; |
61 | } | 63 | } |
62 | 64 | ||
63 | bool | 65 | bool |
64 | GeoValue::operator == (GeoValue & x) | 66 | GeoValue::operator == (GeoValue & x) |
65 | { | 67 | { |
66 | x.parse(); | 68 | x.parse(); |
67 | 69 | ||
68 | if ( latitude_ != x.latitude_ ) return false; | 70 | if ( latitude_ != x.latitude_ ) return false; |
69 | if ( longitude_ != x.longitude_ ) return false; | 71 | if ( longitude_ != x.longitude_ ) return false; |
70 | 72 | ||
71 | return true; | 73 | return true; |
72 | } | 74 | } |
73 | 75 | ||
74 | GeoValue::~GeoValue() | 76 | GeoValue::~GeoValue() |
75 | { | 77 | { |
76 | } | 78 | } |
77 | 79 | ||
78 | GeoValue * | 80 | GeoValue * |
79 | GeoValue::clone() | 81 | GeoValue::clone() |
80 | { | 82 | { |
81 | return new GeoValue( *this ); | 83 | return new GeoValue( *this ); |
82 | } | 84 | } |
83 | 85 | ||
84 | void | 86 | void |
85 | GeoValue::_parse() | 87 | GeoValue::_parse() |
86 | { | 88 | { |
87 | int semiColon = strRep_.find( ";" ); | 89 | int semiColon = strRep_.find( ";" ); |
88 | 90 | ||
89 | if ( semiColon == -1 ) // invalid | 91 | if ( semiColon == -1 ) // invalid |
90 | return; | 92 | return; |
91 | 93 | ||
92 | latitude_ = strRep_.left( semiColon ).toFloat(); | 94 | latitude_ = strRep_.left( semiColon ).toFloat(); |
93 | longitude_ = strRep_.mid( semiColon + 1, strRep_.length() - semiColon ).toFloat(); | 95 | longitude_ = strRep_.mid( semiColon + 1, strRep_.length() - semiColon ).toFloat(); |
94 | } | 96 | } |
95 | 97 | ||
96 | void | 98 | void |
97 | GeoValue::_assemble() | 99 | GeoValue::_assemble() |
98 | { | 100 | { |
99 | strRep_.sprintf( "%.6f;%.6f", latitude_, longitude_ ); | 101 | strRep_.sprintf( "%.6f;%.6f", latitude_, longitude_ ); |
100 | } | 102 | } |
diff --git a/kabc/vcard/ImageParam.cpp b/kabc/vcard/ImageParam.cpp index c9cf6fd..6da317d 100644 --- a/kabc/vcard/ImageParam.cpp +++ b/kabc/vcard/ImageParam.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardImageParam.h> | 24 | #include <VCardImageParam.h> |
25 | 25 | ||
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | ImageParam::ImageParam() | 32 | ImageParam::ImageParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | ImageParam::ImageParam(const ImageParam & x) | 37 | ImageParam::ImageParam(const ImageParam & x) |
36 | :Param(x) | 38 | :Param(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | ImageParam::ImageParam(const QCString & s) | 42 | ImageParam::ImageParam(const Q3CString & s) |
41 | :Param(s) | 43 | :Param(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | ImageParam & | 47 | ImageParam & |
46 | ImageParam::operator = (ImageParam & x) | 48 | ImageParam::operator = (ImageParam & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Param::operator = (x); | 52 | Param::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | ImageParam & | 56 | ImageParam & |
55 | ImageParam::operator = (const QCString & s) | 57 | ImageParam::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Param::operator = (s); | 59 | Param::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | ImageParam::operator == (ImageParam & x) | 64 | ImageParam::operator == (ImageParam & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | ImageParam::~ImageParam() | 70 | ImageParam::~ImageParam() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | ImageParam::_parse() | 75 | ImageParam::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | ImageParam::_assemble() | 80 | ImageParam::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/ImageValue.cpp b/kabc/vcard/ImageValue.cpp index 4630fac..678a81c 100644 --- a/kabc/vcard/ImageValue.cpp +++ b/kabc/vcard/ImageValue.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardImageValue.h> | 24 | #include <VCardImageValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | ImageValue::ImageValue() | 32 | ImageValue::ImageValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | ImageValue::ImageValue(const ImageValue & x) | 37 | ImageValue::ImageValue(const ImageValue & x) |
36 | :Value(x) | 38 | :Value(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | ImageValue::ImageValue(const QCString & s) | 42 | ImageValue::ImageValue(const Q3CString & s) |
41 | :Value(s) | 43 | :Value(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | ImageValue & | 47 | ImageValue & |
46 | ImageValue::operator = (ImageValue & x) | 48 | ImageValue::operator = (ImageValue & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Value::operator = (x); | 52 | Value::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | ImageValue & | 56 | ImageValue & |
55 | ImageValue::operator = (const QCString & s) | 57 | ImageValue::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Value::operator = (s); | 59 | Value::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | ImageValue::operator == (ImageValue & x) | 64 | ImageValue::operator == (ImageValue & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | ImageValue::~ImageValue() | 70 | ImageValue::~ImageValue() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | ImageValue::_parse() | 75 | ImageValue::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | ImageValue::_assemble() | 80 | ImageValue::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/ImgValue.cpp b/kabc/vcard/ImgValue.cpp index 7b961f8..1b289df 100644 --- a/kabc/vcard/ImgValue.cpp +++ b/kabc/vcard/ImgValue.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardImgValue.h> | 24 | #include <VCardImgValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | ImgValue::ImgValue() | 32 | ImgValue::ImgValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | ImgValue::ImgValue(const ImgValue & x) | 37 | ImgValue::ImgValue(const ImgValue & x) |
36 | :Value(x) | 38 | :Value(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | ImgValue::ImgValue(const QCString & s) | 42 | ImgValue::ImgValue(const Q3CString & s) |
41 | :Value(s) | 43 | :Value(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | ImgValue & | 47 | ImgValue & |
46 | ImgValue::operator = (ImgValue & x) | 48 | ImgValue::operator = (ImgValue & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Value::operator = (x); | 52 | Value::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | ImgValue & | 56 | ImgValue & |
55 | ImgValue::operator = (const QCString & s) | 57 | ImgValue::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Value::operator = (s); | 59 | Value::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | ImgValue::operator == (ImgValue & x) | 64 | ImgValue::operator == (ImgValue & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | ImgValue::~ImgValue() | 70 | ImgValue::~ImgValue() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | ImgValue::_parse() | 75 | ImgValue::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | ImgValue::_assemble() | 80 | ImgValue::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/LangValue.cpp b/kabc/vcard/LangValue.cpp index edf1804..52a0204 100644 --- a/kabc/vcard/LangValue.cpp +++ b/kabc/vcard/LangValue.cpp | |||
@@ -1,127 +1,131 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardRToken.h> | 24 | #include <VCardRToken.h> |
25 | 25 | ||
26 | #include <VCardLangValue.h> | 26 | #include <VCardLangValue.h> |
27 | 27 | ||
28 | #include <VCardValue.h> | 28 | #include <VCardValue.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3CString> | ||
31 | #include <Q3StrList> | ||
29 | 32 | ||
30 | using namespace VCARD; | 33 | using namespace VCARD; |
31 | 34 | ||
32 | LangValue::LangValue() | 35 | LangValue::LangValue() |
33 | :Value() | 36 | :Value() |
34 | { | 37 | { |
35 | } | 38 | } |
36 | 39 | ||
37 | LangValue::LangValue(const LangValue & x) | 40 | LangValue::LangValue(const LangValue & x) |
38 | :Value(x) | 41 | :Value(x) |
39 | { | 42 | { |
40 | } | 43 | } |
41 | 44 | ||
42 | LangValue::LangValue(const QCString & s) | 45 | LangValue::LangValue(const Q3CString & s) |
43 | :Value(s) | 46 | :Value(s) |
44 | { | 47 | { |
45 | } | 48 | } |
46 | 49 | ||
47 | LangValue & | 50 | LangValue & |
48 | LangValue::operator = (LangValue & x) | 51 | LangValue::operator = (LangValue & x) |
49 | { | 52 | { |
50 | if (*this == x) return *this; | 53 | if (*this == x) return *this; |
51 | 54 | ||
52 | Value::operator = (x); | 55 | Value::operator = (x); |
53 | return *this; | 56 | return *this; |
54 | } | 57 | } |
55 | 58 | ||
56 | LangValue & | 59 | LangValue & |
57 | LangValue::operator = (const QCString & s) | 60 | LangValue::operator = (const Q3CString & s) |
58 | { | 61 | { |
59 | Value::operator = (s); | 62 | Value::operator = (s); |
60 | return *this; | 63 | return *this; |
61 | } | 64 | } |
62 | 65 | ||
63 | bool | 66 | bool |
64 | LangValue::operator == (LangValue & x) | 67 | LangValue::operator == (LangValue & x) |
65 | { | 68 | { |
66 | x.parse(); | 69 | x.parse(); |
67 | return false; | 70 | return false; |
68 | } | 71 | } |
69 | 72 | ||
70 | LangValue::~LangValue() | 73 | LangValue::~LangValue() |
71 | { | 74 | { |
72 | } | 75 | } |
73 | 76 | ||
74 | void | 77 | void |
75 | LangValue::_parse() | 78 | LangValue::_parse() |
76 | { | 79 | { |
77 | QStrList l; | 80 | Q3StrList l; |
78 | RTokenise(strRep_, "-", l); | 81 | RTokenise(strRep_, "-", l); |
79 | 82 | ||
80 | if (l.count() == 0) return; | 83 | if (l.count() == 0) return; |
81 | 84 | ||
82 | primary_ = l.at(0); | 85 | primary_ = l.at(0); |
83 | 86 | ||
84 | l.remove(0u); | 87 | l.remove(0u); |
85 | 88 | ||
86 | subtags_ = l; | 89 | subtags_ = l; |
87 | } | 90 | } |
88 | 91 | ||
89 | void | 92 | void |
90 | LangValue::_assemble() | 93 | LangValue::_assemble() |
91 | { | 94 | { |
92 | strRep_ = primary_; | 95 | strRep_ = primary_; |
93 | 96 | ||
94 | QStrListIterator it(subtags_); | 97 | Q3StrListIterator it(subtags_); |
95 | 98 | ||
96 | for (; it.current(); ++it) | 99 | for (; it.current(); ++it) { |
97 | strRep_ += QCString('-') + it.current(); | 100 | strRep_ += Q3CString('-'); strRep_ += it.current(); |
101 | } | ||
98 | } | 102 | } |
99 | 103 | ||
100 | QCString | 104 | Q3CString |
101 | LangValue::primary() | 105 | LangValue::primary() |
102 | { | 106 | { |
103 | parse(); | 107 | parse(); |
104 | return primary_; | 108 | return primary_; |
105 | } | 109 | } |
106 | 110 | ||
107 | QStrList | 111 | Q3StrList |
108 | LangValue::subtags() | 112 | LangValue::subtags() |
109 | { | 113 | { |
110 | parse(); | 114 | parse(); |
111 | return subtags_; | 115 | return subtags_; |
112 | } | 116 | } |
113 | 117 | ||
114 | void | 118 | void |
115 | LangValue::setPrimary(const QCString & s) | 119 | LangValue::setPrimary(const Q3CString & s) |
116 | { | 120 | { |
117 | parse(); | 121 | parse(); |
118 | primary_ = s; | 122 | primary_ = s; |
119 | } | 123 | } |
120 | 124 | ||
121 | void | 125 | void |
122 | LangValue::setSubTags(const QStrList & l) | 126 | LangValue::setSubTags(const Q3StrList & l) |
123 | { | 127 | { |
124 | parse(); | 128 | parse(); |
125 | subtags_ = l; | 129 | subtags_ = l; |
126 | } | 130 | } |
127 | 131 | ||
diff --git a/kabc/vcard/NValue.cpp b/kabc/vcard/NValue.cpp index cdec621..6c0f365 100644 --- a/kabc/vcard/NValue.cpp +++ b/kabc/vcard/NValue.cpp | |||
@@ -1,128 +1,130 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qstrlist.h> | 24 | #include <q3strlist.h> |
25 | //Added by qt3to4: | ||
26 | #include <Q3CString> | ||
25 | 27 | ||
26 | #include <VCardRToken.h> | 28 | #include <VCardRToken.h> |
27 | #include <VCardNValue.h> | 29 | #include <VCardNValue.h> |
28 | #include <VCardValue.h> | 30 | #include <VCardValue.h> |
29 | #include <VCardDefines.h> | 31 | #include <VCardDefines.h> |
30 | 32 | ||
31 | using namespace VCARD; | 33 | using namespace VCARD; |
32 | 34 | ||
33 | NValue::NValue() | 35 | NValue::NValue() |
34 | :Value() | 36 | :Value() |
35 | { | 37 | { |
36 | vDebug("ctor"); | 38 | vDebug("ctor"); |
37 | } | 39 | } |
38 | 40 | ||
39 | NValue::NValue(const NValue & x) | 41 | NValue::NValue(const NValue & x) |
40 | :Value(x), | 42 | :Value(x), |
41 | family_(x.family_), | 43 | family_(x.family_), |
42 | given_(x.given_), | 44 | given_(x.given_), |
43 | middle_(x.middle_), | 45 | middle_(x.middle_), |
44 | prefix_(x.prefix_), | 46 | prefix_(x.prefix_), |
45 | suffix_(x.suffix_) | 47 | suffix_(x.suffix_) |
46 | { | 48 | { |
47 | } | 49 | } |
48 | 50 | ||
49 | NValue::NValue(const QCString & s) | 51 | NValue::NValue(const Q3CString & s) |
50 | :Value(s) | 52 | :Value(s) |
51 | { | 53 | { |
52 | vDebug("ctor"); | 54 | vDebug("ctor"); |
53 | } | 55 | } |
54 | 56 | ||
55 | NValue & | 57 | NValue & |
56 | NValue::operator = (NValue & x) | 58 | NValue::operator = (NValue & x) |
57 | { | 59 | { |
58 | if (*this == x) return *this; | 60 | if (*this == x) return *this; |
59 | 61 | ||
60 | family_= x.family_; | 62 | family_= x.family_; |
61 | given_= x.given_; | 63 | given_= x.given_; |
62 | middle_= x.middle_; | 64 | middle_= x.middle_; |
63 | prefix_= x.prefix_; | 65 | prefix_= x.prefix_; |
64 | suffix_= x.suffix_; | 66 | suffix_= x.suffix_; |
65 | 67 | ||
66 | Value::operator = (x); | 68 | Value::operator = (x); |
67 | return *this; | 69 | return *this; |
68 | } | 70 | } |
69 | 71 | ||
70 | NValue & | 72 | NValue & |
71 | NValue::operator = (const QCString & s) | 73 | NValue::operator = (const Q3CString & s) |
72 | { | 74 | { |
73 | Value::operator = (s); | 75 | Value::operator = (s); |
74 | return *this; | 76 | return *this; |
75 | } | 77 | } |
76 | 78 | ||
77 | bool | 79 | bool |
78 | NValue::operator == (NValue & x) | 80 | NValue::operator == (NValue & x) |
79 | { | 81 | { |
80 | x.parse(); | 82 | x.parse(); |
81 | 83 | ||
82 | return ( | 84 | return ( |
83 | family_ == x.family_&& | 85 | family_ == x.family_&& |
84 | given_ == x.given_&& | 86 | given_ == x.given_&& |
85 | middle_ == x.middle_&& | 87 | middle_ == x.middle_&& |
86 | prefix_ == x.prefix_&& | 88 | prefix_ == x.prefix_&& |
87 | suffix_ == x.suffix_); | 89 | suffix_ == x.suffix_); |
88 | } | 90 | } |
89 | 91 | ||
90 | NValue::~NValue() | 92 | NValue::~NValue() |
91 | { | 93 | { |
92 | } | 94 | } |
93 | 95 | ||
94 | NValue * | 96 | NValue * |
95 | NValue::clone() | 97 | NValue::clone() |
96 | { | 98 | { |
97 | return new NValue( *this ); | 99 | return new NValue( *this ); |
98 | } | 100 | } |
99 | 101 | ||
100 | void | 102 | void |
101 | NValue::_parse() | 103 | NValue::_parse() |
102 | { | 104 | { |
103 | QStrList l; | 105 | Q3StrList l; |
104 | RTokenise(strRep_, ";", l); | 106 | RTokenise(strRep_, ";", l); |
105 | 107 | ||
106 | for (unsigned int i = 0; i < l.count(); i++) { | 108 | for (unsigned int i = 0; i < l.count(); i++) { |
107 | 109 | ||
108 | switch (i) { | 110 | switch (i) { |
109 | case 0: family_ = l.at(0);break; | 111 | case 0: family_ = l.at(0);break; |
110 | case 1: given_ = l.at(1);break; | 112 | case 1: given_ = l.at(1);break; |
111 | case 2: middle_ = l.at(2);break; | 113 | case 2: middle_ = l.at(2);break; |
112 | case 3: prefix_ = l.at(3);break; | 114 | case 3: prefix_ = l.at(3);break; |
113 | case 4: suffix_ = l.at(4);break; | 115 | case 4: suffix_ = l.at(4);break; |
114 | default: break; | 116 | default: break; |
115 | } | 117 | } |
116 | } | 118 | } |
117 | } | 119 | } |
118 | 120 | ||
119 | void | 121 | void |
120 | NValue::_assemble() | 122 | NValue::_assemble() |
121 | { | 123 | { |
122 | strRep_ = family_; | 124 | strRep_ = family_; |
123 | strRep_ += ";" +given_; | 125 | strRep_ += ";" +given_; |
124 | strRep_ += ";" +middle_; | 126 | strRep_ += ";" +middle_; |
125 | strRep_ += ";" +prefix_; | 127 | strRep_ += ";" +prefix_; |
126 | strRep_ += ";" +suffix_; | 128 | strRep_ += ";" +suffix_; |
127 | } | 129 | } |
128 | 130 | ||
diff --git a/kabc/vcard/OrgValue.cpp b/kabc/vcard/OrgValue.cpp index c3134c8..a6a32dd 100644 --- a/kabc/vcard/OrgValue.cpp +++ b/kabc/vcard/OrgValue.cpp | |||
@@ -1,107 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardRToken.h> | 24 | #include <VCardRToken.h> |
25 | 25 | ||
26 | #include <VCardOrgValue.h> | 26 | #include <VCardOrgValue.h> |
27 | 27 | ||
28 | #include <VCardValue.h> | 28 | #include <VCardValue.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3CString> | ||
29 | 31 | ||
30 | using namespace VCARD; | 32 | using namespace VCARD; |
31 | 33 | ||
32 | OrgValue::OrgValue() | 34 | OrgValue::OrgValue() |
33 | :Value() | 35 | :Value() |
34 | { | 36 | { |
35 | } | 37 | } |
36 | 38 | ||
37 | OrgValue::OrgValue(const OrgValue & x) | 39 | OrgValue::OrgValue(const OrgValue & x) |
38 | :Value(x) | 40 | :Value(x) |
39 | { | 41 | { |
40 | } | 42 | } |
41 | 43 | ||
42 | OrgValue::OrgValue(const QCString & s) | 44 | OrgValue::OrgValue(const Q3CString & s) |
43 | :Value(s) | 45 | :Value(s) |
44 | { | 46 | { |
45 | } | 47 | } |
46 | 48 | ||
47 | OrgValue & | 49 | OrgValue & |
48 | OrgValue::operator = (OrgValue & x) | 50 | OrgValue::operator = (OrgValue & x) |
49 | { | 51 | { |
50 | if (*this == x) return *this; | 52 | if (*this == x) return *this; |
51 | 53 | ||
52 | Value::operator = (x); | 54 | Value::operator = (x); |
53 | return *this; | 55 | return *this; |
54 | } | 56 | } |
55 | 57 | ||
56 | OrgValue & | 58 | OrgValue & |
57 | OrgValue::operator = (const QCString & s) | 59 | OrgValue::operator = (const Q3CString & s) |
58 | { | 60 | { |
59 | Value::operator = (s); | 61 | Value::operator = (s); |
60 | return *this; | 62 | return *this; |
61 | } | 63 | } |
62 | 64 | ||
63 | bool | 65 | bool |
64 | OrgValue::operator == (OrgValue & x) | 66 | OrgValue::operator == (OrgValue & x) |
65 | { | 67 | { |
66 | x.parse(); | 68 | x.parse(); |
67 | return false; | 69 | return false; |
68 | } | 70 | } |
69 | 71 | ||
70 | OrgValue::~OrgValue() | 72 | OrgValue::~OrgValue() |
71 | { | 73 | { |
72 | } | 74 | } |
73 | 75 | ||
74 | void | 76 | void |
75 | OrgValue::_parse() | 77 | OrgValue::_parse() |
76 | { | 78 | { |
77 | RTokenise(strRep_, ";", valueList_); | 79 | RTokenise(strRep_, ";", valueList_); |
78 | } | 80 | } |
79 | 81 | ||
80 | void | 82 | void |
81 | OrgValue::_assemble() | 83 | OrgValue::_assemble() |
82 | { | 84 | { |
83 | bool first(true); | 85 | bool first(true); |
84 | 86 | ||
85 | QStrListIterator it(valueList_); | 87 | Q3StrListIterator it(valueList_); |
86 | 88 | ||
87 | for (; it.current(); ++it) { | 89 | for (; it.current(); ++it) { |
88 | if (!first) strRep_ += ';'; | 90 | if (!first) strRep_ += ';'; |
89 | strRep_ += it.current(); | 91 | strRep_ += it.current(); |
90 | first = false; | 92 | first = false; |
91 | } | 93 | } |
92 | } | 94 | } |
93 | 95 | ||
94 | unsigned int | 96 | unsigned int |
95 | OrgValue::numValues() | 97 | OrgValue::numValues() |
96 | { | 98 | { |
97 | parse(); | 99 | parse(); |
98 | return valueList_.count(); | 100 | return valueList_.count(); |
99 | } | 101 | } |
100 | 102 | ||
101 | QCString | 103 | Q3CString |
102 | OrgValue::value(unsigned int i) | 104 | OrgValue::value(unsigned int i) |
103 | { | 105 | { |
104 | parse(); | 106 | parse(); |
105 | return valueList_.at(i); | 107 | return valueList_.at(i); |
106 | } | 108 | } |
107 | 109 | ||
diff --git a/kabc/vcard/Param.cpp b/kabc/vcard/Param.cpp index c513613..bd6b299 100644 --- a/kabc/vcard/Param.cpp +++ b/kabc/vcard/Param.cpp | |||
@@ -1,129 +1,131 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardParam.h> | 24 | #include <VCardParam.h> |
25 | 25 | ||
26 | #include <VCardEntity.h> | 26 | #include <VCardEntity.h> |
27 | 27 | ||
28 | #include <VCardRToken.h> | 28 | #include <VCardRToken.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3CString> | ||
29 | 31 | ||
30 | using namespace VCARD; | 32 | using namespace VCARD; |
31 | 33 | ||
32 | Param::Param() | 34 | Param::Param() |
33 | :Entity(), | 35 | :Entity(), |
34 | name_(""), | 36 | name_(""), |
35 | value_("") | 37 | value_("") |
36 | { | 38 | { |
37 | } | 39 | } |
38 | 40 | ||
39 | Param::Param(const Param & x) | 41 | Param::Param(const Param & x) |
40 | :Entity(x), | 42 | :Entity(x), |
41 | name_(x.name_), | 43 | name_(x.name_), |
42 | value_(x.value_) | 44 | value_(x.value_) |
43 | { | 45 | { |
44 | } | 46 | } |
45 | 47 | ||
46 | Param::Param(const QCString & s) | 48 | Param::Param(const Q3CString & s) |
47 | :Entity(s), | 49 | :Entity(s), |
48 | name_(""), | 50 | name_(""), |
49 | value_("") | 51 | value_("") |
50 | { | 52 | { |
51 | } | 53 | } |
52 | 54 | ||
53 | Param & | 55 | Param & |
54 | Param::operator = (Param & x) | 56 | Param::operator = (Param & x) |
55 | { | 57 | { |
56 | if (*this == x) return *this; | 58 | if (*this == x) return *this; |
57 | 59 | ||
58 | Entity::operator = (x); | 60 | Entity::operator = (x); |
59 | name_ = x.name_; | 61 | name_ = x.name_; |
60 | value_ = x.value_; | 62 | value_ = x.value_; |
61 | 63 | ||
62 | return *this; | 64 | return *this; |
63 | } | 65 | } |
64 | 66 | ||
65 | Param & | 67 | Param & |
66 | Param::operator = (const QCString & s) | 68 | Param::operator = (const Q3CString & s) |
67 | { | 69 | { |
68 | Entity::operator = (s); | 70 | Entity::operator = (s); |
69 | return *this; | 71 | return *this; |
70 | } | 72 | } |
71 | 73 | ||
72 | bool | 74 | bool |
73 | Param::operator == (Param & x) | 75 | Param::operator == (Param & x) |
74 | { | 76 | { |
75 | x.parse(); | 77 | x.parse(); |
76 | return false; | 78 | return false; |
77 | } | 79 | } |
78 | 80 | ||
79 | Param::~Param() | 81 | Param::~Param() |
80 | { | 82 | { |
81 | } | 83 | } |
82 | 84 | ||
83 | void | 85 | void |
84 | Param::_parse() | 86 | Param::_parse() |
85 | { | 87 | { |
86 | } | 88 | } |
87 | 89 | ||
88 | void | 90 | void |
89 | Param::_assemble() | 91 | Param::_assemble() |
90 | { | 92 | { |
91 | strRep_ = name_ + "=" + value_; | 93 | strRep_ = name_ + "=" + value_; |
92 | } | 94 | } |
93 | 95 | ||
94 | Param::Param(const QCString &name, const QCString &value) | 96 | Param::Param(const Q3CString &name, const Q3CString &value) |
95 | :Entity(), | 97 | :Entity(), |
96 | name_(name), | 98 | name_(name), |
97 | value_(value) | 99 | value_(value) |
98 | { | 100 | { |
99 | parsed_ = true; | 101 | parsed_ = true; |
100 | assembled_ = false; | 102 | assembled_ = false; |
101 | } | 103 | } |
102 | 104 | ||
103 | void | 105 | void |
104 | Param::setName(const QCString & name) | 106 | Param::setName(const Q3CString & name) |
105 | { | 107 | { |
106 | name_ = name; | 108 | name_ = name; |
107 | 109 | ||
108 | assembled_ = false; | 110 | assembled_ = false; |
109 | } | 111 | } |
110 | 112 | ||
111 | void | 113 | void |
112 | Param::setValue(const QCString & value) | 114 | Param::setValue(const Q3CString & value) |
113 | { | 115 | { |
114 | value_ = value; | 116 | value_ = value; |
115 | 117 | ||
116 | assembled_ = false; | 118 | assembled_ = false; |
117 | } | 119 | } |
118 | 120 | ||
119 | QCString | 121 | Q3CString |
120 | Param::name() | 122 | Param::name() |
121 | { | 123 | { |
122 | return name_; | 124 | return name_; |
123 | } | 125 | } |
124 | 126 | ||
125 | QCString | 127 | Q3CString |
126 | Param::value() | 128 | Param::value() |
127 | { | 129 | { |
128 | return value_; | 130 | return value_; |
129 | } | 131 | } |
diff --git a/kabc/vcard/PhoneNumberValue.cpp b/kabc/vcard/PhoneNumberValue.cpp index 17b1400..57aa336 100644 --- a/kabc/vcard/PhoneNumberValue.cpp +++ b/kabc/vcard/PhoneNumberValue.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardPhoneNumberValue.h> | 24 | #include <VCardPhoneNumberValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | PhoneNumberValue::PhoneNumberValue() | 32 | PhoneNumberValue::PhoneNumberValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | PhoneNumberValue::PhoneNumberValue(const PhoneNumberValue & x) | 37 | PhoneNumberValue::PhoneNumberValue(const PhoneNumberValue & x) |
36 | :Value(x) | 38 | :Value(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | PhoneNumberValue::PhoneNumberValue(const QCString & s) | 42 | PhoneNumberValue::PhoneNumberValue(const Q3CString & s) |
41 | :Value(s) | 43 | :Value(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | PhoneNumberValue & | 47 | PhoneNumberValue & |
46 | PhoneNumberValue::operator = (PhoneNumberValue & x) | 48 | PhoneNumberValue::operator = (PhoneNumberValue & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Value::operator = (x); | 52 | Value::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | PhoneNumberValue & | 56 | PhoneNumberValue & |
55 | PhoneNumberValue::operator = (const QCString & s) | 57 | PhoneNumberValue::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Value::operator = (s); | 59 | Value::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | PhoneNumberValue::operator == (PhoneNumberValue & x) | 64 | PhoneNumberValue::operator == (PhoneNumberValue & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | PhoneNumberValue::~PhoneNumberValue() | 70 | PhoneNumberValue::~PhoneNumberValue() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | PhoneNumberValue::_parse() | 75 | PhoneNumberValue::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | PhoneNumberValue::_assemble() | 80 | PhoneNumberValue::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/RToken.cpp b/kabc/vcard/RToken.cpp index 2a85820..8fc0558 100644 --- a/kabc/vcard/RToken.cpp +++ b/kabc/vcard/RToken.cpp | |||
@@ -1,88 +1,88 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | libvcard - vCard parsing library for vCard version 3.0 | 3 | libvcard - vCard parsing library for vCard version 3.0 |
4 | 4 | ||
5 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 5 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
6 | 6 | ||
7 | Permission is hereby granted, free of charge, to any person obtaining a copy | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy |
8 | of this software and associated documentation files (the "Software"), to | 8 | of this software and associated documentation files (the "Software"), to |
9 | deal in the Software without restriction, including without limitation the | 9 | deal in the Software without restriction, including without limitation the |
10 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 10 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
11 | sell copies of the Software, and to permit persons to whom the Software is | 11 | sell copies of the Software, and to permit persons to whom the Software is |
12 | furnished to do so, subject to the following conditions: | 12 | furnished to do so, subject to the following conditions: |
13 | 13 | ||
14 | The above copyright notice and this permission notice shall be included in | 14 | The above copyright notice and this permission notice shall be included in |
15 | all copies or substantial portions of the Software. | 15 | all copies or substantial portions of the Software. |
16 | 16 | ||
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
20 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 20 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
21 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 21 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #include <string.h> | 25 | #include <string.h> |
26 | #include <stddef.h> | 26 | #include <stddef.h> |
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | #include <qstrlist.h> | 28 | #include <q3strlist.h> |
29 | 29 | ||
30 | namespace VCARD | 30 | namespace VCARD |
31 | { | 31 | { |
32 | 32 | ||
33 | Q_UINT32 | 33 | Q_UINT32 |
34 | RTokenise(const char * str, const char * delim, QStrList & l) | 34 | RTokenise(const char * str, const char * delim, Q3StrList & l) |
35 | { | 35 | { |
36 | // FIXME no stderr ! | 36 | // FIXME no stderr ! |
37 | l.clear(); | 37 | l.clear(); |
38 | 38 | ||
39 | if (!delim || !str || strlen(delim) == 0 || strlen(str) == 0) return 0; | 39 | if (!delim || !str || strlen(delim) == 0 || strlen(str) == 0) return 0; |
40 | 40 | ||
41 | char * len = (char *)(str + strlen(str));// End of string. | 41 | char * len = (char *)(str + strlen(str));// End of string. |
42 | 42 | ||
43 | register char * rstart = new char[strlen(str) + 1]; | 43 | register char * rstart = new char[strlen(str) + 1]; |
44 | register char * r = rstart; | 44 | register char * r = rstart; |
45 | 45 | ||
46 | 46 | ||
47 | register const char * i = str;// Cursor. | 47 | register const char * i = str;// Cursor. |
48 | 48 | ||
49 | while (i <= len) { | 49 | while (i <= len) { |
50 | 50 | ||
51 | if (*i == '\\') { // Escaped chars go straight through. | 51 | if (*i == '\\') { // Escaped chars go straight through. |
52 | *r++ = *i++; | 52 | *r++ = *i++; |
53 | if (i <= len) | 53 | if (i <= len) |
54 | *r++ = *i++; | 54 | *r++ = *i++; |
55 | continue; | 55 | continue; |
56 | } | 56 | } |
57 | 57 | ||
58 | if (strchr(delim, *i) != 0) { | 58 | if (strchr(delim, *i) != 0) { |
59 | // We hit a delimiter. If we have some text, make a new token. | 59 | // We hit a delimiter. If we have some text, make a new token. |
60 | // This has the effect that multiple delimiters are collapsed. | 60 | // This has the effect that multiple delimiters are collapsed. |
61 | // cs: We mustn't collapse multiple delimiters, otherwise we | 61 | // cs: We mustn't collapse multiple delimiters, otherwise we |
62 | // lose empty fields. | 62 | // lose empty fields. |
63 | *r = '\0'; | 63 | *r = '\0'; |
64 | // if (r != rstart) { | 64 | // if (r != rstart) { |
65 | l.append(rstart); | 65 | l.append(rstart); |
66 | // } | 66 | // } |
67 | r = rstart; | 67 | r = rstart; |
68 | ++i; | 68 | ++i; |
69 | continue; | 69 | continue; |
70 | } | 70 | } |
71 | 71 | ||
72 | *r++ = *i++; | 72 | *r++ = *i++; |
73 | } | 73 | } |
74 | 74 | ||
75 | // Catch last token | 75 | // Catch last token |
76 | //if (r != rstart) { | 76 | //if (r != rstart) { |
77 | *r = '\0'; | 77 | *r = '\0'; |
78 | l.append(rstart); | 78 | l.append(rstart); |
79 | //} | 79 | //} |
80 | 80 | ||
81 | r = 0; | 81 | r = 0; |
82 | 82 | ||
83 | delete [] rstart; | 83 | delete [] rstart; |
84 | 84 | ||
85 | return l.count(); | 85 | return l.count(); |
86 | } | 86 | } |
87 | 87 | ||
88 | } | 88 | } |
diff --git a/kabc/vcard/SoundValue.cpp b/kabc/vcard/SoundValue.cpp index 81040d1..4d098d2 100644 --- a/kabc/vcard/SoundValue.cpp +++ b/kabc/vcard/SoundValue.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardSoundValue.h> | 24 | #include <VCardSoundValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | SoundValue::SoundValue() | 32 | SoundValue::SoundValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | SoundValue::SoundValue(const SoundValue & x) | 37 | SoundValue::SoundValue(const SoundValue & x) |
36 | :Value(x) | 38 | :Value(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | SoundValue::SoundValue(const QCString & s) | 42 | SoundValue::SoundValue(const Q3CString & s) |
41 | :Value(s) | 43 | :Value(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | SoundValue & | 47 | SoundValue & |
46 | SoundValue::operator = (SoundValue & x) | 48 | SoundValue::operator = (SoundValue & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Value::operator = (x); | 52 | Value::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | SoundValue & | 56 | SoundValue & |
55 | SoundValue::operator = (const QCString & s) | 57 | SoundValue::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Value::operator = (s); | 59 | Value::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | SoundValue::operator == (SoundValue & x) | 64 | SoundValue::operator == (SoundValue & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | SoundValue::~SoundValue() | 70 | SoundValue::~SoundValue() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | SoundValue::_parse() | 75 | SoundValue::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | SoundValue::_assemble() | 80 | SoundValue::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/SourceParam.cpp b/kabc/vcard/SourceParam.cpp index cd51cbd..8f02113 100644 --- a/kabc/vcard/SourceParam.cpp +++ b/kabc/vcard/SourceParam.cpp | |||
@@ -1,112 +1,114 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardSourceParam.h> | 24 | #include <VCardSourceParam.h> |
25 | 25 | ||
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | SourceParam::SourceParam() | 32 | SourceParam::SourceParam() |
31 | :Param(), | 33 | :Param(), |
32 | type_(SourceParam::TypeUnknown) | 34 | type_(SourceParam::TypeUnknown) |
33 | { | 35 | { |
34 | } | 36 | } |
35 | 37 | ||
36 | SourceParam::SourceParam(const SourceParam & x) | 38 | SourceParam::SourceParam(const SourceParam & x) |
37 | :Param(x), | 39 | :Param(x), |
38 | type_(x.type_), | 40 | type_(x.type_), |
39 | par_(x.par_), | 41 | par_(x.par_), |
40 | val_(x.val_) | 42 | val_(x.val_) |
41 | { | 43 | { |
42 | } | 44 | } |
43 | 45 | ||
44 | SourceParam::SourceParam(const QCString & s) | 46 | SourceParam::SourceParam(const Q3CString & s) |
45 | :Param(s), | 47 | :Param(s), |
46 | type_(SourceParam::TypeUnknown) | 48 | type_(SourceParam::TypeUnknown) |
47 | { | 49 | { |
48 | } | 50 | } |
49 | 51 | ||
50 | SourceParam & | 52 | SourceParam & |
51 | SourceParam::operator = (SourceParam & x) | 53 | SourceParam::operator = (SourceParam & x) |
52 | { | 54 | { |
53 | if (*this == x) return *this; | 55 | if (*this == x) return *this; |
54 | type_= x.type(); | 56 | type_= x.type(); |
55 | par_= x.par(); | 57 | par_= x.par(); |
56 | val_= x.val(); | 58 | val_= x.val(); |
57 | 59 | ||
58 | Param::operator = (x); | 60 | Param::operator = (x); |
59 | return *this; | 61 | return *this; |
60 | } | 62 | } |
61 | 63 | ||
62 | SourceParam & | 64 | SourceParam & |
63 | SourceParam::operator = (const QCString & s) | 65 | SourceParam::operator = (const Q3CString & s) |
64 | { | 66 | { |
65 | Param::operator = (s); | 67 | Param::operator = (s); |
66 | return *this; | 68 | return *this; |
67 | } | 69 | } |
68 | 70 | ||
69 | bool | 71 | bool |
70 | SourceParam::operator == (SourceParam & x) | 72 | SourceParam::operator == (SourceParam & x) |
71 | { | 73 | { |
72 | x.parse(); | 74 | x.parse(); |
73 | return false; | 75 | return false; |
74 | } | 76 | } |
75 | 77 | ||
76 | SourceParam::~SourceParam() | 78 | SourceParam::~SourceParam() |
77 | { | 79 | { |
78 | } | 80 | } |
79 | 81 | ||
80 | void | 82 | void |
81 | SourceParam::_parse() | 83 | SourceParam::_parse() |
82 | { | 84 | { |
83 | int i = strRep_.find('='); | 85 | int i = strRep_.find('='); |
84 | if (i == -1) // Invalid | 86 | if (i == -1) // Invalid |
85 | return; | 87 | return; |
86 | 88 | ||
87 | par_ = strRep_.left(i); | 89 | par_ = strRep_.left(i); |
88 | val_ = strRep_.right(strRep_.length() - i - 1); | 90 | val_ = strRep_.right(strRep_.length() - i - 1); |
89 | 91 | ||
90 | if (qstricmp(par_, "VALUE") == 0 && qstricmp(val_, "uri") == 0) | 92 | if (qstricmp(par_, "VALUE") == 0 && qstricmp(val_, "uri") == 0) |
91 | type_ = TypeValue; | 93 | type_ = TypeValue; |
92 | else if (qstricmp(par_, "CONTEXT") == 0 && qstricmp(val_, "word") == 0) | 94 | else if (qstricmp(par_, "CONTEXT") == 0 && qstricmp(val_, "word") == 0) |
93 | type_ = TypeContext; | 95 | type_ = TypeContext; |
94 | else if (qstrnicmp(par_, "X-", 2) == 0) { | 96 | else if (qstrnicmp(par_, "X-", 2) == 0) { |
95 | type_ = TypeX; | 97 | type_ = TypeX; |
96 | } | 98 | } |
97 | else type_ = TypeUnknown; | 99 | else type_ = TypeUnknown; |
98 | 100 | ||
99 | } | 101 | } |
100 | 102 | ||
101 | void | 103 | void |
102 | SourceParam::_assemble() | 104 | SourceParam::_assemble() |
103 | { | 105 | { |
104 | if (type_ == TypeValue) | 106 | if (type_ == TypeValue) |
105 | strRep_ = "VALUE=uri"; | 107 | strRep_ = "VALUE=uri"; |
106 | else if (type_ == TypeContext) | 108 | else if (type_ == TypeContext) |
107 | strRep_ = "CONTEXT=word"; | 109 | strRep_ = "CONTEXT=word"; |
108 | else if (type_ == TypeX) | 110 | else if (type_ == TypeX) |
109 | strRep_ = par_ + "=" + val_; | 111 | strRep_ = par_ + "=" + val_; |
110 | else strRep_ = ""; | 112 | else strRep_ = ""; |
111 | } | 113 | } |
112 | 114 | ||
diff --git a/kabc/vcard/TelParam.cpp b/kabc/vcard/TelParam.cpp index 9d9fe4d..4bc8b6a 100644 --- a/kabc/vcard/TelParam.cpp +++ b/kabc/vcard/TelParam.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardTelParam.h> | 24 | #include <VCardTelParam.h> |
25 | 25 | ||
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | TelParam::TelParam() | 32 | TelParam::TelParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | TelParam::TelParam(const TelParam & x) | 37 | TelParam::TelParam(const TelParam & x) |
36 | :Param(x) | 38 | :Param(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | TelParam::TelParam(const QCString & s) | 42 | TelParam::TelParam(const Q3CString & s) |
41 | :Param(s) | 43 | :Param(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | TelParam & | 47 | TelParam & |
46 | TelParam::operator = (TelParam & x) | 48 | TelParam::operator = (TelParam & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Param::operator = (x); | 52 | Param::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | TelParam & | 56 | TelParam & |
55 | TelParam::operator = (const QCString & s) | 57 | TelParam::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Param::operator = (s); | 59 | Param::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | TelParam::operator == (TelParam & x) | 64 | TelParam::operator == (TelParam & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | TelParam::~TelParam() | 70 | TelParam::~TelParam() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | TelParam::_parse() | 75 | TelParam::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | TelParam::_assemble() | 80 | TelParam::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/TelValue.cpp b/kabc/vcard/TelValue.cpp index 349f99a..d9cbf3e 100644 --- a/kabc/vcard/TelValue.cpp +++ b/kabc/vcard/TelValue.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardTelValue.h> | 24 | #include <VCardTelValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | TelValue::TelValue() | 32 | TelValue::TelValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | TelValue::TelValue(const TelValue & x) | 37 | TelValue::TelValue(const TelValue & x) |
36 | :Value(x) | 38 | :Value(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | TelValue::TelValue(const QCString & s) | 42 | TelValue::TelValue(const Q3CString & s) |
41 | :Value(s) | 43 | :Value(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | TelValue & | 47 | TelValue & |
46 | TelValue::operator = (TelValue & x) | 48 | TelValue::operator = (TelValue & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Value::operator = (x); | 52 | Value::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | TelValue & | 56 | TelValue & |
55 | TelValue::operator = (const QCString & s) | 57 | TelValue::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Value::operator = (s); | 59 | Value::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | TelValue::operator == (TelValue & x) | 64 | TelValue::operator == (TelValue & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | TelValue::~TelValue() | 70 | TelValue::~TelValue() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | TelValue::_parse() | 75 | TelValue::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | TelValue::_assemble() | 80 | TelValue::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/TextBinParam.cpp b/kabc/vcard/TextBinParam.cpp index 66f2946..2866c12 100644 --- a/kabc/vcard/TextBinParam.cpp +++ b/kabc/vcard/TextBinParam.cpp | |||
@@ -1,81 +1,83 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardTextBinParam.h> | 24 | #include <VCardTextBinParam.h> |
25 | 25 | ||
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | TextBinParam::TextBinParam() | 32 | TextBinParam::TextBinParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | TextBinParam::TextBinParam(const TextBinParam & x) | 37 | TextBinParam::TextBinParam(const TextBinParam & x) |
36 | :Param(x) | 38 | :Param(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | TextBinParam::TextBinParam(const QCString & s) | 42 | TextBinParam::TextBinParam(const Q3CString & s) |
41 | :Param(s) | 43 | :Param(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | TextBinParam & | 47 | TextBinParam & |
46 | TextBinParam::operator = (TextBinParam & x) | 48 | TextBinParam::operator = (TextBinParam & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Param::operator = (x); | 52 | Param::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | TextBinParam & | 56 | TextBinParam & |
55 | TextBinParam::operator = (const QCString & s) | 57 | TextBinParam::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Param::operator = (s); | 59 | Param::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | TextBinParam::operator == (TextBinParam & x) | 64 | TextBinParam::operator == (TextBinParam & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | return false; | 67 | return false; |
66 | } | 68 | } |
67 | 69 | ||
68 | TextBinParam::~TextBinParam() | 70 | TextBinParam::~TextBinParam() |
69 | { | 71 | { |
70 | } | 72 | } |
71 | 73 | ||
72 | void | 74 | void |
73 | TextBinParam::_parse() | 75 | TextBinParam::_parse() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | TextBinParam::_assemble() | 80 | TextBinParam::_assemble() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
diff --git a/kabc/vcard/TextBinValue.cpp b/kabc/vcard/TextBinValue.cpp index c584009..a3a96ae 100644 --- a/kabc/vcard/TextBinValue.cpp +++ b/kabc/vcard/TextBinValue.cpp | |||
@@ -1,104 +1,106 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <kmdcodec.h> | 24 | #include <kmdcodec.h> |
25 | 25 | ||
26 | #include <VCardTextBinValue.h> | 26 | #include <VCardTextBinValue.h> |
27 | #include <VCardValue.h> | 27 | #include <VCardValue.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3CString> | ||
28 | 30 | ||
29 | using namespace VCARD; | 31 | using namespace VCARD; |
30 | 32 | ||
31 | TextBinValue::TextBinValue() | 33 | TextBinValue::TextBinValue() |
32 | :Value() | 34 | :Value() |
33 | { | 35 | { |
34 | } | 36 | } |
35 | 37 | ||
36 | TextBinValue::TextBinValue(const TextBinValue & x) | 38 | TextBinValue::TextBinValue(const TextBinValue & x) |
37 | :Value(x) | 39 | :Value(x) |
38 | { | 40 | { |
39 | mIsBinary_ = x.mIsBinary_; | 41 | mIsBinary_ = x.mIsBinary_; |
40 | mData_ = x.mData_; | 42 | mData_ = x.mData_; |
41 | mUrl_ = x.mUrl_; | 43 | mUrl_ = x.mUrl_; |
42 | } | 44 | } |
43 | 45 | ||
44 | TextBinValue::TextBinValue(const QCString & s) | 46 | TextBinValue::TextBinValue(const Q3CString & s) |
45 | :Value(s) | 47 | :Value(s) |
46 | { | 48 | { |
47 | } | 49 | } |
48 | 50 | ||
49 | TextBinValue & | 51 | TextBinValue & |
50 | TextBinValue::operator = (TextBinValue & x) | 52 | TextBinValue::operator = (TextBinValue & x) |
51 | { | 53 | { |
52 | if (*this == x) return *this; | 54 | if (*this == x) return *this; |
53 | 55 | ||
54 | mIsBinary_ = x.mIsBinary_; | 56 | mIsBinary_ = x.mIsBinary_; |
55 | mData_ = x.mData_; | 57 | mData_ = x.mData_; |
56 | mUrl_ = x.mUrl_; | 58 | mUrl_ = x.mUrl_; |
57 | 59 | ||
58 | Value::operator = (x); | 60 | Value::operator = (x); |
59 | return *this; | 61 | return *this; |
60 | } | 62 | } |
61 | 63 | ||
62 | TextBinValue & | 64 | TextBinValue & |
63 | TextBinValue::operator = (const QCString & s) | 65 | TextBinValue::operator = (const Q3CString & s) |
64 | { | 66 | { |
65 | Value::operator = (s); | 67 | Value::operator = (s); |
66 | return *this; | 68 | return *this; |
67 | } | 69 | } |
68 | 70 | ||
69 | bool | 71 | bool |
70 | TextBinValue::operator == (TextBinValue & x) | 72 | TextBinValue::operator == (TextBinValue & x) |
71 | { | 73 | { |
72 | x.parse(); | 74 | x.parse(); |
73 | 75 | ||
74 | if ( mIsBinary_ != x.mIsBinary_ ) return false; | 76 | if ( mIsBinary_ != x.mIsBinary_ ) return false; |
75 | if ( mData_ != x.mData_ ) return false; | 77 | if ( mData_ != x.mData_ ) return false; |
76 | if ( mUrl_ != x.mUrl_ ) return false; | 78 | if ( mUrl_ != x.mUrl_ ) return false; |
77 | 79 | ||
78 | return true; | 80 | return true; |
79 | } | 81 | } |
80 | 82 | ||
81 | TextBinValue::~TextBinValue() | 83 | TextBinValue::~TextBinValue() |
82 | { | 84 | { |
83 | } | 85 | } |
84 | 86 | ||
85 | TextBinValue * | 87 | TextBinValue * |
86 | TextBinValue::clone() | 88 | TextBinValue::clone() |
87 | { | 89 | { |
88 | return new TextBinValue( *this ); | 90 | return new TextBinValue( *this ); |
89 | } | 91 | } |
90 | 92 | ||
91 | void | 93 | void |
92 | TextBinValue::_parse() | 94 | TextBinValue::_parse() |
93 | { | 95 | { |
94 | } | 96 | } |
95 | 97 | ||
96 | void | 98 | void |
97 | TextBinValue::_assemble() | 99 | TextBinValue::_assemble() |
98 | { | 100 | { |
99 | if ( mIsBinary_ ) { | 101 | if ( mIsBinary_ ) { |
100 | strRep_ = KCodecs::base64Encode( mData_ ); | 102 | strRep_ = KCodecs::base64Encode( mData_ ); |
101 | } else | 103 | } else |
102 | strRep_ = mUrl_.utf8(); | 104 | strRep_ = mUrl_.utf8(); |
103 | } | 105 | } |
104 | 106 | ||
diff --git a/kabc/vcard/TextListValue.cpp b/kabc/vcard/TextListValue.cpp index c4ac1e3..919f4f7 100644 --- a/kabc/vcard/TextListValue.cpp +++ b/kabc/vcard/TextListValue.cpp | |||
@@ -1,107 +1,109 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardRToken.h> | 24 | #include <VCardRToken.h> |
25 | 25 | ||
26 | #include <VCardTextListValue.h> | 26 | #include <VCardTextListValue.h> |
27 | 27 | ||
28 | #include <VCardValue.h> | 28 | #include <VCardValue.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3CString> | ||
29 | 31 | ||
30 | using namespace VCARD; | 32 | using namespace VCARD; |
31 | 33 | ||
32 | TextListValue::TextListValue() | 34 | TextListValue::TextListValue() |
33 | :Value() | 35 | :Value() |
34 | { | 36 | { |
35 | } | 37 | } |
36 | 38 | ||
37 | TextListValue::TextListValue(const TextListValue & x) | 39 | TextListValue::TextListValue(const TextListValue & x) |
38 | :Value(x) | 40 | :Value(x) |
39 | { | 41 | { |
40 | } | 42 | } |
41 | 43 | ||
42 | TextListValue::TextListValue(const QCString & s) | 44 | TextListValue::TextListValue(const Q3CString & s) |
43 | :Value(s) | 45 | :Value(s) |
44 | { | 46 | { |
45 | } | 47 | } |
46 | 48 | ||
47 | TextListValue & | 49 | TextListValue & |
48 | TextListValue::operator = (TextListValue & x) | 50 | TextListValue::operator = (TextListValue & x) |
49 | { | 51 | { |
50 | if (*this == x) return *this; | 52 | if (*this == x) return *this; |
51 | 53 | ||
52 | Value::operator = (x); | 54 | Value::operator = (x); |
53 | return *this; | 55 | return *this; |
54 | } | 56 | } |
55 | 57 | ||
56 | TextListValue & | 58 | TextListValue & |
57 | TextListValue::operator = (const QCString & s) | 59 | TextListValue::operator = (const Q3CString & s) |
58 | { | 60 | { |
59 | Value::operator = (s); | 61 | Value::operator = (s); |
60 | return *this; | 62 | return *this; |
61 | } | 63 | } |
62 | 64 | ||
63 | bool | 65 | bool |
64 | TextListValue::operator == (TextListValue & x) | 66 | TextListValue::operator == (TextListValue & x) |
65 | { | 67 | { |
66 | x.parse(); | 68 | x.parse(); |
67 | return false; | 69 | return false; |
68 | } | 70 | } |
69 | 71 | ||
70 | TextListValue::~TextListValue() | 72 | TextListValue::~TextListValue() |
71 | { | 73 | { |
72 | } | 74 | } |
73 | 75 | ||
74 | void | 76 | void |
75 | TextListValue::_parse() | 77 | TextListValue::_parse() |
76 | { | 78 | { |
77 | RTokenise(strRep_, ";", valueList_); | 79 | RTokenise(strRep_, ";", valueList_); |
78 | } | 80 | } |
79 | 81 | ||
80 | void | 82 | void |
81 | TextListValue::_assemble() | 83 | TextListValue::_assemble() |
82 | { | 84 | { |
83 | bool first(true); | 85 | bool first(true); |
84 | 86 | ||
85 | QStrListIterator it(valueList_); | 87 | Q3StrListIterator it(valueList_); |
86 | 88 | ||
87 | for (; it.current(); ++it) { | 89 | for (; it.current(); ++it) { |
88 | if (!first) strRep_ += ';'; | 90 | if (!first) strRep_ += ';'; |
89 | strRep_ += it.current(); | 91 | strRep_ += it.current(); |
90 | first = false; | 92 | first = false; |
91 | } | 93 | } |
92 | } | 94 | } |
93 | 95 | ||
94 | unsigned int | 96 | unsigned int |
95 | TextListValue::numValues() | 97 | TextListValue::numValues() |
96 | { | 98 | { |
97 | parse(); | 99 | parse(); |
98 | return valueList_.count(); | 100 | return valueList_.count(); |
99 | } | 101 | } |
100 | 102 | ||
101 | QCString | 103 | Q3CString |
102 | TextListValue::value(unsigned int i) | 104 | TextListValue::value(unsigned int i) |
103 | { | 105 | { |
104 | parse(); | 106 | parse(); |
105 | return valueList_.at(i); | 107 | return valueList_.at(i); |
106 | } | 108 | } |
107 | 109 | ||
diff --git a/kabc/vcard/TextParam.cpp b/kabc/vcard/TextParam.cpp index 7c68700..ce6661f 100644 --- a/kabc/vcard/TextParam.cpp +++ b/kabc/vcard/TextParam.cpp | |||
@@ -1,82 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardTextParam.h> | 24 | #include <VCardTextParam.h> |
25 | 25 | ||
26 | #include <VCardParam.h> | 26 | #include <VCardParam.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | TextParam::TextParam() | 32 | TextParam::TextParam() |
31 | :Param() | 33 | :Param() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | TextParam::TextParam(const TextParam & x) | 37 | TextParam::TextParam(const TextParam & x) |
36 | :Param(x) | 38 | :Param(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | TextParam::TextParam(const QCString & s) | 42 | TextParam::TextParam(const Q3CString & s) |
41 | :Param(s) | 43 | :Param(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | TextParam & | 47 | TextParam & |
46 | TextParam::operator = (TextParam & x) | 48 | TextParam::operator = (TextParam & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Param::operator = (x); | 52 | Param::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | TextParam & | 56 | TextParam & |
55 | TextParam::operator = (const QCString & s) | 57 | TextParam::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Param::operator = (s); | 59 | Param::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | TextParam::operator == (TextParam & x) | 64 | TextParam::operator == (TextParam & x) |
63 | { | 65 | { |
64 | x.parse(); | 66 | x.parse(); |
65 | 67 | ||
66 | return false; | 68 | return false; |
67 | } | 69 | } |
68 | 70 | ||
69 | TextParam::~TextParam() | 71 | TextParam::~TextParam() |
70 | { | 72 | { |
71 | } | 73 | } |
72 | 74 | ||
73 | void | 75 | void |
74 | TextParam::_parse() | 76 | TextParam::_parse() |
75 | { | 77 | { |
76 | } | 78 | } |
77 | 79 | ||
78 | void | 80 | void |
79 | TextParam::_assemble() | 81 | TextParam::_assemble() |
80 | { | 82 | { |
81 | } | 83 | } |
82 | 84 | ||
diff --git a/kabc/vcard/TextValue.cpp b/kabc/vcard/TextValue.cpp index 09934fa..d0d2996 100644 --- a/kabc/vcard/TextValue.cpp +++ b/kabc/vcard/TextValue.cpp | |||
@@ -1,86 +1,88 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardTextValue.h> | 24 | #include <VCardTextValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | TextValue::TextValue() | 32 | TextValue::TextValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | TextValue::TextValue(const TextValue & x) | 37 | TextValue::TextValue(const TextValue & x) |
36 | :Value(x) | 38 | :Value(x) |
37 | { | 39 | { |
38 | } | 40 | } |
39 | 41 | ||
40 | TextValue::TextValue(const QCString & s) | 42 | TextValue::TextValue(const Q3CString & s) |
41 | :Value(s) | 43 | :Value(s) |
42 | { | 44 | { |
43 | } | 45 | } |
44 | 46 | ||
45 | TextValue & | 47 | TextValue & |
46 | TextValue::operator = (TextValue & x) | 48 | TextValue::operator = (TextValue & x) |
47 | { | 49 | { |
48 | if (*this == x) return *this; | 50 | if (*this == x) return *this; |
49 | 51 | ||
50 | Value::operator = (x); | 52 | Value::operator = (x); |
51 | return *this; | 53 | return *this; |
52 | } | 54 | } |
53 | 55 | ||
54 | TextValue & | 56 | TextValue & |
55 | TextValue::operator = (const QCString & s) | 57 | TextValue::operator = (const Q3CString & s) |
56 | { | 58 | { |
57 | Value::operator = (s); | 59 | Value::operator = (s); |
58 | return *this; | 60 | return *this; |
59 | } | 61 | } |
60 | 62 | ||
61 | bool | 63 | bool |
62 | TextValue::operator == (TextValue & x) | 64 | TextValue::operator == (TextValue & x) |
63 | { | 65 | { |
64 | return strRep_ = x.strRep_; | 66 | return strRep_ == x.strRep_; |
65 | } | 67 | } |
66 | 68 | ||
67 | TextValue::~TextValue() | 69 | TextValue::~TextValue() |
68 | { | 70 | { |
69 | } | 71 | } |
70 | 72 | ||
71 | TextValue * | 73 | TextValue * |
72 | TextValue::clone() | 74 | TextValue::clone() |
73 | { | 75 | { |
74 | return new TextValue( *this ); | 76 | return new TextValue( *this ); |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | TextValue::_parse() | 80 | TextValue::_parse() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
82 | void | 84 | void |
83 | TextValue::_assemble() | 85 | TextValue::_assemble() |
84 | { | 86 | { |
85 | } | 87 | } |
86 | 88 | ||
diff --git a/kabc/vcard/URIValue.cpp b/kabc/vcard/URIValue.cpp index c1d1022..26da7f4 100644 --- a/kabc/vcard/URIValue.cpp +++ b/kabc/vcard/URIValue.cpp | |||
@@ -1,133 +1,135 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardURIValue.h> | 24 | #include <VCardURIValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | URIValue::URIValue() | 32 | URIValue::URIValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | URIValue::URIValue(const QCString & scheme, const QCString & schemeSpecificPart) | 37 | URIValue::URIValue(const Q3CString & scheme, const Q3CString & schemeSpecificPart) |
36 | :Value(), | 38 | :Value(), |
37 | scheme_ (scheme), | 39 | scheme_ (scheme), |
38 | schemeSpecificPart_(schemeSpecificPart) | 40 | schemeSpecificPart_(schemeSpecificPart) |
39 | { | 41 | { |
40 | parsed_ = true; | 42 | parsed_ = true; |
41 | } | 43 | } |
42 | 44 | ||
43 | URIValue::URIValue(const URIValue & x) | 45 | URIValue::URIValue(const URIValue & x) |
44 | : Value (x), | 46 | : Value (x), |
45 | scheme_ (x.scheme_), | 47 | scheme_ (x.scheme_), |
46 | schemeSpecificPart_(x.schemeSpecificPart_) | 48 | schemeSpecificPart_(x.schemeSpecificPart_) |
47 | { | 49 | { |
48 | } | 50 | } |
49 | 51 | ||
50 | URIValue::URIValue(const QCString & s) | 52 | URIValue::URIValue(const Q3CString & s) |
51 | :Value(s) | 53 | :Value(s) |
52 | { | 54 | { |
53 | } | 55 | } |
54 | 56 | ||
55 | URIValue & | 57 | URIValue & |
56 | URIValue::operator = (URIValue & x) | 58 | URIValue::operator = (URIValue & x) |
57 | { | 59 | { |
58 | if (*this == x) return *this; | 60 | if (*this == x) return *this; |
59 | 61 | ||
60 | scheme_ = x.scheme_; | 62 | scheme_ = x.scheme_; |
61 | schemeSpecificPart_= x.schemeSpecificPart_; | 63 | schemeSpecificPart_= x.schemeSpecificPart_; |
62 | 64 | ||
63 | Value::operator = (x); | 65 | Value::operator = (x); |
64 | return *this; | 66 | return *this; |
65 | } | 67 | } |
66 | 68 | ||
67 | URIValue & | 69 | URIValue & |
68 | URIValue::operator = (const QCString & s) | 70 | URIValue::operator = (const Q3CString & s) |
69 | { | 71 | { |
70 | Value::operator = (s); | 72 | Value::operator = (s); |
71 | return *this; | 73 | return *this; |
72 | } | 74 | } |
73 | 75 | ||
74 | bool | 76 | bool |
75 | URIValue::operator == (URIValue & x) | 77 | URIValue::operator == (URIValue & x) |
76 | { | 78 | { |
77 | x.parse(); | 79 | x.parse(); |
78 | return ( | 80 | return ( |
79 | (scheme_ == x.scheme_) && | 81 | (scheme_ == x.scheme_) && |
80 | (schemeSpecificPart_== x.schemeSpecificPart_)); | 82 | (schemeSpecificPart_== x.schemeSpecificPart_)); |
81 | 83 | ||
82 | return false; | 84 | return false; |
83 | } | 85 | } |
84 | 86 | ||
85 | URIValue::~URIValue() | 87 | URIValue::~URIValue() |
86 | { | 88 | { |
87 | } | 89 | } |
88 | 90 | ||
89 | void | 91 | void |
90 | URIValue::_parse() | 92 | URIValue::_parse() |
91 | { | 93 | { |
92 | int split = strRep_.find(':'); | 94 | int split = strRep_.find(':'); |
93 | if (split == -1) | 95 | if (split == -1) |
94 | return; | 96 | return; |
95 | 97 | ||
96 | scheme_ = strRep_.left(split); | 98 | scheme_ = strRep_.left(split); |
97 | schemeSpecificPart_ = strRep_.mid(split + 1); | 99 | schemeSpecificPart_ = strRep_.mid(split + 1); |
98 | } | 100 | } |
99 | 101 | ||
100 | void | 102 | void |
101 | URIValue::_assemble() | 103 | URIValue::_assemble() |
102 | { | 104 | { |
103 | strRep_ = scheme_ + ':' + schemeSpecificPart_; | 105 | strRep_ = scheme_ + ':' + schemeSpecificPart_; |
104 | } | 106 | } |
105 | 107 | ||
106 | QCString | 108 | Q3CString |
107 | URIValue::scheme() | 109 | URIValue::scheme() |
108 | { | 110 | { |
109 | parse(); | 111 | parse(); |
110 | return scheme_; | 112 | return scheme_; |
111 | } | 113 | } |
112 | 114 | ||
113 | QCString | 115 | Q3CString |
114 | URIValue::schemeSpecificPart() | 116 | URIValue::schemeSpecificPart() |
115 | { | 117 | { |
116 | parse(); | 118 | parse(); |
117 | return schemeSpecificPart_; | 119 | return schemeSpecificPart_; |
118 | } | 120 | } |
119 | 121 | ||
120 | void | 122 | void |
121 | URIValue::setScheme(const QCString & s) | 123 | URIValue::setScheme(const Q3CString & s) |
122 | { | 124 | { |
123 | parse(); | 125 | parse(); |
124 | scheme_ = s; | 126 | scheme_ = s; |
125 | } | 127 | } |
126 | 128 | ||
127 | void | 129 | void |
128 | URIValue::setSchemeSpecificPart(const QCString & s) | 130 | URIValue::setSchemeSpecificPart(const Q3CString & s) |
129 | { | 131 | { |
130 | parse(); | 132 | parse(); |
131 | schemeSpecificPart_ = s; | 133 | schemeSpecificPart_ = s; |
132 | } | 134 | } |
133 | 135 | ||
diff --git a/kabc/vcard/UTCValue.cpp b/kabc/vcard/UTCValue.cpp index 374306c..f35d986 100644 --- a/kabc/vcard/UTCValue.cpp +++ b/kabc/vcard/UTCValue.cpp | |||
@@ -1,110 +1,112 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardUTCValue.h> | 24 | #include <VCardUTCValue.h> |
25 | 25 | ||
26 | #include <VCardValue.h> | 26 | #include <VCardValue.h> |
27 | //Added by qt3to4: | ||
28 | #include <Q3CString> | ||
27 | 29 | ||
28 | using namespace VCARD; | 30 | using namespace VCARD; |
29 | 31 | ||
30 | UTCValue::UTCValue() | 32 | UTCValue::UTCValue() |
31 | :Value() | 33 | :Value() |
32 | { | 34 | { |
33 | } | 35 | } |
34 | 36 | ||
35 | UTCValue::UTCValue(const UTCValue & x) | 37 | UTCValue::UTCValue(const UTCValue & x) |
36 | : Value(x),positive_(x.positive_), hour_(x.hour_), minute_(x.minute_) | 38 | : Value(x),positive_(x.positive_), hour_(x.hour_), minute_(x.minute_) |
37 | 39 | ||
38 | { | 40 | { |
39 | } | 41 | } |
40 | 42 | ||
41 | UTCValue::UTCValue(const QCString & s) | 43 | UTCValue::UTCValue(const Q3CString & s) |
42 | :Value(s) | 44 | :Value(s) |
43 | { | 45 | { |
44 | } | 46 | } |
45 | 47 | ||
46 | UTCValue & | 48 | UTCValue & |
47 | UTCValue::operator = (UTCValue & x) | 49 | UTCValue::operator = (UTCValue & x) |
48 | { | 50 | { |
49 | if (*this == x) return *this; | 51 | if (*this == x) return *this; |
50 | 52 | ||
51 | positive_ = x.positive_; | 53 | positive_ = x.positive_; |
52 | hour_ = x.hour_; | 54 | hour_ = x.hour_; |
53 | minute_ = x.minute_; | 55 | minute_ = x.minute_; |
54 | 56 | ||
55 | Value::operator = (x); | 57 | Value::operator = (x); |
56 | return *this; | 58 | return *this; |
57 | } | 59 | } |
58 | 60 | ||
59 | UTCValue & | 61 | UTCValue & |
60 | UTCValue::operator = (const QCString & s) | 62 | UTCValue::operator = (const Q3CString & s) |
61 | { | 63 | { |
62 | Value::operator = (s); | 64 | Value::operator = (s); |
63 | return *this; | 65 | return *this; |
64 | } | 66 | } |
65 | 67 | ||
66 | bool | 68 | bool |
67 | UTCValue::operator == (UTCValue & x) | 69 | UTCValue::operator == (UTCValue & x) |
68 | { | 70 | { |
69 | x.parse(); | 71 | x.parse(); |
70 | 72 | ||
71 | if (positive_ != x.positive_) return false; | 73 | if (positive_ != x.positive_) return false; |
72 | if (hour_ != x.hour_) return false; | 74 | if (hour_ != x.hour_) return false; |
73 | if (minute_ != x.minute_) return false; | 75 | if (minute_ != x.minute_) return false; |
74 | 76 | ||
75 | return true; | 77 | return true; |
76 | } | 78 | } |
77 | 79 | ||
78 | UTCValue::~UTCValue() | 80 | UTCValue::~UTCValue() |
79 | { | 81 | { |
80 | } | 82 | } |
81 | 83 | ||
82 | UTCValue * | 84 | UTCValue * |
83 | UTCValue::clone() | 85 | UTCValue::clone() |
84 | { | 86 | { |
85 | return new UTCValue( *this ); | 87 | return new UTCValue( *this ); |
86 | } | 88 | } |
87 | 89 | ||
88 | void | 90 | void |
89 | UTCValue::_parse() | 91 | UTCValue::_parse() |
90 | { | 92 | { |
91 | if ( strRep_.isEmpty() ) | 93 | if ( strRep_.isEmpty() ) |
92 | return; | 94 | return; |
93 | 95 | ||
94 | positive_ = ( strRep_[0] == '+' ); | 96 | positive_ = ( strRep_[0] == '+' ); |
95 | 97 | ||
96 | int colon = strRep_.find( ':' ); | 98 | int colon = strRep_.find( ':' ); |
97 | 99 | ||
98 | if ( colon == -1 ) // Not valid. | 100 | if ( colon == -1 ) // Not valid. |
99 | return; | 101 | return; |
100 | 102 | ||
101 | hour_= strRep_.mid( 1, 2 ).toInt(); | 103 | hour_= strRep_.mid( 1, 2 ).toInt(); |
102 | minute_= strRep_.right( 2 ).toInt(); | 104 | minute_= strRep_.right( 2 ).toInt(); |
103 | } | 105 | } |
104 | 106 | ||
105 | void | 107 | void |
106 | UTCValue::_assemble() | 108 | UTCValue::_assemble() |
107 | { | 109 | { |
108 | strRep_.sprintf( "%c%.2i:%.2i", (positive_ ? '+' : '-'), hour_, minute_ ); | 110 | strRep_.sprintf( "%c%.2i:%.2i", (positive_ ? '+' : '-'), hour_, minute_ ); |
109 | } | 111 | } |
110 | 112 | ||
diff --git a/kabc/vcard/VCardEntity.cpp b/kabc/vcard/VCardEntity.cpp index a2ff327..bae5385 100644 --- a/kabc/vcard/VCardEntity.cpp +++ b/kabc/vcard/VCardEntity.cpp | |||
@@ -1,175 +1,177 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qregexp.h> | 24 | #include <qregexp.h> |
25 | #include <qdatetime.h> | 25 | #include <qdatetime.h> |
26 | //Added by qt3to4: | ||
27 | #include <Q3CString> | ||
26 | 28 | ||
27 | #include <VCardDefines.h> | 29 | #include <VCardDefines.h> |
28 | #include <VCardVCardEntity.h> | 30 | #include <VCardVCardEntity.h> |
29 | 31 | ||
30 | using namespace VCARD; | 32 | using namespace VCARD; |
31 | 33 | ||
32 | VCardEntity::VCardEntity() | 34 | VCardEntity::VCardEntity() |
33 | :Entity() | 35 | :Entity() |
34 | { | 36 | { |
35 | cardList_.setAutoDelete( TRUE ); | 37 | cardList_.setAutoDelete( TRUE ); |
36 | } | 38 | } |
37 | 39 | ||
38 | VCardEntity::VCardEntity(const VCardEntity & x) | 40 | VCardEntity::VCardEntity(const VCardEntity & x) |
39 | :Entity(x) | 41 | :Entity(x) |
40 | { | 42 | { |
41 | cardList_.setAutoDelete( TRUE ); | 43 | cardList_.setAutoDelete( TRUE ); |
42 | } | 44 | } |
43 | 45 | ||
44 | VCardEntity::VCardEntity(const QCString & s) | 46 | VCardEntity::VCardEntity(const Q3CString & s) |
45 | :Entity(s) | 47 | :Entity(s) |
46 | { | 48 | { |
47 | cardList_.setAutoDelete( TRUE ); | 49 | cardList_.setAutoDelete( TRUE ); |
48 | } | 50 | } |
49 | 51 | ||
50 | VCardEntity & | 52 | VCardEntity & |
51 | VCardEntity::operator = (VCardEntity & x) | 53 | VCardEntity::operator = (VCardEntity & x) |
52 | { | 54 | { |
53 | if (*this == x) return *this; | 55 | if (*this == x) return *this; |
54 | 56 | ||
55 | Entity::operator = (x); | 57 | Entity::operator = (x); |
56 | return *this; | 58 | return *this; |
57 | } | 59 | } |
58 | 60 | ||
59 | VCardEntity & | 61 | VCardEntity & |
60 | VCardEntity::operator = (const QCString & s) | 62 | VCardEntity::operator = (const Q3CString & s) |
61 | { | 63 | { |
62 | Entity::operator = (s); | 64 | Entity::operator = (s); |
63 | return *this; | 65 | return *this; |
64 | } | 66 | } |
65 | 67 | ||
66 | bool | 68 | bool |
67 | VCardEntity::operator == (VCardEntity & x) | 69 | VCardEntity::operator == (VCardEntity & x) |
68 | { | 70 | { |
69 | x.parse(); | 71 | x.parse(); |
70 | return false; | 72 | return false; |
71 | } | 73 | } |
72 | 74 | ||
73 | VCardEntity::~VCardEntity() | 75 | VCardEntity::~VCardEntity() |
74 | { | 76 | { |
75 | } | 77 | } |
76 | 78 | ||
77 | void | 79 | void |
78 | VCardEntity::_parse() | 80 | VCardEntity::_parse() |
79 | { | 81 | { |
80 | #if 0 | 82 | #if 0 |
81 | QTime tim; | 83 | QTime tim; |
82 | tim.start(); | 84 | tim.start(); |
83 | int num = 0; | 85 | int num = 0; |
84 | // old code | 86 | // old code |
85 | vDebug("parse"); | 87 | vDebug("parse"); |
86 | QCString s(strRep_); | 88 | Q3CString s(strRep_); |
87 | 89 | ||
88 | int i = s.find(QRegExp("BEGIN:VCARD", false)); | 90 | int i = s.find(QRegExp("BEGIN:VCARD", false)); |
89 | 91 | ||
90 | while (i != -1) { | 92 | while (i != -1) { |
91 | 93 | ||
92 | i = s.find(QRegExp("BEGIN:VCARD", false), 11); | 94 | i = s.find(QRegExp("BEGIN:VCARD", false), 11); |
93 | 95 | ||
94 | QCString cardStr(s.left(i)); | 96 | Q3CString cardStr(s.left(i)); |
95 | 97 | ||
96 | VCard * v = new VCard(cardStr); | 98 | VCard * v = new VCard(cardStr); |
97 | 99 | ||
98 | cardList_.append(v); | 100 | cardList_.append(v); |
99 | 101 | ||
100 | v->parse(); | 102 | v->parse(); |
101 | 103 | ||
102 | s.remove(0, i); | 104 | s.remove(0, i); |
103 | } | 105 | } |
104 | 106 | ||
105 | #else | 107 | #else |
106 | // this code is up to 17 (!) times faster | 108 | // this code is up to 17 (!) times faster |
107 | int start = 0; | 109 | int start = 0; |
108 | QTime tim; | 110 | QTime tim; |
109 | tim.start(); | 111 | tim.start(); |
110 | int i = 11; | 112 | int i = 11; |
111 | int len = strRep_.length(); | 113 | int len = strRep_.length(); |
112 | int num = 0; | 114 | int num = 0; |
113 | while (i < len ) { | 115 | while (i < len ) { |
114 | while( i < len ) { | 116 | while( i < len ) { |
115 | int add = 1; | 117 | int add = 1; |
116 | if ( strRep_.at(i) == 'B' ) { | 118 | if ( strRep_.at(i) == 'B' ) { |
117 | if ( i+add < len && strRep_.at(i+add++) == 'E') | 119 | if ( i+add < len && strRep_.at(i+add++) == 'E') |
118 | if ( i+add < len && strRep_.at(i+add++) == 'G') | 120 | if ( i+add < len && strRep_.at(i+add++) == 'G') |
119 | if ( i+add < len && strRep_.at(i+add++) == 'I') | 121 | if ( i+add < len && strRep_.at(i+add++) == 'I') |
120 | if ( i+add < len && strRep_.at(i+add++) == 'N') | 122 | if ( i+add < len && strRep_.at(i+add++) == 'N') |
121 | if ( i+add < len && strRep_.at(i+add++) == ':') | 123 | if ( i+add < len && strRep_.at(i+add++) == ':') |
122 | if ( i+add < len && strRep_.at(i+add++) == 'V') | 124 | if ( i+add < len && strRep_.at(i+add++) == 'V') |
123 | if ( i+add < len && strRep_.at(i+add++) == 'C') | 125 | if ( i+add < len && strRep_.at(i+add++) == 'C') |
124 | if ( i+add < len && strRep_.at(i+add++) == 'A') | 126 | if ( i+add < len && strRep_.at(i+add++) == 'A') |
125 | if ( i+add < len && strRep_.at(i+add++) == 'R') | 127 | if ( i+add < len && strRep_.at(i+add++) == 'R') |
126 | if ( i+add < len && strRep_.at(i+add++) == 'D') | 128 | if ( i+add < len && strRep_.at(i+add++) == 'D') |
127 | if ( i+add < len && (strRep_.at(i+add) == '\r' || strRep_.at(i+add) == '\n' )) | 129 | if ( i+add < len && (strRep_.at(i+add) == '\r' || strRep_.at(i+add) == '\n' )) |
128 | break; | 130 | break; |
129 | } | 131 | } |
130 | ++i; | 132 | ++i; |
131 | } | 133 | } |
132 | if ( i <= len ) { | 134 | if ( i <= len ) { |
133 | ++num; | 135 | ++num; |
134 | char* dat = strRep_.data()+start; | 136 | char* dat = strRep_.data()+start; |
135 | VCard * v = new VCard( QCString ( dat,i-start ) ); | 137 | VCard * v = new VCard( Q3CString ( dat,i-start ) ); |
136 | start = i; | 138 | start = i; |
137 | cardList_.append(v); | 139 | cardList_.append(v); |
138 | v->parse(); | 140 | v->parse(); |
139 | } | 141 | } |
140 | i+= 11; | 142 | i+= 11; |
141 | } | 143 | } |
142 | #endif | 144 | #endif |
143 | //qDebug("***time %d found %d", tim.elapsed(), num); | 145 | //qDebug("***time %d found %d", tim.elapsed(), num); |
144 | } | 146 | } |
145 | 147 | ||
146 | void | 148 | void |
147 | VCardEntity::_assemble() | 149 | VCardEntity::_assemble() |
148 | { | 150 | { |
149 | VCardListIterator it(cardList_); | 151 | VCardListIterator it(cardList_); |
150 | 152 | ||
151 | for (; it.current(); ++it) | 153 | for (; it.current(); ++it) |
152 | strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck. | 154 | strRep_ += it.current()->asString() + "\r\n"; // One CRLF for luck. |
153 | } | 155 | } |
154 | 156 | ||
155 | VCardList & | 157 | VCardList & |
156 | VCardEntity::cardList() | 158 | VCardEntity::cardList() |
157 | { | 159 | { |
158 | parse(); | 160 | parse(); |
159 | return cardList_; | 161 | return cardList_; |
160 | } | 162 | } |
161 | 163 | ||
162 | void | 164 | void |
163 | VCardEntity::setCardList(const VCardList & l) | 165 | VCardEntity::setCardList(const VCardList & l) |
164 | { | 166 | { |
165 | parse(); | 167 | parse(); |
166 | //UScardList_ = l; | 168 | //UScardList_ = l; |
167 | VCardListIterator it(l); | 169 | VCardListIterator it(l); |
168 | 170 | ||
169 | for (; it.current(); ++it) { | 171 | for (; it.current(); ++it) { |
170 | VCard* v = new VCard(*it.current()); | 172 | VCard* v = new VCard(*it.current()); |
171 | cardList_.append(v); | 173 | cardList_.append(v); |
172 | } | 174 | } |
173 | 175 | ||
174 | } | 176 | } |
175 | 177 | ||
diff --git a/kabc/vcard/VCardv.cpp b/kabc/vcard/VCardv.cpp index bad2ef1..5dd675d 100644 --- a/kabc/vcard/VCardv.cpp +++ b/kabc/vcard/VCardv.cpp | |||
@@ -1,294 +1,295 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <qcstring.h> | 24 | #include <q3cstring.h> |
25 | #include <qstrlist.h> | 25 | #include <q3strlist.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qvaluelist.h> | 28 | #include <q3valuelist.h> |
29 | 29 | ||
30 | #include <VCardEntity.h> | 30 | #include <VCardEntity.h> |
31 | #include <VCardVCard.h> | 31 | #include <VCardVCard.h> |
32 | #include <VCardContentLine.h> | 32 | #include <VCardContentLine.h> |
33 | #include <VCardRToken.h> | 33 | #include <VCardRToken.h> |
34 | 34 | ||
35 | #include <VCardDefines.h> | 35 | #include <VCardDefines.h> |
36 | 36 | ||
37 | using namespace VCARD; | 37 | using namespace VCARD; |
38 | 38 | ||
39 | VCard::VCard() | 39 | VCard::VCard() |
40 | :Entity() | 40 | :Entity() |
41 | { | 41 | { |
42 | contentLineList_.setAutoDelete( TRUE ); | 42 | contentLineList_.setAutoDelete( TRUE ); |
43 | } | 43 | } |
44 | 44 | ||
45 | VCard::VCard(const VCard & x) | 45 | VCard::VCard(const VCard & x) |
46 | :Entity(x), | 46 | :Entity(x), |
47 | group_(x.group_) | 47 | group_(x.group_) |
48 | { | 48 | { |
49 | contentLineList_.setAutoDelete( TRUE ); | 49 | contentLineList_.setAutoDelete( TRUE ); |
50 | 50 | ||
51 | QPtrListIterator<ContentLine> it(x.contentLineList_); | 51 | Q3PtrListIterator<ContentLine> it(x.contentLineList_); |
52 | for (; it.current(); ++it) { | 52 | for (; it.current(); ++it) { |
53 | ContentLine * c = new ContentLine(*it.current()); | 53 | ContentLine * c = new ContentLine(*it.current()); |
54 | contentLineList_.append(c); | 54 | contentLineList_.append(c); |
55 | } | 55 | } |
56 | 56 | ||
57 | } | 57 | } |
58 | 58 | ||
59 | VCard::VCard(const QCString & s) | 59 | VCard::VCard(const Q3CString & s) |
60 | :Entity(s) | 60 | :Entity(s) |
61 | { | 61 | { |
62 | contentLineList_.setAutoDelete( TRUE ); | 62 | contentLineList_.setAutoDelete( TRUE ); |
63 | } | 63 | } |
64 | 64 | ||
65 | VCard & | 65 | VCard & |
66 | VCard::operator = (VCard & x) | 66 | VCard::operator = (VCard & x) |
67 | { | 67 | { |
68 | if (*this == x) return *this; | 68 | if (*this == x) return *this; |
69 | 69 | ||
70 | group_ = x.group(); | 70 | group_ = x.group(); |
71 | QPtrListIterator<ContentLine> it(x.contentLineList_); | 71 | Q3PtrListIterator<ContentLine> it(x.contentLineList_); |
72 | for (; it.current(); ++it) { | 72 | for (; it.current(); ++it) { |
73 | ContentLine * c = new ContentLine(*it.current()); | 73 | ContentLine * c = new ContentLine(*it.current()); |
74 | contentLineList_.append(c); | 74 | contentLineList_.append(c); |
75 | } | 75 | } |
76 | 76 | ||
77 | Entity::operator = (x); | 77 | Entity::operator = (x); |
78 | return *this; | 78 | return *this; |
79 | } | 79 | } |
80 | 80 | ||
81 | VCard & | 81 | VCard & |
82 | VCard::operator = (const QCString & s) | 82 | VCard::operator = (const Q3CString & s) |
83 | { | 83 | { |
84 | Entity::operator = (s); | 84 | Entity::operator = (s); |
85 | return *this; | 85 | return *this; |
86 | } | 86 | } |
87 | 87 | ||
88 | bool | 88 | bool |
89 | VCard::operator == (VCard & x) | 89 | VCard::operator == (VCard & x) |
90 | { | 90 | { |
91 | x.parse(); | 91 | x.parse(); |
92 | return false; | 92 | return false; |
93 | } | 93 | } |
94 | 94 | ||
95 | VCard::~VCard() | 95 | VCard::~VCard() |
96 | { | 96 | { |
97 | } | 97 | } |
98 | 98 | ||
99 | void | 99 | void |
100 | VCard::_parse() | 100 | VCard::_parse() |
101 | { | 101 | { |
102 | 102 | ||
103 | QStringList l; | 103 | QStringList l; |
104 | QStrList sl; | 104 | Q3StrList sl; |
105 | 105 | ||
106 | RTokenise(strRep_, "\r\n", sl); | 106 | RTokenise(strRep_, "\r\n", sl); |
107 | 107 | ||
108 | if (sl.count() < 3) { // Invalid VCARD ! | 108 | if (sl.count() < 3) { // Invalid VCARD ! |
109 | //qDebug("invalid vcard "); | 109 | //qDebug("invalid vcard "); |
110 | return; | 110 | return; |
111 | } | 111 | } |
112 | l = QStringList::fromStrList( sl ); | 112 | for(Q3StrList::iterator i=sl.begin();i!=sl.end();++i) |
113 | l.push_back(*i); | ||
113 | // Get the first line | 114 | // Get the first line |
114 | QString beginLine = l[0].stripWhiteSpace(); | 115 | QString beginLine = l[0].stripWhiteSpace(); |
115 | 116 | ||
116 | // Remove extra blank lines | 117 | // Remove extra blank lines |
117 | while (l.last().isEmpty()) | 118 | while (l.last().isEmpty()) |
118 | l.remove(l.last()); | 119 | l.remove(l.last()); |
119 | 120 | ||
120 | // Now we know this is the last line | 121 | // Now we know this is the last line |
121 | QString endLine = l.last(); | 122 | QString endLine = l.last(); |
122 | 123 | ||
123 | // Trash the first and last lines as we have seen them. | 124 | // Trash the first and last lines as we have seen them. |
124 | l.remove(l.begin()); | 125 | l.remove(l.begin()); |
125 | l.remove(l.last()); | 126 | l.remove(l.last()); |
126 | 127 | ||
127 | /////////////////////////////////////////////////////////////// | 128 | /////////////////////////////////////////////////////////////// |
128 | // FIRST LINE | 129 | // FIRST LINE |
129 | 130 | ||
130 | int split = beginLine.find(':'); | 131 | int split = beginLine.find(':'); |
131 | 132 | ||
132 | if (split == -1) { // invalid, no BEGIN | 133 | if (split == -1) { // invalid, no BEGIN |
133 | vDebug("No split"); | 134 | vDebug("No split"); |
134 | return; | 135 | return; |
135 | } | 136 | } |
136 | 137 | ||
137 | QString firstPart(beginLine.left(split)); | 138 | QString firstPart(beginLine.left(split)); |
138 | QString valuePart(beginLine.mid(split + 1)); | 139 | QString valuePart(beginLine.mid(split + 1)); |
139 | 140 | ||
140 | split = firstPart.find('.'); | 141 | split = firstPart.find('.'); |
141 | 142 | ||
142 | if (split != -1) { | 143 | if (split != -1) { |
143 | group_ = firstPart.left(split); | 144 | group_ = firstPart.left(split); |
144 | firstPart= firstPart.right(firstPart.length() - split - 1); | 145 | firstPart= firstPart.right(firstPart.length() - split - 1); |
145 | } | 146 | } |
146 | 147 | ||
147 | if (firstPart.left(5) != "BEGIN" ) { // No BEGIN ! | 148 | if (firstPart.left(5) != "BEGIN" ) { // No BEGIN ! |
148 | qDebug("no BEGIN in vcard "); | 149 | qDebug("no BEGIN in vcard "); |
149 | return; | 150 | return; |
150 | } | 151 | } |
151 | 152 | ||
152 | if (valuePart.left(5) != "VCARD") { // Not a vcard ! | 153 | if (valuePart.left(5) != "VCARD") { // Not a vcard ! |
153 | qDebug("not a VCARD "); | 154 | qDebug("not a VCARD "); |
154 | return; | 155 | return; |
155 | } | 156 | } |
156 | 157 | ||
157 | /////////////////////////////////////////////////////////////// | 158 | /////////////////////////////////////////////////////////////// |
158 | // CONTENT LINES | 159 | // CONTENT LINES |
159 | // | 160 | // |
160 | vDebug("Content lines"); | 161 | vDebug("Content lines"); |
161 | 162 | ||
162 | // Handle folded lines. | 163 | // Handle folded lines. |
163 | 164 | ||
164 | QStringList refolded; | 165 | QStringList refolded; |
165 | 166 | ||
166 | 167 | ||
167 | QStringList::Iterator it = l.begin(); | 168 | QStringList::Iterator it = l.begin(); |
168 | 169 | ||
169 | QString cur; | 170 | QString cur; |
170 | 171 | ||
171 | for (; it != l.end(); ++it) { | 172 | for (; it != l.end(); ++it) { |
172 | cur = (*it); | 173 | cur = (*it); |
173 | ++it; | 174 | ++it; |
174 | while ( it!= l.end() && (*it).at(0) == ' '&& (*it).length()!= 1) { | 175 | while ( it!= l.end() && (*it).at(0) == ' '&& (*it).length()!= 1) { |
175 | cur += (*it).mid(1) ; | 176 | cur += (*it).mid(1) ; |
176 | ++it; | 177 | ++it; |
177 | } | 178 | } |
178 | --it; | 179 | --it; |
179 | refolded.append(cur); | 180 | refolded.append(cur); |
180 | } | 181 | } |
181 | QStringList::Iterator it2 = refolded.begin(); | 182 | QStringList::Iterator it2 = refolded.begin(); |
182 | for (; it2 != refolded.end(); ++it2) { | 183 | for (; it2 != refolded.end(); ++it2) { |
183 | ContentLine * cl = new ContentLine(QCString((*it2).latin1())); | 184 | ContentLine * cl = new ContentLine(Q3CString((*it2).latin1())); |
184 | cl->parse(); | 185 | cl->parse(); |
185 | if (cl->value() == 0) | 186 | if (cl->value() == 0) |
186 | { | 187 | { |
187 | qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1()); | 188 | qDebug("Content line could not be parsed. Discarded: %s", (*it2).latin1()); |
188 | delete cl; | 189 | delete cl; |
189 | } | 190 | } |
190 | else | 191 | else |
191 | contentLineList_.append(cl); | 192 | contentLineList_.append(cl); |
192 | } | 193 | } |
193 | 194 | ||
194 | /////////////////////////////////////////////////////////////// | 195 | /////////////////////////////////////////////////////////////// |
195 | // LAST LINE | 196 | // LAST LINE |
196 | 197 | ||
197 | 198 | ||
198 | // LR: sorry, but the remaining code in this method makes no sense | 199 | // LR: sorry, but the remaining code in this method makes no sense |
199 | 200 | ||
200 | #if 0 | 201 | #if 0 |
201 | split = endLine.find(':'); | 202 | split = endLine.find(':'); |
202 | 203 | ||
203 | if (split == -1) // invalid, no END | 204 | if (split == -1) // invalid, no END |
204 | return; | 205 | return; |
205 | 206 | ||
206 | firstPart = endLine.left(split); | 207 | firstPart = endLine.left(split); |
207 | valuePart = endLine.right(firstPart.length() - split - 1); | 208 | valuePart = endLine.right(firstPart.length() - split - 1); |
208 | 209 | ||
209 | split = firstPart.find('.'); | 210 | split = firstPart.find('.'); |
210 | 211 | ||
211 | if (split != -1) { | 212 | if (split != -1) { |
212 | group_ = firstPart.left(split); | 213 | group_ = firstPart.left(split); |
213 | firstPart= firstPart.right(firstPart.length() - split - 1); | 214 | firstPart= firstPart.right(firstPart.length() - split - 1); |
214 | } | 215 | } |
215 | 216 | ||
216 | if (qstricmp(firstPart, "END") != 0) // No END ! | 217 | if (qstricmp(firstPart, "END") != 0) // No END ! |
217 | return; | 218 | return; |
218 | 219 | ||
219 | if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! | 220 | if (qstricmp(valuePart, "VCARD") != 0) // Not a vcard ! |
220 | return; | 221 | return; |
221 | #endif | 222 | #endif |
222 | } | 223 | } |
223 | 224 | ||
224 | void | 225 | void |
225 | VCard::_assemble() | 226 | VCard::_assemble() |
226 | { | 227 | { |
227 | vDebug("Assembling vcard"); | 228 | vDebug("Assembling vcard"); |
228 | strRep_ = "BEGIN:VCARD\r\n"; | 229 | strRep_ = "BEGIN:VCARD\r\n"; |
229 | strRep_ += "VERSION:3.0\r\n"; | 230 | strRep_ += "VERSION:3.0\r\n"; |
230 | 231 | ||
231 | QPtrListIterator<ContentLine> it(contentLineList_); | 232 | Q3PtrListIterator<ContentLine> it(contentLineList_); |
232 | 233 | ||
233 | for (; it.current(); ++it) | 234 | for (; it.current(); ++it) |
234 | strRep_ += it.current()->asString() + "\r\n"; | 235 | strRep_ += it.current()->asString() + "\r\n"; |
235 | 236 | ||
236 | strRep_ += "END:VCARD\r\n"; | 237 | strRep_ += "END:VCARD\r\n"; |
237 | } | 238 | } |
238 | 239 | ||
239 | bool | 240 | bool |
240 | VCard::has(EntityType t) | 241 | VCard::has(EntityType t) |
241 | { | 242 | { |
242 | parse(); | 243 | parse(); |
243 | return contentLine(t) == 0 ? false : true; | 244 | return contentLine(t) == 0 ? false : true; |
244 | } | 245 | } |
245 | 246 | ||
246 | bool | 247 | bool |
247 | VCard::has(const QCString & s) | 248 | VCard::has(const Q3CString & s) |
248 | { | 249 | { |
249 | parse(); | 250 | parse(); |
250 | return contentLine(s) == 0 ? false : true; | 251 | return contentLine(s) == 0 ? false : true; |
251 | } | 252 | } |
252 | 253 | ||
253 | void | 254 | void |
254 | VCard::add(const ContentLine & cl) | 255 | VCard::add(const ContentLine & cl) |
255 | { | 256 | { |
256 | parse(); | 257 | parse(); |
257 | ContentLine * c = new ContentLine(cl); | 258 | ContentLine * c = new ContentLine(cl); |
258 | contentLineList_.append(c); | 259 | contentLineList_.append(c); |
259 | } | 260 | } |
260 | 261 | ||
261 | void | 262 | void |
262 | VCard::add(const QCString & s) | 263 | VCard::add(const Q3CString & s) |
263 | { | 264 | { |
264 | parse(); | 265 | parse(); |
265 | ContentLine * c = new ContentLine(s); | 266 | ContentLine * c = new ContentLine(s); |
266 | contentLineList_.append(c); | 267 | contentLineList_.append(c); |
267 | } | 268 | } |
268 | 269 | ||
269 | ContentLine * | 270 | ContentLine * |
270 | VCard::contentLine(EntityType t) | 271 | VCard::contentLine(EntityType t) |
271 | { | 272 | { |
272 | parse(); | 273 | parse(); |
273 | QPtrListIterator<ContentLine> it(contentLineList_); | 274 | Q3PtrListIterator<ContentLine> it(contentLineList_); |
274 | 275 | ||
275 | for (; it.current(); ++it) | 276 | for (; it.current(); ++it) |
276 | if (it.current()->entityType() == t) | 277 | if (it.current()->entityType() == t) |
277 | return it.current(); | 278 | return it.current(); |
278 | 279 | ||
279 | return 0; | 280 | return 0; |
280 | } | 281 | } |
281 | 282 | ||
282 | ContentLine * | 283 | ContentLine * |
283 | VCard::contentLine(const QCString & s) | 284 | VCard::contentLine(const Q3CString & s) |
284 | { | 285 | { |
285 | parse(); | 286 | parse(); |
286 | QPtrListIterator<ContentLine> it(contentLineList_); | 287 | Q3PtrListIterator<ContentLine> it(contentLineList_); |
287 | 288 | ||
288 | for (; it.current(); ++it) | 289 | for (; it.current(); ++it) |
289 | if (it.current()->entityType() == EntityNameToEntityType(s)) | 290 | if (it.current()->entityType() == EntityNameToEntityType(s)) |
290 | return it.current(); | 291 | return it.current(); |
291 | 292 | ||
292 | return 0; | 293 | return 0; |
293 | } | 294 | } |
294 | 295 | ||
diff --git a/kabc/vcard/Value.cpp b/kabc/vcard/Value.cpp index 1978af2..3a4d406 100644 --- a/kabc/vcard/Value.cpp +++ b/kabc/vcard/Value.cpp | |||
@@ -1,82 +1,84 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #include <VCardEntity.h> | 24 | #include <VCardEntity.h> |
25 | #include <VCardValue.h> | 25 | #include <VCardValue.h> |
26 | //Added by qt3to4: | ||
27 | #include <Q3CString> | ||
26 | 28 | ||
27 | using namespace VCARD; | 29 | using namespace VCARD; |
28 | 30 | ||
29 | Value::Value() | 31 | Value::Value() |
30 | :Entity() | 32 | :Entity() |
31 | { | 33 | { |
32 | } | 34 | } |
33 | 35 | ||
34 | Value::Value(const Value & x) | 36 | Value::Value(const Value & x) |
35 | :Entity(x) | 37 | :Entity(x) |
36 | { | 38 | { |
37 | } | 39 | } |
38 | 40 | ||
39 | Value::Value(const QCString & s) | 41 | Value::Value(const Q3CString & s) |
40 | :Entity(s) | 42 | :Entity(s) |
41 | { | 43 | { |
42 | } | 44 | } |
43 | 45 | ||
44 | Value & | 46 | Value & |
45 | Value::operator = (Value & x) | 47 | Value::operator = (Value & x) |
46 | { | 48 | { |
47 | if (*this == x) return *this; | 49 | if (*this == x) return *this; |
48 | 50 | ||
49 | Entity::operator = (x); | 51 | Entity::operator = (x); |
50 | return *this; | 52 | return *this; |
51 | } | 53 | } |
52 | 54 | ||
53 | Value & | 55 | Value & |
54 | Value::operator = (const QCString & s) | 56 | Value::operator = (const Q3CString & s) |
55 | { | 57 | { |
56 | Entity::operator = (s); | 58 | Entity::operator = (s); |
57 | return *this; | 59 | return *this; |
58 | } | 60 | } |
59 | 61 | ||
60 | bool | 62 | bool |
61 | Value::operator == (Value & x) | 63 | Value::operator == (Value & x) |
62 | { | 64 | { |
63 | x.parse(); | 65 | x.parse(); |
64 | return false; | 66 | return false; |
65 | } | 67 | } |
66 | 68 | ||
67 | Value::~Value() | 69 | Value::~Value() |
68 | { | 70 | { |
69 | } | 71 | } |
70 | 72 | ||
71 | void | 73 | void |
72 | Value::_parse() | 74 | Value::_parse() |
73 | { | 75 | { |
74 | } | 76 | } |
75 | 77 | ||
76 | void | 78 | void |
77 | Value::_assemble() | 79 | Value::_assemble() |
78 | { | 80 | { |
79 | //USvDebug("Value::_assemble()"); | 81 | //USvDebug("Value::_assemble()"); |
80 | qDebug("Value::_assemble()"); | 82 | qDebug("Value::_assemble()"); |
81 | } | 83 | } |
82 | 84 | ||
diff --git a/kabc/vcard/include/VCardAdrParam.h b/kabc/vcard/include/VCardAdrParam.h index 89dcb64..6456624 100644 --- a/kabc/vcard/include/VCardAdrParam.h +++ b/kabc/vcard/include/VCardAdrParam.h | |||
@@ -1,64 +1,64 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ADRPARAM_H | 24 | #ifndef ADRPARAM_H |
25 | #define ADRPARAM_H | 25 | #define ADRPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | #include <qstrlist.h> | 28 | #include <q3strlist.h> |
29 | 29 | ||
30 | #include <VCardParam.h> | 30 | #include <VCardParam.h> |
31 | 31 | ||
32 | namespace VCARD | 32 | namespace VCARD |
33 | { | 33 | { |
34 | 34 | ||
35 | class AdrParam : public Param | 35 | class AdrParam : public Param |
36 | { | 36 | { |
37 | 37 | ||
38 | #include "AdrParam-generated.h" | 38 | #include "AdrParam-generated.h" |
39 | 39 | ||
40 | QStrList adrTypeList() | 40 | Q3StrList adrTypeList() |
41 | { parse(); return adrTypeList_; } | 41 | { parse(); return adrTypeList_; } |
42 | 42 | ||
43 | QCString textParam() | 43 | Q3CString textParam() |
44 | { parse(); return textParam_; } | 44 | { parse(); return textParam_; } |
45 | 45 | ||
46 | void setAdrTypeList(const QStrList & l) | 46 | void setAdrTypeList(const Q3StrList & l) |
47 | { adrTypeList_ = l; assembled_ = false; } | 47 | { adrTypeList_ = l; assembled_ = false; } |
48 | 48 | ||
49 | void setTextParam(const QCString & s) | 49 | void setTextParam(const Q3CString & s) |
50 | { textParam_ = s; assembled_ = false; } | 50 | { textParam_ = s; assembled_ = false; } |
51 | 51 | ||
52 | enum AdrType { | 52 | enum AdrType { |
53 | AdrDom, AdrIntl, AdrPostal, AdrParcel, AdrHome, AdrWork, AdrPref, | 53 | AdrDom, AdrIntl, AdrPostal, AdrParcel, AdrHome, AdrWork, AdrPref, |
54 | AdrIANA, AdrX | 54 | AdrIANA, AdrX |
55 | }; | 55 | }; |
56 | 56 | ||
57 | private: | 57 | private: |
58 | 58 | ||
59 | QStrListadrTypeList_; | 59 | Q3StrListadrTypeList_; |
60 | QCStringtextParam_; | 60 | Q3CStringtextParam_; |
61 | }; | 61 | }; |
62 | } | 62 | } |
63 | 63 | ||
64 | #endif | 64 | #endif |
diff --git a/kabc/vcard/include/VCardAdrValue.h b/kabc/vcard/include/VCardAdrValue.h index 0731924..14ddb02 100644 --- a/kabc/vcard/include/VCardAdrValue.h +++ b/kabc/vcard/include/VCardAdrValue.h | |||
@@ -1,83 +1,85 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ADRVALUE_H | 24 | #ifndef ADRVALUE_H |
25 | #define ADRVALUE_H | 25 | #define ADRVALUE_H |
26 | 26 | ||
27 | #include <qstrlist.h> | 27 | #include <q3strlist.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3CString> | ||
28 | #include <VCardValue.h> | 30 | #include <VCardValue.h> |
29 | 31 | ||
30 | namespace VCARD | 32 | namespace VCARD |
31 | { | 33 | { |
32 | 34 | ||
33 | class AdrValue : public Value | 35 | class AdrValue : public Value |
34 | { | 36 | { |
35 | 37 | ||
36 | #include "AdrValue-generated.h" | 38 | #include "AdrValue-generated.h" |
37 | 39 | ||
38 | AdrValue *clone(); | 40 | AdrValue *clone(); |
39 | 41 | ||
40 | void setPOBox(const QCString & s) | 42 | void setPOBox(const Q3CString & s) |
41 | { poBox_ = s; assembled_ = false; } | 43 | { poBox_ = s; assembled_ = false; } |
42 | 44 | ||
43 | void setExtAddress(const QCString & s) | 45 | void setExtAddress(const Q3CString & s) |
44 | { extAddress_ = s; assembled_ = false; } | 46 | { extAddress_ = s; assembled_ = false; } |
45 | 47 | ||
46 | void setStreet(const QCString & s) | 48 | void setStreet(const Q3CString & s) |
47 | { street_ = s; assembled_ = false; } | 49 | { street_ = s; assembled_ = false; } |
48 | 50 | ||
49 | void setLocality(const QCString & s) | 51 | void setLocality(const Q3CString & s) |
50 | { locality_ = s; assembled_ = false; } | 52 | { locality_ = s; assembled_ = false; } |
51 | 53 | ||
52 | void setRegion(const QCString & s) | 54 | void setRegion(const Q3CString & s) |
53 | { region_ = s; assembled_ = false; } | 55 | { region_ = s; assembled_ = false; } |
54 | 56 | ||
55 | void setPostCode(const QCString & s) | 57 | void setPostCode(const Q3CString & s) |
56 | { postCode_ = s; assembled_ = false; } | 58 | { postCode_ = s; assembled_ = false; } |
57 | 59 | ||
58 | void setCountryName(const QCString & s) | 60 | void setCountryName(const Q3CString & s) |
59 | { countryName_ = s; assembled_ = false; } | 61 | { countryName_ = s; assembled_ = false; } |
60 | 62 | ||
61 | QCString poBox() { parse(); return poBox_;} | 63 | Q3CString poBox() { parse(); return poBox_;} |
62 | QCString extAddress() { parse(); return extAddress_;} | 64 | Q3CString extAddress() { parse(); return extAddress_;} |
63 | QCString street() { parse(); return street_;} | 65 | Q3CString street() { parse(); return street_;} |
64 | QCString locality() { parse(); return locality_;} | 66 | Q3CString locality() { parse(); return locality_;} |
65 | QCString region() { parse(); return region_;} | 67 | Q3CString region() { parse(); return region_;} |
66 | QCString postCode() { parse(); return postCode_;} | 68 | Q3CString postCode() { parse(); return postCode_;} |
67 | QCString countryName() { parse(); return countryName_;} | 69 | Q3CString countryName() { parse(); return countryName_;} |
68 | 70 | ||
69 | private: | 71 | private: |
70 | 72 | ||
71 | QCString poBox_; | 73 | Q3CString poBox_; |
72 | QCString extAddress_; | 74 | Q3CString extAddress_; |
73 | QCString street_; | 75 | Q3CString street_; |
74 | QCString locality_; | 76 | Q3CString locality_; |
75 | QCString region_; | 77 | Q3CString region_; |
76 | QCString postCode_; | 78 | Q3CString postCode_; |
77 | QCString countryName_; | 79 | Q3CString countryName_; |
78 | }; | 80 | }; |
79 | 81 | ||
80 | } | 82 | } |
81 | 83 | ||
82 | #endif | 84 | #endif |
83 | 85 | ||
diff --git a/kabc/vcard/include/VCardAgentParam.h b/kabc/vcard/include/VCardAgentParam.h index 72a05db..5733540 100644 --- a/kabc/vcard/include/VCardAgentParam.h +++ b/kabc/vcard/include/VCardAgentParam.h | |||
@@ -1,60 +1,60 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef AGENTPARAM_H | 24 | #ifndef AGENTPARAM_H |
25 | #define AGENTPARAM_H | 25 | #define AGENTPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardParam.h> | 29 | #include <VCardParam.h> |
30 | #include <VCardURIValue.h> | 30 | #include <VCardURIValue.h> |
31 | 31 | ||
32 | namespace VCARD | 32 | namespace VCARD |
33 | { | 33 | { |
34 | 34 | ||
35 | class AgentParam : public Param | 35 | class AgentParam : public Param |
36 | { | 36 | { |
37 | 37 | ||
38 | #include "AgentParam-generated.h" | 38 | #include "AgentParam-generated.h" |
39 | 39 | ||
40 | bool refer() | 40 | bool refer() |
41 | { parse(); return refer_; } | 41 | { parse(); return refer_; } |
42 | 42 | ||
43 | URIValue uri() | 43 | URIValue uri() |
44 | { parse(); return uri_; } | 44 | { parse(); return uri_; } |
45 | 45 | ||
46 | void setRefer(bool b) | 46 | void setRefer(bool b) |
47 | { refer_ = b; assembled_ = false; } | 47 | { refer_ = b; assembled_ = false; } |
48 | 48 | ||
49 | void setURI(const QCString & s) | 49 | void setURI(const Q3CString & s) |
50 | { uri_ = s; assembled_ = false; } | 50 | { uri_ = s; assembled_ = false; } |
51 | 51 | ||
52 | private: | 52 | private: |
53 | 53 | ||
54 | bool refer_; | 54 | bool refer_; |
55 | URIValueuri_; | 55 | URIValueuri_; |
56 | }; | 56 | }; |
57 | 57 | ||
58 | } | 58 | } |
59 | 59 | ||
60 | #endif | 60 | #endif |
diff --git a/kabc/vcard/include/VCardAgentValue.h b/kabc/vcard/include/VCardAgentValue.h index f655836..b0d883b 100644 --- a/kabc/vcard/include/VCardAgentValue.h +++ b/kabc/vcard/include/VCardAgentValue.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef AGENTVALUE_H | 24 | #ifndef AGENTVALUE_H |
25 | #define AGENTVALUE_H | 25 | #define AGENTVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardValue.h> | 29 | #include <VCardValue.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class AgentValue : public Value | 34 | class AgentValue : public Value |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "AgentValue-generated.h" | 37 | #include "AgentValue-generated.h" |
38 | 38 | ||
39 | private: | 39 | private: |
40 | }; | 40 | }; |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/kabc/vcard/include/VCardClassValue.h b/kabc/vcard/include/VCardClassValue.h index ff133c2..c450169 100644 --- a/kabc/vcard/include/VCardClassValue.h +++ b/kabc/vcard/include/VCardClassValue.h | |||
@@ -1,56 +1,56 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef CLASSVALUE_H | 24 | #ifndef CLASSVALUE_H |
25 | #define CLASSVALUE_H | 25 | #define CLASSVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardValue.h> | 29 | #include <VCardValue.h> |
30 | 30 | ||
31 | #include <kdebug.h> | 31 | #include <kdebug.h> |
32 | 32 | ||
33 | namespace VCARD | 33 | namespace VCARD |
34 | { | 34 | { |
35 | 35 | ||
36 | class ClassValue : public Value | 36 | class ClassValue : public Value |
37 | { | 37 | { |
38 | 38 | ||
39 | #include "ClassValue-generated.h" | 39 | #include "ClassValue-generated.h" |
40 | 40 | ||
41 | enum ClassType { | 41 | enum ClassType { |
42 | Public, Private, Confidential, Other | 42 | Public, Private, Confidential, Other |
43 | }; | 43 | }; |
44 | 44 | ||
45 | ClassValue *clone(); | 45 | ClassValue *clone(); |
46 | 46 | ||
47 | void setType( int type ) { classType_ = type; assembled_ = false; parsed_ = true; } | 47 | void setType( int type ) { classType_ = type; assembled_ = false; parsed_ = true; } |
48 | int type() { parse(); return classType_; } | 48 | int type() { parse(); return classType_; } |
49 | 49 | ||
50 | private: | 50 | private: |
51 | int classType_; | 51 | int classType_; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ||
56 | #endif | 56 | #endif |
diff --git a/kabc/vcard/include/VCardContentLine.h b/kabc/vcard/include/VCardContentLine.h index 1c5f5be..c3c5253 100644 --- a/kabc/vcard/include/VCardContentLine.h +++ b/kabc/vcard/include/VCardContentLine.h | |||
@@ -1,77 +1,79 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef CONTENTLINE_H | 24 | #ifndef CONTENTLINE_H |
25 | #define CONTENTLINE_H | 25 | #define CONTENTLINE_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <q3ptrlist.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3CString> | ||
28 | 30 | ||
29 | #include "VCardEnum.h" | 31 | #include "VCardEnum.h" |
30 | #include "VCardEntity.h" | 32 | #include "VCardEntity.h" |
31 | #include "VCardParam.h" | 33 | #include "VCardParam.h" |
32 | #include "VCardValue.h" | 34 | #include "VCardValue.h" |
33 | 35 | ||
34 | namespace VCARD | 36 | namespace VCARD |
35 | { | 37 | { |
36 | 38 | ||
37 | class ContentLine : public Entity | 39 | class ContentLine : public Entity |
38 | { | 40 | { |
39 | 41 | ||
40 | #include "ContentLine-generated.h" | 42 | #include "ContentLine-generated.h" |
41 | 43 | ||
42 | QCString group() { parse(); return group_;} | 44 | Q3CString group() { parse(); return group_;} |
43 | QCString name() { parse(); return name_;} | 45 | Q3CString name() { parse(); return name_;} |
44 | Value * value() { parse(); return value_;} | 46 | Value * value() { parse(); return value_;} |
45 | ParamList paramList() { parse(); return paramList_;} | 47 | ParamList paramList() { parse(); return paramList_;} |
46 | ParamType paramType() { parse(); return paramType_;} | 48 | ParamType paramType() { parse(); return paramType_;} |
47 | ValueType valueType() { parse(); return valueType_;} | 49 | ValueType valueType() { parse(); return valueType_;} |
48 | EntityType entityType() { parse(); return entityType_;} | 50 | EntityType entityType() { parse(); return entityType_;} |
49 | 51 | ||
50 | void setGroup (const QCString & s) | 52 | void setGroup (const Q3CString & s) |
51 | { group_ = s; assembled_ = false; } | 53 | { group_ = s; assembled_ = false; } |
52 | 54 | ||
53 | void setName (const QCString & s) | 55 | void setName (const Q3CString & s) |
54 | { name_ = s; assembled_ = false; } | 56 | { name_ = s; assembled_ = false; } |
55 | 57 | ||
56 | void setValue (Value *s) | 58 | void setValue (Value *s) |
57 | { value_ = s; assembled_ = false; } | 59 | { value_ = s; assembled_ = false; } |
58 | 60 | ||
59 | void setParamList(const ParamList & l) | 61 | void setParamList(const ParamList & l) |
60 | { paramList_ = l; assembled_ = false; } | 62 | { paramList_ = l; assembled_ = false; } |
61 | 63 | ||
62 | void clear (); | 64 | void clear (); |
63 | 65 | ||
64 | private: | 66 | private: |
65 | 67 | ||
66 | QCString group_; | 68 | Q3CString group_; |
67 | QCString name_; | 69 | Q3CString name_; |
68 | QPtrList<Param> paramList_; | 70 | Q3PtrList<Param> paramList_; |
69 | Value * value_; | 71 | Value * value_; |
70 | 72 | ||
71 | ParamType paramType_; | 73 | ParamType paramType_; |
72 | ValueType valueType_; | 74 | ValueType valueType_; |
73 | EntityType entityType_; | 75 | EntityType entityType_; |
74 | }; | 76 | }; |
75 | } | 77 | } |
76 | 78 | ||
77 | #endif | 79 | #endif |
diff --git a/kabc/vcard/include/VCardDateParam.h b/kabc/vcard/include/VCardDateParam.h index 21ac1f1..959b75b 100644 --- a/kabc/vcard/include/VCardDateParam.h +++ b/kabc/vcard/include/VCardDateParam.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef DATEPARAM_H | 24 | #ifndef DATEPARAM_H |
25 | #define DATEPARAM_H | 25 | #define DATEPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardParam.h> | 29 | #include <VCardParam.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class DateParam : public Param | 34 | class DateParam : public Param |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "DateParam-generated.h" | 37 | #include "DateParam-generated.h" |
38 | 38 | ||
39 | private: | 39 | private: |
40 | }; | 40 | }; |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/kabc/vcard/include/VCardDateValue.h b/kabc/vcard/include/VCardDateValue.h index c248966..fc216c0 100644 --- a/kabc/vcard/include/VCardDateValue.h +++ b/kabc/vcard/include/VCardDateValue.h | |||
@@ -1,99 +1,99 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef DATEVALUE_H | 24 | #ifndef DATEVALUE_H |
25 | #define DATEVALUE_H | 25 | #define DATEVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | #include <qdatetime.h> | 28 | #include <qdatetime.h> |
29 | 29 | ||
30 | #include <VCardValue.h> | 30 | #include <VCardValue.h> |
31 | 31 | ||
32 | namespace VCARD | 32 | namespace VCARD |
33 | { | 33 | { |
34 | 34 | ||
35 | class DateValue : public Value | 35 | class DateValue : public Value |
36 | { | 36 | { |
37 | #include "DateValue-generated.h" | 37 | #include "DateValue-generated.h" |
38 | 38 | ||
39 | DateValue( | 39 | DateValue( |
40 | unsigned intyear, | 40 | unsigned intyear, |
41 | unsigned intmonth, | 41 | unsigned intmonth, |
42 | unsigned intday, | 42 | unsigned intday, |
43 | unsigned inthour = 0, | 43 | unsigned inthour = 0, |
44 | unsigned intminute = 0, | 44 | unsigned intminute = 0, |
45 | unsigned intsecond = 0, | 45 | unsigned intsecond = 0, |
46 | double secFrac = 0, | 46 | double secFrac = 0, |
47 | bool zonePositive = true, | 47 | bool zonePositive = true, |
48 | unsigned intzoneHour = 0, | 48 | unsigned intzoneHour = 0, |
49 | unsigned intzoneMinute = 0); | 49 | unsigned intzoneMinute = 0); |
50 | 50 | ||
51 | DateValue(const QDate &); | 51 | DateValue(const QDate &); |
52 | DateValue(const QDateTime &); | 52 | DateValue(const QDateTime &); |
53 | 53 | ||
54 | DateValue *clone(); | 54 | DateValue *clone(); |
55 | 55 | ||
56 | bool hasTime(); | 56 | bool hasTime(); |
57 | 57 | ||
58 | unsigned intyear(); | 58 | unsigned intyear(); |
59 | unsigned intmonth(); | 59 | unsigned intmonth(); |
60 | unsigned intday(); | 60 | unsigned intday(); |
61 | unsigned inthour(); | 61 | unsigned inthour(); |
62 | unsigned intminute(); | 62 | unsigned intminute(); |
63 | unsigned intsecond(); | 63 | unsigned intsecond(); |
64 | double secondFraction(); | 64 | double secondFraction(); |
65 | bool zonePositive(); | 65 | bool zonePositive(); |
66 | unsigned intzoneHour(); | 66 | unsigned intzoneHour(); |
67 | unsigned intzoneMinute(); | 67 | unsigned intzoneMinute(); |
68 | 68 | ||
69 | void setYear (unsigned int); | 69 | void setYear (unsigned int); |
70 | void setMonth (unsigned int); | 70 | void setMonth (unsigned int); |
71 | void setDay (unsigned int); | 71 | void setDay (unsigned int); |
72 | void setHour (unsigned int); | 72 | void setHour (unsigned int); |
73 | void setMinute (unsigned int); | 73 | void setMinute (unsigned int); |
74 | void setSecond (unsigned int); | 74 | void setSecond (unsigned int); |
75 | void setSecondFraction(double); | 75 | void setSecondFraction(double); |
76 | void setZonePositive(bool); | 76 | void setZonePositive(bool); |
77 | void setZoneHour (unsigned int); | 77 | void setZoneHour (unsigned int); |
78 | void setZoneMinute (unsigned int); | 78 | void setZoneMinute (unsigned int); |
79 | 79 | ||
80 | QDate qdate(); | 80 | QDate qdate(); |
81 | QTime qtime(); | 81 | QTime qtime(); |
82 | QDateTime qdt(); | 82 | QDateTime qdt(); |
83 | 83 | ||
84 | private: | 84 | private: |
85 | 85 | ||
86 | unsigned intyear_, month_, day_, | 86 | unsigned intyear_, month_, day_, |
87 | hour_, minute_, second_, | 87 | hour_, minute_, second_, |
88 | zoneHour_, zoneMinute_; | 88 | zoneHour_, zoneMinute_; |
89 | 89 | ||
90 | double secFrac_; | 90 | double secFrac_; |
91 | 91 | ||
92 | bool zonePositive_; | 92 | bool zonePositive_; |
93 | 93 | ||
94 | bool hasTime_; | 94 | bool hasTime_; |
95 | }; | 95 | }; |
96 | 96 | ||
97 | } | 97 | } |
98 | 98 | ||
99 | #endif | 99 | #endif |
diff --git a/kabc/vcard/include/VCardDefines.h b/kabc/vcard/include/VCardDefines.h index 557410f..5d4f2f4 100644 --- a/kabc/vcard/include/VCardDefines.h +++ b/kabc/vcard/include/VCardDefines.h | |||
@@ -1,53 +1,53 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1998 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1998 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef VCARD_DEFINES_H | 24 | #ifndef VCARD_DEFINES_H |
25 | #define VCARD_DEFINES_H | 25 | #define VCARD_DEFINES_H |
26 | 26 | ||
27 | #include <kdebug.h> | 27 | #include <kdebug.h> |
28 | 28 | ||
29 | #ifdef VCARD_DEBUG | 29 | #ifdef VCARD_DEBUG |
30 | //US #define vDebug(a) kdDebug(5710) << a << endl; | 30 | //US #define vDebug(a) kdDebug(5710) << a << endl; |
31 | #define vDebug(a) qDebug(a); | 31 | #define vDebug(a) qDebug(a); |
32 | #else | 32 | #else |
33 | #define vDebug(a) | 33 | #define vDebug(a) |
34 | #endif | 34 | #endif |
35 | 35 | ||
36 | #if 0 | 36 | #if 0 |
37 | #ifndef NDEBUG | 37 | #ifndef NDEBUG |
38 | #include <qcstring.h> | 38 | #include <q3cstring.h> |
39 | #include <iostream> | 39 | #include <iostream> |
40 | #ifdef __GNUG__ | 40 | #ifdef __GNUG__ |
41 | # define vDebug(a) cerr << className() << ":" << __FUNCTION__ << " (" \ | 41 | # define vDebug(a) cerr << className() << ":" << __FUNCTION__ << " (" \ |
42 | << __LINE__ << "): " << QCString((a)).data() << endl; | 42 | << __LINE__ << "): " << Q3CString((a)).data() << endl; |
43 | #else | 43 | #else |
44 | # define vDebug(a) cerr << className() << ": " \ | 44 | # define vDebug(a) cerr << className() << ": " \ |
45 | << QCString((a)).data() << endl; | 45 | << Q3CString((a)).data() << endl; |
46 | #endif | 46 | #endif |
47 | #else | 47 | #else |
48 | #define vDebug(a) | 48 | #define vDebug(a) |
49 | #endif | 49 | #endif |
50 | #endif | 50 | #endif |
51 | 51 | ||
52 | #endif // Included this file | 52 | #endif // Included this file |
53 | 53 | ||
diff --git a/kabc/vcard/include/VCardEmailParam.h b/kabc/vcard/include/VCardEmailParam.h index 98d1b30..ff07324 100644 --- a/kabc/vcard/include/VCardEmailParam.h +++ b/kabc/vcard/include/VCardEmailParam.h | |||
@@ -1,56 +1,56 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef EMAILPARAM_H | 24 | #ifndef EMAILPARAM_H |
25 | #define EMAILPARAM_H | 25 | #define EMAILPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardParam.h> | 29 | #include <VCardParam.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class EmailParam : public Param | 34 | class EmailParam : public Param |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "EmailParam-generated.h" | 37 | #include "EmailParam-generated.h" |
38 | 38 | ||
39 | QCString emailType() { parse(); return emailType_;} | 39 | Q3CString emailType() { parse(); return emailType_;} |
40 | bool pref() { parse(); return pref_; } | 40 | bool pref() { parse(); return pref_; } |
41 | 41 | ||
42 | void setEmailType(const QCString & s) | 42 | void setEmailType(const Q3CString & s) |
43 | { emailType_ = s; assembled_ = false; } | 43 | { emailType_ = s; assembled_ = false; } |
44 | 44 | ||
45 | void setPref(bool b) | 45 | void setPref(bool b) |
46 | { pref_ = b; assembled_ = false; } | 46 | { pref_ = b; assembled_ = false; } |
47 | 47 | ||
48 | private: | 48 | private: |
49 | 49 | ||
50 | QCStringemailType_; | 50 | Q3CStringemailType_; |
51 | bool pref_; | 51 | bool pref_; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ||
56 | #endif | 56 | #endif |
diff --git a/kabc/vcard/include/VCardEntity.h b/kabc/vcard/include/VCardEntity.h index 3c945b5..1a3d20f 100644 --- a/kabc/vcard/include/VCardEntity.h +++ b/kabc/vcard/include/VCardEntity.h | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ENTITY_H | 24 | #ifndef ENTITY_H |
25 | #define ENTITY_H | 25 | #define ENTITY_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | namespace VCARD | 29 | namespace VCARD |
30 | { | 30 | { |
31 | 31 | ||
32 | class Entity | 32 | class Entity |
33 | { | 33 | { |
34 | public: | 34 | public: |
35 | 35 | ||
36 | Entity(); | 36 | Entity(); |
37 | Entity(const Entity & e); | 37 | Entity(const Entity & e); |
38 | Entity(const QCString & s); | 38 | Entity(const Q3CString & s); |
39 | 39 | ||
40 | virtual Entity & operator = (const Entity & e); | 40 | virtual Entity & operator = (const Entity & e); |
41 | virtual Entity & operator = (const QCString & s); | 41 | virtual Entity & operator = (const Q3CString & s); |
42 | 42 | ||
43 | virtual bool operator == (Entity & e); | 43 | virtual bool operator == (Entity & e); |
44 | virtual bool operator != (Entity & e); | 44 | virtual bool operator != (Entity & e); |
45 | virtual bool operator == (const QCString & s); | 45 | virtual bool operator == (const Q3CString & s); |
46 | virtual bool operator != (const QCString & s); | 46 | virtual bool operator != (const Q3CString & s); |
47 | 47 | ||
48 | virtual ~Entity(); | 48 | virtual ~Entity(); |
49 | 49 | ||
50 | QCString asString(); | 50 | Q3CString asString(); |
51 | 51 | ||
52 | virtual void parse(); | 52 | virtual void parse(); |
53 | virtual void assemble(); | 53 | virtual void assemble(); |
54 | 54 | ||
55 | virtual void _parse() = 0; | 55 | virtual void _parse() = 0; |
56 | virtual void _assemble() = 0; | 56 | virtual void _assemble() = 0; |
57 | 57 | ||
58 | protected: | 58 | protected: |
59 | 59 | ||
60 | QCString strRep_; | 60 | Q3CString strRep_; |
61 | bool parsed_; | 61 | bool parsed_; |
62 | bool assembled_; | 62 | bool assembled_; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | #endif | 67 | #endif |
diff --git a/kabc/vcard/include/VCardEnum.h b/kabc/vcard/include/VCardEnum.h index b4e4094..0c35e5e 100644 --- a/kabc/vcard/include/VCardEnum.h +++ b/kabc/vcard/include/VCardEnum.h | |||
@@ -1,120 +1,120 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ENUM_H | 24 | #ifndef ENUM_H |
25 | #define ENUM_H | 25 | #define ENUM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | namespace VCARD | 29 | namespace VCARD |
30 | { | 30 | { |
31 | 31 | ||
32 | extern const QCString paramNames []; | 32 | extern const Q3CString paramNames []; |
33 | 33 | ||
34 | enum EntityType { | 34 | enum EntityType { |
35 | EntityName, | 35 | EntityName, |
36 | EntityProfile, | 36 | EntityProfile, |
37 | EntitySource, | 37 | EntitySource, |
38 | EntityFullName, | 38 | EntityFullName, |
39 | EntityN, | 39 | EntityN, |
40 | EntityNickname, | 40 | EntityNickname, |
41 | EntityPhoto, | 41 | EntityPhoto, |
42 | EntityBirthday, | 42 | EntityBirthday, |
43 | EntityAddress, | 43 | EntityAddress, |
44 | EntityLabel, | 44 | EntityLabel, |
45 | EntityTelephone, | 45 | EntityTelephone, |
46 | EntityEmail, | 46 | EntityEmail, |
47 | EntityMailer, | 47 | EntityMailer, |
48 | EntityTimeZone, | 48 | EntityTimeZone, |
49 | EntityGeo, | 49 | EntityGeo, |
50 | EntityTitle, | 50 | EntityTitle, |
51 | EntityRole, | 51 | EntityRole, |
52 | EntityLogo, | 52 | EntityLogo, |
53 | EntityAgent, | 53 | EntityAgent, |
54 | EntityOrganisation, | 54 | EntityOrganisation, |
55 | EntityCategories, | 55 | EntityCategories, |
56 | EntityNote, | 56 | EntityNote, |
57 | EntityProductID, | 57 | EntityProductID, |
58 | EntityRevision, | 58 | EntityRevision, |
59 | EntitySortString, | 59 | EntitySortString, |
60 | EntitySound, | 60 | EntitySound, |
61 | EntityUID, | 61 | EntityUID, |
62 | EntityURL, | 62 | EntityURL, |
63 | EntityVersion, | 63 | EntityVersion, |
64 | EntityClass, | 64 | EntityClass, |
65 | EntityKey, | 65 | EntityKey, |
66 | EntityExtension, | 66 | EntityExtension, |
67 | EntityUnknown | 67 | EntityUnknown |
68 | }; | 68 | }; |
69 | 69 | ||
70 | enum ValueType { | 70 | enum ValueType { |
71 | ValueSound, | 71 | ValueSound, |
72 | ValueAgent, | 72 | ValueAgent, |
73 | ValueAddress, | 73 | ValueAddress, |
74 | ValueTel, | 74 | ValueTel, |
75 | ValueTextBin, | 75 | ValueTextBin, |
76 | ValueOrg, | 76 | ValueOrg, |
77 | ValueN, | 77 | ValueN, |
78 | ValueUTC, | 78 | ValueUTC, |
79 | ValueURI, | 79 | ValueURI, |
80 | ValueClass, | 80 | ValueClass, |
81 | ValueFloat, | 81 | ValueFloat, |
82 | ValueImage, | 82 | ValueImage, |
83 | ValueDate, | 83 | ValueDate, |
84 | ValueTextList, | 84 | ValueTextList, |
85 | ValueText, | 85 | ValueText, |
86 | ValueGeo, | 86 | ValueGeo, |
87 | ValueUnknown | 87 | ValueUnknown |
88 | }; | 88 | }; |
89 | 89 | ||
90 | enum ParamType { | 90 | enum ParamType { |
91 | ParamUnknown, | 91 | ParamUnknown, |
92 | ParamNone, | 92 | ParamNone, |
93 | ParamSource, | 93 | ParamSource, |
94 | ParamText, | 94 | ParamText, |
95 | ParamImage, | 95 | ParamImage, |
96 | ParamDate, | 96 | ParamDate, |
97 | ParamAddrText, | 97 | ParamAddrText, |
98 | ParamTel, | 98 | ParamTel, |
99 | ParamEmail, | 99 | ParamEmail, |
100 | ParamMailer, | 100 | ParamMailer, |
101 | ParamAgent, | 101 | ParamAgent, |
102 | ParamTextBin, | 102 | ParamTextBin, |
103 | ParamTextNS, | 103 | ParamTextNS, |
104 | ParamSound | 104 | ParamSound |
105 | }; | 105 | }; |
106 | 106 | ||
107 | extern const ParamType paramTypesTable[]; | 107 | extern const ParamType paramTypesTable[]; |
108 | 108 | ||
109 | ParamType EntityTypeToParamType(EntityType); | 109 | ParamType EntityTypeToParamType(EntityType); |
110 | ValueType EntityTypeToValueType(EntityType); | 110 | ValueType EntityTypeToValueType(EntityType); |
111 | QCString EntityTypeToParamName(EntityType); | 111 | Q3CString EntityTypeToParamName(EntityType); |
112 | EntityType EntityNameToEntityType(const QCString &); | 112 | EntityType EntityNameToEntityType(const Q3CString &); |
113 | 113 | ||
114 | char * encodeBase64(const char *, unsigned long, unsigned long &); | 114 | char * encodeBase64(const char *, unsigned long, unsigned long &); |
115 | char * decodeBase64(const char *, unsigned long, unsigned long &); | 115 | char * decodeBase64(const char *, unsigned long, unsigned long &); |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | #endif | 119 | #endif |
120 | 120 | ||
diff --git a/kabc/vcard/include/VCardFloatValue.h b/kabc/vcard/include/VCardFloatValue.h index 69fdc22..cac7a91 100644 --- a/kabc/vcard/include/VCardFloatValue.h +++ b/kabc/vcard/include/VCardFloatValue.h | |||
@@ -1,51 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef FLOATVALUE_H | 24 | #ifndef FLOATVALUE_H |
25 | #define FLOATVALUE_H | 25 | #define FLOATVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardValue.h> | 29 | #include <VCardValue.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class FloatValue : public Value | 34 | class FloatValue : public Value |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "FloatValue-generated.h" | 37 | #include "FloatValue-generated.h" |
38 | 38 | ||
39 | FloatValue(float); | 39 | FloatValue(float); |
40 | 40 | ||
41 | float value(); | 41 | float value(); |
42 | void setValue(float); | 42 | void setValue(float); |
43 | 43 | ||
44 | private: | 44 | private: |
45 | 45 | ||
46 | float value_; | 46 | float value_; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | } | 49 | } |
50 | 50 | ||
51 | #endif | 51 | #endif |
diff --git a/kabc/vcard/include/VCardImageParam.h b/kabc/vcard/include/VCardImageParam.h index ce99ccc..2785331 100644 --- a/kabc/vcard/include/VCardImageParam.h +++ b/kabc/vcard/include/VCardImageParam.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef IMGPARAM_H | 24 | #ifndef IMGPARAM_H |
25 | #define IMGPARAM_H | 25 | #define IMGPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardParam.h> | 29 | #include <VCardParam.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class ImageParam : public Param | 34 | class ImageParam : public Param |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "ImageParam-generated.h" | 37 | #include "ImageParam-generated.h" |
38 | 38 | ||
39 | private: | 39 | private: |
40 | }; | 40 | }; |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/kabc/vcard/include/VCardImageValue.h b/kabc/vcard/include/VCardImageValue.h index 6ce0371..3b64731 100644 --- a/kabc/vcard/include/VCardImageValue.h +++ b/kabc/vcard/include/VCardImageValue.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef IMAGEVALUE_H | 24 | #ifndef IMAGEVALUE_H |
25 | #define IMAGEVALUE_H | 25 | #define IMAGEVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardValue.h> | 29 | #include <VCardValue.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class ImageValue : public Value | 34 | class ImageValue : public Value |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "ImageValue-generated.h" | 37 | #include "ImageValue-generated.h" |
38 | 38 | ||
39 | private: | 39 | private: |
40 | }; | 40 | }; |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/kabc/vcard/include/VCardLangValue.h b/kabc/vcard/include/VCardLangValue.h index 991ceed..319de76 100644 --- a/kabc/vcard/include/VCardLangValue.h +++ b/kabc/vcard/include/VCardLangValue.h | |||
@@ -1,51 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef LANGVALUE_H | 24 | #ifndef LANGVALUE_H |
25 | #define LANGVALUE_H | 25 | #define LANGVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | #include <qstrlist.h> | 28 | #include <q3strlist.h> |
29 | 29 | ||
30 | #include <VCardValue.h> | 30 | #include <VCardValue.h> |
31 | 31 | ||
32 | namespace VCARD | 32 | namespace VCARD |
33 | { | 33 | { |
34 | 34 | ||
35 | class LangValue : public Value | 35 | class LangValue : public Value |
36 | { | 36 | { |
37 | #include "LangValue-generated.h" | 37 | #include "LangValue-generated.h" |
38 | 38 | ||
39 | QCString primary(); | 39 | Q3CString primary(); |
40 | QStrList subtags(); | 40 | Q3StrList subtags(); |
41 | 41 | ||
42 | void setPrimary(const QCString &); | 42 | void setPrimary(const Q3CString &); |
43 | void setSubTags(const QStrList &); | 43 | void setSubTags(const Q3StrList &); |
44 | 44 | ||
45 | QCString primary_; | 45 | Q3CString primary_; |
46 | QStrList subtags_; | 46 | Q3StrList subtags_; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | } | 49 | } |
50 | 50 | ||
51 | #endif | 51 | #endif |
diff --git a/kabc/vcard/include/VCardNValue.h b/kabc/vcard/include/VCardNValue.h index 306821b..ffc5355 100644 --- a/kabc/vcard/include/VCardNValue.h +++ b/kabc/vcard/include/VCardNValue.h | |||
@@ -1,56 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef NVALUE_H | 24 | #ifndef NVALUE_H |
25 | #define NVALUE_H | 25 | #define NVALUE_H |
26 | 26 | ||
27 | #include <VCardValue.h> | 27 | #include <VCardValue.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3CString> | ||
28 | 30 | ||
29 | namespace VCARD | 31 | namespace VCARD |
30 | { | 32 | { |
31 | 33 | ||
32 | class NValue : public Value | 34 | class NValue : public Value |
33 | { | 35 | { |
34 | #include "NValue-generated.h" | 36 | #include "NValue-generated.h" |
35 | NValue *clone(); | 37 | NValue *clone(); |
36 | 38 | ||
37 | QCString family() { parse(); return family_;} | 39 | Q3CString family() { parse(); return family_;} |
38 | QCString given() { parse(); return given_;} | 40 | Q3CString given() { parse(); return given_;} |
39 | QCString middle() { parse(); return middle_;} | 41 | Q3CString middle() { parse(); return middle_;} |
40 | QCString prefix() { parse(); return prefix_;} | 42 | Q3CString prefix() { parse(); return prefix_;} |
41 | QCString suffix() { parse(); return suffix_;} | 43 | Q3CString suffix() { parse(); return suffix_;} |
42 | 44 | ||
43 | void setFamily (const QCString & s) { family_= s; assembled_ = false; } | 45 | void setFamily (const Q3CString & s) { family_= s; assembled_ = false; } |
44 | void setGiven (const QCString & s) { given_= s; assembled_ = false; } | 46 | void setGiven (const Q3CString & s) { given_= s; assembled_ = false; } |
45 | void setMiddle (const QCString & s) { middle_= s; assembled_ = false; } | 47 | void setMiddle (const Q3CString & s) { middle_= s; assembled_ = false; } |
46 | void setPrefix (const QCString & s) { prefix_= s; assembled_ = false; } | 48 | void setPrefix (const Q3CString & s) { prefix_= s; assembled_ = false; } |
47 | void setSuffix (const QCString & s) { suffix_= s; assembled_ = false; } | 49 | void setSuffix (const Q3CString & s) { suffix_= s; assembled_ = false; } |
48 | 50 | ||
49 | private: | 51 | private: |
50 | 52 | ||
51 | QCString family_, given_, middle_, prefix_, suffix_; | 53 | Q3CString family_, given_, middle_, prefix_, suffix_; |
52 | }; | 54 | }; |
53 | 55 | ||
54 | } | 56 | } |
55 | 57 | ||
56 | #endif | 58 | #endif |
diff --git a/kabc/vcard/include/VCardOrgValue.h b/kabc/vcard/include/VCardOrgValue.h index c4f3f25..2e5d32f 100644 --- a/kabc/vcard/include/VCardOrgValue.h +++ b/kabc/vcard/include/VCardOrgValue.h | |||
@@ -1,50 +1,50 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef ORGVALUE_H | 24 | #ifndef ORGVALUE_H |
25 | #define ORGVALUE_H | 25 | #define ORGVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | #include <qstrlist.h> | 28 | #include <q3strlist.h> |
29 | 29 | ||
30 | #include <VCardValue.h> | 30 | #include <VCardValue.h> |
31 | 31 | ||
32 | namespace VCARD | 32 | namespace VCARD |
33 | { | 33 | { |
34 | 34 | ||
35 | class OrgValue : public Value | 35 | class OrgValue : public Value |
36 | { | 36 | { |
37 | 37 | ||
38 | #include "OrgValue-generated.h" | 38 | #include "OrgValue-generated.h" |
39 | 39 | ||
40 | unsigned int numValues(); | 40 | unsigned int numValues(); |
41 | QCString value(unsigned int); | 41 | Q3CString value(unsigned int); |
42 | 42 | ||
43 | private: | 43 | private: |
44 | 44 | ||
45 | QStrList valueList_; | 45 | Q3StrList valueList_; |
46 | }; | 46 | }; |
47 | 47 | ||
48 | } | 48 | } |
49 | 49 | ||
50 | #endif | 50 | #endif |
diff --git a/kabc/vcard/include/VCardParam.h b/kabc/vcard/include/VCardParam.h index b61ce5c..b83fde1 100644 --- a/kabc/vcard/include/VCardParam.h +++ b/kabc/vcard/include/VCardParam.h | |||
@@ -1,59 +1,59 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef PARAM_H | 24 | #ifndef PARAM_H |
25 | #define PARAM_H | 25 | #define PARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | #include <qptrlist.h> | 28 | #include <q3ptrlist.h> |
29 | 29 | ||
30 | #include <VCardEntity.h> | 30 | #include <VCardEntity.h> |
31 | 31 | ||
32 | namespace VCARD | 32 | namespace VCARD |
33 | { | 33 | { |
34 | 34 | ||
35 | class Param : public Entity | 35 | class Param : public Entity |
36 | { | 36 | { |
37 | 37 | ||
38 | #include "Param-generated.h" | 38 | #include "Param-generated.h" |
39 | 39 | ||
40 | Param(const QCString &name, const QCString &value); | 40 | Param(const Q3CString &name, const Q3CString &value); |
41 | 41 | ||
42 | void setName(const QCString &); | 42 | void setName(const Q3CString &); |
43 | void setValue(const QCString &); | 43 | void setValue(const Q3CString &); |
44 | 44 | ||
45 | QCString name(); | 45 | Q3CString name(); |
46 | QCString value(); | 46 | Q3CString value(); |
47 | 47 | ||
48 | private: | 48 | private: |
49 | 49 | ||
50 | QCString name_; | 50 | Q3CString name_; |
51 | QCString value_; | 51 | Q3CString value_; |
52 | }; | 52 | }; |
53 | 53 | ||
54 | typedef QPtrList<Param> ParamList; | 54 | typedef Q3PtrList<Param> ParamList; |
55 | typedef QPtrListIterator<Param> ParamListIterator; | 55 | typedef Q3PtrListIterator<Param> ParamListIterator; |
56 | 56 | ||
57 | } | 57 | } |
58 | 58 | ||
59 | #endif | 59 | #endif |
diff --git a/kabc/vcard/include/VCardRToken.h b/kabc/vcard/include/VCardRToken.h index 2f95f1b..4a5adb2 100644 --- a/kabc/vcard/include/VCardRToken.h +++ b/kabc/vcard/include/VCardRToken.h | |||
@@ -1,38 +1,38 @@ | |||
1 | /* | 1 | /* |
2 | 2 | ||
3 | libvcard - vCard parsing library for vCard version 3.0 | 3 | libvcard - vCard parsing library for vCard version 3.0 |
4 | 4 | ||
5 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 5 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
6 | 6 | ||
7 | Permission is hereby granted, free of charge, to any person obtaining a copy | 7 | Permission is hereby granted, free of charge, to any person obtaining a copy |
8 | of this software and associated documentation files (the "Software"), to | 8 | of this software and associated documentation files (the "Software"), to |
9 | deal in the Software without restriction, including without limitation the | 9 | deal in the Software without restriction, including without limitation the |
10 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 10 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
11 | sell copies of the Software, and to permit persons to whom the Software is | 11 | sell copies of the Software, and to permit persons to whom the Software is |
12 | furnished to do so, subject to the following conditions: | 12 | furnished to do so, subject to the following conditions: |
13 | 13 | ||
14 | The above copyright notice and this permission notice shall be included in | 14 | The above copyright notice and this permission notice shall be included in |
15 | all copies or substantial portions of the Software. | 15 | all copies or substantial portions of the Software. |
16 | 16 | ||
17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 17 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 18 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 19 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
20 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 20 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
21 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 21 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 22 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
23 | */ | 23 | */ |
24 | 24 | ||
25 | #ifndef RTOKEN_H | 25 | #ifndef RTOKEN_H |
26 | #define RTOKEN_H | 26 | #define RTOKEN_H |
27 | 27 | ||
28 | #include <qstrlist.h> | 28 | #include <q3strlist.h> |
29 | 29 | ||
30 | namespace VCARD | 30 | namespace VCARD |
31 | { | 31 | { |
32 | 32 | ||
33 | Q_UINT32 RTokenise(const char * str, const char * delim, QStrList & l); | 33 | Q_UINT32 RTokenise(const char * str, const char * delim, Q3StrList & l); |
34 | 34 | ||
35 | } | 35 | } |
36 | 36 | ||
37 | #endif | 37 | #endif |
38 | 38 | ||
diff --git a/kabc/vcard/include/VCardSoundValue.h b/kabc/vcard/include/VCardSoundValue.h index 994f55e..26f750b 100644 --- a/kabc/vcard/include/VCardSoundValue.h +++ b/kabc/vcard/include/VCardSoundValue.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef SOUNDVALUE_H | 24 | #ifndef SOUNDVALUE_H |
25 | #define SOUNDVALUE_H | 25 | #define SOUNDVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardValue.h> | 29 | #include <VCardValue.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class SoundValue : public Value | 34 | class SoundValue : public Value |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "SoundValue-generated.h" | 37 | #include "SoundValue-generated.h" |
38 | 38 | ||
39 | private: | 39 | private: |
40 | }; | 40 | }; |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/kabc/vcard/include/VCardSourceParam.h b/kabc/vcard/include/VCardSourceParam.h index 887ea20..5218864 100644 --- a/kabc/vcard/include/VCardSourceParam.h +++ b/kabc/vcard/include/VCardSourceParam.h | |||
@@ -1,58 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef SOURCEPARAM_H | 24 | #ifndef SOURCEPARAM_H |
25 | #define SOURCEPARAM_H | 25 | #define SOURCEPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardParam.h> | 29 | #include <VCardParam.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class SourceParam : public Param | 34 | class SourceParam : public Param |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "SourceParam-generated.h" | 37 | #include "SourceParam-generated.h" |
38 | 38 | ||
39 | enum SourceParamType { TypeUnknown, TypeValue, TypeContext, TypeX }; | 39 | enum SourceParamType { TypeUnknown, TypeValue, TypeContext, TypeX }; |
40 | 40 | ||
41 | SourceParamType type(){ parse(); return type_;} | 41 | SourceParamType type(){ parse(); return type_;} |
42 | QCString par() { parse(); return par_; } | 42 | Q3CString par() { parse(); return par_; } |
43 | QCString val() { parse(); return val_; } | 43 | Q3CString val() { parse(); return val_; } |
44 | 44 | ||
45 | void setType(SourceParamType t) { type_= t; assembled_ = false; } | 45 | void setType(SourceParamType t) { type_= t; assembled_ = false; } |
46 | void setPar(const QCString & s) { par_= s; assembled_ = false; } | 46 | void setPar(const Q3CString & s) { par_= s; assembled_ = false; } |
47 | void setVal(const QCString & s) { val_= s; assembled_ = false; } | 47 | void setVal(const Q3CString & s) { val_= s; assembled_ = false; } |
48 | 48 | ||
49 | private: | 49 | private: |
50 | 50 | ||
51 | SourceParamType type_; | 51 | SourceParamType type_; |
52 | // May be "VALUE = uri" or "CONTEXT = word" or "x-name = *SAFE-CHAR" | 52 | // May be "VALUE = uri" or "CONTEXT = word" or "x-name = *SAFE-CHAR" |
53 | QCString par_, val_; // Sub-parameter, value | 53 | Q3CString par_, val_; // Sub-parameter, value |
54 | }; | 54 | }; |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | #endif | 58 | #endif |
diff --git a/kabc/vcard/include/VCardTelParam.h b/kabc/vcard/include/VCardTelParam.h index 27d7dcc..0c45a3a 100644 --- a/kabc/vcard/include/VCardTelParam.h +++ b/kabc/vcard/include/VCardTelParam.h | |||
@@ -1,51 +1,53 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef TELPARAM_H | 24 | #ifndef TELPARAM_H |
25 | #define TELPARAM_H | 25 | #define TELPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3PtrList> | ||
28 | 30 | ||
29 | #include <VCardParam.h> | 31 | #include <VCardParam.h> |
30 | 32 | ||
31 | namespace VCARD | 33 | namespace VCARD |
32 | { | 34 | { |
33 | 35 | ||
34 | class TelParam : public Param | 36 | class TelParam : public Param |
35 | { | 37 | { |
36 | #include "TelParam-generated.h" | 38 | #include "TelParam-generated.h" |
37 | 39 | ||
38 | enum TelType { | 40 | enum TelType { |
39 | TelHome, TelWork, TelPref, TelVoice, TelFex, TelMsg, TelCell, | 41 | TelHome, TelWork, TelPref, TelVoice, TelFex, TelMsg, TelCell, |
40 | TelPager, TelBBS, TelModem, TelCar, TelISDN, TelVideo, TelPCS, | 42 | TelPager, TelBBS, TelModem, TelCar, TelISDN, TelVideo, TelPCS, |
41 | TelIANA, TelX | 43 | TelIANA, TelX |
42 | }; | 44 | }; |
43 | 45 | ||
44 | private: | 46 | private: |
45 | 47 | ||
46 | QPtrList<TelType> types_; | 48 | Q3PtrList<TelType> types_; |
47 | }; | 49 | }; |
48 | 50 | ||
49 | } | 51 | } |
50 | 52 | ||
51 | #endif | 53 | #endif |
diff --git a/kabc/vcard/include/VCardTelValue.h b/kabc/vcard/include/VCardTelValue.h index 9cf5a98..a119e4a 100644 --- a/kabc/vcard/include/VCardTelValue.h +++ b/kabc/vcard/include/VCardTelValue.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef TELVALUE_H | 24 | #ifndef TELVALUE_H |
25 | #define TELVALUE_H | 25 | #define TELVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardValue.h> | 29 | #include <VCardValue.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class TelValue : public Value | 34 | class TelValue : public Value |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "TelValue-generated.h" | 37 | #include "TelValue-generated.h" |
38 | 38 | ||
39 | private: | 39 | private: |
40 | }; | 40 | }; |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/kabc/vcard/include/VCardTextBinParam.h b/kabc/vcard/include/VCardTextBinParam.h index 31dec86..d186995 100644 --- a/kabc/vcard/include/VCardTextBinParam.h +++ b/kabc/vcard/include/VCardTextBinParam.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef TEXTBINPARAM_H | 24 | #ifndef TEXTBINPARAM_H |
25 | #define TEXTBINPARAM_H | 25 | #define TEXTBINPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardParam.h> | 29 | #include <VCardParam.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class TextBinParam : public Param | 34 | class TextBinParam : public Param |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "TextBinParam-generated.h" | 37 | #include "TextBinParam-generated.h" |
38 | 38 | ||
39 | private: | 39 | private: |
40 | }; | 40 | }; |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/kabc/vcard/include/VCardTextBinValue.h b/kabc/vcard/include/VCardTextBinValue.h index 8d44fdf..3924f2a 100644 --- a/kabc/vcard/include/VCardTextBinValue.h +++ b/kabc/vcard/include/VCardTextBinValue.h | |||
@@ -1,67 +1,67 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef TEXTBINVALUE_H | 24 | #ifndef TEXTBINVALUE_H |
25 | #define TEXTBINVALUE_H | 25 | #define TEXTBINVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardValue.h> | 29 | #include <VCardValue.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class TextBinValue : public Value | 34 | class TextBinValue : public Value |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "TextBinValue-generated.h" | 37 | #include "TextBinValue-generated.h" |
38 | 38 | ||
39 | TextBinValue *clone(); | 39 | TextBinValue *clone(); |
40 | 40 | ||
41 | bool isBinary() { parse(); return mIsBinary_; } | 41 | bool isBinary() { parse(); return mIsBinary_; } |
42 | QByteArray data() { parse(); return mData_; } | 42 | QByteArray data() { parse(); return mData_; } |
43 | QString url() { parse(); return mUrl_; } | 43 | QString url() { parse(); return mUrl_; } |
44 | 44 | ||
45 | void setData( const QByteArray &data ) | 45 | void setData( const QByteArray &data ) |
46 | { | 46 | { |
47 | mData_ = data; | 47 | mData_ = data; |
48 | mIsBinary_ = true; | 48 | mIsBinary_ = true; |
49 | assembled_ = false; | 49 | assembled_ = false; |
50 | } | 50 | } |
51 | 51 | ||
52 | void setUrl( const QString &url ) | 52 | void setUrl( const QString &url ) |
53 | { | 53 | { |
54 | mUrl_ = url; | 54 | mUrl_ = url; |
55 | mIsBinary_ = false; | 55 | mIsBinary_ = false; |
56 | assembled_ = false; | 56 | assembled_ = false; |
57 | } | 57 | } |
58 | 58 | ||
59 | private: | 59 | private: |
60 | int mIsBinary_; | 60 | int mIsBinary_; |
61 | QByteArray mData_; | 61 | QByteArray mData_; |
62 | QString mUrl_; | 62 | QString mUrl_; |
63 | }; | 63 | }; |
64 | 64 | ||
65 | } | 65 | } |
66 | 66 | ||
67 | #endif | 67 | #endif |
diff --git a/kabc/vcard/include/VCardTextListValue.h b/kabc/vcard/include/VCardTextListValue.h index 8e47af5..ac42a29 100644 --- a/kabc/vcard/include/VCardTextListValue.h +++ b/kabc/vcard/include/VCardTextListValue.h | |||
@@ -1,51 +1,51 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef TEXTLISTVALUE_H | 24 | #ifndef TEXTLISTVALUE_H |
25 | #define TEXTLISTVALUE_H | 25 | #define TEXTLISTVALUE_H |
26 | 26 | ||
27 | #include <qstrlist.h> | 27 | #include <q3strlist.h> |
28 | 28 | ||
29 | #include <qcstring.h> | 29 | #include <q3cstring.h> |
30 | 30 | ||
31 | #include <VCardValue.h> | 31 | #include <VCardValue.h> |
32 | 32 | ||
33 | namespace VCARD | 33 | namespace VCARD |
34 | { | 34 | { |
35 | 35 | ||
36 | class TextListValue : public Value | 36 | class TextListValue : public Value |
37 | { | 37 | { |
38 | 38 | ||
39 | #include "TextListValue-generated.h" | 39 | #include "TextListValue-generated.h" |
40 | 40 | ||
41 | unsigned int numValues(); | 41 | unsigned int numValues(); |
42 | QCString value(unsigned int); | 42 | Q3CString value(unsigned int); |
43 | 43 | ||
44 | private: | 44 | private: |
45 | 45 | ||
46 | QStrList valueList_; | 46 | Q3StrList valueList_; |
47 | }; | 47 | }; |
48 | 48 | ||
49 | } | 49 | } |
50 | 50 | ||
51 | #endif | 51 | #endif |
diff --git a/kabc/vcard/include/VCardTextParam.h b/kabc/vcard/include/VCardTextParam.h index 08b5f57..2503337 100644 --- a/kabc/vcard/include/VCardTextParam.h +++ b/kabc/vcard/include/VCardTextParam.h | |||
@@ -1,44 +1,44 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef TEXTPARAM_H | 24 | #ifndef TEXTPARAM_H |
25 | #define TEXTPARAM_H | 25 | #define TEXTPARAM_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardParam.h> | 29 | #include <VCardParam.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class TextParam : public Param | 34 | class TextParam : public Param |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "TextParam-generated.h" | 37 | #include "TextParam-generated.h" |
38 | 38 | ||
39 | private: | 39 | private: |
40 | }; | 40 | }; |
41 | 41 | ||
42 | } | 42 | } |
43 | 43 | ||
44 | #endif | 44 | #endif |
diff --git a/kabc/vcard/include/VCardURIValue.h b/kabc/vcard/include/VCardURIValue.h index 5fd7184..116e4c8 100644 --- a/kabc/vcard/include/VCardURIValue.h +++ b/kabc/vcard/include/VCardURIValue.h | |||
@@ -1,52 +1,54 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef URIVALUE_H | 24 | #ifndef URIVALUE_H |
25 | #define URIVALUE_H | 25 | #define URIVALUE_H |
26 | 26 | ||
27 | #include <VCardValue.h> | 27 | #include <VCardValue.h> |
28 | //Added by qt3to4: | ||
29 | #include <Q3CString> | ||
28 | 30 | ||
29 | namespace VCARD | 31 | namespace VCARD |
30 | { | 32 | { |
31 | 33 | ||
32 | class URIValue : public Value | 34 | class URIValue : public Value |
33 | { | 35 | { |
34 | #include "URIValue-generated.h" | 36 | #include "URIValue-generated.h" |
35 | 37 | ||
36 | URIValue(const QCString & scheme, const QCString & schemeSpecificPart); | 38 | URIValue(const Q3CString & scheme, const Q3CString & schemeSpecificPart); |
37 | 39 | ||
38 | QCString scheme(); | 40 | Q3CString scheme(); |
39 | QCString schemeSpecificPart(); | 41 | Q3CString schemeSpecificPart(); |
40 | 42 | ||
41 | void setScheme (const QCString &); | 43 | void setScheme (const Q3CString &); |
42 | void setSchemeSpecificPart(const QCString &); | 44 | void setSchemeSpecificPart(const Q3CString &); |
43 | 45 | ||
44 | private: | 46 | private: |
45 | 47 | ||
46 | QCString scheme_; | 48 | Q3CString scheme_; |
47 | QCString schemeSpecificPart_; | 49 | Q3CString schemeSpecificPart_; |
48 | }; | 50 | }; |
49 | 51 | ||
50 | } | 52 | } |
51 | 53 | ||
52 | #endif | 54 | #endif |
diff --git a/kabc/vcard/include/VCardUTCValue.h b/kabc/vcard/include/VCardUTCValue.h index ff695e0..eb69829 100644 --- a/kabc/vcard/include/VCardUTCValue.h +++ b/kabc/vcard/include/VCardUTCValue.h | |||
@@ -1,58 +1,58 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef UTCVALUE_H | 24 | #ifndef UTCVALUE_H |
25 | #define UTCVALUE_H | 25 | #define UTCVALUE_H |
26 | 26 | ||
27 | #include <qcstring.h> | 27 | #include <q3cstring.h> |
28 | 28 | ||
29 | #include <VCardValue.h> | 29 | #include <VCardValue.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class UTCValue : public Value | 34 | class UTCValue : public Value |
35 | { | 35 | { |
36 | 36 | ||
37 | #include "UTCValue-generated.h" | 37 | #include "UTCValue-generated.h" |
38 | 38 | ||
39 | UTCValue *clone(); | 39 | UTCValue *clone(); |
40 | 40 | ||
41 | void setPositive( int p ) { positive_ = p; assembled_ = false; } | 41 | void setPositive( int p ) { positive_ = p; assembled_ = false; } |
42 | void setHour( int h ) { hour_ = h; assembled_ = false; } | 42 | void setHour( int h ) { hour_ = h; assembled_ = false; } |
43 | void setMinute( int m ) { minute_ = m; assembled_ = false; } | 43 | void setMinute( int m ) { minute_ = m; assembled_ = false; } |
44 | 44 | ||
45 | bool positive() { parse(); return positive_; } | 45 | bool positive() { parse(); return positive_; } |
46 | unsigned int hour() { parse(); return hour_; } | 46 | unsigned int hour() { parse(); return hour_; } |
47 | unsigned int minute() { parse(); return minute_; } | 47 | unsigned int minute() { parse(); return minute_; } |
48 | 48 | ||
49 | private: | 49 | private: |
50 | 50 | ||
51 | bool positive_; | 51 | bool positive_; |
52 | unsigned int hour_; | 52 | unsigned int hour_; |
53 | unsigned int minute_; | 53 | unsigned int minute_; |
54 | }; | 54 | }; |
55 | 55 | ||
56 | } | 56 | } |
57 | 57 | ||
58 | #endif | 58 | #endif |
diff --git a/kabc/vcard/include/VCardVCard.h b/kabc/vcard/include/VCardVCard.h index 5dec166..5b66074 100644 --- a/kabc/vcard/include/VCardVCard.h +++ b/kabc/vcard/include/VCardVCard.h | |||
@@ -1,63 +1,65 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef VCARD_VCARD_H | 24 | #ifndef VCARD_VCARD_H |
25 | #define VCARD_VCARD_H | 25 | #define VCARD_VCARD_H |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qptrlist.h> | 28 | #include <q3ptrlist.h> |
29 | //Added by qt3to4: | ||
30 | #include <Q3CString> | ||
29 | 31 | ||
30 | #include <VCardEnum.h> | 32 | #include <VCardEnum.h> |
31 | #include <VCardEntity.h> | 33 | #include <VCardEntity.h> |
32 | #include <VCardContentLine.h> | 34 | #include <VCardContentLine.h> |
33 | 35 | ||
34 | namespace VCARD | 36 | namespace VCARD |
35 | { | 37 | { |
36 | 38 | ||
37 | class VCard : public Entity | 39 | class VCard : public Entity |
38 | { | 40 | { |
39 | 41 | ||
40 | #include "VCard-generated.h" | 42 | #include "VCard-generated.h" |
41 | 43 | ||
42 | bool has(EntityType); | 44 | bool has(EntityType); |
43 | bool has(const QCString &); | 45 | bool has(const Q3CString &); |
44 | 46 | ||
45 | void add(const ContentLine &); | 47 | void add(const ContentLine &); |
46 | void add(const QCString &); | 48 | void add(const Q3CString &); |
47 | 49 | ||
48 | ContentLine * contentLine(EntityType); | 50 | ContentLine * contentLine(EntityType); |
49 | ContentLine * contentLine(const QCString &); | 51 | ContentLine * contentLine(const Q3CString &); |
50 | 52 | ||
51 | QCString group() { parse(); return group_; } | 53 | Q3CString group() { parse(); return group_; } |
52 | 54 | ||
53 | QPtrList<ContentLine>contentLineList() { parse(); return contentLineList_; } | 55 | Q3PtrList<ContentLine>contentLineList() { parse(); return contentLineList_; } |
54 | 56 | ||
55 | private: | 57 | private: |
56 | 58 | ||
57 | QCString group_; | 59 | Q3CString group_; |
58 | QPtrList<ContentLine>contentLineList_; | 60 | Q3PtrList<ContentLine>contentLineList_; |
59 | }; | 61 | }; |
60 | 62 | ||
61 | } | 63 | } |
62 | 64 | ||
63 | #endif | 65 | #endif |
diff --git a/kabc/vcard/include/VCardVCardEntity.h b/kabc/vcard/include/VCardVCardEntity.h index 47ba370..8c824e7 100644 --- a/kabc/vcard/include/VCardVCardEntity.h +++ b/kabc/vcard/include/VCardVCardEntity.h | |||
@@ -1,56 +1,56 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef VCARD_ENTITY_H | 24 | #ifndef VCARD_ENTITY_H |
25 | #define VCARD_ENTITY_H | 25 | #define VCARD_ENTITY_H |
26 | 26 | ||
27 | #include <qstring.h> | 27 | #include <qstring.h> |
28 | #include <qptrlist.h> | 28 | #include <q3ptrlist.h> |
29 | 29 | ||
30 | #include <VCardEnum.h> | 30 | #include <VCardEnum.h> |
31 | #include <VCardVCard.h> | 31 | #include <VCardVCard.h> |
32 | #include <VCardEntity.h> | 32 | #include <VCardEntity.h> |
33 | 33 | ||
34 | namespace VCARD | 34 | namespace VCARD |
35 | { | 35 | { |
36 | 36 | ||
37 | typedef QPtrList<VCard> VCardList; | 37 | typedef Q3PtrList<VCard> VCardList; |
38 | typedef QPtrListIterator<VCard> VCardListIterator; | 38 | typedef Q3PtrListIterator<VCard> VCardListIterator; |
39 | 39 | ||
40 | class VCardEntity : public Entity | 40 | class VCardEntity : public Entity |
41 | { | 41 | { |
42 | 42 | ||
43 | #include "VCardEntity-generated.h" | 43 | #include "VCardEntity-generated.h" |
44 | 44 | ||
45 | void setCardList(const VCardList & l); | 45 | void setCardList(const VCardList & l); |
46 | VCardList & cardList(); | 46 | VCardList & cardList(); |
47 | 47 | ||
48 | private: | 48 | private: |
49 | 49 | ||
50 | VCardList cardList_; | 50 | VCardList cardList_; |
51 | 51 | ||
52 | }; | 52 | }; |
53 | 53 | ||
54 | } | 54 | } |
55 | 55 | ||
56 | #endif | 56 | #endif |
diff --git a/kabc/vcard/include/VCardValue.h b/kabc/vcard/include/VCardValue.h index 7cfe4a0..024397c 100644 --- a/kabc/vcard/include/VCardValue.h +++ b/kabc/vcard/include/VCardValue.h | |||
@@ -1,46 +1,46 @@ | |||
1 | /* | 1 | /* |
2 | libvcard - vCard parsing library for vCard version 3.0 | 2 | libvcard - vCard parsing library for vCard version 3.0 |
3 | 3 | ||
4 | Copyright (C) 1999 Rik Hemsley rik@kde.org | 4 | Copyright (C) 1999 Rik Hemsley rik@kde.org |
5 | 5 | ||
6 | Permission is hereby granted, free of charge, to any person obtaining a copy | 6 | Permission is hereby granted, free of charge, to any person obtaining a copy |
7 | of this software and associated documentation files (the "Software"), to | 7 | of this software and associated documentation files (the "Software"), to |
8 | deal in the Software without restriction, including without limitation the | 8 | deal in the Software without restriction, including without limitation the |
9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | 9 | rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
10 | sell copies of the Software, and to permit persons to whom the Software is | 10 | sell copies of the Software, and to permit persons to whom the Software is |
11 | furnished to do so, subject to the following conditions: | 11 | furnished to do so, subject to the following conditions: |
12 | 12 | ||
13 | The above copyright notice and this permission notice shall be included in | 13 | The above copyright notice and this permission notice shall be included in |
14 | all copies or substantial portions of the Software. | 14 | all copies or substantial portions of the Software. |
15 | 15 | ||
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | 17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | 18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN | 19 | AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN |
20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION | 20 | ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | 21 | WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #ifndef VALUE_H | 24 | #ifndef VALUE_H |
25 | #define VALUE_H | 25 | #define VALUE_H |
26 | 26 | ||
27 | #include <qptrlist.h> | 27 | #include <q3ptrlist.h> |
28 | 28 | ||
29 | #include <VCardEntity.h> | 29 | #include <VCardEntity.h> |
30 | 30 | ||
31 | namespace VCARD | 31 | namespace VCARD |
32 | { | 32 | { |
33 | 33 | ||
34 | class Value : public Entity | 34 | class Value : public Entity |
35 | { | 35 | { |
36 | #include "Value-generated.h" | 36 | #include "Value-generated.h" |
37 | 37 | ||
38 | virtual Value *clone() { return new Value( *this ); } | 38 | virtual Value *clone() { return new Value( *this ); } |
39 | }; | 39 | }; |
40 | 40 | ||
41 | typedef QPtrList<Value> ValueList; | 41 | typedef Q3PtrList<Value> ValueList; |
42 | typedef QPtrListIterator<Value> ValueListIterator; | 42 | typedef Q3PtrListIterator<Value> ValueListIterator; |
43 | 43 | ||
44 | } | 44 | } |
45 | 45 | ||
46 | #endif | 46 | #endif |
diff --git a/kabc/vcard/include/generated/AdrParam-generated.h b/kabc/vcard/include/generated/AdrParam-generated.h index 3e265d8..a11d142 100644 --- a/kabc/vcard/include/generated/AdrParam-generated.h +++ b/kabc/vcard/include/generated/AdrParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | AdrParam(); | 6 | AdrParam(); |
5 | AdrParam(const AdrParam&); | 7 | AdrParam(const AdrParam&); |
6 | AdrParam(const QCString&); | 8 | AdrParam(const Q3CString&); |
7 | AdrParam & operator = (AdrParam&); | 9 | AdrParam & operator = (AdrParam&); |
8 | AdrParam & operator = (const QCString&); | 10 | AdrParam & operator = (const Q3CString&); |
9 | bool operator ==(AdrParam&); | 11 | bool operator ==(AdrParam&); |
10 | bool operator !=(AdrParam& x) {return !(*this==x);} | 12 | bool operator !=(AdrParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {AdrParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {AdrParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~AdrParam(); | 16 | virtual ~AdrParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "AdrParam"; } | 23 | const char * className() const { return "AdrParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/AdrValue-generated.h b/kabc/vcard/include/generated/AdrValue-generated.h index e1d93e4..c0a33a3 100644 --- a/kabc/vcard/include/generated/AdrValue-generated.h +++ b/kabc/vcard/include/generated/AdrValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | AdrValue(); | 6 | AdrValue(); |
5 | AdrValue(const AdrValue&); | 7 | AdrValue(const AdrValue&); |
6 | AdrValue(const QCString&); | 8 | AdrValue(const Q3CString&); |
7 | AdrValue & operator = (AdrValue&); | 9 | AdrValue & operator = (AdrValue&); |
8 | AdrValue & operator = (const QCString&); | 10 | AdrValue & operator = (const Q3CString&); |
9 | bool operator ==(AdrValue&); | 11 | bool operator ==(AdrValue&); |
10 | bool operator !=(AdrValue& x) {return !(*this==x);} | 12 | bool operator !=(AdrValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {AdrValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {AdrValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~AdrValue(); | 16 | virtual ~AdrValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "AdrValue"; } | 23 | const char * className() const { return "AdrValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/AgentParam-generated.h b/kabc/vcard/include/generated/AgentParam-generated.h index 6423867..d5ed988 100644 --- a/kabc/vcard/include/generated/AgentParam-generated.h +++ b/kabc/vcard/include/generated/AgentParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | AgentParam(); | 6 | AgentParam(); |
5 | AgentParam(const AgentParam&); | 7 | AgentParam(const AgentParam&); |
6 | AgentParam(const QCString&); | 8 | AgentParam(const Q3CString&); |
7 | AgentParam & operator = (AgentParam&); | 9 | AgentParam & operator = (AgentParam&); |
8 | AgentParam & operator = (const QCString&); | 10 | AgentParam & operator = (const Q3CString&); |
9 | bool operator ==(AgentParam&); | 11 | bool operator ==(AgentParam&); |
10 | bool operator !=(AgentParam& x) {return !(*this==x);} | 12 | bool operator !=(AgentParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {AgentParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {AgentParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~AgentParam(); | 16 | virtual ~AgentParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "AgentParam"; } | 23 | const char * className() const { return "AgentParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/AgentValue-generated.h b/kabc/vcard/include/generated/AgentValue-generated.h index 76bb81c..eef5277 100644 --- a/kabc/vcard/include/generated/AgentValue-generated.h +++ b/kabc/vcard/include/generated/AgentValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | AgentValue(); | 6 | AgentValue(); |
5 | AgentValue(const AgentValue&); | 7 | AgentValue(const AgentValue&); |
6 | AgentValue(const QCString&); | 8 | AgentValue(const Q3CString&); |
7 | AgentValue & operator = (AgentValue&); | 9 | AgentValue & operator = (AgentValue&); |
8 | AgentValue & operator = (const QCString&); | 10 | AgentValue & operator = (const Q3CString&); |
9 | bool operator ==(AgentValue&); | 11 | bool operator ==(AgentValue&); |
10 | bool operator !=(AgentValue& x) {return !(*this==x);} | 12 | bool operator !=(AgentValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {AgentValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {AgentValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~AgentValue(); | 16 | virtual ~AgentValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "AgentValue"; } | 23 | const char * className() const { return "AgentValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/ClassValue-generated.h b/kabc/vcard/include/generated/ClassValue-generated.h index df4ed5f..b84c98f 100644 --- a/kabc/vcard/include/generated/ClassValue-generated.h +++ b/kabc/vcard/include/generated/ClassValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | ClassValue(); | 6 | ClassValue(); |
5 | ClassValue(const ClassValue&); | 7 | ClassValue(const ClassValue&); |
6 | ClassValue(const QCString&); | 8 | ClassValue(const Q3CString&); |
7 | ClassValue & operator = (ClassValue&); | 9 | ClassValue & operator = (ClassValue&); |
8 | ClassValue & operator = (const QCString&); | 10 | ClassValue & operator = (const Q3CString&); |
9 | bool operator ==(ClassValue&); | 11 | bool operator ==(ClassValue&); |
10 | bool operator !=(ClassValue& x) {return !(*this==x);} | 12 | bool operator !=(ClassValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {ClassValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {ClassValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~ClassValue(); | 16 | virtual ~ClassValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "ClassValue"; } | 23 | const char * className() const { return "ClassValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/ContentLine-generated.h b/kabc/vcard/include/generated/ContentLine-generated.h index 9efe273..84d0822 100644 --- a/kabc/vcard/include/generated/ContentLine-generated.h +++ b/kabc/vcard/include/generated/ContentLine-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | ContentLine(); | 6 | ContentLine(); |
5 | ContentLine(const ContentLine&); | 7 | ContentLine(const ContentLine&); |
6 | ContentLine(const QCString&); | 8 | ContentLine(const Q3CString&); |
7 | ContentLine & operator = (ContentLine&); | 9 | ContentLine & operator = (ContentLine&); |
8 | ContentLine & operator = (const QCString&); | 10 | ContentLine & operator = (const Q3CString&); |
9 | bool operator ==(ContentLine&); | 11 | bool operator ==(ContentLine&); |
10 | bool operator !=(ContentLine& x) {return !(*this==x);} | 12 | bool operator !=(ContentLine& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {ContentLine a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {ContentLine a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~ContentLine(); | 16 | virtual ~ContentLine(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "ContentLine"; } | 23 | const char * className() const { return "ContentLine"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/DateParam-generated.h b/kabc/vcard/include/generated/DateParam-generated.h index ff1da58..029c1da 100644 --- a/kabc/vcard/include/generated/DateParam-generated.h +++ b/kabc/vcard/include/generated/DateParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | DateParam(); | 6 | DateParam(); |
5 | DateParam(const DateParam&); | 7 | DateParam(const DateParam&); |
6 | DateParam(const QCString&); | 8 | DateParam(const Q3CString&); |
7 | DateParam & operator = (DateParam&); | 9 | DateParam & operator = (DateParam&); |
8 | DateParam & operator = (const QCString&); | 10 | DateParam & operator = (const Q3CString&); |
9 | bool operator ==(DateParam&); | 11 | bool operator ==(DateParam&); |
10 | bool operator !=(DateParam& x) {return !(*this==x);} | 12 | bool operator !=(DateParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {DateParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {DateParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~DateParam(); | 16 | virtual ~DateParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "DateParam"; } | 23 | const char * className() const { return "DateParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/DateValue-generated.h b/kabc/vcard/include/generated/DateValue-generated.h index a382823..70eecce 100644 --- a/kabc/vcard/include/generated/DateValue-generated.h +++ b/kabc/vcard/include/generated/DateValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | DateValue(); | 6 | DateValue(); |
5 | DateValue(const DateValue&); | 7 | DateValue(const DateValue&); |
6 | DateValue(const QCString&); | 8 | DateValue(const Q3CString&); |
7 | DateValue & operator = (DateValue&); | 9 | DateValue & operator = (DateValue&); |
8 | DateValue & operator = (const QCString&); | 10 | DateValue & operator = (const Q3CString&); |
9 | bool operator ==(DateValue&); | 11 | bool operator ==(DateValue&); |
10 | bool operator !=(DateValue& x) {return !(*this==x);} | 12 | bool operator !=(DateValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {DateValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {DateValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~DateValue(); | 16 | virtual ~DateValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "DateValue"; } | 23 | const char * className() const { return "DateValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/EmailParam-generated.h b/kabc/vcard/include/generated/EmailParam-generated.h index 428a6fc..f498931 100644 --- a/kabc/vcard/include/generated/EmailParam-generated.h +++ b/kabc/vcard/include/generated/EmailParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | EmailParam(); | 6 | EmailParam(); |
5 | EmailParam(const EmailParam&); | 7 | EmailParam(const EmailParam&); |
6 | EmailParam(const QCString&); | 8 | EmailParam(const Q3CString&); |
7 | EmailParam & operator = (EmailParam&); | 9 | EmailParam & operator = (EmailParam&); |
8 | EmailParam & operator = (const QCString&); | 10 | EmailParam & operator = (const Q3CString&); |
9 | bool operator ==(EmailParam&); | 11 | bool operator ==(EmailParam&); |
10 | bool operator !=(EmailParam& x) {return !(*this==x);} | 12 | bool operator !=(EmailParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {EmailParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {EmailParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~EmailParam(); | 16 | virtual ~EmailParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "EmailParam"; } | 23 | const char * className() const { return "EmailParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/FloatValue-generated.h b/kabc/vcard/include/generated/FloatValue-generated.h index cac55cf..c04b85f 100644 --- a/kabc/vcard/include/generated/FloatValue-generated.h +++ b/kabc/vcard/include/generated/FloatValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | FloatValue(); | 6 | FloatValue(); |
5 | FloatValue(const FloatValue&); | 7 | FloatValue(const FloatValue&); |
6 | FloatValue(const QCString&); | 8 | FloatValue(const Q3CString&); |
7 | FloatValue & operator = (FloatValue&); | 9 | FloatValue & operator = (FloatValue&); |
8 | FloatValue & operator = (const QCString&); | 10 | FloatValue & operator = (const Q3CString&); |
9 | bool operator ==(FloatValue&); | 11 | bool operator ==(FloatValue&); |
10 | bool operator !=(FloatValue& x) {return !(*this==x);} | 12 | bool operator !=(FloatValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {FloatValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {FloatValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~FloatValue(); | 16 | virtual ~FloatValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "FloatValue"; } | 23 | const char * className() const { return "FloatValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/GeoValue-generated.h b/kabc/vcard/include/generated/GeoValue-generated.h index 594f3ad..ab659bf 100644 --- a/kabc/vcard/include/generated/GeoValue-generated.h +++ b/kabc/vcard/include/generated/GeoValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | GeoValue(); | 6 | GeoValue(); |
5 | GeoValue(const GeoValue&); | 7 | GeoValue(const GeoValue&); |
6 | GeoValue(const QCString&); | 8 | GeoValue(const Q3CString&); |
7 | GeoValue & operator = (GeoValue&); | 9 | GeoValue & operator = (GeoValue&); |
8 | GeoValue & operator = (const QCString&); | 10 | GeoValue & operator = (const Q3CString&); |
9 | bool operator ==(GeoValue&); | 11 | bool operator ==(GeoValue&); |
10 | bool operator !=(GeoValue& x) {return !(*this==x);} | 12 | bool operator !=(GeoValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {GeoValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {GeoValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~GeoValue(); | 16 | virtual ~GeoValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "GeoValue"; } | 23 | const char * className() const { return "GeoValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/Group-generated.h b/kabc/vcard/include/generated/Group-generated.h index f39302d..ae16e3d 100644 --- a/kabc/vcard/include/generated/Group-generated.h +++ b/kabc/vcard/include/generated/Group-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | Group(); | 6 | Group(); |
5 | Group(const Group&); | 7 | Group(const Group&); |
6 | Group(const QCString&); | 8 | Group(const Q3CString&); |
7 | Group & operator = (Group&); | 9 | Group & operator = (Group&); |
8 | Group & operator = (const QCString&); | 10 | Group & operator = (const Q3CString&); |
9 | bool operator ==(Group&); | 11 | bool operator ==(Group&); |
10 | bool operator !=(Group& x) {return !(*this==x);} | 12 | bool operator !=(Group& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {Group a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {Group a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~Group(); | 16 | virtual ~Group(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "Group"; } | 23 | const char * className() const { return "Group"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/ImageParam-generated.h b/kabc/vcard/include/generated/ImageParam-generated.h index 81edfd2..91b09a4 100644 --- a/kabc/vcard/include/generated/ImageParam-generated.h +++ b/kabc/vcard/include/generated/ImageParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | ImageParam(); | 6 | ImageParam(); |
5 | ImageParam(const ImageParam&); | 7 | ImageParam(const ImageParam&); |
6 | ImageParam(const QCString&); | 8 | ImageParam(const Q3CString&); |
7 | ImageParam & operator = (ImageParam&); | 9 | ImageParam & operator = (ImageParam&); |
8 | ImageParam & operator = (const QCString&); | 10 | ImageParam & operator = (const Q3CString&); |
9 | bool operator ==(ImageParam&); | 11 | bool operator ==(ImageParam&); |
10 | bool operator !=(ImageParam& x) {return !(*this==x);} | 12 | bool operator !=(ImageParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {ImageParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {ImageParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~ImageParam(); | 16 | virtual ~ImageParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "ImageParam"; } | 23 | const char * className() const { return "ImageParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/ImageValue-generated.h b/kabc/vcard/include/generated/ImageValue-generated.h index 5a2c493..d71282e 100644 --- a/kabc/vcard/include/generated/ImageValue-generated.h +++ b/kabc/vcard/include/generated/ImageValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | ImageValue(); | 6 | ImageValue(); |
5 | ImageValue(const ImageValue&); | 7 | ImageValue(const ImageValue&); |
6 | ImageValue(const QCString&); | 8 | ImageValue(const Q3CString&); |
7 | ImageValue & operator = (ImageValue&); | 9 | ImageValue & operator = (ImageValue&); |
8 | ImageValue & operator = (const QCString&); | 10 | ImageValue & operator = (const Q3CString&); |
9 | bool operator ==(ImageValue&); | 11 | bool operator ==(ImageValue&); |
10 | bool operator !=(ImageValue& x) {return !(*this==x);} | 12 | bool operator !=(ImageValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {ImageValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {ImageValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~ImageValue(); | 16 | virtual ~ImageValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "ImageValue"; } | 23 | const char * className() const { return "ImageValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/ImgParam-generated.h b/kabc/vcard/include/generated/ImgParam-generated.h index 46a6ca0..461ca6d 100644 --- a/kabc/vcard/include/generated/ImgParam-generated.h +++ b/kabc/vcard/include/generated/ImgParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | ImgParam(); | 6 | ImgParam(); |
5 | ImgParam(const ImgParam&); | 7 | ImgParam(const ImgParam&); |
6 | ImgParam(const QCString&); | 8 | ImgParam(const Q3CString&); |
7 | ImgParam & operator = (ImgParam&); | 9 | ImgParam & operator = (ImgParam&); |
8 | ImgParam & operator = (const QCString&); | 10 | ImgParam & operator = (const Q3CString&); |
9 | bool operator ==(ImgParam&); | 11 | bool operator ==(ImgParam&); |
10 | bool operator !=(ImgParam& x) {return !(*this==x);} | 12 | bool operator !=(ImgParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {ImgParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {ImgParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~ImgParam(); | 16 | virtual ~ImgParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | virtual const char * className() const { return "ImgParam"; } | 23 | virtual const char * className() const { return "ImgParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/ImgValue-generated.h b/kabc/vcard/include/generated/ImgValue-generated.h index d75d545..80ee646 100644 --- a/kabc/vcard/include/generated/ImgValue-generated.h +++ b/kabc/vcard/include/generated/ImgValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | ImgValue(); | 6 | ImgValue(); |
5 | ImgValue(const ImgValue&); | 7 | ImgValue(const ImgValue&); |
6 | ImgValue(const QCString&); | 8 | ImgValue(const Q3CString&); |
7 | ImgValue & operator = (ImgValue&); | 9 | ImgValue & operator = (ImgValue&); |
8 | ImgValue & operator = (const QCString&); | 10 | ImgValue & operator = (const Q3CString&); |
9 | bool operator ==(ImgValue&); | 11 | bool operator ==(ImgValue&); |
10 | bool operator !=(ImgValue& x) {return !(*this==x);} | 12 | bool operator !=(ImgValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {ImgValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {ImgValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~ImgValue(); | 16 | virtual ~ImgValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | virtual const char * className() const { return "ImgValue"; } | 23 | virtual const char * className() const { return "ImgValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/LangValue-generated.h b/kabc/vcard/include/generated/LangValue-generated.h index 23e138b..434f762 100644 --- a/kabc/vcard/include/generated/LangValue-generated.h +++ b/kabc/vcard/include/generated/LangValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | LangValue(); | 6 | LangValue(); |
5 | LangValue(const LangValue&); | 7 | LangValue(const LangValue&); |
6 | LangValue(const QCString&); | 8 | LangValue(const Q3CString&); |
7 | LangValue & operator = (LangValue&); | 9 | LangValue & operator = (LangValue&); |
8 | LangValue & operator = (const QCString&); | 10 | LangValue & operator = (const Q3CString&); |
9 | bool operator ==(LangValue&); | 11 | bool operator ==(LangValue&); |
10 | bool operator !=(LangValue& x) {return !(*this==x);} | 12 | bool operator !=(LangValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {LangValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {LangValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~LangValue(); | 16 | virtual ~LangValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "LangValue"; } | 23 | const char * className() const { return "LangValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/NValue-generated.h b/kabc/vcard/include/generated/NValue-generated.h index 082c253..086810f 100644 --- a/kabc/vcard/include/generated/NValue-generated.h +++ b/kabc/vcard/include/generated/NValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | NValue(); | 6 | NValue(); |
5 | NValue(const NValue&); | 7 | NValue(const NValue&); |
6 | NValue(const QCString&); | 8 | NValue(const Q3CString&); |
7 | NValue & operator = (NValue&); | 9 | NValue & operator = (NValue&); |
8 | NValue & operator = (const QCString&); | 10 | NValue & operator = (const Q3CString&); |
9 | bool operator ==(NValue&); | 11 | bool operator ==(NValue&); |
10 | bool operator !=(NValue& x) {return !(*this==x);} | 12 | bool operator !=(NValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {NValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {NValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~NValue(); | 16 | virtual ~NValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "NValue"; } | 23 | const char * className() const { return "NValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/Name-generated.h b/kabc/vcard/include/generated/Name-generated.h index 0e69abd..a3bcb25 100644 --- a/kabc/vcard/include/generated/Name-generated.h +++ b/kabc/vcard/include/generated/Name-generated.h | |||
@@ -1,22 +1,24 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | V_Name(); | 6 | V_Name(); |
5 | V_Name(const V_Name&); | 7 | V_Name(const V_Name&); |
6 | V_Name(const QCString&); | 8 | V_Name(const Q3CString&); |
7 | V_Name & operator = (V_Name&); | 9 | V_Name & operator = (V_Name&); |
8 | V_Name & operator = (const QCString&); | 10 | V_Name & operator = (const Q3CString&); |
9 | bool operator ==(V_Name&); | 11 | bool operator ==(V_Name&); |
10 | bool operator !=(V_Name& x) {return !(*this==x);} | 12 | bool operator !=(V_Name& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {V_Name a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {V_Name a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~V_Name(); | 16 | virtual ~V_Name(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | 23 | ||
22 | // End of automatically generated code // | 24 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/OrgValue-generated.h b/kabc/vcard/include/generated/OrgValue-generated.h index 51eb1b7..275f56f 100644 --- a/kabc/vcard/include/generated/OrgValue-generated.h +++ b/kabc/vcard/include/generated/OrgValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | OrgValue(); | 6 | OrgValue(); |
5 | OrgValue(const OrgValue&); | 7 | OrgValue(const OrgValue&); |
6 | OrgValue(const QCString&); | 8 | OrgValue(const Q3CString&); |
7 | OrgValue & operator = (OrgValue&); | 9 | OrgValue & operator = (OrgValue&); |
8 | OrgValue & operator = (const QCString&); | 10 | OrgValue & operator = (const Q3CString&); |
9 | bool operator ==(OrgValue&); | 11 | bool operator ==(OrgValue&); |
10 | bool operator !=(OrgValue& x) {return !(*this==x);} | 12 | bool operator !=(OrgValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {OrgValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {OrgValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~OrgValue(); | 16 | virtual ~OrgValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "OrgValue"; } | 23 | const char * className() const { return "OrgValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/Param-generated.h b/kabc/vcard/include/generated/Param-generated.h index cf4666a..1a35166 100644 --- a/kabc/vcard/include/generated/Param-generated.h +++ b/kabc/vcard/include/generated/Param-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | Param(); | 6 | Param(); |
5 | Param(const Param&); | 7 | Param(const Param&); |
6 | Param(const QCString&); | 8 | Param(const Q3CString&); |
7 | Param & operator = (Param&); | 9 | Param & operator = (Param&); |
8 | Param & operator = (const QCString&); | 10 | Param & operator = (const Q3CString&); |
9 | bool operator ==(Param&); | 11 | bool operator ==(Param&); |
10 | bool operator !=(Param& x) {return !(*this==x);} | 12 | bool operator !=(Param& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {Param a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {Param a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~Param(); | 16 | virtual ~Param(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "Param"; } | 23 | const char * className() const { return "Param"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/ParamName-generated.h b/kabc/vcard/include/generated/ParamName-generated.h index ef673c3..b45022e 100644 --- a/kabc/vcard/include/generated/ParamName-generated.h +++ b/kabc/vcard/include/generated/ParamName-generated.h | |||
@@ -1,22 +1,24 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | V_ParamName(); | 6 | V_ParamName(); |
5 | V_ParamName(const V_ParamName&); | 7 | V_ParamName(const V_ParamName&); |
6 | V_ParamName(const QCString&); | 8 | V_ParamName(const Q3CString&); |
7 | V_ParamName & operator = (V_ParamName&); | 9 | V_ParamName & operator = (V_ParamName&); |
8 | V_ParamName & operator = (const QCString&); | 10 | V_ParamName & operator = (const Q3CString&); |
9 | bool operator ==(V_ParamName&); | 11 | bool operator ==(V_ParamName&); |
10 | bool operator !=(V_ParamName& x) {return !(*this==x);} | 12 | bool operator !=(V_ParamName& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {V_ParamName a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {V_ParamName a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~V_ParamName(); | 16 | virtual ~V_ParamName(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | 23 | ||
22 | // End of automatically generated code // | 24 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/ParamValue-generated.h b/kabc/vcard/include/generated/ParamValue-generated.h index e73500f..956c8da 100644 --- a/kabc/vcard/include/generated/ParamValue-generated.h +++ b/kabc/vcard/include/generated/ParamValue-generated.h | |||
@@ -1,22 +1,24 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | V_ParamValue(); | 6 | V_ParamValue(); |
5 | V_ParamValue(const V_ParamValue&); | 7 | V_ParamValue(const V_ParamValue&); |
6 | V_ParamValue(const QCString&); | 8 | V_ParamValue(const Q3CString&); |
7 | V_ParamValue & operator = (V_ParamValue&); | 9 | V_ParamValue & operator = (V_ParamValue&); |
8 | V_ParamValue & operator = (const QCString&); | 10 | V_ParamValue & operator = (const Q3CString&); |
9 | bool operator ==(V_ParamValue&); | 11 | bool operator ==(V_ParamValue&); |
10 | bool operator !=(V_ParamValue& x) {return !(*this==x);} | 12 | bool operator !=(V_ParamValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {V_ParamValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {V_ParamValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~V_ParamValue(); | 16 | virtual ~V_ParamValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | 23 | ||
22 | // End of automatically generated code // | 24 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/PhoneNumberValue-generated.h b/kabc/vcard/include/generated/PhoneNumberValue-generated.h index 1320f18..0d206f4 100644 --- a/kabc/vcard/include/generated/PhoneNumberValue-generated.h +++ b/kabc/vcard/include/generated/PhoneNumberValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | PhoneNumberValue(); | 6 | PhoneNumberValue(); |
5 | PhoneNumberValue(const PhoneNumberValue&); | 7 | PhoneNumberValue(const PhoneNumberValue&); |
6 | PhoneNumberValue(const QCString&); | 8 | PhoneNumberValue(const Q3CString&); |
7 | PhoneNumberValue & operator = (PhoneNumberValue&); | 9 | PhoneNumberValue & operator = (PhoneNumberValue&); |
8 | PhoneNumberValue & operator = (const QCString&); | 10 | PhoneNumberValue & operator = (const Q3CString&); |
9 | bool operator ==(PhoneNumberValue&); | 11 | bool operator ==(PhoneNumberValue&); |
10 | bool operator !=(PhoneNumberValue& x) {return !(*this==x);} | 12 | bool operator !=(PhoneNumberValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {PhoneNumberValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {PhoneNumberValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~PhoneNumberValue(); | 16 | virtual ~PhoneNumberValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "PhoneNumberValue"; } | 23 | const char * className() const { return "PhoneNumberValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/SoundValue-generated.h b/kabc/vcard/include/generated/SoundValue-generated.h index a9ab2e8..2cc9c0d 100644 --- a/kabc/vcard/include/generated/SoundValue-generated.h +++ b/kabc/vcard/include/generated/SoundValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | SoundValue(); | 6 | SoundValue(); |
5 | SoundValue(const SoundValue&); | 7 | SoundValue(const SoundValue&); |
6 | SoundValue(const QCString&); | 8 | SoundValue(const Q3CString&); |
7 | SoundValue & operator = (SoundValue&); | 9 | SoundValue & operator = (SoundValue&); |
8 | SoundValue & operator = (const QCString&); | 10 | SoundValue & operator = (const Q3CString&); |
9 | bool operator ==(SoundValue&); | 11 | bool operator ==(SoundValue&); |
10 | bool operator !=(SoundValue& x) {return !(*this==x);} | 12 | bool operator !=(SoundValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {SoundValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {SoundValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~SoundValue(); | 16 | virtual ~SoundValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "SoundValue"; } | 23 | const char * className() const { return "SoundValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/SourceParam-generated.h b/kabc/vcard/include/generated/SourceParam-generated.h index 75fefb8..537e093 100644 --- a/kabc/vcard/include/generated/SourceParam-generated.h +++ b/kabc/vcard/include/generated/SourceParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | SourceParam(); | 6 | SourceParam(); |
5 | SourceParam(const SourceParam&); | 7 | SourceParam(const SourceParam&); |
6 | SourceParam(const QCString&); | 8 | SourceParam(const Q3CString&); |
7 | SourceParam & operator = (SourceParam&); | 9 | SourceParam & operator = (SourceParam&); |
8 | SourceParam & operator = (const QCString&); | 10 | SourceParam & operator = (const Q3CString&); |
9 | bool operator ==(SourceParam&); | 11 | bool operator ==(SourceParam&); |
10 | bool operator !=(SourceParam& x) {return !(*this==x);} | 12 | bool operator !=(SourceParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {SourceParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {SourceParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~SourceParam(); | 16 | virtual ~SourceParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "SourceParam"; } | 23 | const char * className() const { return "SourceParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/TelParam-generated.h b/kabc/vcard/include/generated/TelParam-generated.h index 3ee77cc..8d9ba0f 100644 --- a/kabc/vcard/include/generated/TelParam-generated.h +++ b/kabc/vcard/include/generated/TelParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | TelParam(); | 6 | TelParam(); |
5 | TelParam(const TelParam&); | 7 | TelParam(const TelParam&); |
6 | TelParam(const QCString&); | 8 | TelParam(const Q3CString&); |
7 | TelParam & operator = (TelParam&); | 9 | TelParam & operator = (TelParam&); |
8 | TelParam & operator = (const QCString&); | 10 | TelParam & operator = (const Q3CString&); |
9 | bool operator ==(TelParam&); | 11 | bool operator ==(TelParam&); |
10 | bool operator !=(TelParam& x) {return !(*this==x);} | 12 | bool operator !=(TelParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {TelParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {TelParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~TelParam(); | 16 | virtual ~TelParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "TelParam"; } | 23 | const char * className() const { return "TelParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/TelValue-generated.h b/kabc/vcard/include/generated/TelValue-generated.h index 3213e1c..b72fa7d 100644 --- a/kabc/vcard/include/generated/TelValue-generated.h +++ b/kabc/vcard/include/generated/TelValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | TelValue(); | 6 | TelValue(); |
5 | TelValue(const TelValue&); | 7 | TelValue(const TelValue&); |
6 | TelValue(const QCString&); | 8 | TelValue(const Q3CString&); |
7 | TelValue & operator = (TelValue&); | 9 | TelValue & operator = (TelValue&); |
8 | TelValue & operator = (const QCString&); | 10 | TelValue & operator = (const Q3CString&); |
9 | bool operator ==(TelValue&); | 11 | bool operator ==(TelValue&); |
10 | bool operator !=(TelValue& x) {return !(*this==x);} | 12 | bool operator !=(TelValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {TelValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {TelValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~TelValue(); | 16 | virtual ~TelValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "TelValue"; } | 23 | const char * className() const { return "TelValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/TextBinParam-generated.h b/kabc/vcard/include/generated/TextBinParam-generated.h index d075c10..2e433b0 100644 --- a/kabc/vcard/include/generated/TextBinParam-generated.h +++ b/kabc/vcard/include/generated/TextBinParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | TextBinParam(); | 6 | TextBinParam(); |
5 | TextBinParam(const TextBinParam&); | 7 | TextBinParam(const TextBinParam&); |
6 | TextBinParam(const QCString&); | 8 | TextBinParam(const Q3CString&); |
7 | TextBinParam & operator = (TextBinParam&); | 9 | TextBinParam & operator = (TextBinParam&); |
8 | TextBinParam & operator = (const QCString&); | 10 | TextBinParam & operator = (const Q3CString&); |
9 | bool operator ==(TextBinParam&); | 11 | bool operator ==(TextBinParam&); |
10 | bool operator !=(TextBinParam& x) {return !(*this==x);} | 12 | bool operator !=(TextBinParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {TextBinParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {TextBinParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~TextBinParam(); | 16 | virtual ~TextBinParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "TextBinParam"; } | 23 | const char * className() const { return "TextBinParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/TextBinValue-generated.h b/kabc/vcard/include/generated/TextBinValue-generated.h index e9553ac..bc3ad61 100644 --- a/kabc/vcard/include/generated/TextBinValue-generated.h +++ b/kabc/vcard/include/generated/TextBinValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | TextBinValue(); | 6 | TextBinValue(); |
5 | TextBinValue(const TextBinValue&); | 7 | TextBinValue(const TextBinValue&); |
6 | TextBinValue(const QCString&); | 8 | TextBinValue(const Q3CString&); |
7 | TextBinValue & operator = (TextBinValue&); | 9 | TextBinValue & operator = (TextBinValue&); |
8 | TextBinValue & operator = (const QCString&); | 10 | TextBinValue & operator = (const Q3CString&); |
9 | bool operator ==(TextBinValue&); | 11 | bool operator ==(TextBinValue&); |
10 | bool operator !=(TextBinValue& x) {return !(*this==x);} | 12 | bool operator !=(TextBinValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {TextBinValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {TextBinValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~TextBinValue(); | 16 | virtual ~TextBinValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "TextBinValue"; } | 23 | const char * className() const { return "TextBinValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/TextListValue-generated.h b/kabc/vcard/include/generated/TextListValue-generated.h index 9f46124..9df8a46 100644 --- a/kabc/vcard/include/generated/TextListValue-generated.h +++ b/kabc/vcard/include/generated/TextListValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | TextListValue(); | 6 | TextListValue(); |
5 | TextListValue(const TextListValue&); | 7 | TextListValue(const TextListValue&); |
6 | TextListValue(const QCString&); | 8 | TextListValue(const Q3CString&); |
7 | TextListValue & operator = (TextListValue&); | 9 | TextListValue & operator = (TextListValue&); |
8 | TextListValue & operator = (const QCString&); | 10 | TextListValue & operator = (const Q3CString&); |
9 | bool operator ==(TextListValue&); | 11 | bool operator ==(TextListValue&); |
10 | bool operator !=(TextListValue& x) {return !(*this==x);} | 12 | bool operator !=(TextListValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {TextListValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {TextListValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~TextListValue(); | 16 | virtual ~TextListValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "TextListValue"; } | 23 | const char * className() const { return "TextListValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/TextNSParam-generated.h b/kabc/vcard/include/generated/TextNSParam-generated.h index d7f58ca..8842bd6 100644 --- a/kabc/vcard/include/generated/TextNSParam-generated.h +++ b/kabc/vcard/include/generated/TextNSParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | TextNSParam(); | 6 | TextNSParam(); |
5 | TextNSParam(const TextNSParam&); | 7 | TextNSParam(const TextNSParam&); |
6 | TextNSParam(const QCString&); | 8 | TextNSParam(const Q3CString&); |
7 | TextNSParam & operator = (TextNSParam&); | 9 | TextNSParam & operator = (TextNSParam&); |
8 | TextNSParam & operator = (const QCString&); | 10 | TextNSParam & operator = (const Q3CString&); |
9 | bool operator ==(TextNSParam&); | 11 | bool operator ==(TextNSParam&); |
10 | bool operator !=(TextNSParam& x) {return !(*this==x);} | 12 | bool operator !=(TextNSParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {TextNSParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {TextNSParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~TextNSParam(); | 16 | virtual ~TextNSParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "TextNSParam"; } | 23 | const char * className() const { return "TextNSParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/TextParam-generated.h b/kabc/vcard/include/generated/TextParam-generated.h index 154e1bf..e56a8a5 100644 --- a/kabc/vcard/include/generated/TextParam-generated.h +++ b/kabc/vcard/include/generated/TextParam-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | TextParam(); | 6 | TextParam(); |
5 | TextParam(const TextParam&); | 7 | TextParam(const TextParam&); |
6 | TextParam(const QCString&); | 8 | TextParam(const Q3CString&); |
7 | TextParam & operator = (TextParam&); | 9 | TextParam & operator = (TextParam&); |
8 | TextParam & operator = (const QCString&); | 10 | TextParam & operator = (const Q3CString&); |
9 | bool operator ==(TextParam&); | 11 | bool operator ==(TextParam&); |
10 | bool operator !=(TextParam& x) {return !(*this==x);} | 12 | bool operator !=(TextParam& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {TextParam a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {TextParam a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~TextParam(); | 16 | virtual ~TextParam(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "TextParam"; } | 23 | const char * className() const { return "TextParam"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/TextValue-generated.h b/kabc/vcard/include/generated/TextValue-generated.h index e1c4dcc..3f205e0 100644 --- a/kabc/vcard/include/generated/TextValue-generated.h +++ b/kabc/vcard/include/generated/TextValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | TextValue(); | 6 | TextValue(); |
5 | TextValue(const TextValue&); | 7 | TextValue(const TextValue&); |
6 | TextValue(const QCString&); | 8 | TextValue(const Q3CString&); |
7 | TextValue & operator = (TextValue&); | 9 | TextValue & operator = (TextValue&); |
8 | TextValue & operator = (const QCString&); | 10 | TextValue & operator = (const Q3CString&); |
9 | bool operator ==(TextValue&); | 11 | bool operator ==(TextValue&); |
10 | bool operator !=(TextValue& x) {return !(*this==x);} | 12 | bool operator !=(TextValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {TextValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {TextValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~TextValue(); | 16 | virtual ~TextValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "TextValue"; } | 23 | const char * className() const { return "TextValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/URIValue-generated.h b/kabc/vcard/include/generated/URIValue-generated.h index dbcb5c1..464178f 100644 --- a/kabc/vcard/include/generated/URIValue-generated.h +++ b/kabc/vcard/include/generated/URIValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | URIValue(); | 6 | URIValue(); |
5 | URIValue(const URIValue&); | 7 | URIValue(const URIValue&); |
6 | URIValue(const QCString&); | 8 | URIValue(const Q3CString&); |
7 | URIValue & operator = (URIValue&); | 9 | URIValue & operator = (URIValue&); |
8 | URIValue & operator = (const QCString&); | 10 | URIValue & operator = (const Q3CString&); |
9 | bool operator ==(URIValue&); | 11 | bool operator ==(URIValue&); |
10 | bool operator !=(URIValue& x) {return !(*this==x);} | 12 | bool operator !=(URIValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {URIValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {URIValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~URIValue(); | 16 | virtual ~URIValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "URIValue"; } | 23 | const char * className() const { return "URIValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/UTCValue-generated.h b/kabc/vcard/include/generated/UTCValue-generated.h index 46e447b..1a34b5c 100644 --- a/kabc/vcard/include/generated/UTCValue-generated.h +++ b/kabc/vcard/include/generated/UTCValue-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | UTCValue(); | 6 | UTCValue(); |
5 | UTCValue(const UTCValue&); | 7 | UTCValue(const UTCValue&); |
6 | UTCValue(const QCString&); | 8 | UTCValue(const Q3CString&); |
7 | UTCValue & operator = (UTCValue&); | 9 | UTCValue & operator = (UTCValue&); |
8 | UTCValue & operator = (const QCString&); | 10 | UTCValue & operator = (const Q3CString&); |
9 | bool operator ==(UTCValue&); | 11 | bool operator ==(UTCValue&); |
10 | bool operator !=(UTCValue& x) {return !(*this==x);} | 12 | bool operator !=(UTCValue& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {UTCValue a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {UTCValue a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~UTCValue(); | 16 | virtual ~UTCValue(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "UTCValue"; } | 23 | const char * className() const { return "UTCValue"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/VCard-generated.h b/kabc/vcard/include/generated/VCard-generated.h index 4d7d96d..d09c789 100644 --- a/kabc/vcard/include/generated/VCard-generated.h +++ b/kabc/vcard/include/generated/VCard-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | VCard(); | 6 | VCard(); |
5 | VCard(const VCard&); | 7 | VCard(const VCard&); |
6 | VCard(const QCString&); | 8 | VCard(const Q3CString&); |
7 | VCard & operator = (VCard&); | 9 | VCard & operator = (VCard&); |
8 | VCard & operator = (const QCString&); | 10 | VCard & operator = (const Q3CString&); |
9 | bool operator ==(VCard&); | 11 | bool operator ==(VCard&); |
10 | bool operator !=(VCard& x) {return !(*this==x);} | 12 | bool operator !=(VCard& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {VCard a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {VCard a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~VCard(); | 16 | virtual ~VCard(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "VCard"; } | 23 | const char * className() const { return "VCard"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/VCardEntity-generated.h b/kabc/vcard/include/generated/VCardEntity-generated.h index 9f2dfbc..cbbe8e1 100644 --- a/kabc/vcard/include/generated/VCardEntity-generated.h +++ b/kabc/vcard/include/generated/VCardEntity-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | VCardEntity(); | 6 | VCardEntity(); |
5 | VCardEntity(const VCardEntity&); | 7 | VCardEntity(const VCardEntity&); |
6 | VCardEntity(const QCString&); | 8 | VCardEntity(const Q3CString&); |
7 | VCardEntity & operator = (VCardEntity&); | 9 | VCardEntity & operator = (VCardEntity&); |
8 | VCardEntity & operator = (const QCString&); | 10 | VCardEntity & operator = (const Q3CString&); |
9 | bool operator ==(VCardEntity&); | 11 | bool operator ==(VCardEntity&); |
10 | bool operator !=(VCardEntity& x) {return !(*this==x);} | 12 | bool operator !=(VCardEntity& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {VCardEntity a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {VCardEntity a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~VCardEntity(); | 16 | virtual ~VCardEntity(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "VCardEntity"; } | 23 | const char * className() const { return "VCardEntity"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/include/generated/Value-generated.h b/kabc/vcard/include/generated/Value-generated.h index 7afac34..142e720 100644 --- a/kabc/vcard/include/generated/Value-generated.h +++ b/kabc/vcard/include/generated/Value-generated.h | |||
@@ -1,23 +1,25 @@ | |||
1 | //Added by qt3to4: | ||
2 | #include <Q3CString> | ||
1 | // XXX Automatically generated. DO NOT EDIT! XXX // | 3 | // XXX Automatically generated. DO NOT EDIT! XXX // |
2 | 4 | ||
3 | public: | 5 | public: |
4 | Value(); | 6 | Value(); |
5 | Value(const Value&); | 7 | Value(const Value&); |
6 | Value(const QCString&); | 8 | Value(const Q3CString&); |
7 | Value & operator = (Value&); | 9 | Value & operator = (Value&); |
8 | Value & operator = (const QCString&); | 10 | Value & operator = (const Q3CString&); |
9 | bool operator ==(Value&); | 11 | bool operator ==(Value&); |
10 | bool operator !=(Value& x) {return !(*this==x);} | 12 | bool operator !=(Value& x) {return !(*this==x);} |
11 | bool operator ==(const QCString& s) {Value a(s);return(*this==a);} | 13 | bool operator ==(const Q3CString& s) {Value a(s);return(*this==a);} |
12 | bool operator != (const QCString& s) {return !(*this == s);} | 14 | bool operator != (const Q3CString& s) {return !(*this == s);} |
13 | 15 | ||
14 | virtual ~Value(); | 16 | virtual ~Value(); |
15 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} | 17 | void parse() {if(!parsed_) _parse();parsed_=true;assembled_=false;} |
16 | 18 | ||
17 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} | 19 | void assemble() {if(assembled_) return;parse();_assemble();assembled_=true;} |
18 | 20 | ||
19 | void _parse(); | 21 | void _parse(); |
20 | void _assemble(); | 22 | void _assemble(); |
21 | const char * className() const { return "Value"; } | 23 | const char * className() const { return "Value"; } |
22 | 24 | ||
23 | // End of automatically generated code // | 25 | // End of automatically generated code // |
diff --git a/kabc/vcard/testread.cpp b/kabc/vcard/testread.cpp index 919c661..4d66aaf 100644 --- a/kabc/vcard/testread.cpp +++ b/kabc/vcard/testread.cpp | |||
@@ -1,129 +1,131 @@ | |||
1 | #include <iostream> | 1 | #include <iostream> |
2 | #include <stdlib.h> | 2 | #include <stdlib.h> |
3 | #include <assert.h> | 3 | #include <assert.h> |
4 | 4 | ||
5 | #include <qfile.h> | 5 | #include <qfile.h> |
6 | #include <qtextstream.h> | 6 | #include <q3textstream.h> |
7 | //Added by qt3to4: | ||
8 | #include <Q3CString> | ||
7 | 9 | ||
8 | #include <VCard.h> | 10 | #include <VCard.h> |
9 | 11 | ||
10 | using namespace std; | 12 | using namespace std; |
11 | 13 | ||
12 | int main(int argc, char * argv[]) | 14 | int main(int argc, char * argv[]) |
13 | { | 15 | { |
14 | if (argc != 2) { | 16 | if (argc != 2) { |
15 | cerr << "Usage: " << argv[0] << " <filename>" << endl; | 17 | cerr << "Usage: " << argv[0] << " <filename>" << endl; |
16 | exit(1); | 18 | exit(1); |
17 | } | 19 | } |
18 | 20 | ||
19 | QFile f(argv[1]); | 21 | QFile f(argv[1]); |
20 | 22 | ||
21 | QCString str; | 23 | Q3CString str; |
22 | 24 | ||
23 | if (!f.open(IO_ReadOnly)) { | 25 | if (!f.open(QIODevice::ReadOnly)) { |
24 | cerr << "Couldn't open file \"" << argv[1] << endl; | 26 | cerr << "Couldn't open file \"" << argv[1] << endl; |
25 | exit(1); | 27 | exit(1); |
26 | } | 28 | } |
27 | 29 | ||
28 | QTextStream t(&f); | 30 | Q3TextStream t(&f); |
29 | 31 | ||
30 | while (!t.eof()) | 32 | while (!t.eof()) |
31 | str += t.readLine().utf8() + '\n'; | 33 | str += t.readLine().utf8() + '\n'; |
32 | 34 | ||
33 | using namespace VCARD; | 35 | using namespace VCARD; |
34 | 36 | ||
35 | // Iterate through all vCards in the file. | 37 | // Iterate through all vCards in the file. |
36 | 38 | ||
37 | cout << "--------- begin ----------" << endl; | 39 | cout << "--------- begin ----------" << endl; |
38 | cout << str.data(); | 40 | cout << str.data(); |
39 | cout << "--------- end ----------" << endl; | 41 | cout << "--------- end ----------" << endl; |
40 | 42 | ||
41 | VCardEntity e(str); | 43 | VCardEntity e(str); |
42 | 44 | ||
43 | VCardListIterator it(e.cardList()); | 45 | VCardListIterator it(e.cardList()); |
44 | 46 | ||
45 | for (; it.current(); ++it) { | 47 | for (; it.current(); ++it) { |
46 | 48 | ||
47 | cerr << "****************** VCARD ********************" << endl; | 49 | cerr << "****************** VCARD ********************" << endl; |
48 | 50 | ||
49 | // Create a vcard using the string representation. | 51 | // Create a vcard using the string representation. |
50 | VCard & v (*it.current()); | 52 | VCard & v (*it.current()); |
51 | 53 | ||
52 | if (v.has(EntityEmail)) { | 54 | if (v.has(EntityEmail)) { |
53 | cerr << "Email parameter found" << endl; | 55 | cerr << "Email parameter found" << endl; |
54 | 56 | ||
55 | QCString s = v.contentLine(EntityEmail)->value()->asString(); | 57 | Q3CString s = v.contentLine(EntityEmail)->value()->asString(); |
56 | 58 | ||
57 | cerr << "Email value == " << s << endl; | 59 | cerr << "Email value == " << s << endl; |
58 | } | 60 | } |
59 | 61 | ||
60 | if (v.has(EntityNickname)) { | 62 | if (v.has(EntityNickname)) { |
61 | cerr << "Nickname parameter found" << endl; | 63 | cerr << "Nickname parameter found" << endl; |
62 | 64 | ||
63 | cerr << "Nickname value == " << | 65 | cerr << "Nickname value == " << |
64 | v.contentLine(EntityNickname)->value()->asString() << | 66 | v.contentLine(EntityNickname)->value()->asString() << |
65 | endl; | 67 | endl; |
66 | } | 68 | } |
67 | 69 | ||
68 | if (v.has(EntityRevision)) { | 70 | if (v.has(EntityRevision)) { |
69 | 71 | ||
70 | cerr << "Revision parameter found" << endl; | 72 | cerr << "Revision parameter found" << endl; |
71 | 73 | ||
72 | DateValue * d = | 74 | DateValue * d = |
73 | (DateValue *) | 75 | (DateValue *) |
74 | v.contentLine(EntityRevision)->value(); | 76 | v.contentLine(EntityRevision)->value(); |
75 | 77 | ||
76 | assert(d != 0); | 78 | assert(d != 0); |
77 | 79 | ||
78 | cerr << "Revision date: " << endl; | 80 | cerr << "Revision date: " << endl; |
79 | cerr << "Day : " << d->day() << endl; | 81 | cerr << "Day : " << d->day() << endl; |
80 | cerr << "Month : " << d->month()<< endl; | 82 | cerr << "Month : " << d->month()<< endl; |
81 | cerr << "Year : " << d->year() << endl; | 83 | cerr << "Year : " << d->year() << endl; |
82 | 84 | ||
83 | if (d->hasTime()) { | 85 | if (d->hasTime()) { |
84 | cerr << "Revision date has a time component" << endl; | 86 | cerr << "Revision date has a time component" << endl; |
85 | cerr << "Revision time: " << endl; | 87 | cerr << "Revision time: " << endl; |
86 | cerr << "Hour : " << d->hour()<< endl; | 88 | cerr << "Hour : " << d->hour()<< endl; |
87 | cerr << "Minute : " << d->minute()<< endl; | 89 | cerr << "Minute : " << d->minute()<< endl; |
88 | cerr << "Second : " << d->second()<< endl; | 90 | cerr << "Second : " << d->second()<< endl; |
89 | 91 | ||
90 | } | 92 | } |
91 | else cerr << "Revision date does NOT have a time component" << endl; | 93 | else cerr << "Revision date does NOT have a time component" << endl; |
92 | } | 94 | } |
93 | 95 | ||
94 | if (v.has(EntityURL)) { | 96 | if (v.has(EntityURL)) { |
95 | cerr << "URL Parameter found" << endl; | 97 | cerr << "URL Parameter found" << endl; |
96 | 98 | ||
97 | cerr << "URL Value == " << | 99 | cerr << "URL Value == " << |
98 | v.contentLine(EntityURL)->value()->asString() << | 100 | v.contentLine(EntityURL)->value()->asString() << |
99 | endl; | 101 | endl; |
100 | 102 | ||
101 | URIValue * urlVal = | 103 | URIValue * urlVal = |
102 | (URIValue *)v.contentLine(EntityURL)->value(); | 104 | (URIValue *)v.contentLine(EntityURL)->value(); |
103 | 105 | ||
104 | assert(urlVal != 0); | 106 | assert(urlVal != 0); |
105 | 107 | ||
106 | cerr << "URL scheme == " << | 108 | cerr << "URL scheme == " << |
107 | urlVal->scheme() << endl; | 109 | urlVal->scheme() << endl; |
108 | 110 | ||
109 | cerr << "URL scheme specific part == " << | 111 | cerr << "URL scheme specific part == " << |
110 | urlVal->schemeSpecificPart() << endl; | 112 | urlVal->schemeSpecificPart() << endl; |
111 | } | 113 | } |
112 | 114 | ||
113 | if (v.has(EntityN)) { | 115 | if (v.has(EntityN)) { |
114 | cerr << "N Parameter found" << endl; | 116 | cerr << "N Parameter found" << endl; |
115 | 117 | ||
116 | NValue * n = | 118 | NValue * n = |
117 | (NValue *)(v.contentLine(EntityN)->value()); | 119 | (NValue *)(v.contentLine(EntityN)->value()); |
118 | 120 | ||
119 | cerr << "Family name == " << n->family()<< endl; | 121 | cerr << "Family name == " << n->family()<< endl; |
120 | cerr << "Given name == " << n->given()<< endl; | 122 | cerr << "Given name == " << n->given()<< endl; |
121 | cerr << "Middle name == " << n->middle()<< endl; | 123 | cerr << "Middle name == " << n->middle()<< endl; |
122 | cerr << "Prefix == " << n->prefix()<< endl; | 124 | cerr << "Prefix == " << n->prefix()<< endl; |
123 | cerr << "Suffix == " << n->suffix()<< endl; | 125 | cerr << "Suffix == " << n->suffix()<< endl; |
124 | } | 126 | } |
125 | 127 | ||
126 | cerr << "***************** END VCARD ******************" << endl; | 128 | cerr << "***************** END VCARD ******************" << endl; |
127 | } | 129 | } |
128 | } | 130 | } |
129 | 131 | ||
diff --git a/kabc/vcard/testwrite.cpp b/kabc/vcard/testwrite.cpp index e4bbe7b..846e51a 100644 --- a/kabc/vcard/testwrite.cpp +++ b/kabc/vcard/testwrite.cpp | |||
@@ -1,41 +1,43 @@ | |||
1 | #include <kaboutdata.h> | 1 | #include <kaboutdata.h> |
2 | #include <kapplication.h> | 2 | #include <kapplication.h> |
3 | #include <kdebug.h> | 3 | #include <kdebug.h> |
4 | #include <klocale.h> | 4 | #include <klocale.h> |
5 | #include <kcmdlineargs.h> | 5 | #include <kcmdlineargs.h> |
6 | 6 | ||
7 | #include <VCard.h> | 7 | #include <VCard.h> |
8 | //Added by qt3to4: | ||
9 | #include <Q3CString> | ||
8 | 10 | ||
9 | int main(int argc,char **argv) | 11 | int main(int argc,char **argv) |
10 | { | 12 | { |
11 | KAboutData aboutData("testwrite",I18N_NOOP("TestWritevCard"),"0.1"); | 13 | KAboutData aboutData("testwrite",I18N_NOOP("TestWritevCard"),"0.1"); |
12 | KCmdLineArgs::init(argc,argv,&aboutData); | 14 | KCmdLineArgs::init(argc,argv,&aboutData); |
13 | 15 | ||
14 | KApplication app; | 16 | KApplication app; |
15 | 17 | ||
16 | kdDebug() << "Test Write VCard" << endl; | 18 | kdDebug() << "Test Write VCard" << endl; |
17 | 19 | ||
18 | using namespace VCARD; | 20 | using namespace VCARD; |
19 | 21 | ||
20 | VCard v; | 22 | VCard v; |
21 | 23 | ||
22 | ContentLine cl1; | 24 | ContentLine cl1; |
23 | cl1.setName(EntityTypeToParamName(EntityName)); | 25 | cl1.setName(EntityTypeToParamName(EntityName)); |
24 | cl1.setValue(new TextValue("Hans Wurst")); | 26 | cl1.setValue(new TextValue("Hans Wurst")); |
25 | v.add(cl1); | 27 | v.add(cl1); |
26 | 28 | ||
27 | ContentLine cl2; | 29 | ContentLine cl2; |
28 | cl2.setName(EntityTypeToParamName(EntityTelephone)); | 30 | cl2.setName(EntityTypeToParamName(EntityTelephone)); |
29 | cl2.setValue(new TelValue("12345")); | 31 | cl2.setValue(new TelValue("12345")); |
30 | ParamList p; | 32 | ParamList p; |
31 | p.append( new TelParam("home") ); | 33 | p.append( new TelParam("home") ); |
32 | p.append( new TelParam("fax") ); | 34 | p.append( new TelParam("fax") ); |
33 | cl2.setParamList( p ); | 35 | cl2.setParamList( p ); |
34 | v.add(cl2); | 36 | v.add(cl2); |
35 | 37 | ||
36 | QCString str = v.asString(); | 38 | Q3CString str = v.asString(); |
37 | 39 | ||
38 | kdDebug() << "--- VCard begin ---" << endl | 40 | kdDebug() << "--- VCard begin ---" << endl |
39 | << str | 41 | << str |
40 | << "--- VCard end ---" << endl; | 42 | << "--- VCard end ---" << endl; |
41 | } | 43 | } |
diff --git a/kabc/vcard21parser.cpp b/kabc/vcard21parser.cpp index 60d02b8..e24a9dc 100644 --- a/kabc/vcard21parser.cpp +++ b/kabc/vcard21parser.cpp | |||
@@ -1,607 +1,613 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Mark Westcott <mark@houseoffish.org> | 3 | Copyright (c) 2001 Mark Westcott <mark@houseoffish.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qmap.h> | 28 | #include <qmap.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | //Added by qt3to4: | ||
31 | #include <Q3ValueList> | ||
30 | #include <kmdcodec.h> | 32 | #include <kmdcodec.h> |
31 | 33 | ||
32 | #include "vcard21parser.h" | 34 | #include "vcard21parser.h" |
33 | #include "vcardconverter.h" | 35 | #include "vcardconverter.h" |
34 | 36 | ||
35 | using namespace KABC; | 37 | using namespace KABC; |
36 | 38 | ||
37 | bool VCardLineX::isValid() const | 39 | bool VCardLineX::isValid() const |
38 | { | 40 | { |
39 | // Invalid: if it is "begin:vcard" or "end:vcard" | 41 | // Invalid: if it is "begin:vcard" or "end:vcard" |
40 | if ( name == VCARD_BEGIN_N || name == VCARD_END_N ) | 42 | if ( name == VCARD_BEGIN_N || name == VCARD_END_N ) |
41 | return false; | 43 | return false; |
42 | 44 | ||
43 | if ( name[0] == 'x' && name[1] == '-' ) // A custom x- line | 45 | if ( name[0] == 'x' && name[1] == '-' ) // A custom x- line |
44 | return true; | 46 | return true; |
45 | 47 | ||
46 | // This is long but it makes it a bit faster (and saves me from using | 48 | // This is long but it makes it a bit faster (and saves me from using |
47 | // a tree which is probably the ideal situation, but a bit memory heavy) | 49 | // a tree which is probably the ideal situation, but a bit memory heavy) |
48 | switch( name[0] ) { | 50 | switch( name[0].unicode() ) { |
49 | case 'a': | 51 | case 'a': |
50 | if ( name == VCARD_ADR && qualified && | 52 | if ( name == VCARD_ADR && qualified && |
51 | (qualifiers.contains(VCARD_ADR_DOM) || | 53 | (qualifiers.contains(VCARD_ADR_DOM) || |
52 | qualifiers.contains(VCARD_ADR_INTL) || | 54 | qualifiers.contains(VCARD_ADR_INTL) || |
53 | qualifiers.contains(VCARD_ADR_POSTAL) || | 55 | qualifiers.contains(VCARD_ADR_POSTAL) || |
54 | qualifiers.contains(VCARD_ADR_HOME) || | 56 | qualifiers.contains(VCARD_ADR_HOME) || |
55 | qualifiers.contains(VCARD_ADR_WORK) || | 57 | qualifiers.contains(VCARD_ADR_WORK) || |
56 | qualifiers.contains(VCARD_ADR_PREF) | 58 | qualifiers.contains(VCARD_ADR_PREF) |
57 | ) ) | 59 | ) ) |
58 | return true; | 60 | return true; |
59 | 61 | ||
60 | if ( name == VCARD_AGENT ) | 62 | if ( name == VCARD_AGENT ) |
61 | return true; | 63 | return true; |
62 | break; | 64 | break; |
63 | 65 | ||
64 | case 'b': | 66 | case 'b': |
65 | if ( name == VCARD_BDAY ) | 67 | if ( name == VCARD_BDAY ) |
66 | return true; | 68 | return true; |
67 | break; | 69 | break; |
68 | 70 | ||
69 | case 'c': | 71 | case 'c': |
70 | if ( name == VCARD_CATEGORIES ) | 72 | if ( name == VCARD_CATEGORIES ) |
71 | return true; | 73 | return true; |
72 | if ( name == VCARD_CLASS && qualified && | 74 | if ( name == VCARD_CLASS && qualified && |
73 | (qualifiers.contains(VCARD_CLASS_PUBLIC) || | 75 | (qualifiers.contains(VCARD_CLASS_PUBLIC) || |
74 | qualifiers.contains(VCARD_CLASS_PRIVATE) || | 76 | qualifiers.contains(VCARD_CLASS_PRIVATE) || |
75 | qualifiers.contains(VCARD_CLASS_CONFIDENTIAL) | 77 | qualifiers.contains(VCARD_CLASS_CONFIDENTIAL) |
76 | ) ) | 78 | ) ) |
77 | return true; | 79 | return true; |
78 | break; | 80 | break; |
79 | 81 | ||
80 | case 'e': | 82 | case 'e': |
81 | if ( name == VCARD_EMAIL && qualified && | 83 | if ( name == VCARD_EMAIL && qualified && |
82 | (qualifiers.contains(VCARD_EMAIL_INTERNET) || | 84 | (qualifiers.contains(VCARD_EMAIL_INTERNET) || |
83 | qualifiers.contains(VCARD_EMAIL_PREF) || | 85 | qualifiers.contains(VCARD_EMAIL_PREF) || |
84 | qualifiers.contains(VCARD_EMAIL_X400) | 86 | qualifiers.contains(VCARD_EMAIL_X400) |
85 | ) ) | 87 | ) ) |
86 | return true; | 88 | return true; |
87 | break; | 89 | break; |
88 | 90 | ||
89 | case 'f': | 91 | case 'f': |
90 | if ( name == VCARD_FN ) | 92 | if ( name == VCARD_FN ) |
91 | return true; | 93 | return true; |
92 | break; | 94 | break; |
93 | 95 | ||
94 | case 'g': | 96 | case 'g': |
95 | if ( name == VCARD_GEO ) | 97 | if ( name == VCARD_GEO ) |
96 | return true; | 98 | return true; |
97 | break; | 99 | break; |
98 | 100 | ||
99 | case 'k': | 101 | case 'k': |
100 | if ( name == VCARD_KEY && qualified && | 102 | if ( name == VCARD_KEY && qualified && |
101 | (qualifiers.contains(VCARD_KEY_X509) || | 103 | (qualifiers.contains(VCARD_KEY_X509) || |
102 | qualifiers.contains(VCARD_KEY_PGP) | 104 | qualifiers.contains(VCARD_KEY_PGP) |
103 | ) ) | 105 | ) ) |
104 | return true; | 106 | return true; |
105 | break; | 107 | break; |
106 | 108 | ||
107 | case 'l': | 109 | case 'l': |
108 | if ( name == VCARD_LABEL ) | 110 | if ( name == VCARD_LABEL ) |
109 | return true; | 111 | return true; |
110 | if ( name == VCARD_LOGO ) | 112 | if ( name == VCARD_LOGO ) |
111 | return true; | 113 | return true; |
112 | break; | 114 | break; |
113 | 115 | ||
114 | case 'm': | 116 | case 'm': |
115 | if ( name == VCARD_MAILER ) | 117 | if ( name == VCARD_MAILER ) |
116 | return true; | 118 | return true; |
117 | break; | 119 | break; |
118 | 120 | ||
119 | case 'n': | 121 | case 'n': |
120 | if ( name == VCARD_N ) | 122 | if ( name == VCARD_N ) |
121 | return true; | 123 | return true; |
122 | if ( name == VCARD_NAME ) | 124 | if ( name == VCARD_NAME ) |
123 | return true; | 125 | return true; |
124 | if ( name == VCARD_NICKNAME ) | 126 | if ( name == VCARD_NICKNAME ) |
125 | return true; | 127 | return true; |
126 | if ( name == VCARD_NOTE ) | 128 | if ( name == VCARD_NOTE ) |
127 | return true; | 129 | return true; |
128 | break; | 130 | break; |
129 | 131 | ||
130 | case 'o': | 132 | case 'o': |
131 | if ( name == VCARD_ORG ) | 133 | if ( name == VCARD_ORG ) |
132 | return true; | 134 | return true; |
133 | break; | 135 | break; |
134 | 136 | ||
135 | case 'p': | 137 | case 'p': |
136 | if ( name == VCARD_PHOTO ) | 138 | if ( name == VCARD_PHOTO ) |
137 | return true; | 139 | return true; |
138 | if ( name == VCARD_PROFILE ) | 140 | if ( name == VCARD_PROFILE ) |
139 | return true; | 141 | return true; |
140 | if ( name == VCARD_PRODID ) | 142 | if ( name == VCARD_PRODID ) |
141 | return true; | 143 | return true; |
142 | break; | 144 | break; |
143 | 145 | ||
144 | case 'r': | 146 | case 'r': |
145 | if ( name == VCARD_ROLE ) | 147 | if ( name == VCARD_ROLE ) |
146 | return true; | 148 | return true; |
147 | if ( name == VCARD_REV ) | 149 | if ( name == VCARD_REV ) |
148 | return true; | 150 | return true; |
149 | break; | 151 | break; |
150 | 152 | ||
151 | case 's': | 153 | case 's': |
152 | if ( name == VCARD_SOURCE ) | 154 | if ( name == VCARD_SOURCE ) |
153 | return true; | 155 | return true; |
154 | if ( name == VCARD_SOUND ) | 156 | if ( name == VCARD_SOUND ) |
155 | return true; | 157 | return true; |
156 | break; | 158 | break; |
157 | 159 | ||
158 | case 't': | 160 | case 't': |
159 | if ( name == VCARD_TEL && qualified && | 161 | if ( name == VCARD_TEL && qualified && |
160 | (qualifiers.contains(VCARD_TEL_HOME) || | 162 | (qualifiers.contains(VCARD_TEL_HOME) || |
161 | qualifiers.contains(VCARD_TEL_WORK) || | 163 | qualifiers.contains(VCARD_TEL_WORK) || |
162 | qualifiers.contains(VCARD_TEL_PREF) || | 164 | qualifiers.contains(VCARD_TEL_PREF) || |
163 | qualifiers.contains(VCARD_TEL_VOICE) || | 165 | qualifiers.contains(VCARD_TEL_VOICE) || |
164 | qualifiers.contains(VCARD_TEL_FAX) || | 166 | qualifiers.contains(VCARD_TEL_FAX) || |
165 | qualifiers.contains(VCARD_TEL_MSG) || | 167 | qualifiers.contains(VCARD_TEL_MSG) || |
166 | qualifiers.contains(VCARD_TEL_CELL) || | 168 | qualifiers.contains(VCARD_TEL_CELL) || |
167 | qualifiers.contains(VCARD_TEL_PAGER) || | 169 | qualifiers.contains(VCARD_TEL_PAGER) || |
168 | qualifiers.contains(VCARD_TEL_BBS) || | 170 | qualifiers.contains(VCARD_TEL_BBS) || |
169 | qualifiers.contains(VCARD_TEL_MODEM) || | 171 | qualifiers.contains(VCARD_TEL_MODEM) || |
170 | qualifiers.contains(VCARD_TEL_CAR) || | 172 | qualifiers.contains(VCARD_TEL_CAR) || |
171 | qualifiers.contains(VCARD_TEL_ISDN) || | 173 | qualifiers.contains(VCARD_TEL_ISDN) || |
172 | qualifiers.contains(VCARD_TEL_VIDEO) || | 174 | qualifiers.contains(VCARD_TEL_VIDEO) || |
173 | qualifiers.contains(VCARD_TEL_PCS) | 175 | qualifiers.contains(VCARD_TEL_PCS) |
174 | ) ) | 176 | ) ) |
175 | return true; | 177 | return true; |
176 | if ( name == VCARD_TZ ) | 178 | if ( name == VCARD_TZ ) |
177 | return true; | 179 | return true; |
178 | if ( name == VCARD_TITLE ) | 180 | if ( name == VCARD_TITLE ) |
179 | return true; | 181 | return true; |
180 | break; | 182 | break; |
181 | 183 | ||
182 | case 'u': | 184 | case 'u': |
183 | if ( name == VCARD_URL ) | 185 | if ( name == VCARD_URL ) |
184 | return true; | 186 | return true; |
185 | if ( name == VCARD_UID ) | 187 | if ( name == VCARD_UID ) |
186 | return true; | 188 | return true; |
187 | break; | 189 | break; |
188 | 190 | ||
189 | case 'v': | 191 | case 'v': |
190 | if ( name == VCARD_VERSION ) | 192 | if ( name == VCARD_VERSION ) |
191 | return true; | 193 | return true; |
192 | break; | 194 | break; |
193 | default: | 195 | default: |
194 | break; | 196 | break; |
195 | } | 197 | } |
196 | 198 | ||
197 | return false; | 199 | return false; |
198 | } | 200 | } |
199 | 201 | ||
200 | 202 | ||
201 | VCard21Parser::VCard21Parser() | 203 | VCard21Parser::VCard21Parser() |
202 | { | 204 | { |
203 | } | 205 | } |
204 | 206 | ||
205 | VCard21Parser::~VCard21Parser() | 207 | VCard21Parser::~VCard21Parser() |
206 | { | 208 | { |
207 | } | 209 | } |
208 | 210 | ||
209 | void VCard21Parser::readFromString(KABC::AddressBook *addressbook, const QString &data) | 211 | void VCard21Parser::readFromString(KABC::AddressBook *addressbook, const QString &data) |
210 | { | 212 | { |
211 | KABC::Addressee mAddressee = readFromString(data); | 213 | KABC::Addressee mAddressee = readFromString(data); |
212 | addressbook->insertAddressee(mAddressee); | 214 | addressbook->insertAddressee(mAddressee); |
213 | } | 215 | } |
214 | 216 | ||
215 | KABC::Addressee VCard21Parser::readFromString( const QString &data) | 217 | KABC::Addressee VCard21Parser::readFromString( const QString &data) |
216 | { | 218 | { |
217 | KABC::Addressee addressee; | 219 | KABC::Addressee addressee; |
218 | VCard21ParserImpl *mVCard = VCard21ParserImpl::parseVCard(data); | 220 | VCard21ParserImpl *mVCard = VCard21ParserImpl::parseVCard(data); |
219 | QString tmpStr; | 221 | QString tmpStr; |
220 | 222 | ||
221 | // Check if parsing failed | 223 | // Check if parsing failed |
222 | if (mVCard == 0) | 224 | if (mVCard == 0) |
223 | { | 225 | { |
224 | kdDebug() << "Parsing failed" << endl; | 226 | kdDebug() << "Parsing failed" << endl; |
225 | return addressee; | 227 | return addressee; |
226 | } | 228 | } |
227 | //set the addressees name and formated name | 229 | //set the addressees name and formated name |
228 | QStringList tmpList = mVCard->getValues(VCARD_N); | 230 | QStringList tmpList = mVCard->getValues(VCARD_N); |
229 | QString formattedName = ""; | 231 | QString formattedName = ""; |
230 | if (tmpList.count() > 0) | 232 | if (tmpList.count() > 0) |
231 | addressee.setFamilyName(tmpList[0]); | 233 | addressee.setFamilyName(tmpList[0]); |
232 | if (tmpList.count() > 1) | 234 | if (tmpList.count() > 1) |
233 | addressee.setGivenName(tmpList[1]); | 235 | addressee.setGivenName(tmpList[1]); |
234 | if (tmpList.count() > 2) | 236 | if (tmpList.count() > 2) |
235 | addressee.setAdditionalName(tmpList[2]); | 237 | addressee.setAdditionalName(tmpList[2]); |
236 | if (tmpList.count() > 3) | 238 | if (tmpList.count() > 3) |
237 | addressee.setPrefix(tmpList[3]); | 239 | addressee.setPrefix(tmpList[3]); |
238 | if (tmpList.count() > 4) | 240 | if (tmpList.count() > 4) |
239 | addressee.setSuffix(tmpList[4]); | 241 | addressee.setSuffix(tmpList[4]); |
240 | 242 | ||
241 | tmpStr = (mVCard->getValue(VCARD_FN)); | 243 | tmpStr = (mVCard->getValue(VCARD_FN)); |
242 | if (!tmpStr.isEmpty()) | 244 | if (!tmpStr.isEmpty()) |
243 | addressee.setFormattedName(tmpStr); | 245 | addressee.setFormattedName(tmpStr); |
244 | 246 | ||
245 | //set the addressee's nick name | 247 | //set the addressee's nick name |
246 | tmpStr = mVCard->getValue(VCARD_NICKNAME); | 248 | tmpStr = mVCard->getValue(VCARD_NICKNAME); |
247 | addressee.setNickName(tmpStr); | 249 | addressee.setNickName(tmpStr); |
248 | //set the addressee's organisation | 250 | //set the addressee's organisation |
249 | tmpStr = mVCard->getValue(VCARD_ORG); | 251 | tmpStr = mVCard->getValue(VCARD_ORG); |
250 | addressee.setOrganization(tmpStr); | 252 | addressee.setOrganization(tmpStr); |
251 | //set the addressee's title | 253 | //set the addressee's title |
252 | tmpStr = mVCard->getValue(VCARD_TITLE); | 254 | tmpStr = mVCard->getValue(VCARD_TITLE); |
253 | addressee.setTitle(tmpStr); | 255 | addressee.setTitle(tmpStr); |
254 | //set the addressee's email - we can only deal with two. The preferenced one and one other. | 256 | //set the addressee's email - we can only deal with two. The preferenced one and one other. |
255 | tmpStr = mVCard->getValue(VCARD_EMAIL, VCARD_EMAIL_INTERNET); | 257 | tmpStr = mVCard->getValue(VCARD_EMAIL, VCARD_EMAIL_INTERNET); |
256 | addressee.insertEmail(tmpStr, false); | 258 | addressee.insertEmail(tmpStr, false); |
257 | tmpStr = mVCard->getValue(VCARD_EMAIL,VCARD_EMAIL_PREF); | 259 | tmpStr = mVCard->getValue(VCARD_EMAIL,VCARD_EMAIL_PREF); |
258 | addressee.insertEmail(tmpStr, true); | 260 | addressee.insertEmail(tmpStr, true); |
259 | //set the addressee's url | 261 | //set the addressee's url |
260 | tmpStr = mVCard->getValue(VCARD_URL); | 262 | tmpStr = mVCard->getValue(VCARD_URL); |
261 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_WORK); | 263 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_WORK); |
262 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_HOME); | 264 | if (tmpStr.isEmpty()) tmpStr = mVCard->getValue(VCARD_URL, VCARD_ADR_HOME); |
263 | if (!tmpStr.isEmpty()) { | 265 | if (!tmpStr.isEmpty()) { |
264 | addressee.setUrl(KURL(tmpStr)); | 266 | addressee.setUrl(KURL(tmpStr)); |
265 | } | 267 | } |
266 | 268 | ||
267 | //set the addressee's birthday | 269 | //set the addressee's birthday |
268 | tmpStr = mVCard->getValue(VCARD_BDAY); | 270 | tmpStr = mVCard->getValue(VCARD_BDAY); |
269 | addressee.setBirthday(VCardStringToDate(tmpStr)); | 271 | addressee.setBirthday(VCardStringToDate(tmpStr)); |
270 | 272 | ||
271 | //set the addressee's phone numbers | 273 | //set the addressee's phone numbers |
272 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { | 274 | for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { |
273 | if ( (*i).name == VCARD_TEL ) { | 275 | if ( (*i).name == VCARD_TEL ) { |
274 | int type = 0; | 276 | int type = 0; |
275 | if ( (*i).qualified ) { | 277 | if ( (*i).qualified ) { |
276 | if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) ) | 278 | if ( (*i).qualifiers.contains( VCARD_TEL_HOME ) ) |
277 | type |= PhoneNumber::Home; | 279 | type |= PhoneNumber::Home; |
278 | if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) ) | 280 | if ( (*i).qualifiers.contains( VCARD_TEL_WORK ) ) |
279 | type |= PhoneNumber::Work; | 281 | type |= PhoneNumber::Work; |
280 | if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) | 282 | if ( (*i).qualifiers.contains( VCARD_TEL_PREF ) ) |
281 | type |= PhoneNumber::Pref; | 283 | type |= PhoneNumber::Pref; |
282 | if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) | 284 | if ( (*i).qualifiers.contains( VCARD_TEL_VOICE ) ) |
283 | type |= PhoneNumber::Voice; | 285 | type |= PhoneNumber::Voice; |
284 | if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) | 286 | if ( (*i).qualifiers.contains( VCARD_TEL_FAX ) ) |
285 | type |= PhoneNumber::Fax; | 287 | type |= PhoneNumber::Fax; |
286 | if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) | 288 | if ( (*i).qualifiers.contains( VCARD_TEL_MSG ) ) |
287 | type |= PhoneNumber::Msg; | 289 | type |= PhoneNumber::Msg; |
288 | if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) | 290 | if ( (*i).qualifiers.contains( VCARD_TEL_CELL ) ) |
289 | type |= PhoneNumber::Cell; | 291 | type |= PhoneNumber::Cell; |
290 | if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) ) | 292 | if ( (*i).qualifiers.contains( VCARD_TEL_PAGER ) ) |
291 | type |= PhoneNumber::Pager; | 293 | type |= PhoneNumber::Pager; |
292 | if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) ) | 294 | if ( (*i).qualifiers.contains( VCARD_TEL_BBS ) ) |
293 | type |= PhoneNumber::Bbs; | 295 | type |= PhoneNumber::Bbs; |
294 | if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) ) | 296 | if ( (*i).qualifiers.contains( VCARD_TEL_MODEM ) ) |
295 | type |= PhoneNumber::Modem; | 297 | type |= PhoneNumber::Modem; |
296 | if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) | 298 | if ( (*i).qualifiers.contains( VCARD_TEL_CAR ) ) |
297 | type |= PhoneNumber::Car; | 299 | type |= PhoneNumber::Car; |
298 | if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) | 300 | if ( (*i).qualifiers.contains( VCARD_TEL_ISDN ) ) |
299 | type |= PhoneNumber::Isdn; | 301 | type |= PhoneNumber::Isdn; |
300 | if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) | 302 | if ( (*i).qualifiers.contains( VCARD_TEL_VIDEO ) ) |
301 | type |= PhoneNumber::Video; | 303 | type |= PhoneNumber::Video; |
302 | if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) | 304 | if ( (*i).qualifiers.contains( VCARD_TEL_PCS ) ) |
303 | type |= PhoneNumber::Pcs; | 305 | type |= PhoneNumber::Pcs; |
304 | 306 | ||
305 | } | 307 | } |
306 | addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); | 308 | addressee.insertPhoneNumber( PhoneNumber( (*i).parameters[ 0 ], type ) ); |
307 | } | 309 | } |
308 | } | 310 | } |
309 | addressee.makePhoneNumbersOLcompatible(); | 311 | addressee.makePhoneNumbersOLcompatible(); |
310 | //set the addressee's addresses | 312 | //set the addressee's addresses |
311 | for ( QValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { | 313 | for ( Q3ValueListIterator<VCardLineX> i = mVCard->_vcdata->begin();i != mVCard->_vcdata->end(); ++i ) { |
312 | if ( (*i).name == VCARD_ADR ) { | 314 | if ( (*i).name == VCARD_ADR ) { |
313 | int type = 0; | 315 | int type = 0; |
314 | if ( (*i).qualified ) { | 316 | if ( (*i).qualified ) { |
315 | if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) | 317 | if ( (*i).qualifiers.contains( VCARD_ADR_DOM ) ) |
316 | type |= Address::Dom; | 318 | type |= Address::Dom; |
317 | if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) | 319 | if ( (*i).qualifiers.contains( VCARD_ADR_INTL ) ) |
318 | type |= Address::Intl; | 320 | type |= Address::Intl; |
319 | if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) | 321 | if ( (*i).qualifiers.contains( VCARD_ADR_POSTAL ) ) |
320 | type |= Address::Postal; | 322 | type |= Address::Postal; |
321 | if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) | 323 | if ( (*i).qualifiers.contains( VCARD_ADR_PARCEL ) ) |
322 | type |= Address::Parcel; | 324 | type |= Address::Parcel; |
323 | if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) | 325 | if ( (*i).qualifiers.contains( VCARD_ADR_HOME ) ) |
324 | type |= Address::Home; | 326 | type |= Address::Home; |
325 | if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) | 327 | if ( (*i).qualifiers.contains( VCARD_ADR_WORK ) ) |
326 | type |= Address::Work; | 328 | type |= Address::Work; |
327 | if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) | 329 | if ( (*i).qualifiers.contains( VCARD_ADR_PREF ) ) |
328 | type |= Address::Pref; | 330 | type |= Address::Pref; |
329 | } | 331 | } |
330 | addressee.insertAddress( readAddressFromQStringList( (*i).parameters, type ) ); | 332 | QStringList tmp; |
333 | for(Q3ValueList<QString>::const_iterator ii=(*i).parameters.begin();ii!=(*i).parameters.end();++ii) | ||
334 | tmp.push_back(*ii); | ||
335 | addressee.insertAddress( readAddressFromQStringList( tmp, type ) ); | ||
331 | } | 336 | } |
332 | } | 337 | } |
333 | 338 | ||
334 | //set the addressee's delivery label | 339 | //set the addressee's delivery label |
335 | tmpStr = mVCard->getValue(VCARD_LABEL); | 340 | tmpStr = mVCard->getValue(VCARD_LABEL); |
336 | if (!tmpStr.isEmpty()) { | 341 | if (!tmpStr.isEmpty()) { |
337 | qDebug("VCard21Parser::readFromString please verify if replace is correct"); | 342 | qDebug("VCard21Parser::readFromString please verify if replace is correct"); |
338 | //US tmpStr.replace("\r\n","\n"); | 343 | //US tmpStr.replace("\r\n","\n"); |
339 | tmpStr.replace( QRegExp("\r\n"), "\n" ); | 344 | tmpStr.replace( QRegExp("\r\n"), "\n" ); |
340 | Address tmpAddress; | 345 | Address tmpAddress; |
341 | tmpAddress.setLabel(tmpStr); | 346 | tmpAddress.setLabel(tmpStr); |
342 | addressee.insertAddress(tmpAddress); | 347 | addressee.insertAddress(tmpAddress); |
343 | } | 348 | } |
344 | 349 | ||
345 | //set the addressee's notes | 350 | //set the addressee's notes |
346 | tmpStr = mVCard->getValue(VCARD_NOTE); | 351 | tmpStr = mVCard->getValue(VCARD_NOTE); |
347 | qDebug("VCard21Parser::readFromString please verify if correct"); | 352 | qDebug("VCard21Parser::readFromString please verify if correct"); |
348 | //US tmpStr.replace("\r\n","\n"); | 353 | //US tmpStr.replace("\r\n","\n"); |
349 | tmpStr.replace( QRegExp("\r\n"), "\n" ); | 354 | tmpStr.replace( QRegExp("\r\n"), "\n" ); |
350 | addressee.setNote(tmpStr); | 355 | addressee.setNote(tmpStr); |
351 | 356 | ||
352 | //set the addressee's timezone | 357 | //set the addressee's timezone |
353 | tmpStr = mVCard->getValue(VCARD_TZ); | 358 | tmpStr = mVCard->getValue(VCARD_TZ); |
354 | TimeZone tmpZone(tmpStr.toInt()); | 359 | TimeZone tmpZone(tmpStr.toInt()); |
355 | addressee.setTimeZone(tmpZone); | 360 | addressee.setTimeZone(tmpZone); |
356 | 361 | ||
357 | //set the addressee's geographical position | 362 | //set the addressee's geographical position |
358 | tmpList = mVCard->getValues(VCARD_GEO); | 363 | tmpList = mVCard->getValues(VCARD_GEO); |
359 | if (tmpList.count()==2) | 364 | if (tmpList.count()==2) |
360 | { | 365 | { |
361 | tmpStr = tmpList[0]; | 366 | tmpStr = tmpList[0]; |
362 | float glat = tmpStr.toFloat(); | 367 | float glat = tmpStr.toFloat(); |
363 | tmpStr = tmpList[1]; | 368 | tmpStr = tmpList[1]; |
364 | float glong = tmpStr.toFloat(); | 369 | float glong = tmpStr.toFloat(); |
365 | Geo tmpGeo(glat,glong); | 370 | Geo tmpGeo(glat,glong); |
366 | addressee.setGeo(tmpGeo); | 371 | addressee.setGeo(tmpGeo); |
367 | } | 372 | } |
368 | 373 | ||
369 | //set the last revision date | 374 | //set the last revision date |
370 | tmpStr = mVCard->getValue(VCARD_REV); | 375 | tmpStr = mVCard->getValue(VCARD_REV); |
371 | addressee.setRevision(VCardStringToDate(tmpStr)); | 376 | addressee.setRevision(VCardStringToDate(tmpStr)); |
372 | 377 | ||
373 | //set the role of the addressee | 378 | //set the role of the addressee |
374 | tmpStr = mVCard->getValue(VCARD_ROLE); | 379 | tmpStr = mVCard->getValue(VCARD_ROLE); |
375 | addressee.setRole(tmpStr); | 380 | addressee.setRole(tmpStr); |
376 | 381 | ||
377 | return addressee; | 382 | return addressee; |
378 | } | 383 | } |
379 | 384 | ||
380 | 385 | ||
381 | 386 | ||
382 | KABC::Address VCard21Parser::readAddressFromQStringList ( const QStringList &data, const int type ) | 387 | KABC::Address VCard21Parser::readAddressFromQStringList ( const QStringList &data, const int type ) |
383 | { | 388 | { |
384 | KABC::Address mAddress; | 389 | KABC::Address mAddress; |
385 | mAddress.setType( type ); | 390 | mAddress.setType( type ); |
386 | 391 | ||
387 | if ( data.count() > 0 ) | 392 | if ( data.count() > 0 ) |
388 | mAddress.setPostOfficeBox( data[0] ); | 393 | mAddress.setPostOfficeBox( data[0] ); |
389 | if ( data.count() > 1 ) | 394 | if ( data.count() > 1 ) |
390 | mAddress.setExtended( data[1] ); | 395 | mAddress.setExtended( data[1] ); |
391 | if ( data.count() > 2 ) | 396 | if ( data.count() > 2 ) |
392 | mAddress.setStreet( data[2] ); | 397 | mAddress.setStreet( data[2] ); |
393 | if ( data.count() > 3 ) | 398 | if ( data.count() > 3 ) |
394 | mAddress.setLocality( data[3] ); | 399 | mAddress.setLocality( data[3] ); |
395 | if ( data.count() > 4 ) | 400 | if ( data.count() > 4 ) |
396 | mAddress.setRegion( data[4] ); | 401 | mAddress.setRegion( data[4] ); |
397 | if ( data.count() > 5 ) | 402 | if ( data.count() > 5 ) |
398 | mAddress.setPostalCode( data[5] ); | 403 | mAddress.setPostalCode( data[5] ); |
399 | if ( data.count() > 6 ) | 404 | if ( data.count() > 6 ) |
400 | mAddress.setCountry( data[6] ); | 405 | mAddress.setCountry( data[6] ); |
401 | 406 | ||
402 | return mAddress; | 407 | return mAddress; |
403 | } | 408 | } |
404 | 409 | ||
405 | 410 | ||
406 | VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err ) | 411 | VCard21ParserImpl *VCard21ParserImpl::parseVCard( const QString& vc, int *err ) |
407 | { | 412 | { |
408 | int _err = 0; | 413 | int _err = 0; |
409 | int _state = VC_STATE_BEGIN; | 414 | int _state = VC_STATE_BEGIN; |
410 | 415 | ||
411 | QValueList<VCardLineX> *_vcdata; | 416 | Q3ValueList<VCardLineX> *_vcdata; |
412 | QValueList<QString> lines; | 417 | QStringList lines; |
413 | 418 | ||
414 | _vcdata = new QValueList<VCardLineX>; | 419 | _vcdata = new Q3ValueList<VCardLineX>; |
415 | 420 | ||
416 | lines = QStringList::split( QRegExp( "[\x0d\x0a]" ), vc ); | 421 | lines = QStringList::split( QRegExp( "[\x0d\x0a]" ), vc ); |
417 | 422 | ||
418 | // for each line in the vCard | 423 | // for each line in the vCard |
419 | for ( QStringList::Iterator j = lines.begin(); j != lines.end(); ++j ) { | 424 | for ( QStringList::Iterator j = lines.begin(); j != lines.end(); ++j ) { |
420 | VCardLineX _vcl; | 425 | VCardLineX _vcl; |
421 | 426 | ||
422 | // take spaces off the end - ugly but necessary hack | 427 | // take spaces off the end - ugly but necessary hack |
423 | for ( int g = (*j).length()-1; g > 0 && (*j)[g].isSpace(); --g ) | 428 | for ( int g = (*j).length()-1; g > 0 && (*j)[g].isSpace(); --g ) |
424 | (*j)[g] = 0; | 429 | (*j)[g] = 0; |
425 | 430 | ||
426 | // first token: | 431 | // first token: |
427 | // verify state, update if necessary | 432 | // verify state, update if necessary |
428 | if ( _state & VC_STATE_BEGIN) { | 433 | if ( _state & VC_STATE_BEGIN) { |
429 | if ( !qstricmp( (*j).latin1(), VCARD_BEGIN ) ) { | 434 | if ( !qstricmp( (*j).latin1(), VCARD_BEGIN ) ) { |
430 | _state = VC_STATE_BODY; | 435 | _state = VC_STATE_BODY; |
431 | continue; | 436 | continue; |
432 | } else { | 437 | } else { |
433 | _err = VC_ERR_NO_BEGIN; | 438 | _err = VC_ERR_NO_BEGIN; |
434 | break; | 439 | break; |
435 | } | 440 | } |
436 | } else if ( _state & VC_STATE_BODY ) { | 441 | } else if ( _state & VC_STATE_BODY ) { |
437 | if ( !qstricmp( (*j).latin1(), VCARD_END ) ) { | 442 | if ( !qstricmp( (*j).latin1(), VCARD_END ) ) { |
438 | _state |= VC_STATE_END; | 443 | _state |= VC_STATE_END; |
439 | break; | 444 | break; |
440 | } | 445 | } |
441 | 446 | ||
442 | // split into two tokens | 447 | // split into two tokens |
443 | int colon = (*j).find( ':' ); | 448 | int colon = (*j).find( ':' ); |
444 | if ( colon < 0 ) { | 449 | if ( colon < 0 ) { |
445 | _err = VC_ERR_INVALID_LINE; | 450 | _err = VC_ERR_INVALID_LINE; |
446 | break; | 451 | break; |
447 | } | 452 | } |
448 | 453 | ||
449 | QString key = (*j).left( colon ); | 454 | QString key = (*j).left( colon ); |
450 | QString value = (*j).mid( colon + 1 ); | 455 | QString value = (*j).mid( colon + 1 ); |
451 | 456 | ||
452 | // check for qualifiers and | 457 | // check for qualifiers and |
453 | // set name, qualified, qualifier(s) | 458 | // set name, qualified, qualifier(s) |
454 | QStringList keyTokens = QStringList::split( ';', key ); | 459 | QStringList keyTokens = QStringList::split( ';', key ); |
455 | bool qp = false, first_pass = true; | 460 | bool qp = false, first_pass = true; |
456 | bool b64 = false; | 461 | bool b64 = false; |
457 | 462 | ||
458 | if ( keyTokens.count() > 0 ) { | 463 | if ( keyTokens.count() > 0 ) { |
459 | _vcl.qualified = false; | 464 | _vcl.qualified = false; |
460 | _vcl.name = keyTokens[ 0 ].lower(); | 465 | _vcl.name = keyTokens[ 0 ].lower(); |
461 | 466 | ||
462 | for ( QStringList::Iterator z = keyTokens.begin(); z != keyTokens.end(); ++z ) { | 467 | for ( QStringList::Iterator z = keyTokens.begin(); z != keyTokens.end(); ++z ) { |
463 | QString zz = (*z).lower(); | 468 | QString zz = (*z).lower(); |
464 | if ( zz == VCARD_QUOTED_PRINTABLE || zz == VCARD_ENCODING_QUOTED_PRINTABLE ) { | 469 | if ( zz == VCARD_QUOTED_PRINTABLE || zz == VCARD_ENCODING_QUOTED_PRINTABLE ) { |
465 | qp = true; | 470 | qp = true; |
466 | } else if ( zz == VCARD_BASE64 ) { | 471 | } else if ( zz == VCARD_BASE64 ) { |
467 | b64 = true; | 472 | b64 = true; |
468 | } else if ( !first_pass ) { | 473 | } else if ( !first_pass ) { |
469 | _vcl.qualified = true; | 474 | _vcl.qualified = true; |
470 | _vcl.qualifiers.append( zz ); | 475 | _vcl.qualifiers.append( zz ); |
471 | } | 476 | } |
472 | first_pass = false; | 477 | first_pass = false; |
473 | } | 478 | } |
474 | } else { | 479 | } else { |
475 | _err = VC_ERR_INVALID_LINE; | 480 | _err = VC_ERR_INVALID_LINE; |
476 | } | 481 | } |
477 | 482 | ||
478 | if ( _err != 0 ) | 483 | if ( _err != 0 ) |
479 | break; | 484 | break; |
480 | 485 | ||
481 | if ( _vcl.name == VCARD_VERSION ) | 486 | if ( _vcl.name == VCARD_VERSION ) |
482 | _state |= VC_STATE_HAVE_VERSION; | 487 | _state |= VC_STATE_HAVE_VERSION; |
483 | 488 | ||
484 | if ( _vcl.name == VCARD_N || _vcl.name == VCARD_FN ) | 489 | if ( _vcl.name == VCARD_N || _vcl.name == VCARD_FN ) |
485 | _state |= VC_STATE_HAVE_N; | 490 | _state |= VC_STATE_HAVE_N; |
486 | 491 | ||
487 | // second token: | 492 | // second token: |
488 | // split into tokens by ; | 493 | // split into tokens by ; |
489 | // add to parameters vector | 494 | // add to parameters vector |
490 | if ( b64 ) { | 495 | if ( b64 ) { |
491 | if ( value.at( value.length() - 1 ) != '=' ) | 496 | if ( value.at( value.length() - 1 ) != '=' ) |
492 | do { | 497 | do { |
493 | value += *( ++j ); | 498 | value += *( ++j ); |
494 | } while ( (*j).at( (*j).length() - 1 ) != '=' ); | 499 | } while ( (*j).at( (*j).length() - 1 ) != '=' ); |
495 | } else { | 500 | } else { |
496 | if ( qp ) { // join any split lines | 501 | if ( qp ) { // join any split lines |
497 | while ( value.at( value.length() - 1 ) == '=' ) { | 502 | while ( value.at( value.length() - 1 ) == '=' ) { |
498 | value.remove( value.length() - 1, 1 ); | 503 | value.remove( value.length() - 1, 1 ); |
499 | value.append(*( ++j )); | 504 | value.append(*( ++j )); |
500 | } | 505 | } |
501 | } | 506 | } |
502 | _vcl.parameters = QStringList::split( ';', value, true ); | 507 | _vcl.parameters = QStringList::split( ';', value, true ); |
503 | if ( qp ) { // decode the quoted printable | 508 | if ( qp ) { // decode the quoted printable |
504 | for ( QStringList::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z ) | 509 | for ( QLinkedList<QString>::Iterator z = _vcl.parameters.begin(); z != _vcl.parameters.end(); ++z ) |
505 | *z = KCodecs::quotedPrintableDecode( (*z).latin1() ); | 510 | *z = KCodecs::quotedPrintableDecode( (Q3CString)(*z).latin1() ); |
506 | } | 511 | } |
507 | } | 512 | } |
508 | } else { | 513 | } else { |
509 | _err = VC_ERR_INTERNAL; | 514 | _err = VC_ERR_INTERNAL; |
510 | break; | 515 | break; |
511 | } | 516 | } |
512 | 517 | ||
513 | // validate VCardLineX | 518 | // validate VCardLineX |
514 | if ( !_vcl.isValid() ) { | 519 | if ( !_vcl.isValid() ) { |
515 | _err = VC_ERR_INVALID_LINE; | 520 | _err = VC_ERR_INVALID_LINE; |
516 | break; | 521 | break; |
517 | } | 522 | } |
518 | 523 | ||
519 | // add to vector | 524 | // add to vector |
520 | _vcdata->append( _vcl ); | 525 | _vcdata->append( _vcl ); |
521 | } | 526 | } |
522 | 527 | ||
523 | // errors to check at the last minute (exit state related) | 528 | // errors to check at the last minute (exit state related) |
524 | if ( _err == 0 ) { | 529 | if ( _err == 0 ) { |
525 | if ( !( _state & VC_STATE_END ) ) // we have to have an end!! | 530 | if ( !( _state & VC_STATE_END ) ) // we have to have an end!! |
526 | _err = VC_ERR_NO_END; | 531 | _err = VC_ERR_NO_END; |
527 | 532 | ||
528 | if ( !( _state & VC_STATE_HAVE_N ) || // we have to have the mandatories! | 533 | if ( !( _state & VC_STATE_HAVE_N ) || // we have to have the mandatories! |
529 | !( _state & VC_STATE_HAVE_VERSION ) ) | 534 | !( _state & VC_STATE_HAVE_VERSION ) ) |
530 | _err = VC_ERR_MISSING_MANDATORY; | 535 | _err = VC_ERR_MISSING_MANDATORY; |
531 | } | 536 | } |
532 | 537 | ||
533 | // set the error message if we can, and only return an object | 538 | // set the error message if we can, and only return an object |
534 | // if the vCard was valid. | 539 | // if the vCard was valid. |
535 | if ( err ) | 540 | if ( err ) |
536 | *err = _err; | 541 | *err = _err; |
537 | 542 | ||
538 | if ( _err != 0 ) { | 543 | if ( _err != 0 ) { |
539 | delete _vcdata; | 544 | delete _vcdata; |
540 | return 0; | 545 | return 0; |
541 | } | 546 | } |
542 | 547 | ||
543 | return new VCard21ParserImpl( _vcdata ); | 548 | return new VCard21ParserImpl( _vcdata ); |
544 | } | 549 | } |
545 | 550 | ||
546 | VCard21ParserImpl::VCard21ParserImpl(QValueList<VCardLineX> *_vcd) : _vcdata(_vcd) | 551 | VCard21ParserImpl::VCard21ParserImpl(Q3ValueList<VCardLineX> *_vcd) : _vcdata(_vcd) |
547 | { | 552 | { |
548 | } | 553 | } |
549 | 554 | ||
550 | 555 | ||
551 | QString VCard21ParserImpl::getValue(const QString& name, const QString& qualifier) | 556 | QString VCard21ParserImpl::getValue(const QString& name, const QString& qualifier) |
552 | { | 557 | { |
553 | QString failed; | 558 | QString failed; |
554 | const QString lowname = name.lower(); | 559 | const QString lowname = name.lower(); |
555 | const QString lowqualifier = qualifier.lower(); | 560 | const QString lowqualifier = qualifier.lower(); |
556 | 561 | ||
557 | for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { | 562 | for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { |
558 | if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) { | 563 | if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) { |
559 | if ((*i).parameters.count() > 0) | 564 | if ((*i).parameters.count() > 0) |
560 | return (*i).parameters[0]; | 565 | return (*i).parameters[0]; |
561 | else return failed; | 566 | else return failed; |
562 | } | 567 | } |
563 | } | 568 | } |
564 | return failed; | 569 | return failed; |
565 | } | 570 | } |
566 | 571 | ||
567 | 572 | ||
568 | QString VCard21ParserImpl::getValue(const QString& name) | 573 | QString VCard21ParserImpl::getValue(const QString& name) |
569 | { | 574 | { |
570 | QString failed; | 575 | QString failed; |
571 | const QString lowname = name.lower(); | 576 | const QString lowname = name.lower(); |
572 | 577 | ||
573 | for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { | 578 | for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { |
574 | if ((*i).name == lowname && !(*i).qualified) { | 579 | if ((*i).name == lowname && !(*i).qualified) { |
575 | if ((*i).parameters.count() > 0) | 580 | if ((*i).parameters.count() > 0) |
576 | return (*i).parameters[0]; | 581 | return (*i).parameters[0]; |
577 | else return failed; | 582 | else return failed; |
578 | } | 583 | } |
579 | } | 584 | } |
580 | return failed; | 585 | return failed; |
581 | } | 586 | } |
582 | 587 | ||
583 | 588 | ||
584 | QStringList VCard21ParserImpl::getValues(const QString& name) | 589 | QStringList VCard21ParserImpl::getValues(const QString& name) |
585 | { | 590 | { |
586 | const QString lowname = name.lower(); | 591 | const QString lowname = name.lower(); |
587 | for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { | 592 | for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { |
588 | if ((*i).name == lowname && !(*i).qualified) | 593 | if ((*i).name == lowname && !(*i).qualified) { |
589 | return (*i).parameters; | 594 | return QStringList( (*i).parameters ); |
595 | } | ||
590 | } | 596 | } |
591 | // failed. | 597 | // failed. |
592 | return QStringList(); | 598 | return QStringList(); |
593 | } | 599 | } |
594 | 600 | ||
595 | QStringList VCard21ParserImpl::getValues(const QString& name, const QString& qualifier) | 601 | QStringList VCard21ParserImpl::getValues(const QString& name, const QString& qualifier) |
596 | { | 602 | { |
597 | const QString lowname = name.lower(); | 603 | const QString lowname = name.lower(); |
598 | const QString lowqualifier = qualifier.lower(); | 604 | const QString lowqualifier = qualifier.lower(); |
599 | for (QValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { | 605 | for (Q3ValueListIterator<VCardLineX> i = _vcdata->begin();i != _vcdata->end();++i) { |
600 | if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) | 606 | if ((*i).name == lowname && (*i).qualified && (*i).qualifiers.contains(lowqualifier)) |
601 | return (*i).parameters; | 607 | return QStringList( (*i).parameters ); |
602 | } | 608 | } |
603 | // failed. | 609 | // failed. |
604 | return QStringList(); | 610 | return QStringList(); |
605 | } | 611 | } |
606 | 612 | ||
607 | 613 | ||
diff --git a/kabc/vcard21parser.h b/kabc/vcard21parser.h index 77e69b6..80ba6ef 100644 --- a/kabc/vcard21parser.h +++ b/kabc/vcard21parser.h | |||
@@ -1,226 +1,226 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | 3 | ||
4 | Copyright (c) 2002 Mark Westcott <mark@houseoffish.org> | 4 | Copyright (c) 2002 Mark Westcott <mark@houseoffish.org> |
5 | Copyright (c) 2000 George Staikos <staikos@kde.org> | 5 | Copyright (c) 2000 George Staikos <staikos@kde.org> |
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 | #ifndef KABC_VCARD21FORMAT_H | 29 | #ifndef KABC_VCARD21FORMAT_H |
30 | #define KABC_VCARD21FORMAT_H | 30 | #define KABC_VCARD21FORMAT_H |
31 | 31 | ||
32 | #include <qdatetime.h> | 32 | #include <qdatetime.h> |
33 | #include <kdebug.h> | 33 | #include <kdebug.h> |
34 | #include <qregexp.h> | 34 | #include <qregexp.h> |
35 | #include <qstring.h> | 35 | #include <qstring.h> |
36 | #include <kurl.h> | 36 | #include <kurl.h> |
37 | #include <qvaluelist.h> | 37 | #include <q3valuelist.h> |
38 | 38 | ||
39 | #include "addressee.h" | 39 | #include "addressee.h" |
40 | #include "addressbook.h" | 40 | #include "addressbook.h" |
41 | #include "phonenumber.h" | 41 | #include "phonenumber.h" |
42 | 42 | ||
43 | 43 | ||
44 | #define VCARD_BEGIN "begin:vcard" | 44 | #define VCARD_BEGIN "begin:vcard" |
45 | #define VCARD_END "end:vcard" | 45 | #define VCARD_END "end:vcard" |
46 | #define VCARD_BEGIN_N "begin" | 46 | #define VCARD_BEGIN_N "begin" |
47 | #define VCARD_END_N "end" | 47 | #define VCARD_END_N "end" |
48 | #define VCARD_VERSION "version" | 48 | #define VCARD_VERSION "version" |
49 | 49 | ||
50 | #define VCARD_FN "fn" | 50 | #define VCARD_FN "fn" |
51 | #define VCARD_N "n" | 51 | #define VCARD_N "n" |
52 | 52 | ||
53 | // optional | 53 | // optional |
54 | #define VCARD_NAME "name" | 54 | #define VCARD_NAME "name" |
55 | #define VCARD_NICKNAME "nickname" | 55 | #define VCARD_NICKNAME "nickname" |
56 | #define VCARD_PHOTO "photo" | 56 | #define VCARD_PHOTO "photo" |
57 | #define VCARD_BDAY "bday" | 57 | #define VCARD_BDAY "bday" |
58 | #define VCARD_ADR "adr" | 58 | #define VCARD_ADR "adr" |
59 | 59 | ||
60 | // types | 60 | // types |
61 | #define VCARD_ADR_DOM "dom" | 61 | #define VCARD_ADR_DOM "dom" |
62 | #define VCARD_ADR_INTL "intl" | 62 | #define VCARD_ADR_INTL "intl" |
63 | #define VCARD_ADR_POSTAL "postal" | 63 | #define VCARD_ADR_POSTAL "postal" |
64 | #define VCARD_ADR_PARCEL "parcel" | 64 | #define VCARD_ADR_PARCEL "parcel" |
65 | #define VCARD_ADR_HOME "home" | 65 | #define VCARD_ADR_HOME "home" |
66 | #define VCARD_ADR_WORK "work" | 66 | #define VCARD_ADR_WORK "work" |
67 | #define VCARD_ADR_PREF "pref" | 67 | #define VCARD_ADR_PREF "pref" |
68 | // values | 68 | // values |
69 | #define VCARD_ADR_POBOX "PO Box" | 69 | #define VCARD_ADR_POBOX "PO Box" |
70 | #define VCARD_ADR_EXTADR "Extended Address" | 70 | #define VCARD_ADR_EXTADR "Extended Address" |
71 | #define VCARD_ADR_STREET "Street" | 71 | #define VCARD_ADR_STREET "Street" |
72 | #define VCARD_ADR_LOCALITY "Locality" | 72 | #define VCARD_ADR_LOCALITY "Locality" |
73 | #define VCARD_ADR_REGION "Region" | 73 | #define VCARD_ADR_REGION "Region" |
74 | #define VCARD_ADR_POSTCODE "Postal Code" | 74 | #define VCARD_ADR_POSTCODE "Postal Code" |
75 | #define VCARD_ADR_COUNTRY "Country Name" | 75 | #define VCARD_ADR_COUNTRY "Country Name" |
76 | #define VCARD_LABEL "label" | 76 | #define VCARD_LABEL "label" |
77 | #define VCARD_PROFILE "profile" | 77 | #define VCARD_PROFILE "profile" |
78 | #define VCARD_SOURCE "source" | 78 | #define VCARD_SOURCE "source" |
79 | #define VCARD_TEL "tel" | 79 | #define VCARD_TEL "tel" |
80 | // types | 80 | // types |
81 | #define VCARD_TEL_HOME "home" | 81 | #define VCARD_TEL_HOME "home" |
82 | #define VCARD_TEL_WORK "work" | 82 | #define VCARD_TEL_WORK "work" |
83 | #define VCARD_TEL_PREF "pref" | 83 | #define VCARD_TEL_PREF "pref" |
84 | #define VCARD_TEL_VOICE "voice" | 84 | #define VCARD_TEL_VOICE "voice" |
85 | #define VCARD_TEL_FAX "fax" | 85 | #define VCARD_TEL_FAX "fax" |
86 | #define VCARD_TEL_MSG "msg" | 86 | #define VCARD_TEL_MSG "msg" |
87 | #define VCARD_TEL_CELL "cell" | 87 | #define VCARD_TEL_CELL "cell" |
88 | #define VCARD_TEL_PAGER "pager" | 88 | #define VCARD_TEL_PAGER "pager" |
89 | #define VCARD_TEL_BBS "bbs" | 89 | #define VCARD_TEL_BBS "bbs" |
90 | #define VCARD_TEL_MODEM "modem" | 90 | #define VCARD_TEL_MODEM "modem" |
91 | #define VCARD_TEL_CAR "car" | 91 | #define VCARD_TEL_CAR "car" |
92 | #define VCARD_TEL_ISDN "isdn" | 92 | #define VCARD_TEL_ISDN "isdn" |
93 | #define VCARD_TEL_VIDEO "video" | 93 | #define VCARD_TEL_VIDEO "video" |
94 | #define VCARD_TEL_PCS "pcs" | 94 | #define VCARD_TEL_PCS "pcs" |
95 | #define VCARD_TEL_SIP "sip" | 95 | #define VCARD_TEL_SIP "sip" |
96 | #define VCARD_EMAIL "email" | 96 | #define VCARD_EMAIL "email" |
97 | // types | 97 | // types |
98 | #define VCARD_EMAIL_PREF "pref" | 98 | #define VCARD_EMAIL_PREF "pref" |
99 | #define VCARD_EMAIL_INTERNET "internet" | 99 | #define VCARD_EMAIL_INTERNET "internet" |
100 | #define VCARD_EMAIL_X400 "x400" | 100 | #define VCARD_EMAIL_X400 "x400" |
101 | #define VCARD_TZ "tz" | 101 | #define VCARD_TZ "tz" |
102 | #define VCARD_GEO "geo" | 102 | #define VCARD_GEO "geo" |
103 | #define VCARD_MAILER "mailer" | 103 | #define VCARD_MAILER "mailer" |
104 | #define VCARD_TITLE "title" | 104 | #define VCARD_TITLE "title" |
105 | #define VCARD_ROLE "role" | 105 | #define VCARD_ROLE "role" |
106 | #define VCARD_LOGO "logo" | 106 | #define VCARD_LOGO "logo" |
107 | #define VCARD_AGENT "agent" | 107 | #define VCARD_AGENT "agent" |
108 | #define VCARD_ORG "org" | 108 | #define VCARD_ORG "org" |
109 | #define VCARD_CATEGORIES "categories" | 109 | #define VCARD_CATEGORIES "categories" |
110 | #define VCARD_NOTE "note" | 110 | #define VCARD_NOTE "note" |
111 | #define VCARD_PRODID "prodid" | 111 | #define VCARD_PRODID "prodid" |
112 | #define VCARD_REV "rev" | 112 | #define VCARD_REV "rev" |
113 | #define VCARD_SOUND "sound" | 113 | #define VCARD_SOUND "sound" |
114 | #define VCARD_UID "uid" | 114 | #define VCARD_UID "uid" |
115 | #define VCARD_URL "url" | 115 | #define VCARD_URL "url" |
116 | #define VCARD_CLASS "class" | 116 | #define VCARD_CLASS "class" |
117 | #define VCARD_CLASS_PUBLIC "public" | 117 | #define VCARD_CLASS_PUBLIC "public" |
118 | #define VCARD_CLASS_PRIVATE "private" | 118 | #define VCARD_CLASS_PRIVATE "private" |
119 | #define VCARD_CLASS_CONFIDENTIAL "confidential" | 119 | #define VCARD_CLASS_CONFIDENTIAL "confidential" |
120 | #define VCARD_KEY "key" | 120 | #define VCARD_KEY "key" |
121 | // types | 121 | // types |
122 | #define VCARD_KEY_X509 "x509" | 122 | #define VCARD_KEY_X509 "x509" |
123 | #define VCARD_KEY_PGP "pgp" | 123 | #define VCARD_KEY_PGP "pgp" |
124 | 124 | ||
125 | #define VCARD_QUOTED_PRINTABLE "quoted-printable" | 125 | #define VCARD_QUOTED_PRINTABLE "quoted-printable" |
126 | // this one is a temporary hack until we support TYPE=VALUE | 126 | // this one is a temporary hack until we support TYPE=VALUE |
127 | #define VCARD_ENCODING_QUOTED_PRINTABLE "encoding=quoted-printable" | 127 | #define VCARD_ENCODING_QUOTED_PRINTABLE "encoding=quoted-printable" |
128 | #define VCARD_BASE64 "base64" | 128 | #define VCARD_BASE64 "base64" |
129 | 129 | ||
130 | #define VC_STATE_BEGIN 1 | 130 | #define VC_STATE_BEGIN 1 |
131 | #define VC_STATE_BODY 2 | 131 | #define VC_STATE_BODY 2 |
132 | #define VC_STATE_END 4 | 132 | #define VC_STATE_END 4 |
133 | #define VC_STATE_HAVE_N 8 | 133 | #define VC_STATE_HAVE_N 8 |
134 | #define VC_STATE_HAVE_VERSION 16 | 134 | #define VC_STATE_HAVE_VERSION 16 |
135 | 135 | ||
136 | #define VC_ERR_NO_BEGIN 1 | 136 | #define VC_ERR_NO_BEGIN 1 |
137 | #define VC_ERR_NO_END 2 | 137 | #define VC_ERR_NO_END 2 |
138 | #define VC_ERR_INVALID_LINE 3 | 138 | #define VC_ERR_INVALID_LINE 3 |
139 | #define VC_ERR_INTERNAL 4 | 139 | #define VC_ERR_INTERNAL 4 |
140 | #define VC_ERR_INVALID_NAME 5 | 140 | #define VC_ERR_INVALID_NAME 5 |
141 | #define VC_ERR_MISSING_MANDATORY 6 | 141 | #define VC_ERR_MISSING_MANDATORY 6 |
142 | 142 | ||
143 | namespace KABC { | 143 | namespace KABC { |
144 | 144 | ||
145 | class AddressBook; | 145 | class AddressBook; |
146 | 146 | ||
147 | class VCard21Parser | 147 | class VCard21Parser |
148 | { | 148 | { |
149 | public: | 149 | public: |
150 | 150 | ||
151 | /** | 151 | /** |
152 | * Constructor. | 152 | * Constructor. |
153 | */ | 153 | */ |
154 | VCard21Parser(); | 154 | VCard21Parser(); |
155 | 155 | ||
156 | /** | 156 | /** |
157 | * Destructor. | 157 | * Destructor. |
158 | */ | 158 | */ |
159 | virtual ~VCard21Parser(); | 159 | virtual ~VCard21Parser(); |
160 | 160 | ||
161 | /** | 161 | /** |
162 | * Parses a string in vcard2.1 format and saves the single addressees | 162 | * Parses a string in vcard2.1 format and saves the single addressees |
163 | * to the address book. | 163 | * to the address book. |
164 | * | 164 | * |
165 | * @param ab The address book. | 165 | * @param ab The address book. |
166 | * @param str The vcard string. | 166 | * @param str The vcard string. |
167 | */ | 167 | */ |
168 | void readFromString( KABC::AddressBook *ab, const QString &str ); | 168 | void readFromString( KABC::AddressBook *ab, const QString &str ); |
169 | 169 | ||
170 | /** | 170 | /** |
171 | * FIXME: we need a writeToString method | 171 | * FIXME: we need a writeToString method |
172 | * QString writeToString (KABC::AddressBook *); | 172 | * QString writeToString (KABC::AddressBook *); |
173 | */ | 173 | */ |
174 | 174 | ||
175 | /** | 175 | /** |
176 | * Parses a string in vcard2.1 format and returns the inherent addressee. | 176 | * Parses a string in vcard2.1 format and returns the inherent addressee. |
177 | */ | 177 | */ |
178 | KABC::Addressee readFromString( const QString &data); | 178 | KABC::Addressee readFromString( const QString &data); |
179 | 179 | ||
180 | /** | 180 | /** |
181 | * Helper method to store a address. | 181 | * Helper method to store a address. |
182 | * | 182 | * |
183 | * @param data A string list, that is filled with 'street', 'house number' ... | 183 | * @param data A string list, that is filled with 'street', 'house number' ... |
184 | * @param type The type of the returned address. | 184 | * @param type The type of the returned address. |
185 | */ | 185 | */ |
186 | static KABC::Address readAddressFromQStringList (const QStringList &data, const int type); | 186 | static KABC::Address readAddressFromQStringList (const QStringList &data, const int type); |
187 | }; | 187 | }; |
188 | 188 | ||
189 | } | 189 | } |
190 | 190 | ||
191 | /** | 191 | /** |
192 | * @short Helper class | 192 | * @short Helper class |
193 | */ | 193 | */ |
194 | class VCardLineX | 194 | class VCardLineX |
195 | { | 195 | { |
196 | public: | 196 | public: |
197 | QString name; | 197 | QString name; |
198 | bool qualified; | 198 | bool qualified; |
199 | QValueList<QString> qualifiers; | 199 | Q3ValueList<QString> qualifiers; |
200 | QValueList<QString> parameters; | 200 | Q3ValueList<QString> parameters; |
201 | bool isValid() const; | 201 | bool isValid() const; |
202 | }; | 202 | }; |
203 | 203 | ||
204 | /** | 204 | /** |
205 | * @short Helper class | 205 | * @short Helper class |
206 | */ | 206 | */ |
207 | class VCard21ParserImpl | 207 | class VCard21ParserImpl |
208 | { | 208 | { |
209 | friend class VCardLineX; | 209 | friend class VCardLineX; |
210 | 210 | ||
211 | public: | 211 | public: |
212 | VCard21ParserImpl() { }; | 212 | VCard21ParserImpl() { }; |
213 | virtual ~VCard21ParserImpl() { }; | 213 | virtual ~VCard21ParserImpl() { }; |
214 | static VCard21ParserImpl *parseVCard(const QString& vc, int *err = NULL); | 214 | static VCard21ParserImpl *parseVCard(const QString& vc, int *err = NULL); |
215 | QString getValue(const QString& name, const QString& qualifier); | 215 | QString getValue(const QString& name, const QString& qualifier); |
216 | QString getValue(const QString& name); | 216 | QString getValue(const QString& name); |
217 | QStringList getValues(const QString& name, const QString& qualifier); | 217 | QStringList getValues(const QString& name, const QString& qualifier); |
218 | QStringList getValues(const QString& name); | 218 | QStringList getValues(const QString& name); |
219 | 219 | ||
220 | QValueList<VCardLineX> *_vcdata; | 220 | Q3ValueList<VCardLineX> *_vcdata; |
221 | 221 | ||
222 | private: | 222 | private: |
223 | VCard21ParserImpl (QValueList<VCardLineX> *_vcd); | 223 | VCard21ParserImpl (Q3ValueList<VCardLineX> *_vcd); |
224 | }; | 224 | }; |
225 | 225 | ||
226 | #endif | 226 | #endif |
diff --git a/kabc/vcardformatimpl.cpp b/kabc/vcardformatimpl.cpp index 580c28b..2417874 100644 --- a/kabc/vcardformatimpl.cpp +++ b/kabc/vcardformatimpl.cpp | |||
@@ -1,1039 +1,1042 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | /* | 21 | /* |
22 | Enhanced Version of the file for platform independent KDE tools. | 22 | Enhanced Version of the file for platform independent KDE tools. |
23 | Copyright (c) 2004 Ulf Schenk | 23 | Copyright (c) 2004 Ulf Schenk |
24 | 24 | ||
25 | $Id$ | 25 | $Id$ |
26 | */ | 26 | */ |
27 | 27 | ||
28 | #include <qfile.h> | 28 | #include <qfile.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | 30 | #include <qapplication.h> |
31 | //Added by qt3to4: | ||
32 | #include <Q3CString> | ||
33 | #include <Q3PtrList> | ||
31 | 34 | ||
32 | #include <kdebug.h> | 35 | #include <kdebug.h> |
33 | #include <kmdcodec.h> | 36 | #include <kmdcodec.h> |
34 | #include <kstandarddirs.h> | 37 | #include <kstandarddirs.h> |
35 | #include <ktempfile.h> | 38 | #include <ktempfile.h> |
36 | 39 | ||
37 | #include <VCard.h> | 40 | #include <VCard.h> |
38 | 41 | ||
39 | #include "addressbook.h" | 42 | #include "addressbook.h" |
40 | #include "vcardformatimpl.h" | 43 | #include "vcardformatimpl.h" |
41 | 44 | ||
42 | using namespace KABC; | 45 | using namespace KABC; |
43 | using namespace VCARD; | 46 | using namespace VCARD; |
44 | 47 | ||
45 | int VCardFormatImpl::debug = -1; | 48 | int VCardFormatImpl::debug = -1; |
46 | 49 | ||
47 | VCardFormatImpl::VCardFormatImpl() | 50 | VCardFormatImpl::VCardFormatImpl() |
48 | { | 51 | { |
49 | debug = (getenv("KABC_DEBUG") != 0); | 52 | debug = (getenv("KABC_DEBUG") != 0); |
50 | } | 53 | } |
51 | 54 | ||
52 | bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) | 55 | bool VCardFormatImpl::load( Addressee &addressee, QFile *file ) |
53 | { | 56 | { |
54 | kdDebug(5700) << "VCardFormat::load()" << endl; | 57 | kdDebug(5700) << "VCardFormat::load()" << endl; |
55 | 58 | ||
56 | QByteArray fdata = file->readAll(); | 59 | QByteArray fdata = file->readAll(); |
57 | QCString data(fdata.data(), fdata.size()+1); | 60 | Q3CString data(fdata.data(), fdata.size()+1); |
58 | 61 | ||
59 | VCardEntity e( data ); | 62 | VCardEntity e( data ); |
60 | 63 | ||
61 | VCardListIterator it( e.cardList() ); | 64 | VCardListIterator it( e.cardList() ); |
62 | 65 | ||
63 | if ( it.current() ) { | 66 | if ( it.current() ) { |
64 | //US VCard v(*it.current()); | 67 | //US VCard v(*it.current()); |
65 | //US loadAddressee( addressee, v ); | 68 | //US loadAddressee( addressee, v ); |
66 | loadAddressee( addressee, it.current() ); | 69 | loadAddressee( addressee, it.current() ); |
67 | return true; | 70 | return true; |
68 | } | 71 | } |
69 | 72 | ||
70 | return false; | 73 | return false; |
71 | } | 74 | } |
72 | 75 | ||
73 | 76 | ||
74 | #include <kmessagebox.h> | 77 | #include <kmessagebox.h> |
75 | bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 78 | bool VCardFormatImpl::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
76 | { | 79 | { |
77 | 80 | ||
78 | QCString data(file->readAll().data(), file->size()+1); | 81 | Q3CString data(file->readAll().data(), file->size()+1); |
79 | VCardEntity e( data ); | 82 | VCardEntity e( data ); |
80 | 83 | ||
81 | VCardListIterator it( e.cardList() ); | 84 | VCardListIterator it( e.cardList() ); |
82 | 85 | ||
83 | for (; it.current(); ++it) { | 86 | for (; it.current(); ++it) { |
84 | //US VCard v(*it.current()); | 87 | //US VCard v(*it.current()); |
85 | Addressee addressee; | 88 | Addressee addressee; |
86 | //US loadAddressee( addressee, v ); | 89 | //US loadAddressee( addressee, v ); |
87 | loadAddressee( addressee, it.current() ); | 90 | loadAddressee( addressee, it.current() ); |
88 | addressee.setResource( resource ); | 91 | addressee.setResource( resource ); |
89 | addressBook->insertAddressee( addressee ); | 92 | addressBook->insertAddressee( addressee ); |
90 | if (debug == true) | 93 | if (debug == true) |
91 | { | 94 | { |
92 | printf("address %s loaded successfully\n", addressee.formattedName().latin1()); | 95 | printf("address %s loaded successfully\n", addressee.formattedName().latin1()); |
93 | } | 96 | } |
94 | } | 97 | } |
95 | return true; | 98 | return true; |
96 | } | 99 | } |
97 | 100 | ||
98 | void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) | 101 | void VCardFormatImpl::save( const Addressee &addressee, QFile *file ) |
99 | { | 102 | { |
100 | VCardEntity vcards; | 103 | VCardEntity vcards; |
101 | VCardList vcardlist; | 104 | VCardList vcardlist; |
102 | vcardlist.setAutoDelete( true ); | 105 | vcardlist.setAutoDelete( true ); |
103 | 106 | ||
104 | VCard *v = new VCard; | 107 | VCard *v = new VCard; |
105 | 108 | ||
106 | saveAddressee( addressee, v, false ); | 109 | saveAddressee( addressee, v, false ); |
107 | 110 | ||
108 | vcardlist.append( v ); | 111 | vcardlist.append( v ); |
109 | vcards.setCardList( vcardlist ); | 112 | vcards.setCardList( vcardlist ); |
110 | 113 | ||
111 | QCString vcardData = vcards.asString(); | 114 | Q3CString vcardData = vcards.asString(); |
112 | file->writeBlock( (const char*)vcardData, vcardData.length() ); | 115 | file->writeBlock( (const char*)vcardData, vcardData.length() ); |
113 | } | 116 | } |
114 | 117 | ||
115 | void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) | 118 | void VCardFormatImpl::saveAll( AddressBook *ab, Resource *resource, QFile *file ) |
116 | { | 119 | { |
117 | 120 | ||
118 | AddressBook::Iterator it; | 121 | AddressBook::Iterator it; |
119 | for ( it = ab->begin(); it != ab->end(); ++it ) { | 122 | for ( it = ab->begin(); it != ab->end(); ++it ) { |
120 | if ( (*it).resource() == resource ) { | 123 | if ( (*it).resource() == resource ) { |
121 | save((*it),file); | 124 | save((*it),file); |
122 | qApp->processEvents(); | 125 | qApp->processEvents(); |
123 | (*it).setChanged( false ); | 126 | (*it).setChanged( false ); |
124 | } | 127 | } |
125 | } | 128 | } |
126 | // for memory usage status test only | 129 | // for memory usage status test only |
127 | // KMessageBox::information ( 0, "Stoppppp", QString("Stop ") ); | 130 | // KMessageBox::information ( 0, "Stoppppp", QString("Stop ") ); |
128 | } | 131 | } |
129 | 132 | ||
130 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) | 133 | bool VCardFormatImpl::loadAddressee( Addressee& addressee, VCard *v ) |
131 | { | 134 | { |
132 | QPtrList<ContentLine> contentLines = v->contentLineList(); | 135 | Q3PtrList<ContentLine> contentLines = v->contentLineList(); |
133 | ContentLine *cl; | 136 | ContentLine *cl; |
134 | 137 | ||
135 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { | 138 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { |
136 | QCString n = cl->name(); | 139 | Q3CString n = cl->name(); |
137 | if ( n.left( 2 ) == "X-" ) { | 140 | if ( n.left( 2 ) == "X-" ) { |
138 | n = n.mid( 2 ); | 141 | n = n.mid( 2 ); |
139 | int posDash = n.find( "-" ); | 142 | int posDash = n.find( "-" ); |
140 | addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), | 143 | addressee.insertCustom( QString::fromUtf8( n.left( posDash ) ), |
141 | QString::fromUtf8( n.mid( posDash + 1 ) ), | 144 | QString::fromUtf8( n.mid( posDash + 1 ) ), |
142 | QString::fromUtf8( cl->value()->asString() ) ); | 145 | QString::fromUtf8( cl->value()->asString() ) ); |
143 | continue; | 146 | continue; |
144 | } | 147 | } |
145 | 148 | ||
146 | EntityType type = cl->entityType(); | 149 | EntityType type = cl->entityType(); |
147 | switch( type ) { | 150 | switch( type ) { |
148 | 151 | ||
149 | case EntityUID: | 152 | case EntityUID: |
150 | addressee.setUid( readTextValue( cl ) ); | 153 | addressee.setUid( readTextValue( cl ) ); |
151 | break; | 154 | break; |
152 | 155 | ||
153 | case EntityEmail: | 156 | case EntityEmail: |
154 | addressee.insertEmail( readTextValue( cl ) ); | 157 | addressee.insertEmail( readTextValue( cl ) ); |
155 | break; | 158 | break; |
156 | 159 | ||
157 | case EntityName: | 160 | case EntityName: |
158 | addressee.setName( readTextValue( cl ) ); | 161 | addressee.setName( readTextValue( cl ) ); |
159 | break; | 162 | break; |
160 | 163 | ||
161 | case EntityFullName: | 164 | case EntityFullName: |
162 | addressee.setFormattedName( readTextValue( cl ) ); | 165 | addressee.setFormattedName( readTextValue( cl ) ); |
163 | break; | 166 | break; |
164 | 167 | ||
165 | case EntityURL: | 168 | case EntityURL: |
166 | addressee.setUrl( KURL( readTextValue( cl ) ) ); | 169 | addressee.setUrl( KURL( readTextValue( cl ) ) ); |
167 | break; | 170 | break; |
168 | 171 | ||
169 | case EntityNickname: | 172 | case EntityNickname: |
170 | addressee.setNickName( readTextValue( cl ) ); | 173 | addressee.setNickName( readTextValue( cl ) ); |
171 | break; | 174 | break; |
172 | 175 | ||
173 | case EntityLabel: | 176 | case EntityLabel: |
174 | // not yet supported by kabc | 177 | // not yet supported by kabc |
175 | break; | 178 | break; |
176 | 179 | ||
177 | case EntityMailer: | 180 | case EntityMailer: |
178 | addressee.setMailer( readTextValue( cl ) ); | 181 | addressee.setMailer( readTextValue( cl ) ); |
179 | break; | 182 | break; |
180 | 183 | ||
181 | case EntityTitle: | 184 | case EntityTitle: |
182 | addressee.setTitle( readTextValue( cl ) ); | 185 | addressee.setTitle( readTextValue( cl ) ); |
183 | break; | 186 | break; |
184 | 187 | ||
185 | case EntityRole: | 188 | case EntityRole: |
186 | addressee.setRole( readTextValue( cl ) ); | 189 | addressee.setRole( readTextValue( cl ) ); |
187 | break; | 190 | break; |
188 | 191 | ||
189 | case EntityOrganisation: | 192 | case EntityOrganisation: |
190 | addressee.setOrganization( readTextValue( cl ) ); | 193 | addressee.setOrganization( readTextValue( cl ) ); |
191 | break; | 194 | break; |
192 | 195 | ||
193 | case EntityNote: | 196 | case EntityNote: |
194 | addressee.setNote( readTextValue( cl ) ); | 197 | addressee.setNote( readTextValue( cl ) ); |
195 | break; | 198 | break; |
196 | 199 | ||
197 | case EntityProductID: | 200 | case EntityProductID: |
198 | addressee.setProductId( readTextValue( cl ) ); | 201 | addressee.setProductId( readTextValue( cl ) ); |
199 | break; | 202 | break; |
200 | 203 | ||
201 | case EntitySortString: | 204 | case EntitySortString: |
202 | addressee.setSortString( readTextValue( cl ) ); | 205 | addressee.setSortString( readTextValue( cl ) ); |
203 | break; | 206 | break; |
204 | 207 | ||
205 | case EntityN: | 208 | case EntityN: |
206 | readNValue( cl, addressee ); | 209 | readNValue( cl, addressee ); |
207 | break; | 210 | break; |
208 | 211 | ||
209 | case EntityAddress: | 212 | case EntityAddress: |
210 | addressee.insertAddress( readAddressValue( cl ) ); | 213 | addressee.insertAddress( readAddressValue( cl ) ); |
211 | break; | 214 | break; |
212 | 215 | ||
213 | case EntityTelephone: | 216 | case EntityTelephone: |
214 | addressee.insertPhoneNumber( readTelephoneValue( cl ) ); | 217 | addressee.insertPhoneNumber( readTelephoneValue( cl ) ); |
215 | break; | 218 | break; |
216 | 219 | ||
217 | case EntityCategories: | 220 | case EntityCategories: |
218 | addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) ); | 221 | addressee.setCategories( QStringList::split( ",", readTextValue( cl ) ) ); |
219 | break; | 222 | break; |
220 | 223 | ||
221 | case EntityBirthday: | 224 | case EntityBirthday: |
222 | addressee.setBirthday( readDateValue( cl ) ); | 225 | addressee.setBirthday( (QDateTime) readDateValue( cl ) ); |
223 | break; | 226 | break; |
224 | 227 | ||
225 | case EntityRevision: | 228 | case EntityRevision: |
226 | addressee.setRevision( readDateTimeValue( cl ) ); | 229 | addressee.setRevision( readDateTimeValue( cl ) ); |
227 | break; | 230 | break; |
228 | 231 | ||
229 | case EntityGeo: | 232 | case EntityGeo: |
230 | addressee.setGeo( readGeoValue( cl ) ); | 233 | addressee.setGeo( readGeoValue( cl ) ); |
231 | break; | 234 | break; |
232 | 235 | ||
233 | case EntityTimeZone: | 236 | case EntityTimeZone: |
234 | addressee.setTimeZone( readUTCValue( cl ) ); | 237 | addressee.setTimeZone( readUTCValue( cl ) ); |
235 | break; | 238 | break; |
236 | 239 | ||
237 | case EntityVersion: | 240 | case EntityVersion: |
238 | break; | 241 | break; |
239 | 242 | ||
240 | case EntityClass: | 243 | case EntityClass: |
241 | addressee.setSecrecy( readClassValue( cl ) ); | 244 | addressee.setSecrecy( readClassValue( cl ) ); |
242 | break; | 245 | break; |
243 | 246 | ||
244 | case EntityKey: | 247 | case EntityKey: |
245 | addressee.insertKey( readKeyValue( cl ) ); | 248 | addressee.insertKey( readKeyValue( cl ) ); |
246 | break; | 249 | break; |
247 | 250 | ||
248 | case EntityPhoto: | 251 | case EntityPhoto: |
249 | addressee.setPhoto( readPictureValue( cl, EntityPhoto, addressee ) ); | 252 | addressee.setPhoto( readPictureValue( cl, EntityPhoto, addressee ) ); |
250 | break; | 253 | break; |
251 | 254 | ||
252 | case EntityLogo: | 255 | case EntityLogo: |
253 | addressee.setLogo( readPictureValue( cl, EntityLogo, addressee ) ); | 256 | addressee.setLogo( readPictureValue( cl, EntityLogo, addressee ) ); |
254 | break; | 257 | break; |
255 | 258 | ||
256 | case EntityAgent: | 259 | case EntityAgent: |
257 | addressee.setAgent( readAgentValue( cl ) ); | 260 | addressee.setAgent( readAgentValue( cl ) ); |
258 | break; | 261 | break; |
259 | 262 | ||
260 | case EntitySound: | 263 | case EntitySound: |
261 | addressee.setSound( readSoundValue( cl, addressee ) ); | 264 | addressee.setSound( readSoundValue( cl, addressee ) ); |
262 | break; | 265 | break; |
263 | 266 | ||
264 | default: | 267 | default: |
265 | kdDebug(5700) << "VCardFormat::load(): Unsupported entity: " | 268 | kdDebug(5700) << "VCardFormat::load(): Unsupported entity: " |
266 | << int( type ) << ": " << cl->asString() << endl; | 269 | << int( type ) << ": " << cl->asString() << endl; |
267 | qDebug("VCardFormat::load(): Unsupported entity: %i: %s ", int(type), (const char*)cl->asString()); | 270 | qDebug("VCardFormat::load(): Unsupported entity: %i: %s ", int(type), (const char*)cl->asString()); |
268 | break; | 271 | break; |
269 | } | 272 | } |
270 | } | 273 | } |
271 | 274 | ||
272 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { | 275 | for( cl = contentLines.first(); cl; cl = contentLines.next() ) { |
273 | EntityType type = cl->entityType(); | 276 | EntityType type = cl->entityType(); |
274 | if ( type == EntityLabel ) { | 277 | if ( type == EntityLabel ) { |
275 | int type = readAddressParam( cl ); | 278 | int type = readAddressParam( cl ); |
276 | Address address = addressee.address( type ); | 279 | Address address = addressee.address( type ); |
277 | if ( address.isEmpty() ) | 280 | if ( address.isEmpty() ) |
278 | address.setType( type ); | 281 | address.setType( type ); |
279 | 282 | ||
280 | address.setLabel( QString::fromUtf8( cl->value()->asString() ) ); | 283 | address.setLabel( QString::fromUtf8( cl->value()->asString() ) ); |
281 | addressee.insertAddress( address ); | 284 | addressee.insertAddress( address ); |
282 | } | 285 | } |
283 | } | 286 | } |
284 | addressee.makePhoneNumbersOLcompatible(); | 287 | addressee.makePhoneNumbersOLcompatible(); |
285 | return true; | 288 | return true; |
286 | } | 289 | } |
287 | 290 | ||
288 | void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern ) | 291 | void VCardFormatImpl::saveAddressee( const Addressee &addressee, VCard *v, bool intern ) |
289 | { | 292 | { |
290 | //US ContentLine cl; | 293 | //US ContentLine cl; |
291 | //US QString value; | 294 | //US QString value; |
292 | 295 | ||
293 | addTextValue( v, EntityName, addressee.name() ); | 296 | addTextValue( v, EntityName, addressee.name() ); |
294 | addTextValue( v, EntityUID, addressee.uid() ); | 297 | addTextValue( v, EntityUID, addressee.uid() ); |
295 | addTextValue( v, EntityFullName, addressee.formattedName() ); | 298 | addTextValue( v, EntityFullName, addressee.formattedName() ); |
296 | 299 | ||
297 | QStringList emails = addressee.emails(); | 300 | QStringList emails = addressee.emails(); |
298 | QStringList::ConstIterator it4; | 301 | QStringList::ConstIterator it4; |
299 | for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) { | 302 | for( it4 = emails.begin(); it4 != emails.end(); ++it4 ) { |
300 | addTextValue( v, EntityEmail, *it4 ); | 303 | addTextValue( v, EntityEmail, *it4 ); |
301 | } | 304 | } |
302 | 305 | ||
303 | QStringList customs = addressee.customs(); | 306 | QStringList customs = addressee.customs(); |
304 | QStringList::ConstIterator it5; | 307 | QStringList::ConstIterator it5; |
305 | for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) { | 308 | for( it5 = customs.begin(); it5 != customs.end(); ++it5 ) { |
306 | addCustomValue( v, *it5 ); | 309 | addCustomValue( v, *it5 ); |
307 | } | 310 | } |
308 | 311 | ||
309 | addTextValue( v, EntityURL, addressee.url().url() ); | 312 | addTextValue( v, EntityURL, addressee.url().url() ); |
310 | 313 | ||
311 | addNValue( v, addressee ); | 314 | addNValue( v, addressee ); |
312 | 315 | ||
313 | addTextValue( v, EntityNickname, addressee.nickName() ); | 316 | addTextValue( v, EntityNickname, addressee.nickName() ); |
314 | addTextValue( v, EntityMailer, addressee.mailer() ); | 317 | addTextValue( v, EntityMailer, addressee.mailer() ); |
315 | addTextValue( v, EntityTitle, addressee.title() ); | 318 | addTextValue( v, EntityTitle, addressee.title() ); |
316 | addTextValue( v, EntityRole, addressee.role() ); | 319 | addTextValue( v, EntityRole, addressee.role() ); |
317 | addTextValue( v, EntityOrganisation, addressee.organization() ); | 320 | addTextValue( v, EntityOrganisation, addressee.organization() ); |
318 | addTextValue( v, EntityNote, addressee.note() ); | 321 | addTextValue( v, EntityNote, addressee.note() ); |
319 | addTextValue( v, EntityProductID, addressee.productId() ); | 322 | addTextValue( v, EntityProductID, addressee.productId() ); |
320 | addTextValue( v, EntitySortString, addressee.sortString() ); | 323 | addTextValue( v, EntitySortString, addressee.sortString() ); |
321 | 324 | ||
322 | Address::List addresses = addressee.addresses(); | 325 | Address::List addresses = addressee.addresses(); |
323 | Address::List::ConstIterator it3; | 326 | Address::List::ConstIterator it3; |
324 | for( it3 = addresses.begin(); it3 != addresses.end(); ++it3 ) { | 327 | for( it3 = addresses.begin(); it3 != addresses.end(); ++it3 ) { |
325 | addAddressValue( v, *it3 ); | 328 | addAddressValue( v, *it3 ); |
326 | addLabelValue( v, *it3 ); | 329 | addLabelValue( v, *it3 ); |
327 | } | 330 | } |
328 | 331 | ||
329 | PhoneNumber::List phoneNumbers = addressee.phoneNumbers(); | 332 | PhoneNumber::List phoneNumbers = addressee.phoneNumbers(); |
330 | PhoneNumber::List::ConstIterator it2; | 333 | PhoneNumber::List::ConstIterator it2; |
331 | for( it2 = phoneNumbers.begin(); it2 != phoneNumbers.end(); ++it2 ) { | 334 | for( it2 = phoneNumbers.begin(); it2 != phoneNumbers.end(); ++it2 ) { |
332 | addTelephoneValue( v, *it2 ); | 335 | addTelephoneValue( v, *it2 ); |
333 | } | 336 | } |
334 | 337 | ||
335 | Key::List keys = addressee.keys(); | 338 | Key::List keys = addressee.keys(); |
336 | Key::List::ConstIterator it6; | 339 | Key::List::ConstIterator it6; |
337 | for( it6 = keys.begin(); it6 != keys.end(); ++it6 ) { | 340 | for( it6 = keys.begin(); it6 != keys.end(); ++it6 ) { |
338 | addKeyValue( v, *it6 ); | 341 | addKeyValue( v, *it6 ); |
339 | } | 342 | } |
340 | 343 | ||
341 | addTextValue( v, EntityCategories, addressee.categories().join(",") ); | 344 | addTextValue( v, EntityCategories, addressee.categories().join(",") ); |
342 | 345 | ||
343 | addDateValue( v, EntityBirthday, addressee.birthday().date() ); | 346 | addDateValue( v, EntityBirthday, addressee.birthday().date() ); |
344 | addDateTimeValue( v, EntityRevision, addressee.revision() ); | 347 | addDateTimeValue( v, EntityRevision, addressee.revision() ); |
345 | addGeoValue( v, addressee.geo() ); | 348 | addGeoValue( v, addressee.geo() ); |
346 | addUTCValue( v, addressee.timeZone() ); | 349 | addUTCValue( v, addressee.timeZone() ); |
347 | 350 | ||
348 | addClassValue( v, addressee.secrecy() ); | 351 | addClassValue( v, addressee.secrecy() ); |
349 | 352 | ||
350 | addPictureValue( v, EntityPhoto, addressee.photo(), addressee, intern ); | 353 | addPictureValue( v, EntityPhoto, addressee.photo(), addressee, intern ); |
351 | addPictureValue( v, EntityLogo, addressee.logo(), addressee, intern ); | 354 | addPictureValue( v, EntityLogo, addressee.logo(), addressee, intern ); |
352 | 355 | ||
353 | addAgentValue( v, addressee.agent() ); | 356 | addAgentValue( v, addressee.agent() ); |
354 | 357 | ||
355 | addSoundValue( v, addressee.sound(), addressee, intern ); | 358 | addSoundValue( v, addressee.sound(), addressee, intern ); |
356 | } | 359 | } |
357 | 360 | ||
358 | void VCardFormatImpl::addCustomValue( VCard *v, const QString &txt ) | 361 | void VCardFormatImpl::addCustomValue( VCard *v, const QString &txt ) |
359 | { | 362 | { |
360 | if ( txt.isEmpty() ) return; | 363 | if ( txt.isEmpty() ) return; |
361 | 364 | ||
362 | ContentLine cl; | 365 | ContentLine cl; |
363 | cl.setName( "X-" + txt.left( txt.find( ":" ) ).utf8() ); | 366 | cl.setName( "X-" + txt.left( txt.find( ":" ) ).utf8() ); |
364 | QString value = txt.mid( txt.find( ":" ) + 1 ); | 367 | QString value = txt.mid( txt.find( ":" ) + 1 ); |
365 | if ( value.isEmpty() ) | 368 | if ( value.isEmpty() ) |
366 | return; | 369 | return; |
367 | cl.setValue( new TextValue( value.utf8() ) ); | 370 | cl.setValue( new TextValue( value.utf8() ) ); |
368 | v->add(cl); | 371 | v->add(cl); |
369 | } | 372 | } |
370 | 373 | ||
371 | void VCardFormatImpl::addTextValue( VCard *v, EntityType type, const QString &txt ) | 374 | void VCardFormatImpl::addTextValue( VCard *v, EntityType type, const QString &txt ) |
372 | { | 375 | { |
373 | if ( txt.isEmpty() ) return; | 376 | if ( txt.isEmpty() ) return; |
374 | 377 | ||
375 | ContentLine cl; | 378 | ContentLine cl; |
376 | cl.setName( EntityTypeToParamName( type ) ); | 379 | cl.setName( EntityTypeToParamName( type ) ); |
377 | cl.setValue( new TextValue( txt.utf8() ) ); | 380 | cl.setValue( new TextValue( txt.utf8() ) ); |
378 | v->add(cl); | 381 | v->add(cl); |
379 | } | 382 | } |
380 | 383 | ||
381 | void VCardFormatImpl::addDateValue( VCard *vcard, EntityType type, | 384 | void VCardFormatImpl::addDateValue( VCard *vcard, EntityType type, |
382 | const QDate &date ) | 385 | const QDate &date ) |
383 | { | 386 | { |
384 | if ( !date.isValid() ) return; | 387 | if ( !date.isValid() ) return; |
385 | 388 | ||
386 | ContentLine cl; | 389 | ContentLine cl; |
387 | cl.setName( EntityTypeToParamName( type ) ); | 390 | cl.setName( EntityTypeToParamName( type ) ); |
388 | 391 | ||
389 | DateValue *v = new DateValue( date ); | 392 | DateValue *v = new DateValue( date ); |
390 | cl.setValue( v ); | 393 | cl.setValue( v ); |
391 | vcard->add(cl); | 394 | vcard->add(cl); |
392 | } | 395 | } |
393 | 396 | ||
394 | void VCardFormatImpl::addDateTimeValue( VCard *vcard, EntityType type, | 397 | void VCardFormatImpl::addDateTimeValue( VCard *vcard, EntityType type, |
395 | const QDateTime &dateTime ) | 398 | const QDateTime &dateTime ) |
396 | { | 399 | { |
397 | if ( !dateTime.isValid() ) return; | 400 | if ( !dateTime.isValid() ) return; |
398 | 401 | ||
399 | ContentLine cl; | 402 | ContentLine cl; |
400 | cl.setName( EntityTypeToParamName( type ) ); | 403 | cl.setName( EntityTypeToParamName( type ) ); |
401 | 404 | ||
402 | DateValue *v = new DateValue( dateTime ); | 405 | DateValue *v = new DateValue( dateTime ); |
403 | cl.setValue( v ); | 406 | cl.setValue( v ); |
404 | vcard->add(cl); | 407 | vcard->add(cl); |
405 | } | 408 | } |
406 | 409 | ||
407 | void VCardFormatImpl::addAddressValue( VCard *vcard, const Address &a ) | 410 | void VCardFormatImpl::addAddressValue( VCard *vcard, const Address &a ) |
408 | { | 411 | { |
409 | if ( a.isEmpty() ) | 412 | if ( a.isEmpty() ) |
410 | return; | 413 | return; |
411 | 414 | ||
412 | ContentLine cl; | 415 | ContentLine cl; |
413 | cl.setName( EntityTypeToParamName( EntityAddress ) ); | 416 | cl.setName( EntityTypeToParamName( EntityAddress ) ); |
414 | 417 | ||
415 | AdrValue *v = new AdrValue; | 418 | AdrValue *v = new AdrValue; |
416 | v->setPOBox( a.postOfficeBox().utf8() ); | 419 | v->setPOBox( a.postOfficeBox().utf8() ); |
417 | v->setExtAddress( a.extended().utf8() ); | 420 | v->setExtAddress( a.extended().utf8() ); |
418 | v->setStreet( a.street().utf8() ); | 421 | v->setStreet( a.street().utf8() ); |
419 | v->setLocality( a.locality().utf8() ); | 422 | v->setLocality( a.locality().utf8() ); |
420 | v->setRegion( a.region().utf8() ); | 423 | v->setRegion( a.region().utf8() ); |
421 | v->setPostCode( a.postalCode().utf8() ); | 424 | v->setPostCode( a.postalCode().utf8() ); |
422 | v->setCountryName( a.country().utf8() ); | 425 | v->setCountryName( a.country().utf8() ); |
423 | cl.setValue( v ); | 426 | cl.setValue( v ); |
424 | 427 | ||
425 | addAddressParam( &cl, a.type() ); | 428 | addAddressParam( &cl, a.type() ); |
426 | 429 | ||
427 | vcard->add( cl ); | 430 | vcard->add( cl ); |
428 | } | 431 | } |
429 | 432 | ||
430 | void VCardFormatImpl::addLabelValue( VCard *vcard, const Address &a ) | 433 | void VCardFormatImpl::addLabelValue( VCard *vcard, const Address &a ) |
431 | { | 434 | { |
432 | if ( a.label().isEmpty() ) return; | 435 | if ( a.label().isEmpty() ) return; |
433 | 436 | ||
434 | ContentLine cl; | 437 | ContentLine cl; |
435 | cl.setName( EntityTypeToParamName( EntityLabel ) ); | 438 | cl.setName( EntityTypeToParamName( EntityLabel ) ); |
436 | cl.setValue( new TextValue( a.label().utf8() ) ); | 439 | cl.setValue( new TextValue( a.label().utf8() ) ); |
437 | 440 | ||
438 | addAddressParam( &cl, a.type() ); | 441 | addAddressParam( &cl, a.type() ); |
439 | 442 | ||
440 | vcard->add( cl ); | 443 | vcard->add( cl ); |
441 | } | 444 | } |
442 | 445 | ||
443 | void VCardFormatImpl::addAddressParam( ContentLine *cl, int type ) | 446 | void VCardFormatImpl::addAddressParam( ContentLine *cl, int type ) |
444 | { | 447 | { |
445 | ParamList params; | 448 | ParamList params; |
446 | if ( type & Address::Dom ) params.append( new Param( "TYPE", "dom" ) ); | 449 | if ( type & Address::Dom ) params.append( new Param( "TYPE", "dom" ) ); |
447 | if ( type & Address::Intl ) params.append( new Param( "TYPE", "intl" ) ); | 450 | if ( type & Address::Intl ) params.append( new Param( "TYPE", "intl" ) ); |
448 | if ( type & Address::Parcel ) params.append( new Param( "TYPE", "parcel" ) ); | 451 | if ( type & Address::Parcel ) params.append( new Param( "TYPE", "parcel" ) ); |
449 | if ( type & Address::Postal ) params.append( new Param( "TYPE", "postal" ) ); | 452 | if ( type & Address::Postal ) params.append( new Param( "TYPE", "postal" ) ); |
450 | if ( type & Address::Work ) params.append( new Param( "TYPE", "work" ) ); | 453 | if ( type & Address::Work ) params.append( new Param( "TYPE", "work" ) ); |
451 | if ( type & Address::Home ) params.append( new Param( "TYPE", "home" ) ); | 454 | if ( type & Address::Home ) params.append( new Param( "TYPE", "home" ) ); |
452 | if ( type & Address::Pref ) params.append( new Param( "TYPE", "pref" ) ); | 455 | if ( type & Address::Pref ) params.append( new Param( "TYPE", "pref" ) ); |
453 | cl->setParamList( params ); | 456 | cl->setParamList( params ); |
454 | } | 457 | } |
455 | 458 | ||
456 | void VCardFormatImpl::addGeoValue( VCard *vcard, const Geo &geo ) | 459 | void VCardFormatImpl::addGeoValue( VCard *vcard, const Geo &geo ) |
457 | { | 460 | { |
458 | if ( !geo.isValid() ) return; | 461 | if ( !geo.isValid() ) return; |
459 | 462 | ||
460 | ContentLine cl; | 463 | ContentLine cl; |
461 | cl.setName( EntityTypeToParamName( EntityGeo ) ); | 464 | cl.setName( EntityTypeToParamName( EntityGeo ) ); |
462 | 465 | ||
463 | GeoValue *v = new GeoValue; | 466 | GeoValue *v = new GeoValue; |
464 | v->setLatitude( geo.latitude() ); | 467 | v->setLatitude( geo.latitude() ); |
465 | v->setLongitude( geo.longitude() ); | 468 | v->setLongitude( geo.longitude() ); |
466 | 469 | ||
467 | cl.setValue( v ); | 470 | cl.setValue( v ); |
468 | vcard->add(cl); | 471 | vcard->add(cl); |
469 | } | 472 | } |
470 | 473 | ||
471 | void VCardFormatImpl::addUTCValue( VCard *vcard, const TimeZone &tz ) | 474 | void VCardFormatImpl::addUTCValue( VCard *vcard, const TimeZone &tz ) |
472 | { | 475 | { |
473 | if ( !tz.isValid() ) return; | 476 | if ( !tz.isValid() ) return; |
474 | 477 | ||
475 | ContentLine cl; | 478 | ContentLine cl; |
476 | cl.setName( EntityTypeToParamName( EntityTimeZone ) ); | 479 | cl.setName( EntityTypeToParamName( EntityTimeZone ) ); |
477 | 480 | ||
478 | UTCValue *v = new UTCValue; | 481 | UTCValue *v = new UTCValue; |
479 | 482 | ||
480 | v->setPositive( tz.offset() >= 0 ); | 483 | v->setPositive( tz.offset() >= 0 ); |
481 | v->setHour( (tz.offset() / 60) * ( tz.offset() >= 0 ? 1 : -1 ) ); | 484 | v->setHour( (tz.offset() / 60) * ( tz.offset() >= 0 ? 1 : -1 ) ); |
482 | v->setMinute( (tz.offset() % 60) * ( tz.offset() >= 0 ? 1 : -1 ) ); | 485 | v->setMinute( (tz.offset() % 60) * ( tz.offset() >= 0 ? 1 : -1 ) ); |
483 | 486 | ||
484 | cl.setValue( v ); | 487 | cl.setValue( v ); |
485 | vcard->add(cl); | 488 | vcard->add(cl); |
486 | } | 489 | } |
487 | 490 | ||
488 | void VCardFormatImpl::addClassValue( VCard *vcard, const Secrecy &secrecy ) | 491 | void VCardFormatImpl::addClassValue( VCard *vcard, const Secrecy &secrecy ) |
489 | { | 492 | { |
490 | ContentLine cl; | 493 | ContentLine cl; |
491 | cl.setName( EntityTypeToParamName( EntityClass ) ); | 494 | cl.setName( EntityTypeToParamName( EntityClass ) ); |
492 | 495 | ||
493 | ClassValue *v = new ClassValue; | 496 | ClassValue *v = new ClassValue; |
494 | switch ( secrecy.type() ) { | 497 | switch ( secrecy.type() ) { |
495 | case Secrecy::Public: | 498 | case Secrecy::Public: |
496 | v->setType( (int)ClassValue::Public ); | 499 | v->setType( (int)ClassValue::Public ); |
497 | break; | 500 | break; |
498 | case Secrecy::Private: | 501 | case Secrecy::Private: |
499 | v->setType( (int)ClassValue::Private ); | 502 | v->setType( (int)ClassValue::Private ); |
500 | break; | 503 | break; |
501 | case Secrecy::Confidential: | 504 | case Secrecy::Confidential: |
502 | v->setType( (int)ClassValue::Confidential ); | 505 | v->setType( (int)ClassValue::Confidential ); |
503 | break; | 506 | break; |
504 | } | 507 | } |
505 | 508 | ||
506 | cl.setValue( v ); | 509 | cl.setValue( v ); |
507 | vcard->add(cl); | 510 | vcard->add(cl); |
508 | } | 511 | } |
509 | 512 | ||
510 | 513 | ||
511 | Address VCardFormatImpl::readAddressValue( ContentLine *cl ) | 514 | Address VCardFormatImpl::readAddressValue( ContentLine *cl ) |
512 | { | 515 | { |
513 | Address a; | 516 | Address a; |
514 | AdrValue *v = (AdrValue *)cl->value(); | 517 | AdrValue *v = (AdrValue *)cl->value(); |
515 | a.setPostOfficeBox( QString::fromUtf8( v->poBox() ) ); | 518 | a.setPostOfficeBox( QString::fromUtf8( v->poBox() ) ); |
516 | a.setExtended( QString::fromUtf8( v->extAddress() ) ); | 519 | a.setExtended( QString::fromUtf8( v->extAddress() ) ); |
517 | a.setStreet( QString::fromUtf8( v->street() ) ); | 520 | a.setStreet( QString::fromUtf8( v->street() ) ); |
518 | a.setLocality( QString::fromUtf8( v->locality() ) ); | 521 | a.setLocality( QString::fromUtf8( v->locality() ) ); |
519 | a.setRegion( QString::fromUtf8( v->region() ) ); | 522 | a.setRegion( QString::fromUtf8( v->region() ) ); |
520 | a.setPostalCode( QString::fromUtf8( v->postCode() ) ); | 523 | a.setPostalCode( QString::fromUtf8( v->postCode() ) ); |
521 | a.setCountry( QString::fromUtf8( v->countryName() ) ); | 524 | a.setCountry( QString::fromUtf8( v->countryName() ) ); |
522 | 525 | ||
523 | a.setType( readAddressParam( cl ) ); | 526 | a.setType( readAddressParam( cl ) ); |
524 | 527 | ||
525 | return a; | 528 | return a; |
526 | } | 529 | } |
527 | 530 | ||
528 | int VCardFormatImpl::readAddressParam( ContentLine *cl ) | 531 | int VCardFormatImpl::readAddressParam( ContentLine *cl ) |
529 | { | 532 | { |
530 | int type = 0; | 533 | int type = 0; |
531 | ParamList params = cl->paramList(); | 534 | ParamList params = cl->paramList(); |
532 | ParamListIterator it( params ); | 535 | ParamListIterator it( params ); |
533 | QCString tmpStr; | 536 | Q3CString tmpStr; |
534 | for( ; it.current(); ++it ) { | 537 | for( ; it.current(); ++it ) { |
535 | if ( (*it)->name().upper() == "TYPE" ) { | 538 | if ( (*it)->name().upper() == "TYPE" ) { |
536 | tmpStr = (*it)->value().lower(); | 539 | tmpStr = (*it)->value().lower(); |
537 | if ( tmpStr == "dom" ) type |= Address::Dom; | 540 | if ( tmpStr == "dom" ) type |= Address::Dom; |
538 | else if ( tmpStr == "intl" ) type |= Address::Intl; | 541 | else if ( tmpStr == "intl" ) type |= Address::Intl; |
539 | else if ( tmpStr == "parcel" ) type |= Address::Parcel; | 542 | else if ( tmpStr == "parcel" ) type |= Address::Parcel; |
540 | else if ( tmpStr == "postal" ) type |= Address::Postal; | 543 | else if ( tmpStr == "postal" ) type |= Address::Postal; |
541 | else if ( tmpStr == "work" ) type |= Address::Work; | 544 | else if ( tmpStr == "work" ) type |= Address::Work; |
542 | else if ( tmpStr == "home" ) type |= Address::Home; | 545 | else if ( tmpStr == "home" ) type |= Address::Home; |
543 | else if ( tmpStr == "pref" ) type |= Address::Pref; | 546 | else if ( tmpStr == "pref" ) type |= Address::Pref; |
544 | } | 547 | } |
545 | } | 548 | } |
546 | return type; | 549 | return type; |
547 | } | 550 | } |
548 | 551 | ||
549 | void VCardFormatImpl::addNValue( VCard *vcard, const Addressee &a ) | 552 | void VCardFormatImpl::addNValue( VCard *vcard, const Addressee &a ) |
550 | { | 553 | { |
551 | ContentLine cl; | 554 | ContentLine cl; |
552 | cl.setName(EntityTypeToParamName( EntityN ) ); | 555 | cl.setName(EntityTypeToParamName( EntityN ) ); |
553 | NValue *v = new NValue; | 556 | NValue *v = new NValue; |
554 | v->setFamily( a.familyName().utf8() ); | 557 | v->setFamily( a.familyName().utf8() ); |
555 | v->setGiven( a.givenName().utf8() ); | 558 | v->setGiven( a.givenName().utf8() ); |
556 | v->setMiddle( a.additionalName().utf8() ); | 559 | v->setMiddle( a.additionalName().utf8() ); |
557 | v->setPrefix( a.prefix().utf8() ); | 560 | v->setPrefix( a.prefix().utf8() ); |
558 | v->setSuffix( a.suffix().utf8() ); | 561 | v->setSuffix( a.suffix().utf8() ); |
559 | 562 | ||
560 | cl.setValue( v ); | 563 | cl.setValue( v ); |
561 | vcard->add(cl); | 564 | vcard->add(cl); |
562 | } | 565 | } |
563 | 566 | ||
564 | void VCardFormatImpl::readNValue( ContentLine *cl, Addressee &a ) | 567 | void VCardFormatImpl::readNValue( ContentLine *cl, Addressee &a ) |
565 | { | 568 | { |
566 | NValue *v = (NValue *)cl->value(); | 569 | NValue *v = (NValue *)cl->value(); |
567 | a.setFamilyName( QString::fromUtf8( v->family() ) ); | 570 | a.setFamilyName( QString::fromUtf8( v->family() ) ); |
568 | a.setGivenName( QString::fromUtf8( v->given() ) ); | 571 | a.setGivenName( QString::fromUtf8( v->given() ) ); |
569 | a.setAdditionalName( QString::fromUtf8( v->middle() ) ); | 572 | a.setAdditionalName( QString::fromUtf8( v->middle() ) ); |
570 | a.setPrefix( QString::fromUtf8( v->prefix() ) ); | 573 | a.setPrefix( QString::fromUtf8( v->prefix() ) ); |
571 | a.setSuffix( QString::fromUtf8( v->suffix() ) ); | 574 | a.setSuffix( QString::fromUtf8( v->suffix() ) ); |
572 | } | 575 | } |
573 | 576 | ||
574 | void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p ) | 577 | void VCardFormatImpl::addTelephoneValue( VCard *v, const PhoneNumber &p ) |
575 | { | 578 | { |
576 | if ( p.number().isEmpty() ) | 579 | if ( p.number().isEmpty() ) |
577 | return; | 580 | return; |
578 | 581 | ||
579 | ContentLine cl; | 582 | ContentLine cl; |
580 | cl.setName(EntityTypeToParamName(EntityTelephone)); | 583 | cl.setName(EntityTypeToParamName(EntityTelephone)); |
581 | cl.setValue(new TelValue( p.number().utf8() )); | 584 | cl.setValue(new TelValue( p.number().utf8() )); |
582 | 585 | ||
583 | ParamList params; | 586 | ParamList params; |
584 | if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) ); | 587 | if( p.type() & PhoneNumber::Home ) params.append( new Param( "TYPE", "home" ) ); |
585 | if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) ); | 588 | if( p.type() & PhoneNumber::Work ) params.append( new Param( "TYPE", "work" ) ); |
586 | if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) ); | 589 | if( p.type() & PhoneNumber::Msg ) params.append( new Param( "TYPE", "msg" ) ); |
587 | if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) ); | 590 | if( p.type() & PhoneNumber::Pref ) params.append( new Param( "TYPE", "pref" ) ); |
588 | if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) ); | 591 | if( p.type() & PhoneNumber::Voice ) params.append( new Param( "TYPE", "voice" ) ); |
589 | if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) ); | 592 | if( p.type() & PhoneNumber::Fax ) params.append( new Param( "TYPE", "fax" ) ); |
590 | if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) ); | 593 | if( p.type() & PhoneNumber::Cell ) params.append( new Param( "TYPE", "cell" ) ); |
591 | if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) ); | 594 | if( p.type() & PhoneNumber::Video ) params.append( new Param( "TYPE", "video" ) ); |
592 | if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) ); | 595 | if( p.type() & PhoneNumber::Bbs ) params.append( new Param( "TYPE", "bbs" ) ); |
593 | if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) ); | 596 | if( p.type() & PhoneNumber::Modem ) params.append( new Param( "TYPE", "modem" ) ); |
594 | if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) ); | 597 | if( p.type() & PhoneNumber::Car ) params.append( new Param( "TYPE", "car" ) ); |
595 | if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) ); | 598 | if( p.type() & PhoneNumber::Isdn ) params.append( new Param( "TYPE", "isdn" ) ); |
596 | if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) ); | 599 | if( p.type() & PhoneNumber::Pcs ) params.append( new Param( "TYPE", "pcs" ) ); |
597 | if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) ); | 600 | if( p.type() & PhoneNumber::Pager ) params.append( new Param( "TYPE", "pager" ) ); |
598 | cl.setParamList( params ); | 601 | cl.setParamList( params ); |
599 | 602 | ||
600 | v->add(cl); | 603 | v->add(cl); |
601 | } | 604 | } |
602 | 605 | ||
603 | PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) | 606 | PhoneNumber VCardFormatImpl::readTelephoneValue( ContentLine *cl ) |
604 | { | 607 | { |
605 | PhoneNumber p; | 608 | PhoneNumber p; |
606 | TelValue *value = (TelValue *)cl->value(); | 609 | TelValue *value = (TelValue *)cl->value(); |
607 | p.setNumber( QString::fromUtf8( value->asString() ) ); | 610 | p.setNumber( QString::fromUtf8( value->asString() ) ); |
608 | 611 | ||
609 | int type = 0; | 612 | int type = 0; |
610 | ParamList params = cl->paramList(); | 613 | ParamList params = cl->paramList(); |
611 | ParamListIterator it( params ); | 614 | ParamListIterator it( params ); |
612 | QCString tmpStr; | 615 | Q3CString tmpStr; |
613 | for( ; it.current(); ++it ) { | 616 | for( ; it.current(); ++it ) { |
614 | if ( (*it)->name() == "TYPE" ) { | 617 | if ( (*it)->name() == "TYPE" ) { |
615 | tmpStr = (*it)->value().lower(); | 618 | tmpStr = (*it)->value().lower(); |
616 | if ( tmpStr == "home" ) type |= PhoneNumber::Home; | 619 | if ( tmpStr == "home" ) type |= PhoneNumber::Home; |
617 | else if ( tmpStr == "work" ) type |= PhoneNumber::Work; | 620 | else if ( tmpStr == "work" ) type |= PhoneNumber::Work; |
618 | else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg; | 621 | else if ( tmpStr == "msg" ) type |= PhoneNumber::Msg; |
619 | else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref; | 622 | else if ( tmpStr == "pref" ) type |= PhoneNumber::Pref; |
620 | else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice; | 623 | else if ( tmpStr == "voice" ) type |= PhoneNumber::Voice; |
621 | else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax; | 624 | else if ( tmpStr == "fax" ) type |= PhoneNumber::Fax; |
622 | else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell; | 625 | else if ( tmpStr == "cell" ) type |= PhoneNumber::Cell; |
623 | else if ( tmpStr == "video" ) type |= PhoneNumber::Video; | 626 | else if ( tmpStr == "video" ) type |= PhoneNumber::Video; |
624 | else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs; | 627 | else if ( tmpStr == "bbs" ) type |= PhoneNumber::Bbs; |
625 | else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem; | 628 | else if ( tmpStr == "modem" ) type |= PhoneNumber::Modem; |
626 | else if ( tmpStr == "car" ) type |= PhoneNumber::Car; | 629 | else if ( tmpStr == "car" ) type |= PhoneNumber::Car; |
627 | else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn; | 630 | else if ( tmpStr == "isdn" ) type |= PhoneNumber::Isdn; |
628 | else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs; | 631 | else if ( tmpStr == "pcs" ) type |= PhoneNumber::Pcs; |
629 | else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager; | 632 | else if ( tmpStr == "pager" ) type |= PhoneNumber::Pager; |
630 | } | 633 | } |
631 | } | 634 | } |
632 | p.setType( type ); | 635 | p.setType( type ); |
633 | 636 | ||
634 | return p; | 637 | return p; |
635 | } | 638 | } |
636 | 639 | ||
637 | QString VCardFormatImpl::readTextValue( ContentLine *cl ) | 640 | QString VCardFormatImpl::readTextValue( ContentLine *cl ) |
638 | { | 641 | { |
639 | VCARD::Value *value = cl->value(); | 642 | VCARD::Value *value = cl->value(); |
640 | if ( value ) { | 643 | if ( value ) { |
641 | return QString::fromUtf8( value->asString() ); | 644 | return QString::fromUtf8( value->asString() ); |
642 | } else { | 645 | } else { |
643 | kdDebug(5700) << "No value: " << cl->asString() << endl; | 646 | kdDebug(5700) << "No value: " << cl->asString() << endl; |
644 | qDebug("No value: %s", (const char*)(cl->asString())); | 647 | qDebug("No value: %s", (const char*)(cl->asString())); |
645 | return QString::null; | 648 | return QString::null; |
646 | } | 649 | } |
647 | } | 650 | } |
648 | 651 | ||
649 | QDate VCardFormatImpl::readDateValue( ContentLine *cl ) | 652 | QDate VCardFormatImpl::readDateValue( ContentLine *cl ) |
650 | { | 653 | { |
651 | DateValue *dateValue = (DateValue *)cl->value(); | 654 | DateValue *dateValue = (DateValue *)cl->value(); |
652 | if ( dateValue ) | 655 | if ( dateValue ) |
653 | return dateValue->qdate(); | 656 | return dateValue->qdate(); |
654 | else | 657 | else |
655 | return QDate(); | 658 | return QDate(); |
656 | } | 659 | } |
657 | 660 | ||
658 | QDateTime VCardFormatImpl::readDateTimeValue( ContentLine *cl ) | 661 | QDateTime VCardFormatImpl::readDateTimeValue( ContentLine *cl ) |
659 | { | 662 | { |
660 | DateValue *dateValue = (DateValue *)cl->value(); | 663 | DateValue *dateValue = (DateValue *)cl->value(); |
661 | if ( dateValue ) | 664 | if ( dateValue ) |
662 | return dateValue->qdt(); | 665 | return dateValue->qdt(); |
663 | else | 666 | else |
664 | return QDateTime(); | 667 | return QDateTime(); |
665 | } | 668 | } |
666 | 669 | ||
667 | Geo VCardFormatImpl::readGeoValue( ContentLine *cl ) | 670 | Geo VCardFormatImpl::readGeoValue( ContentLine *cl ) |
668 | { | 671 | { |
669 | GeoValue *geoValue = (GeoValue *)cl->value(); | 672 | GeoValue *geoValue = (GeoValue *)cl->value(); |
670 | if ( geoValue ) { | 673 | if ( geoValue ) { |
671 | Geo geo( geoValue->latitude(), geoValue->longitude() ); | 674 | Geo geo( geoValue->latitude(), geoValue->longitude() ); |
672 | return geo; | 675 | return geo; |
673 | } else | 676 | } else |
674 | return Geo(); | 677 | return Geo(); |
675 | } | 678 | } |
676 | 679 | ||
677 | TimeZone VCardFormatImpl::readUTCValue( ContentLine *cl ) | 680 | TimeZone VCardFormatImpl::readUTCValue( ContentLine *cl ) |
678 | { | 681 | { |
679 | UTCValue *utcValue = (UTCValue *)cl->value(); | 682 | UTCValue *utcValue = (UTCValue *)cl->value(); |
680 | if ( utcValue ) { | 683 | if ( utcValue ) { |
681 | TimeZone tz; | 684 | TimeZone tz; |
682 | tz.setOffset(((utcValue->hour()*60)+utcValue->minute())*(utcValue->positive() ? 1 : -1)); | 685 | tz.setOffset(((utcValue->hour()*60)+utcValue->minute())*(utcValue->positive() ? 1 : -1)); |
683 | return tz; | 686 | return tz; |
684 | } else | 687 | } else |
685 | return TimeZone(); | 688 | return TimeZone(); |
686 | } | 689 | } |
687 | 690 | ||
688 | Secrecy VCardFormatImpl::readClassValue( ContentLine *cl ) | 691 | Secrecy VCardFormatImpl::readClassValue( ContentLine *cl ) |
689 | { | 692 | { |
690 | ClassValue *classValue = (ClassValue *)cl->value(); | 693 | ClassValue *classValue = (ClassValue *)cl->value(); |
691 | if ( classValue ) { | 694 | if ( classValue ) { |
692 | Secrecy secrecy; | 695 | Secrecy secrecy; |
693 | switch ( classValue->type() ) { | 696 | switch ( classValue->type() ) { |
694 | case ClassValue::Public: | 697 | case ClassValue::Public: |
695 | secrecy.setType( Secrecy::Public ); | 698 | secrecy.setType( Secrecy::Public ); |
696 | break; | 699 | break; |
697 | case ClassValue::Private: | 700 | case ClassValue::Private: |
698 | secrecy.setType( Secrecy::Private ); | 701 | secrecy.setType( Secrecy::Private ); |
699 | break; | 702 | break; |
700 | case ClassValue::Confidential: | 703 | case ClassValue::Confidential: |
701 | secrecy.setType( Secrecy::Confidential ); | 704 | secrecy.setType( Secrecy::Confidential ); |
702 | break; | 705 | break; |
703 | } | 706 | } |
704 | 707 | ||
705 | return secrecy; | 708 | return secrecy; |
706 | } else | 709 | } else |
707 | return Secrecy(); | 710 | return Secrecy(); |
708 | } | 711 | } |
709 | 712 | ||
710 | void VCardFormatImpl::addKeyValue( VCARD::VCard *vcard, const Key &key ) | 713 | void VCardFormatImpl::addKeyValue( VCARD::VCard *vcard, const Key &key ) |
711 | { | 714 | { |
712 | ContentLine cl; | 715 | ContentLine cl; |
713 | cl.setName( EntityTypeToParamName( EntityKey ) ); | 716 | cl.setName( EntityTypeToParamName( EntityKey ) ); |
714 | 717 | ||
715 | ParamList params; | 718 | ParamList params; |
716 | if ( key.isBinary() ) { | 719 | if ( key.isBinary() ) { |
717 | cl.setValue( new TextValue( KCodecs::base64Encode( key.binaryData() ) ) ); | 720 | cl.setValue( new TextValue( KCodecs::base64Encode( key.binaryData() ) ) ); |
718 | params.append( new Param( "ENCODING", "b" ) ); | 721 | params.append( new Param( "ENCODING", "b" ) ); |
719 | } else { | 722 | } else { |
720 | cl.setValue( new TextValue( key.textData().utf8() ) ); | 723 | cl.setValue( new TextValue( key.textData().utf8() ) ); |
721 | } | 724 | } |
722 | 725 | ||
723 | switch ( key.type() ) { | 726 | switch ( key.type() ) { |
724 | case Key::X509: | 727 | case Key::X509: |
725 | params.append( new Param( "TYPE", "X509" ) ); | 728 | params.append( new Param( "TYPE", "X509" ) ); |
726 | break; | 729 | break; |
727 | case Key::PGP: | 730 | case Key::PGP: |
728 | params.append( new Param( "TYPE", "PGP" ) ); | 731 | params.append( new Param( "TYPE", "PGP" ) ); |
729 | break; | 732 | break; |
730 | case Key::Custom: | 733 | case Key::Custom: |
731 | params.append( new Param( "TYPE", key.customTypeString().utf8() ) ); | 734 | params.append( new Param( "TYPE", key.customTypeString().utf8() ) ); |
732 | break; | 735 | break; |
733 | } | 736 | } |
734 | 737 | ||
735 | cl.setParamList( params ); | 738 | cl.setParamList( params ); |
736 | vcard->add( cl ); | 739 | vcard->add( cl ); |
737 | } | 740 | } |
738 | 741 | ||
739 | Key VCardFormatImpl::readKeyValue( VCARD::ContentLine *cl ) | 742 | Key VCardFormatImpl::readKeyValue( VCARD::ContentLine *cl ) |
740 | { | 743 | { |
741 | Key key; | 744 | Key key; |
742 | bool isBinary = false; | 745 | bool isBinary = false; |
743 | TextValue *v = (TextValue *)cl->value(); | 746 | TextValue *v = (TextValue *)cl->value(); |
744 | 747 | ||
745 | ParamList params = cl->paramList(); | 748 | ParamList params = cl->paramList(); |
746 | ParamListIterator it( params ); | 749 | ParamListIterator it( params ); |
747 | for( ; it.current(); ++it ) { | 750 | for( ; it.current(); ++it ) { |
748 | if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) | 751 | if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) |
749 | isBinary = true; | 752 | isBinary = true; |
750 | if ( (*it)->name() == "TYPE" ) { | 753 | if ( (*it)->name() == "TYPE" ) { |
751 | if ( (*it)->value().isEmpty() ) | 754 | if ( (*it)->value().isEmpty() ) |
752 | continue; | 755 | continue; |
753 | if ( (*it)->value() == "X509" ) | 756 | if ( (*it)->value() == "X509" ) |
754 | key.setType( Key::X509 ); | 757 | key.setType( Key::X509 ); |
755 | else if ( (*it)->value() == "PGP" ) | 758 | else if ( (*it)->value() == "PGP" ) |
756 | key.setType( Key::PGP ); | 759 | key.setType( Key::PGP ); |
757 | else { | 760 | else { |
758 | key.setType( Key::Custom ); | 761 | key.setType( Key::Custom ); |
759 | key.setCustomTypeString( QString::fromUtf8( (*it)->value() ) ); | 762 | key.setCustomTypeString( QString::fromUtf8( (*it)->value() ) ); |
760 | } | 763 | } |
761 | } | 764 | } |
762 | } | 765 | } |
763 | 766 | ||
764 | 767 | ||
765 | if ( isBinary ) { | 768 | if ( isBinary ) { |
766 | QByteArray data; | 769 | QByteArray data; |
767 | KCodecs::base64Decode( v->asString().stripWhiteSpace(), data ); | 770 | KCodecs::base64Decode( v->asString().stripWhiteSpace(), data ); |
768 | key.setBinaryData( data ); | 771 | key.setBinaryData( data ); |
769 | } else { | 772 | } else { |
770 | key.setTextData( QString::fromUtf8( v->asString() ) ); | 773 | key.setTextData( QString::fromUtf8( v->asString() ) ); |
771 | } | 774 | } |
772 | 775 | ||
773 | return key; | 776 | return key; |
774 | } | 777 | } |
775 | 778 | ||
776 | 779 | ||
777 | void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent ) | 780 | void VCardFormatImpl::addAgentValue( VCARD::VCard *vcard, const Agent &agent ) |
778 | { | 781 | { |
779 | if ( agent.isIntern() && !agent.addressee() ) | 782 | if ( agent.isIntern() && !agent.addressee() ) |
780 | return; | 783 | return; |
781 | 784 | ||
782 | if ( !agent.isIntern() && agent.url().isEmpty() ) | 785 | if ( !agent.isIntern() && agent.url().isEmpty() ) |
783 | return; | 786 | return; |
784 | 787 | ||
785 | ContentLine cl; | 788 | ContentLine cl; |
786 | cl.setName( EntityTypeToParamName( EntityAgent ) ); | 789 | cl.setName( EntityTypeToParamName( EntityAgent ) ); |
787 | 790 | ||
788 | ParamList params; | 791 | ParamList params; |
789 | if ( agent.isIntern() ) { | 792 | if ( agent.isIntern() ) { |
790 | QString vstr; | 793 | QString vstr; |
791 | Addressee *addr = agent.addressee(); | 794 | Addressee *addr = agent.addressee(); |
792 | if ( addr ) { | 795 | if ( addr ) { |
793 | writeToString( (*addr), vstr ); | 796 | writeToString( (*addr), vstr ); |
794 | 797 | ||
795 | qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); | 798 | qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); |
796 | /*US | 799 | /*US |
797 | vstr.replace( ":", "\\:" ); | 800 | vstr.replace( ":", "\\:" ); |
798 | vstr.replace( ",", "\\," ); | 801 | vstr.replace( ",", "\\," ); |
799 | vstr.replace( ";", "\\;" ); | 802 | vstr.replace( ";", "\\;" ); |
800 | vstr.replace( "\r\n", "\\n" ); | 803 | vstr.replace( "\r\n", "\\n" ); |
801 | */ | 804 | */ |
802 | vstr.replace( QRegExp(":"), "\\:" ); | 805 | vstr.replace( QRegExp(":"), "\\:" ); |
803 | vstr.replace( QRegExp(","), "\\," ); | 806 | vstr.replace( QRegExp(","), "\\," ); |
804 | vstr.replace( QRegExp(";"), "\\;" ); | 807 | vstr.replace( QRegExp(";"), "\\;" ); |
805 | vstr.replace( QRegExp("\r\n"), "\\n" ); | 808 | vstr.replace( QRegExp("\r\n"), "\\n" ); |
806 | 809 | ||
807 | cl.setValue( new TextValue( vstr.utf8() ) ); | 810 | cl.setValue( new TextValue( vstr.utf8() ) ); |
808 | } else | 811 | } else |
809 | return; | 812 | return; |
810 | } else { | 813 | } else { |
811 | cl.setValue( new TextValue( agent.url().utf8() ) ); | 814 | cl.setValue( new TextValue( agent.url().utf8() ) ); |
812 | params.append( new Param( "VALUE", "uri" ) ); | 815 | params.append( new Param( "VALUE", "uri" ) ); |
813 | } | 816 | } |
814 | 817 | ||
815 | cl.setParamList( params ); | 818 | cl.setParamList( params ); |
816 | vcard->add( cl ); | 819 | vcard->add( cl ); |
817 | } | 820 | } |
818 | 821 | ||
819 | Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl ) | 822 | Agent VCardFormatImpl::readAgentValue( VCARD::ContentLine *cl ) |
820 | { | 823 | { |
821 | Agent agent; | 824 | Agent agent; |
822 | bool isIntern = true; | 825 | bool isIntern = true; |
823 | TextValue *v = (TextValue *)cl->value(); | 826 | TextValue *v = (TextValue *)cl->value(); |
824 | 827 | ||
825 | ParamList params = cl->paramList(); | 828 | ParamList params = cl->paramList(); |
826 | ParamListIterator it( params ); | 829 | ParamListIterator it( params ); |
827 | for( ; it.current(); ++it ) { | 830 | for( ; it.current(); ++it ) { |
828 | if ( (*it)->name() == "VALUE" && (*it)->value() == "uri" ) | 831 | if ( (*it)->name() == "VALUE" && (*it)->value() == "uri" ) |
829 | isIntern = false; | 832 | isIntern = false; |
830 | } | 833 | } |
831 | 834 | ||
832 | if ( isIntern ) { | 835 | if ( isIntern ) { |
833 | QString vstr = QString::fromUtf8( v->asString() ); | 836 | QString vstr = QString::fromUtf8( v->asString() ); |
834 | qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); | 837 | qDebug("VCardFormatImpl::addAgentValue please verify if replace is correct"); |
835 | /*US | 838 | /*US |
836 | vstr.replace( "\\n", "\r\n" ); | 839 | vstr.replace( "\\n", "\r\n" ); |
837 | vstr.replace( "\\:", ":" ); | 840 | vstr.replace( "\\:", ":" ); |
838 | vstr.replace( "\\,", "," ); | 841 | vstr.replace( "\\,", "," ); |
839 | vstr.replace( "\\;", ";" ); | 842 | vstr.replace( "\\;", ";" ); |
840 | */ | 843 | */ |
841 | vstr.replace( QRegExp("\\\\n"), "\r\n" ); | 844 | vstr.replace( QRegExp("\\\\n"), "\r\n" ); |
842 | vstr.replace( QRegExp("\\\\:"), ":" ); | 845 | vstr.replace( QRegExp("\\\\:"), ":" ); |
843 | vstr.replace( QRegExp("\\\\,"), "," ); | 846 | vstr.replace( QRegExp("\\\\,"), "," ); |
844 | vstr.replace( QRegExp("\\\\;"), ";" ); | 847 | vstr.replace( QRegExp("\\\\;"), ";" ); |
845 | 848 | ||
846 | Addressee *addr = new Addressee; | 849 | Addressee *addr = new Addressee; |
847 | readFromString( vstr, *addr ); | 850 | readFromString( vstr, *addr ); |
848 | agent.setAddressee( addr ); | 851 | agent.setAddressee( addr ); |
849 | } else { | 852 | } else { |
850 | agent.setUrl( QString::fromUtf8( v->asString() ) ); | 853 | agent.setUrl( QString::fromUtf8( v->asString() ) ); |
851 | } | 854 | } |
852 | 855 | ||
853 | return agent; | 856 | return agent; |
854 | } | 857 | } |
855 | 858 | ||
856 | #include <qstringlist.h> | 859 | #include <qstringlist.h> |
857 | void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType type, const Picture &pic, const Addressee &addr, bool intern ) | 860 | void VCardFormatImpl::addPictureValue( VCARD::VCard *vcard, VCARD::EntityType type, const Picture &pic, const Addressee &addr, bool intern ) |
858 | { | 861 | { |
859 | ContentLine cl; | 862 | ContentLine cl; |
860 | cl.setName( EntityTypeToParamName( type ) ); | 863 | cl.setName( EntityTypeToParamName( type ) ); |
861 | // qDebug( "IIIMMMMM %s",QImage::outputFormatList ().join("-").latin1() ); | 864 | // qDebug( "IIIMMMMM %s",QImage::outputFormatList ().join("-").latin1() ); |
862 | if ( pic.isIntern() && pic.data().isNull() ) | 865 | if ( pic.isIntern() && pic.data().isNull() ) |
863 | return; | 866 | return; |
864 | 867 | ||
865 | if ( !pic.isIntern() && pic.url().isEmpty() ) | 868 | if ( !pic.isIntern() && pic.url().isEmpty() ) |
866 | return; | 869 | return; |
867 | 870 | ||
868 | ParamList params; | 871 | ParamList params; |
869 | if ( pic.isIntern() ) { | 872 | if ( pic.isIntern() ) { |
870 | QImage img = pic.data(); | 873 | QImage img = pic.data(); |
871 | if ( intern ) { // only for vCard export we really write the data inline | 874 | if ( intern ) { // only for vCard export we really write the data inline |
872 | QByteArray data; | 875 | QByteArray data; |
873 | QDataStream s( data, IO_WriteOnly ); | 876 | QDataStream s( &data, QIODevice::WriteOnly ); |
874 | s.setVersion( 4 ); // to produce valid png files | 877 | s.setVersion( 4 ); // to produce valid png files |
875 | s << img; | 878 | s << img; |
876 | cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); | 879 | cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); |
877 | params.append( new Param( "ENCODING", "b" ) ); | 880 | params.append( new Param( "ENCODING", "b" ) ); |
878 | if ( !pic.type().isEmpty() ) | 881 | if ( !pic.type().isEmpty() ) |
879 | params.append( new Param( "TYPE", pic.type().utf8() ) ); | 882 | params.append( new Param( "TYPE", pic.type().utf8() ) ); |
880 | } else { // save picture in cache | 883 | } else { // save picture in cache |
881 | QString dir; | 884 | QString dir; |
882 | if ( type == EntityPhoto ) | 885 | if ( type == EntityPhoto ) |
883 | dir = "photos"; | 886 | dir = "photos"; |
884 | if ( type == EntityLogo ) | 887 | if ( type == EntityLogo ) |
885 | dir = "logos"; | 888 | dir = "logos"; |
886 | QString imUrl = locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ); | 889 | QString imUrl = locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ); |
887 | KABC::Picture* ppic =(KABC::Picture*) &pic; | 890 | KABC::Picture* ppic =(KABC::Picture*) &pic; |
888 | ppic->setUrl( imUrl ); | 891 | ppic->setUrl( imUrl ); |
889 | img.save(imUrl, "PNG" ); | 892 | img.save(imUrl, "PNG" ); |
890 | cl.setValue( new TextValue( pic.url().utf8() ) ); | 893 | cl.setValue( new TextValue( pic.url().utf8() ) ); |
891 | params.append( new Param( "VALUE", "uri" ) ); | 894 | params.append( new Param( "VALUE", "uri" ) ); |
892 | } | 895 | } |
893 | 896 | ||
894 | } else { | 897 | } else { |
895 | 898 | ||
896 | cl.setValue( new TextValue( pic.url().utf8() ) ); | 899 | cl.setValue( new TextValue( pic.url().utf8() ) ); |
897 | params.append( new Param( "VALUE", "uri" ) ); | 900 | params.append( new Param( "VALUE", "uri" ) ); |
898 | } | 901 | } |
899 | 902 | ||
900 | cl.setParamList( params ); | 903 | cl.setParamList( params ); |
901 | vcard->add( cl ); | 904 | vcard->add( cl ); |
902 | } | 905 | } |
903 | 906 | ||
904 | Picture VCardFormatImpl::readPictureValue( VCARD::ContentLine *cl, VCARD::EntityType type, const Addressee &addr ) | 907 | Picture VCardFormatImpl::readPictureValue( VCARD::ContentLine *cl, VCARD::EntityType type, const Addressee &addr ) |
905 | { | 908 | { |
906 | Picture pic; | 909 | Picture pic; |
907 | bool isInline = false; | 910 | bool isInline = false; |
908 | QString picType; | 911 | QString picType; |
909 | TextValue *v = (TextValue *)cl->value(); | 912 | TextValue *v = (TextValue *)cl->value(); |
910 | 913 | ||
911 | ParamList params = cl->paramList(); | 914 | ParamList params = cl->paramList(); |
912 | ParamListIterator it( params ); | 915 | ParamListIterator it( params ); |
913 | for( ; it.current(); ++it ) { | 916 | for( ; it.current(); ++it ) { |
914 | if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) | 917 | if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) |
915 | isInline = true; | 918 | isInline = true; |
916 | if ( (*it)->name() == "TYPE" && !(*it)->value().isEmpty() ) | 919 | if ( (*it)->name() == "TYPE" && !(*it)->value().isEmpty() ) |
917 | picType = QString::fromUtf8( (*it)->value() ); | 920 | picType = QString::fromUtf8( (*it)->value() ); |
918 | } | 921 | } |
919 | 922 | ||
920 | if ( isInline ) { | 923 | if ( isInline ) { |
921 | QImage img; | 924 | QImage img; |
922 | if ( v->asString() == "<dummy>" ) { // no picture inline stored => picture is in cache | 925 | if ( v->asString() == "<dummy>" ) { // no picture inline stored => picture is in cache |
923 | QString dir; | 926 | QString dir; |
924 | if ( type == EntityPhoto ) | 927 | if ( type == EntityPhoto ) |
925 | dir = "photos"; | 928 | dir = "photos"; |
926 | if ( type == EntityLogo ) | 929 | if ( type == EntityLogo ) |
927 | dir = "logos"; | 930 | dir = "logos"; |
928 | 931 | ||
929 | img.load( locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ) ); | 932 | img.load( locateLocal( "data", "kabc/" + dir + "/" + addr.uid() ) ); |
930 | } else { | 933 | } else { |
931 | QByteArray data; | 934 | QByteArray data; |
932 | KCodecs::base64Decode( v->asString(), data ); | 935 | KCodecs::base64Decode( v->asString(), data ); |
933 | img.loadFromData( data ); | 936 | img.loadFromData( data ); |
934 | } | 937 | } |
935 | pic.setData( img ); | 938 | pic.setData( img ); |
936 | pic.setType( picType ); | 939 | pic.setType( picType ); |
937 | } else { | 940 | } else { |
938 | pic.setUrl( QString::fromUtf8( v->asString() ) ); | 941 | pic.setUrl( QString::fromUtf8( v->asString() ) ); |
939 | } | 942 | } |
940 | 943 | ||
941 | return pic; | 944 | return pic; |
942 | } | 945 | } |
943 | 946 | ||
944 | void VCardFormatImpl::addSoundValue( VCARD::VCard *vcard, const Sound &sound, const Addressee &addr, bool intern ) | 947 | void VCardFormatImpl::addSoundValue( VCARD::VCard *vcard, const Sound &sound, const Addressee &addr, bool intern ) |
945 | { | 948 | { |
946 | ContentLine cl; | 949 | ContentLine cl; |
947 | cl.setName( EntityTypeToParamName( EntitySound ) ); | 950 | cl.setName( EntityTypeToParamName( EntitySound ) ); |
948 | 951 | ||
949 | if ( sound.isIntern() && sound.data().isNull() ) | 952 | if ( sound.isIntern() && sound.data().isNull() ) |
950 | return; | 953 | return; |
951 | 954 | ||
952 | if ( !sound.isIntern() && sound.url().isEmpty() ) | 955 | if ( !sound.isIntern() && sound.url().isEmpty() ) |
953 | return; | 956 | return; |
954 | 957 | ||
955 | ParamList params; | 958 | ParamList params; |
956 | if ( sound.isIntern() ) { | 959 | if ( sound.isIntern() ) { |
957 | QByteArray data = sound.data(); | 960 | QByteArray data = sound.data(); |
958 | if ( intern ) { // only for vCard export we really write the data inline | 961 | if ( intern ) { // only for vCard export we really write the data inline |
959 | cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); | 962 | cl.setValue( new TextValue( KCodecs::base64Encode( data ) ) ); |
960 | } else { // save sound in cache | 963 | } else { // save sound in cache |
961 | QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) ); | 964 | QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) ); |
962 | if ( file.open( IO_WriteOnly ) ) { | 965 | if ( file.open( QIODevice::WriteOnly ) ) { |
963 | file.writeBlock( data ); | 966 | file.writeBlock( data ); |
964 | } | 967 | } |
965 | cl.setValue( new TextValue( "<dummy>" ) ); | 968 | cl.setValue( new TextValue( "<dummy>" ) ); |
966 | } | 969 | } |
967 | params.append( new Param( "ENCODING", "b" ) ); | 970 | params.append( new Param( "ENCODING", "b" ) ); |
968 | } else { | 971 | } else { |
969 | cl.setValue( new TextValue( sound.url().utf8() ) ); | 972 | cl.setValue( new TextValue( sound.url().utf8() ) ); |
970 | params.append( new Param( "VALUE", "uri" ) ); | 973 | params.append( new Param( "VALUE", "uri" ) ); |
971 | } | 974 | } |
972 | 975 | ||
973 | cl.setParamList( params ); | 976 | cl.setParamList( params ); |
974 | vcard->add( cl ); | 977 | vcard->add( cl ); |
975 | } | 978 | } |
976 | 979 | ||
977 | Sound VCardFormatImpl::readSoundValue( VCARD::ContentLine *cl, const Addressee &addr ) | 980 | Sound VCardFormatImpl::readSoundValue( VCARD::ContentLine *cl, const Addressee &addr ) |
978 | { | 981 | { |
979 | Sound sound; | 982 | Sound sound; |
980 | bool isInline = false; | 983 | bool isInline = false; |
981 | TextValue *v = (TextValue *)cl->value(); | 984 | TextValue *v = (TextValue *)cl->value(); |
982 | 985 | ||
983 | ParamList params = cl->paramList(); | 986 | ParamList params = cl->paramList(); |
984 | ParamListIterator it( params ); | 987 | ParamListIterator it( params ); |
985 | for( ; it.current(); ++it ) { | 988 | for( ; it.current(); ++it ) { |
986 | if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) | 989 | if ( (*it)->name() == "ENCODING" && (*it)->value() == "b" ) |
987 | isInline = true; | 990 | isInline = true; |
988 | } | 991 | } |
989 | 992 | ||
990 | if ( isInline ) { | 993 | if ( isInline ) { |
991 | QByteArray data; | 994 | QByteArray data; |
992 | if ( v->asString() == "<dummy>" ) { // no sound inline stored => sound is in cache | 995 | if ( v->asString() == "<dummy>" ) { // no sound inline stored => sound is in cache |
993 | QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) ); | 996 | QFile file( locateLocal( "data", "kabc/sounds/" + addr.uid() ) ); |
994 | if ( file.open( IO_ReadOnly ) ) { | 997 | if ( file.open( QIODevice::ReadOnly ) ) { |
995 | data = file.readAll(); | 998 | data = file.readAll(); |
996 | file.close(); | 999 | file.close(); |
997 | } | 1000 | } |
998 | } else { | 1001 | } else { |
999 | KCodecs::base64Decode( v->asString(), data ); | 1002 | KCodecs::base64Decode( v->asString(), data ); |
1000 | } | 1003 | } |
1001 | sound.setData( data ); | 1004 | sound.setData( data ); |
1002 | } else { | 1005 | } else { |
1003 | sound.setUrl( QString::fromUtf8( v->asString() ) ); | 1006 | sound.setUrl( QString::fromUtf8( v->asString() ) ); |
1004 | } | 1007 | } |
1005 | 1008 | ||
1006 | return sound; | 1009 | return sound; |
1007 | } | 1010 | } |
1008 | 1011 | ||
1009 | bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee ) | 1012 | bool VCardFormatImpl::readFromString( const QString &vcard, Addressee &addressee ) |
1010 | { | 1013 | { |
1011 | VCardEntity e( vcard.utf8() ); | 1014 | VCardEntity e( vcard.utf8() ); |
1012 | VCardListIterator it( e.cardList() ); | 1015 | VCardListIterator it( e.cardList() ); |
1013 | 1016 | ||
1014 | if ( it.current() ) { | 1017 | if ( it.current() ) { |
1015 | //US VCard v(*it.current()); | 1018 | //US VCard v(*it.current()); |
1016 | //US loadAddressee( addressee, v ); | 1019 | //US loadAddressee( addressee, v ); |
1017 | loadAddressee( addressee, it.current() ); | 1020 | loadAddressee( addressee, it.current() ); |
1018 | return true; | 1021 | return true; |
1019 | } | 1022 | } |
1020 | 1023 | ||
1021 | return false; | 1024 | return false; |
1022 | } | 1025 | } |
1023 | 1026 | ||
1024 | bool VCardFormatImpl::writeToString( const Addressee &addressee, QString &vcard ) | 1027 | bool VCardFormatImpl::writeToString( const Addressee &addressee, QString &vcard ) |
1025 | { | 1028 | { |
1026 | VCardEntity vcards; | 1029 | VCardEntity vcards; |
1027 | VCardList vcardlist; | 1030 | VCardList vcardlist; |
1028 | vcardlist.setAutoDelete( true ); | 1031 | vcardlist.setAutoDelete( true ); |
1029 | 1032 | ||
1030 | VCard *v = new VCard; | 1033 | VCard *v = new VCard; |
1031 | 1034 | ||
1032 | saveAddressee( addressee, v, true ); | 1035 | saveAddressee( addressee, v, true ); |
1033 | 1036 | ||
1034 | vcardlist.append( v ); | 1037 | vcardlist.append( v ); |
1035 | vcards.setCardList( vcardlist ); | 1038 | vcards.setCardList( vcardlist ); |
1036 | vcard = QString::fromUtf8( vcards.asString() ); | 1039 | vcard = QString::fromUtf8( vcards.asString() ); |
1037 | 1040 | ||
1038 | return true; | 1041 | return true; |
1039 | } | 1042 | } |
diff --git a/kabc/vcardformatplugin.cpp b/kabc/vcardformatplugin.cpp index 8db8c11..0b97a08 100644 --- a/kabc/vcardformatplugin.cpp +++ b/kabc/vcardformatplugin.cpp | |||
@@ -1,70 +1,70 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> | 3 | Copyright (c) 2001 Cornelius Schumacher <schumacher@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "vcardformatplugin.h" | 21 | #include "vcardformatplugin.h" |
22 | #include "vcardformatimpl.h" | 22 | #include "vcardformatimpl.h" |
23 | 23 | ||
24 | using namespace KABC; | 24 | using namespace KABC; |
25 | 25 | ||
26 | VCardFormatPlugin::VCardFormatPlugin() | 26 | VCardFormatPlugin::VCardFormatPlugin() |
27 | { | 27 | { |
28 | mImpl = new VCardFormatImpl; | 28 | mImpl = new VCardFormatImpl; |
29 | } | 29 | } |
30 | 30 | ||
31 | VCardFormatPlugin::~VCardFormatPlugin() | 31 | VCardFormatPlugin::~VCardFormatPlugin() |
32 | { | 32 | { |
33 | delete mImpl; | 33 | delete mImpl; |
34 | } | 34 | } |
35 | 35 | ||
36 | bool VCardFormatPlugin::load( Addressee &addressee, QFile *file ) | 36 | bool VCardFormatPlugin::load( Addressee &addressee, QFile *file ) |
37 | { | 37 | { |
38 | qDebug("VCardFormatPlugin::load"); | 38 | qDebug("VCardFormatPlugin::load"); |
39 | return mImpl->load( addressee, file ); | 39 | return mImpl->load( addressee, file ); |
40 | } | 40 | } |
41 | 41 | ||
42 | bool VCardFormatPlugin::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 42 | bool VCardFormatPlugin::loadAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
43 | { | 43 | { |
44 | // qDebug("VCardFormatPlugin::loadAll"); | 44 | // qDebug("VCardFormatPlugin::loadAll"); |
45 | return mImpl->loadAll( addressBook, resource, file ); | 45 | return mImpl->loadAll( addressBook, resource, file ); |
46 | } | 46 | } |
47 | 47 | ||
48 | void VCardFormatPlugin::save( const Addressee &addressee, QFile *file ) | 48 | void VCardFormatPlugin::save( const Addressee &addressee, QFile *file ) |
49 | { | 49 | { |
50 | qDebug("VCardFormatPlugin::save"); | 50 | qDebug("VCardFormatPlugin::save"); |
51 | mImpl->save( addressee, file ); | 51 | mImpl->save( addressee, file ); |
52 | } | 52 | } |
53 | 53 | ||
54 | void VCardFormatPlugin::saveAll( AddressBook *addressBook, Resource *resource, QFile *file ) | 54 | void VCardFormatPlugin::saveAll( AddressBook *addressBook, Resource *resource, QFile *file ) |
55 | { | 55 | { |
56 | qDebug("VCardFormatPlugin::saveAll"); | 56 | qDebug("VCardFormatPlugin::saveAll"); |
57 | mImpl->saveAll( addressBook, resource, file ); | 57 | mImpl->saveAll( addressBook, resource, file ); |
58 | } | 58 | } |
59 | 59 | ||
60 | bool VCardFormatPlugin::checkFormat( QFile *file ) const | 60 | bool VCardFormatPlugin::checkFormat( QFile *file ) const |
61 | { | 61 | { |
62 | QString line; | 62 | QString line; |
63 | 63 | ||
64 | file->readLine( line, 1024 ); | 64 | char tmp[1024]; file->readLine( tmp, 1024 ); line = tmp; |
65 | line = line.stripWhiteSpace(); | 65 | line = line.stripWhiteSpace(); |
66 | if ( line == "BEGIN:VCARD" ) | 66 | if ( line == "BEGIN:VCARD" ) |
67 | return true; | 67 | return true; |
68 | else | 68 | else |
69 | return false; | 69 | return false; |
70 | } | 70 | } |
diff --git a/kabc/vcardparser/vcard.h b/kabc/vcardparser/vcard.h index 0bee441..85b50e4 100644 --- a/kabc/vcardparser/vcard.h +++ b/kabc/vcardparser/vcard.h | |||
@@ -1,91 +1,91 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef VCARDPARSER_VCARD_H | 21 | #ifndef VCARDPARSER_VCARD_H |
22 | #define VCARDPARSER_VCARD_H | 22 | #define VCARDPARSER_VCARD_H |
23 | 23 | ||
24 | #include "vcardline.h" | 24 | #include "vcardline.h" |
25 | #include <qmap.h> | 25 | #include <qmap.h> |
26 | #include <qstringlist.h> | 26 | #include <qstringlist.h> |
27 | #include <qvaluelist.h> | 27 | #include <q3valuelist.h> |
28 | 28 | ||
29 | namespace KABC { | 29 | namespace KABC { |
30 | 30 | ||
31 | class VCard | 31 | class VCard |
32 | { | 32 | { |
33 | public: | 33 | public: |
34 | typedef QValueList<VCard> List; | 34 | typedef Q3ValueList<VCard> List; |
35 | typedef QMap< QString, VCardLine::List > LineMap; | 35 | typedef QMap< QString, VCardLine::List > LineMap; |
36 | 36 | ||
37 | enum Version { v2_1, v3_0 }; | 37 | enum Version { v2_1, v3_0 }; |
38 | 38 | ||
39 | VCard(); | 39 | VCard(); |
40 | VCard( const VCard& ); | 40 | VCard( const VCard& ); |
41 | 41 | ||
42 | ~VCard(); | 42 | ~VCard(); |
43 | 43 | ||
44 | VCard& operator=( const VCard& ); | 44 | VCard& operator=( const VCard& ); |
45 | 45 | ||
46 | /** | 46 | /** |
47 | * Removes all lines from the vCard. | 47 | * Removes all lines from the vCard. |
48 | */ | 48 | */ |
49 | void clear(); | 49 | void clear(); |
50 | 50 | ||
51 | /** | 51 | /** |
52 | * Returns a list of all identifiers that exists in the | 52 | * Returns a list of all identifiers that exists in the |
53 | * vCard. | 53 | * vCard. |
54 | */ | 54 | */ |
55 | QStringList identifiers() const; | 55 | QStringList identifiers() const; |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * Adds a VCardLine to the VCard | 58 | * Adds a VCardLine to the VCard |
59 | */ | 59 | */ |
60 | void addLine( const VCardLine& line ); | 60 | void addLine( const VCardLine& line ); |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * Returns all lines of the vcard with a special identifier. | 63 | * Returns all lines of the vcard with a special identifier. |
64 | */ | 64 | */ |
65 | VCardLine::List lines( const QString& identifier ) const; | 65 | VCardLine::List lines( const QString& identifier ) const; |
66 | 66 | ||
67 | /** | 67 | /** |
68 | * Returns only the first line of the vcard with a special identifier. | 68 | * Returns only the first line of the vcard with a special identifier. |
69 | */ | 69 | */ |
70 | VCardLine line( const QString& identifier ) const; | 70 | VCardLine line( const QString& identifier ) const; |
71 | 71 | ||
72 | /** | 72 | /** |
73 | * Set the version of the vCard. | 73 | * Set the version of the vCard. |
74 | */ | 74 | */ |
75 | void setVersion( Version version ); | 75 | void setVersion( Version version ); |
76 | 76 | ||
77 | /** | 77 | /** |
78 | * Returns the version of this vCard. | 78 | * Returns the version of this vCard. |
79 | */ | 79 | */ |
80 | Version version() const; | 80 | Version version() const; |
81 | 81 | ||
82 | private: | 82 | private: |
83 | LineMap mLineMap; | 83 | LineMap mLineMap; |
84 | 84 | ||
85 | class VCardPrivate; | 85 | class VCardPrivate; |
86 | VCardPrivate *d; | 86 | VCardPrivate *d; |
87 | }; | 87 | }; |
88 | 88 | ||
89 | } | 89 | } |
90 | 90 | ||
91 | #endif | 91 | #endif |
diff --git a/kabc/vcardparser/vcardline.cpp b/kabc/vcardparser/vcardline.cpp index 8df2d32..c7254a0 100644 --- a/kabc/vcardparser/vcardline.cpp +++ b/kabc/vcardparser/vcardline.cpp | |||
@@ -1,175 +1,177 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include "vcardline.h" | 21 | #include "vcardline.h" |
22 | //Added by qt3to4: | ||
23 | #include <Q3CString> | ||
22 | 24 | ||
23 | using namespace KABC; | 25 | using namespace KABC; |
24 | 26 | ||
25 | class VCardLine::VCardLinePrivate | 27 | class VCardLine::VCardLinePrivate |
26 | { | 28 | { |
27 | public: | 29 | public: |
28 | QString mGroup; | 30 | QString mGroup; |
29 | }; | 31 | }; |
30 | 32 | ||
31 | VCardLine::VCardLine() | 33 | VCardLine::VCardLine() |
32 | : d( 0 ) | 34 | : d( 0 ) |
33 | { | 35 | { |
34 | } | 36 | } |
35 | 37 | ||
36 | VCardLine::VCardLine( const QString &identifier ) | 38 | VCardLine::VCardLine( const QString &identifier ) |
37 | : d( 0 ) | 39 | : d( 0 ) |
38 | { | 40 | { |
39 | mIdentifier = identifier; | 41 | mIdentifier = identifier; |
40 | } | 42 | } |
41 | 43 | ||
42 | VCardLine::VCardLine( const QString &identifier, const QString &value ) | 44 | VCardLine::VCardLine( const QString &identifier, const QString &value ) |
43 | : d( 0 ) | 45 | : d( 0 ) |
44 | { | 46 | { |
45 | mIdentifier = identifier; | 47 | mIdentifier = identifier; |
46 | mValue.assign( value.data(), value.length() ); | 48 | mValue = value; |
47 | } | 49 | } |
48 | 50 | ||
49 | VCardLine::VCardLine( const VCardLine& line ) | 51 | VCardLine::VCardLine( const VCardLine& line ) |
50 | : d( 0 ) | 52 | : d( 0 ) |
51 | { | 53 | { |
52 | mParamMap = line.mParamMap; | 54 | mParamMap = line.mParamMap; |
53 | mValue = line.mValue; | 55 | mValue = line.mValue; |
54 | mIdentifier = line.mIdentifier; | 56 | mIdentifier = line.mIdentifier; |
55 | } | 57 | } |
56 | 58 | ||
57 | VCardLine::~VCardLine() | 59 | VCardLine::~VCardLine() |
58 | { | 60 | { |
59 | delete d; | 61 | delete d; |
60 | d = 0; | 62 | d = 0; |
61 | } | 63 | } |
62 | 64 | ||
63 | VCardLine& VCardLine::operator=( const VCardLine& line ) | 65 | VCardLine& VCardLine::operator=( const VCardLine& line ) |
64 | { | 66 | { |
65 | if ( &line == this ) | 67 | if ( &line == this ) |
66 | return *this; | 68 | return *this; |
67 | 69 | ||
68 | mParamMap = line.mParamMap; | 70 | mParamMap = line.mParamMap; |
69 | mValue = line.mValue; | 71 | mValue = line.mValue; |
70 | mIdentifier = line.mIdentifier; | 72 | mIdentifier = line.mIdentifier; |
71 | 73 | ||
72 | return *this; | 74 | return *this; |
73 | } | 75 | } |
74 | 76 | ||
75 | void VCardLine::setIdentifier( const QString& identifier ) | 77 | void VCardLine::setIdentifier( const QString& identifier ) |
76 | { | 78 | { |
77 | mIdentifier = identifier; | 79 | mIdentifier = identifier; |
78 | } | 80 | } |
79 | 81 | ||
80 | QString VCardLine::identifier() const | 82 | QString VCardLine::identifier() const |
81 | { | 83 | { |
82 | return mIdentifier; | 84 | return mIdentifier; |
83 | } | 85 | } |
84 | 86 | ||
85 | void VCardLine::setValueString( const QString& value ) | 87 | void VCardLine::setValueString( const QString& value ) |
86 | { | 88 | { |
87 | setValueCString( value.utf8() ); | 89 | setValueCString( value.utf8() ); |
88 | } | 90 | } |
89 | void VCardLine::setValueCString( const QCString& value ) | 91 | void VCardLine::setValueCString( const Q3CString& value ) |
90 | { | 92 | { |
91 | mValue.duplicate( value.data(), value.length() ); | 93 | mValue.duplicate( value.data(), value.length() ); |
92 | } | 94 | } |
93 | 95 | ||
94 | void VCardLine::setValueBytes( const QByteArray& value ) | 96 | void VCardLine::setValueBytes( const QByteArray& value ) |
95 | { | 97 | { |
96 | mValue = value; | 98 | mValue = value; |
97 | } | 99 | } |
98 | 100 | ||
99 | QString VCardLine::valueString() const | 101 | QString VCardLine::valueString() const |
100 | { | 102 | { |
101 | return QString::fromUtf8( mValue.data(), mValue.size() ); | 103 | return QString::fromUtf8( mValue.data(), mValue.size() ); |
102 | } | 104 | } |
103 | 105 | ||
104 | QByteArray VCardLine::valueBytes() const | 106 | QByteArray VCardLine::valueBytes() const |
105 | { | 107 | { |
106 | return mValue; | 108 | return mValue; |
107 | } | 109 | } |
108 | 110 | ||
109 | void VCardLine::setGroup( const QString& group ) | 111 | void VCardLine::setGroup( const QString& group ) |
110 | { | 112 | { |
111 | if ( !d ) | 113 | if ( !d ) |
112 | d = new VCardLinePrivate(); | 114 | d = new VCardLinePrivate(); |
113 | 115 | ||
114 | d->mGroup = group; | 116 | d->mGroup = group; |
115 | } | 117 | } |
116 | 118 | ||
117 | QString VCardLine::group() const | 119 | QString VCardLine::group() const |
118 | { | 120 | { |
119 | if ( d ) | 121 | if ( d ) |
120 | return d->mGroup; | 122 | return d->mGroup; |
121 | else | 123 | else |
122 | return QString(); | 124 | return QString(); |
123 | } | 125 | } |
124 | 126 | ||
125 | bool VCardLine::hasGroup() const | 127 | bool VCardLine::hasGroup() const |
126 | { | 128 | { |
127 | if ( !d ) | 129 | if ( !d ) |
128 | return false; | 130 | return false; |
129 | else | 131 | else |
130 | return d->mGroup.isEmpty(); | 132 | return d->mGroup.isEmpty(); |
131 | } | 133 | } |
132 | 134 | ||
133 | QStringList VCardLine::parameterList() const | 135 | QStringList VCardLine::parameterList() const |
134 | { | 136 | { |
135 | //return mParamMap.keys(); | 137 | //return mParamMap.keys(); |
136 | //US method QMap::keys() not available yet. SO collect the data manually | 138 | //US method QMap::keys() not available yet. SO collect the data manually |
137 | //US return mParamMap->keys(); | 139 | //US return mParamMap->keys(); |
138 | 140 | ||
139 | QStringList result; | 141 | QStringList result; |
140 | 142 | ||
141 | QMap<QString, QStringList>::ConstIterator it; | 143 | QMap<QString, QStringList>::ConstIterator it; |
142 | for( it = mParamMap.begin(); it != mParamMap.end(); ++it ) { | 144 | for( it = mParamMap.begin(); it != mParamMap.end(); ++it ) { |
143 | result << it.key().latin1(); | 145 | result << it.key().latin1(); |
144 | } | 146 | } |
145 | return result; | 147 | return result; |
146 | } | 148 | } |
147 | 149 | ||
148 | void VCardLine::addParameter( const QString& param, const QString& value ) | 150 | void VCardLine::addParameter( const QString& param, const QString& value ) |
149 | { | 151 | { |
150 | QStringList &list = mParamMap[ param ]; | 152 | QStringList &list = mParamMap[ param ]; |
151 | if ( list.findIndex( value ) == -1 ) // not included yet | 153 | if ( list.findIndex( value ) == -1 ) // not included yet |
152 | list.append( value ); | 154 | list.append( value ); |
153 | } | 155 | } |
154 | 156 | ||
155 | QStringList VCardLine::parameters( const QString& param ) const | 157 | QStringList VCardLine::parameters( const QString& param ) const |
156 | { | 158 | { |
157 | ParamMap::ConstIterator it = mParamMap.find( param ); | 159 | ParamMap::ConstIterator it = mParamMap.find( param ); |
158 | if ( it == mParamMap.end() ) | 160 | if ( it == mParamMap.end() ) |
159 | return QStringList(); | 161 | return QStringList(); |
160 | else | 162 | else |
161 | return *it; | 163 | return *it; |
162 | } | 164 | } |
163 | 165 | ||
164 | QString VCardLine::parameter( const QString& param ) const | 166 | QString VCardLine::parameter( const QString& param ) const |
165 | { | 167 | { |
166 | ParamMap::ConstIterator it = mParamMap.find( param ); | 168 | ParamMap::ConstIterator it = mParamMap.find( param ); |
167 | if ( it == mParamMap.end() ) | 169 | if ( it == mParamMap.end() ) |
168 | return QString::null; | 170 | return QString::null; |
169 | else { | 171 | else { |
170 | if ( (*it).isEmpty() ) | 172 | if ( (*it).isEmpty() ) |
171 | return QString::null; | 173 | return QString::null; |
172 | else | 174 | else |
173 | return (*it).first(); | 175 | return (*it).first(); |
174 | } | 176 | } |
175 | } | 177 | } |
diff --git a/kabc/vcardparser/vcardline.h b/kabc/vcardparser/vcardline.h index 8dc9322..dc4bdec 100644 --- a/kabc/vcardparser/vcardline.h +++ b/kabc/vcardparser/vcardline.h | |||
@@ -1,119 +1,119 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #ifndef VCARDLINE_H | 21 | #ifndef VCARDLINE_H |
22 | #define VCARDLINE_H | 22 | #define VCARDLINE_H |
23 | 23 | ||
24 | #include <qstringlist.h> | 24 | #include <qstringlist.h> |
25 | #include <qvaluelist.h> | 25 | #include <q3valuelist.h> |
26 | #include <qcstring.h> | 26 | #include <q3cstring.h> |
27 | #include <qvariant.h> | 27 | #include <qvariant.h> |
28 | #include <qmap.h> | 28 | #include <qmap.h> |
29 | #include <qstring.h> | 29 | #include <qstring.h> |
30 | 30 | ||
31 | namespace KABC { | 31 | namespace KABC { |
32 | 32 | ||
33 | class VCardLine | 33 | class VCardLine |
34 | { | 34 | { |
35 | public: | 35 | public: |
36 | typedef QValueList<VCardLine> List; | 36 | typedef Q3ValueList<VCardLine> List; |
37 | typedef QMap<QString, QStringList> ParamMap; | 37 | typedef QMap<QString, QStringList> ParamMap; |
38 | 38 | ||
39 | VCardLine(); | 39 | VCardLine(); |
40 | VCardLine( const QString &identifier ); | 40 | VCardLine( const QString &identifier ); |
41 | VCardLine( const QString &identifier, const QString &value ); | 41 | VCardLine( const QString &identifier, const QString &value ); |
42 | VCardLine( const VCardLine& ); | 42 | VCardLine( const VCardLine& ); |
43 | 43 | ||
44 | ~VCardLine(); | 44 | ~VCardLine(); |
45 | 45 | ||
46 | VCardLine& operator=( const VCardLine& ); | 46 | VCardLine& operator=( const VCardLine& ); |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * Sets the identifier of this line e.g. UID, FN, CLASS | 49 | * Sets the identifier of this line e.g. UID, FN, CLASS |
50 | */ | 50 | */ |
51 | void setIdentifier( const QString& identifier ); | 51 | void setIdentifier( const QString& identifier ); |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Returns the identifier of this line. | 54 | * Returns the identifier of this line. |
55 | */ | 55 | */ |
56 | QString identifier() const; | 56 | QString identifier() const; |
57 | 57 | ||
58 | /** | 58 | /** |
59 | * Sets the value of of this line. | 59 | * Sets the value of of this line. |
60 | */ | 60 | */ |
61 | void setValueString( const QString& value ); | 61 | void setValueString( const QString& value ); |
62 | void setValueCString( const QCString& value ); | 62 | void setValueCString( const Q3CString& value ); |
63 | void setValueBytes( const QByteArray& value ); | 63 | void setValueBytes( const QByteArray& value ); |
64 | 64 | ||
65 | /** | 65 | /** |
66 | * Returns the value of this line. | 66 | * Returns the value of this line. |
67 | */ | 67 | */ |
68 | QString valueString() const; | 68 | QString valueString() const; |
69 | QByteArray valueBytes() const; | 69 | QByteArray valueBytes() const; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * Sets the group the line belongs to. | 72 | * Sets the group the line belongs to. |
73 | */ | 73 | */ |
74 | void setGroup( const QString& group ); | 74 | void setGroup( const QString& group ); |
75 | 75 | ||
76 | /** | 76 | /** |
77 | * Returns the group the line belongs to. | 77 | * Returns the group the line belongs to. |
78 | */ | 78 | */ |
79 | QString group() const; | 79 | QString group() const; |
80 | 80 | ||
81 | /** | 81 | /** |
82 | * Returns whether the line belongs to a group. | 82 | * Returns whether the line belongs to a group. |
83 | */ | 83 | */ |
84 | bool hasGroup() const; | 84 | bool hasGroup() const; |
85 | 85 | ||
86 | /** | 86 | /** |
87 | * Returns all parameters. | 87 | * Returns all parameters. |
88 | */ | 88 | */ |
89 | QStringList parameterList() const; | 89 | QStringList parameterList() const; |
90 | 90 | ||
91 | /** | 91 | /** |
92 | * Add a new parameter to the line. | 92 | * Add a new parameter to the line. |
93 | */ | 93 | */ |
94 | void addParameter( const QString& param, const QString& value ); | 94 | void addParameter( const QString& param, const QString& value ); |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * Returns the values of a special parameter. | 97 | * Returns the values of a special parameter. |
98 | * You can get a list of all parameters with paramList(). | 98 | * You can get a list of all parameters with paramList(). |
99 | */ | 99 | */ |
100 | QStringList parameters( const QString& param ) const; | 100 | QStringList parameters( const QString& param ) const; |
101 | 101 | ||
102 | /** | 102 | /** |
103 | * Returns only the first value of a special parameter. | 103 | * Returns only the first value of a special parameter. |
104 | * You can get a list of all parameters with paramList(). | 104 | * You can get a list of all parameters with paramList(). |
105 | */ | 105 | */ |
106 | QString parameter( const QString& param ) const; | 106 | QString parameter( const QString& param ) const; |
107 | 107 | ||
108 | private: | 108 | private: |
109 | ParamMap mParamMap; | 109 | ParamMap mParamMap; |
110 | QString mIdentifier; | 110 | QString mIdentifier; |
111 | QByteArray mValue; | 111 | QByteArray mValue; |
112 | 112 | ||
113 | class VCardLinePrivate; | 113 | class VCardLinePrivate; |
114 | VCardLinePrivate *d; | 114 | VCardLinePrivate *d; |
115 | }; | 115 | }; |
116 | 116 | ||
117 | } | 117 | } |
118 | 118 | ||
119 | #endif | 119 | #endif |
diff --git a/kabc/vcardparser/vcardparser.cpp b/kabc/vcardparser/vcardparser.cpp index 11622a0..a319531 100644 --- a/kabc/vcardparser/vcardparser.cpp +++ b/kabc/vcardparser/vcardparser.cpp | |||
@@ -1,240 +1,240 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of libkabc. | 2 | This file is part of libkabc. |
3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> | 3 | Copyright (c) 2003 Tobias Koenig <tokoe@kde.org> |
4 | 4 | ||
5 | This library is free software; you can redistribute it and/or | 5 | This library is free software; you can redistribute it and/or |
6 | modify it under the terms of the GNU Library General Public | 6 | modify it under the terms of the GNU Library General Public |
7 | License as published by the Free Software Foundation; either | 7 | License as published by the Free Software Foundation; either |
8 | version 2 of the License, or (at your option) any later version. | 8 | version 2 of the License, or (at your option) any later version. |
9 | 9 | ||
10 | This library is distributed in the hope that it will be useful, | 10 | This library is distributed in the hope that it will be useful, |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | but WITHOUT ANY WARRANTY; without even the implied warranty of |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
13 | Library General Public License for more details. | 13 | Library General Public License for more details. |
14 | 14 | ||
15 | You should have received a copy of the GNU Library General Public License | 15 | You should have received a copy of the GNU Library General Public License |
16 | along with this library; see the file COPYING.LIB. If not, write to | 16 | along with this library; see the file COPYING.LIB. If not, write to |
17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, | 17 | the Free Software Foundation, Inc., 59 Temple Place - Suite 330, |
18 | Boston, MA 02111-1307, USA. | 18 | Boston, MA 02111-1307, USA. |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <qregexp.h> | 21 | #include <qregexp.h> |
22 | 22 | ||
23 | #include <kmdcodec.h> | 23 | #include <kmdcodec.h> |
24 | 24 | ||
25 | #include "vcardparser.h" | 25 | #include "vcardparser.h" |
26 | 26 | ||
27 | #define FOLD_WIDTH 75 | 27 | #define FOLD_WIDTH 75 |
28 | 28 | ||
29 | using namespace KABC; | 29 | using namespace KABC; |
30 | 30 | ||
31 | VCardParser::VCardParser() | 31 | VCardParser::VCardParser() |
32 | { | 32 | { |
33 | } | 33 | } |
34 | 34 | ||
35 | VCardParser::~VCardParser() | 35 | VCardParser::~VCardParser() |
36 | { | 36 | { |
37 | } | 37 | } |
38 | 38 | ||
39 | VCard::List VCardParser::parseVCards( const QString& text ) | 39 | VCard::List VCardParser::parseVCards( const QString& text ) |
40 | { | 40 | { |
41 | static QRegExp sep( "[\x0d\x0a]" ); | 41 | static QRegExp sep( "[\x0d\x0a]" ); |
42 | 42 | ||
43 | VCard currentVCard; | 43 | VCard currentVCard; |
44 | VCard::List vCardList; | 44 | VCard::List vCardList; |
45 | QString currentLine; | 45 | QString currentLine; |
46 | 46 | ||
47 | const QStringList lines = QStringList::split( sep, text ); | 47 | const QStringList lines = QStringList::split( sep, text ); |
48 | QStringList::ConstIterator it; | 48 | QStringList::ConstIterator it; |
49 | 49 | ||
50 | bool inVCard = false; | 50 | bool inVCard = false; |
51 | QStringList::ConstIterator linesEnd( lines.end() ); | 51 | QStringList::ConstIterator linesEnd( lines.end() ); |
52 | for ( it = lines.begin(); it != linesEnd; ++it ) { | 52 | for ( it = lines.begin(); it != linesEnd; ++it ) { |
53 | 53 | ||
54 | if ( (*it).isEmpty() ) // empty line | 54 | if ( (*it).isEmpty() ) // empty line |
55 | continue; | 55 | continue; |
56 | 56 | ||
57 | if ( (*it)[ 0 ] == ' ' || (*it)[ 0 ] == '\t' ) { // folded line => append to previous | 57 | if ( (*it)[ 0 ] == ' ' || (*it)[ 0 ] == '\t' ) { // folded line => append to previous |
58 | currentLine += QString( *it ).remove( 0, 1 ); | 58 | currentLine += QString( *it ).remove( 0, 1 ); |
59 | continue; | 59 | continue; |
60 | } else { | 60 | } else { |
61 | if ( inVCard && !currentLine.isEmpty() ) { // now parse the line | 61 | if ( inVCard && !currentLine.isEmpty() ) { // now parse the line |
62 | int colon = currentLine.find( ':' ); | 62 | int colon = currentLine.find( ':' ); |
63 | if ( colon == -1 ) { // invalid line | 63 | if ( colon == -1 ) { // invalid line |
64 | currentLine = (*it); | 64 | currentLine = (*it); |
65 | continue; | 65 | continue; |
66 | } | 66 | } |
67 | 67 | ||
68 | VCardLine vCardLine; | 68 | VCardLine vCardLine; |
69 | const QString key = currentLine.left( colon ).stripWhiteSpace(); | 69 | const QString key = currentLine.left( colon ).stripWhiteSpace(); |
70 | QString value = currentLine.mid( colon + 1 ); | 70 | QString value = currentLine.mid( colon + 1 ); |
71 | 71 | ||
72 | QStringList params = QStringList::split( ';', key ); | 72 | QStringList params = QStringList::split( ';', key ); |
73 | 73 | ||
74 | // check for group | 74 | // check for group |
75 | if ( params[0].find( '.' ) != -1 ) { | 75 | if ( params[0].find( '.' ) != -1 ) { |
76 | const QStringList groupList = QStringList::split( '.', params[0] ); | 76 | const QStringList groupList = QStringList::split( '.', params[0] ); |
77 | vCardLine.setGroup( groupList[0] ); | 77 | vCardLine.setGroup( groupList[0] ); |
78 | vCardLine.setIdentifier( groupList[1] ); | 78 | vCardLine.setIdentifier( groupList[1] ); |
79 | } else | 79 | } else |
80 | vCardLine.setIdentifier( params[0] ); | 80 | vCardLine.setIdentifier( params[0] ); |
81 | 81 | ||
82 | if ( params.count() > 1 ) { // find all parameters | 82 | if ( params.count() > 1 ) { // find all parameters |
83 | QStringList::ConstIterator paramIt = params.begin(); | 83 | QStringList::ConstIterator paramIt = params.begin(); |
84 | for ( ++paramIt; paramIt != params.end(); ++paramIt ) { | 84 | for ( ++paramIt; paramIt != params.end(); ++paramIt ) { |
85 | QStringList pair = QStringList::split( '=', *paramIt ); | 85 | QStringList pair = QStringList::split( '=', *paramIt ); |
86 | if ( pair.count() == 1 ) { | 86 | if ( pair.count() == 1 ) { |
87 | // correct the fucking 2.1 'standard' | 87 | // correct the fucking 2.1 'standard' |
88 | if ( pair[0].lower() == "quoted-printable" ) { | 88 | if ( pair[0].lower() == "quoted-printable" ) { |
89 | pair[0] = "encoding"; | 89 | pair[0] = "encoding"; |
90 | pair[1] = "quoted-printable"; | 90 | pair[1] = "quoted-printable"; |
91 | } else if ( pair[0].lower() == "base64" ) { | 91 | } else if ( pair[0].lower() == "base64" ) { |
92 | pair[0] = "encoding"; | 92 | pair[0] = "encoding"; |
93 | pair[1] = "base64"; | 93 | pair[1] = "base64"; |
94 | } else { | 94 | } else { |
95 | pair.prepend( "type" ); | 95 | pair.prepend( "type" ); |
96 | } | 96 | } |
97 | } | 97 | } |
98 | // This is pretty much a faster pair[1].contains( ',' )... | 98 | // This is pretty much a faster pair[1].contains( ',' )... |
99 | if ( pair[1].find( ',' ) != -1 ) { // parameter in type=x,y,z format | 99 | if ( pair[1].find( ',' ) != -1 ) { // parameter in type=x,y,z format |
100 | const QStringList args = QStringList::split( ',', pair[ 1 ] ); | 100 | const QStringList args = QStringList::split( ',', pair[ 1 ] ); |
101 | QStringList::ConstIterator argIt; | 101 | QStringList::ConstIterator argIt; |
102 | for ( argIt = args.begin(); argIt != args.end(); ++argIt ) | 102 | for ( argIt = args.begin(); argIt != args.end(); ++argIt ) |
103 | vCardLine.addParameter( pair[0].lower(), *argIt ); | 103 | vCardLine.addParameter( pair[0].lower(), *argIt ); |
104 | } else | 104 | } else |
105 | vCardLine.addParameter( pair[0].lower(), pair[1] ); | 105 | vCardLine.addParameter( pair[0].lower(), pair[1] ); |
106 | } | 106 | } |
107 | } | 107 | } |
108 | 108 | ||
109 | params = vCardLine.parameterList(); | 109 | params = vCardLine.parameterList(); |
110 | if ( params.findIndex( "encoding" ) != -1 ) { // have to decode the data | 110 | if ( params.findIndex( "encoding" ) != -1 ) { // have to decode the data |
111 | QByteArray input, output; | 111 | QByteArray input, output; |
112 | if ( vCardLine.parameter( "encoding" ).lower() == "b" || | 112 | if ( vCardLine.parameter( "encoding" ).lower() == "b" || |
113 | vCardLine.parameter( "encoding" ).lower() == "base64" ) { | 113 | vCardLine.parameter( "encoding" ).lower() == "base64" ) { |
114 | input = value.local8Bit(); | 114 | input = value.local8Bit(); |
115 | KCodecs::base64Decode( input, output ); | 115 | KCodecs::base64Decode( input, output ); |
116 | } else if ( vCardLine.parameter( "encoding" ).lower() == "quoted-printable" ) { | 116 | } else if ( vCardLine.parameter( "encoding" ).lower() == "quoted-printable" ) { |
117 | // join any qp-folded lines | 117 | // join any qp-folded lines |
118 | while ( value.mid(value.length()-1,1) == "=" && it != linesEnd ) { | 118 | while ( value.mid(value.length()-1,1) == "=" && it != linesEnd ) { |
119 | value = value.remove( value.length()-1, 1 ) + (*it); | 119 | value = value.remove( value.length()-1, 1 ) + (*it); |
120 | ++it; | 120 | ++it; |
121 | } | 121 | } |
122 | input = value.local8Bit(); | 122 | input = value.local8Bit(); |
123 | KCodecs::quotedPrintableDecode( input, output ); | 123 | KCodecs::quotedPrintableDecode( input, output ); |
124 | } | 124 | } |
125 | //PP our vcards are *supposed* to be in UTF-8 | 125 | //PP our vcards are *supposed* to be in UTF-8 |
126 | // if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) { | 126 | // if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) { |
127 | // vCardLine.setValue( QString::fromUtf8( output.data(), output.size() ) ); | 127 | // vCardLine.setValue( QString::fromUtf8( output.data(), output.size() ) ); |
128 | // } else | 128 | // } else |
129 | vCardLine.setValueBytes( output ); | 129 | vCardLine.setValueBytes( output ); |
130 | //PP our vcards are *supposed* to be in UTF-8 | 130 | //PP our vcards are *supposed* to be in UTF-8 |
131 | // } else if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) { | 131 | // } else if ( vCardLine.parameter( "charset" ).lower() == "utf-8" ) { |
132 | // vCardLine.setValue( QString::fromUtf8( value.ascii() ) ); | 132 | // vCardLine.setValue( QString::fromUtf8( value.ascii() ) ); |
133 | } else | 133 | } else |
134 | vCardLine.setValueString( value.replace( QRegExp("\\\\n"), "\n" ) ); | 134 | vCardLine.setValueString( value.replace( QRegExp("\\\\n"), "\n" ) ); |
135 | 135 | ||
136 | currentVCard.addLine( vCardLine ); | 136 | currentVCard.addLine( vCardLine ); |
137 | } | 137 | } |
138 | 138 | ||
139 | // we do not save the start and end tag as vcardline | 139 | // we do not save the start and end tag as vcardline |
140 | if ( (*it).lower().startsWith( "begin:vcard" ) ) { | 140 | if ( (*it).lower().startsWith( "begin:vcard" ) ) { |
141 | inVCard = true; | 141 | inVCard = true; |
142 | currentLine = ""; | 142 | currentLine = ""; |
143 | currentVCard.clear(); // flush vcard | 143 | currentVCard.clear(); // flush vcard |
144 | continue; | 144 | continue; |
145 | } | 145 | } |
146 | 146 | ||
147 | if ( (*it).lower().startsWith( "end:vcard" ) ) { | 147 | if ( (*it).lower().startsWith( "end:vcard" ) ) { |
148 | inVCard = false; | 148 | inVCard = false; |
149 | vCardList.append( currentVCard ); | 149 | vCardList.append( currentVCard ); |
150 | currentLine = ""; | 150 | currentLine = ""; |
151 | currentVCard.clear(); // flush vcard | 151 | currentVCard.clear(); // flush vcard |
152 | continue; | 152 | continue; |
153 | } | 153 | } |
154 | 154 | ||
155 | currentLine = (*it); | 155 | currentLine = (*it); |
156 | } | 156 | } |
157 | } | 157 | } |
158 | 158 | ||
159 | return vCardList; | 159 | return vCardList; |
160 | } | 160 | } |
161 | 161 | ||
162 | QString VCardParser::createVCards( const VCard::List& list ) | 162 | QString VCardParser::createVCards( const VCard::List& list ) |
163 | { | 163 | { |
164 | QString text; | 164 | QString text; |
165 | QString textLine; | 165 | QString textLine; |
166 | QString encodingType; | 166 | QString encodingType; |
167 | QStringList idents; | 167 | QStringList idents; |
168 | QStringList params; | 168 | QStringList params; |
169 | QStringList values; | 169 | QStringList values; |
170 | QStringList::ConstIterator identIt; | 170 | QStringList::ConstIterator identIt; |
171 | QStringList::Iterator paramIt; | 171 | QStringList::Iterator paramIt; |
172 | QStringList::ConstIterator valueIt; | 172 | QStringList::ConstIterator valueIt; |
173 | 173 | ||
174 | VCardLine::List lines; | 174 | VCardLine::List lines; |
175 | VCardLine::List::ConstIterator lineIt; | 175 | VCardLine::List::ConstIterator lineIt; |
176 | VCard::List::ConstIterator cardIt; | 176 | VCard::List::ConstIterator cardIt; |
177 | 177 | ||
178 | bool hasEncoding; | 178 | bool hasEncoding; |
179 | 179 | ||
180 | // iterate over the cards | 180 | // iterate over the cards |
181 | VCard::List::ConstIterator listEnd( list.end() ); | 181 | VCard::List::ConstIterator listEnd( list.end() ); |
182 | for ( cardIt = list.begin(); cardIt != listEnd; ++cardIt ) { | 182 | for ( cardIt = list.begin(); cardIt != listEnd; ++cardIt ) { |
183 | text.append( "BEGIN:VCARD\r\n" ); | 183 | text.append( "BEGIN:VCARD\r\n" ); |
184 | 184 | ||
185 | idents = (*cardIt).identifiers(); | 185 | idents = (*cardIt).identifiers(); |
186 | for ( identIt = idents.begin(); identIt != idents.end(); ++identIt ) { | 186 | for ( identIt = idents.begin(); identIt != idents.end(); ++identIt ) { |
187 | lines = (*cardIt).lines( (*identIt) ); | 187 | lines = (*cardIt).lines( (*identIt) ); |
188 | 188 | ||
189 | // iterate over the lines | 189 | // iterate over the lines |
190 | for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) { | 190 | for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) { |
191 | if ( !(*lineIt).valueString().isEmpty() ) { | 191 | if ( !(*lineIt).valueString().isEmpty() ) { |
192 | if ( (*lineIt).hasGroup() ) | 192 | if ( (*lineIt).hasGroup() ) |
193 | textLine = (*lineIt).group() + "." + (*lineIt).identifier(); | 193 | textLine = (*lineIt).group() + "." + (*lineIt).identifier(); |
194 | else | 194 | else |
195 | textLine = (*lineIt).identifier(); | 195 | textLine = (*lineIt).identifier(); |
196 | 196 | ||
197 | params = (*lineIt).parameterList(); | 197 | params = (*lineIt).parameterList(); |
198 | hasEncoding = false; | 198 | hasEncoding = false; |
199 | if ( params.count() > 0 ) { // we have parameters | 199 | if ( params.count() > 0 ) { // we have parameters |
200 | for ( paramIt = params.begin(); paramIt != params.end(); ++paramIt ) { | 200 | for ( paramIt = params.begin(); paramIt != params.end(); ++paramIt ) { |
201 | if ( (*paramIt) == "encoding" ) { | 201 | if ( (*paramIt) == "encoding" ) { |
202 | hasEncoding = true; | 202 | hasEncoding = true; |
203 | encodingType = (*lineIt).parameter( "encoding" ).lower(); | 203 | encodingType = (*lineIt).parameter( "encoding" ).lower(); |
204 | } | 204 | } |
205 | 205 | ||
206 | values = (*lineIt).parameters( *paramIt ); | 206 | values = (*lineIt).parameters( *paramIt ); |
207 | for ( valueIt = values.begin(); valueIt != values.end(); ++valueIt ) { | 207 | for ( valueIt = values.begin(); valueIt != values.end(); ++valueIt ) { |
208 | textLine.append( ";" + (*paramIt).upper() ); | 208 | textLine.append( ";" + (*paramIt).upper() ); |
209 | if ( !(*valueIt).isEmpty() ) | 209 | if ( !(*valueIt).isEmpty() ) |
210 | textLine.append( "=" + (*valueIt) ); | 210 | textLine.append( "=" + (*valueIt) ); |
211 | } | 211 | } |
212 | } | 212 | } |
213 | } | 213 | } |
214 | 214 | ||
215 | if ( hasEncoding ) { // have to encode the data | 215 | if ( hasEncoding ) { // have to encode the data |
216 | QByteArray input, output; | 216 | QByteArray input, output; |
217 | input = (*lineIt).valueBytes(); | 217 | input = (*lineIt).valueBytes(); |
218 | if ( encodingType == "b" ) | 218 | if ( encodingType == "b" ) |
219 | KCodecs::base64Encode( input, output ); | 219 | KCodecs::base64Encode( input, output ); |
220 | else if ( encodingType == "quoted-printable" ) | 220 | else if ( encodingType == "quoted-printable" ) |
221 | KCodecs::quotedPrintableEncode( input, output ); | 221 | KCodecs::quotedPrintableEncode( input, output, true ); |
222 | textLine.append( ":" + QString( output ) ); | 222 | textLine.append( ":" + QString( output ) ); |
223 | } else | 223 | } else |
224 | textLine.append( ":" + (*lineIt).valueString().replace( QRegExp("\n"), "\\n" ) ); | 224 | textLine.append( ":" + (*lineIt).valueString().replace( QRegExp("\n"), "\\n" ) ); |
225 | 225 | ||
226 | if ( textLine.length() > FOLD_WIDTH ) { // we have to fold the line | 226 | if ( textLine.length() > FOLD_WIDTH ) { // we have to fold the line |
227 | for ( uint i = 0; i <= ( textLine.length() / FOLD_WIDTH ); ++i ) | 227 | for ( uint i = 0; i <= ( textLine.length() / FOLD_WIDTH ); ++i ) |
228 | text.append( ( i == 0 ? "" : " " ) + textLine.mid( i * FOLD_WIDTH, FOLD_WIDTH ) + "\r\n" ); | 228 | text.append( ( i == 0 ? "" : " " ) + textLine.mid( i * FOLD_WIDTH, FOLD_WIDTH ) + "\r\n" ); |
229 | } else | 229 | } else |
230 | text.append( textLine + "\r\n" ); | 230 | text.append( textLine + "\r\n" ); |
231 | } | 231 | } |
232 | } | 232 | } |
233 | } | 233 | } |
234 | 234 | ||
235 | text.append( "END:VCARD\r\n" ); | 235 | text.append( "END:VCARD\r\n" ); |
236 | text.append( "\r\n" ); | 236 | text.append( "\r\n" ); |
237 | } | 237 | } |
238 | 238 | ||
239 | return text; | 239 | return text; |
240 | } | 240 | } |
diff --git a/kabc/vcardparser/vcardtool.cpp b/kabc/vcardparser/vcardtool.cpp index 204326e..435c3b0 100644 --- a/kabc/vcardparser/vcardtool.cpp +++ b/kabc/vcardparser/vcardtool.cpp | |||
@@ -143,727 +143,727 @@ QString VCardTool::createVCards( Addressee::List list, VCard::Version version ) | |||
143 | } | 143 | } |
144 | 144 | ||
145 | card.addLine( catLine ); | 145 | card.addLine( catLine ); |
146 | } | 146 | } |
147 | 147 | ||
148 | // CLASS | 148 | // CLASS |
149 | if ( version == VCard::v3_0 ) { | 149 | if ( version == VCard::v3_0 ) { |
150 | card.addLine( createSecrecy( (*addrIt).secrecy() ) ); | 150 | card.addLine( createSecrecy( (*addrIt).secrecy() ) ); |
151 | } | 151 | } |
152 | 152 | ||
153 | 153 | ||
154 | const QStringList emails = (*addrIt).emails(); | 154 | const QStringList emails = (*addrIt).emails(); |
155 | bool pref = true; | 155 | bool pref = true; |
156 | for ( strIt = emails.begin(); strIt != emails.end(); ++strIt ) { | 156 | for ( strIt = emails.begin(); strIt != emails.end(); ++strIt ) { |
157 | VCardLine line( "EMAIL", *strIt ); | 157 | VCardLine line( "EMAIL", *strIt ); |
158 | if ( version == VCard::v2_1 ) { | 158 | if ( version == VCard::v2_1 ) { |
159 | line.addParameter( "CHARSET", "UTF-8" ); | 159 | line.addParameter( "CHARSET", "UTF-8" ); |
160 | line.addParameter( "ENCODING", "8BIT" ); | 160 | line.addParameter( "ENCODING", "8BIT" ); |
161 | } | 161 | } |
162 | if ( pref == true && emails.count() > 1 ) { | 162 | if ( pref == true && emails.count() > 1 ) { |
163 | line.addParameter( "TYPE", "PREF" ); | 163 | line.addParameter( "TYPE", "PREF" ); |
164 | pref = false; | 164 | pref = false; |
165 | } | 165 | } |
166 | card.addLine( line ); | 166 | card.addLine( line ); |
167 | } | 167 | } |
168 | 168 | ||
169 | // FN | 169 | // FN |
170 | VCardLine fnLine( "FN", (*addrIt).formattedName() ); | 170 | VCardLine fnLine( "FN", (*addrIt).formattedName() ); |
171 | if ( version == VCard::v2_1 ) { | 171 | if ( version == VCard::v2_1 ) { |
172 | fnLine.addParameter( "CHARSET", "UTF-8" ); | 172 | fnLine.addParameter( "CHARSET", "UTF-8" ); |
173 | fnLine.addParameter( "ENCODING", "8BIT" ); | 173 | fnLine.addParameter( "ENCODING", "8BIT" ); |
174 | } | 174 | } |
175 | card.addLine( fnLine ); | 175 | card.addLine( fnLine ); |
176 | 176 | ||
177 | // GEO | 177 | // GEO |
178 | Geo geo = (*addrIt).geo(); | 178 | Geo geo = (*addrIt).geo(); |
179 | if ( geo.isValid() ) { | 179 | if ( geo.isValid() ) { |
180 | QString str; | 180 | QString str; |
181 | str.sprintf( "%.6f;%.6f", geo.latitude(), geo.longitude() ); | 181 | str.sprintf( "%.6f;%.6f", geo.latitude(), geo.longitude() ); |
182 | card.addLine( VCardLine( "GEO", str ) ); | 182 | card.addLine( VCardLine( "GEO", str ) ); |
183 | } | 183 | } |
184 | 184 | ||
185 | // KEY | 185 | // KEY |
186 | const Key::List keys = (*addrIt).keys(); | 186 | const Key::List keys = (*addrIt).keys(); |
187 | Key::List::ConstIterator keyIt; | 187 | Key::List::ConstIterator keyIt; |
188 | for ( keyIt = keys.begin(); keyIt != keys.end(); ++keyIt ) | 188 | for ( keyIt = keys.begin(); keyIt != keys.end(); ++keyIt ) |
189 | card.addLine( createKey( *keyIt ) ); | 189 | card.addLine( createKey( *keyIt ) ); |
190 | 190 | ||
191 | // LOGO | 191 | // LOGO |
192 | card.addLine( createPicture( "LOGO", (*addrIt).logo() ) ); | 192 | card.addLine( createPicture( "LOGO", (*addrIt).logo() ) ); |
193 | 193 | ||
194 | // MAILER | 194 | // MAILER |
195 | VCardLine mailerLine( "MAILER", (*addrIt).mailer() ); | 195 | VCardLine mailerLine( "MAILER", (*addrIt).mailer() ); |
196 | if ( version == VCard::v2_1 ) { | 196 | if ( version == VCard::v2_1 ) { |
197 | mailerLine.addParameter( "CHARSET", "UTF-8" ); | 197 | mailerLine.addParameter( "CHARSET", "UTF-8" ); |
198 | mailerLine.addParameter( "ENCODING", "8BIT" ); | 198 | mailerLine.addParameter( "ENCODING", "8BIT" ); |
199 | } | 199 | } |
200 | card.addLine( mailerLine ); | 200 | card.addLine( mailerLine ); |
201 | 201 | ||
202 | // N | 202 | // N |
203 | QStringList name; | 203 | QStringList name; |
204 | name.append( (*addrIt).familyName().replace( semiExp, "\\;" ) ); | 204 | name.append( (*addrIt).familyName().replace( semiExp, "\\;" ) ); |
205 | name.append( (*addrIt).givenName().replace( semiExp, "\\;" ) ); | 205 | name.append( (*addrIt).givenName().replace( semiExp, "\\;" ) ); |
206 | name.append( (*addrIt).additionalName().replace( semiExp, "\\;" ) ); | 206 | name.append( (*addrIt).additionalName().replace( semiExp, "\\;" ) ); |
207 | name.append( (*addrIt).prefix().replace( semiExp, "\\;" ) ); | 207 | name.append( (*addrIt).prefix().replace( semiExp, "\\;" ) ); |
208 | name.append( (*addrIt).suffix().replace( semiExp, "\\;" ) ); | 208 | name.append( (*addrIt).suffix().replace( semiExp, "\\;" ) ); |
209 | 209 | ||
210 | VCardLine nLine( "N", name.join( ";" ) ); | 210 | VCardLine nLine( "N", name.join( ";" ) ); |
211 | if ( version == VCard::v2_1 ) { | 211 | if ( version == VCard::v2_1 ) { |
212 | nLine.addParameter( "CHARSET", "UTF-8" ); | 212 | nLine.addParameter( "CHARSET", "UTF-8" ); |
213 | nLine.addParameter( "ENCODING", "8BIT" ); | 213 | nLine.addParameter( "ENCODING", "8BIT" ); |
214 | } | 214 | } |
215 | card.addLine( nLine ); | 215 | card.addLine( nLine ); |
216 | 216 | ||
217 | // NAME | 217 | // NAME |
218 | VCardLine nameLine( "NAME", (*addrIt).name() ); | 218 | VCardLine nameLine( "NAME", (*addrIt).name() ); |
219 | if ( version == VCard::v2_1 ) { | 219 | if ( version == VCard::v2_1 ) { |
220 | nameLine.addParameter( "CHARSET", "UTF-8" ); | 220 | nameLine.addParameter( "CHARSET", "UTF-8" ); |
221 | nameLine.addParameter( "ENCODING", "8BIT" ); | 221 | nameLine.addParameter( "ENCODING", "8BIT" ); |
222 | } | 222 | } |
223 | card.addLine( nameLine ); | 223 | card.addLine( nameLine ); |
224 | 224 | ||
225 | // NICKNAME | 225 | // NICKNAME |
226 | if ( version == VCard::v3_0 ) | 226 | if ( version == VCard::v3_0 ) |
227 | card.addLine( VCardLine( "NICKNAME", (*addrIt).nickName() ) ); | 227 | card.addLine( VCardLine( "NICKNAME", (*addrIt).nickName() ) ); |
228 | 228 | ||
229 | // NOTE | 229 | // NOTE |
230 | VCardLine noteLine( "NOTE", (*addrIt).note() ); | 230 | VCardLine noteLine( "NOTE", (*addrIt).note() ); |
231 | if ( version == VCard::v2_1 ) { | 231 | if ( version == VCard::v2_1 ) { |
232 | noteLine.addParameter( "CHARSET", "UTF-8" ); | 232 | noteLine.addParameter( "CHARSET", "UTF-8" ); |
233 | noteLine.addParameter( "ENCODING", "8BIT" ); | 233 | noteLine.addParameter( "ENCODING", "8BIT" ); |
234 | } | 234 | } |
235 | card.addLine( noteLine ); | 235 | card.addLine( noteLine ); |
236 | 236 | ||
237 | // ORG | 237 | // ORG |
238 | VCardLine orgLine( "ORG", (*addrIt).organization() ); | 238 | VCardLine orgLine( "ORG", (*addrIt).organization() ); |
239 | if ( version == VCard::v2_1 ) { | 239 | if ( version == VCard::v2_1 ) { |
240 | orgLine.addParameter( "CHARSET", "UTF-8" ); | 240 | orgLine.addParameter( "CHARSET", "UTF-8" ); |
241 | orgLine.addParameter( "ENCODING", "8BIT" ); | 241 | orgLine.addParameter( "ENCODING", "8BIT" ); |
242 | } | 242 | } |
243 | card.addLine( orgLine ); | 243 | card.addLine( orgLine ); |
244 | 244 | ||
245 | // PHOTO | 245 | // PHOTO |
246 | card.addLine( createPicture( "PHOTO", (*addrIt).photo() ) ); | 246 | card.addLine( createPicture( "PHOTO", (*addrIt).photo() ) ); |
247 | 247 | ||
248 | // PROID | 248 | // PROID |
249 | if ( version == VCard::v3_0 ) | 249 | if ( version == VCard::v3_0 ) |
250 | card.addLine( VCardLine( "PRODID", (*addrIt).productId() ) ); | 250 | card.addLine( VCardLine( "PRODID", (*addrIt).productId() ) ); |
251 | 251 | ||
252 | // REV | 252 | // REV |
253 | card.addLine( VCardLine( "REV", createDateTime( (*addrIt).revision() ) ) ); | 253 | card.addLine( VCardLine( "REV", createDateTime( (*addrIt).revision() ) ) ); |
254 | 254 | ||
255 | // ROLE | 255 | // ROLE |
256 | VCardLine roleLine( "ROLE", (*addrIt).role() ); | 256 | VCardLine roleLine( "ROLE", (*addrIt).role() ); |
257 | if ( version == VCard::v2_1 ) { | 257 | if ( version == VCard::v2_1 ) { |
258 | roleLine.addParameter( "CHARSET", "UTF-8" ); | 258 | roleLine.addParameter( "CHARSET", "UTF-8" ); |
259 | roleLine.addParameter( "ENCODING", "8BIT" ); | 259 | roleLine.addParameter( "ENCODING", "8BIT" ); |
260 | } | 260 | } |
261 | card.addLine( roleLine ); | 261 | card.addLine( roleLine ); |
262 | 262 | ||
263 | // SORT-STRING | 263 | // SORT-STRING |
264 | if ( version == VCard::v3_0 ) | 264 | if ( version == VCard::v3_0 ) |
265 | card.addLine( VCardLine( "SORT-STRING", (*addrIt).sortString() ) ); | 265 | card.addLine( VCardLine( "SORT-STRING", (*addrIt).sortString() ) ); |
266 | 266 | ||
267 | // SOUND | 267 | // SOUND |
268 | card.addLine( createSound( (*addrIt).sound() ) ); | 268 | card.addLine( createSound( (*addrIt).sound() ) ); |
269 | 269 | ||
270 | // TEL | 270 | // TEL |
271 | const PhoneNumber::List phoneNumbers = (*addrIt).phoneNumbers(); | 271 | const PhoneNumber::List phoneNumbers = (*addrIt).phoneNumbers(); |
272 | PhoneNumber::List::ConstIterator phoneIt; | 272 | PhoneNumber::List::ConstIterator phoneIt; |
273 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { | 273 | for ( phoneIt = phoneNumbers.begin(); phoneIt != phoneNumbers.end(); ++phoneIt ) { |
274 | VCardLine line( "TEL", (*phoneIt).number() ); | 274 | VCardLine line( "TEL", (*phoneIt).number() ); |
275 | 275 | ||
276 | QMap<QString, int>::ConstIterator typeIt; | 276 | QMap<QString, int>::ConstIterator typeIt; |
277 | for ( typeIt = mPhoneTypeMap.begin(); typeIt != mPhoneTypeMap.end(); ++typeIt ) { | 277 | for ( typeIt = mPhoneTypeMap.begin(); typeIt != mPhoneTypeMap.end(); ++typeIt ) { |
278 | if ( typeIt.data() & (*phoneIt).type() ) | 278 | if ( typeIt.data() & (*phoneIt).type() ) |
279 | line.addParameter( "TYPE", typeIt.key() ); | 279 | line.addParameter( "TYPE", typeIt.key() ); |
280 | } | 280 | } |
281 | 281 | ||
282 | card.addLine( line ); | 282 | card.addLine( line ); |
283 | } | 283 | } |
284 | 284 | ||
285 | // TITLE | 285 | // TITLE |
286 | VCardLine titleLine( "TITLE", (*addrIt).title() ); | 286 | VCardLine titleLine( "TITLE", (*addrIt).title() ); |
287 | if ( version == VCard::v2_1 ) { | 287 | if ( version == VCard::v2_1 ) { |
288 | titleLine.addParameter( "CHARSET", "UTF-8" ); | 288 | titleLine.addParameter( "CHARSET", "UTF-8" ); |
289 | titleLine.addParameter( "ENCODING", "8BIT" ); | 289 | titleLine.addParameter( "ENCODING", "8BIT" ); |
290 | } | 290 | } |
291 | card.addLine( titleLine ); | 291 | card.addLine( titleLine ); |
292 | 292 | ||
293 | // TZ | 293 | // TZ |
294 | TimeZone timeZone = (*addrIt).timeZone(); | 294 | TimeZone timeZone = (*addrIt).timeZone(); |
295 | if ( timeZone.isValid() ) { | 295 | if ( timeZone.isValid() ) { |
296 | QString str; | 296 | QString str; |
297 | 297 | ||
298 | int neg = 1; | 298 | int neg = 1; |
299 | if ( timeZone.offset() < 0 ) | 299 | if ( timeZone.offset() < 0 ) |
300 | neg = -1; | 300 | neg = -1; |
301 | 301 | ||
302 | str.sprintf( "%c%02d:%02d", ( timeZone.offset() >= 0 ? '+' : '-' ), | 302 | str.sprintf( "%c%02d:%02d", ( timeZone.offset() >= 0 ? '+' : '-' ), |
303 | ( timeZone.offset() / 60 ) * neg, | 303 | ( timeZone.offset() / 60 ) * neg, |
304 | ( timeZone.offset() % 60 ) * neg ); | 304 | ( timeZone.offset() % 60 ) * neg ); |
305 | 305 | ||
306 | card.addLine( VCardLine( "TZ", str ) ); | 306 | card.addLine( VCardLine( "TZ", str ) ); |
307 | } | 307 | } |
308 | 308 | ||
309 | // UID | 309 | // UID |
310 | card.addLine( VCardLine( "UID", (*addrIt).uid() ) ); | 310 | card.addLine( VCardLine( "UID", (*addrIt).uid() ) ); |
311 | 311 | ||
312 | // URL | 312 | // URL |
313 | card.addLine( VCardLine( "URL", (*addrIt).url().url() ) ); | 313 | card.addLine( VCardLine( "URL", (*addrIt).url().url() ) ); |
314 | 314 | ||
315 | // VERSION | 315 | // VERSION |
316 | if ( version == VCard::v2_1 ) | 316 | if ( version == VCard::v2_1 ) |
317 | card.addLine( VCardLine( "VERSION", "2.1" ) ); | 317 | card.addLine( VCardLine( "VERSION", "2.1" ) ); |
318 | if ( version == VCard::v3_0 ) | 318 | if ( version == VCard::v3_0 ) |
319 | card.addLine( VCardLine( "VERSION", "3.0" ) ); | 319 | card.addLine( VCardLine( "VERSION", "3.0" ) ); |
320 | 320 | ||
321 | // X- | 321 | // X- |
322 | const QStringList customs = (*addrIt).customs(); | 322 | const QStringList customs = (*addrIt).customs(); |
323 | for ( strIt = customs.begin(); strIt != customs.end(); ++strIt ) { | 323 | for ( strIt = customs.begin(); strIt != customs.end(); ++strIt ) { |
324 | QString identifier = "X-" + (*strIt).left( (*strIt).find( ":" ) ); | 324 | QString identifier = "X-" + (*strIt).left( (*strIt).find( ":" ) ); |
325 | QString value = (*strIt).mid( (*strIt).find( ":" ) + 1 ); | 325 | QString value = (*strIt).mid( (*strIt).find( ":" ) + 1 ); |
326 | if ( value.isEmpty() ) | 326 | if ( value.isEmpty() ) |
327 | continue; | 327 | continue; |
328 | 328 | ||
329 | VCardLine line( identifier, value ); | 329 | VCardLine line( identifier, value ); |
330 | if ( version == VCard::v2_1 ) { | 330 | if ( version == VCard::v2_1 ) { |
331 | line.addParameter( "CHARSET", "UTF-8" ); | 331 | line.addParameter( "CHARSET", "UTF-8" ); |
332 | line.addParameter( "ENCODING", "8BIT" ); | 332 | line.addParameter( "ENCODING", "8BIT" ); |
333 | } | 333 | } |
334 | card.addLine( line ); | 334 | card.addLine( line ); |
335 | } | 335 | } |
336 | 336 | ||
337 | vCardList.append( card ); | 337 | vCardList.append( card ); |
338 | } | 338 | } |
339 | 339 | ||
340 | return VCardParser::createVCards( vCardList ); | 340 | return VCardParser::createVCards( vCardList ); |
341 | } | 341 | } |
342 | 342 | ||
343 | Addressee::List VCardTool::parseVCards( const QString& vcard ) | 343 | Addressee::List VCardTool::parseVCards( const QString& vcard ) |
344 | { | 344 | { |
345 | static const QChar semicolonSep( ';' ); | 345 | static const QChar semicolonSep( ';' ); |
346 | static const QChar commaSep( ',' ); | 346 | static const QChar commaSep( ',' ); |
347 | QString identifier; | 347 | QString identifier; |
348 | 348 | ||
349 | Addressee::List addrList; | 349 | Addressee::List addrList; |
350 | const VCard::List vCardList = VCardParser::parseVCards( vcard ); | 350 | const VCard::List vCardList = VCardParser::parseVCards( vcard ); |
351 | 351 | ||
352 | VCard::List::ConstIterator cardIt; | 352 | VCard::List::ConstIterator cardIt; |
353 | VCard::List::ConstIterator listEnd( vCardList.end() ); | 353 | VCard::List::ConstIterator listEnd( vCardList.end() ); |
354 | for ( cardIt = vCardList.begin(); cardIt != listEnd; ++cardIt ) { | 354 | for ( cardIt = vCardList.begin(); cardIt != listEnd; ++cardIt ) { |
355 | Addressee addr; | 355 | Addressee addr; |
356 | 356 | ||
357 | const QStringList idents = (*cardIt).identifiers(); | 357 | const QStringList idents = (*cardIt).identifiers(); |
358 | QStringList::ConstIterator identIt; | 358 | QStringList::ConstIterator identIt; |
359 | QStringList::ConstIterator identEnd( idents.end() ); | 359 | QStringList::ConstIterator identEnd( idents.end() ); |
360 | for ( identIt = idents.begin(); identIt != identEnd; ++identIt ) { | 360 | for ( identIt = idents.begin(); identIt != identEnd; ++identIt ) { |
361 | const VCardLine::List lines = (*cardIt).lines( (*identIt) ); | 361 | const VCardLine::List lines = (*cardIt).lines( (*identIt) ); |
362 | VCardLine::List::ConstIterator lineIt; | 362 | VCardLine::List::ConstIterator lineIt; |
363 | 363 | ||
364 | // iterate over the lines | 364 | // iterate over the lines |
365 | for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) { | 365 | for ( lineIt = lines.begin(); lineIt != lines.end(); ++lineIt ) { |
366 | identifier = (*lineIt).identifier().lower(); | 366 | identifier = (*lineIt).identifier().lower(); |
367 | // ADR | 367 | // ADR |
368 | if ( identifier == "adr" ) { | 368 | if ( identifier == "adr" ) { |
369 | Address address; | 369 | Address address; |
370 | const QStringList addrParts = splitString( semicolonSep, (*lineIt).valueString() ); | 370 | const QStringList addrParts = splitString( semicolonSep, (*lineIt).valueString() ); |
371 | if ( addrParts.count() > 0 ) | 371 | if ( addrParts.count() > 0 ) |
372 | address.setPostOfficeBox( addrParts[ 0 ] ); | 372 | address.setPostOfficeBox( addrParts[ 0 ] ); |
373 | if ( addrParts.count() > 1 ) | 373 | if ( addrParts.count() > 1 ) |
374 | address.setExtended( addrParts[ 1 ] ); | 374 | address.setExtended( addrParts[ 1 ] ); |
375 | if ( addrParts.count() > 2 ) | 375 | if ( addrParts.count() > 2 ) |
376 | address.setStreet( addrParts[ 2 ] ); | 376 | address.setStreet( addrParts[ 2 ] ); |
377 | if ( addrParts.count() > 3 ) | 377 | if ( addrParts.count() > 3 ) |
378 | address.setLocality( addrParts[ 3 ] ); | 378 | address.setLocality( addrParts[ 3 ] ); |
379 | if ( addrParts.count() > 4 ) | 379 | if ( addrParts.count() > 4 ) |
380 | address.setRegion( addrParts[ 4 ] ); | 380 | address.setRegion( addrParts[ 4 ] ); |
381 | if ( addrParts.count() > 5 ) | 381 | if ( addrParts.count() > 5 ) |
382 | address.setPostalCode( addrParts[ 5 ] ); | 382 | address.setPostalCode( addrParts[ 5 ] ); |
383 | if ( addrParts.count() > 6 ) | 383 | if ( addrParts.count() > 6 ) |
384 | address.setCountry( addrParts[ 6 ] ); | 384 | address.setCountry( addrParts[ 6 ] ); |
385 | 385 | ||
386 | int type = 0; | 386 | int type = 0; |
387 | 387 | ||
388 | const QStringList types = (*lineIt).parameters( "type" ); | 388 | const QStringList types = (*lineIt).parameters( "type" ); |
389 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) | 389 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) |
390 | type += mAddressTypeMap[ (*it).lower() ]; | 390 | type += mAddressTypeMap[ (*it).lower() ]; |
391 | 391 | ||
392 | address.setType( type ); | 392 | address.setType( type ); |
393 | addr.insertAddress( address ); | 393 | addr.insertAddress( address ); |
394 | } | 394 | } |
395 | 395 | ||
396 | // AGENT | 396 | // AGENT |
397 | else if ( identifier == "agent" ) | 397 | else if ( identifier == "agent" ) |
398 | addr.setAgent( parseAgent( *lineIt ) ); | 398 | addr.setAgent( parseAgent( *lineIt ) ); |
399 | 399 | ||
400 | // BDAY | 400 | // BDAY |
401 | else if ( identifier == "bday" ) | 401 | else if ( identifier == "bday" ) |
402 | addr.setBirthday( parseDateTime( (*lineIt).valueString() ) ); | 402 | addr.setBirthday( parseDateTime( (*lineIt).valueString() ) ); |
403 | 403 | ||
404 | // CATEGORIES | 404 | // CATEGORIES |
405 | else if ( identifier == "categories" ) { | 405 | else if ( identifier == "categories" ) { |
406 | const QStringList categories = splitString( commaSep, (*lineIt).valueString() ); | 406 | const QStringList categories = splitString( commaSep, (*lineIt).valueString() ); |
407 | addr.setCategories( categories ); | 407 | addr.setCategories( categories ); |
408 | } | 408 | } |
409 | 409 | ||
410 | // CLASS | 410 | // CLASS |
411 | else if ( identifier == "class" ) | 411 | else if ( identifier == "class" ) |
412 | addr.setSecrecy( parseSecrecy( *lineIt ) ); | 412 | addr.setSecrecy( parseSecrecy( *lineIt ) ); |
413 | 413 | ||
414 | 414 | ||
415 | else if ( identifier == "email" ) { | 415 | else if ( identifier == "email" ) { |
416 | const QStringList types = (*lineIt).parameters( "type" ); | 416 | const QStringList types = (*lineIt).parameters( "type" ); |
417 | addr.insertEmail( (*lineIt).valueString(), types.findIndex( "PREF" ) != -1 ); | 417 | addr.insertEmail( (*lineIt).valueString(), types.findIndex( "PREF" ) != -1 ); |
418 | } | 418 | } |
419 | 419 | ||
420 | // FN | 420 | // FN |
421 | else if ( identifier == "fn" ) | 421 | else if ( identifier == "fn" ) |
422 | addr.setFormattedName( (*lineIt).valueString() ); | 422 | addr.setFormattedName( (*lineIt).valueString() ); |
423 | 423 | ||
424 | // GEO | 424 | // GEO |
425 | else if ( identifier == "geo" ) { | 425 | else if ( identifier == "geo" ) { |
426 | Geo geo; | 426 | Geo geo; |
427 | 427 | ||
428 | const QStringList geoParts = QStringList::split( ';', (*lineIt).valueString(), true ); | 428 | const QStringList geoParts = QStringList::split( ';', (*lineIt).valueString(), true ); |
429 | geo.setLatitude( geoParts[ 0 ].toFloat() ); | 429 | geo.setLatitude( geoParts[ 0 ].toFloat() ); |
430 | geo.setLongitude( geoParts[ 1 ].toFloat() ); | 430 | geo.setLongitude( geoParts[ 1 ].toFloat() ); |
431 | 431 | ||
432 | addr.setGeo( geo ); | 432 | addr.setGeo( geo ); |
433 | } | 433 | } |
434 | 434 | ||
435 | // KEY | 435 | // KEY |
436 | else if ( identifier == "key" ) | 436 | else if ( identifier == "key" ) |
437 | addr.insertKey( parseKey( *lineIt ) ); | 437 | addr.insertKey( parseKey( *lineIt ) ); |
438 | 438 | ||
439 | // LABEL | 439 | // LABEL |
440 | else if ( identifier == "label" ) { | 440 | else if ( identifier == "label" ) { |
441 | int type = 0; | 441 | int type = 0; |
442 | 442 | ||
443 | const QStringList types = (*lineIt).parameters( "type" ); | 443 | const QStringList types = (*lineIt).parameters( "type" ); |
444 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) | 444 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) |
445 | type += mAddressTypeMap[ (*it).lower() ]; | 445 | type += mAddressTypeMap[ (*it).lower() ]; |
446 | 446 | ||
447 | bool available = false; | 447 | bool available = false; |
448 | KABC::Address::List addressList = addr.addresses(); | 448 | KABC::Address::List addressList = addr.addresses(); |
449 | KABC::Address::List::Iterator it; | 449 | KABC::Address::List::Iterator it; |
450 | for ( it = addressList.begin(); it != addressList.end(); ++it ) { | 450 | for ( it = addressList.begin(); it != addressList.end(); ++it ) { |
451 | if ( (*it).type() == type ) { | 451 | if ( (*it).type() == type ) { |
452 | (*it).setLabel( (*lineIt).valueString() ); | 452 | (*it).setLabel( (*lineIt).valueString() ); |
453 | addr.insertAddress( *it ); | 453 | addr.insertAddress( *it ); |
454 | available = true; | 454 | available = true; |
455 | break; | 455 | break; |
456 | } | 456 | } |
457 | } | 457 | } |
458 | 458 | ||
459 | if ( !available ) { // a standalone LABEL tag | 459 | if ( !available ) { // a standalone LABEL tag |
460 | KABC::Address address( type ); | 460 | KABC::Address address( type ); |
461 | address.setLabel( (*lineIt).valueString() ); | 461 | address.setLabel( (*lineIt).valueString() ); |
462 | addr.insertAddress( address ); | 462 | addr.insertAddress( address ); |
463 | } | 463 | } |
464 | } | 464 | } |
465 | 465 | ||
466 | // LOGO | 466 | // LOGO |
467 | else if ( identifier == "logo" ) | 467 | else if ( identifier == "logo" ) |
468 | addr.setLogo( parsePicture( *lineIt ) ); | 468 | addr.setLogo( parsePicture( *lineIt ) ); |
469 | 469 | ||
470 | // MAILER | 470 | // MAILER |
471 | else if ( identifier == "mailer" ) | 471 | else if ( identifier == "mailer" ) |
472 | addr.setMailer( (*lineIt).valueString() ); | 472 | addr.setMailer( (*lineIt).valueString() ); |
473 | 473 | ||
474 | // N | 474 | // N |
475 | else if ( identifier == "n" ) { | 475 | else if ( identifier == "n" ) { |
476 | const QStringList nameParts = splitString( semicolonSep, (*lineIt).valueString() ); | 476 | const QStringList nameParts = splitString( semicolonSep, (*lineIt).valueString() ); |
477 | if ( nameParts.count() > 0 ) | 477 | if ( nameParts.count() > 0 ) |
478 | addr.setFamilyName( nameParts[ 0 ] ); | 478 | addr.setFamilyName( nameParts[ 0 ] ); |
479 | if ( nameParts.count() > 1 ) | 479 | if ( nameParts.count() > 1 ) |
480 | addr.setGivenName( nameParts[ 1 ] ); | 480 | addr.setGivenName( nameParts[ 1 ] ); |
481 | if ( nameParts.count() > 2 ) | 481 | if ( nameParts.count() > 2 ) |
482 | addr.setAdditionalName( nameParts[ 2 ] ); | 482 | addr.setAdditionalName( nameParts[ 2 ] ); |
483 | if ( nameParts.count() > 3 ) | 483 | if ( nameParts.count() > 3 ) |
484 | addr.setPrefix( nameParts[ 3 ] ); | 484 | addr.setPrefix( nameParts[ 3 ] ); |
485 | if ( nameParts.count() > 4 ) | 485 | if ( nameParts.count() > 4 ) |
486 | addr.setSuffix( nameParts[ 4 ] ); | 486 | addr.setSuffix( nameParts[ 4 ] ); |
487 | } | 487 | } |
488 | 488 | ||
489 | // NAME | 489 | // NAME |
490 | else if ( identifier == "name" ) | 490 | else if ( identifier == "name" ) |
491 | addr.setName( (*lineIt).valueString() ); | 491 | addr.setName( (*lineIt).valueString() ); |
492 | 492 | ||
493 | // NICKNAME | 493 | // NICKNAME |
494 | else if ( identifier == "nickname" ) | 494 | else if ( identifier == "nickname" ) |
495 | addr.setNickName( (*lineIt).valueString() ); | 495 | addr.setNickName( (*lineIt).valueString() ); |
496 | 496 | ||
497 | // NOTE | 497 | // NOTE |
498 | else if ( identifier == "note" ) | 498 | else if ( identifier == "note" ) |
499 | addr.setNote( (*lineIt).valueString() ); | 499 | addr.setNote( (*lineIt).valueString() ); |
500 | 500 | ||
501 | // ORGANIZATION | 501 | // ORGANIZATION |
502 | else if ( identifier == "org" ) | 502 | else if ( identifier == "org" ) |
503 | addr.setOrganization( (*lineIt).valueString() ); | 503 | addr.setOrganization( (*lineIt).valueString() ); |
504 | 504 | ||
505 | // PHOTO | 505 | // PHOTO |
506 | else if ( identifier == "photo" ) | 506 | else if ( identifier == "photo" ) |
507 | addr.setPhoto( parsePicture( *lineIt ) ); | 507 | addr.setPhoto( parsePicture( *lineIt ) ); |
508 | 508 | ||
509 | // PROID | 509 | // PROID |
510 | else if ( identifier == "prodid" ) | 510 | else if ( identifier == "prodid" ) |
511 | addr.setProductId( (*lineIt).valueString() ); | 511 | addr.setProductId( (*lineIt).valueString() ); |
512 | 512 | ||
513 | // REV | 513 | // REV |
514 | else if ( identifier == "rev" ) | 514 | else if ( identifier == "rev" ) |
515 | addr.setRevision( parseDateTime( (*lineIt).valueString() ) ); | 515 | addr.setRevision( parseDateTime( (*lineIt).valueString() ) ); |
516 | 516 | ||
517 | // ROLE | 517 | // ROLE |
518 | else if ( identifier == "role" ) | 518 | else if ( identifier == "role" ) |
519 | addr.setRole( (*lineIt).valueString() ); | 519 | addr.setRole( (*lineIt).valueString() ); |
520 | 520 | ||
521 | // SORT-STRING | 521 | // SORT-STRING |
522 | else if ( identifier == "sort-string" ) | 522 | else if ( identifier == "sort-string" ) |
523 | addr.setSortString( (*lineIt).valueString() ); | 523 | addr.setSortString( (*lineIt).valueString() ); |
524 | 524 | ||
525 | // SOUND | 525 | // SOUND |
526 | else if ( identifier == "sound" ) | 526 | else if ( identifier == "sound" ) |
527 | addr.setSound( parseSound( *lineIt ) ); | 527 | addr.setSound( parseSound( *lineIt ) ); |
528 | 528 | ||
529 | // TEL | 529 | // TEL |
530 | else if ( identifier == "tel" ) { | 530 | else if ( identifier == "tel" ) { |
531 | PhoneNumber phone; | 531 | PhoneNumber phone; |
532 | phone.setNumber( (*lineIt).valueString() ); | 532 | phone.setNumber( (*lineIt).valueString() ); |
533 | 533 | ||
534 | int type = 0; | 534 | int type = 0; |
535 | 535 | ||
536 | const QStringList types = (*lineIt).parameters( "type" ); | 536 | const QStringList types = (*lineIt).parameters( "type" ); |
537 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) | 537 | for ( QStringList::ConstIterator it = types.begin(); it != types.end(); ++it ) |
538 | type += mPhoneTypeMap[(*it).upper()]; | 538 | type += mPhoneTypeMap[(*it).upper()]; |
539 | 539 | ||
540 | phone.setType( type ); | 540 | phone.setType( type ); |
541 | 541 | ||
542 | addr.insertPhoneNumber( phone ); | 542 | addr.insertPhoneNumber( phone ); |
543 | } | 543 | } |
544 | 544 | ||
545 | // TITLE | 545 | // TITLE |
546 | else if ( identifier == "title" ) | 546 | else if ( identifier == "title" ) |
547 | addr.setTitle( (*lineIt).valueString() ); | 547 | addr.setTitle( (*lineIt).valueString() ); |
548 | 548 | ||
549 | // TZ | 549 | // TZ |
550 | else if ( identifier == "tz" ) { | 550 | else if ( identifier == "tz" ) { |
551 | TimeZone tz; | 551 | TimeZone tz; |
552 | const QString date = (*lineIt).valueString(); | 552 | const QString date = (*lineIt).valueString(); |
553 | 553 | ||
554 | int hours = date.mid( 1, 2).toInt(); | 554 | int hours = date.mid( 1, 2).toInt(); |
555 | int minutes = date.mid( 4, 2 ).toInt(); | 555 | int minutes = date.mid( 4, 2 ).toInt(); |
556 | int offset = ( hours * 60 ) + minutes; | 556 | int offset = ( hours * 60 ) + minutes; |
557 | offset = offset * ( date[ 0 ] == '+' ? 1 : -1 ); | 557 | offset = offset * ( date[ 0 ] == '+' ? 1 : -1 ); |
558 | 558 | ||
559 | tz.setOffset( offset ); | 559 | tz.setOffset( offset ); |
560 | addr.setTimeZone( tz ); | 560 | addr.setTimeZone( tz ); |
561 | } | 561 | } |
562 | 562 | ||
563 | // UID | 563 | // UID |
564 | else if ( identifier == "uid" ) | 564 | else if ( identifier == "uid" ) |
565 | addr.setUid( (*lineIt).valueString() ); | 565 | addr.setUid( (*lineIt).valueString() ); |
566 | 566 | ||
567 | // URL | 567 | // URL |
568 | else if ( identifier == "url" ) | 568 | else if ( identifier == "url" ) |
569 | addr.setUrl( KURL( (*lineIt).valueString() ) ); | 569 | addr.setUrl( KURL( (*lineIt).valueString() ) ); |
570 | 570 | ||
571 | // X- | 571 | // X- |
572 | else if ( identifier.startsWith( "x-" ) ) { | 572 | else if ( identifier.startsWith( "x-" ) ) { |
573 | const QString key = (*lineIt).identifier().mid( 2 ); | 573 | const QString key = (*lineIt).identifier().mid( 2 ); |
574 | int dash = key.find( "-" ); | 574 | int dash = key.find( "-" ); |
575 | addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).valueString() ); | 575 | addr.insertCustom( key.left( dash ), key.mid( dash + 1 ), (*lineIt).valueString() ); |
576 | } | 576 | } |
577 | } | 577 | } |
578 | } | 578 | } |
579 | addr.makePhoneNumbersOLcompatible(); | 579 | addr.makePhoneNumbersOLcompatible(); |
580 | addrList.append( addr ); | 580 | addrList.append( addr ); |
581 | } | 581 | } |
582 | 582 | ||
583 | return addrList; | 583 | return addrList; |
584 | } | 584 | } |
585 | 585 | ||
586 | QDateTime VCardTool::parseDateTime( const QString &str ) | 586 | QDateTime VCardTool::parseDateTime( const QString &str ) |
587 | { | 587 | { |
588 | QDateTime dateTime; | 588 | QDateTime dateTime; |
589 | 589 | ||
590 | if ( str.find( '-' ) == -1 ) { // is base format (yyyymmdd) | 590 | if ( str.find( '-' ) == -1 ) { // is base format (yyyymmdd) |
591 | dateTime.setDate( QDate( str.left( 4 ).toInt(), str.mid( 4, 2 ).toInt(), | 591 | dateTime.setDate( QDate( str.left( 4 ).toInt(), str.mid( 4, 2 ).toInt(), |
592 | str.mid( 6, 2 ).toInt() ) ); | 592 | str.mid( 6, 2 ).toInt() ) ); |
593 | 593 | ||
594 | if ( str.find( 'T' ) ) // has time information yyyymmddThh:mm:ss | 594 | if ( str.find( 'T' ) ) // has time information yyyymmddThh:mm:ss |
595 | dateTime.setTime( QTime( str.mid( 11, 2 ).toInt(), str.mid( 14, 2 ).toInt(), | 595 | dateTime.setTime( QTime( str.mid( 11, 2 ).toInt(), str.mid( 14, 2 ).toInt(), |
596 | str.mid( 17, 2 ).toInt() ) ); | 596 | str.mid( 17, 2 ).toInt() ) ); |
597 | 597 | ||
598 | } else { // is extended format yyyy-mm-dd | 598 | } else { // is extended format yyyy-mm-dd |
599 | dateTime.setDate( QDate( str.left( 4 ).toInt(), str.mid( 5, 2 ).toInt(), | 599 | dateTime.setDate( QDate( str.left( 4 ).toInt(), str.mid( 5, 2 ).toInt(), |
600 | str.mid( 8, 2 ).toInt() ) ); | 600 | str.mid( 8, 2 ).toInt() ) ); |
601 | 601 | ||
602 | if ( str.find( 'T' ) ) // has time information yyyy-mm-ddThh:mm:ss | 602 | if ( str.find( 'T' ) ) // has time information yyyy-mm-ddThh:mm:ss |
603 | dateTime.setTime( QTime( str.mid( 11, 2 ).toInt(), str.mid( 14, 2 ).toInt(), | 603 | dateTime.setTime( QTime( str.mid( 11, 2 ).toInt(), str.mid( 14, 2 ).toInt(), |
604 | str.mid( 17, 2 ).toInt() ) ); | 604 | str.mid( 17, 2 ).toInt() ) ); |
605 | } | 605 | } |
606 | 606 | ||
607 | return dateTime; | 607 | return dateTime; |
608 | } | 608 | } |
609 | 609 | ||
610 | QString VCardTool::createDateTime( const QDateTime &dateTime ) | 610 | QString VCardTool::createDateTime( const QDateTime &dateTime ) |
611 | { | 611 | { |
612 | QString str; | 612 | QString str; |
613 | 613 | ||
614 | if ( dateTime.date().isValid() ) { | 614 | if ( dateTime.date().isValid() ) { |
615 | str.sprintf( "%4d-%02d-%02d", dateTime.date().year(), dateTime.date().month(), | 615 | str.sprintf( "%4d-%02d-%02d", dateTime.date().year(), dateTime.date().month(), |
616 | dateTime.date().day() ); | 616 | dateTime.date().day() ); |
617 | if ( dateTime.time().isValid() ) { | 617 | if ( dateTime.time().isValid() ) { |
618 | QString tmp; | 618 | QString tmp; |
619 | tmp.sprintf( "T%02d:%02d:%02dZ", dateTime.time().hour(), dateTime.time().minute(), | 619 | tmp.sprintf( "T%02d:%02d:%02dZ", dateTime.time().hour(), dateTime.time().minute(), |
620 | dateTime.time().second() ); | 620 | dateTime.time().second() ); |
621 | str += tmp; | 621 | str += tmp; |
622 | } | 622 | } |
623 | } | 623 | } |
624 | 624 | ||
625 | return str; | 625 | return str; |
626 | } | 626 | } |
627 | 627 | ||
628 | Picture VCardTool::parsePicture( const VCardLine &line ) | 628 | Picture VCardTool::parsePicture( const VCardLine &line ) |
629 | { | 629 | { |
630 | Picture pic; | 630 | Picture pic; |
631 | 631 | ||
632 | const QStringList params = line.parameterList(); | 632 | const QStringList params = line.parameterList(); |
633 | if ( params.findIndex( "encoding" ) != -1 ) { | 633 | if ( params.findIndex( "encoding" ) != -1 ) { |
634 | QImage img; | 634 | QImage img; |
635 | img.loadFromData( line.valueBytes() ); | 635 | img.loadFromData( line.valueBytes() ); |
636 | pic.setData( img ); | 636 | pic.setData( img ); |
637 | } else if ( params.findIndex( "value" ) != -1 ) { | 637 | } else if ( params.findIndex( "value" ) != -1 ) { |
638 | if ( line.parameter( "value" ).lower() == "uri" ) | 638 | if ( line.parameter( "value" ).lower() == "uri" ) |
639 | pic.setUrl( line.valueString() ); | 639 | pic.setUrl( line.valueString() ); |
640 | } | 640 | } |
641 | 641 | ||
642 | if ( params.findIndex( "type" ) != -1 ) | 642 | if ( params.findIndex( "type" ) != -1 ) |
643 | pic.setType( line.parameter( "type" ) ); | 643 | pic.setType( line.parameter( "type" ) ); |
644 | 644 | ||
645 | return pic; | 645 | return pic; |
646 | } | 646 | } |
647 | 647 | ||
648 | VCardLine VCardTool::createPicture( const QString &identifier, const Picture &pic ) | 648 | VCardLine VCardTool::createPicture( const QString &identifier, const Picture &pic ) |
649 | { | 649 | { |
650 | VCardLine line( identifier ); | 650 | VCardLine line( identifier ); |
651 | 651 | ||
652 | if ( pic.isIntern() ) { | 652 | if ( pic.isIntern() ) { |
653 | if ( !pic.data().isNull() ) { | 653 | if ( !pic.data().isNull() ) { |
654 | QByteArray input; | 654 | QByteArray input; |
655 | QDataStream s( input, IO_WriteOnly ); | 655 | QDataStream s( &input, QIODevice::WriteOnly ); |
656 | s.setVersion( 4 ); | 656 | s.setVersion( 4 ); |
657 | s << pic.data(); | 657 | s << pic.data(); |
658 | line.setValueBytes( input ); | 658 | line.setValueBytes( input ); |
659 | line.addParameter( "encoding", "b" ); | 659 | line.addParameter( "encoding", "b" ); |
660 | line.addParameter( "type", "image/png" ); | 660 | line.addParameter( "type", "image/png" ); |
661 | } | 661 | } |
662 | } else if ( !pic.url().isEmpty() ) { | 662 | } else if ( !pic.url().isEmpty() ) { |
663 | QByteArray ba; | 663 | QByteArray ba; |
664 | line.setValueString( pic.url() ); | 664 | line.setValueString( pic.url() ); |
665 | line.addParameter( "value", "URI" ); | 665 | line.addParameter( "value", "URI" ); |
666 | } | 666 | } |
667 | 667 | ||
668 | return line; | 668 | return line; |
669 | } | 669 | } |
670 | 670 | ||
671 | Sound VCardTool::parseSound( const VCardLine &line ) | 671 | Sound VCardTool::parseSound( const VCardLine &line ) |
672 | { | 672 | { |
673 | Sound snd; | 673 | Sound snd; |
674 | 674 | ||
675 | const QStringList params = line.parameterList(); | 675 | const QStringList params = line.parameterList(); |
676 | if ( params.findIndex( "encoding" ) != -1 ) | 676 | if ( params.findIndex( "encoding" ) != -1 ) |
677 | snd.setData( line.valueBytes() ); | 677 | snd.setData( line.valueBytes() ); |
678 | else if ( params.findIndex( "value" ) != -1 ) { | 678 | else if ( params.findIndex( "value" ) != -1 ) { |
679 | if ( line.parameter( "value" ).lower() == "uri" ) | 679 | if ( line.parameter( "value" ).lower() == "uri" ) |
680 | snd.setUrl( line.valueString() ); | 680 | snd.setUrl( line.valueString() ); |
681 | } | 681 | } |
682 | 682 | ||
683 | /* TODO: support sound types | 683 | /* TODO: support sound types |
684 | if ( params.contains( "type" ) ) | 684 | if ( params.contains( "type" ) ) |
685 | snd.setType( line.parameter( "type" ) ); | 685 | snd.setType( line.parameter( "type" ) ); |
686 | */ | 686 | */ |
687 | 687 | ||
688 | return snd; | 688 | return snd; |
689 | } | 689 | } |
690 | 690 | ||
691 | VCardLine VCardTool::createSound( const Sound &snd ) | 691 | VCardLine VCardTool::createSound( const Sound &snd ) |
692 | { | 692 | { |
693 | VCardLine line( "SOUND" ); | 693 | VCardLine line( "SOUND" ); |
694 | 694 | ||
695 | if ( snd.isIntern() ) { | 695 | if ( snd.isIntern() ) { |
696 | if ( !snd.data().isEmpty() ) { | 696 | if ( !snd.data().isEmpty() ) { |
697 | line.setValueBytes( snd.data() ); | 697 | line.setValueBytes( snd.data() ); |
698 | line.addParameter( "encoding", "b" ); | 698 | line.addParameter( "encoding", "b" ); |
699 | // TODO: need to store sound type!!! | 699 | // TODO: need to store sound type!!! |
700 | } | 700 | } |
701 | } else if ( !snd.url().isEmpty() ) { | 701 | } else if ( !snd.url().isEmpty() ) { |
702 | line.setValueString( snd.url() ); | 702 | line.setValueString( snd.url() ); |
703 | line.addParameter( "value", "URI" ); | 703 | line.addParameter( "value", "URI" ); |
704 | } | 704 | } |
705 | 705 | ||
706 | return line; | 706 | return line; |
707 | } | 707 | } |
708 | 708 | ||
709 | Key VCardTool::parseKey( const VCardLine &line ) | 709 | Key VCardTool::parseKey( const VCardLine &line ) |
710 | { | 710 | { |
711 | Key key; | 711 | Key key; |
712 | 712 | ||
713 | const QStringList params = line.parameterList(); | 713 | const QStringList params = line.parameterList(); |
714 | if ( params.findIndex( "encoding" ) != -1 ) | 714 | if ( params.findIndex( "encoding" ) != -1 ) |
715 | key.setBinaryData( line.valueBytes() ); | 715 | key.setBinaryData( line.valueBytes() ); |
716 | else | 716 | else |
717 | key.setTextData( line.valueString() ); | 717 | key.setTextData( line.valueString() ); |
718 | 718 | ||
719 | if ( params.findIndex( "type" ) != -1 ) { | 719 | if ( params.findIndex( "type" ) != -1 ) { |
720 | if ( line.parameter( "type" ).lower() == "x509" ) | 720 | if ( line.parameter( "type" ).lower() == "x509" ) |
721 | key.setType( Key::X509 ); | 721 | key.setType( Key::X509 ); |
722 | else if ( line.parameter( "type" ).lower() == "pgp" ) | 722 | else if ( line.parameter( "type" ).lower() == "pgp" ) |
723 | key.setType( Key::PGP ); | 723 | key.setType( Key::PGP ); |
724 | else { | 724 | else { |
725 | key.setType( Key::Custom ); | 725 | key.setType( Key::Custom ); |
726 | key.setCustomTypeString( line.parameter( "type" ) ); | 726 | key.setCustomTypeString( line.parameter( "type" ) ); |
727 | } | 727 | } |
728 | } | 728 | } |
729 | 729 | ||
730 | return key; | 730 | return key; |
731 | } | 731 | } |
732 | 732 | ||
733 | VCardLine VCardTool::createKey( const Key &key ) | 733 | VCardLine VCardTool::createKey( const Key &key ) |
734 | { | 734 | { |
735 | VCardLine line( "KEY" ); | 735 | VCardLine line( "KEY" ); |
736 | 736 | ||
737 | if ( key.isBinary() ) { | 737 | if ( key.isBinary() ) { |
738 | if ( !key.binaryData().isEmpty() ) { | 738 | if ( !key.binaryData().isEmpty() ) { |
739 | line.setValueBytes( key.binaryData() ); | 739 | line.setValueBytes( key.binaryData() ); |
740 | line.addParameter( "encoding", "b" ); | 740 | line.addParameter( "encoding", "b" ); |
741 | } | 741 | } |
742 | } else if ( !key.textData().isEmpty() ) | 742 | } else if ( !key.textData().isEmpty() ) |
743 | line.setValueString( key.textData() ); | 743 | line.setValueString( key.textData() ); |
744 | 744 | ||
745 | if ( key.type() == Key::X509 ) | 745 | if ( key.type() == Key::X509 ) |
746 | line.addParameter( "type", "X509" ); | 746 | line.addParameter( "type", "X509" ); |
747 | else if ( key.type() == Key::PGP ) | 747 | else if ( key.type() == Key::PGP ) |
748 | line.addParameter( "type", "PGP" ); | 748 | line.addParameter( "type", "PGP" ); |
749 | else if ( key.type() == Key::Custom ) | 749 | else if ( key.type() == Key::Custom ) |
750 | line.addParameter( "type", key.customTypeString() ); | 750 | line.addParameter( "type", key.customTypeString() ); |
751 | 751 | ||
752 | return line; | 752 | return line; |
753 | } | 753 | } |
754 | 754 | ||
755 | Secrecy VCardTool::parseSecrecy( const VCardLine &line ) | 755 | Secrecy VCardTool::parseSecrecy( const VCardLine &line ) |
756 | { | 756 | { |
757 | Secrecy secrecy; | 757 | Secrecy secrecy; |
758 | 758 | ||
759 | if ( line.valueString().lower() == "public" ) | 759 | if ( line.valueString().lower() == "public" ) |
760 | secrecy.setType( Secrecy::Public ); | 760 | secrecy.setType( Secrecy::Public ); |
761 | if ( line.valueString().lower() == "private" ) | 761 | if ( line.valueString().lower() == "private" ) |
762 | secrecy.setType( Secrecy::Private ); | 762 | secrecy.setType( Secrecy::Private ); |
763 | if ( line.valueString().lower() == "confidential" ) | 763 | if ( line.valueString().lower() == "confidential" ) |
764 | secrecy.setType( Secrecy::Confidential ); | 764 | secrecy.setType( Secrecy::Confidential ); |
765 | 765 | ||
766 | return secrecy; | 766 | return secrecy; |
767 | } | 767 | } |
768 | 768 | ||
769 | VCardLine VCardTool::createSecrecy( const Secrecy &secrecy ) | 769 | VCardLine VCardTool::createSecrecy( const Secrecy &secrecy ) |
770 | { | 770 | { |
771 | VCardLine line( "CLASS" ); | 771 | VCardLine line( "CLASS" ); |
772 | 772 | ||
773 | int type = secrecy.type(); | 773 | int type = secrecy.type(); |
774 | 774 | ||
775 | if ( type == Secrecy::Public ) | 775 | if ( type == Secrecy::Public ) |
776 | line.setValueString( "PUBLIC" ); | 776 | line.setValueString( "PUBLIC" ); |
777 | else if ( type == Secrecy::Private ) | 777 | else if ( type == Secrecy::Private ) |
778 | line.setValueString( "PRIVATE" ); | 778 | line.setValueString( "PRIVATE" ); |
779 | else if ( type == Secrecy::Confidential ) | 779 | else if ( type == Secrecy::Confidential ) |
780 | line.setValueString( "CONFIDENTIAL" ); | 780 | line.setValueString( "CONFIDENTIAL" ); |
781 | 781 | ||
782 | return line; | 782 | return line; |
783 | } | 783 | } |
784 | 784 | ||
785 | Agent VCardTool::parseAgent( const VCardLine &line ) | 785 | Agent VCardTool::parseAgent( const VCardLine &line ) |
786 | { | 786 | { |
787 | Agent agent; | 787 | Agent agent; |
788 | 788 | ||
789 | const QStringList params = line.parameterList(); | 789 | const QStringList params = line.parameterList(); |
790 | if ( params.findIndex( "value" ) != -1 ) { | 790 | if ( params.findIndex( "value" ) != -1 ) { |
791 | if ( line.parameter( "value" ).lower() == "uri" ) | 791 | if ( line.parameter( "value" ).lower() == "uri" ) |
792 | agent.setUrl( line.valueString() ); | 792 | agent.setUrl( line.valueString() ); |
793 | } else { | 793 | } else { |
794 | QString str = line.valueString(); | 794 | QString str = line.valueString(); |
795 | str.replace( QRegExp("\\\\n"), "\r\n" ); | 795 | str.replace( QRegExp("\\\\n"), "\r\n" ); |
796 | str.replace( QRegExp("\\\\N"), "\r\n" ); | 796 | str.replace( QRegExp("\\\\N"), "\r\n" ); |
797 | str.replace( QRegExp("\\\\;"), ";" ); | 797 | str.replace( QRegExp("\\\\;"), ";" ); |
798 | str.replace( QRegExp("\\\\:"), ":" ); | 798 | str.replace( QRegExp("\\\\:"), ":" ); |
799 | str.replace( QRegExp("\\\\,"), "," ); | 799 | str.replace( QRegExp("\\\\,"), "," ); |
800 | 800 | ||
801 | const Addressee::List list = parseVCards( str ); | 801 | const Addressee::List list = parseVCards( str ); |
802 | if ( list.count() > 0 ) { | 802 | if ( list.count() > 0 ) { |
803 | Addressee *addr = new Addressee; | 803 | Addressee *addr = new Addressee; |
804 | *addr = list[ 0 ]; | 804 | *addr = list[ 0 ]; |
805 | agent.setAddressee( addr ); | 805 | agent.setAddressee( addr ); |
806 | } | 806 | } |
807 | } | 807 | } |
808 | 808 | ||
809 | return agent; | 809 | return agent; |
810 | } | 810 | } |
811 | 811 | ||
812 | VCardLine VCardTool::createAgent( VCard::Version version, const Agent &agent ) | 812 | VCardLine VCardTool::createAgent( VCard::Version version, const Agent &agent ) |
813 | { | 813 | { |
814 | VCardLine line( "AGENT" ); | 814 | VCardLine line( "AGENT" ); |
815 | 815 | ||
816 | if ( agent.isIntern() ) { | 816 | if ( agent.isIntern() ) { |
817 | if ( agent.addressee() != 0 ) { | 817 | if ( agent.addressee() != 0 ) { |
818 | Addressee::List list; | 818 | Addressee::List list; |
819 | list.append( *agent.addressee() ); | 819 | list.append( *agent.addressee() ); |
820 | 820 | ||
821 | QString str = createVCards( list, version ); | 821 | QString str = createVCards( list, version ); |
822 | str.replace( QRegExp("\\r\\n"), "\\n" ); | 822 | str.replace( QRegExp("\\r\\n"), "\\n" ); |
823 | str.replace( QRegExp(";"), "\\;" ); | 823 | str.replace( QRegExp(";"), "\\;" ); |
824 | str.replace( QRegExp(":"), "\\:" ); | 824 | str.replace( QRegExp(":"), "\\:" ); |
825 | str.replace( QRegExp(","), "\\," ); | 825 | str.replace( QRegExp(","), "\\," ); |
826 | line.setValueString( str ); | 826 | line.setValueString( str ); |
827 | } | 827 | } |
828 | } else if ( !agent.url().isEmpty() ) { | 828 | } else if ( !agent.url().isEmpty() ) { |
829 | line.setValueString( agent.url() ); | 829 | line.setValueString( agent.url() ); |
830 | line.addParameter( "value", "URI" ); | 830 | line.addParameter( "value", "URI" ); |
831 | } | 831 | } |
832 | 832 | ||
833 | return line; | 833 | return line; |
834 | } | 834 | } |
835 | 835 | ||
836 | QStringList VCardTool::splitString( const QChar &sep, const QString &str ) | 836 | QStringList VCardTool::splitString( const QChar &sep, const QString &str ) |
837 | { | 837 | { |
838 | QStringList list; | 838 | QStringList list; |
839 | QString value( str ); | 839 | QString value( str ); |
840 | 840 | ||
841 | int start = 0; | 841 | int start = 0; |
842 | int pos = value.find( sep, start ); | 842 | int pos = value.find( sep, start ); |
843 | 843 | ||
844 | while ( pos != -1 ) { | 844 | while ( pos != -1 ) { |
845 | if ( value[ pos - 1 ] != '\\' ) { | 845 | if ( value[ pos - 1 ] != '\\' ) { |
846 | if ( pos > start && pos <= (int)value.length() ) | 846 | if ( pos > start && pos <= (int)value.length() ) |
847 | list << value.mid( start, pos - start ); | 847 | list << value.mid( start, pos - start ); |
848 | else | 848 | else |
849 | list << QString::null; | 849 | list << QString::null; |
850 | 850 | ||
851 | start = pos + 1; | 851 | start = pos + 1; |
852 | pos = value.find( sep, start ); | 852 | pos = value.find( sep, start ); |
853 | } else { | 853 | } else { |
854 | if ( pos != 0 ) { | 854 | if ( pos != 0 ) { |
855 | value.replace( pos - 1, 2, sep ); | 855 | value.replace( pos - 1, 2, sep ); |
856 | pos = value.find( sep, pos ); | 856 | pos = value.find( sep, pos ); |
857 | } else | 857 | } else |
858 | pos = value.find( sep, pos + 1 ); | 858 | pos = value.find( sep, pos + 1 ); |
859 | } | 859 | } |
860 | } | 860 | } |
861 | 861 | ||
862 | int l = value.length() - 1; | 862 | int l = value.length() - 1; |
863 | if ( value.mid( start, l - start + 1 ).length() > 0 ) | 863 | if ( value.mid( start, l - start + 1 ).length() > 0 ) |
864 | list << value.mid( start, l - start + 1 ); | 864 | list << value.mid( start, l - start + 1 ); |
865 | else | 865 | else |
866 | list << QString::null; | 866 | list << QString::null; |
867 | 867 | ||
868 | return list; | 868 | return list; |
869 | } | 869 | } |