author | eilers <eilers> | 2003-09-08 12:42:26 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-09-08 12:42:26 (UTC) |
commit | 913788f77c3f501778b7653317a4a6b06452961d (patch) (unidiff) | |
tree | b9393e5b7eefb87f3a421a17035b702a6b688eb7 | |
parent | 7fb091e12eec52e3d73896c728fc011fe40a3eb4 (diff) | |
download | opie-913788f77c3f501778b7653317a4a6b06452961d.zip opie-913788f77c3f501778b7653317a4a6b06452961d.tar.gz opie-913788f77c3f501778b7653317a4a6b06452961d.tar.bz2 |
Fixing bug #1161: No space between jobtitle and organization
-rw-r--r-- | libopie/pim/ocontact.cpp | 12 | ||||
-rw-r--r-- | libopie2/opiepim/ocontact.cpp | 12 |
2 files changed, 8 insertions, 16 deletions
diff --git a/libopie/pim/ocontact.cpp b/libopie/pim/ocontact.cpp index 0f05b65..fcf3b26 100644 --- a/libopie/pim/ocontact.cpp +++ b/libopie/pim/ocontact.cpp | |||
@@ -1,1211 +1,1207 @@ | |||
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-2003 by Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 13 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
14 | ** | 14 | ** |
15 | ** Contact info@trolltech.com if any conditions of this licensing are | 15 | ** Contact info@trolltech.com if any conditions of this licensing are |
16 | ** not clear to you. | 16 | ** not clear to you. |
17 | ** | 17 | ** |
18 | **********************************************************************/ | 18 | **********************************************************************/ |
19 | 19 | ||
20 | #define QTOPIA_INTERNAL_CONTACT_MRE | 20 | #define QTOPIA_INTERNAL_CONTACT_MRE |
21 | 21 | ||
22 | #include "ocontact.h" | 22 | #include "ocontact.h" |
23 | #include "opimresolver.h" | 23 | #include "opimresolver.h" |
24 | #include "oconversion.h" | 24 | #include "oconversion.h" |
25 | 25 | ||
26 | #include <qpe/stringutil.h> | 26 | #include <qpe/stringutil.h> |
27 | #include <qpe/timestring.h> | 27 | #include <qpe/timestring.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.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 | QString str; | 439 | QString str; |
440 | bool marker = false; | 440 | bool marker = false; |
441 | 441 | ||
442 | Config cfg("qpe"); | 442 | Config cfg("qpe"); |
443 | cfg.setGroup("Appearance"); | 443 | cfg.setGroup("Appearance"); |
444 | int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State ); | 444 | int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State ); |
445 | 445 | ||
446 | // name, jobtitle and company | 446 | // name, jobtitle and company |
447 | if ( !(value = fullName()).isEmpty() ) | 447 | if ( !(value = fullName()).isEmpty() ) |
448 | text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>"; | 448 | text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>"; |
449 | 449 | ||
450 | if ( !(value = jobTitle()).isEmpty() ) | 450 | if ( !(value = jobTitle()).isEmpty() ) |
451 | text += Qtopia::escapeString(value); | 451 | text += Qtopia::escapeString(value) + " "; |
452 | 452 | ||
453 | comp = company(); | 453 | comp = company(); |
454 | if ( !(value = department()).isEmpty() ) { | 454 | if ( !(value = department()).isEmpty() ) { |
455 | text += Qtopia::escapeString(value); | 455 | text += Qtopia::escapeString(value); |
456 | if ( comp ) | 456 | if ( comp ) |
457 | text += ", "; | 457 | text += ", " + Qtopia::escapeString(comp); |
458 | else | 458 | }else if ( comp ) |
459 | text += "<br>"; | 459 | text += "<br>" + Qtopia::escapeString(comp); |
460 | } | ||
461 | if ( !comp.isEmpty() ) | ||
462 | text += Qtopia::escapeString(comp); | ||
463 | |||
464 | text += "<br><hr>"; | 460 | text += "<br><hr>"; |
465 | 461 | ||
466 | // defailt email | 462 | // defailt email |
467 | QString defEmail = defaultEmail(); | 463 | QString defEmail = defaultEmail(); |
468 | if ( !defEmail.isEmpty() ){ | 464 | if ( !defEmail.isEmpty() ){ |
469 | text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>" | 465 | text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>" |
470 | + Qtopia::escapeString(defEmail); | 466 | + Qtopia::escapeString(defEmail); |
471 | marker = true; | 467 | marker = true; |
472 | } | 468 | } |
473 | 469 | ||
474 | // business address | 470 | // business address |
475 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 471 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
476 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 472 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
477 | text += QObject::tr( "<br><b>Work Address:</b>" ); | 473 | text += QObject::tr( "<br><b>Work Address:</b>" ); |
478 | marker = true; | 474 | marker = true; |
479 | } | 475 | } |
480 | 476 | ||
481 | if ( !(value = businessStreet()).isEmpty() ){ | 477 | if ( !(value = businessStreet()).isEmpty() ){ |
482 | text += "<br>" + Qtopia::escapeString(value); | 478 | text += "<br>" + Qtopia::escapeString(value); |
483 | marker = true; | 479 | marker = true; |
484 | } | 480 | } |
485 | 481 | ||
486 | switch( addressformat ){ | 482 | switch( addressformat ){ |
487 | case Zip_City_State:{ // Zip_Code City, State | 483 | case Zip_City_State:{ // Zip_Code City, State |
488 | state = businessState(); | 484 | state = businessState(); |
489 | if ( !(value = businessZip()).isEmpty() ){ | 485 | if ( !(value = businessZip()).isEmpty() ){ |
490 | text += "<br>" + Qtopia::escapeString(value) + " "; | 486 | text += "<br>" + Qtopia::escapeString(value) + " "; |
491 | marker = true; | 487 | marker = true; |
492 | 488 | ||
493 | } | 489 | } |
494 | if ( !(value = businessCity()).isEmpty() ) { | 490 | if ( !(value = businessCity()).isEmpty() ) { |
495 | marker = true; | 491 | marker = true; |
496 | if ( businessZip().isEmpty() && !businessStreet().isEmpty() ) | 492 | if ( businessZip().isEmpty() && !businessStreet().isEmpty() ) |
497 | text += "<br>"; | 493 | text += "<br>"; |
498 | text += Qtopia::escapeString(value); | 494 | text += Qtopia::escapeString(value); |
499 | if ( state ) | 495 | if ( state ) |
500 | text += ", " + Qtopia::escapeString(state); | 496 | text += ", " + Qtopia::escapeString(state); |
501 | } else if ( !state.isEmpty() ){ | 497 | } else if ( !state.isEmpty() ){ |
502 | text += "<br>" + Qtopia::escapeString(state); | 498 | text += "<br>" + Qtopia::escapeString(state); |
503 | marker = true; | 499 | marker = true; |
504 | } | 500 | } |
505 | break; | 501 | break; |
506 | } | 502 | } |
507 | case City_State_Zip:{ // City, State Zip_Code | 503 | case City_State_Zip:{ // City, State Zip_Code |
508 | state = businessState(); | 504 | state = businessState(); |
509 | if ( !(value = businessCity()).isEmpty() ) { | 505 | if ( !(value = businessCity()).isEmpty() ) { |
510 | marker = true; | 506 | marker = true; |
511 | text += "<br>" + Qtopia::escapeString(value); | 507 | text += "<br>" + Qtopia::escapeString(value); |
512 | if ( state ) | 508 | if ( state ) |
513 | text += ", " + Qtopia::escapeString(state); | 509 | text += ", " + Qtopia::escapeString(state); |
514 | } else if ( !state.isEmpty() ){ | 510 | } else if ( !state.isEmpty() ){ |
515 | text += "<br>" + Qtopia::escapeString(state); | 511 | text += "<br>" + Qtopia::escapeString(state); |
516 | marker = true; | 512 | marker = true; |
517 | } | 513 | } |
518 | if ( !(value = businessZip()).isEmpty() ){ | 514 | if ( !(value = businessZip()).isEmpty() ){ |
519 | text += " " + Qtopia::escapeString(value); | 515 | text += " " + Qtopia::escapeString(value); |
520 | marker = true; | 516 | marker = true; |
521 | } | 517 | } |
522 | break; | 518 | break; |
523 | } | 519 | } |
524 | } | 520 | } |
525 | 521 | ||
526 | if ( !(value = businessCountry()).isEmpty() ){ | 522 | if ( !(value = businessCountry()).isEmpty() ){ |
527 | text += "<br>" + Qtopia::escapeString(value); | 523 | text += "<br>" + Qtopia::escapeString(value); |
528 | marker = true; | 524 | marker = true; |
529 | } | 525 | } |
530 | 526 | ||
531 | // rest of Business data | 527 | // rest of Business data |
532 | str = office(); | 528 | str = office(); |
533 | if ( !str.isEmpty() ){ | 529 | if ( !str.isEmpty() ){ |
534 | text += "<br><b>" + QObject::tr("Office: ") + "</b>" | 530 | text += "<br><b>" + QObject::tr("Office: ") + "</b>" |
535 | + Qtopia::escapeString(str); | 531 | + Qtopia::escapeString(str); |
536 | marker = true; | 532 | marker = true; |
537 | } | 533 | } |
538 | str = businessWebpage(); | 534 | str = businessWebpage(); |
539 | if ( !str.isEmpty() ){ | 535 | if ( !str.isEmpty() ){ |
540 | text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" | 536 | text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" |
541 | + Qtopia::escapeString(str); | 537 | + Qtopia::escapeString(str); |
542 | marker = true; | 538 | marker = true; |
543 | } | 539 | } |
544 | str = businessPhone(); | 540 | str = businessPhone(); |
545 | if ( !str.isEmpty() ){ | 541 | if ( !str.isEmpty() ){ |
546 | text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" | 542 | text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" |
547 | + Qtopia::escapeString(str); | 543 | + Qtopia::escapeString(str); |
548 | marker = true; | 544 | marker = true; |
549 | } | 545 | } |
550 | str = businessFax(); | 546 | str = businessFax(); |
551 | if ( !str.isEmpty() ){ | 547 | if ( !str.isEmpty() ){ |
552 | text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" | 548 | text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" |
553 | + Qtopia::escapeString(str); | 549 | + Qtopia::escapeString(str); |
554 | marker = true; | 550 | marker = true; |
555 | } | 551 | } |
556 | str = businessMobile(); | 552 | str = businessMobile(); |
557 | if ( !str.isEmpty() ){ | 553 | if ( !str.isEmpty() ){ |
558 | text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" | 554 | text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" |
559 | + Qtopia::escapeString(str); | 555 | + Qtopia::escapeString(str); |
560 | marker = true; | 556 | marker = true; |
561 | } | 557 | } |
562 | str = businessPager(); | 558 | str = businessPager(); |
563 | if ( !str.isEmpty() ){ | 559 | if ( !str.isEmpty() ){ |
564 | text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" | 560 | text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" |
565 | + Qtopia::escapeString(str); | 561 | + Qtopia::escapeString(str); |
566 | marker = true; | 562 | marker = true; |
567 | } | 563 | } |
568 | 564 | ||
569 | // text += "<br>"; | 565 | // text += "<br>"; |
570 | 566 | ||
571 | // home address | 567 | // home address |
572 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 568 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
573 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 569 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
574 | text += QObject::tr( "<br><b>Home Address:</b>" ); | 570 | text += QObject::tr( "<br><b>Home Address:</b>" ); |
575 | marker = true; | 571 | marker = true; |
576 | } | 572 | } |
577 | 573 | ||
578 | if ( !(value = homeStreet()).isEmpty() ){ | 574 | if ( !(value = homeStreet()).isEmpty() ){ |
579 | text += "<br>" + Qtopia::escapeString(value); | 575 | text += "<br>" + Qtopia::escapeString(value); |
580 | marker = true; | 576 | marker = true; |
581 | } | 577 | } |
582 | 578 | ||
583 | switch( addressformat ){ | 579 | switch( addressformat ){ |
584 | case Zip_City_State:{ // Zip_Code City, State | 580 | case Zip_City_State:{ // Zip_Code City, State |
585 | state = homeState(); | 581 | state = homeState(); |
586 | if ( !(value = homeZip()).isEmpty() ){ | 582 | if ( !(value = homeZip()).isEmpty() ){ |
587 | text += "<br>" + Qtopia::escapeString(value) + " "; | 583 | text += "<br>" + Qtopia::escapeString(value) + " "; |
588 | marker = true; | 584 | marker = true; |
589 | } | 585 | } |
590 | if ( !(value = homeCity()).isEmpty() ) { | 586 | if ( !(value = homeCity()).isEmpty() ) { |
591 | marker = true; | 587 | marker = true; |
592 | if ( homeZip().isEmpty() && !homeStreet().isEmpty() ) | 588 | if ( homeZip().isEmpty() && !homeStreet().isEmpty() ) |
593 | text += "<br>"; | 589 | text += "<br>"; |
594 | text += Qtopia::escapeString(value); | 590 | text += Qtopia::escapeString(value); |
595 | if ( !state.isEmpty() ) | 591 | if ( !state.isEmpty() ) |
596 | text += ", " + Qtopia::escapeString(state); | 592 | text += ", " + Qtopia::escapeString(state); |
597 | } else if (!state.isEmpty()) { | 593 | } else if (!state.isEmpty()) { |
598 | text += "<br>" + Qtopia::escapeString(state); | 594 | text += "<br>" + Qtopia::escapeString(state); |
599 | marker = true; | 595 | marker = true; |
600 | } | 596 | } |
601 | break; | 597 | break; |
602 | } | 598 | } |
603 | case City_State_Zip:{ // City, State Zip_Code | 599 | case City_State_Zip:{ // City, State Zip_Code |
604 | state = homeState(); | 600 | state = homeState(); |
605 | if ( !(value = homeCity()).isEmpty() ) { | 601 | if ( !(value = homeCity()).isEmpty() ) { |
606 | marker = true; | 602 | marker = true; |
607 | text += "<br>" + Qtopia::escapeString(value); | 603 | text += "<br>" + Qtopia::escapeString(value); |
608 | if ( state ) | 604 | if ( state ) |
609 | text += ", " + Qtopia::escapeString(state); | 605 | text += ", " + Qtopia::escapeString(state); |
610 | } else if ( !state.isEmpty() ){ | 606 | } else if ( !state.isEmpty() ){ |
611 | text += "<br>" + Qtopia::escapeString(state); | 607 | text += "<br>" + Qtopia::escapeString(state); |
612 | marker = true; | 608 | marker = true; |
613 | } | 609 | } |
614 | if ( !(value = homeZip()).isEmpty() ){ | 610 | if ( !(value = homeZip()).isEmpty() ){ |
615 | text += " " + Qtopia::escapeString(value); | 611 | text += " " + Qtopia::escapeString(value); |
616 | marker = true; | 612 | marker = true; |
617 | } | 613 | } |
618 | break; | 614 | break; |
619 | } | 615 | } |
620 | } | 616 | } |
621 | 617 | ||
622 | if ( !(value = homeCountry()).isEmpty() ){ | 618 | if ( !(value = homeCountry()).isEmpty() ){ |
623 | text += "<br>" + Qtopia::escapeString(value); | 619 | text += "<br>" + Qtopia::escapeString(value); |
624 | marker = true; | 620 | marker = true; |
625 | } | 621 | } |
626 | 622 | ||
627 | // rest of Home data | 623 | // rest of Home data |
628 | str = homeWebpage(); | 624 | str = homeWebpage(); |
629 | if ( !str.isEmpty() ){ | 625 | if ( !str.isEmpty() ){ |
630 | text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" | 626 | text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" |
631 | + Qtopia::escapeString(str); | 627 | + Qtopia::escapeString(str); |
632 | marker = true; | 628 | marker = true; |
633 | } | 629 | } |
634 | str = homePhone(); | 630 | str = homePhone(); |
635 | if ( !str.isEmpty() ){ | 631 | if ( !str.isEmpty() ){ |
636 | text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" | 632 | text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" |
637 | + Qtopia::escapeString(str); | 633 | + Qtopia::escapeString(str); |
638 | marker = true; | 634 | marker = true; |
639 | } | 635 | } |
640 | str = homeFax(); | 636 | str = homeFax(); |
641 | if ( !str.isEmpty() ){ | 637 | if ( !str.isEmpty() ){ |
642 | text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>" | 638 | text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>" |
643 | + Qtopia::escapeString(str); | 639 | + Qtopia::escapeString(str); |
644 | marker = true; | 640 | marker = true; |
645 | } | 641 | } |
646 | str = homeMobile(); | 642 | str = homeMobile(); |
647 | if ( !str.isEmpty() ){ | 643 | if ( !str.isEmpty() ){ |
648 | text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>" | 644 | text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>" |
649 | + Qtopia::escapeString(str); | 645 | + Qtopia::escapeString(str); |
650 | marker = true; | 646 | marker = true; |
651 | } | 647 | } |
652 | 648 | ||
653 | if ( marker ) | 649 | if ( marker ) |
654 | text += "<br><hr>"; | 650 | text += "<br><hr>"; |
655 | 651 | ||
656 | // the rest... | 652 | // the rest... |
657 | str = emails(); | 653 | str = emails(); |
658 | if ( !str.isEmpty() && ( str != defEmail ) ) | 654 | if ( !str.isEmpty() && ( str != defEmail ) ) |
659 | text += "<br><b>" + QObject::tr("All Emails: ") + "</b>" | 655 | text += "<br><b>" + QObject::tr("All Emails: ") + "</b>" |
660 | + Qtopia::escapeString(str); | 656 | + Qtopia::escapeString(str); |
661 | str = profession(); | 657 | str = profession(); |
662 | if ( !str.isEmpty() ) | 658 | if ( !str.isEmpty() ) |
663 | text += "<br><b>" + QObject::tr("Profession: ") + "</b>" | 659 | text += "<br><b>" + QObject::tr("Profession: ") + "</b>" |
664 | + Qtopia::escapeString(str); | 660 | + Qtopia::escapeString(str); |
665 | str = assistant(); | 661 | str = assistant(); |
666 | if ( !str.isEmpty() ) | 662 | if ( !str.isEmpty() ) |
667 | text += "<br><b>" + QObject::tr("Assistant: ") + "</b>" | 663 | text += "<br><b>" + QObject::tr("Assistant: ") + "</b>" |
668 | + Qtopia::escapeString(str); | 664 | + Qtopia::escapeString(str); |
669 | str = manager(); | 665 | str = manager(); |
670 | if ( !str.isEmpty() ) | 666 | if ( !str.isEmpty() ) |
671 | text += "<br><b>" + QObject::tr("Manager: ") + "</b>" | 667 | text += "<br><b>" + QObject::tr("Manager: ") + "</b>" |
672 | + Qtopia::escapeString(str); | 668 | + Qtopia::escapeString(str); |
673 | str = gender(); | 669 | str = gender(); |
674 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 670 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
675 | text += "<br>"; | 671 | text += "<br>"; |
676 | if ( str.toInt() == 1 ) | 672 | if ( str.toInt() == 1 ) |
677 | str = QObject::tr( "Male" ); | 673 | str = QObject::tr( "Male" ); |
678 | else if ( str.toInt() == 2 ) | 674 | else if ( str.toInt() == 2 ) |
679 | str = QObject::tr( "Female" ); | 675 | str = QObject::tr( "Female" ); |
680 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str; | 676 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str; |
681 | } | 677 | } |
682 | str = spouse(); | 678 | str = spouse(); |
683 | if ( !str.isEmpty() ) | 679 | if ( !str.isEmpty() ) |
684 | text += "<br><b>" + QObject::tr("Spouse: ") + "</b>" | 680 | text += "<br><b>" + QObject::tr("Spouse: ") + "</b>" |
685 | + Qtopia::escapeString(str); | 681 | + Qtopia::escapeString(str); |
686 | if ( birthday().isValid() ){ | 682 | if ( birthday().isValid() ){ |
687 | str = TimeString::numberDateString( birthday() ); | 683 | str = TimeString::numberDateString( birthday() ); |
688 | text += "<br><b>" + QObject::tr("Birthday: ") + "</b>" | 684 | text += "<br><b>" + QObject::tr("Birthday: ") + "</b>" |
689 | + Qtopia::escapeString(str); | 685 | + Qtopia::escapeString(str); |
690 | } | 686 | } |
691 | if ( anniversary().isValid() ){ | 687 | if ( anniversary().isValid() ){ |
692 | str = TimeString::numberDateString( anniversary() ); | 688 | str = TimeString::numberDateString( anniversary() ); |
693 | text += "<br><b>" + QObject::tr("Anniversary: ") + "</b>" | 689 | text += "<br><b>" + QObject::tr("Anniversary: ") + "</b>" |
694 | + Qtopia::escapeString(str); | 690 | + Qtopia::escapeString(str); |
695 | } | 691 | } |
696 | str = children(); | 692 | str = children(); |
697 | if ( !str.isEmpty() ) | 693 | if ( !str.isEmpty() ) |
698 | text += "<br><b>" + QObject::tr("Children: ") + "</b>" | 694 | text += "<br><b>" + QObject::tr("Children: ") + "</b>" |
699 | + Qtopia::escapeString(str); | 695 | + Qtopia::escapeString(str); |
700 | 696 | ||
701 | str = nickname(); | 697 | str = nickname(); |
702 | if ( !str.isEmpty() ) | 698 | if ( !str.isEmpty() ) |
703 | text += "<br><b>" + QObject::tr("Nickname: ") + "</b>" | 699 | text += "<br><b>" + QObject::tr("Nickname: ") + "</b>" |
704 | + Qtopia::escapeString(str); | 700 | + Qtopia::escapeString(str); |
705 | 701 | ||
706 | // categories | 702 | // categories |
707 | if ( categoryNames("Contacts").count() ){ | 703 | if ( categoryNames("Contacts").count() ){ |
708 | text += "<br><b>" + QObject::tr( "Category:") + "</b> "; | 704 | text += "<br><b>" + QObject::tr( "Category:") + "</b> "; |
709 | text += categoryNames("Contacts").join(", "); | 705 | text += categoryNames("Contacts").join(", "); |
710 | } | 706 | } |
711 | 707 | ||
712 | // notes last | 708 | // notes last |
713 | if ( !(value = notes()).isEmpty() ) { | 709 | if ( !(value = notes()).isEmpty() ) { |
714 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; | 710 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; |
715 | QRegExp reg("\n"); | 711 | QRegExp reg("\n"); |
716 | 712 | ||
717 | //QString tmp = Qtopia::escapeString(value); | 713 | //QString tmp = Qtopia::escapeString(value); |
718 | QString tmp = QStyleSheet::convertFromPlainText(value); | 714 | QString tmp = QStyleSheet::convertFromPlainText(value); |
719 | //tmp.replace( reg, "<br>" ); | 715 | //tmp.replace( reg, "<br>" ); |
720 | text += "<br>" + tmp + "<br>"; | 716 | text += "<br>" + tmp + "<br>"; |
721 | } | 717 | } |
722 | return text; | 718 | return text; |
723 | } | 719 | } |
724 | 720 | ||
725 | /*! | 721 | /*! |
726 | \internal | 722 | \internal |
727 | */ | 723 | */ |
728 | void OContact::insert( int key, const QString &v ) | 724 | void OContact::insert( int key, const QString &v ) |
729 | { | 725 | { |
730 | QString value = v.stripWhiteSpace(); | 726 | QString value = v.stripWhiteSpace(); |
731 | if ( value.isEmpty() ) | 727 | if ( value.isEmpty() ) |
732 | mMap.remove( key ); | 728 | mMap.remove( key ); |
733 | else | 729 | else |
734 | mMap.insert( key, value ); | 730 | mMap.insert( key, value ); |
735 | } | 731 | } |
736 | 732 | ||
737 | /*! | 733 | /*! |
738 | \internal | 734 | \internal |
739 | */ | 735 | */ |
740 | void OContact::replace( int key, const QString & v ) | 736 | void OContact::replace( int key, const QString & v ) |
741 | { | 737 | { |
742 | QString value = v.stripWhiteSpace(); | 738 | QString value = v.stripWhiteSpace(); |
743 | if ( value.isEmpty() ) | 739 | if ( value.isEmpty() ) |
744 | mMap.remove( key ); | 740 | mMap.remove( key ); |
745 | else | 741 | else |
746 | mMap.replace( key, value ); | 742 | mMap.replace( key, value ); |
747 | } | 743 | } |
748 | 744 | ||
749 | /*! | 745 | /*! |
750 | \internal | 746 | \internal |
751 | */ | 747 | */ |
752 | QString OContact::find( int key ) const | 748 | QString OContact::find( int key ) const |
753 | { | 749 | { |
754 | return mMap[key]; | 750 | return mMap[key]; |
755 | } | 751 | } |
756 | 752 | ||
757 | /*! | 753 | /*! |
758 | \internal | 754 | \internal |
759 | */ | 755 | */ |
760 | QString OContact::displayAddress( const QString &street, | 756 | QString OContact::displayAddress( const QString &street, |
761 | const QString &city, | 757 | const QString &city, |
762 | const QString &state, | 758 | const QString &state, |
763 | const QString &zip, | 759 | const QString &zip, |
764 | const QString &country ) const | 760 | const QString &country ) const |
765 | { | 761 | { |
766 | QString s = street; | 762 | QString s = street; |
767 | if ( !street.isEmpty() ) | 763 | if ( !street.isEmpty() ) |
768 | s+= "\n"; | 764 | s+= "\n"; |
769 | s += city; | 765 | s += city; |
770 | if ( !city.isEmpty() && !state.isEmpty() ) | 766 | if ( !city.isEmpty() && !state.isEmpty() ) |
771 | s += ", "; | 767 | s += ", "; |
772 | s += state; | 768 | s += state; |
773 | if ( !state.isEmpty() && !zip.isEmpty() ) | 769 | if ( !state.isEmpty() && !zip.isEmpty() ) |
774 | s += " "; | 770 | s += " "; |
775 | s += zip; | 771 | s += zip; |
776 | if ( !country.isEmpty() && !s.isEmpty() ) | 772 | if ( !country.isEmpty() && !s.isEmpty() ) |
777 | s += "\n"; | 773 | s += "\n"; |
778 | s += country; | 774 | s += country; |
779 | return s; | 775 | return s; |
780 | } | 776 | } |
781 | 777 | ||
782 | /*! | 778 | /*! |
783 | \internal | 779 | \internal |
784 | */ | 780 | */ |
785 | QString OContact::displayBusinessAddress() const | 781 | QString OContact::displayBusinessAddress() const |
786 | { | 782 | { |
787 | return displayAddress( businessStreet(), businessCity(), | 783 | return displayAddress( businessStreet(), businessCity(), |
788 | businessState(), businessZip(), | 784 | businessState(), businessZip(), |
789 | businessCountry() ); | 785 | businessCountry() ); |
790 | } | 786 | } |
791 | 787 | ||
792 | /*! | 788 | /*! |
793 | \internal | 789 | \internal |
794 | */ | 790 | */ |
795 | QString OContact::displayHomeAddress() const | 791 | QString OContact::displayHomeAddress() const |
796 | { | 792 | { |
797 | return displayAddress( homeStreet(), homeCity(), | 793 | return displayAddress( homeStreet(), homeCity(), |
798 | homeState(), homeZip(), | 794 | homeState(), homeZip(), |
799 | homeCountry() ); | 795 | homeCountry() ); |
800 | } | 796 | } |
801 | 797 | ||
802 | /*! | 798 | /*! |
803 | Returns the full name of the contact | 799 | Returns the full name of the contact |
804 | */ | 800 | */ |
805 | QString OContact::fullName() const | 801 | QString OContact::fullName() const |
806 | { | 802 | { |
807 | QString title = find( Qtopia::Title ); | 803 | QString title = find( Qtopia::Title ); |
808 | QString firstName = find( Qtopia::FirstName ); | 804 | QString firstName = find( Qtopia::FirstName ); |
809 | QString middleName = find( Qtopia::MiddleName ); | 805 | QString middleName = find( Qtopia::MiddleName ); |
810 | QString lastName = find( Qtopia::LastName ); | 806 | QString lastName = find( Qtopia::LastName ); |
811 | QString suffix = find( Qtopia::Suffix ); | 807 | QString suffix = find( Qtopia::Suffix ); |
812 | 808 | ||
813 | QString name = title; | 809 | QString name = title; |
814 | if ( !firstName.isEmpty() ) { | 810 | if ( !firstName.isEmpty() ) { |
815 | if ( !name.isEmpty() ) | 811 | if ( !name.isEmpty() ) |
816 | name += " "; | 812 | name += " "; |
817 | name += firstName; | 813 | name += firstName; |
818 | } | 814 | } |
819 | if ( !middleName.isEmpty() ) { | 815 | if ( !middleName.isEmpty() ) { |
820 | if ( !name.isEmpty() ) | 816 | if ( !name.isEmpty() ) |
821 | name += " "; | 817 | name += " "; |
822 | name += middleName; | 818 | name += middleName; |
823 | } | 819 | } |
824 | if ( !lastName.isEmpty() ) { | 820 | if ( !lastName.isEmpty() ) { |
825 | if ( !name.isEmpty() ) | 821 | if ( !name.isEmpty() ) |
826 | name += " "; | 822 | name += " "; |
827 | name += lastName; | 823 | name += lastName; |
828 | } | 824 | } |
829 | if ( !suffix.isEmpty() ) { | 825 | if ( !suffix.isEmpty() ) { |
830 | if ( !name.isEmpty() ) | 826 | if ( !name.isEmpty() ) |
831 | name += " "; | 827 | name += " "; |
832 | name += suffix; | 828 | name += suffix; |
833 | } | 829 | } |
834 | return name.simplifyWhiteSpace(); | 830 | return name.simplifyWhiteSpace(); |
835 | } | 831 | } |
836 | 832 | ||
837 | /*! | 833 | /*! |
838 | Returns a list of the names of the children of the contact. | 834 | Returns a list of the names of the children of the contact. |
839 | */ | 835 | */ |
840 | QStringList OContact::childrenList() const | 836 | QStringList OContact::childrenList() const |
841 | { | 837 | { |
842 | return QStringList::split( " ", find( Qtopia::Children ) ); | 838 | return QStringList::split( " ", find( Qtopia::Children ) ); |
843 | } | 839 | } |
844 | 840 | ||
845 | /*! \fn void OContact::insertEmail( const QString &email ) | 841 | /*! \fn void OContact::insertEmail( const QString &email ) |
846 | 842 | ||
847 | Insert \a email into the email list. Ensures \a email can only be added | 843 | Insert \a email into the email list. Ensures \a email can only be added |
848 | once. If there is no default email address set, it sets it to the \a email. | 844 | once. If there is no default email address set, it sets it to the \a email. |
849 | */ | 845 | */ |
850 | 846 | ||
851 | /*! \fn void OContact::removeEmail( const QString &email ) | 847 | /*! \fn void OContact::removeEmail( const QString &email ) |
852 | 848 | ||
853 | Removes the \a email from the email list. If the default email was \a email, | 849 | Removes the \a email from the email list. If the default email was \a email, |
854 | then the default email address is assigned to the first email in the | 850 | then the default email address is assigned to the first email in the |
855 | email list | 851 | email list |
856 | */ | 852 | */ |
857 | 853 | ||
858 | /*! \fn void OContact::clearEmails() | 854 | /*! \fn void OContact::clearEmails() |
859 | 855 | ||
860 | Clears the email list. | 856 | Clears the email list. |
861 | */ | 857 | */ |
862 | 858 | ||
863 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) | 859 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) |
864 | 860 | ||
865 | Appends the \a emailList to the exiting email list | 861 | Appends the \a emailList to the exiting email list |
866 | */ | 862 | */ |
867 | 863 | ||
868 | /*! | 864 | /*! |
869 | Returns a list of email addresses belonging to the contact, including | 865 | Returns a list of email addresses belonging to the contact, including |
870 | the default email address. | 866 | the default email address. |
871 | */ | 867 | */ |
872 | QStringList OContact::emailList() const | 868 | QStringList OContact::emailList() const |
873 | { | 869 | { |
874 | QString emailStr = emails(); | 870 | QString emailStr = emails(); |
875 | 871 | ||
876 | QStringList r; | 872 | QStringList r; |
877 | if ( !emailStr.isEmpty() ) { | 873 | if ( !emailStr.isEmpty() ) { |
878 | qDebug(" emailstr "); | 874 | qDebug(" emailstr "); |
879 | QStringList l = QStringList::split( emailSeparator(), emailStr ); | 875 | QStringList l = QStringList::split( emailSeparator(), emailStr ); |
880 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) | 876 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) |
881 | r += (*it).simplifyWhiteSpace(); | 877 | r += (*it).simplifyWhiteSpace(); |
882 | } | 878 | } |
883 | 879 | ||
884 | return r; | 880 | return r; |
885 | } | 881 | } |
886 | 882 | ||
887 | /*! | 883 | /*! |
888 | \overload | 884 | \overload |
889 | 885 | ||
890 | Generates the string for the contact to be filed as from the first, | 886 | Generates the string for the contact to be filed as from the first, |
891 | middle and last name of the contact. | 887 | middle and last name of the contact. |
892 | */ | 888 | */ |
893 | void OContact::setFileAs() | 889 | void OContact::setFileAs() |
894 | { | 890 | { |
895 | QString lastName, firstName, middleName, fileas; | 891 | QString lastName, firstName, middleName, fileas; |
896 | 892 | ||
897 | lastName = find( Qtopia::LastName ); | 893 | lastName = find( Qtopia::LastName ); |
898 | firstName = find( Qtopia::FirstName ); | 894 | firstName = find( Qtopia::FirstName ); |
899 | middleName = find( Qtopia::MiddleName ); | 895 | middleName = find( Qtopia::MiddleName ); |
900 | if ( !lastName.isEmpty() && !firstName.isEmpty() | 896 | if ( !lastName.isEmpty() && !firstName.isEmpty() |
901 | && !middleName.isEmpty() ) | 897 | && !middleName.isEmpty() ) |
902 | fileas = lastName + ", " + firstName + " " + middleName; | 898 | fileas = lastName + ", " + firstName + " " + middleName; |
903 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) | 899 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) |
904 | fileas = lastName + ", " + firstName; | 900 | fileas = lastName + ", " + firstName; |
905 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || | 901 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || |
906 | !middleName.isEmpty() ) | 902 | !middleName.isEmpty() ) |
907 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) | 903 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) |
908 | + middleName + ( middleName.isEmpty() ? "" : " " ) | 904 | + middleName + ( middleName.isEmpty() ? "" : " " ) |
909 | + lastName; | 905 | + lastName; |
910 | 906 | ||
911 | replace( Qtopia::FileAs, fileas ); | 907 | replace( Qtopia::FileAs, fileas ); |
912 | } | 908 | } |
913 | 909 | ||
914 | /*! | 910 | /*! |
915 | \internal | 911 | \internal |
916 | Appends the contact information to \a buf. | 912 | Appends the contact information to \a buf. |
917 | */ | 913 | */ |
918 | void OContact::save( QString &buf ) const | 914 | void OContact::save( QString &buf ) const |
919 | { | 915 | { |
920 | static const QStringList SLFIELDS = fields(); | 916 | static const QStringList SLFIELDS = fields(); |
921 | // I'm expecting "<Contact " in front of this... | 917 | // I'm expecting "<Contact " in front of this... |
922 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); | 918 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); |
923 | it != mMap.end(); ++it ) { | 919 | it != mMap.end(); ++it ) { |
924 | const QString &value = it.data(); | 920 | const QString &value = it.data(); |
925 | int key = it.key(); | 921 | int key = it.key(); |
926 | if ( !value.isEmpty() ) { | 922 | if ( !value.isEmpty() ) { |
927 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) | 923 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) |
928 | continue; | 924 | continue; |
929 | 925 | ||
930 | key -= Qtopia::AddressCategory+1; | 926 | key -= Qtopia::AddressCategory+1; |
931 | buf += SLFIELDS[key]; | 927 | buf += SLFIELDS[key]; |
932 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; | 928 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; |
933 | } | 929 | } |
934 | } | 930 | } |
935 | buf += customToXml(); | 931 | buf += customToXml(); |
936 | if ( categories().count() > 0 ) | 932 | if ( categories().count() > 0 ) |
937 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; | 933 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; |
938 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; | 934 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; |
939 | // You need to close this yourself | 935 | // You need to close this yourself |
940 | } | 936 | } |
941 | 937 | ||
942 | 938 | ||
943 | /*! | 939 | /*! |
944 | \internal | 940 | \internal |
945 | Returns the list of fields belonging to a contact | 941 | Returns the list of fields belonging to a contact |
946 | Never change order of this list ! It has to be regarding | 942 | Never change order of this list ! It has to be regarding |
947 | enum AddressBookFields !! | 943 | enum AddressBookFields !! |
948 | */ | 944 | */ |
949 | QStringList OContact::fields() | 945 | QStringList OContact::fields() |
950 | { | 946 | { |
951 | QStringList list; | 947 | QStringList list; |
952 | 948 | ||
953 | list.append( "Title" ); // Not Used! | 949 | list.append( "Title" ); // Not Used! |
954 | list.append( "FirstName" ); | 950 | list.append( "FirstName" ); |
955 | list.append( "MiddleName" ); | 951 | list.append( "MiddleName" ); |
956 | list.append( "LastName" ); | 952 | list.append( "LastName" ); |
957 | list.append( "Suffix" ); | 953 | list.append( "Suffix" ); |
958 | list.append( "FileAs" ); | 954 | list.append( "FileAs" ); |
959 | 955 | ||
960 | list.append( "JobTitle" ); | 956 | list.append( "JobTitle" ); |
961 | list.append( "Department" ); | 957 | list.append( "Department" ); |
962 | list.append( "Company" ); | 958 | list.append( "Company" ); |
963 | list.append( "BusinessPhone" ); | 959 | list.append( "BusinessPhone" ); |
964 | list.append( "BusinessFax" ); | 960 | list.append( "BusinessFax" ); |
965 | list.append( "BusinessMobile" ); | 961 | list.append( "BusinessMobile" ); |
966 | 962 | ||
967 | list.append( "DefaultEmail" ); | 963 | list.append( "DefaultEmail" ); |
968 | list.append( "Emails" ); | 964 | list.append( "Emails" ); |
969 | 965 | ||
970 | list.append( "HomePhone" ); | 966 | list.append( "HomePhone" ); |
971 | list.append( "HomeFax" ); | 967 | list.append( "HomeFax" ); |
972 | list.append( "HomeMobile" ); | 968 | list.append( "HomeMobile" ); |
973 | 969 | ||
974 | list.append( "BusinessStreet" ); | 970 | list.append( "BusinessStreet" ); |
975 | list.append( "BusinessCity" ); | 971 | list.append( "BusinessCity" ); |
976 | list.append( "BusinessState" ); | 972 | list.append( "BusinessState" ); |
977 | list.append( "BusinessZip" ); | 973 | list.append( "BusinessZip" ); |
978 | list.append( "BusinessCountry" ); | 974 | list.append( "BusinessCountry" ); |
979 | list.append( "BusinessPager" ); | 975 | list.append( "BusinessPager" ); |
980 | list.append( "BusinessWebPage" ); | 976 | list.append( "BusinessWebPage" ); |
981 | 977 | ||
982 | list.append( "Office" ); | 978 | list.append( "Office" ); |
983 | list.append( "Profession" ); | 979 | list.append( "Profession" ); |
984 | list.append( "Assistant" ); | 980 | list.append( "Assistant" ); |
985 | list.append( "Manager" ); | 981 | list.append( "Manager" ); |
986 | 982 | ||
987 | list.append( "HomeStreet" ); | 983 | list.append( "HomeStreet" ); |
988 | list.append( "HomeCity" ); | 984 | list.append( "HomeCity" ); |
989 | list.append( "HomeState" ); | 985 | list.append( "HomeState" ); |
990 | list.append( "HomeZip" ); | 986 | list.append( "HomeZip" ); |
991 | list.append( "HomeCountry" ); | 987 | list.append( "HomeCountry" ); |
992 | list.append( "HomeWebPage" ); | 988 | list.append( "HomeWebPage" ); |
993 | 989 | ||
994 | list.append( "Spouse" ); | 990 | list.append( "Spouse" ); |
995 | list.append( "Gender" ); | 991 | list.append( "Gender" ); |
996 | list.append( "Birthday" ); | 992 | list.append( "Birthday" ); |
997 | list.append( "Anniversary" ); | 993 | list.append( "Anniversary" ); |
998 | list.append( "Nickname" ); | 994 | list.append( "Nickname" ); |
999 | list.append( "Children" ); | 995 | list.append( "Children" ); |
1000 | 996 | ||
1001 | list.append( "Notes" ); | 997 | list.append( "Notes" ); |
1002 | list.append( "Groups" ); | 998 | list.append( "Groups" ); |
1003 | 999 | ||
1004 | return list; | 1000 | return list; |
1005 | } | 1001 | } |
1006 | 1002 | ||
1007 | 1003 | ||
1008 | /*! | 1004 | /*! |
1009 | Sets the list of email address for contact to those contained in \a str. | 1005 | Sets the list of email address for contact to those contained in \a str. |
1010 | Email address should be separated by ';'s. | 1006 | Email address should be separated by ';'s. |
1011 | */ | 1007 | */ |
1012 | void OContact::setEmails( const QString &str ) | 1008 | void OContact::setEmails( const QString &str ) |
1013 | { | 1009 | { |
1014 | replace( Qtopia::Emails, str ); | 1010 | replace( Qtopia::Emails, str ); |
1015 | if ( str.isEmpty() ) | 1011 | if ( str.isEmpty() ) |
1016 | setDefaultEmail( QString::null ); | 1012 | setDefaultEmail( QString::null ); |
1017 | } | 1013 | } |
1018 | 1014 | ||
1019 | /*! | 1015 | /*! |
1020 | Sets the list of children for the contact to those contained in \a str. | 1016 | Sets the list of children for the contact to those contained in \a str. |
1021 | */ | 1017 | */ |
1022 | void OContact::setChildren( const QString &str ) | 1018 | void OContact::setChildren( const QString &str ) |
1023 | { | 1019 | { |
1024 | replace( Qtopia::Children, str ); | 1020 | replace( Qtopia::Children, str ); |
1025 | } | 1021 | } |
1026 | 1022 | ||
1027 | /*! | 1023 | /*! |
1028 | \overload | 1024 | \overload |
1029 | Returns TRUE if the contact matches the regular expression \a regexp. | 1025 | Returns TRUE if the contact matches the regular expression \a regexp. |
1030 | Otherwise returns FALSE. | 1026 | Otherwise returns FALSE. |
1031 | */ | 1027 | */ |
1032 | bool OContact::match( const QRegExp &r ) const | 1028 | bool OContact::match( const QRegExp &r ) const |
1033 | { | 1029 | { |
1034 | setLastHitField( -1 ); | 1030 | setLastHitField( -1 ); |
1035 | bool match; | 1031 | bool match; |
1036 | match = false; | 1032 | match = false; |
1037 | QMap<int, QString>::ConstIterator it; | 1033 | QMap<int, QString>::ConstIterator it; |
1038 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { | 1034 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { |
1039 | if ( (*it).find( r ) > -1 ) { | 1035 | if ( (*it).find( r ) > -1 ) { |
1040 | setLastHitField( it.key() ); | 1036 | setLastHitField( it.key() ); |
1041 | match = true; | 1037 | match = true; |
1042 | break; | 1038 | break; |
1043 | } | 1039 | } |
1044 | } | 1040 | } |
1045 | return match; | 1041 | return match; |
1046 | } | 1042 | } |
1047 | 1043 | ||
1048 | 1044 | ||
1049 | QString OContact::toShortText() const | 1045 | QString OContact::toShortText() const |
1050 | { | 1046 | { |
1051 | return ( fullName() ); | 1047 | return ( fullName() ); |
1052 | } | 1048 | } |
1053 | QString OContact::type() const | 1049 | QString OContact::type() const |
1054 | { | 1050 | { |
1055 | return QString::fromLatin1( "OContact" ); | 1051 | return QString::fromLatin1( "OContact" ); |
1056 | } | 1052 | } |
1057 | 1053 | ||
1058 | 1054 | ||
1059 | 1055 | ||
1060 | class QString OContact::recordField( int pos ) const | 1056 | class QString OContact::recordField( int pos ) const |
1061 | { | 1057 | { |
1062 | QStringList SLFIELDS = fields(); // ?? why this ? (se) | 1058 | QStringList SLFIELDS = fields(); // ?? why this ? (se) |
1063 | return SLFIELDS[pos]; | 1059 | return SLFIELDS[pos]; |
1064 | } | 1060 | } |
1065 | 1061 | ||
1066 | // In future releases, we should store birthday and anniversary | 1062 | // In future releases, we should store birthday and anniversary |
1067 | // internally as QDate instead of QString ! | 1063 | // internally as QDate instead of QString ! |
1068 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) | 1064 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) |
1069 | 1065 | ||
1070 | /*! \fn void OContact::setBirthday( const QDate& date ) | 1066 | /*! \fn void OContact::setBirthday( const QDate& date ) |
1071 | Sets the birthday for the contact to \a date. If date is null | 1067 | Sets the birthday for the contact to \a date. If date is null |
1072 | the current stored date will be removed. | 1068 | the current stored date will be removed. |
1073 | */ | 1069 | */ |
1074 | void OContact::setBirthday( const QDate &v ) | 1070 | void OContact::setBirthday( const QDate &v ) |
1075 | { | 1071 | { |
1076 | if ( v.isNull() ){ | 1072 | if ( v.isNull() ){ |
1077 | qWarning( "Remove Birthday"); | 1073 | qWarning( "Remove Birthday"); |
1078 | replace( Qtopia::Birthday, QString::null ); | 1074 | replace( Qtopia::Birthday, QString::null ); |
1079 | return; | 1075 | return; |
1080 | } | 1076 | } |
1081 | 1077 | ||
1082 | if ( v.isValid() ) | 1078 | if ( v.isValid() ) |
1083 | replace( Qtopia::Birthday, OConversion::dateToString( v ) ); | 1079 | replace( Qtopia::Birthday, OConversion::dateToString( v ) ); |
1084 | 1080 | ||
1085 | } | 1081 | } |
1086 | 1082 | ||
1087 | 1083 | ||
1088 | /*! \fn void OContact::setAnniversary( const QDate &date ) | 1084 | /*! \fn void OContact::setAnniversary( const QDate &date ) |
1089 | Sets the anniversary of the contact to \a date. If date is | 1085 | Sets the anniversary of the contact to \a date. If date is |
1090 | null, the current stored date will be removed. | 1086 | null, the current stored date will be removed. |
1091 | */ | 1087 | */ |
1092 | void OContact::setAnniversary( const QDate &v ) | 1088 | void OContact::setAnniversary( const QDate &v ) |
1093 | { | 1089 | { |
1094 | if ( v.isNull() ){ | 1090 | if ( v.isNull() ){ |
1095 | qWarning( "Remove Anniversary"); | 1091 | qWarning( "Remove Anniversary"); |
1096 | replace( Qtopia::Anniversary, QString::null ); | 1092 | replace( Qtopia::Anniversary, QString::null ); |
1097 | return; | 1093 | return; |
1098 | } | 1094 | } |
1099 | 1095 | ||
1100 | if ( v.isValid() ) | 1096 | if ( v.isValid() ) |
1101 | replace( Qtopia::Anniversary, OConversion::dateToString( v ) ); | 1097 | replace( Qtopia::Anniversary, OConversion::dateToString( v ) ); |
1102 | } | 1098 | } |
1103 | 1099 | ||
1104 | /*! \fn QDate OContact::birthday() const | 1100 | /*! \fn QDate OContact::birthday() const |
1105 | Returns the birthday of the contact. | 1101 | Returns the birthday of the contact. |
1106 | */ | 1102 | */ |
1107 | QDate OContact::birthday() const | 1103 | QDate OContact::birthday() const |
1108 | { | 1104 | { |
1109 | QString str = find( Qtopia::Birthday ); | 1105 | QString str = find( Qtopia::Birthday ); |
1110 | // qWarning ("Birthday %s", str.latin1() ); | 1106 | // qWarning ("Birthday %s", str.latin1() ); |
1111 | if ( !str.isEmpty() ) | 1107 | if ( !str.isEmpty() ) |
1112 | return OConversion::dateFromString ( str ); | 1108 | return OConversion::dateFromString ( str ); |
1113 | else | 1109 | else |
1114 | return QDate(); | 1110 | return QDate(); |
1115 | } | 1111 | } |
1116 | 1112 | ||
1117 | 1113 | ||
1118 | /*! \fn QDate OContact::anniversary() const | 1114 | /*! \fn QDate OContact::anniversary() const |
1119 | Returns the anniversary of the contact. | 1115 | Returns the anniversary of the contact. |
1120 | */ | 1116 | */ |
1121 | QDate OContact::anniversary() const | 1117 | QDate OContact::anniversary() const |
1122 | { | 1118 | { |
1123 | QDate empty; | 1119 | QDate empty; |
1124 | QString str = find( Qtopia::Anniversary ); | 1120 | QString str = find( Qtopia::Anniversary ); |
1125 | // qWarning ("Anniversary %s", str.latin1() ); | 1121 | // qWarning ("Anniversary %s", str.latin1() ); |
1126 | if ( !str.isEmpty() ) | 1122 | if ( !str.isEmpty() ) |
1127 | return OConversion::dateFromString ( str ); | 1123 | return OConversion::dateFromString ( str ); |
1128 | else | 1124 | else |
1129 | return empty; | 1125 | return empty; |
1130 | } | 1126 | } |
1131 | 1127 | ||
1132 | 1128 | ||
1133 | void OContact::insertEmail( const QString &v ) | 1129 | void OContact::insertEmail( const QString &v ) |
1134 | { | 1130 | { |
1135 | //qDebug("insertEmail %s", v.latin1()); | 1131 | //qDebug("insertEmail %s", v.latin1()); |
1136 | QString e = v.simplifyWhiteSpace(); | 1132 | QString e = v.simplifyWhiteSpace(); |
1137 | QString def = defaultEmail(); | 1133 | QString def = defaultEmail(); |
1138 | 1134 | ||
1139 | // if no default, set it as the default email and don't insert | 1135 | // if no default, set it as the default email and don't insert |
1140 | if ( def.isEmpty() ) { | 1136 | if ( def.isEmpty() ) { |
1141 | setDefaultEmail( e ); // will insert into the list for us | 1137 | setDefaultEmail( e ); // will insert into the list for us |
1142 | return; | 1138 | return; |
1143 | } | 1139 | } |
1144 | 1140 | ||
1145 | // otherwise, insert assuming doesn't already exist | 1141 | // otherwise, insert assuming doesn't already exist |
1146 | QString emailsStr = find( Qtopia::Emails ); | 1142 | QString emailsStr = find( Qtopia::Emails ); |
1147 | if ( emailsStr.contains( e )) | 1143 | if ( emailsStr.contains( e )) |
1148 | return; | 1144 | return; |
1149 | if ( !emailsStr.isEmpty() ) | 1145 | if ( !emailsStr.isEmpty() ) |
1150 | emailsStr += emailSeparator(); | 1146 | emailsStr += emailSeparator(); |
1151 | emailsStr += e; | 1147 | emailsStr += e; |
1152 | replace( Qtopia::Emails, emailsStr ); | 1148 | replace( Qtopia::Emails, emailsStr ); |
1153 | } | 1149 | } |
1154 | 1150 | ||
1155 | void OContact::removeEmail( const QString &v ) | 1151 | void OContact::removeEmail( const QString &v ) |
1156 | { | 1152 | { |
1157 | QString e = v.simplifyWhiteSpace(); | 1153 | QString e = v.simplifyWhiteSpace(); |
1158 | QString def = defaultEmail(); | 1154 | QString def = defaultEmail(); |
1159 | QString emailsStr = find( Qtopia::Emails ); | 1155 | QString emailsStr = find( Qtopia::Emails ); |
1160 | QStringList emails = emailList(); | 1156 | QStringList emails = emailList(); |
1161 | 1157 | ||
1162 | // otherwise, must first contain it | 1158 | // otherwise, must first contain it |
1163 | if ( !emailsStr.contains( e ) ) | 1159 | if ( !emailsStr.contains( e ) ) |
1164 | return; | 1160 | return; |
1165 | 1161 | ||
1166 | // remove it | 1162 | // remove it |
1167 | //qDebug(" removing email from list %s", e.latin1()); | 1163 | //qDebug(" removing email from list %s", e.latin1()); |
1168 | emails.remove( e ); | 1164 | emails.remove( e ); |
1169 | // reset the string | 1165 | // reset the string |
1170 | emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator | 1166 | emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator |
1171 | replace( Qtopia::Emails, emailsStr ); | 1167 | replace( Qtopia::Emails, emailsStr ); |
1172 | 1168 | ||
1173 | // if default, then replace the default email with the first one | 1169 | // if default, then replace the default email with the first one |
1174 | if ( def == e ) { | 1170 | if ( def == e ) { |
1175 | //qDebug("removeEmail is default; setting new default"); | 1171 | //qDebug("removeEmail is default; setting new default"); |
1176 | if ( !emails.count() ) | 1172 | if ( !emails.count() ) |
1177 | clearEmails(); | 1173 | clearEmails(); |
1178 | else // setDefaultEmail will remove e from the list | 1174 | else // setDefaultEmail will remove e from the list |
1179 | setDefaultEmail( emails.first() ); | 1175 | setDefaultEmail( emails.first() ); |
1180 | } | 1176 | } |
1181 | } | 1177 | } |
1182 | void OContact::clearEmails() | 1178 | void OContact::clearEmails() |
1183 | { | 1179 | { |
1184 | mMap.remove( Qtopia::DefaultEmail ); | 1180 | mMap.remove( Qtopia::DefaultEmail ); |
1185 | mMap.remove( Qtopia::Emails ); | 1181 | mMap.remove( Qtopia::Emails ); |
1186 | } | 1182 | } |
1187 | void OContact::setDefaultEmail( const QString &v ) | 1183 | void OContact::setDefaultEmail( const QString &v ) |
1188 | { | 1184 | { |
1189 | QString e = v.simplifyWhiteSpace(); | 1185 | QString e = v.simplifyWhiteSpace(); |
1190 | 1186 | ||
1191 | //qDebug("OContact::setDefaultEmail %s", e.latin1()); | 1187 | //qDebug("OContact::setDefaultEmail %s", e.latin1()); |
1192 | replace( Qtopia::DefaultEmail, e ); | 1188 | replace( Qtopia::DefaultEmail, e ); |
1193 | 1189 | ||
1194 | if ( !e.isEmpty() ) | 1190 | if ( !e.isEmpty() ) |
1195 | insertEmail( e ); | 1191 | insertEmail( e ); |
1196 | 1192 | ||
1197 | } | 1193 | } |
1198 | 1194 | ||
1199 | void OContact::insertEmails( const QStringList &v ) | 1195 | void OContact::insertEmails( const QStringList &v ) |
1200 | { | 1196 | { |
1201 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) | 1197 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) |
1202 | insertEmail( *it ); | 1198 | insertEmail( *it ); |
1203 | } | 1199 | } |
1204 | int OContact::rtti() { | 1200 | int OContact::rtti() { |
1205 | return OPimResolver::AddressBook; | 1201 | return OPimResolver::AddressBook; |
1206 | } | 1202 | } |
1207 | void OContact::setUid( int i ) | 1203 | void OContact::setUid( int i ) |
1208 | { | 1204 | { |
1209 | OPimRecord::setUid(i); | 1205 | OPimRecord::setUid(i); |
1210 | replace( Qtopia::AddressUid , QString::number(i)); | 1206 | replace( Qtopia::AddressUid , QString::number(i)); |
1211 | } | 1207 | } |
diff --git a/libopie2/opiepim/ocontact.cpp b/libopie2/opiepim/ocontact.cpp index 0f05b65..fcf3b26 100644 --- a/libopie2/opiepim/ocontact.cpp +++ b/libopie2/opiepim/ocontact.cpp | |||
@@ -1,1211 +1,1207 @@ | |||
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-2003 by Stefan Eilers (eilers.stefan@epost.de) | 3 | ** Copyright (C) 2002-2003 by Stefan Eilers (eilers.stefan@epost.de) |
4 | ** | 4 | ** |
5 | ** This file may be distributed and/or modified under the terms of the | 5 | ** This file may be distributed and/or modified under the terms of the |
6 | ** GNU General Public License version 2 as published by the Free Software | 6 | ** GNU General Public License version 2 as published by the Free Software |
7 | ** Foundation and appearing in the file LICENSE.GPL included in the | 7 | ** Foundation and appearing in the file LICENSE.GPL included in the |
8 | ** packaging of this file. | 8 | ** packaging of this file. |
9 | ** | 9 | ** |
10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 10 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 11 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
12 | ** | 12 | ** |
13 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. | 13 | ** See http://www.trolltech.com/gpl/ for GPL licensing information. |
14 | ** | 14 | ** |
15 | ** Contact info@trolltech.com if any conditions of this licensing are | 15 | ** Contact info@trolltech.com if any conditions of this licensing are |
16 | ** not clear to you. | 16 | ** not clear to you. |
17 | ** | 17 | ** |
18 | **********************************************************************/ | 18 | **********************************************************************/ |
19 | 19 | ||
20 | #define QTOPIA_INTERNAL_CONTACT_MRE | 20 | #define QTOPIA_INTERNAL_CONTACT_MRE |
21 | 21 | ||
22 | #include "ocontact.h" | 22 | #include "ocontact.h" |
23 | #include "opimresolver.h" | 23 | #include "opimresolver.h" |
24 | #include "oconversion.h" | 24 | #include "oconversion.h" |
25 | 25 | ||
26 | #include <qpe/stringutil.h> | 26 | #include <qpe/stringutil.h> |
27 | #include <qpe/timestring.h> | 27 | #include <qpe/timestring.h> |
28 | #include <qpe/config.h> | 28 | #include <qpe/config.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 | QString str; | 439 | QString str; |
440 | bool marker = false; | 440 | bool marker = false; |
441 | 441 | ||
442 | Config cfg("qpe"); | 442 | Config cfg("qpe"); |
443 | cfg.setGroup("Appearance"); | 443 | cfg.setGroup("Appearance"); |
444 | int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State ); | 444 | int addressformat = cfg.readNumEntry( "AddressFormat", Zip_City_State ); |
445 | 445 | ||
446 | // name, jobtitle and company | 446 | // name, jobtitle and company |
447 | if ( !(value = fullName()).isEmpty() ) | 447 | if ( !(value = fullName()).isEmpty() ) |
448 | text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>"; | 448 | text += "<b><h3><img src=\"addressbook/AddressBook\"> " + Qtopia::escapeString(value) + "</h3></b>"; |
449 | 449 | ||
450 | if ( !(value = jobTitle()).isEmpty() ) | 450 | if ( !(value = jobTitle()).isEmpty() ) |
451 | text += Qtopia::escapeString(value); | 451 | text += Qtopia::escapeString(value) + " "; |
452 | 452 | ||
453 | comp = company(); | 453 | comp = company(); |
454 | if ( !(value = department()).isEmpty() ) { | 454 | if ( !(value = department()).isEmpty() ) { |
455 | text += Qtopia::escapeString(value); | 455 | text += Qtopia::escapeString(value); |
456 | if ( comp ) | 456 | if ( comp ) |
457 | text += ", "; | 457 | text += ", " + Qtopia::escapeString(comp); |
458 | else | 458 | }else if ( comp ) |
459 | text += "<br>"; | 459 | text += "<br>" + Qtopia::escapeString(comp); |
460 | } | ||
461 | if ( !comp.isEmpty() ) | ||
462 | text += Qtopia::escapeString(comp); | ||
463 | |||
464 | text += "<br><hr>"; | 460 | text += "<br><hr>"; |
465 | 461 | ||
466 | // defailt email | 462 | // defailt email |
467 | QString defEmail = defaultEmail(); | 463 | QString defEmail = defaultEmail(); |
468 | if ( !defEmail.isEmpty() ){ | 464 | if ( !defEmail.isEmpty() ){ |
469 | text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>" | 465 | text += "<b><img src=\"addressbook/email\"> " + QObject::tr("Default Email: ") + "</b>" |
470 | + Qtopia::escapeString(defEmail); | 466 | + Qtopia::escapeString(defEmail); |
471 | marker = true; | 467 | marker = true; |
472 | } | 468 | } |
473 | 469 | ||
474 | // business address | 470 | // business address |
475 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || | 471 | if ( !businessStreet().isEmpty() || !businessCity().isEmpty() || |
476 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { | 472 | !businessZip().isEmpty() || !businessCountry().isEmpty() ) { |
477 | text += QObject::tr( "<br><b>Work Address:</b>" ); | 473 | text += QObject::tr( "<br><b>Work Address:</b>" ); |
478 | marker = true; | 474 | marker = true; |
479 | } | 475 | } |
480 | 476 | ||
481 | if ( !(value = businessStreet()).isEmpty() ){ | 477 | if ( !(value = businessStreet()).isEmpty() ){ |
482 | text += "<br>" + Qtopia::escapeString(value); | 478 | text += "<br>" + Qtopia::escapeString(value); |
483 | marker = true; | 479 | marker = true; |
484 | } | 480 | } |
485 | 481 | ||
486 | switch( addressformat ){ | 482 | switch( addressformat ){ |
487 | case Zip_City_State:{ // Zip_Code City, State | 483 | case Zip_City_State:{ // Zip_Code City, State |
488 | state = businessState(); | 484 | state = businessState(); |
489 | if ( !(value = businessZip()).isEmpty() ){ | 485 | if ( !(value = businessZip()).isEmpty() ){ |
490 | text += "<br>" + Qtopia::escapeString(value) + " "; | 486 | text += "<br>" + Qtopia::escapeString(value) + " "; |
491 | marker = true; | 487 | marker = true; |
492 | 488 | ||
493 | } | 489 | } |
494 | if ( !(value = businessCity()).isEmpty() ) { | 490 | if ( !(value = businessCity()).isEmpty() ) { |
495 | marker = true; | 491 | marker = true; |
496 | if ( businessZip().isEmpty() && !businessStreet().isEmpty() ) | 492 | if ( businessZip().isEmpty() && !businessStreet().isEmpty() ) |
497 | text += "<br>"; | 493 | text += "<br>"; |
498 | text += Qtopia::escapeString(value); | 494 | text += Qtopia::escapeString(value); |
499 | if ( state ) | 495 | if ( state ) |
500 | text += ", " + Qtopia::escapeString(state); | 496 | text += ", " + Qtopia::escapeString(state); |
501 | } else if ( !state.isEmpty() ){ | 497 | } else if ( !state.isEmpty() ){ |
502 | text += "<br>" + Qtopia::escapeString(state); | 498 | text += "<br>" + Qtopia::escapeString(state); |
503 | marker = true; | 499 | marker = true; |
504 | } | 500 | } |
505 | break; | 501 | break; |
506 | } | 502 | } |
507 | case City_State_Zip:{ // City, State Zip_Code | 503 | case City_State_Zip:{ // City, State Zip_Code |
508 | state = businessState(); | 504 | state = businessState(); |
509 | if ( !(value = businessCity()).isEmpty() ) { | 505 | if ( !(value = businessCity()).isEmpty() ) { |
510 | marker = true; | 506 | marker = true; |
511 | text += "<br>" + Qtopia::escapeString(value); | 507 | text += "<br>" + Qtopia::escapeString(value); |
512 | if ( state ) | 508 | if ( state ) |
513 | text += ", " + Qtopia::escapeString(state); | 509 | text += ", " + Qtopia::escapeString(state); |
514 | } else if ( !state.isEmpty() ){ | 510 | } else if ( !state.isEmpty() ){ |
515 | text += "<br>" + Qtopia::escapeString(state); | 511 | text += "<br>" + Qtopia::escapeString(state); |
516 | marker = true; | 512 | marker = true; |
517 | } | 513 | } |
518 | if ( !(value = businessZip()).isEmpty() ){ | 514 | if ( !(value = businessZip()).isEmpty() ){ |
519 | text += " " + Qtopia::escapeString(value); | 515 | text += " " + Qtopia::escapeString(value); |
520 | marker = true; | 516 | marker = true; |
521 | } | 517 | } |
522 | break; | 518 | break; |
523 | } | 519 | } |
524 | } | 520 | } |
525 | 521 | ||
526 | if ( !(value = businessCountry()).isEmpty() ){ | 522 | if ( !(value = businessCountry()).isEmpty() ){ |
527 | text += "<br>" + Qtopia::escapeString(value); | 523 | text += "<br>" + Qtopia::escapeString(value); |
528 | marker = true; | 524 | marker = true; |
529 | } | 525 | } |
530 | 526 | ||
531 | // rest of Business data | 527 | // rest of Business data |
532 | str = office(); | 528 | str = office(); |
533 | if ( !str.isEmpty() ){ | 529 | if ( !str.isEmpty() ){ |
534 | text += "<br><b>" + QObject::tr("Office: ") + "</b>" | 530 | text += "<br><b>" + QObject::tr("Office: ") + "</b>" |
535 | + Qtopia::escapeString(str); | 531 | + Qtopia::escapeString(str); |
536 | marker = true; | 532 | marker = true; |
537 | } | 533 | } |
538 | str = businessWebpage(); | 534 | str = businessWebpage(); |
539 | if ( !str.isEmpty() ){ | 535 | if ( !str.isEmpty() ){ |
540 | text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" | 536 | text += "<br><b><img src=\"addressbook/webpagework\"> " + QObject::tr("Business Web Page: ") + "</b>" |
541 | + Qtopia::escapeString(str); | 537 | + Qtopia::escapeString(str); |
542 | marker = true; | 538 | marker = true; |
543 | } | 539 | } |
544 | str = businessPhone(); | 540 | str = businessPhone(); |
545 | if ( !str.isEmpty() ){ | 541 | if ( !str.isEmpty() ){ |
546 | text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" | 542 | text += "<br><b><img src=\"addressbook/phonework\"> " + QObject::tr("Business Phone: ") + "</b>" |
547 | + Qtopia::escapeString(str); | 543 | + Qtopia::escapeString(str); |
548 | marker = true; | 544 | marker = true; |
549 | } | 545 | } |
550 | str = businessFax(); | 546 | str = businessFax(); |
551 | if ( !str.isEmpty() ){ | 547 | if ( !str.isEmpty() ){ |
552 | text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" | 548 | text += "<br><b><img src=\"addressbook/faxwork\"> " + QObject::tr("Business Fax: ") + "</b>" |
553 | + Qtopia::escapeString(str); | 549 | + Qtopia::escapeString(str); |
554 | marker = true; | 550 | marker = true; |
555 | } | 551 | } |
556 | str = businessMobile(); | 552 | str = businessMobile(); |
557 | if ( !str.isEmpty() ){ | 553 | if ( !str.isEmpty() ){ |
558 | text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" | 554 | text += "<br><b><img src=\"addressbook/mobilework\"> " + QObject::tr("Business Mobile: ") + "</b>" |
559 | + Qtopia::escapeString(str); | 555 | + Qtopia::escapeString(str); |
560 | marker = true; | 556 | marker = true; |
561 | } | 557 | } |
562 | str = businessPager(); | 558 | str = businessPager(); |
563 | if ( !str.isEmpty() ){ | 559 | if ( !str.isEmpty() ){ |
564 | text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" | 560 | text += "<br><b>" + QObject::tr("Business Pager: ") + "</b>" |
565 | + Qtopia::escapeString(str); | 561 | + Qtopia::escapeString(str); |
566 | marker = true; | 562 | marker = true; |
567 | } | 563 | } |
568 | 564 | ||
569 | // text += "<br>"; | 565 | // text += "<br>"; |
570 | 566 | ||
571 | // home address | 567 | // home address |
572 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || | 568 | if ( !homeStreet().isEmpty() || !homeCity().isEmpty() || |
573 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { | 569 | !homeZip().isEmpty() || !homeCountry().isEmpty() ) { |
574 | text += QObject::tr( "<br><b>Home Address:</b>" ); | 570 | text += QObject::tr( "<br><b>Home Address:</b>" ); |
575 | marker = true; | 571 | marker = true; |
576 | } | 572 | } |
577 | 573 | ||
578 | if ( !(value = homeStreet()).isEmpty() ){ | 574 | if ( !(value = homeStreet()).isEmpty() ){ |
579 | text += "<br>" + Qtopia::escapeString(value); | 575 | text += "<br>" + Qtopia::escapeString(value); |
580 | marker = true; | 576 | marker = true; |
581 | } | 577 | } |
582 | 578 | ||
583 | switch( addressformat ){ | 579 | switch( addressformat ){ |
584 | case Zip_City_State:{ // Zip_Code City, State | 580 | case Zip_City_State:{ // Zip_Code City, State |
585 | state = homeState(); | 581 | state = homeState(); |
586 | if ( !(value = homeZip()).isEmpty() ){ | 582 | if ( !(value = homeZip()).isEmpty() ){ |
587 | text += "<br>" + Qtopia::escapeString(value) + " "; | 583 | text += "<br>" + Qtopia::escapeString(value) + " "; |
588 | marker = true; | 584 | marker = true; |
589 | } | 585 | } |
590 | if ( !(value = homeCity()).isEmpty() ) { | 586 | if ( !(value = homeCity()).isEmpty() ) { |
591 | marker = true; | 587 | marker = true; |
592 | if ( homeZip().isEmpty() && !homeStreet().isEmpty() ) | 588 | if ( homeZip().isEmpty() && !homeStreet().isEmpty() ) |
593 | text += "<br>"; | 589 | text += "<br>"; |
594 | text += Qtopia::escapeString(value); | 590 | text += Qtopia::escapeString(value); |
595 | if ( !state.isEmpty() ) | 591 | if ( !state.isEmpty() ) |
596 | text += ", " + Qtopia::escapeString(state); | 592 | text += ", " + Qtopia::escapeString(state); |
597 | } else if (!state.isEmpty()) { | 593 | } else if (!state.isEmpty()) { |
598 | text += "<br>" + Qtopia::escapeString(state); | 594 | text += "<br>" + Qtopia::escapeString(state); |
599 | marker = true; | 595 | marker = true; |
600 | } | 596 | } |
601 | break; | 597 | break; |
602 | } | 598 | } |
603 | case City_State_Zip:{ // City, State Zip_Code | 599 | case City_State_Zip:{ // City, State Zip_Code |
604 | state = homeState(); | 600 | state = homeState(); |
605 | if ( !(value = homeCity()).isEmpty() ) { | 601 | if ( !(value = homeCity()).isEmpty() ) { |
606 | marker = true; | 602 | marker = true; |
607 | text += "<br>" + Qtopia::escapeString(value); | 603 | text += "<br>" + Qtopia::escapeString(value); |
608 | if ( state ) | 604 | if ( state ) |
609 | text += ", " + Qtopia::escapeString(state); | 605 | text += ", " + Qtopia::escapeString(state); |
610 | } else if ( !state.isEmpty() ){ | 606 | } else if ( !state.isEmpty() ){ |
611 | text += "<br>" + Qtopia::escapeString(state); | 607 | text += "<br>" + Qtopia::escapeString(state); |
612 | marker = true; | 608 | marker = true; |
613 | } | 609 | } |
614 | if ( !(value = homeZip()).isEmpty() ){ | 610 | if ( !(value = homeZip()).isEmpty() ){ |
615 | text += " " + Qtopia::escapeString(value); | 611 | text += " " + Qtopia::escapeString(value); |
616 | marker = true; | 612 | marker = true; |
617 | } | 613 | } |
618 | break; | 614 | break; |
619 | } | 615 | } |
620 | } | 616 | } |
621 | 617 | ||
622 | if ( !(value = homeCountry()).isEmpty() ){ | 618 | if ( !(value = homeCountry()).isEmpty() ){ |
623 | text += "<br>" + Qtopia::escapeString(value); | 619 | text += "<br>" + Qtopia::escapeString(value); |
624 | marker = true; | 620 | marker = true; |
625 | } | 621 | } |
626 | 622 | ||
627 | // rest of Home data | 623 | // rest of Home data |
628 | str = homeWebpage(); | 624 | str = homeWebpage(); |
629 | if ( !str.isEmpty() ){ | 625 | if ( !str.isEmpty() ){ |
630 | text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" | 626 | text += "<br><b><img src=\"addressbook/webpagehome\"> " + QObject::tr("Home Web Page: ") + "</b>" |
631 | + Qtopia::escapeString(str); | 627 | + Qtopia::escapeString(str); |
632 | marker = true; | 628 | marker = true; |
633 | } | 629 | } |
634 | str = homePhone(); | 630 | str = homePhone(); |
635 | if ( !str.isEmpty() ){ | 631 | if ( !str.isEmpty() ){ |
636 | text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" | 632 | text += "<br><b><img src=\"addressbook/phonehome\"> " + QObject::tr("Home Phone: ") + "</b>" |
637 | + Qtopia::escapeString(str); | 633 | + Qtopia::escapeString(str); |
638 | marker = true; | 634 | marker = true; |
639 | } | 635 | } |
640 | str = homeFax(); | 636 | str = homeFax(); |
641 | if ( !str.isEmpty() ){ | 637 | if ( !str.isEmpty() ){ |
642 | text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>" | 638 | text += "<br><b><img src=\"addressbook/faxhome\"> " + QObject::tr("Home Fax: ") + "</b>" |
643 | + Qtopia::escapeString(str); | 639 | + Qtopia::escapeString(str); |
644 | marker = true; | 640 | marker = true; |
645 | } | 641 | } |
646 | str = homeMobile(); | 642 | str = homeMobile(); |
647 | if ( !str.isEmpty() ){ | 643 | if ( !str.isEmpty() ){ |
648 | text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>" | 644 | text += "<br><b><img src=\"addressbook/mobilehome\"> " + QObject::tr("Home Mobile: ") + "</b>" |
649 | + Qtopia::escapeString(str); | 645 | + Qtopia::escapeString(str); |
650 | marker = true; | 646 | marker = true; |
651 | } | 647 | } |
652 | 648 | ||
653 | if ( marker ) | 649 | if ( marker ) |
654 | text += "<br><hr>"; | 650 | text += "<br><hr>"; |
655 | 651 | ||
656 | // the rest... | 652 | // the rest... |
657 | str = emails(); | 653 | str = emails(); |
658 | if ( !str.isEmpty() && ( str != defEmail ) ) | 654 | if ( !str.isEmpty() && ( str != defEmail ) ) |
659 | text += "<br><b>" + QObject::tr("All Emails: ") + "</b>" | 655 | text += "<br><b>" + QObject::tr("All Emails: ") + "</b>" |
660 | + Qtopia::escapeString(str); | 656 | + Qtopia::escapeString(str); |
661 | str = profession(); | 657 | str = profession(); |
662 | if ( !str.isEmpty() ) | 658 | if ( !str.isEmpty() ) |
663 | text += "<br><b>" + QObject::tr("Profession: ") + "</b>" | 659 | text += "<br><b>" + QObject::tr("Profession: ") + "</b>" |
664 | + Qtopia::escapeString(str); | 660 | + Qtopia::escapeString(str); |
665 | str = assistant(); | 661 | str = assistant(); |
666 | if ( !str.isEmpty() ) | 662 | if ( !str.isEmpty() ) |
667 | text += "<br><b>" + QObject::tr("Assistant: ") + "</b>" | 663 | text += "<br><b>" + QObject::tr("Assistant: ") + "</b>" |
668 | + Qtopia::escapeString(str); | 664 | + Qtopia::escapeString(str); |
669 | str = manager(); | 665 | str = manager(); |
670 | if ( !str.isEmpty() ) | 666 | if ( !str.isEmpty() ) |
671 | text += "<br><b>" + QObject::tr("Manager: ") + "</b>" | 667 | text += "<br><b>" + QObject::tr("Manager: ") + "</b>" |
672 | + Qtopia::escapeString(str); | 668 | + Qtopia::escapeString(str); |
673 | str = gender(); | 669 | str = gender(); |
674 | if ( !str.isEmpty() && str.toInt() != 0 ) { | 670 | if ( !str.isEmpty() && str.toInt() != 0 ) { |
675 | text += "<br>"; | 671 | text += "<br>"; |
676 | if ( str.toInt() == 1 ) | 672 | if ( str.toInt() == 1 ) |
677 | str = QObject::tr( "Male" ); | 673 | str = QObject::tr( "Male" ); |
678 | else if ( str.toInt() == 2 ) | 674 | else if ( str.toInt() == 2 ) |
679 | str = QObject::tr( "Female" ); | 675 | str = QObject::tr( "Female" ); |
680 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str; | 676 | text += "<b>" + QObject::tr("Gender: ") + "</b>" + str; |
681 | } | 677 | } |
682 | str = spouse(); | 678 | str = spouse(); |
683 | if ( !str.isEmpty() ) | 679 | if ( !str.isEmpty() ) |
684 | text += "<br><b>" + QObject::tr("Spouse: ") + "</b>" | 680 | text += "<br><b>" + QObject::tr("Spouse: ") + "</b>" |
685 | + Qtopia::escapeString(str); | 681 | + Qtopia::escapeString(str); |
686 | if ( birthday().isValid() ){ | 682 | if ( birthday().isValid() ){ |
687 | str = TimeString::numberDateString( birthday() ); | 683 | str = TimeString::numberDateString( birthday() ); |
688 | text += "<br><b>" + QObject::tr("Birthday: ") + "</b>" | 684 | text += "<br><b>" + QObject::tr("Birthday: ") + "</b>" |
689 | + Qtopia::escapeString(str); | 685 | + Qtopia::escapeString(str); |
690 | } | 686 | } |
691 | if ( anniversary().isValid() ){ | 687 | if ( anniversary().isValid() ){ |
692 | str = TimeString::numberDateString( anniversary() ); | 688 | str = TimeString::numberDateString( anniversary() ); |
693 | text += "<br><b>" + QObject::tr("Anniversary: ") + "</b>" | 689 | text += "<br><b>" + QObject::tr("Anniversary: ") + "</b>" |
694 | + Qtopia::escapeString(str); | 690 | + Qtopia::escapeString(str); |
695 | } | 691 | } |
696 | str = children(); | 692 | str = children(); |
697 | if ( !str.isEmpty() ) | 693 | if ( !str.isEmpty() ) |
698 | text += "<br><b>" + QObject::tr("Children: ") + "</b>" | 694 | text += "<br><b>" + QObject::tr("Children: ") + "</b>" |
699 | + Qtopia::escapeString(str); | 695 | + Qtopia::escapeString(str); |
700 | 696 | ||
701 | str = nickname(); | 697 | str = nickname(); |
702 | if ( !str.isEmpty() ) | 698 | if ( !str.isEmpty() ) |
703 | text += "<br><b>" + QObject::tr("Nickname: ") + "</b>" | 699 | text += "<br><b>" + QObject::tr("Nickname: ") + "</b>" |
704 | + Qtopia::escapeString(str); | 700 | + Qtopia::escapeString(str); |
705 | 701 | ||
706 | // categories | 702 | // categories |
707 | if ( categoryNames("Contacts").count() ){ | 703 | if ( categoryNames("Contacts").count() ){ |
708 | text += "<br><b>" + QObject::tr( "Category:") + "</b> "; | 704 | text += "<br><b>" + QObject::tr( "Category:") + "</b> "; |
709 | text += categoryNames("Contacts").join(", "); | 705 | text += categoryNames("Contacts").join(", "); |
710 | } | 706 | } |
711 | 707 | ||
712 | // notes last | 708 | // notes last |
713 | if ( !(value = notes()).isEmpty() ) { | 709 | if ( !(value = notes()).isEmpty() ) { |
714 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; | 710 | text += "<br><hr><b>" + QObject::tr( "Notes:") + "</b> "; |
715 | QRegExp reg("\n"); | 711 | QRegExp reg("\n"); |
716 | 712 | ||
717 | //QString tmp = Qtopia::escapeString(value); | 713 | //QString tmp = Qtopia::escapeString(value); |
718 | QString tmp = QStyleSheet::convertFromPlainText(value); | 714 | QString tmp = QStyleSheet::convertFromPlainText(value); |
719 | //tmp.replace( reg, "<br>" ); | 715 | //tmp.replace( reg, "<br>" ); |
720 | text += "<br>" + tmp + "<br>"; | 716 | text += "<br>" + tmp + "<br>"; |
721 | } | 717 | } |
722 | return text; | 718 | return text; |
723 | } | 719 | } |
724 | 720 | ||
725 | /*! | 721 | /*! |
726 | \internal | 722 | \internal |
727 | */ | 723 | */ |
728 | void OContact::insert( int key, const QString &v ) | 724 | void OContact::insert( int key, const QString &v ) |
729 | { | 725 | { |
730 | QString value = v.stripWhiteSpace(); | 726 | QString value = v.stripWhiteSpace(); |
731 | if ( value.isEmpty() ) | 727 | if ( value.isEmpty() ) |
732 | mMap.remove( key ); | 728 | mMap.remove( key ); |
733 | else | 729 | else |
734 | mMap.insert( key, value ); | 730 | mMap.insert( key, value ); |
735 | } | 731 | } |
736 | 732 | ||
737 | /*! | 733 | /*! |
738 | \internal | 734 | \internal |
739 | */ | 735 | */ |
740 | void OContact::replace( int key, const QString & v ) | 736 | void OContact::replace( int key, const QString & v ) |
741 | { | 737 | { |
742 | QString value = v.stripWhiteSpace(); | 738 | QString value = v.stripWhiteSpace(); |
743 | if ( value.isEmpty() ) | 739 | if ( value.isEmpty() ) |
744 | mMap.remove( key ); | 740 | mMap.remove( key ); |
745 | else | 741 | else |
746 | mMap.replace( key, value ); | 742 | mMap.replace( key, value ); |
747 | } | 743 | } |
748 | 744 | ||
749 | /*! | 745 | /*! |
750 | \internal | 746 | \internal |
751 | */ | 747 | */ |
752 | QString OContact::find( int key ) const | 748 | QString OContact::find( int key ) const |
753 | { | 749 | { |
754 | return mMap[key]; | 750 | return mMap[key]; |
755 | } | 751 | } |
756 | 752 | ||
757 | /*! | 753 | /*! |
758 | \internal | 754 | \internal |
759 | */ | 755 | */ |
760 | QString OContact::displayAddress( const QString &street, | 756 | QString OContact::displayAddress( const QString &street, |
761 | const QString &city, | 757 | const QString &city, |
762 | const QString &state, | 758 | const QString &state, |
763 | const QString &zip, | 759 | const QString &zip, |
764 | const QString &country ) const | 760 | const QString &country ) const |
765 | { | 761 | { |
766 | QString s = street; | 762 | QString s = street; |
767 | if ( !street.isEmpty() ) | 763 | if ( !street.isEmpty() ) |
768 | s+= "\n"; | 764 | s+= "\n"; |
769 | s += city; | 765 | s += city; |
770 | if ( !city.isEmpty() && !state.isEmpty() ) | 766 | if ( !city.isEmpty() && !state.isEmpty() ) |
771 | s += ", "; | 767 | s += ", "; |
772 | s += state; | 768 | s += state; |
773 | if ( !state.isEmpty() && !zip.isEmpty() ) | 769 | if ( !state.isEmpty() && !zip.isEmpty() ) |
774 | s += " "; | 770 | s += " "; |
775 | s += zip; | 771 | s += zip; |
776 | if ( !country.isEmpty() && !s.isEmpty() ) | 772 | if ( !country.isEmpty() && !s.isEmpty() ) |
777 | s += "\n"; | 773 | s += "\n"; |
778 | s += country; | 774 | s += country; |
779 | return s; | 775 | return s; |
780 | } | 776 | } |
781 | 777 | ||
782 | /*! | 778 | /*! |
783 | \internal | 779 | \internal |
784 | */ | 780 | */ |
785 | QString OContact::displayBusinessAddress() const | 781 | QString OContact::displayBusinessAddress() const |
786 | { | 782 | { |
787 | return displayAddress( businessStreet(), businessCity(), | 783 | return displayAddress( businessStreet(), businessCity(), |
788 | businessState(), businessZip(), | 784 | businessState(), businessZip(), |
789 | businessCountry() ); | 785 | businessCountry() ); |
790 | } | 786 | } |
791 | 787 | ||
792 | /*! | 788 | /*! |
793 | \internal | 789 | \internal |
794 | */ | 790 | */ |
795 | QString OContact::displayHomeAddress() const | 791 | QString OContact::displayHomeAddress() const |
796 | { | 792 | { |
797 | return displayAddress( homeStreet(), homeCity(), | 793 | return displayAddress( homeStreet(), homeCity(), |
798 | homeState(), homeZip(), | 794 | homeState(), homeZip(), |
799 | homeCountry() ); | 795 | homeCountry() ); |
800 | } | 796 | } |
801 | 797 | ||
802 | /*! | 798 | /*! |
803 | Returns the full name of the contact | 799 | Returns the full name of the contact |
804 | */ | 800 | */ |
805 | QString OContact::fullName() const | 801 | QString OContact::fullName() const |
806 | { | 802 | { |
807 | QString title = find( Qtopia::Title ); | 803 | QString title = find( Qtopia::Title ); |
808 | QString firstName = find( Qtopia::FirstName ); | 804 | QString firstName = find( Qtopia::FirstName ); |
809 | QString middleName = find( Qtopia::MiddleName ); | 805 | QString middleName = find( Qtopia::MiddleName ); |
810 | QString lastName = find( Qtopia::LastName ); | 806 | QString lastName = find( Qtopia::LastName ); |
811 | QString suffix = find( Qtopia::Suffix ); | 807 | QString suffix = find( Qtopia::Suffix ); |
812 | 808 | ||
813 | QString name = title; | 809 | QString name = title; |
814 | if ( !firstName.isEmpty() ) { | 810 | if ( !firstName.isEmpty() ) { |
815 | if ( !name.isEmpty() ) | 811 | if ( !name.isEmpty() ) |
816 | name += " "; | 812 | name += " "; |
817 | name += firstName; | 813 | name += firstName; |
818 | } | 814 | } |
819 | if ( !middleName.isEmpty() ) { | 815 | if ( !middleName.isEmpty() ) { |
820 | if ( !name.isEmpty() ) | 816 | if ( !name.isEmpty() ) |
821 | name += " "; | 817 | name += " "; |
822 | name += middleName; | 818 | name += middleName; |
823 | } | 819 | } |
824 | if ( !lastName.isEmpty() ) { | 820 | if ( !lastName.isEmpty() ) { |
825 | if ( !name.isEmpty() ) | 821 | if ( !name.isEmpty() ) |
826 | name += " "; | 822 | name += " "; |
827 | name += lastName; | 823 | name += lastName; |
828 | } | 824 | } |
829 | if ( !suffix.isEmpty() ) { | 825 | if ( !suffix.isEmpty() ) { |
830 | if ( !name.isEmpty() ) | 826 | if ( !name.isEmpty() ) |
831 | name += " "; | 827 | name += " "; |
832 | name += suffix; | 828 | name += suffix; |
833 | } | 829 | } |
834 | return name.simplifyWhiteSpace(); | 830 | return name.simplifyWhiteSpace(); |
835 | } | 831 | } |
836 | 832 | ||
837 | /*! | 833 | /*! |
838 | Returns a list of the names of the children of the contact. | 834 | Returns a list of the names of the children of the contact. |
839 | */ | 835 | */ |
840 | QStringList OContact::childrenList() const | 836 | QStringList OContact::childrenList() const |
841 | { | 837 | { |
842 | return QStringList::split( " ", find( Qtopia::Children ) ); | 838 | return QStringList::split( " ", find( Qtopia::Children ) ); |
843 | } | 839 | } |
844 | 840 | ||
845 | /*! \fn void OContact::insertEmail( const QString &email ) | 841 | /*! \fn void OContact::insertEmail( const QString &email ) |
846 | 842 | ||
847 | Insert \a email into the email list. Ensures \a email can only be added | 843 | Insert \a email into the email list. Ensures \a email can only be added |
848 | once. If there is no default email address set, it sets it to the \a email. | 844 | once. If there is no default email address set, it sets it to the \a email. |
849 | */ | 845 | */ |
850 | 846 | ||
851 | /*! \fn void OContact::removeEmail( const QString &email ) | 847 | /*! \fn void OContact::removeEmail( const QString &email ) |
852 | 848 | ||
853 | Removes the \a email from the email list. If the default email was \a email, | 849 | Removes the \a email from the email list. If the default email was \a email, |
854 | then the default email address is assigned to the first email in the | 850 | then the default email address is assigned to the first email in the |
855 | email list | 851 | email list |
856 | */ | 852 | */ |
857 | 853 | ||
858 | /*! \fn void OContact::clearEmails() | 854 | /*! \fn void OContact::clearEmails() |
859 | 855 | ||
860 | Clears the email list. | 856 | Clears the email list. |
861 | */ | 857 | */ |
862 | 858 | ||
863 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) | 859 | /*! \fn void OContact::insertEmails( const QStringList &emailList ) |
864 | 860 | ||
865 | Appends the \a emailList to the exiting email list | 861 | Appends the \a emailList to the exiting email list |
866 | */ | 862 | */ |
867 | 863 | ||
868 | /*! | 864 | /*! |
869 | Returns a list of email addresses belonging to the contact, including | 865 | Returns a list of email addresses belonging to the contact, including |
870 | the default email address. | 866 | the default email address. |
871 | */ | 867 | */ |
872 | QStringList OContact::emailList() const | 868 | QStringList OContact::emailList() const |
873 | { | 869 | { |
874 | QString emailStr = emails(); | 870 | QString emailStr = emails(); |
875 | 871 | ||
876 | QStringList r; | 872 | QStringList r; |
877 | if ( !emailStr.isEmpty() ) { | 873 | if ( !emailStr.isEmpty() ) { |
878 | qDebug(" emailstr "); | 874 | qDebug(" emailstr "); |
879 | QStringList l = QStringList::split( emailSeparator(), emailStr ); | 875 | QStringList l = QStringList::split( emailSeparator(), emailStr ); |
880 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) | 876 | for ( QStringList::ConstIterator it = l.begin();it != l.end();++it ) |
881 | r += (*it).simplifyWhiteSpace(); | 877 | r += (*it).simplifyWhiteSpace(); |
882 | } | 878 | } |
883 | 879 | ||
884 | return r; | 880 | return r; |
885 | } | 881 | } |
886 | 882 | ||
887 | /*! | 883 | /*! |
888 | \overload | 884 | \overload |
889 | 885 | ||
890 | Generates the string for the contact to be filed as from the first, | 886 | Generates the string for the contact to be filed as from the first, |
891 | middle and last name of the contact. | 887 | middle and last name of the contact. |
892 | */ | 888 | */ |
893 | void OContact::setFileAs() | 889 | void OContact::setFileAs() |
894 | { | 890 | { |
895 | QString lastName, firstName, middleName, fileas; | 891 | QString lastName, firstName, middleName, fileas; |
896 | 892 | ||
897 | lastName = find( Qtopia::LastName ); | 893 | lastName = find( Qtopia::LastName ); |
898 | firstName = find( Qtopia::FirstName ); | 894 | firstName = find( Qtopia::FirstName ); |
899 | middleName = find( Qtopia::MiddleName ); | 895 | middleName = find( Qtopia::MiddleName ); |
900 | if ( !lastName.isEmpty() && !firstName.isEmpty() | 896 | if ( !lastName.isEmpty() && !firstName.isEmpty() |
901 | && !middleName.isEmpty() ) | 897 | && !middleName.isEmpty() ) |
902 | fileas = lastName + ", " + firstName + " " + middleName; | 898 | fileas = lastName + ", " + firstName + " " + middleName; |
903 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) | 899 | else if ( !lastName.isEmpty() && !firstName.isEmpty() ) |
904 | fileas = lastName + ", " + firstName; | 900 | fileas = lastName + ", " + firstName; |
905 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || | 901 | else if ( !lastName.isEmpty() || !firstName.isEmpty() || |
906 | !middleName.isEmpty() ) | 902 | !middleName.isEmpty() ) |
907 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) | 903 | fileas = firstName + ( firstName.isEmpty() ? "" : " " ) |
908 | + middleName + ( middleName.isEmpty() ? "" : " " ) | 904 | + middleName + ( middleName.isEmpty() ? "" : " " ) |
909 | + lastName; | 905 | + lastName; |
910 | 906 | ||
911 | replace( Qtopia::FileAs, fileas ); | 907 | replace( Qtopia::FileAs, fileas ); |
912 | } | 908 | } |
913 | 909 | ||
914 | /*! | 910 | /*! |
915 | \internal | 911 | \internal |
916 | Appends the contact information to \a buf. | 912 | Appends the contact information to \a buf. |
917 | */ | 913 | */ |
918 | void OContact::save( QString &buf ) const | 914 | void OContact::save( QString &buf ) const |
919 | { | 915 | { |
920 | static const QStringList SLFIELDS = fields(); | 916 | static const QStringList SLFIELDS = fields(); |
921 | // I'm expecting "<Contact " in front of this... | 917 | // I'm expecting "<Contact " in front of this... |
922 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); | 918 | for ( QMap<int, QString>::ConstIterator it = mMap.begin(); |
923 | it != mMap.end(); ++it ) { | 919 | it != mMap.end(); ++it ) { |
924 | const QString &value = it.data(); | 920 | const QString &value = it.data(); |
925 | int key = it.key(); | 921 | int key = it.key(); |
926 | if ( !value.isEmpty() ) { | 922 | if ( !value.isEmpty() ) { |
927 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) | 923 | if ( key == Qtopia::AddressCategory || key == Qtopia::AddressUid) |
928 | continue; | 924 | continue; |
929 | 925 | ||
930 | key -= Qtopia::AddressCategory+1; | 926 | key -= Qtopia::AddressCategory+1; |
931 | buf += SLFIELDS[key]; | 927 | buf += SLFIELDS[key]; |
932 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; | 928 | buf += "=\"" + Qtopia::escapeString(value) + "\" "; |
933 | } | 929 | } |
934 | } | 930 | } |
935 | buf += customToXml(); | 931 | buf += customToXml(); |
936 | if ( categories().count() > 0 ) | 932 | if ( categories().count() > 0 ) |
937 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; | 933 | buf += "Categories=\"" + idsToString( categories() ) + "\" "; |
938 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; | 934 | buf += "Uid=\"" + QString::number( uid() ) + "\" "; |
939 | // You need to close this yourself | 935 | // You need to close this yourself |
940 | } | 936 | } |
941 | 937 | ||
942 | 938 | ||
943 | /*! | 939 | /*! |
944 | \internal | 940 | \internal |
945 | Returns the list of fields belonging to a contact | 941 | Returns the list of fields belonging to a contact |
946 | Never change order of this list ! It has to be regarding | 942 | Never change order of this list ! It has to be regarding |
947 | enum AddressBookFields !! | 943 | enum AddressBookFields !! |
948 | */ | 944 | */ |
949 | QStringList OContact::fields() | 945 | QStringList OContact::fields() |
950 | { | 946 | { |
951 | QStringList list; | 947 | QStringList list; |
952 | 948 | ||
953 | list.append( "Title" ); // Not Used! | 949 | list.append( "Title" ); // Not Used! |
954 | list.append( "FirstName" ); | 950 | list.append( "FirstName" ); |
955 | list.append( "MiddleName" ); | 951 | list.append( "MiddleName" ); |
956 | list.append( "LastName" ); | 952 | list.append( "LastName" ); |
957 | list.append( "Suffix" ); | 953 | list.append( "Suffix" ); |
958 | list.append( "FileAs" ); | 954 | list.append( "FileAs" ); |
959 | 955 | ||
960 | list.append( "JobTitle" ); | 956 | list.append( "JobTitle" ); |
961 | list.append( "Department" ); | 957 | list.append( "Department" ); |
962 | list.append( "Company" ); | 958 | list.append( "Company" ); |
963 | list.append( "BusinessPhone" ); | 959 | list.append( "BusinessPhone" ); |
964 | list.append( "BusinessFax" ); | 960 | list.append( "BusinessFax" ); |
965 | list.append( "BusinessMobile" ); | 961 | list.append( "BusinessMobile" ); |
966 | 962 | ||
967 | list.append( "DefaultEmail" ); | 963 | list.append( "DefaultEmail" ); |
968 | list.append( "Emails" ); | 964 | list.append( "Emails" ); |
969 | 965 | ||
970 | list.append( "HomePhone" ); | 966 | list.append( "HomePhone" ); |
971 | list.append( "HomeFax" ); | 967 | list.append( "HomeFax" ); |
972 | list.append( "HomeMobile" ); | 968 | list.append( "HomeMobile" ); |
973 | 969 | ||
974 | list.append( "BusinessStreet" ); | 970 | list.append( "BusinessStreet" ); |
975 | list.append( "BusinessCity" ); | 971 | list.append( "BusinessCity" ); |
976 | list.append( "BusinessState" ); | 972 | list.append( "BusinessState" ); |
977 | list.append( "BusinessZip" ); | 973 | list.append( "BusinessZip" ); |
978 | list.append( "BusinessCountry" ); | 974 | list.append( "BusinessCountry" ); |
979 | list.append( "BusinessPager" ); | 975 | list.append( "BusinessPager" ); |
980 | list.append( "BusinessWebPage" ); | 976 | list.append( "BusinessWebPage" ); |
981 | 977 | ||
982 | list.append( "Office" ); | 978 | list.append( "Office" ); |
983 | list.append( "Profession" ); | 979 | list.append( "Profession" ); |
984 | list.append( "Assistant" ); | 980 | list.append( "Assistant" ); |
985 | list.append( "Manager" ); | 981 | list.append( "Manager" ); |
986 | 982 | ||
987 | list.append( "HomeStreet" ); | 983 | list.append( "HomeStreet" ); |
988 | list.append( "HomeCity" ); | 984 | list.append( "HomeCity" ); |
989 | list.append( "HomeState" ); | 985 | list.append( "HomeState" ); |
990 | list.append( "HomeZip" ); | 986 | list.append( "HomeZip" ); |
991 | list.append( "HomeCountry" ); | 987 | list.append( "HomeCountry" ); |
992 | list.append( "HomeWebPage" ); | 988 | list.append( "HomeWebPage" ); |
993 | 989 | ||
994 | list.append( "Spouse" ); | 990 | list.append( "Spouse" ); |
995 | list.append( "Gender" ); | 991 | list.append( "Gender" ); |
996 | list.append( "Birthday" ); | 992 | list.append( "Birthday" ); |
997 | list.append( "Anniversary" ); | 993 | list.append( "Anniversary" ); |
998 | list.append( "Nickname" ); | 994 | list.append( "Nickname" ); |
999 | list.append( "Children" ); | 995 | list.append( "Children" ); |
1000 | 996 | ||
1001 | list.append( "Notes" ); | 997 | list.append( "Notes" ); |
1002 | list.append( "Groups" ); | 998 | list.append( "Groups" ); |
1003 | 999 | ||
1004 | return list; | 1000 | return list; |
1005 | } | 1001 | } |
1006 | 1002 | ||
1007 | 1003 | ||
1008 | /*! | 1004 | /*! |
1009 | Sets the list of email address for contact to those contained in \a str. | 1005 | Sets the list of email address for contact to those contained in \a str. |
1010 | Email address should be separated by ';'s. | 1006 | Email address should be separated by ';'s. |
1011 | */ | 1007 | */ |
1012 | void OContact::setEmails( const QString &str ) | 1008 | void OContact::setEmails( const QString &str ) |
1013 | { | 1009 | { |
1014 | replace( Qtopia::Emails, str ); | 1010 | replace( Qtopia::Emails, str ); |
1015 | if ( str.isEmpty() ) | 1011 | if ( str.isEmpty() ) |
1016 | setDefaultEmail( QString::null ); | 1012 | setDefaultEmail( QString::null ); |
1017 | } | 1013 | } |
1018 | 1014 | ||
1019 | /*! | 1015 | /*! |
1020 | Sets the list of children for the contact to those contained in \a str. | 1016 | Sets the list of children for the contact to those contained in \a str. |
1021 | */ | 1017 | */ |
1022 | void OContact::setChildren( const QString &str ) | 1018 | void OContact::setChildren( const QString &str ) |
1023 | { | 1019 | { |
1024 | replace( Qtopia::Children, str ); | 1020 | replace( Qtopia::Children, str ); |
1025 | } | 1021 | } |
1026 | 1022 | ||
1027 | /*! | 1023 | /*! |
1028 | \overload | 1024 | \overload |
1029 | Returns TRUE if the contact matches the regular expression \a regexp. | 1025 | Returns TRUE if the contact matches the regular expression \a regexp. |
1030 | Otherwise returns FALSE. | 1026 | Otherwise returns FALSE. |
1031 | */ | 1027 | */ |
1032 | bool OContact::match( const QRegExp &r ) const | 1028 | bool OContact::match( const QRegExp &r ) const |
1033 | { | 1029 | { |
1034 | setLastHitField( -1 ); | 1030 | setLastHitField( -1 ); |
1035 | bool match; | 1031 | bool match; |
1036 | match = false; | 1032 | match = false; |
1037 | QMap<int, QString>::ConstIterator it; | 1033 | QMap<int, QString>::ConstIterator it; |
1038 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { | 1034 | for ( it = mMap.begin(); it != mMap.end(); ++it ) { |
1039 | if ( (*it).find( r ) > -1 ) { | 1035 | if ( (*it).find( r ) > -1 ) { |
1040 | setLastHitField( it.key() ); | 1036 | setLastHitField( it.key() ); |
1041 | match = true; | 1037 | match = true; |
1042 | break; | 1038 | break; |
1043 | } | 1039 | } |
1044 | } | 1040 | } |
1045 | return match; | 1041 | return match; |
1046 | } | 1042 | } |
1047 | 1043 | ||
1048 | 1044 | ||
1049 | QString OContact::toShortText() const | 1045 | QString OContact::toShortText() const |
1050 | { | 1046 | { |
1051 | return ( fullName() ); | 1047 | return ( fullName() ); |
1052 | } | 1048 | } |
1053 | QString OContact::type() const | 1049 | QString OContact::type() const |
1054 | { | 1050 | { |
1055 | return QString::fromLatin1( "OContact" ); | 1051 | return QString::fromLatin1( "OContact" ); |
1056 | } | 1052 | } |
1057 | 1053 | ||
1058 | 1054 | ||
1059 | 1055 | ||
1060 | class QString OContact::recordField( int pos ) const | 1056 | class QString OContact::recordField( int pos ) const |
1061 | { | 1057 | { |
1062 | QStringList SLFIELDS = fields(); // ?? why this ? (se) | 1058 | QStringList SLFIELDS = fields(); // ?? why this ? (se) |
1063 | return SLFIELDS[pos]; | 1059 | return SLFIELDS[pos]; |
1064 | } | 1060 | } |
1065 | 1061 | ||
1066 | // In future releases, we should store birthday and anniversary | 1062 | // In future releases, we should store birthday and anniversary |
1067 | // internally as QDate instead of QString ! | 1063 | // internally as QDate instead of QString ! |
1068 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) | 1064 | // QString is always too complicate to interprete (DD.MM.YY, DD/MM/YY, MM/DD/YY, etc..)(se) |
1069 | 1065 | ||
1070 | /*! \fn void OContact::setBirthday( const QDate& date ) | 1066 | /*! \fn void OContact::setBirthday( const QDate& date ) |
1071 | Sets the birthday for the contact to \a date. If date is null | 1067 | Sets the birthday for the contact to \a date. If date is null |
1072 | the current stored date will be removed. | 1068 | the current stored date will be removed. |
1073 | */ | 1069 | */ |
1074 | void OContact::setBirthday( const QDate &v ) | 1070 | void OContact::setBirthday( const QDate &v ) |
1075 | { | 1071 | { |
1076 | if ( v.isNull() ){ | 1072 | if ( v.isNull() ){ |
1077 | qWarning( "Remove Birthday"); | 1073 | qWarning( "Remove Birthday"); |
1078 | replace( Qtopia::Birthday, QString::null ); | 1074 | replace( Qtopia::Birthday, QString::null ); |
1079 | return; | 1075 | return; |
1080 | } | 1076 | } |
1081 | 1077 | ||
1082 | if ( v.isValid() ) | 1078 | if ( v.isValid() ) |
1083 | replace( Qtopia::Birthday, OConversion::dateToString( v ) ); | 1079 | replace( Qtopia::Birthday, OConversion::dateToString( v ) ); |
1084 | 1080 | ||
1085 | } | 1081 | } |
1086 | 1082 | ||
1087 | 1083 | ||
1088 | /*! \fn void OContact::setAnniversary( const QDate &date ) | 1084 | /*! \fn void OContact::setAnniversary( const QDate &date ) |
1089 | Sets the anniversary of the contact to \a date. If date is | 1085 | Sets the anniversary of the contact to \a date. If date is |
1090 | null, the current stored date will be removed. | 1086 | null, the current stored date will be removed. |
1091 | */ | 1087 | */ |
1092 | void OContact::setAnniversary( const QDate &v ) | 1088 | void OContact::setAnniversary( const QDate &v ) |
1093 | { | 1089 | { |
1094 | if ( v.isNull() ){ | 1090 | if ( v.isNull() ){ |
1095 | qWarning( "Remove Anniversary"); | 1091 | qWarning( "Remove Anniversary"); |
1096 | replace( Qtopia::Anniversary, QString::null ); | 1092 | replace( Qtopia::Anniversary, QString::null ); |
1097 | return; | 1093 | return; |
1098 | } | 1094 | } |
1099 | 1095 | ||
1100 | if ( v.isValid() ) | 1096 | if ( v.isValid() ) |
1101 | replace( Qtopia::Anniversary, OConversion::dateToString( v ) ); | 1097 | replace( Qtopia::Anniversary, OConversion::dateToString( v ) ); |
1102 | } | 1098 | } |
1103 | 1099 | ||
1104 | /*! \fn QDate OContact::birthday() const | 1100 | /*! \fn QDate OContact::birthday() const |
1105 | Returns the birthday of the contact. | 1101 | Returns the birthday of the contact. |
1106 | */ | 1102 | */ |
1107 | QDate OContact::birthday() const | 1103 | QDate OContact::birthday() const |
1108 | { | 1104 | { |
1109 | QString str = find( Qtopia::Birthday ); | 1105 | QString str = find( Qtopia::Birthday ); |
1110 | // qWarning ("Birthday %s", str.latin1() ); | 1106 | // qWarning ("Birthday %s", str.latin1() ); |
1111 | if ( !str.isEmpty() ) | 1107 | if ( !str.isEmpty() ) |
1112 | return OConversion::dateFromString ( str ); | 1108 | return OConversion::dateFromString ( str ); |
1113 | else | 1109 | else |
1114 | return QDate(); | 1110 | return QDate(); |
1115 | } | 1111 | } |
1116 | 1112 | ||
1117 | 1113 | ||
1118 | /*! \fn QDate OContact::anniversary() const | 1114 | /*! \fn QDate OContact::anniversary() const |
1119 | Returns the anniversary of the contact. | 1115 | Returns the anniversary of the contact. |
1120 | */ | 1116 | */ |
1121 | QDate OContact::anniversary() const | 1117 | QDate OContact::anniversary() const |
1122 | { | 1118 | { |
1123 | QDate empty; | 1119 | QDate empty; |
1124 | QString str = find( Qtopia::Anniversary ); | 1120 | QString str = find( Qtopia::Anniversary ); |
1125 | // qWarning ("Anniversary %s", str.latin1() ); | 1121 | // qWarning ("Anniversary %s", str.latin1() ); |
1126 | if ( !str.isEmpty() ) | 1122 | if ( !str.isEmpty() ) |
1127 | return OConversion::dateFromString ( str ); | 1123 | return OConversion::dateFromString ( str ); |
1128 | else | 1124 | else |
1129 | return empty; | 1125 | return empty; |
1130 | } | 1126 | } |
1131 | 1127 | ||
1132 | 1128 | ||
1133 | void OContact::insertEmail( const QString &v ) | 1129 | void OContact::insertEmail( const QString &v ) |
1134 | { | 1130 | { |
1135 | //qDebug("insertEmail %s", v.latin1()); | 1131 | //qDebug("insertEmail %s", v.latin1()); |
1136 | QString e = v.simplifyWhiteSpace(); | 1132 | QString e = v.simplifyWhiteSpace(); |
1137 | QString def = defaultEmail(); | 1133 | QString def = defaultEmail(); |
1138 | 1134 | ||
1139 | // if no default, set it as the default email and don't insert | 1135 | // if no default, set it as the default email and don't insert |
1140 | if ( def.isEmpty() ) { | 1136 | if ( def.isEmpty() ) { |
1141 | setDefaultEmail( e ); // will insert into the list for us | 1137 | setDefaultEmail( e ); // will insert into the list for us |
1142 | return; | 1138 | return; |
1143 | } | 1139 | } |
1144 | 1140 | ||
1145 | // otherwise, insert assuming doesn't already exist | 1141 | // otherwise, insert assuming doesn't already exist |
1146 | QString emailsStr = find( Qtopia::Emails ); | 1142 | QString emailsStr = find( Qtopia::Emails ); |
1147 | if ( emailsStr.contains( e )) | 1143 | if ( emailsStr.contains( e )) |
1148 | return; | 1144 | return; |
1149 | if ( !emailsStr.isEmpty() ) | 1145 | if ( !emailsStr.isEmpty() ) |
1150 | emailsStr += emailSeparator(); | 1146 | emailsStr += emailSeparator(); |
1151 | emailsStr += e; | 1147 | emailsStr += e; |
1152 | replace( Qtopia::Emails, emailsStr ); | 1148 | replace( Qtopia::Emails, emailsStr ); |
1153 | } | 1149 | } |
1154 | 1150 | ||
1155 | void OContact::removeEmail( const QString &v ) | 1151 | void OContact::removeEmail( const QString &v ) |
1156 | { | 1152 | { |
1157 | QString e = v.simplifyWhiteSpace(); | 1153 | QString e = v.simplifyWhiteSpace(); |
1158 | QString def = defaultEmail(); | 1154 | QString def = defaultEmail(); |
1159 | QString emailsStr = find( Qtopia::Emails ); | 1155 | QString emailsStr = find( Qtopia::Emails ); |
1160 | QStringList emails = emailList(); | 1156 | QStringList emails = emailList(); |
1161 | 1157 | ||
1162 | // otherwise, must first contain it | 1158 | // otherwise, must first contain it |
1163 | if ( !emailsStr.contains( e ) ) | 1159 | if ( !emailsStr.contains( e ) ) |
1164 | return; | 1160 | return; |
1165 | 1161 | ||
1166 | // remove it | 1162 | // remove it |
1167 | //qDebug(" removing email from list %s", e.latin1()); | 1163 | //qDebug(" removing email from list %s", e.latin1()); |
1168 | emails.remove( e ); | 1164 | emails.remove( e ); |
1169 | // reset the string | 1165 | // reset the string |
1170 | emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator | 1166 | emailsStr = emails.join(emailSeparator()); // Sharp's brain dead separator |
1171 | replace( Qtopia::Emails, emailsStr ); | 1167 | replace( Qtopia::Emails, emailsStr ); |
1172 | 1168 | ||
1173 | // if default, then replace the default email with the first one | 1169 | // if default, then replace the default email with the first one |
1174 | if ( def == e ) { | 1170 | if ( def == e ) { |
1175 | //qDebug("removeEmail is default; setting new default"); | 1171 | //qDebug("removeEmail is default; setting new default"); |
1176 | if ( !emails.count() ) | 1172 | if ( !emails.count() ) |
1177 | clearEmails(); | 1173 | clearEmails(); |
1178 | else // setDefaultEmail will remove e from the list | 1174 | else // setDefaultEmail will remove e from the list |
1179 | setDefaultEmail( emails.first() ); | 1175 | setDefaultEmail( emails.first() ); |
1180 | } | 1176 | } |
1181 | } | 1177 | } |
1182 | void OContact::clearEmails() | 1178 | void OContact::clearEmails() |
1183 | { | 1179 | { |
1184 | mMap.remove( Qtopia::DefaultEmail ); | 1180 | mMap.remove( Qtopia::DefaultEmail ); |
1185 | mMap.remove( Qtopia::Emails ); | 1181 | mMap.remove( Qtopia::Emails ); |
1186 | } | 1182 | } |
1187 | void OContact::setDefaultEmail( const QString &v ) | 1183 | void OContact::setDefaultEmail( const QString &v ) |
1188 | { | 1184 | { |
1189 | QString e = v.simplifyWhiteSpace(); | 1185 | QString e = v.simplifyWhiteSpace(); |
1190 | 1186 | ||
1191 | //qDebug("OContact::setDefaultEmail %s", e.latin1()); | 1187 | //qDebug("OContact::setDefaultEmail %s", e.latin1()); |
1192 | replace( Qtopia::DefaultEmail, e ); | 1188 | replace( Qtopia::DefaultEmail, e ); |
1193 | 1189 | ||
1194 | if ( !e.isEmpty() ) | 1190 | if ( !e.isEmpty() ) |
1195 | insertEmail( e ); | 1191 | insertEmail( e ); |
1196 | 1192 | ||
1197 | } | 1193 | } |
1198 | 1194 | ||
1199 | void OContact::insertEmails( const QStringList &v ) | 1195 | void OContact::insertEmails( const QStringList &v ) |
1200 | { | 1196 | { |
1201 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) | 1197 | for ( QStringList::ConstIterator it = v.begin(); it != v.end(); ++it ) |
1202 | insertEmail( *it ); | 1198 | insertEmail( *it ); |
1203 | } | 1199 | } |
1204 | int OContact::rtti() { | 1200 | int OContact::rtti() { |
1205 | return OPimResolver::AddressBook; | 1201 | return OPimResolver::AddressBook; |
1206 | } | 1202 | } |
1207 | void OContact::setUid( int i ) | 1203 | void OContact::setUid( int i ) |
1208 | { | 1204 | { |
1209 | OPimRecord::setUid(i); | 1205 | OPimRecord::setUid(i); |
1210 | replace( Qtopia::AddressUid , QString::number(i)); | 1206 | replace( Qtopia::AddressUid , QString::number(i)); |
1211 | } | 1207 | } |