author | eilers <eilers> | 2002-12-09 15:08:30 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-12-09 15:08:30 (UTC) |
commit | e487238141c57df63252e41a47b409cbb1f9ae83 (patch) (unidiff) | |
tree | 6b98869056d5444d65432f3ba313a46273387118 | |
parent | 9aa7570be3c5417314f5c865344b948a90450b48 (diff) | |
download | opie-e487238141c57df63252e41a47b409cbb1f9ae83.zip opie-e487238141c57df63252e41a47b409cbb1f9ae83.tar.gz opie-e487238141c57df63252e41a47b409cbb1f9ae83.tar.bz2 |
Added preview for default email and all email
-rw-r--r-- | libopie/pim/ocontact.cpp | 8 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 8 |
2 files changed, 12 insertions, 4 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index efa2777..6aec62e 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp | |||
@@ -1,1019 +1,1023 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of the Qtopia Environment. | 5 | ** This file is part of the Qtopia Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #define QTOPIA_INTERNAL_CONTACT_MRE | 22 | #define QTOPIA_INTERNAL_CONTACT_MRE |
23 | 23 | ||
24 | #include "ocontact.h" | 24 | #include "ocontact.h" |
25 | 25 | ||
26 | #include <qpe/stringutil.h> | 26 | #include <qpe/stringutil.h> |
27 | #include <qpe/timeconversion.h> | 27 | #include <qpe/timeconversion.h> |
28 | #include <qpe/timestring.h> | 28 | #include <qpe/timestring.h> |
29 | 29 | ||
30 | #include <qobject.h> | 30 | #include <qobject.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qstylesheet.h> | 32 | #include <qstylesheet.h> |
33 | #include <qfileinfo.h> | 33 | #include <qfileinfo.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | 35 | ||
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | 37 | ||
38 | /*! | 38 | /*! |
39 | \class Contact contact.h | 39 | \class Contact contact.h |
40 | \brief The Contact class holds the data of an address book entry. | 40 | \brief The Contact class holds the data of an address book entry. |
41 | 41 | ||
42 | This data includes information the name of the person, contact | 42 | This data includes information the name of the person, contact |
43 | information, and business information such as deparment and job title. | 43 | information, and business information such as deparment and job title. |
44 | 44 | ||
45 | \ingroup qtopiaemb | 45 | \ingroup qtopiaemb |
46 | \ingroup qtopiadesktop | 46 | \ingroup qtopiadesktop |
47 | */ | 47 | */ |
48 | 48 | ||
49 | 49 | ||
50 | /*! | 50 | /*! |
51 | Creates a new, empty contact. | 51 | Creates a new, empty contact. |
52 | */ | 52 | */ |
53 | OContact::OContact() | 53 | OContact::OContact() |
54 | : OPimRecord(), mMap(), d( 0 ) | 54 | : OPimRecord(), mMap(), d( 0 ) |
55 | { | 55 | { |
56 | } | 56 | } |
57 | 57 | ||
58 | /*! | 58 | /*! |
59 | \internal | 59 | \internal |
60 | Creates a new contact. The properties of the contact are | 60 | Creates a new contact. The properties of the contact are |
61 | set from \a fromMap. | 61 | set from \a fromMap. |
62 | */ | 62 | */ |
63 | OContact::OContact( const QMap<int, QString> &fromMap ) : | 63 | OContact::OContact( const QMap<int, QString> &fromMap ) : |
64 | OPimRecord(), mMap( fromMap ), d( 0 ) | 64 | OPimRecord(), mMap( fromMap ), d( 0 ) |
65 | { | 65 | { |
66 | QString cats = mMap[ Qtopia::AddressCategory ]; | 66 | QString cats = mMap[ Qtopia::AddressCategory ]; |
67 | if ( !cats.isEmpty() ) | 67 | if ( !cats.isEmpty() ) |
68 | setCategories( idsFromString( cats ) ); | 68 | setCategories( idsFromString( cats ) ); |
69 | 69 | ||
70 | QString uidStr = find( Qtopia::AddressUid ); | 70 | QString uidStr = find( Qtopia::AddressUid ); |
71 | 71 | ||
72 | if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ | 72 | if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ |
73 | qWarning( "Invalid UID found. Generate new one.." ); | 73 | qWarning( "Invalid UID found. Generate new one.." ); |
74 | setUid( uidGen().generate() ); | 74 | setUid( uidGen().generate() ); |
75 | }else | 75 | }else |
76 | setUid( uidStr.toInt() ); | 76 | setUid( uidStr.toInt() ); |
77 | 77 | ||
78 | // if ( !uidStr.isEmpty() ) | 78 | // if ( !uidStr.isEmpty() ) |
79 | // setUid( uidStr.toInt() ); | 79 | // setUid( uidStr.toInt() ); |
80 | } | 80 | } |
81 | 81 | ||
82 | /*! | 82 | /*! |
83 | Destroys a contact. | 83 | Destroys a contact. |
84 | */ | 84 | */ |
85 | OContact::~OContact() | 85 | OContact::~OContact() |
86 | { | 86 | { |
87 | } | 87 | } |
88 | 88 | ||
89 | /*! \fn void OContact::setTitle( const QString &str ) | 89 | /*! \fn void OContact::setTitle( const QString &str ) |
90 | Sets the title of the contact to \a str. | 90 | Sets the title of the contact to \a str. |
91 | */ | 91 | */ |
92 | 92 | ||
93 | /*! \fn void OContact::setFirstName( const QString &str ) | 93 | /*! \fn void OContact::setFirstName( const QString &str ) |
94 | Sets the first name of the contact to \a str. | 94 | Sets the first name of the contact to \a str. |
95 | */ | 95 | */ |
96 | 96 | ||
97 | /*! \fn void OContact::setMiddleName( const QString &str ) | 97 | /*! \fn void OContact::setMiddleName( const QString &str ) |
98 | Sets the middle name of the contact to \a str. | 98 | Sets the middle name of the contact to \a str. |
99 | */ | 99 | */ |
100 | 100 | ||
101 | /*! \fn void OContact::setLastName( const QString &str ) | 101 | /*! \fn void OContact::setLastName( const QString &str ) |
102 | Sets the last name of the contact to \a str. | 102 | Sets the last name of the contact to \a str. |
103 | */ | 103 | */ |
104 | 104 | ||
105 | /*! \fn void OContact::setSuffix( const QString &str ) | 105 | /*! \fn void OContact::setSuffix( const QString &str ) |
106 | Sets the suffix of the contact to \a str. | 106 | Sets the suffix of the contact to \a str. |
107 | */ | 107 | */ |
108 | 108 | ||
109 | /*! \fn void OContact::setFileAs( const QString &str ) | 109 | /*! \fn void OContact::setFileAs( const QString &str ) |
110 | Sets the contact to filed as \a str. | 110 | Sets the contact to filed as \a str. |
111 | */ | 111 | */ |
112 | 112 | ||
113 | /*! \fn void OContact::setDefaultEmail( const QString &str ) | 113 | /*! \fn void OContact::setDefaultEmail( const QString &str ) |
114 | Sets the default email of the contact to \a str. | 114 | Sets the default email of the contact to \a str. |
115 | */ | 115 | */ |
116 | 116 | ||
117 | /*! \fn void OContact::setHomeStreet( const QString &str ) | 117 | /*! \fn void OContact::setHomeStreet( const QString &str ) |
118 | Sets the home street address of the contact to \a str. | 118 | Sets the home street address of the contact to \a str. |
119 | */ | 119 | */ |
120 | 120 | ||
121 | /*! \fn void OContact::setHomeCity( const QString &str ) | 121 | /*! \fn void OContact::setHomeCity( const QString &str ) |
122 | Sets the home city of the contact to \a str. | 122 | Sets the home city of the contact to \a str. |
123 | */ | 123 | */ |
124 | 124 | ||
125 | /*! \fn void OContact::setHomeState( const QString &str ) | 125 | /*! \fn void OContact::setHomeState( const QString &str ) |
126 | Sets the home state of the contact to \a str. | 126 | Sets the home state of the contact to \a str. |
127 | */ | 127 | */ |
128 | 128 | ||
129 | /*! \fn void OContact::setHomeZip( const QString &str ) | 129 | /*! \fn void OContact::setHomeZip( const QString &str ) |
130 | Sets the home zip code of the contact to \a str. | 130 | Sets the home zip code of the contact to \a str. |
131 | */ | 131 | */ |
132 | 132 | ||
133 | /*! \fn void OContact::setHomeCountry( const QString &str ) | 133 | /*! \fn void OContact::setHomeCountry( const QString &str ) |
134 | Sets the home country of the contact to \a str. | 134 | Sets the home country of the contact to \a str. |
135 | */ | 135 | */ |
136 | 136 | ||
137 | /*! \fn void OContact::setHomePhone( const QString &str ) | 137 | /*! \fn void OContact::setHomePhone( const QString &str ) |
138 | Sets the home phone number of the contact to \a str. | 138 | Sets the home phone number of the contact to \a str. |
139 | */ | 139 | */ |
140 | 140 | ||
141 | /*! \fn void OContact::setHomeFax( const QString &str ) | 141 | /*! \fn void OContact::setHomeFax( const QString &str ) |
142 | Sets the home fax number of the contact to \a str. | 142 | Sets the home fax number of the contact to \a str. |
143 | */ | 143 | */ |
144 | 144 | ||
145 | /*! \fn void OContact::setHomeMobile( const QString &str ) | 145 | /*! \fn void OContact::setHomeMobile( const QString &str ) |
146 | Sets the home mobile phone number of the contact to \a str. | 146 | Sets the home mobile phone number of the contact to \a str. |
147 | */ | 147 | */ |
148 | 148 | ||
149 | /*! \fn void OContact::setHomeWebpage( const QString &str ) | 149 | /*! \fn void OContact::setHomeWebpage( const QString &str ) |
150 | Sets the home webpage of the contact to \a str. | 150 | Sets the home webpage of the contact to \a str. |
151 | */ | 151 | */ |
152 | 152 | ||
153 | /*! \fn void OContact::setCompany( const QString &str ) | 153 | /*! \fn void OContact::setCompany( const QString &str ) |
154 | Sets the company for contact to \a str. | 154 | Sets the company for contact to \a str. |
155 | */ | 155 | */ |
156 | 156 | ||
157 | /*! \fn void OContact::setJobTitle( const QString &str ) | 157 | /*! \fn void OContact::setJobTitle( const QString &str ) |
158 | Sets the job title of the contact to \a str. | 158 | Sets the job title of the contact to \a str. |
159 | */ | 159 | */ |
160 | 160 | ||
161 | /*! \fn void OContact::setDepartment( const QString &str ) | 161 | /*! \fn void OContact::setDepartment( const QString &str ) |
162 | Sets the department for contact to \a str. | 162 | Sets the department for contact to \a str. |
163 | */ | 163 | */ |
164 | 164 | ||
165 | /*! \fn void OContact::setOffice( const QString &str ) | 165 | /*! \fn void OContact::setOffice( const QString &str ) |
166 | Sets the office for contact to \a str. | 166 | Sets the office for contact to \a str. |
167 | */ | 167 | */ |
168 | 168 | ||
169 | /*! \fn void OContact::setBusinessStreet( const QString &str ) | 169 | /*! \fn void OContact::setBusinessStreet( const QString &str ) |
170 | Sets the business street address of the contact to \a str. | 170 | Sets the business street address of the contact to \a str. |
171 | */ | 171 | */ |
172 | 172 | ||
173 | /*! \fn void OContact::setBusinessCity( const QString &str ) | 173 | /*! \fn void OContact::setBusinessCity( const QString &str ) |
174 | Sets the business city of the contact to \a str. | 174 | Sets the business city of the contact to \a str. |
175 | */ | 175 | */ |
176 | 176 | ||
177 | /*! \fn void OContact::setBusinessState( const QString &str ) | 177 | /*! \fn void OContact::setBusinessState( const QString &str ) |
178 | Sets the business state of the contact to \a str. | 178 | Sets the business state of the contact to \a str. |
179 | */ | 179 | */ |
180 | 180 | ||
181 | /*! \fn void OContact::setBusinessZip( const QString &str ) | 181 | /*! \fn void OContact::setBusinessZip( const QString &str ) |
182 | Sets the business zip code of the contact to \a str. | 182 | Sets the business zip code of the contact to \a str. |
183 | */ | 183 | */ |
184 | 184 | ||
185 | /*! \fn void OContact::setBusinessCountry( const QString &str ) | 185 | /*! \fn void OContact::setBusinessCountry( const QString &str ) |
186 | Sets the business country of the contact to \a str. | 186 | Sets the business country of the contact to \a str. |
187 | */ | 187 | */ |
188 | 188 | ||
189 | /*! \fn void OContact::setBusinessPhone( const QString &str ) | 189 | /*! \fn void OContact::setBusinessPhone( const QString &str ) |
190 | Sets the business phone number of the contact to \a str. | 190 | Sets the business phone number of the contact to \a str. |
191 | */ | 191 | */ |
192 | 192 | ||
193 | /*! \fn void OContact::setBusinessFax( const QString &str ) | 193 | /*! \fn void OContact::setBusinessFax( const QString &str ) |
194 | Sets the business fax number of the contact to \a str. | 194 | Sets the business fax number of the contact to \a str. |
195 | */ | 195 | */ |
196 | 196 | ||
197 | /*! \fn void OContact::setBusinessMobile( const QString &str ) | 197 | /*! \fn void OContact::setBusinessMobile( const QString &str ) |
198 | Sets the business mobile phone number of the contact to \a str. | 198 | Sets the business mobile phone number of the contact to \a str. |
199 | */ | 199 | */ |
200 | 200 | ||
201 | /*! \fn void OContact::setBusinessPager( const QString &str ) | 201 | /*! \fn void OContact::setBusinessPager( const QString &str ) |
202 | Sets the business pager number of the contact to \a str. | 202 | Sets the business pager number of the contact to \a str. |
203 | */ | 203 | */ |
204 | 204 | ||
205 | /*! \fn void OContact::setBusinessWebpage( const QString &str ) | 205 | /*! \fn void OContact::setBusinessWebpage( const QString &str ) |
206 | Sets the business webpage of the contact to \a str. | 206 | Sets the business webpage of the contact to \a str. |
207 | */ | 207 | */ |
208 | 208 | ||
209 | /*! \fn void OContact::setProfession( const QString &str ) | 209 | /*! \fn void OContact::setProfession( const QString &str ) |
210 | Sets the profession of the contact to \a str. | 210 | Sets the profession of the contact to \a str. |
211 | */ | 211 | */ |
212 | 212 | ||
213 | /*! \fn void OContact::setAssistant( const QString &str ) | 213 | /*! \fn void OContact::setAssistant( const QString &str ) |
214 | Sets the assistant of the contact to \a str. | 214 | Sets the assistant of the contact to \a str. |
215 | */ | 215 | */ |
216 | 216 | ||
217 | /*! \fn void OContact::setManager( const QString &str ) | 217 | /*! \fn void OContact::setManager( const QString &str ) |
218 | Sets the manager of the contact to \a str. | 218 | Sets the manager of the contact to \a str. |
219 | */ | 219 | */ |
220 | 220 | ||
221 | /*! \fn void OContact::setSpouse( const QString &str ) | 221 | /*! \fn void OContact::setSpouse( const QString &str ) |
222 | Sets the spouse of the contact to \a str. | 222 | Sets the spouse of the contact to \a str. |
223 | */ | 223 | */ |
224 | 224 | ||
225 | /*! \fn void OContact::setGender( const QString &str ) | 225 | /*! \fn void OContact::setGender( const QString &str ) |
226 | Sets the gender of the contact to \a str. | 226 | Sets the gender of the contact to \a str. |
227 | */ | 227 | */ |
228 | 228 | ||
229 | /*! \fn void OContact::setNickname( const QString &str ) | 229 | /*! \fn void OContact::setNickname( const QString &str ) |
230 | Sets the nickname of the contact to \a str. | 230 | Sets the nickname of the contact to \a str. |
231 | */ | 231 | */ |
232 | 232 | ||
233 | /*! \fn void OContact::setNotes( const QString &str ) | 233 | /*! \fn void OContact::setNotes( const QString &str ) |
234 | Sets the notes about the contact to \a str. | 234 | Sets the notes about the contact to \a str. |
235 | */ | 235 | */ |
236 | 236 | ||
237 | /*! \fn QString OContact::title() const | 237 | /*! \fn QString OContact::title() const |
238 | Returns the title of the contact. | 238 | Returns the title of the contact. |
239 | */ | 239 | */ |
240 | 240 | ||
241 | /*! \fn QString OContact::firstName() const | 241 | /*! \fn QString OContact::firstName() const |
242 | Returns the first name of the contact. | 242 | Returns the first name of the contact. |
243 | */ | 243 | */ |
244 | 244 | ||
245 | /*! \fn QString OContact::middleName() const | 245 | /*! \fn QString OContact::middleName() const |
246 | Returns the middle name of the contact. | 246 | Returns the middle name of the contact. |
247 | */ | 247 | */ |
248 | 248 | ||
249 | /*! \fn QString OContact::lastName() const | 249 | /*! \fn QString OContact::lastName() const |
250 | Returns the last name of the contact. | 250 | Returns the last name of the contact. |
251 | */ | 251 | */ |
252 | 252 | ||
253 | /*! \fn QString OContact::suffix() const | 253 | /*! \fn QString OContact::suffix() const |
254 | Returns the suffix of the contact. | 254 | Returns the suffix of the contact. |
255 | */ | 255 | */ |
256 | 256 | ||
257 | /*! \fn QString OContact::fileAs() const | 257 | /*! \fn QString OContact::fileAs() const |
258 | Returns the string the contact is filed as. | 258 | Returns the string the contact is filed as. |
259 | */ | 259 | */ |
260 | 260 | ||
261 | /*! \fn QString OContact::defaultEmail() const | 261 | /*! \fn QString OContact::defaultEmail() const |
262 | Returns the default email address of the contact. | 262 | Returns the default email address of the contact. |
263 | */ | 263 | */ |
264 | 264 | ||
265 | /*! \fn QString OContact::emails() const | 265 | /*! \fn QString OContact::emails() const |
266 | Returns the list of email address for a contact separated by ';'s in a single | 266 | Returns the list of email address for a contact separated by ';'s in a single |
267 | string. | 267 | string. |
268 | */ | 268 | */ |
269 | 269 | ||
270 | /*! \fn QString OContact::homeStreet() const | 270 | /*! \fn QString OContact::homeStreet() const |
271 | Returns the home street address of the contact. | 271 | Returns the home street address of the contact. |
272 | */ | 272 | */ |
273 | 273 | ||
274 | /*! \fn QString OContact::homeCity() const | 274 | /*! \fn QString OContact::homeCity() const |
275 | Returns the home city of the contact. | 275 | Returns the home city of the contact. |
276 | */ | 276 | */ |
277 | 277 | ||
278 | /*! \fn QString OContact::homeState() const | 278 | /*! \fn QString OContact::homeState() const |
279 | Returns the home state of the contact. | 279 | Returns the home state of the contact. |
280 | */ | 280 | */ |
281 | 281 | ||
282 | /*! \fn QString OContact::homeZip() const | 282 | /*! \fn QString OContact::homeZip() const |
283 | Returns the home zip of the contact. | 283 | Returns the home zip of the contact. |
284 | */ | 284 | */ |
285 | 285 | ||
286 | /*! \fn QString OContact::homeCountry() const | 286 | /*! \fn QString OContact::homeCountry() const |
287 | Returns the home country of the contact. | 287 | Returns the home country of the contact. |
288 | */ | 288 | */ |
289 | 289 | ||
290 | /*! \fn QString OContact::homePhone() const | 290 | /*! \fn QString OContact::homePhone() const |
291 | Returns the home phone number of the contact. | 291 | Returns the home phone number of the contact. |
292 | */ | 292 | */ |
293 | 293 | ||
294 | /*! \fn QString OContact::homeFax() const | 294 | /*! \fn QString OContact::homeFax() const |
295 | Returns the home fax number of the contact. | 295 | Returns the home fax number of the contact. |
296 | */ | 296 | */ |
297 | 297 | ||
298 | /*! \fn QString OContact::homeMobile() const | 298 | /*! \fn QString OContact::homeMobile() const |
299 | Returns the home mobile number of the contact. | 299 | Returns the home mobile number of the contact. |
300 | */ | 300 | */ |
301 | 301 | ||
302 | /*! \fn QString OContact::homeWebpage() const | 302 | /*! \fn QString OContact::homeWebpage() const |
303 | Returns the home webpage of the contact. | 303 | Returns the home webpage of the contact. |
304 | */ | 304 | */ |
305 | 305 | ||
306 | /*! \fn QString OContact::company() const | 306 | /*! \fn QString OContact::company() const |
307 | Returns the company for the contact. | 307 | Returns the company for the contact. |
308 | */ | 308 | */ |
309 | 309 | ||
310 | /*! \fn QString OContact::department() const | 310 | /*! \fn QString OContact::department() const |
311 | Returns the department for the contact. | 311 | Returns the department for the contact. |
312 | */ | 312 | */ |
313 | 313 | ||
314 | /*! \fn QString OContact::office() const | 314 | /*! \fn QString OContact::office() const |
315 | Returns the office for the contact. | 315 | Returns the office for the contact. |
316 | */ | 316 | */ |
317 | 317 | ||
318 | /*! \fn QString OContact::jobTitle() const | 318 | /*! \fn QString OContact::jobTitle() const |
319 | Returns the job title of the contact. | 319 | Returns the job title of the contact. |
320 | */ | 320 | */ |
321 | 321 | ||
322 | /*! \fn QString OContact::profession() const | 322 | /*! \fn QString OContact::profession() const |
323 | Returns the profession of the contact. | 323 | Returns the profession of the contact. |
324 | */ | 324 | */ |
325 | 325 | ||
326 | /*! \fn QString OContact::assistant() const | 326 | /*! \fn QString OContact::assistant() const |
327 | Returns the assistant of the contact. | 327 | Returns the assistant of the contact. |
328 | */ | 328 | */ |
329 | 329 | ||
330 | /*! \fn QString OContact::manager() const | 330 | /*! \fn QString OContact::manager() const |
331 | Returns the manager of the contact. | 331 | Returns the manager of the contact. |
332 | */ | 332 | */ |
333 | 333 | ||
334 | /*! \fn QString OContact::businessStreet() const | 334 | /*! \fn QString OContact::businessStreet() const |
335 | Returns the business street address of the contact. | 335 | Returns the business street address of the contact. |
336 | */ | 336 | */ |
337 | 337 | ||
338 | /*! \fn QString OContact::businessCity() const | 338 | /*! \fn QString OContact::businessCity() const |
339 | Returns the business city of the contact. | 339 | Returns the business city of the contact. |
340 | */ | 340 | */ |
341 | 341 | ||
342 | /*! \fn QString OContact::businessState() const | 342 | /*! \fn QString OContact::businessState() const |
343 | Returns the business state of the contact. | 343 | Returns the business state of the contact. |
344 | */ | 344 | */ |
345 | 345 | ||
346 | /*! \fn QString OContact::businessZip() const | 346 | /*! \fn QString OContact::businessZip() const |
347 | Returns the business zip of the contact. | 347 | Returns the business zip of the contact. |
348 | */ | 348 | */ |
349 | 349 | ||
350 | /*! \fn QString OContact::businessCountry() const | 350 | /*! \fn QString OContact::businessCountry() const |
351 | Returns the business country of the contact. | 351 | Returns the business country of the contact. |
352 | */ | 352 | */ |
353 | 353 | ||
354 | /*! \fn QString OContact::businessPhone() const | 354 | /*! \fn QString OContact::businessPhone() const |
355 | Returns the business phone number of the contact. | 355 | Returns the business phone number of the contact. |
356 | */ | 356 | */ |
357 | 357 | ||
358 | /*! \fn QString OContact::businessFax() const | 358 | /*! \fn QString OContact::businessFax() const |
359 | Returns the business fax number of the contact. | 359 | Returns the business fax number of the contact. |
360 | */ | 360 | */ |
361 | 361 | ||
362 | /*! \fn QString OContact::businessMobile() const | 362 | /*! \fn QString OContact::businessMobile() const |
363 | Returns the business mobile number of the contact. | 363 | Returns the business mobile number of the contact. |
364 | */ | 364 | */ |
365 | 365 | ||
366 | /*! \fn QString OContact::businessPager() const | 366 | /*! \fn QString OContact::businessPager() const |
367 | Returns the business pager number of the contact. | 367 | Returns the business pager number of the contact. |
368 | */ | 368 | */ |
369 | 369 | ||
370 | /*! \fn QString OContact::businessWebpage() const | 370 | /*! \fn QString OContact::businessWebpage() const |
371 | Returns the business webpage of the contact. | 371 | Returns the business webpage of the contact. |
372 | */ | 372 | */ |
373 | 373 | ||
374 | /*! \fn QString OContact::spouse() const | 374 | /*! \fn QString OContact::spouse() const |
375 | Returns the spouse of the contact. | 375 | Returns the spouse of the contact. |
376 | */ | 376 | */ |
377 | 377 | ||
378 | /*! \fn QString OContact::gender() const | 378 | /*! \fn QString OContact::gender() const |
379 | Returns the gender of the contact. | 379 | Returns the gender of the contact. |
380 | */ | 380 | */ |
381 | 381 | ||
382 | /*! \fn QString OContact::nickname() const | 382 | /*! \fn QString OContact::nickname() const |
383 | Returns the nickname of the contact. | 383 | Returns the nickname of the contact. |
384 | */ | 384 | */ |
385 | 385 | ||
386 | /*! \fn QString OContact::children() const | 386 | /*! \fn QString OContact::children() const |
387 | Returns the children of the contact. | 387 | Returns the children of the contact. |
388 | */ | 388 | */ |
389 | 389 | ||
390 | /*! \fn QString OContact::notes() const | 390 | /*! \fn QString OContact::notes() const |
391 | Returns the notes relating to the the contact. | 391 | Returns the notes relating to the the contact. |
392 | */ | 392 | */ |
393 | 393 | ||
394 | /*! \fn QString OContact::groups() const | 394 | /*! \fn QString OContact::groups() const |
395 | \internal | 395 | \internal |
396 | Returns the groups for the contact. | 396 | Returns the groups for the contact. |
397 | */ | 397 | */ |
398 | 398 | ||
399 | /*! \fn QStringList OContact::groupList() const | 399 | /*! \fn QStringList OContact::groupList() const |
400 | \internal | 400 | \internal |
401 | */ | 401 | */ |
402 | 402 | ||
403 | /*! \fn QString OContact::field(int) const | 403 | /*! \fn QString OContact::field(int) const |
404 | \internal | 404 | \internal |
405 | */ | 405 | */ |
406 | 406 | ||
407 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) | 407 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) |
408 | \internal | 408 | \internal |
409 | */ | 409 | */ |
410 | 410 | ||
411 | /*! \fn void OContact::setUid( int id ) | 411 | /*! \fn void OContact::setUid( int id ) |
412 | \internal | 412 | \internal |
413 | Sets the uid for this record to \a id. | 413 | Sets the uid for this record to \a id. |
414 | */ | 414 | */ |
415 | 415 | ||
416 | /*! \enum OContact::journal_action | 416 | /*! \enum OContact::journal_action |
417 | \internal | 417 | \internal |
418 | */ | 418 | */ |
419 | 419 | ||
420 | /*! | 420 | /*! |
421 | \internal | 421 | \internal |
422 | */ | 422 | */ |
423 | QMap<int, QString> OContact::toMap() const | 423 | QMap<int, QString> OContact::toMap() const |
424 | { | 424 | { |
425 | QMap<int, QString> map = mMap; | 425 | QMap<int, QString> map = mMap; |
426 | QString cats = idsToString( categories() ); | 426 | QString cats = idsToString( categories() ); |
427 | if ( !cats.isEmpty() ) | 427 | if ( !cats.isEmpty() ) |
428 | map.insert( Qtopia::AddressCategory, cats ); | 428 | map.insert( Qtopia::AddressCategory, cats ); |
429 | return map; | 429 | return map; |
430 | } | 430 | } |
431 | 431 | ||
432 | /*! | 432 | /*! |
433 | Returns a rich text formatted QString representing the contents the contact. | 433 | Returns a rich text formatted QString representing the contents the contact. |
434 | */ | 434 | */ |
435 | QString OContact::toRichText() const | 435 | QString OContact::toRichText() const |
436 | { | 436 | { |
437 | QString text; | 437 | QString text; |
438 | QString value, comp, state; | 438 | QString value, comp, state; |
439 | 439 | ||
440 | // name, jobtitle and company | 440 | // name, jobtitle and company |
441 | if ( !(value = fullName()).isEmpty() ) | 441 | if ( !(value = fullName()).isEmpty() ) |
442 | text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; | 442 | text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; |
443 | if ( !(value = jobTitle()).isEmpty() ) | 443 | if ( !(value = jobTitle()).isEmpty() ) |
444 | text += Qtopia::escapeString(value) + "<br>"; | 444 | text += Qtopia::escapeString(value) + "<br>"; |
445 | 445 | ||
446 | comp = company(); | 446 | comp = company(); |
447 | if ( !(value = department()).isEmpty() ) { | 447 | if ( !(value = department()).isEmpty() ) { |
448 | text += Qtopia::escapeString(value); | 448 | text += Qtopia::escapeString(value); |
449 | if ( comp ) | 449 | if ( comp ) |
450 | text += ", "; | 450 | text += ", "; |
451 | else | 451 | else |
452 | text += "<br>"; | 452 | text += "<br>"; |
453 | } | 453 | } |
454 | if ( !comp.isEmpty() ) | 454 | if ( !comp.isEmpty() ) |
455 | text += Qtopia::escapeString(comp) + "<br>"; | 455 | text += Qtopia::escapeString(comp) + "<br>"; |
456 | 456 | ||
457 | // business address | 457 | // business address |
458 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 458 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
459 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 459 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
460 | text += "<br>"; | 460 | text += "<br>"; |
461 | text += QObject::tr( "<b>Work Address:</b>" ); | 461 | text += QObject::tr( "<b>Work Address:</b>" ); |
462 | text += "<br>"; | 462 | text += "<br>"; |
463 | } | 463 | } |
464 | 464 | ||
465 | if ( !(value = businessStreet()).isEmpty() ) | 465 | if ( !(value = businessStreet()).isEmpty() ) |
466 | text += Qtopia::escapeString(value) + "<br>"; | 466 | text += Qtopia::escapeString(value) + "<br>"; |
467 | state = businessState(); | 467 | state = businessState(); |
468 | if ( !(value = businessCity()).isEmpty() ) { | 468 | if ( !(value = businessCity()).isEmpty() ) { |
469 | text += Qtopia::escapeString(value); | 469 | text += Qtopia::escapeString(value); |
470 | if ( state ) | 470 | if ( state ) |
471 | text += ", " + Qtopia::escapeString(state); | 471 | text += ", " + Qtopia::escapeString(state); |
472 | text += "<br>"; | 472 | text += "<br>"; |
473 | } else if ( !state.isEmpty() ) | 473 | } else if ( !state.isEmpty() ) |
474 | text += Qtopia::escapeString(state) + "<br>"; | 474 | text += Qtopia::escapeString(state) + "<br>"; |
475 | if ( !(value = businessZip()).isEmpty() ) | 475 | if ( !(value = businessZip()).isEmpty() ) |
476 | text += Qtopia::escapeString(value) + "<br>"; | 476 | text += Qtopia::escapeString(value) + "<br>"; |
477 | if ( !(value = businessCountry()).isEmpty() ) | 477 | if ( !(value = businessCountry()).isEmpty() ) |
478 | text += Qtopia::escapeString(value) + "<br>"; | 478 | text += Qtopia::escapeString(value) + "<br>"; |
479 | 479 | ||
480 | // home address | 480 | // home address |
481 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 481 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
482 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 482 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
483 | text += "<br>"; | 483 | text += "<br>"; |
484 | text += QObject::tr( "<b>Home Address:</b>" ); | 484 | text += QObject::tr( "<b>Home Address:</b>" ); |
485 | text += "<br>"; | 485 | text += "<br>"; |
486 | } | 486 | } |
487 | 487 | ||
488 | if ( !(value = homeStreet()).isEmpty() ) | 488 | if ( !(value = homeStreet()).isEmpty() ) |
489 | text += Qtopia::escapeString(value) + "<br>"; | 489 | text += Qtopia::escapeString(value) + "<br>"; |
490 | state = homeState(); | 490 | state = homeState(); |
491 | if ( !(value = homeCity()).isEmpty() ) { | 491 | if ( !(value = homeCity()).isEmpty() ) { |
492 | text += Qtopia::escapeString(value); | 492 | text += Qtopia::escapeString(value); |
493 | if ( !state.isEmpty() ) | 493 | if ( !state.isEmpty() ) |
494 | text += ", " + Qtopia::escapeString(state); | 494 | text += ", " + Qtopia::escapeString(state); |
495 | text += "<br>"; | 495 | text += "<br>"; |
496 | } else if (!state.isEmpty()) | 496 | } else if (!state.isEmpty()) |
497 | text += Qtopia::escapeString(state) + "<br>"; | 497 | text += Qtopia::escapeString(state) + "<br>"; |
498 | if ( !(value = homeZip()).isEmpty() ) | 498 | if ( !(value = homeZip()).isEmpty() ) |
499 | text += Qtopia::escapeString(value) + "<br>"; | 499 | text += Qtopia::escapeString(value) + "<br>"; |
500 | if ( !(value = homeCountry()).isEmpty() ) | 500 | if ( !(value = homeCountry()).isEmpty() ) |
501 | text += Qtopia::escapeString(value) + "<br>"; | 501 | text += Qtopia::escapeString(value) + "<br>"; |
502 | 502 | ||
503 | // the others... | 503 | // the others... |
504 | QString str; | 504 | QString str; |
505 | QString defEmail = defaultEmail(); | ||
506 | if ( !defEmail.isEmpty() ) | ||
507 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" | ||
508 | + Qtopia::escapeString(defEmail) + "<br>"; | ||
505 | str = emails(); | 509 | str = emails(); |
506 | if ( !str.isEmpty() ) | 510 | if ( !str.isEmpty() && ( str != defEmail ) ) |
507 | text += "<b>" + QObject::tr("Email Addresses: ") + "</b>" | 511 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" |
508 | + Qtopia::escapeString(str) + "<br>"; | 512 | + Qtopia::escapeString(str) + "<br>"; |
509 | str = homePhone(); | 513 | str = homePhone(); |
510 | if ( !str.isEmpty() ) | 514 | if ( !str.isEmpty() ) |
511 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" | 515 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" |
512 | + Qtopia::escapeString(str) + "<br>"; | 516 | + Qtopia::escapeString(str) + "<br>"; |
513 | str = homeFax(); | 517 | str = homeFax(); |
514 | if ( !str.isEmpty() ) | 518 | if ( !str.isEmpty() ) |
515 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" | 519 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" |
516 | + Qtopia::escapeString(str) + "<br>"; | 520 | + Qtopia::escapeString(str) + "<br>"; |
517 | str = homeMobile(); | 521 | str = homeMobile(); |
518 | if ( !str.isEmpty() ) | 522 | if ( !str.isEmpty() ) |
519 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" | 523 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" |
520 | + Qtopia::escapeString(str) + "<br>"; | 524 | + Qtopia::escapeString(str) + "<br>"; |
521 | str = homeWebpage(); | 525 | str = homeWebpage(); |
522 | if ( !str.isEmpty() ) | 526 | if ( !str.isEmpty() ) |
523 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" | 527 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" |
524 | + Qtopia::escapeString(str) + "<br>"; | 528 | + Qtopia::escapeString(str) + "<br>"; |
525 | str = businessWebpage(); | 529 | str = businessWebpage(); |
526 | if ( !str.isEmpty() ) | 530 | if ( !str.isEmpty() ) |
527 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" | 531 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" |
528 | + Qtopia::escapeString(str) + "<br>"; | 532 | + Qtopia::escapeString(str) + "<br>"; |
529 | str = office(); | 533 | str = office(); |
530 | if ( !str.isEmpty() ) | 534 | if ( !str.isEmpty() ) |
531 | text += "<b>" + QObject::tr("Office: ") + "</b>" | 535 | text += "<b>" + QObject::tr("Office: ") + "</b>" |
532 | + Qtopia::escapeString(str) + "<br>"; | 536 | + Qtopia::escapeString(str) + "<br>"; |
533 | str = businessPhone(); | 537 | str = businessPhone(); |
534 | if ( !str.isEmpty() ) | 538 | if ( !str.isEmpty() ) |
535 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" | 539 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" |
536 | + Qtopia::escapeString(str) + "<br>"; | 540 | + Qtopia::escapeString(str) + "<br>"; |
537 | str = businessFax(); | 541 | str = businessFax(); |
538 | if ( !str.isEmpty() ) | 542 | if ( !str.isEmpty() ) |
539 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" | 543 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" |
540 | + Qtopia::escapeString(str) + "<br>"; | 544 | + Qtopia::escapeString(str) + "<br>"; |
541 | str = businessMobile(); | 545 | str = businessMobile(); |
542 | if ( !str.isEmpty() ) | 546 | if ( !str.isEmpty() ) |
543 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" | 547 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" |
544 | + Qtopia::escapeString(str) + "<br>"; | 548 | + Qtopia::escapeString(str) + "<br>"; |
545 | str = businessPager(); | 549 | str = businessPager(); |
546 | if ( !str.isEmpty() ) | 550 | if ( !str.isEmpty() ) |
547 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" | 551 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" |
548 | + Qtopia::escapeString(str) + "<br>"; | 552 | + Qtopia::escapeString(str) + "<br>"; |
549 | str = profession(); | 553 | str = profession(); |
550 | if ( !str.isEmpty() ) | 554 | if ( !str.isEmpty() ) |
551 | text += "<b>" + QObject::tr("Profession: ") + "</b>" | 555 | text += "<b>" + QObject::tr("Profession: ") + "</b>" |
552 | + Qtopia::escapeString(str) + "<br>"; | 556 | + Qtopia::escapeString(str) + "<br>"; |
553 | str = assistant(); | 557 | str = assistant(); |
554 | if ( !str.isEmpty() ) | 558 | if ( !str.isEmpty() ) |
555 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" | 559 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" |
556 | + Qtopia::escapeString(str) + "<br>"; | 560 | + Qtopia::escapeString(str) + "<br>"; |
557 | str = manager(); | 561 | str = manager(); |
558 | if ( !str.isEmpty() ) | 562 | if ( !str.isEmpty() ) |
559 | text += "<b>" + QObject::tr("Manager: ") + "</b>" | 563 | text += "<b>" + QObject::tr("Manager: ") + "</b>" |
560 | + Qtopia::escapeString(str) + "<br>"; | 564 | + Qtopia::escapeString(str) + "<br>"; |
561 | str = gender(); | 565 | str = gender(); |
562 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 566 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
563 | if ( str.toInt() == 1 ) | 567 | if ( str.toInt() == 1 ) |
564 | str = QObject::tr( "Male" ); | 568 | str = QObject::tr( "Male" ); |
565 | else if ( str.toInt() == 2 ) | 569 | else if ( str.toInt() == 2 ) |
566 | str = QObject::tr( "Female" ); | 570 | str = QObject::tr( "Female" ); |
567 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; | 571 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; |
568 | } | 572 | } |
569 | str = spouse(); | 573 | str = spouse(); |
570 | if ( !str.isEmpty() ) | 574 | if ( !str.isEmpty() ) |
571 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" | 575 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" |
572 | + Qtopia::escapeString(str) + "<br>"; | 576 | + Qtopia::escapeString(str) + "<br>"; |
573 | if ( birthday().isValid() ){ | 577 | if ( birthday().isValid() ){ |
574 | str = TimeString::numberDateString( birthday() ); | 578 | str = TimeString::numberDateString( birthday() ); |
575 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" | 579 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" |
576 | + Qtopia::escapeString(str) + "<br>"; | 580 | + Qtopia::escapeString(str) + "<br>"; |
577 | } | 581 | } |
578 | if ( anniversary().isValid() ){ | 582 | if ( anniversary().isValid() ){ |
579 | str = TimeString::numberDateString( anniversary() ); | 583 | str = TimeString::numberDateString( anniversary() ); |
580 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" | 584 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" |
581 | + Qtopia::escapeString(str) + "<br>"; | 585 | + Qtopia::escapeString(str) + "<br>"; |
582 | } | 586 | } |
583 | str = nickname(); | 587 | str = nickname(); |
584 | if ( !str.isEmpty() ) | 588 | if ( !str.isEmpty() ) |
585 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 589 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
586 | + Qtopia::escapeString(str) + "<br>"; | 590 | + Qtopia::escapeString(str) + "<br>"; |
587 | 591 | ||
588 | if ( categoryNames().count() ){ | 592 | if ( categoryNames().count() ){ |
589 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 593 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
590 | text += categoryNames().join(", "); | 594 | text += categoryNames().join(", "); |
591 | text += "<br>"; | 595 | text += "<br>"; |
592 | } | 596 | } |
593 | 597 | ||
594 | // notes last | 598 | // notes last |
595 | if ( (value = notes()) ) { | 599 | if ( (value = notes()) ) { |
596 | QRegExp reg("\n"); | 600 | QRegExp reg("\n"); |
597 | 601 | ||
598 | //QString tmp = Qtopia::escapeString(value); | 602 | //QString tmp = Qtopia::escapeString(value); |
599 | QString tmp = QStyleSheet::convertFromPlainText(value); | 603 | QString tmp = QStyleSheet::convertFromPlainText(value); |
600 | //tmp.replace( reg, "<br>" ); | 604 | //tmp.replace( reg, "<br>" ); |
601 | text += "<br>" + tmp + "<br>"; | 605 | text += "<br>" + tmp + "<br>"; |
602 | } | 606 | } |
603 | return text; | 607 | return text; |
604 | } | 608 | } |
605 | 609 | ||
606 | /*! | 610 | /*! |
607 | \internal | 611 | \internal |
608 | */ | 612 | */ |
609 | void OContact::insert( int key, const QString &v ) | 613 | void OContact::insert( int key, const QString &v ) |
610 | { | 614 | { |
611 | QString value = v.stripWhiteSpace(); | 615 | QString value = v.stripWhiteSpace(); |
612 | if ( value.isEmpty() ) | 616 | if ( value.isEmpty() ) |
613 | mMap.remove( key ); | 617 | mMap.remove( key ); |
614 | else | 618 | else |
615 | mMap.insert( key, value ); | 619 | mMap.insert( key, value ); |
616 | } | 620 | } |
617 | 621 | ||
618 | /*! | 622 | /*! |
619 | \internal | 623 | \internal |
620 | */ | 624 | */ |
621 | void OContact::replace( int key, const QString & v ) | 625 | void OContact::replace( int key, const QString & v ) |
622 | { | 626 | { |
623 | QString value = v.stripWhiteSpace(); | 627 | QString value = v.stripWhiteSpace(); |
624 | if ( value.isEmpty() ) | 628 | if ( value.isEmpty() ) |
625 | mMap.remove( key ); | 629 | mMap.remove( key ); |
626 | else | 630 | else |
627 | mMap.replace( key, value ); | 631 | mMap.replace( key, value ); |
628 | } | 632 | } |
629 | 633 | ||
630 | /*! | 634 | /*! |
631 | \internal | 635 | \internal |
632 | */ | 636 | */ |
633 | QString OContact::find( int key ) const | 637 | QString OContact::find( int key ) const |
634 | { | 638 | { |
635 | return mMap[key]; | 639 | return mMap[key]; |
636 | } | 640 | } |
637 | 641 | ||
638 | /*! | 642 | /*! |
639 | \internal | 643 | \internal |
640 | */ | 644 | */ |
641 | QString OContact::displayAddress( const QString &street, | 645 | QString OContact::displayAddress( const QString &street, |
642 | const QString &city, | 646 | const QString &city, |
643 | const QString &state, | 647 | const QString &state, |
644 | const QString &zip, | 648 | const QString &zip, |
645 | const QString &country ) const | 649 | const QString &country ) const |
646 | { | 650 | { |
647 | QString s = street; | 651 | QString s = street; |
648 | if ( !street.isEmpty() ) | 652 | if ( !street.isEmpty() ) |
649 | s+= "\n"; | 653 | s+= "\n"; |
650 | s += city; | 654 | s += city; |
651 | if ( !city.isEmpty() && !state.isEmpty() ) | 655 | if ( !city.isEmpty() && !state.isEmpty() ) |
652 | s += ", "; | 656 | s += ", "; |
653 | s += state; | 657 | s += state; |
654 | if ( !state.isEmpty() && !zip.isEmpty() ) | 658 | if ( !state.isEmpty() && !zip.isEmpty() ) |
655 | s += " "; | 659 | s += " "; |
656 | s += zip; | 660 | s += zip; |
657 | if ( !country.isEmpty() && !s.isEmpty() ) | 661 | if ( !country.isEmpty() && !s.isEmpty() ) |
658 | s += "\n"; | 662 | s += "\n"; |
659 | s += country; | 663 | s += country; |
660 | return s; | 664 | return s; |
661 | } | 665 | } |
662 | 666 | ||
663 | /*! | 667 | /*! |
664 | \internal | 668 | \internal |
665 | */ | 669 | */ |
666 | QString OContact::displayBusinessAddress() const | 670 | QString OContact::displayBusinessAddress() const |
667 | { | 671 | { |
668 | return displayAddress( businessStreet(), businessCity(), | 672 | return displayAddress( businessStreet(), businessCity(), |
669 | businessState(), businessZip(), | 673 | businessState(), businessZip(), |
670 | businessCountry() ); | 674 | businessCountry() ); |
671 | } | 675 | } |
672 | 676 | ||
673 | /*! | 677 | /*! |
674 | \internal | 678 | \internal |
675 | */ | 679 | */ |
676 | QString OContact::displayHomeAddress() const | 680 | QString OContact::displayHomeAddress() const |
677 | { | 681 | { |
678 | return displayAddress( homeStreet(), homeCity(), | 682 | return displayAddress( homeStreet(), homeCity(), |
679 | homeState(), homeZip(), | 683 | homeState(), homeZip(), |
680 | homeCountry() ); | 684 | homeCountry() ); |
681 | } | 685 | } |
682 | 686 | ||
683 | /*! | 687 | /*! |
684 | Returns the full name of the contact | 688 | Returns the full name of the contact |
685 | */ | 689 | */ |
686 | QString OContact::fullName() const | 690 | QString OContact::fullName() const |
687 | { | 691 | { |
688 | QString title = find( Qtopia::Title ); | 692 | QString title = find( Qtopia::Title ); |
689 | QString firstName = find( Qtopia::FirstName ); | 693 | QString firstName = find( Qtopia::FirstName ); |
690 | QString middleName = find( Qtopia::MiddleName ); | 694 | QString middleName = find( Qtopia::MiddleName ); |
691 | QString lastName = find( Qtopia::LastName ); | 695 | QString lastName = find( Qtopia::LastName ); |
692 | QString suffix = find( Qtopia::Suffix ); | 696 | QString suffix = find( Qtopia::Suffix ); |
693 | 697 | ||
694 | QString name = title; | 698 | QString name = title; |
695 | if ( !firstName.isEmpty() ) { | 699 | if ( !firstName.isEmpty() ) { |
696 | if ( !name.isEmpty() ) | 700 | if ( !name.isEmpty() ) |
697 | name += " "; | 701 | name += " "; |
698 | name += firstName; | 702 | name += firstName; |
699 | } | 703 | } |
700 | if ( !middleName.isEmpty() ) { | 704 | if ( !middleName.isEmpty() ) { |
701 | if ( !name.isEmpty() ) | 705 | if ( !name.isEmpty() ) |
702 | name += " "; | 706 | name += " "; |
703 | name += middleName; | 707 | name += middleName; |
704 | } | 708 | } |
705 | if ( !lastName.isEmpty() ) { | 709 | if ( !lastName.isEmpty() ) { |
706 | if ( !name.isEmpty() ) | 710 | if ( !name.isEmpty() ) |
707 | name += " "; | 711 | name += " "; |
708 | name += lastName; | 712 | name += lastName; |
709 | } | 713 | } |
710 | if ( !suffix.isEmpty() ) { | 714 | if ( !suffix.isEmpty() ) { |
711 | if ( !name.isEmpty() ) | 715 | if ( !name.isEmpty() ) |
712 | name += " "; | 716 | name += " "; |
713 | name += suffix; | 717 | name += suffix; |
714 | } | 718 | } |
715 | return name.simplifyWhiteSpace(); | 719 | return name.simplifyWhiteSpace(); |
716 | } | 720 | } |
717 | 721 | ||
718 | /*! | 722 | /*! |
719 | Returns a list of the names of the children of the contact. | 723 | Returns a list of the names of the children of the contact. |
720 | */ | 724 | */ |
721 | QStringList OContact::childrenList() const | 725 | QStringList OContact::childrenList() const |
722 | { | 726 | { |
723 | return QStringList::split( " ", find( Qtopia::Children ) ); | 727 | return QStringList::split( " ", find( Qtopia::Children ) ); |
724 | } | 728 | } |
725 | 729 | ||
726 | /*! \fn void OContact::insertEmail( const QString &email ) | 730 | /*! \fn void OContact::insertEmail( const QString &email ) |
727 | 731 | ||
728 | Insert \a email into the email list. Ensures \a email can only be added | 732 | Insert \a email into the email list. Ensures \a email can only be added |
729 | once. If there is no default email address set, it sets it to the \a email. | 733 | once. If there is no default email address set, it sets it to the \a email. |
730 | */ | 734 | */ |
731 | 735 | ||
732 | /*! \fn void OContact::removeEmail( const QString &email ) | 736 | /*! \fn void OContact::removeEmail( const QString &email ) |
733 | 737 | ||
734 | Removes the \a email from the email list. If the default email was \a email, | 738 | Removes the \a email from the email list. If the default email was \a email, |
735 | then the default email address is assigned to the first email in the | 739 | then the default email address is assigned to the first email in the |
736 | email list | 740 | email list |
737 | */ | 741 | */ |
738 | 742 | ||
739 | /*! \fn void OContact::clearEmails() | 743 | /*! \fn void OContact::clearEmails() |
740 | 744 | ||
741 | Clears the email list. | 745 | Clears the email list. |
742 | */ | 746 | */ |
743 | 747 | ||
744 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) | 748 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) |
745 | 749 | ||
746 | Appends the \a emailList to the exiting email list | 750 | Appends the \a emailList to the exiting email list |
747 | */ | 751 | */ |
748 | 752 | ||
749 | /*! | 753 | /*! |
750 | Returns a list of email addresses belonging to the contact, including | 754 | Returns a list of email addresses belonging to the contact, including |
751 | the default email address. | 755 | the default email address. |
752 | */ | 756 | */ |
753 | QStringList OContact::emailList() const | 757 | QStringList OContact::emailList() const |
754 | { | 758 | { |
755 | QString emailStr = emails(); | 759 | QString emailStr = emails(); |
756 | 760 | ||
757 | QStringList r; | 761 | QStringList r; |
758 | if ( !emailStr.isEmpty() ) { | 762 | if ( !emailStr.isEmpty() ) { |
759 | qDebug(" emailstr "); | 763 | qDebug(" emailstr "); |
760 | QStringList l = QStringList::split( emailSeparator(), emailStr ); | 764 | QStringList l = QStringList::split( emailSeparator(), emailStr ); |
761 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) | 765 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) |
762 | r += (*it).simplifyWhiteSpace(); | 766 | r += (*it).simplifyWhiteSpace(); |
763 | } | 767 | } |
764 | 768 | ||
765 | return r; | 769 | return r; |
766 | } | 770 | } |
767 | 771 | ||
768 | /*! | 772 | /*! |
769 | \overload | 773 | \overload |
770 | 774 | ||
771 | Generates the string for the contact to be filed as from the first, | 775 | Generates the string for the contact to be filed as from the first, |
772 | middle and last name of the contact. | 776 | middle and last name of the contact. |
773 | */ | 777 | */ |
774 | void OContact::setFileAs() | 778 | void OContact::setFileAs() |
775 | { | 779 | { |
776 | QString lastName, firstName, middleName, fileas; | 780 | QString lastName, firstName, middleName, fileas; |
777 | 781 | ||
778 | lastName = find( Qtopia::LastName ); | 782 | lastName = find( Qtopia::LastName ); |
779 | firstName = find( Qtopia::FirstName ); | 783 | firstName = find( Qtopia::FirstName ); |
780 | middleName = find( Qtopia::MiddleName ); | 784 | middleName = find( Qtopia::MiddleName ); |
781 | if ( !lastName.isEmpty() && !firstName.isEmpty() | 785 | if ( !lastName.isEmpty() && !firstName.isEmpty() |
782 | && !middleName.isEmpty() ) | 786 | && !middleName.isEmpty() ) |
783 | fileas = lastName + ", " + firstName + " " + middleName; | 787 | fileas = lastName + ", " + firstName + " " + middleName; |
784 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) | 788 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) |
785 | fileas = lastName + ", " + firstName; | 789 | fileas = lastName + ", " + firstName; |
786 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || | 790 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || |
787 | !middleName.isEmpty() ) | 791 | !middleName.isEmpty() ) |
788 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) | 792 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) |
789 | + middleName + ( middleName.isEmpty() ? "" : " " ) | 793 | + middleName + ( middleName.isEmpty() ? "" : " " ) |
790 | + lastName; | 794 | + lastName; |
791 | 795 | ||
792 | replace( Qtopia::FileAs, fileas ); | 796 | replace( Qtopia::FileAs, fileas ); |
793 | } | 797 | } |
794 | 798 | ||
795 | /*! | 799 | /*! |
796 | \internal | 800 | \internal |
797 | Appends the contact information to \a buf. | 801 | Appends the contact information to \a buf. |
798 | */ | 802 | */ |
799 | void OContact::save( QString &buf ) const | 803 | void OContact::save( QString &buf ) const |
800 | { | 804 | { |
801 | static const QStringList SLFIELDS = fields(); | 805 | static const QStringList SLFIELDS = fields(); |
802 | // I'm expecting "<Contact " in front of this... | 806 | // I'm expecting "<Contact " in front of this... |
803 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); | 807 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); |
804 | it != mMap.end(); ++it ) { | 808 | it != mMap.end(); ++it ) { |
805 | const QString &value = it.data(); | 809 | const QString &value = it.data(); |
806 | int key = it.key(); | 810 | int key = it.key(); |
807 | if ( !value.isEmpty() ) { | 811 | if ( !value.isEmpty() ) { |
808 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) | 812 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) |
809 | continue; | 813 | continue; |
810 | 814 | ||
811 | key -= Qtopia::AddressCategory+1; | 815 | key -= Qtopia::AddressCategory+1; |
812 | buf += SLFIELDS[key]; | 816 | buf += SLFIELDS[key]; |
813 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; | 817 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; |
814 | } | 818 | } |
815 | } | 819 | } |
816 | buf += customToXml(); | 820 | buf += customToXml(); |
817 | if ( categories().count() > 0 ) | 821 | if ( categories().count() > 0 ) |
818 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; | 822 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; |
819 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; | 823 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; |
820 | // You need to close this yourself | 824 | // You need to close this yourself |
821 | } | 825 | } |
822 | 826 | ||
823 | 827 | ||
824 | /*! | 828 | /*! |
825 | \internal | 829 | \internal |
826 | Returns the list of fields belonging to a contact | 830 | Returns the list of fields belonging to a contact |
827 | Never change order of this list ! It has to be regarding | 831 | Never change order of this list ! It has to be regarding |
828 | enum AddressBookFields !! | 832 | enum AddressBookFields !! |
829 | */ | 833 | */ |
830 | QStringList OContact::fields() | 834 | QStringList OContact::fields() |
831 | { | 835 | { |
832 | QStringList list; | 836 | QStringList list; |
833 | 837 | ||
834 | list.append( "Title" ); // Not Used! | 838 | list.append( "Title" ); // Not Used! |
835 | list.append( "FirstName" ); | 839 | list.append( "FirstName" ); |
836 | list.append( "MiddleName" ); | 840 | list.append( "MiddleName" ); |
837 | list.append( "LastName" ); | 841 | list.append( "LastName" ); |
838 | list.append( "Suffix" ); | 842 | list.append( "Suffix" ); |
839 | list.append( "FileAs" ); | 843 | list.append( "FileAs" ); |
840 | 844 | ||
841 | list.append( "JobTitle" ); | 845 | list.append( "JobTitle" ); |
842 | list.append( "Department" ); | 846 | list.append( "Department" ); |
843 | list.append( "Company" ); | 847 | list.append( "Company" ); |
844 | list.append( "BusinessPhone" ); | 848 | list.append( "BusinessPhone" ); |
845 | list.append( "BusinessFax" ); | 849 | list.append( "BusinessFax" ); |
846 | list.append( "BusinessMobile" ); | 850 | list.append( "BusinessMobile" ); |
847 | 851 | ||
848 | list.append( "DefaultEmail" ); | 852 | list.append( "DefaultEmail" ); |
849 | list.append( "Emails" ); | 853 | list.append( "Emails" ); |
850 | 854 | ||
851 | list.append( "HomePhone" ); | 855 | list.append( "HomePhone" ); |
852 | list.append( "HomeFax" ); | 856 | list.append( "HomeFax" ); |
853 | list.append( "HomeMobile" ); | 857 | list.append( "HomeMobile" ); |
854 | 858 | ||
855 | list.append( "BusinessStreet" ); | 859 | list.append( "BusinessStreet" ); |
856 | list.append( "BusinessCity" ); | 860 | list.append( "BusinessCity" ); |
857 | list.append( "BusinessState" ); | 861 | list.append( "BusinessState" ); |
858 | list.append( "BusinessZip" ); | 862 | list.append( "BusinessZip" ); |
859 | list.append( "BusinessCountry" ); | 863 | list.append( "BusinessCountry" ); |
860 | list.append( "BusinessPager" ); | 864 | list.append( "BusinessPager" ); |
861 | list.append( "BusinessWebPage" ); | 865 | list.append( "BusinessWebPage" ); |
862 | 866 | ||
863 | list.append( "Office" ); | 867 | list.append( "Office" ); |
864 | list.append( "Profession" ); | 868 | list.append( "Profession" ); |
865 | list.append( "Assistant" ); | 869 | list.append( "Assistant" ); |
866 | list.append( "Manager" ); | 870 | list.append( "Manager" ); |
867 | 871 | ||
868 | list.append( "HomeStreet" ); | 872 | list.append( "HomeStreet" ); |
869 | list.append( "HomeCity" ); | 873 | list.append( "HomeCity" ); |
870 | list.append( "HomeState" ); | 874 | list.append( "HomeState" ); |
871 | list.append( "HomeZip" ); | 875 | list.append( "HomeZip" ); |
872 | list.append( "HomeCountry" ); | 876 | list.append( "HomeCountry" ); |
873 | list.append( "HomeWebPage" ); | 877 | list.append( "HomeWebPage" ); |
874 | 878 | ||
875 | list.append( "Spouse" ); | 879 | list.append( "Spouse" ); |
876 | list.append( "Gender" ); | 880 | list.append( "Gender" ); |
877 | list.append( "Birthday" ); | 881 | list.append( "Birthday" ); |
878 | list.append( "Anniversary" ); | 882 | list.append( "Anniversary" ); |
879 | list.append( "Nickname" ); | 883 | list.append( "Nickname" ); |
880 | list.append( "Children" ); | 884 | list.append( "Children" ); |
881 | 885 | ||
882 | list.append( "Notes" ); | 886 | list.append( "Notes" ); |
883 | list.append( "Groups" ); | 887 | list.append( "Groups" ); |
884 | 888 | ||
885 | return list; | 889 | return list; |
886 | } | 890 | } |
887 | 891 | ||
888 | 892 | ||
889 | /*! | 893 | /*! |
890 | Sets the list of email address for contact to those contained in \a str. | 894 | Sets the list of email address for contact to those contained in \a str. |
891 | Email address should be separated by ';'s. | 895 | Email address should be separated by ';'s. |
892 | */ | 896 | */ |
893 | void OContact::setEmails( const QString &str ) | 897 | void OContact::setEmails( const QString &str ) |
894 | { | 898 | { |
895 | replace( Qtopia::Emails, str ); | 899 | replace( Qtopia::Emails, str ); |
896 | if ( str.isEmpty() ) | 900 | if ( str.isEmpty() ) |
897 | setDefaultEmail( QString::null ); | 901 | setDefaultEmail( QString::null ); |
898 | } | 902 | } |
899 | 903 | ||
900 | /*! | 904 | /*! |
901 | Sets the list of children for the contact to those contained in \a str. | 905 | Sets the list of children for the contact to those contained in \a str. |
902 | */ | 906 | */ |
903 | void OContact::setChildren( const QString &str ) | 907 | void OContact::setChildren( const QString &str ) |
904 | { | 908 | { |
905 | replace( Qtopia::Children, str ); | 909 | replace( Qtopia::Children, str ); |
906 | } | 910 | } |
907 | 911 | ||
908 | /*! | 912 | /*! |
909 | Returns TRUE if the contact matches the regular expression \a regexp. | 913 | Returns TRUE if the contact matches the regular expression \a regexp. |
910 | Otherwise returns FALSE. | 914 | Otherwise returns FALSE. |
911 | */ | 915 | */ |
912 | bool OContact::match( const QString ®exp ) const | 916 | bool OContact::match( const QString ®exp ) const |
913 | { | 917 | { |
914 | return match(QRegExp(regexp)); | 918 | return match(QRegExp(regexp)); |
915 | } | 919 | } |
916 | 920 | ||
917 | /*! | 921 | /*! |
918 | \overload | 922 | \overload |
919 | Returns TRUE if the contact matches the regular expression \a regexp. | 923 | Returns TRUE if the contact matches the regular expression \a regexp. |
920 | Otherwise returns FALSE. | 924 | Otherwise returns FALSE. |
921 | */ | 925 | */ |
922 | bool OContact::match( const QRegExp &r ) const | 926 | bool OContact::match( const QRegExp &r ) const |
923 | { | 927 | { |
924 | bool match; | 928 | bool match; |
925 | match = false; | 929 | match = false; |
926 | QMap<int, QString>::ConstIterator it; | 930 | QMap<int, QString>::ConstIterator it; |
927 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { | 931 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { |
928 | if ( (*it).find( r ) > -1 ) { | 932 | if ( (*it).find( r ) > -1 ) { |
929 | match = true; | 933 | match = true; |
930 | break; | 934 | break; |
931 | } | 935 | } |
932 | } | 936 | } |
933 | return match; | 937 | return match; |
934 | } | 938 | } |
935 | 939 | ||
936 | 940 | ||
937 | QString OContact::toShortText() const | 941 | QString OContact::toShortText() const |
938 | { | 942 | { |
939 | return ( fullName() ); | 943 | return ( fullName() ); |
940 | } | 944 | } |
941 | QString OContact::type() const | 945 | QString OContact::type() const |
942 | { | 946 | { |
943 | return QString::fromLatin1( "OContact" ); | 947 | return QString::fromLatin1( "OContact" ); |
944 | } | 948 | } |
945 | 949 | ||
946 | // Definition is missing ! (se) | 950 | // Definition is missing ! (se) |
947 | QMap<QString,QString> OContact::toExtraMap() const | 951 | QMap<QString,QString> OContact::toExtraMap() const |
948 | { | 952 | { |
949 | qWarning ("Function not implemented: OContact::toExtraMap()"); | 953 | qWarning ("Function not implemented: OContact::toExtraMap()"); |
950 | QMap <QString,QString> useless; | 954 | QMap <QString,QString> useless; |
951 | return useless; | 955 | return useless; |
952 | } | 956 | } |
953 | 957 | ||
954 | class QString OContact::recordField( int pos ) const | 958 | class QString OContact::recordField( int pos ) const |
955 | { | 959 | { |
956 | QStringList SLFIELDS = fields(); // ?? why this ? (se) | 960 | QStringList SLFIELDS = fields(); // ?? why this ? (se) |
957 | return SLFIELDS[pos]; | 961 | return SLFIELDS[pos]; |
958 | } | 962 | } |
959 | 963 | ||
960 | // In future releases, we should store birthday and anniversary | 964 | // In future releases, we should store birthday and anniversary |
961 | // internally as QDate instead of QString ! | 965 | // internally as QDate instead of QString ! |
962 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) | 966 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) |
963 | 967 | ||
964 | /*! \fn void OContact::setBirthday( const QDate& date ) | 968 | /*! \fn void OContact::setBirthday( const QDate& date ) |
965 | Sets the birthday for the contact to \a date. If date is null | 969 | Sets the birthday for the contact to \a date. If date is null |
966 | the current stored date will be removed. | 970 | the current stored date will be removed. |
967 | */ | 971 | */ |
968 | void OContact::setBirthday( const QDate &v ) | 972 | void OContact::setBirthday( const QDate &v ) |
969 | { | 973 | { |
970 | if ( v.isNull() ){ | 974 | if ( v.isNull() ){ |
971 | qWarning( "Remove Birthday"); | 975 | qWarning( "Remove Birthday"); |
972 | replace( Qtopia::Birthday, QString::null ); | 976 | replace( Qtopia::Birthday, QString::null ); |
973 | return; | 977 | return; |
974 | } | 978 | } |
975 | 979 | ||
976 | if ( v.isValid() ) | 980 | if ( v.isValid() ) |
977 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); | 981 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); |
978 | 982 | ||
979 | } | 983 | } |
980 | 984 | ||
981 | 985 | ||
982 | /*! \fn void OContact::setAnniversary( const QDate &date ) | 986 | /*! \fn void OContact::setAnniversary( const QDate &date ) |
983 | Sets the anniversary of the contact to \a date. If date is | 987 | Sets the anniversary of the contact to \a date. If date is |
984 | null, the current stored date will be removed. | 988 | null, the current stored date will be removed. |
985 | */ | 989 | */ |
986 | void OContact::setAnniversary( const QDate &v ) | 990 | void OContact::setAnniversary( const QDate &v ) |
987 | { | 991 | { |
988 | if ( v.isNull() ){ | 992 | if ( v.isNull() ){ |
989 | qWarning( "Remove Anniversary"); | 993 | qWarning( "Remove Anniversary"); |
990 | replace( Qtopia::Anniversary, QString::null ); | 994 | replace( Qtopia::Anniversary, QString::null ); |
991 | return; | 995 | return; |
992 | } | 996 | } |
993 | 997 | ||
994 | if ( v.isValid() ) | 998 | if ( v.isValid() ) |
995 | replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); | 999 | replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); |
996 | } | 1000 | } |
997 | 1001 | ||
998 | /*! \fn QDate OContact::birthday() const | 1002 | /*! \fn QDate OContact::birthday() const |
999 | Returns the birthday of the contact. | 1003 | Returns the birthday of the contact. |
1000 | */ | 1004 | */ |
1001 | QDate OContact::birthday() const | 1005 | QDate OContact::birthday() const |
1002 | { | 1006 | { |
1003 | QString str = find( Qtopia::Birthday ); | 1007 | QString str = find( Qtopia::Birthday ); |
1004 | qWarning ("Birthday %s", str.latin1() ); | 1008 | qWarning ("Birthday %s", str.latin1() ); |
1005 | if ( !str.isEmpty() ) | 1009 | if ( !str.isEmpty() ) |
1006 | return TimeConversion::fromString ( str ); | 1010 | return TimeConversion::fromString ( str ); |
1007 | else | 1011 | else |
1008 | return QDate(); | 1012 | return QDate(); |
1009 | } | 1013 | } |
1010 | 1014 | ||
1011 | 1015 | ||
1012 | /*! \fn QDate OContact::anniversary() const | 1016 | /*! \fn QDate OContact::anniversary() const |
1013 | Returns the anniversary of the contact. | 1017 | Returns the anniversary of the contact. |
1014 | */ | 1018 | */ |
1015 | QDate OContact::anniversary() const | 1019 | QDate OContact::anniversary() const |
1016 | { | 1020 | { |
1017 | QDate empty; | 1021 | QDate empty; |
1018 | QString str = find( Qtopia::Anniversary ); | 1022 | QString str = find( Qtopia::Anniversary ); |
1019 | qWarning ("Anniversary %s", str.latin1() ); | 1023 | qWarning ("Anniversary %s", str.latin1() ); |
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index efa2777..6aec62e 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp | |||
@@ -1,1019 +1,1023 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (C) 2002 by Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file is part of the Qtopia Environment. | 5 | ** This file is part of the Qtopia Environment. |
6 | ** | 6 | ** |
7 | ** This file may be distributed and/or modified under the terms of the | 7 | ** This file may be distributed and/or modified under the terms of the |
8 | ** GNU General Public License version 2 as published by the Free Software | 8 | ** GNU General Public License version 2 as published by the Free Software |
9 | ** Foundation and appearing in the file LICENSE.GPL included in the | 9 | ** Foundation and appearing in the file LICENSE.GPL included in the |
10 | ** packaging of this file. | 10 | ** packaging of this file. |
11 | ** | 11 | ** |
12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 12 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 13 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
14 | ** | 14 | ** |
15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 15 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
16 | ** | 16 | ** |
17 | ** Contact info@trolltech.com if any conditions of this licensing are | 17 | ** Contact info@trolltech.com if any conditions of this licensing are |
18 | ** not clear to you. | 18 | ** not clear to you. |
19 | ** | 19 | ** |
20 | **********************************************************************/ | 20 | **********************************************************************/ |
21 | 21 | ||
22 | #define QTOPIA_INTERNAL_CONTACT_MRE | 22 | #define QTOPIA_INTERNAL_CONTACT_MRE |
23 | 23 | ||
24 | #include "ocontact.h" | 24 | #include "ocontact.h" |
25 | 25 | ||
26 | #include <qpe/stringutil.h> | 26 | #include <qpe/stringutil.h> |
27 | #include <qpe/timeconversion.h> | 27 | #include <qpe/timeconversion.h> |
28 | #include <qpe/timestring.h> | 28 | #include <qpe/timestring.h> |
29 | 29 | ||
30 | #include <qobject.h> | 30 | #include <qobject.h> |
31 | #include <qregexp.h> | 31 | #include <qregexp.h> |
32 | #include <qstylesheet.h> | 32 | #include <qstylesheet.h> |
33 | #include <qfileinfo.h> | 33 | #include <qfileinfo.h> |
34 | #include <qmap.h> | 34 | #include <qmap.h> |
35 | 35 | ||
36 | #include <stdio.h> | 36 | #include <stdio.h> |
37 | 37 | ||
38 | /*! | 38 | /*! |
39 | \class Contact contact.h | 39 | \class Contact contact.h |
40 | \brief The Contact class holds the data of an address book entry. | 40 | \brief The Contact class holds the data of an address book entry. |
41 | 41 | ||
42 | This data includes information the name of the person, contact | 42 | This data includes information the name of the person, contact |
43 | information, and business information such as deparment and job title. | 43 | information, and business information such as deparment and job title. |
44 | 44 | ||
45 | \ingroup qtopiaemb | 45 | \ingroup qtopiaemb |
46 | \ingroup qtopiadesktop | 46 | \ingroup qtopiadesktop |
47 | */ | 47 | */ |
48 | 48 | ||
49 | 49 | ||
50 | /*! | 50 | /*! |
51 | Creates a new, empty contact. | 51 | Creates a new, empty contact. |
52 | */ | 52 | */ |
53 | OContact::OContact() | 53 | OContact::OContact() |
54 | : OPimRecord(), mMap(), d( 0 ) | 54 | : OPimRecord(), mMap(), d( 0 ) |
55 | { | 55 | { |
56 | } | 56 | } |
57 | 57 | ||
58 | /*! | 58 | /*! |
59 | \internal | 59 | \internal |
60 | Creates a new contact. The properties of the contact are | 60 | Creates a new contact. The properties of the contact are |
61 | set from \a fromMap. | 61 | set from \a fromMap. |
62 | */ | 62 | */ |
63 | OContact::OContact( const QMap<int, QString> &fromMap ) : | 63 | OContact::OContact( const QMap<int, QString> &fromMap ) : |
64 | OPimRecord(), mMap( fromMap ), d( 0 ) | 64 | OPimRecord(), mMap( fromMap ), d( 0 ) |
65 | { | 65 | { |
66 | QString cats = mMap[ Qtopia::AddressCategory ]; | 66 | QString cats = mMap[ Qtopia::AddressCategory ]; |
67 | if ( !cats.isEmpty() ) | 67 | if ( !cats.isEmpty() ) |
68 | setCategories( idsFromString( cats ) ); | 68 | setCategories( idsFromString( cats ) ); |
69 | 69 | ||
70 | QString uidStr = find( Qtopia::AddressUid ); | 70 | QString uidStr = find( Qtopia::AddressUid ); |
71 | 71 | ||
72 | if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ | 72 | if ( uidStr.isEmpty() || (uidStr.toInt() == 0) ){ |
73 | qWarning( "Invalid UID found. Generate new one.." ); | 73 | qWarning( "Invalid UID found. Generate new one.." ); |
74 | setUid( uidGen().generate() ); | 74 | setUid( uidGen().generate() ); |
75 | }else | 75 | }else |
76 | setUid( uidStr.toInt() ); | 76 | setUid( uidStr.toInt() ); |
77 | 77 | ||
78 | // if ( !uidStr.isEmpty() ) | 78 | // if ( !uidStr.isEmpty() ) |
79 | // setUid( uidStr.toInt() ); | 79 | // setUid( uidStr.toInt() ); |
80 | } | 80 | } |
81 | 81 | ||
82 | /*! | 82 | /*! |
83 | Destroys a contact. | 83 | Destroys a contact. |
84 | */ | 84 | */ |
85 | OContact::~OContact() | 85 | OContact::~OContact() |
86 | { | 86 | { |
87 | } | 87 | } |
88 | 88 | ||
89 | /*! \fn void OContact::setTitle( const QString &str ) | 89 | /*! \fn void OContact::setTitle( const QString &str ) |
90 | Sets the title of the contact to \a str. | 90 | Sets the title of the contact to \a str. |
91 | */ | 91 | */ |
92 | 92 | ||
93 | /*! \fn void OContact::setFirstName( const QString &str ) | 93 | /*! \fn void OContact::setFirstName( const QString &str ) |
94 | Sets the first name of the contact to \a str. | 94 | Sets the first name of the contact to \a str. |
95 | */ | 95 | */ |
96 | 96 | ||
97 | /*! \fn void OContact::setMiddleName( const QString &str ) | 97 | /*! \fn void OContact::setMiddleName( const QString &str ) |
98 | Sets the middle name of the contact to \a str. | 98 | Sets the middle name of the contact to \a str. |
99 | */ | 99 | */ |
100 | 100 | ||
101 | /*! \fn void OContact::setLastName( const QString &str ) | 101 | /*! \fn void OContact::setLastName( const QString &str ) |
102 | Sets the last name of the contact to \a str. | 102 | Sets the last name of the contact to \a str. |
103 | */ | 103 | */ |
104 | 104 | ||
105 | /*! \fn void OContact::setSuffix( const QString &str ) | 105 | /*! \fn void OContact::setSuffix( const QString &str ) |
106 | Sets the suffix of the contact to \a str. | 106 | Sets the suffix of the contact to \a str. |
107 | */ | 107 | */ |
108 | 108 | ||
109 | /*! \fn void OContact::setFileAs( const QString &str ) | 109 | /*! \fn void OContact::setFileAs( const QString &str ) |
110 | Sets the contact to filed as \a str. | 110 | Sets the contact to filed as \a str. |
111 | */ | 111 | */ |
112 | 112 | ||
113 | /*! \fn void OContact::setDefaultEmail( const QString &str ) | 113 | /*! \fn void OContact::setDefaultEmail( const QString &str ) |
114 | Sets the default email of the contact to \a str. | 114 | Sets the default email of the contact to \a str. |
115 | */ | 115 | */ |
116 | 116 | ||
117 | /*! \fn void OContact::setHomeStreet( const QString &str ) | 117 | /*! \fn void OContact::setHomeStreet( const QString &str ) |
118 | Sets the home street address of the contact to \a str. | 118 | Sets the home street address of the contact to \a str. |
119 | */ | 119 | */ |
120 | 120 | ||
121 | /*! \fn void OContact::setHomeCity( const QString &str ) | 121 | /*! \fn void OContact::setHomeCity( const QString &str ) |
122 | Sets the home city of the contact to \a str. | 122 | Sets the home city of the contact to \a str. |
123 | */ | 123 | */ |
124 | 124 | ||
125 | /*! \fn void OContact::setHomeState( const QString &str ) | 125 | /*! \fn void OContact::setHomeState( const QString &str ) |
126 | Sets the home state of the contact to \a str. | 126 | Sets the home state of the contact to \a str. |
127 | */ | 127 | */ |
128 | 128 | ||
129 | /*! \fn void OContact::setHomeZip( const QString &str ) | 129 | /*! \fn void OContact::setHomeZip( const QString &str ) |
130 | Sets the home zip code of the contact to \a str. | 130 | Sets the home zip code of the contact to \a str. |
131 | */ | 131 | */ |
132 | 132 | ||
133 | /*! \fn void OContact::setHomeCountry( const QString &str ) | 133 | /*! \fn void OContact::setHomeCountry( const QString &str ) |
134 | Sets the home country of the contact to \a str. | 134 | Sets the home country of the contact to \a str. |
135 | */ | 135 | */ |
136 | 136 | ||
137 | /*! \fn void OContact::setHomePhone( const QString &str ) | 137 | /*! \fn void OContact::setHomePhone( const QString &str ) |
138 | Sets the home phone number of the contact to \a str. | 138 | Sets the home phone number of the contact to \a str. |
139 | */ | 139 | */ |
140 | 140 | ||
141 | /*! \fn void OContact::setHomeFax( const QString &str ) | 141 | /*! \fn void OContact::setHomeFax( const QString &str ) |
142 | Sets the home fax number of the contact to \a str. | 142 | Sets the home fax number of the contact to \a str. |
143 | */ | 143 | */ |
144 | 144 | ||
145 | /*! \fn void OContact::setHomeMobile( const QString &str ) | 145 | /*! \fn void OContact::setHomeMobile( const QString &str ) |
146 | Sets the home mobile phone number of the contact to \a str. | 146 | Sets the home mobile phone number of the contact to \a str. |
147 | */ | 147 | */ |
148 | 148 | ||
149 | /*! \fn void OContact::setHomeWebpage( const QString &str ) | 149 | /*! \fn void OContact::setHomeWebpage( const QString &str ) |
150 | Sets the home webpage of the contact to \a str. | 150 | Sets the home webpage of the contact to \a str. |
151 | */ | 151 | */ |
152 | 152 | ||
153 | /*! \fn void OContact::setCompany( const QString &str ) | 153 | /*! \fn void OContact::setCompany( const QString &str ) |
154 | Sets the company for contact to \a str. | 154 | Sets the company for contact to \a str. |
155 | */ | 155 | */ |
156 | 156 | ||
157 | /*! \fn void OContact::setJobTitle( const QString &str ) | 157 | /*! \fn void OContact::setJobTitle( const QString &str ) |
158 | Sets the job title of the contact to \a str. | 158 | Sets the job title of the contact to \a str. |
159 | */ | 159 | */ |
160 | 160 | ||
161 | /*! \fn void OContact::setDepartment( const QString &str ) | 161 | /*! \fn void OContact::setDepartment( const QString &str ) |
162 | Sets the department for contact to \a str. | 162 | Sets the department for contact to \a str. |
163 | */ | 163 | */ |
164 | 164 | ||
165 | /*! \fn void OContact::setOffice( const QString &str ) | 165 | /*! \fn void OContact::setOffice( const QString &str ) |
166 | Sets the office for contact to \a str. | 166 | Sets the office for contact to \a str. |
167 | */ | 167 | */ |
168 | 168 | ||
169 | /*! \fn void OContact::setBusinessStreet( const QString &str ) | 169 | /*! \fn void OContact::setBusinessStreet( const QString &str ) |
170 | Sets the business street address of the contact to \a str. | 170 | Sets the business street address of the contact to \a str. |
171 | */ | 171 | */ |
172 | 172 | ||
173 | /*! \fn void OContact::setBusinessCity( const QString &str ) | 173 | /*! \fn void OContact::setBusinessCity( const QString &str ) |
174 | Sets the business city of the contact to \a str. | 174 | Sets the business city of the contact to \a str. |
175 | */ | 175 | */ |
176 | 176 | ||
177 | /*! \fn void OContact::setBusinessState( const QString &str ) | 177 | /*! \fn void OContact::setBusinessState( const QString &str ) |
178 | Sets the business state of the contact to \a str. | 178 | Sets the business state of the contact to \a str. |
179 | */ | 179 | */ |
180 | 180 | ||
181 | /*! \fn void OContact::setBusinessZip( const QString &str ) | 181 | /*! \fn void OContact::setBusinessZip( const QString &str ) |
182 | Sets the business zip code of the contact to \a str. | 182 | Sets the business zip code of the contact to \a str. |
183 | */ | 183 | */ |
184 | 184 | ||
185 | /*! \fn void OContact::setBusinessCountry( const QString &str ) | 185 | /*! \fn void OContact::setBusinessCountry( const QString &str ) |
186 | Sets the business country of the contact to \a str. | 186 | Sets the business country of the contact to \a str. |
187 | */ | 187 | */ |
188 | 188 | ||
189 | /*! \fn void OContact::setBusinessPhone( const QString &str ) | 189 | /*! \fn void OContact::setBusinessPhone( const QString &str ) |
190 | Sets the business phone number of the contact to \a str. | 190 | Sets the business phone number of the contact to \a str. |
191 | */ | 191 | */ |
192 | 192 | ||
193 | /*! \fn void OContact::setBusinessFax( const QString &str ) | 193 | /*! \fn void OContact::setBusinessFax( const QString &str ) |
194 | Sets the business fax number of the contact to \a str. | 194 | Sets the business fax number of the contact to \a str. |
195 | */ | 195 | */ |
196 | 196 | ||
197 | /*! \fn void OContact::setBusinessMobile( const QString &str ) | 197 | /*! \fn void OContact::setBusinessMobile( const QString &str ) |
198 | Sets the business mobile phone number of the contact to \a str. | 198 | Sets the business mobile phone number of the contact to \a str. |
199 | */ | 199 | */ |
200 | 200 | ||
201 | /*! \fn void OContact::setBusinessPager( const QString &str ) | 201 | /*! \fn void OContact::setBusinessPager( const QString &str ) |
202 | Sets the business pager number of the contact to \a str. | 202 | Sets the business pager number of the contact to \a str. |
203 | */ | 203 | */ |
204 | 204 | ||
205 | /*! \fn void OContact::setBusinessWebpage( const QString &str ) | 205 | /*! \fn void OContact::setBusinessWebpage( const QString &str ) |
206 | Sets the business webpage of the contact to \a str. | 206 | Sets the business webpage of the contact to \a str. |
207 | */ | 207 | */ |
208 | 208 | ||
209 | /*! \fn void OContact::setProfession( const QString &str ) | 209 | /*! \fn void OContact::setProfession( const QString &str ) |
210 | Sets the profession of the contact to \a str. | 210 | Sets the profession of the contact to \a str. |
211 | */ | 211 | */ |
212 | 212 | ||
213 | /*! \fn void OContact::setAssistant( const QString &str ) | 213 | /*! \fn void OContact::setAssistant( const QString &str ) |
214 | Sets the assistant of the contact to \a str. | 214 | Sets the assistant of the contact to \a str. |
215 | */ | 215 | */ |
216 | 216 | ||
217 | /*! \fn void OContact::setManager( const QString &str ) | 217 | /*! \fn void OContact::setManager( const QString &str ) |
218 | Sets the manager of the contact to \a str. | 218 | Sets the manager of the contact to \a str. |
219 | */ | 219 | */ |
220 | 220 | ||
221 | /*! \fn void OContact::setSpouse( const QString &str ) | 221 | /*! \fn void OContact::setSpouse( const QString &str ) |
222 | Sets the spouse of the contact to \a str. | 222 | Sets the spouse of the contact to \a str. |
223 | */ | 223 | */ |
224 | 224 | ||
225 | /*! \fn void OContact::setGender( const QString &str ) | 225 | /*! \fn void OContact::setGender( const QString &str ) |
226 | Sets the gender of the contact to \a str. | 226 | Sets the gender of the contact to \a str. |
227 | */ | 227 | */ |
228 | 228 | ||
229 | /*! \fn void OContact::setNickname( const QString &str ) | 229 | /*! \fn void OContact::setNickname( const QString &str ) |
230 | Sets the nickname of the contact to \a str. | 230 | Sets the nickname of the contact to \a str. |
231 | */ | 231 | */ |
232 | 232 | ||
233 | /*! \fn void OContact::setNotes( const QString &str ) | 233 | /*! \fn void OContact::setNotes( const QString &str ) |
234 | Sets the notes about the contact to \a str. | 234 | Sets the notes about the contact to \a str. |
235 | */ | 235 | */ |
236 | 236 | ||
237 | /*! \fn QString OContact::title() const | 237 | /*! \fn QString OContact::title() const |
238 | Returns the title of the contact. | 238 | Returns the title of the contact. |
239 | */ | 239 | */ |
240 | 240 | ||
241 | /*! \fn QString OContact::firstName() const | 241 | /*! \fn QString OContact::firstName() const |
242 | Returns the first name of the contact. | 242 | Returns the first name of the contact. |
243 | */ | 243 | */ |
244 | 244 | ||
245 | /*! \fn QString OContact::middleName() const | 245 | /*! \fn QString OContact::middleName() const |
246 | Returns the middle name of the contact. | 246 | Returns the middle name of the contact. |
247 | */ | 247 | */ |
248 | 248 | ||
249 | /*! \fn QString OContact::lastName() const | 249 | /*! \fn QString OContact::lastName() const |
250 | Returns the last name of the contact. | 250 | Returns the last name of the contact. |
251 | */ | 251 | */ |
252 | 252 | ||
253 | /*! \fn QString OContact::suffix() const | 253 | /*! \fn QString OContact::suffix() const |
254 | Returns the suffix of the contact. | 254 | Returns the suffix of the contact. |
255 | */ | 255 | */ |
256 | 256 | ||
257 | /*! \fn QString OContact::fileAs() const | 257 | /*! \fn QString OContact::fileAs() const |
258 | Returns the string the contact is filed as. | 258 | Returns the string the contact is filed as. |
259 | */ | 259 | */ |
260 | 260 | ||
261 | /*! \fn QString OContact::defaultEmail() const | 261 | /*! \fn QString OContact::defaultEmail() const |
262 | Returns the default email address of the contact. | 262 | Returns the default email address of the contact. |
263 | */ | 263 | */ |
264 | 264 | ||
265 | /*! \fn QString OContact::emails() const | 265 | /*! \fn QString OContact::emails() const |
266 | Returns the list of email address for a contact separated by ';'s in a single | 266 | Returns the list of email address for a contact separated by ';'s in a single |
267 | string. | 267 | string. |
268 | */ | 268 | */ |
269 | 269 | ||
270 | /*! \fn QString OContact::homeStreet() const | 270 | /*! \fn QString OContact::homeStreet() const |
271 | Returns the home street address of the contact. | 271 | Returns the home street address of the contact. |
272 | */ | 272 | */ |
273 | 273 | ||
274 | /*! \fn QString OContact::homeCity() const | 274 | /*! \fn QString OContact::homeCity() const |
275 | Returns the home city of the contact. | 275 | Returns the home city of the contact. |
276 | */ | 276 | */ |
277 | 277 | ||
278 | /*! \fn QString OContact::homeState() const | 278 | /*! \fn QString OContact::homeState() const |
279 | Returns the home state of the contact. | 279 | Returns the home state of the contact. |
280 | */ | 280 | */ |
281 | 281 | ||
282 | /*! \fn QString OContact::homeZip() const | 282 | /*! \fn QString OContact::homeZip() const |
283 | Returns the home zip of the contact. | 283 | Returns the home zip of the contact. |
284 | */ | 284 | */ |
285 | 285 | ||
286 | /*! \fn QString OContact::homeCountry() const | 286 | /*! \fn QString OContact::homeCountry() const |
287 | Returns the home country of the contact. | 287 | Returns the home country of the contact. |
288 | */ | 288 | */ |
289 | 289 | ||
290 | /*! \fn QString OContact::homePhone() const | 290 | /*! \fn QString OContact::homePhone() const |
291 | Returns the home phone number of the contact. | 291 | Returns the home phone number of the contact. |
292 | */ | 292 | */ |
293 | 293 | ||
294 | /*! \fn QString OContact::homeFax() const | 294 | /*! \fn QString OContact::homeFax() const |
295 | Returns the home fax number of the contact. | 295 | Returns the home fax number of the contact. |
296 | */ | 296 | */ |
297 | 297 | ||
298 | /*! \fn QString OContact::homeMobile() const | 298 | /*! \fn QString OContact::homeMobile() const |
299 | Returns the home mobile number of the contact. | 299 | Returns the home mobile number of the contact. |
300 | */ | 300 | */ |
301 | 301 | ||
302 | /*! \fn QString OContact::homeWebpage() const | 302 | /*! \fn QString OContact::homeWebpage() const |
303 | Returns the home webpage of the contact. | 303 | Returns the home webpage of the contact. |
304 | */ | 304 | */ |
305 | 305 | ||
306 | /*! \fn QString OContact::company() const | 306 | /*! \fn QString OContact::company() const |
307 | Returns the company for the contact. | 307 | Returns the company for the contact. |
308 | */ | 308 | */ |
309 | 309 | ||
310 | /*! \fn QString OContact::department() const | 310 | /*! \fn QString OContact::department() const |
311 | Returns the department for the contact. | 311 | Returns the department for the contact. |
312 | */ | 312 | */ |
313 | 313 | ||
314 | /*! \fn QString OContact::office() const | 314 | /*! \fn QString OContact::office() const |
315 | Returns the office for the contact. | 315 | Returns the office for the contact. |
316 | */ | 316 | */ |
317 | 317 | ||
318 | /*! \fn QString OContact::jobTitle() const | 318 | /*! \fn QString OContact::jobTitle() const |
319 | Returns the job title of the contact. | 319 | Returns the job title of the contact. |
320 | */ | 320 | */ |
321 | 321 | ||
322 | /*! \fn QString OContact::profession() const | 322 | /*! \fn QString OContact::profession() const |
323 | Returns the profession of the contact. | 323 | Returns the profession of the contact. |
324 | */ | 324 | */ |
325 | 325 | ||
326 | /*! \fn QString OContact::assistant() const | 326 | /*! \fn QString OContact::assistant() const |
327 | Returns the assistant of the contact. | 327 | Returns the assistant of the contact. |
328 | */ | 328 | */ |
329 | 329 | ||
330 | /*! \fn QString OContact::manager() const | 330 | /*! \fn QString OContact::manager() const |
331 | Returns the manager of the contact. | 331 | Returns the manager of the contact. |
332 | */ | 332 | */ |
333 | 333 | ||
334 | /*! \fn QString OContact::businessStreet() const | 334 | /*! \fn QString OContact::businessStreet() const |
335 | Returns the business street address of the contact. | 335 | Returns the business street address of the contact. |
336 | */ | 336 | */ |
337 | 337 | ||
338 | /*! \fn QString OContact::businessCity() const | 338 | /*! \fn QString OContact::businessCity() const |
339 | Returns the business city of the contact. | 339 | Returns the business city of the contact. |
340 | */ | 340 | */ |
341 | 341 | ||
342 | /*! \fn QString OContact::businessState() const | 342 | /*! \fn QString OContact::businessState() const |
343 | Returns the business state of the contact. | 343 | Returns the business state of the contact. |
344 | */ | 344 | */ |
345 | 345 | ||
346 | /*! \fn QString OContact::businessZip() const | 346 | /*! \fn QString OContact::businessZip() const |
347 | Returns the business zip of the contact. | 347 | Returns the business zip of the contact. |
348 | */ | 348 | */ |
349 | 349 | ||
350 | /*! \fn QString OContact::businessCountry() const | 350 | /*! \fn QString OContact::businessCountry() const |
351 | Returns the business country of the contact. | 351 | Returns the business country of the contact. |
352 | */ | 352 | */ |
353 | 353 | ||
354 | /*! \fn QString OContact::businessPhone() const | 354 | /*! \fn QString OContact::businessPhone() const |
355 | Returns the business phone number of the contact. | 355 | Returns the business phone number of the contact. |
356 | */ | 356 | */ |
357 | 357 | ||
358 | /*! \fn QString OContact::businessFax() const | 358 | /*! \fn QString OContact::businessFax() const |
359 | Returns the business fax number of the contact. | 359 | Returns the business fax number of the contact. |
360 | */ | 360 | */ |
361 | 361 | ||
362 | /*! \fn QString OContact::businessMobile() const | 362 | /*! \fn QString OContact::businessMobile() const |
363 | Returns the business mobile number of the contact. | 363 | Returns the business mobile number of the contact. |
364 | */ | 364 | */ |
365 | 365 | ||
366 | /*! \fn QString OContact::businessPager() const | 366 | /*! \fn QString OContact::businessPager() const |
367 | Returns the business pager number of the contact. | 367 | Returns the business pager number of the contact. |
368 | */ | 368 | */ |
369 | 369 | ||
370 | /*! \fn QString OContact::businessWebpage() const | 370 | /*! \fn QString OContact::businessWebpage() const |
371 | Returns the business webpage of the contact. | 371 | Returns the business webpage of the contact. |
372 | */ | 372 | */ |
373 | 373 | ||
374 | /*! \fn QString OContact::spouse() const | 374 | /*! \fn QString OContact::spouse() const |
375 | Returns the spouse of the contact. | 375 | Returns the spouse of the contact. |
376 | */ | 376 | */ |
377 | 377 | ||
378 | /*! \fn QString OContact::gender() const | 378 | /*! \fn QString OContact::gender() const |
379 | Returns the gender of the contact. | 379 | Returns the gender of the contact. |
380 | */ | 380 | */ |
381 | 381 | ||
382 | /*! \fn QString OContact::nickname() const | 382 | /*! \fn QString OContact::nickname() const |
383 | Returns the nickname of the contact. | 383 | Returns the nickname of the contact. |
384 | */ | 384 | */ |
385 | 385 | ||
386 | /*! \fn QString OContact::children() const | 386 | /*! \fn QString OContact::children() const |
387 | Returns the children of the contact. | 387 | Returns the children of the contact. |
388 | */ | 388 | */ |
389 | 389 | ||
390 | /*! \fn QString OContact::notes() const | 390 | /*! \fn QString OContact::notes() const |
391 | Returns the notes relating to the the contact. | 391 | Returns the notes relating to the the contact. |
392 | */ | 392 | */ |
393 | 393 | ||
394 | /*! \fn QString OContact::groups() const | 394 | /*! \fn QString OContact::groups() const |
395 | \internal | 395 | \internal |
396 | Returns the groups for the contact. | 396 | Returns the groups for the contact. |
397 | */ | 397 | */ |
398 | 398 | ||
399 | /*! \fn QStringList OContact::groupList() const | 399 | /*! \fn QStringList OContact::groupList() const |
400 | \internal | 400 | \internal |
401 | */ | 401 | */ |
402 | 402 | ||
403 | /*! \fn QString OContact::field(int) const | 403 | /*! \fn QString OContact::field(int) const |
404 | \internal | 404 | \internal |
405 | */ | 405 | */ |
406 | 406 | ||
407 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) | 407 | /*! \fn void OContact::saveJournal( journal_action, const QString & = QString::null ) |
408 | \internal | 408 | \internal |
409 | */ | 409 | */ |
410 | 410 | ||
411 | /*! \fn void OContact::setUid( int id ) | 411 | /*! \fn void OContact::setUid( int id ) |
412 | \internal | 412 | \internal |
413 | Sets the uid for this record to \a id. | 413 | Sets the uid for this record to \a id. |
414 | */ | 414 | */ |
415 | 415 | ||
416 | /*! \enum OContact::journal_action | 416 | /*! \enum OContact::journal_action |
417 | \internal | 417 | \internal |
418 | */ | 418 | */ |
419 | 419 | ||
420 | /*! | 420 | /*! |
421 | \internal | 421 | \internal |
422 | */ | 422 | */ |
423 | QMap<int, QString> OContact::toMap() const | 423 | QMap<int, QString> OContact::toMap() const |
424 | { | 424 | { |
425 | QMap<int, QString> map = mMap; | 425 | QMap<int, QString> map = mMap; |
426 | QString cats = idsToString( categories() ); | 426 | QString cats = idsToString( categories() ); |
427 | if ( !cats.isEmpty() ) | 427 | if ( !cats.isEmpty() ) |
428 | map.insert( Qtopia::AddressCategory, cats ); | 428 | map.insert( Qtopia::AddressCategory, cats ); |
429 | return map; | 429 | return map; |
430 | } | 430 | } |
431 | 431 | ||
432 | /*! | 432 | /*! |
433 | Returns a rich text formatted QString representing the contents the contact. | 433 | Returns a rich text formatted QString representing the contents the contact. |
434 | */ | 434 | */ |
435 | QString OContact::toRichText() const | 435 | QString OContact::toRichText() const |
436 | { | 436 | { |
437 | QString text; | 437 | QString text; |
438 | QString value, comp, state; | 438 | QString value, comp, state; |
439 | 439 | ||
440 | // name, jobtitle and company | 440 | // name, jobtitle and company |
441 | if ( !(value = fullName()).isEmpty() ) | 441 | if ( !(value = fullName()).isEmpty() ) |
442 | text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; | 442 | text += "<b>" + Qtopia::escapeString(value) + "</b><br>"; |
443 | if ( !(value = jobTitle()).isEmpty() ) | 443 | if ( !(value = jobTitle()).isEmpty() ) |
444 | text += Qtopia::escapeString(value) + "<br>"; | 444 | text += Qtopia::escapeString(value) + "<br>"; |
445 | 445 | ||
446 | comp = company(); | 446 | comp = company(); |
447 | if ( !(value = department()).isEmpty() ) { | 447 | if ( !(value = department()).isEmpty() ) { |
448 | text += Qtopia::escapeString(value); | 448 | text += Qtopia::escapeString(value); |
449 | if ( comp ) | 449 | if ( comp ) |
450 | text += ", "; | 450 | text += ", "; |
451 | else | 451 | else |
452 | text += "<br>"; | 452 | text += "<br>"; |
453 | } | 453 | } |
454 | if ( !comp.isEmpty() ) | 454 | if ( !comp.isEmpty() ) |
455 | text += Qtopia::escapeString(comp) + "<br>"; | 455 | text += Qtopia::escapeString(comp) + "<br>"; |
456 | 456 | ||
457 | // business address | 457 | // business address |
458 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 458 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
459 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 459 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
460 | text += "<br>"; | 460 | text += "<br>"; |
461 | text += QObject::tr( "<b>Work Address:</b>" ); | 461 | text += QObject::tr( "<b>Work Address:</b>" ); |
462 | text += "<br>"; | 462 | text += "<br>"; |
463 | } | 463 | } |
464 | 464 | ||
465 | if ( !(value = businessStreet()).isEmpty() ) | 465 | if ( !(value = businessStreet()).isEmpty() ) |
466 | text += Qtopia::escapeString(value) + "<br>"; | 466 | text += Qtopia::escapeString(value) + "<br>"; |
467 | state = businessState(); | 467 | state = businessState(); |
468 | if ( !(value = businessCity()).isEmpty() ) { | 468 | if ( !(value = businessCity()).isEmpty() ) { |
469 | text += Qtopia::escapeString(value); | 469 | text += Qtopia::escapeString(value); |
470 | if ( state ) | 470 | if ( state ) |
471 | text += ", " + Qtopia::escapeString(state); | 471 | text += ", " + Qtopia::escapeString(state); |
472 | text += "<br>"; | 472 | text += "<br>"; |
473 | } else if ( !state.isEmpty() ) | 473 | } else if ( !state.isEmpty() ) |
474 | text += Qtopia::escapeString(state) + "<br>"; | 474 | text += Qtopia::escapeString(state) + "<br>"; |
475 | if ( !(value = businessZip()).isEmpty() ) | 475 | if ( !(value = businessZip()).isEmpty() ) |
476 | text += Qtopia::escapeString(value) + "<br>"; | 476 | text += Qtopia::escapeString(value) + "<br>"; |
477 | if ( !(value = businessCountry()).isEmpty() ) | 477 | if ( !(value = businessCountry()).isEmpty() ) |
478 | text += Qtopia::escapeString(value) + "<br>"; | 478 | text += Qtopia::escapeString(value) + "<br>"; |
479 | 479 | ||
480 | // home address | 480 | // home address |
481 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 481 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
482 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 482 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
483 | text += "<br>"; | 483 | text += "<br>"; |
484 | text += QObject::tr( "<b>Home Address:</b>" ); | 484 | text += QObject::tr( "<b>Home Address:</b>" ); |
485 | text += "<br>"; | 485 | text += "<br>"; |
486 | } | 486 | } |
487 | 487 | ||
488 | if ( !(value = homeStreet()).isEmpty() ) | 488 | if ( !(value = homeStreet()).isEmpty() ) |
489 | text += Qtopia::escapeString(value) + "<br>"; | 489 | text += Qtopia::escapeString(value) + "<br>"; |
490 | state = homeState(); | 490 | state = homeState(); |
491 | if ( !(value = homeCity()).isEmpty() ) { | 491 | if ( !(value = homeCity()).isEmpty() ) { |
492 | text += Qtopia::escapeString(value); | 492 | text += Qtopia::escapeString(value); |
493 | if ( !state.isEmpty() ) | 493 | if ( !state.isEmpty() ) |
494 | text += ", " + Qtopia::escapeString(state); | 494 | text += ", " + Qtopia::escapeString(state); |
495 | text += "<br>"; | 495 | text += "<br>"; |
496 | } else if (!state.isEmpty()) | 496 | } else if (!state.isEmpty()) |
497 | text += Qtopia::escapeString(state) + "<br>"; | 497 | text += Qtopia::escapeString(state) + "<br>"; |
498 | if ( !(value = homeZip()).isEmpty() ) | 498 | if ( !(value = homeZip()).isEmpty() ) |
499 | text += Qtopia::escapeString(value) + "<br>"; | 499 | text += Qtopia::escapeString(value) + "<br>"; |
500 | if ( !(value = homeCountry()).isEmpty() ) | 500 | if ( !(value = homeCountry()).isEmpty() ) |
501 | text += Qtopia::escapeString(value) + "<br>"; | 501 | text += Qtopia::escapeString(value) + "<br>"; |
502 | 502 | ||
503 | // the others... | 503 | // the others... |
504 | QString str; | 504 | QString str; |
505 | QString defEmail = defaultEmail(); | ||
506 | if ( !defEmail.isEmpty() ) | ||
507 | text += "<b>" + QObject::tr("Default Email: ") + "</b>" | ||
508 | + Qtopia::escapeString(defEmail) + "<br>"; | ||
505 | str = emails(); | 509 | str = emails(); |
506 | if ( !str.isEmpty() ) | 510 | if ( !str.isEmpty() && ( str != defEmail ) ) |
507 | text += "<b>" + QObject::tr("Email Addresses: ") + "</b>" | 511 | text += "<b>" + QObject::tr("All Emails: ") + "</b>" |
508 | + Qtopia::escapeString(str) + "<br>"; | 512 | + Qtopia::escapeString(str) + "<br>"; |
509 | str = homePhone(); | 513 | str = homePhone(); |
510 | if ( !str.isEmpty() ) | 514 | if ( !str.isEmpty() ) |
511 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" | 515 | text += "<b>" + QObject::tr("Home Phone: ") + "</b>" |
512 | + Qtopia::escapeString(str) + "<br>"; | 516 | + Qtopia::escapeString(str) + "<br>"; |
513 | str = homeFax(); | 517 | str = homeFax(); |
514 | if ( !str.isEmpty() ) | 518 | if ( !str.isEmpty() ) |
515 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" | 519 | text += "<b>" + QObject::tr("Home Fax: ") + "</b>" |
516 | + Qtopia::escapeString(str) + "<br>"; | 520 | + Qtopia::escapeString(str) + "<br>"; |
517 | str = homeMobile(); | 521 | str = homeMobile(); |
518 | if ( !str.isEmpty() ) | 522 | if ( !str.isEmpty() ) |
519 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" | 523 | text += "<b>" + QObject::tr("Home Mobile: ") + "</b>" |
520 | + Qtopia::escapeString(str) + "<br>"; | 524 | + Qtopia::escapeString(str) + "<br>"; |
521 | str = homeWebpage(); | 525 | str = homeWebpage(); |
522 | if ( !str.isEmpty() ) | 526 | if ( !str.isEmpty() ) |
523 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" | 527 | text += "<b>" + QObject::tr("Home Web Page: ") + "</b>" |
524 | + Qtopia::escapeString(str) + "<br>"; | 528 | + Qtopia::escapeString(str) + "<br>"; |
525 | str = businessWebpage(); | 529 | str = businessWebpage(); |
526 | if ( !str.isEmpty() ) | 530 | if ( !str.isEmpty() ) |
527 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" | 531 | text += "<b>" + QObject::tr("Business Web Page: ") + "</b>" |
528 | + Qtopia::escapeString(str) + "<br>"; | 532 | + Qtopia::escapeString(str) + "<br>"; |
529 | str = office(); | 533 | str = office(); |
530 | if ( !str.isEmpty() ) | 534 | if ( !str.isEmpty() ) |
531 | text += "<b>" + QObject::tr("Office: ") + "</b>" | 535 | text += "<b>" + QObject::tr("Office: ") + "</b>" |
532 | + Qtopia::escapeString(str) + "<br>"; | 536 | + Qtopia::escapeString(str) + "<br>"; |
533 | str = businessPhone(); | 537 | str = businessPhone(); |
534 | if ( !str.isEmpty() ) | 538 | if ( !str.isEmpty() ) |
535 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" | 539 | text += "<b>" + QObject::tr("Business Phone: ") + "</b>" |
536 | + Qtopia::escapeString(str) + "<br>"; | 540 | + Qtopia::escapeString(str) + "<br>"; |
537 | str = businessFax(); | 541 | str = businessFax(); |
538 | if ( !str.isEmpty() ) | 542 | if ( !str.isEmpty() ) |
539 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" | 543 | text += "<b>" + QObject::tr("Business Fax: ") + "</b>" |
540 | + Qtopia::escapeString(str) + "<br>"; | 544 | + Qtopia::escapeString(str) + "<br>"; |
541 | str = businessMobile(); | 545 | str = businessMobile(); |
542 | if ( !str.isEmpty() ) | 546 | if ( !str.isEmpty() ) |
543 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" | 547 | text += "<b>" + QObject::tr("Business Mobile: ") + "</b>" |
544 | + Qtopia::escapeString(str) + "<br>"; | 548 | + Qtopia::escapeString(str) + "<br>"; |
545 | str = businessPager(); | 549 | str = businessPager(); |
546 | if ( !str.isEmpty() ) | 550 | if ( !str.isEmpty() ) |
547 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" | 551 | text += "<b>" + QObject::tr("Business Pager: ") + "</b>" |
548 | + Qtopia::escapeString(str) + "<br>"; | 552 | + Qtopia::escapeString(str) + "<br>"; |
549 | str = profession(); | 553 | str = profession(); |
550 | if ( !str.isEmpty() ) | 554 | if ( !str.isEmpty() ) |
551 | text += "<b>" + QObject::tr("Profession: ") + "</b>" | 555 | text += "<b>" + QObject::tr("Profession: ") + "</b>" |
552 | + Qtopia::escapeString(str) + "<br>"; | 556 | + Qtopia::escapeString(str) + "<br>"; |
553 | str = assistant(); | 557 | str = assistant(); |
554 | if ( !str.isEmpty() ) | 558 | if ( !str.isEmpty() ) |
555 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" | 559 | text += "<b>" + QObject::tr("Assistant: ") + "</b>" |
556 | + Qtopia::escapeString(str) + "<br>"; | 560 | + Qtopia::escapeString(str) + "<br>"; |
557 | str = manager(); | 561 | str = manager(); |
558 | if ( !str.isEmpty() ) | 562 | if ( !str.isEmpty() ) |
559 | text += "<b>" + QObject::tr("Manager: ") + "</b>" | 563 | text += "<b>" + QObject::tr("Manager: ") + "</b>" |
560 | + Qtopia::escapeString(str) + "<br>"; | 564 | + Qtopia::escapeString(str) + "<br>"; |
561 | str = gender(); | 565 | str = gender(); |
562 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 566 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
563 | if ( str.toInt() == 1 ) | 567 | if ( str.toInt() == 1 ) |
564 | str = QObject::tr( "Male" ); | 568 | str = QObject::tr( "Male" ); |
565 | else if ( str.toInt() == 2 ) | 569 | else if ( str.toInt() == 2 ) |
566 | str = QObject::tr( "Female" ); | 570 | str = QObject::tr( "Female" ); |
567 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; | 571 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str + "<br>"; |
568 | } | 572 | } |
569 | str = spouse(); | 573 | str = spouse(); |
570 | if ( !str.isEmpty() ) | 574 | if ( !str.isEmpty() ) |
571 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" | 575 | text += "<b>" + QObject::tr("Spouse: ") + "</b>" |
572 | + Qtopia::escapeString(str) + "<br>"; | 576 | + Qtopia::escapeString(str) + "<br>"; |
573 | if ( birthday().isValid() ){ | 577 | if ( birthday().isValid() ){ |
574 | str = TimeString::numberDateString( birthday() ); | 578 | str = TimeString::numberDateString( birthday() ); |
575 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" | 579 | text += "<b>" + QObject::tr("Birthday: ") + "</b>" |
576 | + Qtopia::escapeString(str) + "<br>"; | 580 | + Qtopia::escapeString(str) + "<br>"; |
577 | } | 581 | } |
578 | if ( anniversary().isValid() ){ | 582 | if ( anniversary().isValid() ){ |
579 | str = TimeString::numberDateString( anniversary() ); | 583 | str = TimeString::numberDateString( anniversary() ); |
580 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" | 584 | text += "<b>" + QObject::tr("Anniversary: ") + "</b>" |
581 | + Qtopia::escapeString(str) + "<br>"; | 585 | + Qtopia::escapeString(str) + "<br>"; |
582 | } | 586 | } |
583 | str = nickname(); | 587 | str = nickname(); |
584 | if ( !str.isEmpty() ) | 588 | if ( !str.isEmpty() ) |
585 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" | 589 | text += "<b>" + QObject::tr("Nickname: ") + "</b>" |
586 | + Qtopia::escapeString(str) + "<br>"; | 590 | + Qtopia::escapeString(str) + "<br>"; |
587 | 591 | ||
588 | if ( categoryNames().count() ){ | 592 | if ( categoryNames().count() ){ |
589 | text += "<b>" + QObject::tr( "Category:") + "</b> "; | 593 | text += "<b>" + QObject::tr( "Category:") + "</b> "; |
590 | text += categoryNames().join(", "); | 594 | text += categoryNames().join(", "); |
591 | text += "<br>"; | 595 | text += "<br>"; |
592 | } | 596 | } |
593 | 597 | ||
594 | // notes last | 598 | // notes last |
595 | if ( (value = notes()) ) { | 599 | if ( (value = notes()) ) { |
596 | QRegExp reg("\n"); | 600 | QRegExp reg("\n"); |
597 | 601 | ||
598 | //QString tmp = Qtopia::escapeString(value); | 602 | //QString tmp = Qtopia::escapeString(value); |
599 | QString tmp = QStyleSheet::convertFromPlainText(value); | 603 | QString tmp = QStyleSheet::convertFromPlainText(value); |
600 | //tmp.replace( reg, "<br>" ); | 604 | //tmp.replace( reg, "<br>" ); |
601 | text += "<br>" + tmp + "<br>"; | 605 | text += "<br>" + tmp + "<br>"; |
602 | } | 606 | } |
603 | return text; | 607 | return text; |
604 | } | 608 | } |
605 | 609 | ||
606 | /*! | 610 | /*! |
607 | \internal | 611 | \internal |
608 | */ | 612 | */ |
609 | void OContact::insert( int key, const QString &v ) | 613 | void OContact::insert( int key, const QString &v ) |
610 | { | 614 | { |
611 | QString value = v.stripWhiteSpace(); | 615 | QString value = v.stripWhiteSpace(); |
612 | if ( value.isEmpty() ) | 616 | if ( value.isEmpty() ) |
613 | mMap.remove( key ); | 617 | mMap.remove( key ); |
614 | else | 618 | else |
615 | mMap.insert( key, value ); | 619 | mMap.insert( key, value ); |
616 | } | 620 | } |
617 | 621 | ||
618 | /*! | 622 | /*! |
619 | \internal | 623 | \internal |
620 | */ | 624 | */ |
621 | void OContact::replace( int key, const QString & v ) | 625 | void OContact::replace( int key, const QString & v ) |
622 | { | 626 | { |
623 | QString value = v.stripWhiteSpace(); | 627 | QString value = v.stripWhiteSpace(); |
624 | if ( value.isEmpty() ) | 628 | if ( value.isEmpty() ) |
625 | mMap.remove( key ); | 629 | mMap.remove( key ); |
626 | else | 630 | else |
627 | mMap.replace( key, value ); | 631 | mMap.replace( key, value ); |
628 | } | 632 | } |
629 | 633 | ||
630 | /*! | 634 | /*! |
631 | \internal | 635 | \internal |
632 | */ | 636 | */ |
633 | QString OContact::find( int key ) const | 637 | QString OContact::find( int key ) const |
634 | { | 638 | { |
635 | return mMap[key]; | 639 | return mMap[key]; |
636 | } | 640 | } |
637 | 641 | ||
638 | /*! | 642 | /*! |
639 | \internal | 643 | \internal |
640 | */ | 644 | */ |
641 | QString OContact::displayAddress( const QString &street, | 645 | QString OContact::displayAddress( const QString &street, |
642 | const QString &city, | 646 | const QString &city, |
643 | const QString &state, | 647 | const QString &state, |
644 | const QString &zip, | 648 | const QString &zip, |
645 | const QString &country ) const | 649 | const QString &country ) const |
646 | { | 650 | { |
647 | QString s = street; | 651 | QString s = street; |
648 | if ( !street.isEmpty() ) | 652 | if ( !street.isEmpty() ) |
649 | s+= "\n"; | 653 | s+= "\n"; |
650 | s += city; | 654 | s += city; |
651 | if ( !city.isEmpty() && !state.isEmpty() ) | 655 | if ( !city.isEmpty() && !state.isEmpty() ) |
652 | s += ", "; | 656 | s += ", "; |
653 | s += state; | 657 | s += state; |
654 | if ( !state.isEmpty() && !zip.isEmpty() ) | 658 | if ( !state.isEmpty() && !zip.isEmpty() ) |
655 | s += " "; | 659 | s += " "; |
656 | s += zip; | 660 | s += zip; |
657 | if ( !country.isEmpty() && !s.isEmpty() ) | 661 | if ( !country.isEmpty() && !s.isEmpty() ) |
658 | s += "\n"; | 662 | s += "\n"; |
659 | s += country; | 663 | s += country; |
660 | return s; | 664 | return s; |
661 | } | 665 | } |
662 | 666 | ||
663 | /*! | 667 | /*! |
664 | \internal | 668 | \internal |
665 | */ | 669 | */ |
666 | QString OContact::displayBusinessAddress() const | 670 | QString OContact::displayBusinessAddress() const |
667 | { | 671 | { |
668 | return displayAddress( businessStreet(), businessCity(), | 672 | return displayAddress( businessStreet(), businessCity(), |
669 | businessState(), businessZip(), | 673 | businessState(), businessZip(), |
670 | businessCountry() ); | 674 | businessCountry() ); |
671 | } | 675 | } |
672 | 676 | ||
673 | /*! | 677 | /*! |
674 | \internal | 678 | \internal |
675 | */ | 679 | */ |
676 | QString OContact::displayHomeAddress() const | 680 | QString OContact::displayHomeAddress() const |
677 | { | 681 | { |
678 | return displayAddress( homeStreet(), homeCity(), | 682 | return displayAddress( homeStreet(), homeCity(), |
679 | homeState(), homeZip(), | 683 | homeState(), homeZip(), |
680 | homeCountry() ); | 684 | homeCountry() ); |
681 | } | 685 | } |
682 | 686 | ||
683 | /*! | 687 | /*! |
684 | Returns the full name of the contact | 688 | Returns the full name of the contact |
685 | */ | 689 | */ |
686 | QString OContact::fullName() const | 690 | QString OContact::fullName() const |
687 | { | 691 | { |
688 | QString title = find( Qtopia::Title ); | 692 | QString title = find( Qtopia::Title ); |
689 | QString firstName = find( Qtopia::FirstName ); | 693 | QString firstName = find( Qtopia::FirstName ); |
690 | QString middleName = find( Qtopia::MiddleName ); | 694 | QString middleName = find( Qtopia::MiddleName ); |
691 | QString lastName = find( Qtopia::LastName ); | 695 | QString lastName = find( Qtopia::LastName ); |
692 | QString suffix = find( Qtopia::Suffix ); | 696 | QString suffix = find( Qtopia::Suffix ); |
693 | 697 | ||
694 | QString name = title; | 698 | QString name = title; |
695 | if ( !firstName.isEmpty() ) { | 699 | if ( !firstName.isEmpty() ) { |
696 | if ( !name.isEmpty() ) | 700 | if ( !name.isEmpty() ) |
697 | name += " "; | 701 | name += " "; |
698 | name += firstName; | 702 | name += firstName; |
699 | } | 703 | } |
700 | if ( !middleName.isEmpty() ) { | 704 | if ( !middleName.isEmpty() ) { |
701 | if ( !name.isEmpty() ) | 705 | if ( !name.isEmpty() ) |
702 | name += " "; | 706 | name += " "; |
703 | name += middleName; | 707 | name += middleName; |
704 | } | 708 | } |
705 | if ( !lastName.isEmpty() ) { | 709 | if ( !lastName.isEmpty() ) { |
706 | if ( !name.isEmpty() ) | 710 | if ( !name.isEmpty() ) |
707 | name += " "; | 711 | name += " "; |
708 | name += lastName; | 712 | name += lastName; |
709 | } | 713 | } |
710 | if ( !suffix.isEmpty() ) { | 714 | if ( !suffix.isEmpty() ) { |
711 | if ( !name.isEmpty() ) | 715 | if ( !name.isEmpty() ) |
712 | name += " "; | 716 | name += " "; |
713 | name += suffix; | 717 | name += suffix; |
714 | } | 718 | } |
715 | return name.simplifyWhiteSpace(); | 719 | return name.simplifyWhiteSpace(); |
716 | } | 720 | } |
717 | 721 | ||
718 | /*! | 722 | /*! |
719 | Returns a list of the names of the children of the contact. | 723 | Returns a list of the names of the children of the contact. |
720 | */ | 724 | */ |
721 | QStringList OContact::childrenList() const | 725 | QStringList OContact::childrenList() const |
722 | { | 726 | { |
723 | return QStringList::split( " ", find( Qtopia::Children ) ); | 727 | return QStringList::split( " ", find( Qtopia::Children ) ); |
724 | } | 728 | } |
725 | 729 | ||
726 | /*! \fn void OContact::insertEmail( const QString &email ) | 730 | /*! \fn void OContact::insertEmail( const QString &email ) |
727 | 731 | ||
728 | Insert \a email into the email list. Ensures \a email can only be added | 732 | Insert \a email into the email list. Ensures \a email can only be added |
729 | once. If there is no default email address set, it sets it to the \a email. | 733 | once. If there is no default email address set, it sets it to the \a email. |
730 | */ | 734 | */ |
731 | 735 | ||
732 | /*! \fn void OContact::removeEmail( const QString &email ) | 736 | /*! \fn void OContact::removeEmail( const QString &email ) |
733 | 737 | ||
734 | Removes the \a email from the email list. If the default email was \a email, | 738 | Removes the \a email from the email list. If the default email was \a email, |
735 | then the default email address is assigned to the first email in the | 739 | then the default email address is assigned to the first email in the |
736 | email list | 740 | email list |
737 | */ | 741 | */ |
738 | 742 | ||
739 | /*! \fn void OContact::clearEmails() | 743 | /*! \fn void OContact::clearEmails() |
740 | 744 | ||
741 | Clears the email list. | 745 | Clears the email list. |
742 | */ | 746 | */ |
743 | 747 | ||
744 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) | 748 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) |
745 | 749 | ||
746 | Appends the \a emailList to the exiting email list | 750 | Appends the \a emailList to the exiting email list |
747 | */ | 751 | */ |
748 | 752 | ||
749 | /*! | 753 | /*! |
750 | Returns a list of email addresses belonging to the contact, including | 754 | Returns a list of email addresses belonging to the contact, including |
751 | the default email address. | 755 | the default email address. |
752 | */ | 756 | */ |
753 | QStringList OContact::emailList() const | 757 | QStringList OContact::emailList() const |
754 | { | 758 | { |
755 | QString emailStr = emails(); | 759 | QString emailStr = emails(); |
756 | 760 | ||
757 | QStringList r; | 761 | QStringList r; |
758 | if ( !emailStr.isEmpty() ) { | 762 | if ( !emailStr.isEmpty() ) { |
759 | qDebug(" emailstr "); | 763 | qDebug(" emailstr "); |
760 | QStringList l = QStringList::split( emailSeparator(), emailStr ); | 764 | QStringList l = QStringList::split( emailSeparator(), emailStr ); |
761 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) | 765 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) |
762 | r += (*it).simplifyWhiteSpace(); | 766 | r += (*it).simplifyWhiteSpace(); |
763 | } | 767 | } |
764 | 768 | ||
765 | return r; | 769 | return r; |
766 | } | 770 | } |
767 | 771 | ||
768 | /*! | 772 | /*! |
769 | \overload | 773 | \overload |
770 | 774 | ||
771 | Generates the string for the contact to be filed as from the first, | 775 | Generates the string for the contact to be filed as from the first, |
772 | middle and last name of the contact. | 776 | middle and last name of the contact. |
773 | */ | 777 | */ |
774 | void OContact::setFileAs() | 778 | void OContact::setFileAs() |
775 | { | 779 | { |
776 | QString lastName, firstName, middleName, fileas; | 780 | QString lastName, firstName, middleName, fileas; |
777 | 781 | ||
778 | lastName = find( Qtopia::LastName ); | 782 | lastName = find( Qtopia::LastName ); |
779 | firstName = find( Qtopia::FirstName ); | 783 | firstName = find( Qtopia::FirstName ); |
780 | middleName = find( Qtopia::MiddleName ); | 784 | middleName = find( Qtopia::MiddleName ); |
781 | if ( !lastName.isEmpty() && !firstName.isEmpty() | 785 | if ( !lastName.isEmpty() && !firstName.isEmpty() |
782 | && !middleName.isEmpty() ) | 786 | && !middleName.isEmpty() ) |
783 | fileas = lastName + ", " + firstName + " " + middleName; | 787 | fileas = lastName + ", " + firstName + " " + middleName; |
784 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) | 788 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) |
785 | fileas = lastName + ", " + firstName; | 789 | fileas = lastName + ", " + firstName; |
786 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || | 790 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || |
787 | !middleName.isEmpty() ) | 791 | !middleName.isEmpty() ) |
788 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) | 792 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) |
789 | + middleName + ( middleName.isEmpty() ? "" : " " ) | 793 | + middleName + ( middleName.isEmpty() ? "" : " " ) |
790 | + lastName; | 794 | + lastName; |
791 | 795 | ||
792 | replace( Qtopia::FileAs, fileas ); | 796 | replace( Qtopia::FileAs, fileas ); |
793 | } | 797 | } |
794 | 798 | ||
795 | /*! | 799 | /*! |
796 | \internal | 800 | \internal |
797 | Appends the contact information to \a buf. | 801 | Appends the contact information to \a buf. |
798 | */ | 802 | */ |
799 | void OContact::save( QString &buf ) const | 803 | void OContact::save( QString &buf ) const |
800 | { | 804 | { |
801 | static const QStringList SLFIELDS = fields(); | 805 | static const QStringList SLFIELDS = fields(); |
802 | // I'm expecting "<Contact " in front of this... | 806 | // I'm expecting "<Contact " in front of this... |
803 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); | 807 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); |
804 | it != mMap.end(); ++it ) { | 808 | it != mMap.end(); ++it ) { |
805 | const QString &value = it.data(); | 809 | const QString &value = it.data(); |
806 | int key = it.key(); | 810 | int key = it.key(); |
807 | if ( !value.isEmpty() ) { | 811 | if ( !value.isEmpty() ) { |
808 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) | 812 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) |
809 | continue; | 813 | continue; |
810 | 814 | ||
811 | key -= Qtopia::AddressCategory+1; | 815 | key -= Qtopia::AddressCategory+1; |
812 | buf += SLFIELDS[key]; | 816 | buf += SLFIELDS[key]; |
813 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; | 817 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; |
814 | } | 818 | } |
815 | } | 819 | } |
816 | buf += customToXml(); | 820 | buf += customToXml(); |
817 | if ( categories().count() > 0 ) | 821 | if ( categories().count() > 0 ) |
818 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; | 822 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; |
819 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; | 823 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; |
820 | // You need to close this yourself | 824 | // You need to close this yourself |
821 | } | 825 | } |
822 | 826 | ||
823 | 827 | ||
824 | /*! | 828 | /*! |
825 | \internal | 829 | \internal |
826 | Returns the list of fields belonging to a contact | 830 | Returns the list of fields belonging to a contact |
827 | Never change order of this list ! It has to be regarding | 831 | Never change order of this list ! It has to be regarding |
828 | enum AddressBookFields !! | 832 | enum AddressBookFields !! |
829 | */ | 833 | */ |
830 | QStringList OContact::fields() | 834 | QStringList OContact::fields() |
831 | { | 835 | { |
832 | QStringList list; | 836 | QStringList list; |
833 | 837 | ||
834 | list.append( "Title" ); // Not Used! | 838 | list.append( "Title" ); // Not Used! |
835 | list.append( "FirstName" ); | 839 | list.append( "FirstName" ); |
836 | list.append( "MiddleName" ); | 840 | list.append( "MiddleName" ); |
837 | list.append( "LastName" ); | 841 | list.append( "LastName" ); |
838 | list.append( "Suffix" ); | 842 | list.append( "Suffix" ); |
839 | list.append( "FileAs" ); | 843 | list.append( "FileAs" ); |
840 | 844 | ||
841 | list.append( "JobTitle" ); | 845 | list.append( "JobTitle" ); |
842 | list.append( "Department" ); | 846 | list.append( "Department" ); |
843 | list.append( "Company" ); | 847 | list.append( "Company" ); |
844 | list.append( "BusinessPhone" ); | 848 | list.append( "BusinessPhone" ); |
845 | list.append( "BusinessFax" ); | 849 | list.append( "BusinessFax" ); |
846 | list.append( "BusinessMobile" ); | 850 | list.append( "BusinessMobile" ); |
847 | 851 | ||
848 | list.append( "DefaultEmail" ); | 852 | list.append( "DefaultEmail" ); |
849 | list.append( "Emails" ); | 853 | list.append( "Emails" ); |
850 | 854 | ||
851 | list.append( "HomePhone" ); | 855 | list.append( "HomePhone" ); |
852 | list.append( "HomeFax" ); | 856 | list.append( "HomeFax" ); |
853 | list.append( "HomeMobile" ); | 857 | list.append( "HomeMobile" ); |
854 | 858 | ||
855 | list.append( "BusinessStreet" ); | 859 | list.append( "BusinessStreet" ); |
856 | list.append( "BusinessCity" ); | 860 | list.append( "BusinessCity" ); |
857 | list.append( "BusinessState" ); | 861 | list.append( "BusinessState" ); |
858 | list.append( "BusinessZip" ); | 862 | list.append( "BusinessZip" ); |
859 | list.append( "BusinessCountry" ); | 863 | list.append( "BusinessCountry" ); |
860 | list.append( "BusinessPager" ); | 864 | list.append( "BusinessPager" ); |
861 | list.append( "BusinessWebPage" ); | 865 | list.append( "BusinessWebPage" ); |
862 | 866 | ||
863 | list.append( "Office" ); | 867 | list.append( "Office" ); |
864 | list.append( "Profession" ); | 868 | list.append( "Profession" ); |
865 | list.append( "Assistant" ); | 869 | list.append( "Assistant" ); |
866 | list.append( "Manager" ); | 870 | list.append( "Manager" ); |
867 | 871 | ||
868 | list.append( "HomeStreet" ); | 872 | list.append( "HomeStreet" ); |
869 | list.append( "HomeCity" ); | 873 | list.append( "HomeCity" ); |
870 | list.append( "HomeState" ); | 874 | list.append( "HomeState" ); |
871 | list.append( "HomeZip" ); | 875 | list.append( "HomeZip" ); |
872 | list.append( "HomeCountry" ); | 876 | list.append( "HomeCountry" ); |
873 | list.append( "HomeWebPage" ); | 877 | list.append( "HomeWebPage" ); |
874 | 878 | ||
875 | list.append( "Spouse" ); | 879 | list.append( "Spouse" ); |
876 | list.append( "Gender" ); | 880 | list.append( "Gender" ); |
877 | list.append( "Birthday" ); | 881 | list.append( "Birthday" ); |
878 | list.append( "Anniversary" ); | 882 | list.append( "Anniversary" ); |
879 | list.append( "Nickname" ); | 883 | list.append( "Nickname" ); |
880 | list.append( "Children" ); | 884 | list.append( "Children" ); |
881 | 885 | ||
882 | list.append( "Notes" ); | 886 | list.append( "Notes" ); |
883 | list.append( "Groups" ); | 887 | list.append( "Groups" ); |
884 | 888 | ||
885 | return list; | 889 | return list; |
886 | } | 890 | } |
887 | 891 | ||
888 | 892 | ||
889 | /*! | 893 | /*! |
890 | Sets the list of email address for contact to those contained in \a str. | 894 | Sets the list of email address for contact to those contained in \a str. |
891 | Email address should be separated by ';'s. | 895 | Email address should be separated by ';'s. |
892 | */ | 896 | */ |
893 | void OContact::setEmails( const QString &str ) | 897 | void OContact::setEmails( const QString &str ) |
894 | { | 898 | { |
895 | replace( Qtopia::Emails, str ); | 899 | replace( Qtopia::Emails, str ); |
896 | if ( str.isEmpty() ) | 900 | if ( str.isEmpty() ) |
897 | setDefaultEmail( QString::null ); | 901 | setDefaultEmail( QString::null ); |
898 | } | 902 | } |
899 | 903 | ||
900 | /*! | 904 | /*! |
901 | Sets the list of children for the contact to those contained in \a str. | 905 | Sets the list of children for the contact to those contained in \a str. |
902 | */ | 906 | */ |
903 | void OContact::setChildren( const QString &str ) | 907 | void OContact::setChildren( const QString &str ) |
904 | { | 908 | { |
905 | replace( Qtopia::Children, str ); | 909 | replace( Qtopia::Children, str ); |
906 | } | 910 | } |
907 | 911 | ||
908 | /*! | 912 | /*! |
909 | Returns TRUE if the contact matches the regular expression \a regexp. | 913 | Returns TRUE if the contact matches the regular expression \a regexp. |
910 | Otherwise returns FALSE. | 914 | Otherwise returns FALSE. |
911 | */ | 915 | */ |
912 | bool OContact::match( const QString ®exp ) const | 916 | bool OContact::match( const QString ®exp ) const |
913 | { | 917 | { |
914 | return match(QRegExp(regexp)); | 918 | return match(QRegExp(regexp)); |
915 | } | 919 | } |
916 | 920 | ||
917 | /*! | 921 | /*! |
918 | \overload | 922 | \overload |
919 | Returns TRUE if the contact matches the regular expression \a regexp. | 923 | Returns TRUE if the contact matches the regular expression \a regexp. |
920 | Otherwise returns FALSE. | 924 | Otherwise returns FALSE. |
921 | */ | 925 | */ |
922 | bool OContact::match( const QRegExp &r ) const | 926 | bool OContact::match( const QRegExp &r ) const |
923 | { | 927 | { |
924 | bool match; | 928 | bool match; |
925 | match = false; | 929 | match = false; |
926 | QMap<int, QString>::ConstIterator it; | 930 | QMap<int, QString>::ConstIterator it; |
927 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { | 931 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { |
928 | if ( (*it).find( r ) > -1 ) { | 932 | if ( (*it).find( r ) > -1 ) { |
929 | match = true; | 933 | match = true; |
930 | break; | 934 | break; |
931 | } | 935 | } |
932 | } | 936 | } |
933 | return match; | 937 | return match; |
934 | } | 938 | } |
935 | 939 | ||
936 | 940 | ||
937 | QString OContact::toShortText() const | 941 | QString OContact::toShortText() const |
938 | { | 942 | { |
939 | return ( fullName() ); | 943 | return ( fullName() ); |
940 | } | 944 | } |
941 | QString OContact::type() const | 945 | QString OContact::type() const |
942 | { | 946 | { |
943 | return QString::fromLatin1( "OContact" ); | 947 | return QString::fromLatin1( "OContact" ); |
944 | } | 948 | } |
945 | 949 | ||
946 | // Definition is missing ! (se) | 950 | // Definition is missing ! (se) |
947 | QMap<QString,QString> OContact::toExtraMap() const | 951 | QMap<QString,QString> OContact::toExtraMap() const |
948 | { | 952 | { |
949 | qWarning ("Function not implemented: OContact::toExtraMap()"); | 953 | qWarning ("Function not implemented: OContact::toExtraMap()"); |
950 | QMap <QString,QString> useless; | 954 | QMap <QString,QString> useless; |
951 | return useless; | 955 | return useless; |
952 | } | 956 | } |
953 | 957 | ||
954 | class QString OContact::recordField( int pos ) const | 958 | class QString OContact::recordField( int pos ) const |
955 | { | 959 | { |
956 | QStringList SLFIELDS = fields(); // ?? why this ? (se) | 960 | QStringList SLFIELDS = fields(); // ?? why this ? (se) |
957 | return SLFIELDS[pos]; | 961 | return SLFIELDS[pos]; |
958 | } | 962 | } |
959 | 963 | ||
960 | // In future releases, we should store birthday and anniversary | 964 | // In future releases, we should store birthday and anniversary |
961 | // internally as QDate instead of QString ! | 965 | // internally as QDate instead of QString ! |
962 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) | 966 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) |
963 | 967 | ||
964 | /*! \fn void OContact::setBirthday( const QDate& date ) | 968 | /*! \fn void OContact::setBirthday( const QDate& date ) |
965 | Sets the birthday for the contact to \a date. If date is null | 969 | Sets the birthday for the contact to \a date. If date is null |
966 | the current stored date will be removed. | 970 | the current stored date will be removed. |
967 | */ | 971 | */ |
968 | void OContact::setBirthday( const QDate &v ) | 972 | void OContact::setBirthday( const QDate &v ) |
969 | { | 973 | { |
970 | if ( v.isNull() ){ | 974 | if ( v.isNull() ){ |
971 | qWarning( "Remove Birthday"); | 975 | qWarning( "Remove Birthday"); |
972 | replace( Qtopia::Birthday, QString::null ); | 976 | replace( Qtopia::Birthday, QString::null ); |
973 | return; | 977 | return; |
974 | } | 978 | } |
975 | 979 | ||
976 | if ( v.isValid() ) | 980 | if ( v.isValid() ) |
977 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); | 981 | replace( Qtopia::Birthday, TimeConversion::toString( v ) ); |
978 | 982 | ||
979 | } | 983 | } |
980 | 984 | ||
981 | 985 | ||
982 | /*! \fn void OContact::setAnniversary( const QDate &date ) | 986 | /*! \fn void OContact::setAnniversary( const QDate &date ) |
983 | Sets the anniversary of the contact to \a date. If date is | 987 | Sets the anniversary of the contact to \a date. If date is |
984 | null, the current stored date will be removed. | 988 | null, the current stored date will be removed. |
985 | */ | 989 | */ |
986 | void OContact::setAnniversary( const QDate &v ) | 990 | void OContact::setAnniversary( const QDate &v ) |
987 | { | 991 | { |
988 | if ( v.isNull() ){ | 992 | if ( v.isNull() ){ |
989 | qWarning( "Remove Anniversary"); | 993 | qWarning( "Remove Anniversary"); |
990 | replace( Qtopia::Anniversary, QString::null ); | 994 | replace( Qtopia::Anniversary, QString::null ); |
991 | return; | 995 | return; |
992 | } | 996 | } |
993 | 997 | ||
994 | if ( v.isValid() ) | 998 | if ( v.isValid() ) |
995 | replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); | 999 | replace( Qtopia::Anniversary, TimeConversion::toString( v ) ); |
996 | } | 1000 | } |
997 | 1001 | ||
998 | /*! \fn QDate OContact::birthday() const | 1002 | /*! \fn QDate OContact::birthday() const |
999 | Returns the birthday of the contact. | 1003 | Returns the birthday of the contact. |
1000 | */ | 1004 | */ |
1001 | QDate OContact::birthday() const | 1005 | QDate OContact::birthday() const |
1002 | { | 1006 | { |
1003 | QString str = find( Qtopia::Birthday ); | 1007 | QString str = find( Qtopia::Birthday ); |
1004 | qWarning ("Birthday %s", str.latin1() ); | 1008 | qWarning ("Birthday %s", str.latin1() ); |
1005 | if ( !str.isEmpty() ) | 1009 | if ( !str.isEmpty() ) |
1006 | return TimeConversion::fromString ( str ); | 1010 | return TimeConversion::fromString ( str ); |
1007 | else | 1011 | else |
1008 | return QDate(); | 1012 | return QDate(); |
1009 | } | 1013 | } |
1010 | 1014 | ||
1011 | 1015 | ||
1012 | /*! \fn QDate OContact::anniversary() const | 1016 | /*! \fn QDate OContact::anniversary() const |
1013 | Returns the anniversary of the contact. | 1017 | Returns the anniversary of the contact. |
1014 | */ | 1018 | */ |
1015 | QDate OContact::anniversary() const | 1019 | QDate OContact::anniversary() const |
1016 | { | 1020 | { |
1017 | QDate empty; | 1021 | QDate empty; |
1018 | QString str = find( Qtopia::Anniversary ); | 1022 | QString str = find( Qtopia::Anniversary ); |
1019 | qWarning ("Anniversary %s", str.latin1() ); | 1023 | qWarning ("Anniversary %s", str.latin1() ); |