author | tux_mike <tux_mike> | 2002-04-02 02:16:45 (UTC) |
---|---|---|
committer | tux_mike <tux_mike> | 2002-04-02 02:16:45 (UTC) |
commit | 44bfa84cc6d9bcd828f0b08c7bf59dde58dd5288 (patch) (unidiff) | |
tree | 75ff5b49b30c27d927f5d170c2d9e60e56af5e5b | |
parent | f830e73250189b0c9ca06df437c04d1c29e81359 (diff) | |
download | opie-44bfa84cc6d9bcd828f0b08c7bf59dde58dd5288.zip opie-44bfa84cc6d9bcd828f0b08c7bf59dde58dd5288.tar.gz opie-44bfa84cc6d9bcd828f0b08c7bf59dde58dd5288.tar.bz2 |
Fixed annoying bug with the City field always being the home city... sorry :)
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 34 |
1 files changed, 1 insertions, 33 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index 6d92ac3..0e752ca 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -148,1242 +148,1210 @@ void ContactEditor::init() { | |||
148 | } | 148 | } |
149 | 149 | ||
150 | if ( *it == tr( "First Name" ) ) { | 150 | if ( *it == tr( "First Name" ) ) { |
151 | //slDynamicEntries->remove( it ); | 151 | //slDynamicEntries->remove( it ); |
152 | continue; | 152 | continue; |
153 | } | 153 | } |
154 | 154 | ||
155 | if ( *it == tr( "Middle Name" ) ) { | 155 | if ( *it == tr( "Middle Name" ) ) { |
156 | //slDynamicEntries->remove( it ); | 156 | //slDynamicEntries->remove( it ); |
157 | continue; | 157 | continue; |
158 | } | 158 | } |
159 | 159 | ||
160 | if ( *it == tr( "Last Name" ) ) { | 160 | if ( *it == tr( "Last Name" ) ) { |
161 | //slDynamicEntries->remove( it ); | 161 | //slDynamicEntries->remove( it ); |
162 | continue; | 162 | continue; |
163 | } | 163 | } |
164 | 164 | ||
165 | if ( *it == tr( "Suffix" ) ) { | 165 | if ( *it == tr( "Suffix" ) ) { |
166 | //slDynamicEntries->remove( it ); | 166 | //slDynamicEntries->remove( it ); |
167 | continue; | 167 | continue; |
168 | } | 168 | } |
169 | 169 | ||
170 | if ( *it == tr( "File As" ) ) { | 170 | if ( *it == tr( "File As" ) ) { |
171 | //slDynamicEntries->remove( it ); | 171 | //slDynamicEntries->remove( it ); |
172 | continue; | 172 | continue; |
173 | } | 173 | } |
174 | 174 | ||
175 | if ( *it == tr( "Gender" ) ) { | 175 | if ( *it == tr( "Gender" ) ) { |
176 | hasGender = TRUE; | 176 | hasGender = TRUE; |
177 | //slDynamicEntries->remove( it ); | 177 | //slDynamicEntries->remove( it ); |
178 | continue; | 178 | continue; |
179 | } | 179 | } |
180 | 180 | ||
181 | if ( *it == tr( "Job Title" ) ) { | 181 | if ( *it == tr( "Job Title" ) ) { |
182 | hasTitle = TRUE; | 182 | hasTitle = TRUE; |
183 | //slDynamicEntries->remove( it ); | 183 | //slDynamicEntries->remove( it ); |
184 | continue; | 184 | continue; |
185 | } | 185 | } |
186 | 186 | ||
187 | if ( *it == tr( "Company" ) ) { | 187 | if ( *it == tr( "Company" ) ) { |
188 | hasCompany = TRUE; | 188 | hasCompany = TRUE; |
189 | //slDynamicEntries->remove( it ); | 189 | //slDynamicEntries->remove( it ); |
190 | continue; | 190 | continue; |
191 | } | 191 | } |
192 | 192 | ||
193 | if ( *it == tr( "Notes" ) ) { | 193 | if ( *it == tr( "Notes" ) ) { |
194 | hasNotes = TRUE; | 194 | hasNotes = TRUE; |
195 | //slDynamicEntries->remove( it ); | 195 | //slDynamicEntries->remove( it ); |
196 | continue; | 196 | continue; |
197 | } | 197 | } |
198 | 198 | ||
199 | if ( *it == tr( "Groups" ) ) { | 199 | if ( *it == tr( "Groups" ) ) { |
200 | //slDynamicEntries->remove( it ); | 200 | //slDynamicEntries->remove( it ); |
201 | continue; | 201 | continue; |
202 | } | 202 | } |
203 | 203 | ||
204 | if ( (*it).right( 6 ) == tr( "Street" ) ) { | 204 | if ( (*it).right( 6 ) == tr( "Street" ) ) { |
205 | hasStreet = TRUE; | 205 | hasStreet = TRUE; |
206 | //slDynamicEntries->remove( it ); | 206 | //slDynamicEntries->remove( it ); |
207 | continue; | 207 | continue; |
208 | } | 208 | } |
209 | 209 | ||
210 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { | 210 | if ( (*it).right( 8 ) == tr( "Street 2" ) ) { |
211 | hasStreet2 = TRUE; | 211 | hasStreet2 = TRUE; |
212 | //slDynamicEntries->remove( it ); | 212 | //slDynamicEntries->remove( it ); |
213 | continue; | 213 | continue; |
214 | } | 214 | } |
215 | 215 | ||
216 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { | 216 | if ( (*it).right( 8 ) == tr( "P.O. Box" ) ) { |
217 | hasPOBox = TRUE; | 217 | hasPOBox = TRUE; |
218 | //slDynamicEntries->remove( it ); | 218 | //slDynamicEntries->remove( it ); |
219 | continue; | 219 | continue; |
220 | } | 220 | } |
221 | 221 | ||
222 | if ( (*it).right( 4 ) == tr( "City" ) ) { | 222 | if ( (*it).right( 4 ) == tr( "City" ) ) { |
223 | hasCity = TRUE; | 223 | hasCity = TRUE; |
224 | //slDynamicEntries->remove( it ); | 224 | //slDynamicEntries->remove( it ); |
225 | continue; | 225 | continue; |
226 | } | 226 | } |
227 | 227 | ||
228 | if ( (*it).right( 5 ) == tr( "State" ) ) { | 228 | if ( (*it).right( 5 ) == tr( "State" ) ) { |
229 | hasState = TRUE; | 229 | hasState = TRUE; |
230 | //slDynamicEntries->remove( it ); | 230 | //slDynamicEntries->remove( it ); |
231 | continue; | 231 | continue; |
232 | } | 232 | } |
233 | 233 | ||
234 | if ( (*it).right( 3 ) == tr( "Zip" ) ) { | 234 | if ( (*it).right( 3 ) == tr( "Zip" ) ) { |
235 | hasZip = TRUE; | 235 | hasZip = TRUE; |
236 | //slDynamicEntries->remove( it ); | 236 | //slDynamicEntries->remove( it ); |
237 | continue; | 237 | continue; |
238 | } | 238 | } |
239 | 239 | ||
240 | if ( (*it).right( 7 ) == tr( "Country" ) ) { | 240 | if ( (*it).right( 7 ) == tr( "Country" ) ) { |
241 | hasCountry = TRUE; | 241 | hasCountry = TRUE; |
242 | //slDynamicEntries->remove( it ); | 242 | //slDynamicEntries->remove( it ); |
243 | continue; | 243 | continue; |
244 | } | 244 | } |
245 | 245 | ||
246 | slDynamicEntries->append( *it ); | 246 | slDynamicEntries->append( *it ); |
247 | } | 247 | } |
248 | } | 248 | } |
249 | 249 | ||
250 | QVBoxLayout *vb = new QVBoxLayout( this ); | 250 | QVBoxLayout *vb = new QVBoxLayout( this ); |
251 | 251 | ||
252 | tabMain = new QTabWidget( this ); | 252 | tabMain = new QTabWidget( this ); |
253 | vb->addWidget( tabMain ); | 253 | vb->addWidget( tabMain ); |
254 | 254 | ||
255 | QWidget *tabViewport = new QWidget ( tabMain ); | 255 | QWidget *tabViewport = new QWidget ( tabMain ); |
256 | 256 | ||
257 | vb = new QVBoxLayout( tabViewport ); | 257 | vb = new QVBoxLayout( tabViewport ); |
258 | 258 | ||
259 | svGeneral = new QScrollView( tabViewport ); | 259 | svGeneral = new QScrollView( tabViewport ); |
260 | vb->addWidget( svGeneral, 0, 0 ); | 260 | vb->addWidget( svGeneral, 0, 0 ); |
261 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); | 261 | svGeneral->setResizePolicy( QScrollView::AutoOneFit ); |
262 | svGeneral->setFrameStyle( QFrame::NoFrame ); | 262 | svGeneral->setFrameStyle( QFrame::NoFrame ); |
263 | 263 | ||
264 | QWidget *container = new QWidget( svGeneral->viewport() ); | 264 | QWidget *container = new QWidget( svGeneral->viewport() ); |
265 | svGeneral->addChild( container ); | 265 | svGeneral->addChild( container ); |
266 | 266 | ||
267 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 3 ); | 267 | QGridLayout *gl = new QGridLayout( container, 1, 1, 2, 3 ); |
268 | gl->setResizeMode( QLayout::FreeResize ); | 268 | gl->setResizeMode( QLayout::FreeResize ); |
269 | 269 | ||
270 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); | 270 | btnFullName = new QPushButton( tr( "Full Name..." ), container ); |
271 | gl->addWidget( btnFullName, 0, 0 ); | 271 | gl->addWidget( btnFullName, 0, 0 ); |
272 | txtFullName = new QLineEdit( container ); | 272 | txtFullName = new QLineEdit( container ); |
273 | gl->addWidget( txtFullName, 0, 1 ); | 273 | gl->addWidget( txtFullName, 0, 1 ); |
274 | 274 | ||
275 | QLabel *l = new QLabel( tr( "Job Title" ), container ); | 275 | QLabel *l = new QLabel( tr( "Job Title" ), container ); |
276 | gl->addWidget( l, 1, 0 ); | 276 | gl->addWidget( l, 1, 0 ); |
277 | txtJobTitle = new QLineEdit( container ); | 277 | txtJobTitle = new QLineEdit( container ); |
278 | gl->addWidget( txtJobTitle, 1, 1 ); | 278 | gl->addWidget( txtJobTitle, 1, 1 ); |
279 | 279 | ||
280 | l = new QLabel( tr( "Organization" ), container ); | 280 | l = new QLabel( tr( "Organization" ), container ); |
281 | gl->addWidget( l, 2, 0 ); | 281 | gl->addWidget( l, 2, 0 ); |
282 | txtOrganization = new QLineEdit( container ); | 282 | txtOrganization = new QLineEdit( container ); |
283 | gl->addWidget( txtOrganization, 2, 1 ); | 283 | gl->addWidget( txtOrganization, 2, 1 ); |
284 | 284 | ||
285 | cmbChooserField1 = new QComboBox( FALSE, container ); | 285 | cmbChooserField1 = new QComboBox( FALSE, container ); |
286 | cmbChooserField1->setMaximumWidth( 100 ); | 286 | cmbChooserField1->setMaximumWidth( 100 ); |
287 | gl->addWidget( cmbChooserField1, 3, 0 ); | 287 | gl->addWidget( cmbChooserField1, 3, 0 ); |
288 | txtChooserField1 = new QLineEdit( container ); | 288 | txtChooserField1 = new QLineEdit( container ); |
289 | gl->addWidget( txtChooserField1, 3, 1 ); | 289 | gl->addWidget( txtChooserField1, 3, 1 ); |
290 | 290 | ||
291 | cmbChooserField2 = new QComboBox( FALSE, container ); | 291 | cmbChooserField2 = new QComboBox( FALSE, container ); |
292 | cmbChooserField2->setMaximumWidth( 100 ); | 292 | cmbChooserField2->setMaximumWidth( 100 ); |
293 | gl->addWidget( cmbChooserField2, 4, 0 ); | 293 | gl->addWidget( cmbChooserField2, 4, 0 ); |
294 | txtChooserField2 = new QLineEdit( container ); | 294 | txtChooserField2 = new QLineEdit( container ); |
295 | gl->addWidget( txtChooserField2, 4, 1 ); | 295 | gl->addWidget( txtChooserField2, 4, 1 ); |
296 | 296 | ||
297 | cmbChooserField3 = new QComboBox( FALSE, container ); | 297 | cmbChooserField3 = new QComboBox( FALSE, container ); |
298 | cmbChooserField3->setMaximumWidth( 100 ); | 298 | cmbChooserField3->setMaximumWidth( 100 ); |
299 | gl->addWidget( cmbChooserField3, 5, 0 ); | 299 | gl->addWidget( cmbChooserField3, 5, 0 ); |
300 | txtChooserField3 = new QLineEdit( container ); | 300 | txtChooserField3 = new QLineEdit( container ); |
301 | gl->addWidget( txtChooserField3, 5, 1 ); | 301 | gl->addWidget( txtChooserField3, 5, 1 ); |
302 | 302 | ||
303 | l = new QLabel( tr( "File As" ), container ); | 303 | l = new QLabel( tr( "File As" ), container ); |
304 | gl->addWidget( l, 6, 0 ); | 304 | gl->addWidget( l, 6, 0 ); |
305 | cmbFileAs = new QComboBox( TRUE, container ); | 305 | cmbFileAs = new QComboBox( TRUE, container ); |
306 | gl->addWidget( cmbFileAs, 6, 1 ); | 306 | gl->addWidget( cmbFileAs, 6, 1 ); |
307 | 307 | ||
308 | l = new QLabel( tr( "Category" ), container ); | 308 | l = new QLabel( tr( "Category" ), container ); |
309 | gl->addWidget( l, 7, 0 ); | 309 | gl->addWidget( l, 7, 0 ); |
310 | cmbCat = new CategorySelect( container ); | 310 | cmbCat = new CategorySelect( container ); |
311 | gl->addWidget( cmbCat, 7, 1 ); | 311 | gl->addWidget( cmbCat, 7, 1 ); |
312 | 312 | ||
313 | btnNote = new QPushButton( tr( "Notes..." ), container ); | 313 | btnNote = new QPushButton( tr( "Notes..." ), container ); |
314 | gl->addWidget( btnNote, 8, 1 ); | 314 | gl->addWidget( btnNote, 8, 1 ); |
315 | 315 | ||
316 | tabMain->insertTab( tabViewport, tr( "General" ) ); | 316 | tabMain->insertTab( tabViewport, tr( "General" ) ); |
317 | 317 | ||
318 | tabViewport = new QWidget ( tabMain ); | 318 | tabViewport = new QWidget ( tabMain ); |
319 | 319 | ||
320 | vb = new QVBoxLayout( tabViewport ); | 320 | vb = new QVBoxLayout( tabViewport ); |
321 | 321 | ||
322 | svAddress = new QScrollView( tabViewport ); | 322 | svAddress = new QScrollView( tabViewport ); |
323 | vb->addWidget( svAddress, 0, 0 ); | 323 | vb->addWidget( svAddress, 0, 0 ); |
324 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); | 324 | svAddress->setResizePolicy( QScrollView::AutoOneFit ); |
325 | svAddress->setFrameStyle( QFrame::NoFrame ); | 325 | svAddress->setFrameStyle( QFrame::NoFrame ); |
326 | 326 | ||
327 | container = new QWidget( svAddress->viewport() ); | 327 | container = new QWidget( svAddress->viewport() ); |
328 | svAddress->addChild( container ); | 328 | svAddress->addChild( container ); |
329 | 329 | ||
330 | gl = new QGridLayout( container, 5, 3, 2, 3 ); | 330 | gl = new QGridLayout( container, 5, 3, 2, 3 ); |
331 | 331 | ||
332 | cmbAddress = new QComboBox( FALSE, container ); | 332 | cmbAddress = new QComboBox( FALSE, container ); |
333 | cmbAddress->insertItem( tr( "Business" ) ); | 333 | cmbAddress->insertItem( tr( "Business" ) ); |
334 | cmbAddress->insertItem( tr( "Home" ) ); | 334 | cmbAddress->insertItem( tr( "Home" ) ); |
335 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); | 335 | gl->addMultiCellWidget( cmbAddress, 0, 0, 0, 1 ); |
336 | 336 | ||
337 | l = new QLabel( tr( "Address" ), container ); | 337 | l = new QLabel( tr( "Address" ), container ); |
338 | gl->addWidget( l, 1, 0 ); | 338 | gl->addWidget( l, 1, 0 ); |
339 | txtAddress = new QLineEdit( container ); | 339 | txtAddress = new QLineEdit( container ); |
340 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); | 340 | gl->addMultiCellWidget( txtAddress, 1, 1, 1, 2 ); |
341 | /* | 341 | /* |
342 | l = new QLabel( tr( "Address 2" ), container ); | 342 | l = new QLabel( tr( "Address 2" ), container ); |
343 | gl->addWidget( l, 2, 0 ); | 343 | gl->addWidget( l, 2, 0 ); |
344 | txtAddress2 = new QLineEdit( container ); | 344 | txtAddress2 = new QLineEdit( container ); |
345 | gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); | 345 | gl->addMultiCellWidget( txtAddress2, 2, 2, 1, 2 ); |
346 | 346 | ||
347 | l = new QLabel( tr( "P.O. Box" ), container ); | 347 | l = new QLabel( tr( "P.O. Box" ), container ); |
348 | gl->addWidget( l, 3, 0 ); | 348 | gl->addWidget( l, 3, 0 ); |
349 | txtPOBox = new QLineEdit( container ); | 349 | txtPOBox = new QLineEdit( container ); |
350 | gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); | 350 | gl->addMultiCellWidget( txtPOBox, 3, 3, 1, 2 ); |
351 | */ | 351 | */ |
352 | l = new QLabel( tr( "City" ), container ); | 352 | l = new QLabel( tr( "City" ), container ); |
353 | gl->addWidget( l, 2, 0 ); | 353 | gl->addWidget( l, 2, 0 ); |
354 | txtCity = new QLineEdit( container ); | 354 | txtCity = new QLineEdit( container ); |
355 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); | 355 | gl->addMultiCellWidget( txtCity, 2, 2, 1, 2 ); |
356 | 356 | ||
357 | l = new QLabel( tr( "State" ), container ); | 357 | l = new QLabel( tr( "State" ), container ); |
358 | gl->addWidget( l, 3, 0 ); | 358 | gl->addWidget( l, 3, 0 ); |
359 | txtState = new QLineEdit( container ); | 359 | txtState = new QLineEdit( container ); |
360 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); | 360 | gl->addMultiCellWidget( txtState, 3, 3, 1, 2 ); |
361 | 361 | ||
362 | l = new QLabel( tr( "Zip Code" ), container ); | 362 | l = new QLabel( tr( "Zip Code" ), container ); |
363 | gl->addWidget( l, 4, 0 ); | 363 | gl->addWidget( l, 4, 0 ); |
364 | txtZip = new QLineEdit( container ); | 364 | txtZip = new QLineEdit( container ); |
365 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); | 365 | gl->addMultiCellWidget( txtZip, 4, 4, 1, 2 ); |
366 | 366 | ||
367 | l = new QLabel( tr( "Country" ), container ); | 367 | l = new QLabel( tr( "Country" ), container ); |
368 | gl->addWidget( l, 5, 0 ); | 368 | gl->addWidget( l, 5, 0 ); |
369 | cmbCountry = new QComboBox( TRUE, container ); | 369 | cmbCountry = new QComboBox( TRUE, container ); |
370 | cmbCountry->insertItem( tr( "" ) ); | 370 | cmbCountry->insertItem( tr( "" ) ); |
371 | cmbCountry->insertItem( tr( "United States" ) ); | 371 | cmbCountry->insertItem( tr( "United States" ) ); |
372 | cmbCountry->insertItem( tr( "United Kingdom" ) ); | 372 | cmbCountry->insertItem( tr( "United Kingdom" ) ); |
373 | cmbCountry->insertItem( tr( "Japan" ) ); | 373 | cmbCountry->insertItem( tr( "Japan" ) ); |
374 | cmbCountry->insertItem( tr( "France" ) ); | 374 | cmbCountry->insertItem( tr( "France" ) ); |
375 | cmbCountry->insertItem( tr( "Germany" ) ); | 375 | cmbCountry->insertItem( tr( "Germany" ) ); |
376 | cmbCountry->insertItem( tr( "Norway" ) ); | 376 | cmbCountry->insertItem( tr( "Norway" ) ); |
377 | cmbCountry->insertItem( tr( "Canada" ) ); | 377 | cmbCountry->insertItem( tr( "Canada" ) ); |
378 | 378 | ||
379 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); | 379 | gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); |
380 | 380 | ||
381 | tabMain->insertTab( tabViewport, tr( "Address" ) ); | 381 | tabMain->insertTab( tabViewport, tr( "Address" ) ); |
382 | 382 | ||
383 | tabViewport = new QWidget ( tabMain ); | 383 | tabViewport = new QWidget ( tabMain ); |
384 | 384 | ||
385 | vb = new QVBoxLayout( tabViewport ); | 385 | vb = new QVBoxLayout( tabViewport ); |
386 | 386 | ||
387 | svDetails = new QScrollView( tabViewport ); | 387 | svDetails = new QScrollView( tabViewport ); |
388 | vb->addWidget( svDetails, 0, 0 ); | 388 | vb->addWidget( svDetails, 0, 0 ); |
389 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); | 389 | svDetails->setResizePolicy( QScrollView::AutoOneFit ); |
390 | svDetails->setFrameStyle( QFrame::NoFrame ); | 390 | svDetails->setFrameStyle( QFrame::NoFrame ); |
391 | 391 | ||
392 | container = new QWidget( svDetails->viewport() ); | 392 | container = new QWidget( svDetails->viewport() ); |
393 | svDetails->addChild( container ); | 393 | svDetails->addChild( container ); |
394 | 394 | ||
395 | gl = new QGridLayout( container, 1, 2, 2, 3 ); | 395 | gl = new QGridLayout( container, 1, 2, 2, 3 ); |
396 | 396 | ||
397 | QStringList::ConstIterator it = slDynamicEntries->begin(); | 397 | QStringList::ConstIterator it = slDynamicEntries->begin(); |
398 | for (i = 0; it != slDynamicEntries->end(); i++, ++it) { | 398 | for (i = 0; it != slDynamicEntries->end(); i++, ++it) { |
399 | l = new QLabel( *it, container ); | 399 | l = new QLabel( *it, container ); |
400 | listName.append( l ); | 400 | listName.append( l ); |
401 | gl->addWidget( l, i, 0 ); | 401 | gl->addWidget( l, i, 0 ); |
402 | QLineEdit *e = new QLineEdit( container ); | 402 | QLineEdit *e = new QLineEdit( container ); |
403 | listValue.append( e ); | 403 | listValue.append( e ); |
404 | gl->addWidget( e, i, 1); | 404 | gl->addWidget( e, i, 1); |
405 | } | 405 | } |
406 | 406 | ||
407 | l = new QLabel( tr("Gender"), container ); | 407 | l = new QLabel( tr("Gender"), container ); |
408 | gl->addWidget( l, slDynamicEntries->count(), 0 ); | 408 | gl->addWidget( l, slDynamicEntries->count(), 0 ); |
409 | cmbGender = new QComboBox( container ); | 409 | cmbGender = new QComboBox( container ); |
410 | cmbGender->insertItem( "", 0 ); | 410 | cmbGender->insertItem( "", 0 ); |
411 | cmbGender->insertItem( tr("Male"), 1); | 411 | cmbGender->insertItem( tr("Male"), 1); |
412 | cmbGender->insertItem( tr("Female"), 2); | 412 | cmbGender->insertItem( tr("Female"), 2); |
413 | gl->addWidget( cmbGender, slDynamicEntries->count(), 1 ); | 413 | gl->addWidget( cmbGender, slDynamicEntries->count(), 1 ); |
414 | 414 | ||
415 | tabMain->insertTab( tabViewport, tr( "Details" ) ); | 415 | tabMain->insertTab( tabViewport, tr( "Details" ) ); |
416 | 416 | ||
417 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); | 417 | dlgNote = new QDialog( this, "Note Dialog", TRUE ); |
418 | dlgNote->setCaption( tr("Enter Note") ); | 418 | dlgNote->setCaption( tr("Enter Note") ); |
419 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); | 419 | QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); |
420 | txtNote = new QMultiLineEdit( dlgNote ); | 420 | txtNote = new QMultiLineEdit( dlgNote ); |
421 | vbNote->addWidget( txtNote ); | 421 | vbNote->addWidget( txtNote ); |
422 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); | 422 | connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); |
423 | 423 | ||
424 | dlgName = new QDialog( this, "Name Dialog", TRUE ); | 424 | dlgName = new QDialog( this, "Name Dialog", TRUE ); |
425 | dlgName->setCaption( tr("Edit Name") ); | 425 | dlgName->setCaption( tr("Edit Name") ); |
426 | gl = new QGridLayout( dlgName, 4, 2, 2, 3 ); | 426 | gl = new QGridLayout( dlgName, 4, 2, 2, 3 ); |
427 | 427 | ||
428 | l = new QLabel( tr("First Name"), dlgName ); | 428 | l = new QLabel( tr("First Name"), dlgName ); |
429 | gl->addWidget( l, 0, 0 ); | 429 | gl->addWidget( l, 0, 0 ); |
430 | txtFirstName = new QLineEdit( dlgName ); | 430 | txtFirstName = new QLineEdit( dlgName ); |
431 | gl->addWidget( txtFirstName, 0, 1 ); | 431 | gl->addWidget( txtFirstName, 0, 1 ); |
432 | 432 | ||
433 | l = new QLabel( tr("Middle Name"), dlgName ); | 433 | l = new QLabel( tr("Middle Name"), dlgName ); |
434 | gl->addWidget( l, 1, 0 ); | 434 | gl->addWidget( l, 1, 0 ); |
435 | txtMiddleName = new QLineEdit( dlgName ); | 435 | txtMiddleName = new QLineEdit( dlgName ); |
436 | gl->addWidget( txtMiddleName, 1, 1 ); | 436 | gl->addWidget( txtMiddleName, 1, 1 ); |
437 | 437 | ||
438 | l = new QLabel( tr("Last Name"), dlgName ); | 438 | l = new QLabel( tr("Last Name"), dlgName ); |
439 | gl->addWidget( l, 2, 0 ); | 439 | gl->addWidget( l, 2, 0 ); |
440 | txtLastName = new QLineEdit( dlgName ); | 440 | txtLastName = new QLineEdit( dlgName ); |
441 | gl->addWidget( txtLastName, 2, 1 ); | 441 | gl->addWidget( txtLastName, 2, 1 ); |
442 | 442 | ||
443 | l = new QLabel( tr("Suffix"), dlgName ); | 443 | l = new QLabel( tr("Suffix"), dlgName ); |
444 | gl->addWidget( l, 3, 0 ); | 444 | gl->addWidget( l, 3, 0 ); |
445 | txtSuffix = new QLineEdit( dlgName ); | 445 | txtSuffix = new QLineEdit( dlgName ); |
446 | gl->addWidget( txtSuffix, 3, 1 ); | 446 | gl->addWidget( txtSuffix, 3, 1 ); |
447 | 447 | ||
448 | cmbChooserField1->insertStringList( *slChooserNames ); | 448 | cmbChooserField1->insertStringList( *slChooserNames ); |
449 | cmbChooserField2->insertStringList( *slChooserNames ); | 449 | cmbChooserField2->insertStringList( *slChooserNames ); |
450 | cmbChooserField3->insertStringList( *slChooserNames ); | 450 | cmbChooserField3->insertStringList( *slChooserNames ); |
451 | 451 | ||
452 | cmbChooserField1->setCurrentItem( 0 ); | 452 | cmbChooserField1->setCurrentItem( 0 ); |
453 | cmbChooserField2->setCurrentItem( 1 ); | 453 | cmbChooserField2->setCurrentItem( 1 ); |
454 | cmbChooserField3->setCurrentItem( 2 ); | 454 | cmbChooserField3->setCurrentItem( 2 ); |
455 | 455 | ||
456 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); | 456 | connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); |
457 | 457 | ||
458 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); | 458 | connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); |
459 | 459 | ||
460 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); | 460 | connect( txtChooserField1, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser1Change(const QString &)) ); |
461 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); | 461 | connect( txtChooserField2, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser2Change(const QString &)) ); |
462 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); | 462 | connect( txtChooserField3, SIGNAL(textChanged(const QString &)), this, SLOT(slotChooser3Change(const QString &)) ); |
463 | connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) ); | 463 | connect( txtAddress, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddressChange(const QString &)) ); |
464 | //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); | 464 | //connect( txtAddress2, SIGNAL(textChanged(const QString &)), this, SLOT(slotAddress2Change(const QString &)) ); |
465 | //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); | 465 | //connect( txtPOBox, SIGNAL(textChanged(const QString &)), this, SLOT(slotPOBoxChange(const QString &)) ); |
466 | connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) ); | 466 | connect( txtCity, SIGNAL(textChanged(const QString &)), this, SLOT(slotCityChange(const QString &)) ); |
467 | connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) ); | 467 | connect( txtState, SIGNAL(textChanged(const QString &)), this, SLOT(slotStateChange(const QString &)) ); |
468 | connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) ); | 468 | connect( txtZip, SIGNAL(textChanged(const QString &)), this, SLOT(slotZipChange(const QString &)) ); |
469 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); | 469 | connect( cmbCountry, SIGNAL(textChanged(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); |
470 | connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); | 470 | connect( cmbCountry, SIGNAL(activated(const QString &)), this, SLOT(slotCountryChange(const QString &)) ); |
471 | connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) ); | 471 | connect( cmbChooserField1, SIGNAL(activated(int)), this, SLOT(slotCmbChooser1Change(int)) ); |
472 | connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) ); | 472 | connect( cmbChooserField2, SIGNAL(activated(int)), this, SLOT(slotCmbChooser2Change(int)) ); |
473 | connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) ); | 473 | connect( cmbChooserField3, SIGNAL(activated(int)), this, SLOT(slotCmbChooser3Change(int)) ); |
474 | connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); | 474 | connect( cmbAddress, SIGNAL(activated(int)), this, SLOT(slotAddressTypeChange(int)) ); |
475 | new QPEDialogListener(this); | 475 | new QPEDialogListener(this); |
476 | } | 476 | } |
477 | 477 | ||
478 | void ContactEditor::initMap() | 478 | void ContactEditor::initMap() |
479 | { | 479 | { |
480 | /* | 480 | /* |
481 | // since the fields and the XML fields exist, create a map | 481 | // since the fields and the XML fields exist, create a map |
482 | // between them... | 482 | // between them... |
483 | Config cfg1( "AddressBook" ); | 483 | Config cfg1( "AddressBook" ); |
484 | Config cfg2( "AddressBook" ); | 484 | Config cfg2( "AddressBook" ); |
485 | QString strCfg1, | 485 | QString strCfg1, |
486 | strCfg2; | 486 | strCfg2; |
487 | int i; | 487 | int i; |
488 | 488 | ||
489 | // This stuff better exist... | 489 | // This stuff better exist... |
490 | cfg1.setGroup( "AddressFields" ); | 490 | cfg1.setGroup( "AddressFields" ); |
491 | o cfg2.setGroup( "XMLFields" ); | 491 | o cfg2.setGroup( "XMLFields" ); |
492 | i = 0; | 492 | i = 0; |
493 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); | 493 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), QString::null ); |
494 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | 494 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), |
495 | QString::null ); | 495 | QString::null ); |
496 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { | 496 | while ( !strCfg1.isNull() && !strCfg2.isNull() ) { |
497 | mapField.insert( strCfg1, strCfg2 ); | 497 | mapField.insert( strCfg1, strCfg2 ); |
498 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), | 498 | strCfg1 = cfg1.readEntry( "Field" + QString::number(i), |
499 | QString::null ); | 499 | QString::null ); |
500 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), | 500 | strCfg2 = cfg2.readEntry( "XMLField" + QString::number(i++), |
501 | QString::null ); | 501 | QString::null ); |
502 | } | 502 | } |
503 | */ | 503 | */ |
504 | } | 504 | } |
505 | 505 | ||
506 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { | 506 | void ContactEditor::slotChooser1Change( const QString &textChanged ) { |
507 | 507 | ||
508 | int index = cmbChooserField1->currentItem(); | 508 | int index = cmbChooserField1->currentItem(); |
509 | 509 | ||
510 | (*slChooserValues)[index] = textChanged; | 510 | (*slChooserValues)[index] = textChanged; |
511 | 511 | ||
512 | } | 512 | } |
513 | 513 | ||
514 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { | 514 | void ContactEditor::slotChooser2Change( const QString &textChanged ) { |
515 | 515 | ||
516 | int index = cmbChooserField2->currentItem(); | 516 | int index = cmbChooserField2->currentItem(); |
517 | 517 | ||
518 | (*slChooserValues)[index] = textChanged; | 518 | (*slChooserValues)[index] = textChanged; |
519 | 519 | ||
520 | } | 520 | } |
521 | 521 | ||
522 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { | 522 | void ContactEditor::slotChooser3Change( const QString &textChanged ) { |
523 | 523 | ||
524 | int index = cmbChooserField3->currentItem(); | 524 | int index = cmbChooserField3->currentItem(); |
525 | 525 | ||
526 | (*slChooserValues)[index] = textChanged; | 526 | (*slChooserValues)[index] = textChanged; |
527 | 527 | ||
528 | } | 528 | } |
529 | 529 | ||
530 | void ContactEditor::slotAddressChange( const QString &textChanged ) { | 530 | void ContactEditor::slotAddressChange( const QString &textChanged ) { |
531 | 531 | ||
532 | qDebug((*slBusinessAddress)[0]); | ||
533 | qDebug((*slHomeAddress)[0]); | ||
534 | qDebug(textChanged); | ||
535 | if ( cmbAddress->currentItem() == 0 ) { | 532 | if ( cmbAddress->currentItem() == 0 ) { |
536 | (*slBusinessAddress)[0] = textChanged; | 533 | (*slBusinessAddress)[0] = textChanged; |
537 | } else { | 534 | } else { |
538 | (*slHomeAddress)[0] = textChanged; | 535 | (*slHomeAddress)[0] = textChanged; |
539 | } | 536 | } |
540 | } | 537 | } |
541 | 538 | ||
542 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { | 539 | void ContactEditor::slotAddress2Change( const QString &textChanged ) { |
543 | 540 | ||
544 | qDebug((*slBusinessAddress)[1]); | ||
545 | qDebug((*slHomeAddress)[1]); | ||
546 | qDebug(textChanged); | ||
547 | |||
548 | if ( cmbAddress->currentItem() == 0 ) { | 541 | if ( cmbAddress->currentItem() == 0 ) { |
549 | (*slBusinessAddress)[1] = textChanged; | 542 | (*slBusinessAddress)[1] = textChanged; |
550 | } else { | 543 | } else { |
551 | (*slHomeAddress)[1] = textChanged; | 544 | (*slHomeAddress)[1] = textChanged; |
552 | } | 545 | } |
553 | } | 546 | } |
554 | 547 | ||
555 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { | 548 | void ContactEditor::slotPOBoxChange( const QString &textChanged ) { |
556 | 549 | ||
557 | qDebug((*slBusinessAddress)[2]); | ||
558 | qDebug((*slHomeAddress)[2]); | ||
559 | qDebug(textChanged); | ||
560 | if ( cmbAddress->currentItem() == 0 ) { | 550 | if ( cmbAddress->currentItem() == 0 ) { |
561 | (*slBusinessAddress)[2] = textChanged; | 551 | (*slBusinessAddress)[2] = textChanged; |
562 | } else { | 552 | } else { |
563 | (*slHomeAddress)[2] = textChanged; | 553 | (*slHomeAddress)[2] = textChanged; |
564 | } | 554 | } |
565 | } | 555 | } |
566 | 556 | ||
567 | void ContactEditor::slotCityChange( const QString &textChanged ) { | 557 | void ContactEditor::slotCityChange( const QString &textChanged ) { |
568 | 558 | ||
569 | qDebug((*slBusinessAddress)[3]); | ||
570 | qDebug((*slHomeAddress)[3]); | ||
571 | qDebug(textChanged); | ||
572 | if ( cmbAddress->currentItem() == 0 ) { | 559 | if ( cmbAddress->currentItem() == 0 ) { |
573 | (*slBusinessAddress)[3] = textChanged; | 560 | (*slBusinessAddress)[3] = textChanged; |
574 | } else { | 561 | } else { |
575 | (*slHomeAddress)[3] = textChanged; | 562 | (*slHomeAddress)[3] = textChanged; |
576 | } | 563 | } |
577 | } | 564 | } |
578 | 565 | ||
579 | void ContactEditor::slotStateChange( const QString &textChanged ) { | 566 | void ContactEditor::slotStateChange( const QString &textChanged ) { |
580 | 567 | ||
581 | 568 | ||
582 | qDebug((*slBusinessAddress)[4]); | ||
583 | qDebug((*slHomeAddress)[4]); | ||
584 | qDebug(textChanged); | ||
585 | if ( cmbAddress->currentItem() == 0 ) { | 569 | if ( cmbAddress->currentItem() == 0 ) { |
586 | (*slBusinessAddress)[4] = textChanged; | 570 | (*slBusinessAddress)[4] = textChanged; |
587 | } else { | 571 | } else { |
588 | (*slHomeAddress)[4] = textChanged; | 572 | (*slHomeAddress)[4] = textChanged; |
589 | } | 573 | } |
590 | } | 574 | } |
591 | 575 | ||
592 | void ContactEditor::slotZipChange( const QString &textChanged ) { | 576 | void ContactEditor::slotZipChange( const QString &textChanged ) { |
593 | 577 | ||
594 | qDebug((*slBusinessAddress)[5]); | ||
595 | qDebug((*slHomeAddress)[5]); | ||
596 | qDebug(textChanged); | ||
597 | if ( cmbAddress->currentItem() == 0 ) { | 578 | if ( cmbAddress->currentItem() == 0 ) { |
598 | (*slBusinessAddress)[5] = textChanged; | 579 | (*slBusinessAddress)[5] = textChanged; |
599 | } else { | 580 | } else { |
600 | (*slHomeAddress)[5] = textChanged; | 581 | (*slHomeAddress)[5] = textChanged; |
601 | } | 582 | } |
602 | } | 583 | } |
603 | 584 | ||
604 | void ContactEditor::slotCountryChange( const QString &textChanged ) { | 585 | void ContactEditor::slotCountryChange( const QString &textChanged ) { |
605 | 586 | ||
606 | qDebug((*slBusinessAddress)[6]); | ||
607 | qDebug((*slHomeAddress)[6]); | ||
608 | qDebug(textChanged); | ||
609 | if ( cmbAddress->currentItem() == 0 ) { | 587 | if ( cmbAddress->currentItem() == 0 ) { |
610 | (*slBusinessAddress)[6] = textChanged; | 588 | (*slBusinessAddress)[6] = textChanged; |
611 | } else { | 589 | } else { |
612 | (*slHomeAddress)[6] = textChanged; | 590 | (*slHomeAddress)[6] = textChanged; |
613 | } | 591 | } |
614 | } | 592 | } |
615 | 593 | ||
616 | void ContactEditor::slotCmbChooser1Change( int index ) { | 594 | void ContactEditor::slotCmbChooser1Change( int index ) { |
617 | 595 | ||
618 | txtChooserField1->setText( (*slChooserValues)[index] ); | 596 | txtChooserField1->setText( (*slChooserValues)[index] ); |
619 | 597 | ||
620 | } | 598 | } |
621 | 599 | ||
622 | void ContactEditor::slotCmbChooser2Change( int index ) { | 600 | void ContactEditor::slotCmbChooser2Change( int index ) { |
623 | 601 | ||
624 | txtChooserField2->setText( (*slChooserValues)[index] ); | 602 | txtChooserField2->setText( (*slChooserValues)[index] ); |
625 | 603 | ||
626 | } | 604 | } |
627 | 605 | ||
628 | void ContactEditor::slotCmbChooser3Change( int index ) { | 606 | void ContactEditor::slotCmbChooser3Change( int index ) { |
629 | 607 | ||
630 | txtChooserField3->setText( (*slChooserValues)[index] ); | 608 | txtChooserField3->setText( (*slChooserValues)[index] ); |
631 | 609 | ||
632 | } | 610 | } |
633 | 611 | ||
634 | void ContactEditor::slotAddressTypeChange( int index ) { | 612 | void ContactEditor::slotAddressTypeChange( int index ) { |
635 | 613 | ||
636 | qDebug((*slBusinessAddress)[0]); | ||
637 | qDebug((*slBusinessAddress)[1]); | ||
638 | qDebug((*slBusinessAddress)[2]); | ||
639 | qDebug((*slBusinessAddress)[3]); | ||
640 | qDebug((*slBusinessAddress)[4]); | ||
641 | qDebug((*slBusinessAddress)[5]); | ||
642 | qDebug((*slBusinessAddress)[6]); | ||
643 | |||
644 | |||
645 | |||
646 | if ( index == 0 ) { | 614 | if ( index == 0 ) { |
647 | 615 | ||
648 | txtAddress->setText( (*slBusinessAddress)[0] ); | 616 | txtAddress->setText( (*slBusinessAddress)[0] ); |
649 | //txtAddress2->setText( (*slBusinessAddress)[1] ); | 617 | //txtAddress2->setText( (*slBusinessAddress)[1] ); |
650 | //txtPOBox->setText( (*slBusinessAddress)[2] ); | 618 | //txtPOBox->setText( (*slBusinessAddress)[2] ); |
651 | txtCity->setText( (*slBusinessAddress)[3] ); | 619 | txtCity->setText( (*slBusinessAddress)[3] ); |
652 | txtState->setText( (*slBusinessAddress)[4] ); | 620 | txtState->setText( (*slBusinessAddress)[4] ); |
653 | txtZip->setText( (*slBusinessAddress)[5] ); | 621 | txtZip->setText( (*slBusinessAddress)[5] ); |
654 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 622 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
655 | txtTmp->setText( (*slBusinessAddress)[6] ); | 623 | txtTmp->setText( (*slBusinessAddress)[6] ); |
656 | 624 | ||
657 | } else { | 625 | } else { |
658 | 626 | ||
659 | txtAddress->setText( (*slHomeAddress)[0] ); | 627 | txtAddress->setText( (*slHomeAddress)[0] ); |
660 | //txtAddress2->setText( (*slHomeAddress)[1] ); | 628 | //txtAddress2->setText( (*slHomeAddress)[1] ); |
661 | //txtPOBox->setText( (*slHomeAddress)[2] ); | 629 | //txtPOBox->setText( (*slHomeAddress)[2] ); |
662 | txtCity->setText( (*slHomeAddress)[3] ); | 630 | txtCity->setText( (*slHomeAddress)[3] ); |
663 | txtState->setText( (*slHomeAddress)[4] ); | 631 | txtState->setText( (*slHomeAddress)[4] ); |
664 | txtZip->setText( (*slHomeAddress)[5] ); | 632 | txtZip->setText( (*slHomeAddress)[5] ); |
665 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 633 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
666 | txtTmp->setText( (*slHomeAddress)[6] ); | 634 | txtTmp->setText( (*slHomeAddress)[6] ); |
667 | 635 | ||
668 | } | 636 | } |
669 | 637 | ||
670 | } | 638 | } |
671 | 639 | ||
672 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { | 640 | void ContactEditor::slotFullNameChange( const QString &textChanged ) { |
673 | 641 | ||
674 | int index = cmbFileAs->currentItem(); | 642 | int index = cmbFileAs->currentItem(); |
675 | 643 | ||
676 | cmbFileAs->clear(); | 644 | cmbFileAs->clear(); |
677 | 645 | ||
678 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); | 646 | cmbFileAs->insertItem( parseName( textChanged, 0 ) ); |
679 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); | 647 | cmbFileAs->insertItem( parseName( textChanged, 1 ) ); |
680 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); | 648 | cmbFileAs->insertItem( parseName( textChanged, 2 ) ); |
681 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); | 649 | cmbFileAs->insertItem( parseName( textChanged, 3 ) ); |
682 | 650 | ||
683 | cmbFileAs->setCurrentItem( index ); | 651 | cmbFileAs->setCurrentItem( index ); |
684 | 652 | ||
685 | useFullName = TRUE; | 653 | useFullName = TRUE; |
686 | 654 | ||
687 | } | 655 | } |
688 | 656 | ||
689 | void ContactEditor::loadFields() { | 657 | void ContactEditor::loadFields() { |
690 | 658 | ||
691 | QStringList::ConstIterator it; | 659 | QStringList::ConstIterator it; |
692 | QListIterator<QLabel> lit( listName ); | 660 | QListIterator<QLabel> lit( listName ); |
693 | for ( it = slDynamicEntries->begin(); *lit; ++lit, ++it) { | 661 | for ( it = slDynamicEntries->begin(); *lit; ++lit, ++it) { |
694 | (*lit)->setText( *it ); | 662 | (*lit)->setText( *it ); |
695 | } | 663 | } |
696 | } | 664 | } |
697 | 665 | ||
698 | void ContactEditor::accept() { | 666 | void ContactEditor::accept() { |
699 | 667 | ||
700 | if ( isEmpty() ) { | 668 | if ( isEmpty() ) { |
701 | cleanupFields(); | 669 | cleanupFields(); |
702 | reject(); | 670 | reject(); |
703 | } else { | 671 | } else { |
704 | saveEntry(); | 672 | saveEntry(); |
705 | cleanupFields(); | 673 | cleanupFields(); |
706 | QDialog::accept(); | 674 | QDialog::accept(); |
707 | } | 675 | } |
708 | 676 | ||
709 | } | 677 | } |
710 | 678 | ||
711 | void ContactEditor::slotNote() { | 679 | void ContactEditor::slotNote() { |
712 | 680 | ||
713 | dlgNote->showMaximized(); | 681 | dlgNote->showMaximized(); |
714 | if ( !dlgNote->exec() ) { | 682 | if ( !dlgNote->exec() ) { |
715 | txtNote->setText( ent.notes() ); | 683 | txtNote->setText( ent.notes() ); |
716 | } | 684 | } |
717 | } | 685 | } |
718 | 686 | ||
719 | void ContactEditor::slotName() { | 687 | void ContactEditor::slotName() { |
720 | 688 | ||
721 | if (useFullName = TRUE) { | 689 | if (useFullName = TRUE) { |
722 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); | 690 | txtFirstName->setText( parseName(txtFullName->text(), NAME_F) ); |
723 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); | 691 | txtMiddleName->setText( parseName(txtFullName->text(), NAME_M) ); |
724 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); | 692 | txtLastName->setText( parseName(txtFullName->text(), NAME_L) ); |
725 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); | 693 | txtSuffix->setText( parseName(txtFullName->text(), NAME_S) ); |
726 | } | 694 | } |
727 | 695 | ||
728 | dlgName->showMaximized(); | 696 | dlgName->showMaximized(); |
729 | if ( dlgName->exec() ) { | 697 | if ( dlgName->exec() ) { |
730 | txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); | 698 | txtFullName->setText( txtFirstName->text() + " " + txtMiddleName->text() + " " + txtLastName->text() + " " + txtSuffix->text() ); |
731 | slotFullNameChange( txtFullName->text() ); | 699 | slotFullNameChange( txtFullName->text() ); |
732 | useFullName = FALSE; | 700 | useFullName = FALSE; |
733 | } | 701 | } |
734 | 702 | ||
735 | } | 703 | } |
736 | 704 | ||
737 | void ContactEditor::setNameFocus() { | 705 | void ContactEditor::setNameFocus() { |
738 | 706 | ||
739 | txtFullName->setFocus(); | 707 | txtFullName->setFocus(); |
740 | 708 | ||
741 | } | 709 | } |
742 | 710 | ||
743 | bool ContactEditor::isEmpty() { | 711 | bool ContactEditor::isEmpty() { |
744 | // Test and see if the record should be saved. | 712 | // Test and see if the record should be saved. |
745 | // More strict than the original qtopia, needs name or fileas to save | 713 | // More strict than the original qtopia, needs name or fileas to save |
746 | 714 | ||
747 | QString t = txtFullName->text(); | 715 | QString t = txtFullName->text(); |
748 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 716 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
749 | return false; | 717 | return false; |
750 | 718 | ||
751 | t = cmbFileAs->currentText(); | 719 | t = cmbFileAs->currentText(); |
752 | if ( !t.isEmpty() && containsAlphaNum( t ) ) | 720 | if ( !t.isEmpty() && containsAlphaNum( t ) ) |
753 | return false; | 721 | return false; |
754 | 722 | ||
755 | return true; | 723 | return true; |
756 | 724 | ||
757 | } | 725 | } |
758 | 726 | ||
759 | QString ContactEditor::parseName( const QString fullName, int type ) { | 727 | QString ContactEditor::parseName( const QString fullName, int type ) { |
760 | 728 | ||
761 | QString simplifiedName( fullName.simplifyWhiteSpace() ); | 729 | QString simplifiedName( fullName.simplifyWhiteSpace() ); |
762 | QString strFirstName; | 730 | QString strFirstName; |
763 | QString strMiddleName; | 731 | QString strMiddleName; |
764 | QString strLastName; | 732 | QString strLastName; |
765 | QString strSuffix; | 733 | QString strSuffix; |
766 | QString strTitle; | 734 | QString strTitle; |
767 | int commapos; | 735 | int commapos; |
768 | int spCount; | 736 | int spCount; |
769 | int spPos; | 737 | int spPos; |
770 | int spPos2; | 738 | int spPos2; |
771 | 739 | ||
772 | 740 | ||
773 | commapos = simplifiedName.find( ',', 0, TRUE); | 741 | commapos = simplifiedName.find( ',', 0, TRUE); |
774 | spCount = simplifiedName.contains( ' ', TRUE ); | 742 | spCount = simplifiedName.contains( ' ', TRUE ); |
775 | 743 | ||
776 | if ( commapos == -1 ) { | 744 | if ( commapos == -1 ) { |
777 | 745 | ||
778 | switch (spCount) { | 746 | switch (spCount) { |
779 | case 0: | 747 | case 0: |
780 | return simplifiedName; | 748 | return simplifiedName; |
781 | 749 | ||
782 | case 1: | 750 | case 1: |
783 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 751 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
784 | strFirstName = simplifiedName.left( spPos ); | 752 | strFirstName = simplifiedName.left( spPos ); |
785 | strLastName = simplifiedName.mid( spPos + 1 ); | 753 | strLastName = simplifiedName.mid( spPos + 1 ); |
786 | break; | 754 | break; |
787 | 755 | ||
788 | case 2: | 756 | case 2: |
789 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 757 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
790 | strFirstName = simplifiedName.left( spPos ); | 758 | strFirstName = simplifiedName.left( spPos ); |
791 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 759 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
792 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 760 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
793 | strLastName = simplifiedName.mid( spPos2 + 1 ); | 761 | strLastName = simplifiedName.mid( spPos2 + 1 ); |
794 | break; | 762 | break; |
795 | 763 | ||
796 | case 3: | 764 | case 3: |
797 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 765 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
798 | strFirstName = simplifiedName.left( spPos ); | 766 | strFirstName = simplifiedName.left( spPos ); |
799 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 767 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
800 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 768 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
801 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 769 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
802 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 770 | strLastName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
803 | strSuffix = simplifiedName.mid( spPos + 1 ); | 771 | strSuffix = simplifiedName.mid( spPos + 1 ); |
804 | break; | 772 | break; |
805 | 773 | ||
806 | case 4: | 774 | case 4: |
807 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 775 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
808 | strTitle = simplifiedName.left( spPos ); | 776 | strTitle = simplifiedName.left( spPos ); |
809 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 777 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
810 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 778 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
811 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 779 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
812 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 780 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
813 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 781 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
814 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 782 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
815 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 783 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
816 | break; | 784 | break; |
817 | 785 | ||
818 | default: | 786 | default: |
819 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 787 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
820 | strTitle = simplifiedName.left( spPos ); | 788 | strTitle = simplifiedName.left( spPos ); |
821 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 789 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
822 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 790 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
823 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 791 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
824 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 792 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
825 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 793 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
826 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 794 | strLastName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
827 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 795 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
828 | break; | 796 | break; |
829 | } | 797 | } |
830 | } else { | 798 | } else { |
831 | simplifiedName.replace( commapos, 1, " " ); | 799 | simplifiedName.replace( commapos, 1, " " ); |
832 | simplifiedName = simplifiedName.simplifyWhiteSpace(); | 800 | simplifiedName = simplifiedName.simplifyWhiteSpace(); |
833 | 801 | ||
834 | switch (spCount) { | 802 | switch (spCount) { |
835 | case 0: | 803 | case 0: |
836 | return simplifiedName; | 804 | return simplifiedName; |
837 | 805 | ||
838 | case 1: | 806 | case 1: |
839 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 807 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
840 | strLastName = simplifiedName.left( spPos ); | 808 | strLastName = simplifiedName.left( spPos ); |
841 | strFirstName = simplifiedName.mid( spPos + 1 ); | 809 | strFirstName = simplifiedName.mid( spPos + 1 ); |
842 | break; | 810 | break; |
843 | 811 | ||
844 | case 2: | 812 | case 2: |
845 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 813 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
846 | strLastName = simplifiedName.left( spPos ); | 814 | strLastName = simplifiedName.left( spPos ); |
847 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 815 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
848 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 816 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
849 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); | 817 | strMiddleName = simplifiedName.mid( spPos2 + 1 ); |
850 | break; | 818 | break; |
851 | 819 | ||
852 | case 3: | 820 | case 3: |
853 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 821 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
854 | strLastName = simplifiedName.left( spPos ); | 822 | strLastName = simplifiedName.left( spPos ); |
855 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 823 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
856 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 824 | strFirstName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
857 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 825 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
858 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 826 | strMiddleName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
859 | strSuffix = simplifiedName.mid( spPos + 1 ); | 827 | strSuffix = simplifiedName.mid( spPos + 1 ); |
860 | break; | 828 | break; |
861 | 829 | ||
862 | case 4: | 830 | case 4: |
863 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 831 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
864 | strLastName = simplifiedName.left( spPos ); | 832 | strLastName = simplifiedName.left( spPos ); |
865 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 833 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
866 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 834 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
867 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 835 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
868 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 836 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
869 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 837 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
870 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 838 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
871 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 839 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
872 | break; | 840 | break; |
873 | 841 | ||
874 | default: | 842 | default: |
875 | spPos = simplifiedName.find( ' ', 0, TRUE ); | 843 | spPos = simplifiedName.find( ' ', 0, TRUE ); |
876 | strLastName = simplifiedName.left( spPos ); | 844 | strLastName = simplifiedName.left( spPos ); |
877 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 845 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
878 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 846 | strTitle = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
879 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); | 847 | spPos = simplifiedName.find( ' ', spPos2 + 1, TRUE ); |
880 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); | 848 | strFirstName = simplifiedName.mid( spPos2 + 1, (spPos - 1) - spPos ); |
881 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); | 849 | spPos2 = simplifiedName.find( ' ', spPos + 1, TRUE ); |
882 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); | 850 | strMiddleName = simplifiedName.mid( spPos + 1, (spPos2 - 1) - spPos ); |
883 | strSuffix = simplifiedName.mid( spPos2 + 1 ); | 851 | strSuffix = simplifiedName.mid( spPos2 + 1 ); |
884 | break; | 852 | break; |
885 | } | 853 | } |
886 | } | 854 | } |
887 | 855 | ||
888 | switch (type) { | 856 | switch (type) { |
889 | case NAME_FL: | 857 | case NAME_FL: |
890 | return strFirstName + " " + strLastName; | 858 | return strFirstName + " " + strLastName; |
891 | 859 | ||
892 | case NAME_LF: | 860 | case NAME_LF: |
893 | return strLastName + ", " + strFirstName; | 861 | return strLastName + ", " + strFirstName; |
894 | 862 | ||
895 | case NAME_LFM: | 863 | case NAME_LFM: |
896 | return strLastName + ", " + strFirstName + " " + strMiddleName; | 864 | return strLastName + ", " + strFirstName + " " + strMiddleName; |
897 | 865 | ||
898 | case NAME_FMLS: | 866 | case NAME_FMLS: |
899 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; | 867 | return strFirstName + " " + strMiddleName + " " + strLastName + " " + strSuffix; |
900 | 868 | ||
901 | case NAME_F: | 869 | case NAME_F: |
902 | return strFirstName; | 870 | return strFirstName; |
903 | 871 | ||
904 | case NAME_M: | 872 | case NAME_M: |
905 | return strMiddleName; | 873 | return strMiddleName; |
906 | 874 | ||
907 | case NAME_L: | 875 | case NAME_L: |
908 | return strLastName; | 876 | return strLastName; |
909 | 877 | ||
910 | case NAME_S: | 878 | case NAME_S: |
911 | return strSuffix; | 879 | return strSuffix; |
912 | 880 | ||
913 | } | 881 | } |
914 | } | 882 | } |
915 | 883 | ||
916 | void ContactEditor::cleanupFields() { | 884 | void ContactEditor::cleanupFields() { |
917 | 885 | ||
918 | QStringList::Iterator it = slChooserValues->begin(); | 886 | QStringList::Iterator it = slChooserValues->begin(); |
919 | for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { | 887 | for ( int i = 0; it != slChooserValues->end(); i++, ++it ) { |
920 | (*it) = ""; | 888 | (*it) = ""; |
921 | } | 889 | } |
922 | 890 | ||
923 | for ( int i = 0; i < 7; i++ ) { | 891 | for ( int i = 0; i < 7; i++ ) { |
924 | (*slHomeAddress)[i] = ""; | 892 | (*slHomeAddress)[i] = ""; |
925 | (*slBusinessAddress)[i] = ""; | 893 | (*slBusinessAddress)[i] = ""; |
926 | } | 894 | } |
927 | 895 | ||
928 | QStringList::ConstIterator cit; | 896 | QStringList::ConstIterator cit; |
929 | QListIterator<QLineEdit> itLE( listValue ); | 897 | QListIterator<QLineEdit> itLE( listValue ); |
930 | for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { | 898 | for ( cit = slDynamicEntries->begin(); cit != slDynamicEntries->end(); ++cit, ++itLE) { |
931 | (*itLE)->setText( "" ); | 899 | (*itLE)->setText( "" ); |
932 | } | 900 | } |
933 | 901 | ||
934 | txtFirstName->setText(""); | 902 | txtFirstName->setText(""); |
935 | txtMiddleName->setText(""); | 903 | txtMiddleName->setText(""); |
936 | txtLastName->setText(""); | 904 | txtLastName->setText(""); |
937 | txtSuffix->setText(""); | 905 | txtSuffix->setText(""); |
938 | txtNote->setText(""); | 906 | txtNote->setText(""); |
939 | txtFullName->setText(""); | 907 | txtFullName->setText(""); |
940 | txtJobTitle->setText(""); | 908 | txtJobTitle->setText(""); |
941 | txtOrganization->setText(""); | 909 | txtOrganization->setText(""); |
942 | txtChooserField1->setText(""); | 910 | txtChooserField1->setText(""); |
943 | txtChooserField2->setText(""); | 911 | txtChooserField2->setText(""); |
944 | txtChooserField3->setText(""); | 912 | txtChooserField3->setText(""); |
945 | txtAddress->setText(""); | 913 | txtAddress->setText(""); |
946 | //txtAddress2->setText(""); | 914 | //txtAddress2->setText(""); |
947 | txtCity->setText(""); | 915 | txtCity->setText(""); |
948 | //txtPOBox->setText(""); | 916 | //txtPOBox->setText(""); |
949 | txtState->setText(""); | 917 | txtState->setText(""); |
950 | txtZip->setText(""); | 918 | txtZip->setText(""); |
951 | QLineEdit *txtTmp = cmbCountry->lineEdit(); | 919 | QLineEdit *txtTmp = cmbCountry->lineEdit(); |
952 | txtTmp->setText(""); | 920 | txtTmp->setText(""); |
953 | txtTmp = cmbFileAs->lineEdit(); | 921 | txtTmp = cmbFileAs->lineEdit(); |
954 | txtTmp->setText(""); | 922 | txtTmp->setText(""); |
955 | 923 | ||
956 | } | 924 | } |
957 | 925 | ||
958 | void ContactEditor::setEntry( const Contact &entry ) { | 926 | void ContactEditor::setEntry( const Contact &entry ) { |
959 | 927 | ||
960 | cleanupFields(); | 928 | cleanupFields(); |
961 | 929 | ||
962 | 930 | ||
963 | ent = entry; | 931 | ent = entry; |
964 | 932 | ||
965 | useFullName = FALSE; | 933 | useFullName = FALSE; |
966 | txtFirstName->setText( ent.firstName() ); | 934 | txtFirstName->setText( ent.firstName() ); |
967 | txtMiddleName->setText( ent.middleName() ); | 935 | txtMiddleName->setText( ent.middleName() ); |
968 | txtLastName->setText( ent.lastName() ); | 936 | txtLastName->setText( ent.lastName() ); |
969 | txtSuffix->setText( ent.suffix() ); | 937 | txtSuffix->setText( ent.suffix() ); |
970 | 938 | ||
971 | QString *tmpString = new QString; | 939 | QString *tmpString = new QString; |
972 | *tmpString = ent.firstName() + " " + ent.middleName() + | 940 | *tmpString = ent.firstName() + " " + ent.middleName() + |
973 | + " " + ent.lastName() + " " + ent.suffix(); | 941 | + " " + ent.lastName() + " " + ent.suffix(); |
974 | 942 | ||
975 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); | 943 | txtFullName->setText( tmpString->simplifyWhiteSpace() ); |
976 | 944 | ||
977 | cmbFileAs->setEditText( ent.fileAs() ); | 945 | cmbFileAs->setEditText( ent.fileAs() ); |
978 | 946 | ||
979 | if (hasTitle) | 947 | if (hasTitle) |
980 | txtJobTitle->setText( ent.jobTitle() ); | 948 | txtJobTitle->setText( ent.jobTitle() ); |
981 | 949 | ||
982 | if (hasCompany) | 950 | if (hasCompany) |
983 | txtOrganization->setText( ent.company() ); | 951 | txtOrganization->setText( ent.company() ); |
984 | 952 | ||
985 | if (hasNotes) | 953 | if (hasNotes) |
986 | txtNote->setText( ent.notes() ); | 954 | txtNote->setText( ent.notes() ); |
987 | 955 | ||
988 | if (hasStreet) { | 956 | if (hasStreet) { |
989 | (*slHomeAddress)[0] = ent.homeStreet(); | 957 | (*slHomeAddress)[0] = ent.homeStreet(); |
990 | (*slBusinessAddress)[0] = ent.businessStreet(); | 958 | (*slBusinessAddress)[0] = ent.businessStreet(); |
991 | } | 959 | } |
992 | /* | 960 | /* |
993 | if (hasStreet2) { | 961 | if (hasStreet2) { |
994 | (*slHomeAddress)[1] = ent.homeStreet2(); | 962 | (*slHomeAddress)[1] = ent.homeStreet2(); |
995 | (*slBusinessAddress)[1] = ent.businessStreet2(); | 963 | (*slBusinessAddress)[1] = ent.businessStreet2(); |
996 | } | 964 | } |
997 | 965 | ||
998 | if (hasPOBox) { | 966 | if (hasPOBox) { |
999 | (*slHomeAddress)[2] = ent.homePOBox(); | 967 | (*slHomeAddress)[2] = ent.homePOBox(); |
1000 | (*slBusinessAddress)[2] = ent.businessPOBox(); | 968 | (*slBusinessAddress)[2] = ent.businessPOBox(); |
1001 | } | 969 | } |
1002 | */ | 970 | */ |
1003 | if (hasCity) { | 971 | if (hasCity) { |
1004 | (*slHomeAddress)[3] = ent.homeCity(); | 972 | (*slHomeAddress)[3] = ent.homeCity(); |
1005 | (*slBusinessAddress)[3] = ent.homeCity(); | 973 | (*slBusinessAddress)[3] = ent.businessCity(); |
1006 | } | 974 | } |
1007 | 975 | ||
1008 | if (hasState) { | 976 | if (hasState) { |
1009 | (*slHomeAddress)[4] = ent.homeState(); | 977 | (*slHomeAddress)[4] = ent.homeState(); |
1010 | (*slBusinessAddress)[4] = ent.businessState(); | 978 | (*slBusinessAddress)[4] = ent.businessState(); |
1011 | } | 979 | } |
1012 | 980 | ||
1013 | if (hasZip) { | 981 | if (hasZip) { |
1014 | (*slHomeAddress)[5] = ent.homeZip(); | 982 | (*slHomeAddress)[5] = ent.homeZip(); |
1015 | (*slBusinessAddress)[5] = ent.businessZip(); | 983 | (*slBusinessAddress)[5] = ent.businessZip(); |
1016 | } | 984 | } |
1017 | 985 | ||
1018 | if (hasCountry) { | 986 | if (hasCountry) { |
1019 | (*slHomeAddress)[6] = ent.homeCountry(); | 987 | (*slHomeAddress)[6] = ent.homeCountry(); |
1020 | (*slBusinessAddress)[6] = ent.businessCountry(); | 988 | (*slBusinessAddress)[6] = ent.businessCountry(); |
1021 | } | 989 | } |
1022 | 990 | ||
1023 | QStringList::ConstIterator it; | 991 | QStringList::ConstIterator it; |
1024 | QListIterator<QLineEdit> itLE( listValue ); | 992 | QListIterator<QLineEdit> itLE( listValue ); |
1025 | for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { | 993 | for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { |
1026 | if ( *it == "Department" ) | 994 | if ( *it == "Department" ) |
1027 | (*itLE)->setText( ent.department() ); | 995 | (*itLE)->setText( ent.department() ); |
1028 | 996 | ||
1029 | if ( *it == "Company" ) | 997 | if ( *it == "Company" ) |
1030 | (*itLE)->setText( ent.company() ); | 998 | (*itLE)->setText( ent.company() ); |
1031 | 999 | ||
1032 | if ( *it == "Office" ) | 1000 | if ( *it == "Office" ) |
1033 | (*itLE)->setText( ent.office() ); | 1001 | (*itLE)->setText( ent.office() ); |
1034 | 1002 | ||
1035 | if ( *it == "Profession" ) | 1003 | if ( *it == "Profession" ) |
1036 | (*itLE)->setText( ent.profession() ); | 1004 | (*itLE)->setText( ent.profession() ); |
1037 | 1005 | ||
1038 | if ( *it == "Assistant" ) | 1006 | if ( *it == "Assistant" ) |
1039 | (*itLE)->setText( ent.assistant() ); | 1007 | (*itLE)->setText( ent.assistant() ); |
1040 | 1008 | ||
1041 | if ( *it == "Manager" ) | 1009 | if ( *it == "Manager" ) |
1042 | (*itLE)->setText( ent.manager() ); | 1010 | (*itLE)->setText( ent.manager() ); |
1043 | 1011 | ||
1044 | if ( *it == "Spouse" ) | 1012 | if ( *it == "Spouse" ) |
1045 | (*itLE)->setText( ent.spouse() ); | 1013 | (*itLE)->setText( ent.spouse() ); |
1046 | 1014 | ||
1047 | if ( *it == "Birthday" ) | 1015 | if ( *it == "Birthday" ) |
1048 | (*itLE)->setText( ent.birthday() ); | 1016 | (*itLE)->setText( ent.birthday() ); |
1049 | 1017 | ||
1050 | if ( *it == "Anniversary" ) | 1018 | if ( *it == "Anniversary" ) |
1051 | (*itLE)->setText( ent.anniversary() ); | 1019 | (*itLE)->setText( ent.anniversary() ); |
1052 | 1020 | ||
1053 | if ( *it == "Nickname" ) | 1021 | if ( *it == "Nickname" ) |
1054 | (*itLE)->setText( ent.nickname() ); | 1022 | (*itLE)->setText( ent.nickname() ); |
1055 | 1023 | ||
1056 | if ( *it == "Children" ) | 1024 | if ( *it == "Children" ) |
1057 | (*itLE)->setText( ent.children() ); | 1025 | (*itLE)->setText( ent.children() ); |
1058 | 1026 | ||
1059 | } | 1027 | } |
1060 | 1028 | ||
1061 | QStringList::Iterator itV; | 1029 | QStringList::Iterator itV; |
1062 | for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { | 1030 | for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { |
1063 | 1031 | ||
1064 | if ( *it == "Business Phone" || *it == "Work Phone" ) | 1032 | if ( *it == "Business Phone" || *it == "Work Phone" ) |
1065 | *itV = ent.businessPhone(); | 1033 | *itV = ent.businessPhone(); |
1066 | /* | 1034 | /* |
1067 | if ( *it == "Business 2 Phone" ) | 1035 | if ( *it == "Business 2 Phone" ) |
1068 | *itV = ent.business2Phone(); | 1036 | *itV = ent.business2Phone(); |
1069 | */ | 1037 | */ |
1070 | if ( *it == "Business Fax" || *it == "Work Fax" ) | 1038 | if ( *it == "Business Fax" || *it == "Work Fax" ) |
1071 | *itV = ent.businessFax(); | 1039 | *itV = ent.businessFax(); |
1072 | 1040 | ||
1073 | if ( *it == "Business Mobile" || *it == "work Mobile" ) | 1041 | if ( *it == "Business Mobile" || *it == "work Mobile" ) |
1074 | *itV = ent.businessMobile(); | 1042 | *itV = ent.businessMobile(); |
1075 | /* | 1043 | /* |
1076 | if ( *it == "Company Phone" ) | 1044 | if ( *it == "Company Phone" ) |
1077 | *itV = ent.companyPhone(); | 1045 | *itV = ent.companyPhone(); |
1078 | */ | 1046 | */ |
1079 | if ( *it == "Default Email" ) | 1047 | if ( *it == "Default Email" ) |
1080 | *itV = ent.defaultEmail(); | 1048 | *itV = ent.defaultEmail(); |
1081 | 1049 | ||
1082 | if ( *it == "Emails" ) | 1050 | if ( *it == "Emails" ) |
1083 | *itV = ent.emails(); | 1051 | *itV = ent.emails(); |
1084 | 1052 | ||
1085 | if ( *it == "Home Phone" ) | 1053 | if ( *it == "Home Phone" ) |
1086 | *itV = ent.homePhone(); | 1054 | *itV = ent.homePhone(); |
1087 | /* | 1055 | /* |
1088 | if ( *it == "Home 2 Phone" ) | 1056 | if ( *it == "Home 2 Phone" ) |
1089 | *itV = ent.home2Phone(); | 1057 | *itV = ent.home2Phone(); |
1090 | */ | 1058 | */ |
1091 | if ( *it == "Home Fax" ) | 1059 | if ( *it == "Home Fax" ) |
1092 | *itV = ent.homeFax(); | 1060 | *itV = ent.homeFax(); |
1093 | 1061 | ||
1094 | if ( *it == "Home Mobile" ) | 1062 | if ( *it == "Home Mobile" ) |
1095 | *itV = ent.homeMobile(); | 1063 | *itV = ent.homeMobile(); |
1096 | /* | 1064 | /* |
1097 | if ( *it == "Car Phone" ) | 1065 | if ( *it == "Car Phone" ) |
1098 | *itV = ent.carPhone(); | 1066 | *itV = ent.carPhone(); |
1099 | 1067 | ||
1100 | if ( *it == "ISDN Phone" ) | 1068 | if ( *it == "ISDN Phone" ) |
1101 | *itV = ent.ISDNPhone(); | 1069 | *itV = ent.ISDNPhone(); |
1102 | 1070 | ||
1103 | if ( *it == "Other Phone" ) | 1071 | if ( *it == "Other Phone" ) |
1104 | *itV = ent.otherPhone(); | 1072 | *itV = ent.otherPhone(); |
1105 | */ | 1073 | */ |
1106 | if ( *it == "Business Pager" || *it == "Work Pager" ) | 1074 | if ( *it == "Business Pager" || *it == "Work Pager" ) |
1107 | *itV = ent.businessPager(); | 1075 | *itV = ent.businessPager(); |
1108 | /* | 1076 | /* |
1109 | if ( *it == "Home Pager") | 1077 | if ( *it == "Home Pager") |
1110 | *itV = ent.homePager(); | 1078 | *itV = ent.homePager(); |
1111 | 1079 | ||
1112 | if ( *it == "AIM IM" ) | 1080 | if ( *it == "AIM IM" ) |
1113 | *itV = ent.AIMIM(); | 1081 | *itV = ent.AIMIM(); |
1114 | 1082 | ||
1115 | if ( *it == "ICQ IM" ) | 1083 | if ( *it == "ICQ IM" ) |
1116 | *itV = ent.ICQIM(); | 1084 | *itV = ent.ICQIM(); |
1117 | 1085 | ||
1118 | if ( *it == "Jabber IM" ) | 1086 | if ( *it == "Jabber IM" ) |
1119 | *itV = ent.jabberIM(); | 1087 | *itV = ent.jabberIM(); |
1120 | 1088 | ||
1121 | if ( *it == "MSN IM" ) | 1089 | if ( *it == "MSN IM" ) |
1122 | *itV = ent.MSNIM(); | 1090 | *itV = ent.MSNIM(); |
1123 | 1091 | ||
1124 | if ( *it == "Yahoo IM" ) | 1092 | if ( *it == "Yahoo IM" ) |
1125 | *itV = ent.yahooIM(); | 1093 | *itV = ent.yahooIM(); |
1126 | */ | 1094 | */ |
1127 | if ( *it == "Home Web Page" ) | 1095 | if ( *it == "Home Web Page" ) |
1128 | *itV = ent.homeWebpage(); | 1096 | *itV = ent.homeWebpage(); |
1129 | if ( *it == "Business Web Page" || *it == "Work Web Page" ) | 1097 | if ( *it == "Business Web Page" || *it == "Work Web Page" ) |
1130 | *itV = ent.businessWebpage(); | 1098 | *itV = ent.businessWebpage(); |
1131 | 1099 | ||
1132 | 1100 | ||
1133 | } | 1101 | } |
1134 | 1102 | ||
1135 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); | 1103 | cmbCat->setCategories( ent.categories(), "Contacts", tr("Contacts") ); |
1136 | 1104 | ||
1137 | QString gender = ent.gender(); | 1105 | QString gender = ent.gender(); |
1138 | cmbGender->setCurrentItem( gender.toInt() ); | 1106 | cmbGender->setCurrentItem( gender.toInt() ); |
1139 | 1107 | ||
1140 | txtNote->setText( ent.notes() ); | 1108 | txtNote->setText( ent.notes() ); |
1141 | 1109 | ||
1142 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); | 1110 | slotCmbChooser1Change( cmbChooserField1->currentItem() ); |
1143 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); | 1111 | slotCmbChooser2Change( cmbChooserField2->currentItem() ); |
1144 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); | 1112 | slotCmbChooser3Change( cmbChooserField3->currentItem() ); |
1145 | 1113 | ||
1146 | slotAddressTypeChange( cmbAddress->currentItem() ); | 1114 | slotAddressTypeChange( cmbAddress->currentItem() ); |
1147 | 1115 | ||
1148 | } | 1116 | } |
1149 | 1117 | ||
1150 | void ContactEditor::saveEntry() { | 1118 | void ContactEditor::saveEntry() { |
1151 | 1119 | ||
1152 | if ( useFullName == TRUE ) { | 1120 | if ( useFullName == TRUE ) { |
1153 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); | 1121 | txtFirstName->setText( parseName( txtFullName->text(), NAME_F ) ); |
1154 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); | 1122 | txtMiddleName->setText( parseName( txtFullName->text(), NAME_M ) ); |
1155 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); | 1123 | txtLastName->setText( parseName( txtFullName->text(), NAME_L ) ); |
1156 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); | 1124 | txtSuffix->setText( parseName( txtFullName->text(), NAME_S ) ); |
1157 | 1125 | ||
1158 | useFullName = FALSE; | 1126 | useFullName = FALSE; |
1159 | } | 1127 | } |
1160 | 1128 | ||
1161 | /*if ( ent.firstName() != txtFirstName->text() || | 1129 | /*if ( ent.firstName() != txtFirstName->text() || |
1162 | ent.lastName != txtLastName->text() || | 1130 | ent.lastName != txtLastName->text() || |
1163 | ent.middleName != txtMiddleName->text() ) { | 1131 | ent.middleName != txtMiddleName->text() ) { |
1164 | */ | 1132 | */ |
1165 | ent.setFirstName( txtFirstName->text() ); | 1133 | ent.setFirstName( txtFirstName->text() ); |
1166 | ent.setLastName( txtLastName->text() ); | 1134 | ent.setLastName( txtLastName->text() ); |
1167 | ent.setMiddleName( txtMiddleName->text() ); | 1135 | ent.setMiddleName( txtMiddleName->text() ); |
1168 | 1136 | ||
1169 | //} | 1137 | //} |
1170 | 1138 | ||
1171 | ent.setFileAs( cmbFileAs->currentText() ); | 1139 | ent.setFileAs( cmbFileAs->currentText() ); |
1172 | 1140 | ||
1173 | ent.setCategories( cmbCat->currentCategories() ); | 1141 | ent.setCategories( cmbCat->currentCategories() ); |
1174 | 1142 | ||
1175 | if (hasTitle) | 1143 | if (hasTitle) |
1176 | ent.setJobTitle( txtJobTitle->text() ); | 1144 | ent.setJobTitle( txtJobTitle->text() ); |
1177 | 1145 | ||
1178 | if (hasCompany) | 1146 | if (hasCompany) |
1179 | ent.setCompany( txtOrganization->text() ); | 1147 | ent.setCompany( txtOrganization->text() ); |
1180 | 1148 | ||
1181 | if (hasNotes) | 1149 | if (hasNotes) |
1182 | ent.setNotes( txtNote->text() ); | 1150 | ent.setNotes( txtNote->text() ); |
1183 | 1151 | ||
1184 | if (hasStreet) { | 1152 | if (hasStreet) { |
1185 | ent.setHomeStreet( (*slHomeAddress)[0] ); | 1153 | ent.setHomeStreet( (*slHomeAddress)[0] ); |
1186 | ent.setBusinessStreet( (*slBusinessAddress)[0] ); | 1154 | ent.setBusinessStreet( (*slBusinessAddress)[0] ); |
1187 | } | 1155 | } |
1188 | /* | 1156 | /* |
1189 | if (hasStreet2) { | 1157 | if (hasStreet2) { |
1190 | ent.setHomeStreet2( (*slHomeAddress)[1] ); | 1158 | ent.setHomeStreet2( (*slHomeAddress)[1] ); |
1191 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); | 1159 | ent.setBusinessStreet2( (*slBusinessAddress)[1] ); |
1192 | } | 1160 | } |
1193 | 1161 | ||
1194 | if (hasPOBox) { | 1162 | if (hasPOBox) { |
1195 | ent.setHomePOBox( (*slHomeAddress)[2] ); | 1163 | ent.setHomePOBox( (*slHomeAddress)[2] ); |
1196 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); | 1164 | ent.setBusinessPOBox( (*slBusinessAddress)[2] ); |
1197 | } | 1165 | } |
1198 | */ | 1166 | */ |
1199 | if (hasCity) { | 1167 | if (hasCity) { |
1200 | ent.setHomeCity( (*slHomeAddress)[3] ); | 1168 | ent.setHomeCity( (*slHomeAddress)[3] ); |
1201 | ent.setBusinessCity( (*slBusinessAddress)[3] ); | 1169 | ent.setBusinessCity( (*slBusinessAddress)[3] ); |
1202 | } | 1170 | } |
1203 | 1171 | ||
1204 | if (hasState) { | 1172 | if (hasState) { |
1205 | ent.setHomeState( (*slHomeAddress)[4] ); | 1173 | ent.setHomeState( (*slHomeAddress)[4] ); |
1206 | ent.setBusinessState( (*slBusinessAddress)[4] ); | 1174 | ent.setBusinessState( (*slBusinessAddress)[4] ); |
1207 | } | 1175 | } |
1208 | 1176 | ||
1209 | if (hasZip) { | 1177 | if (hasZip) { |
1210 | ent.setHomeZip( (*slHomeAddress)[5] ); | 1178 | ent.setHomeZip( (*slHomeAddress)[5] ); |
1211 | ent.setBusinessZip( (*slBusinessAddress)[5] ); | 1179 | ent.setBusinessZip( (*slBusinessAddress)[5] ); |
1212 | } | 1180 | } |
1213 | 1181 | ||
1214 | if (hasCountry) { | 1182 | if (hasCountry) { |
1215 | ent.setHomeCountry( (*slHomeAddress)[6] ); | 1183 | ent.setHomeCountry( (*slHomeAddress)[6] ); |
1216 | ent.setBusinessCountry( (*slBusinessAddress)[6] ); | 1184 | ent.setBusinessCountry( (*slBusinessAddress)[6] ); |
1217 | } | 1185 | } |
1218 | 1186 | ||
1219 | QStringList::ConstIterator it; | 1187 | QStringList::ConstIterator it; |
1220 | QListIterator<QLineEdit> itLE( listValue ); | 1188 | QListIterator<QLineEdit> itLE( listValue ); |
1221 | for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { | 1189 | for ( it = slDynamicEntries->begin(); it != slDynamicEntries->end(); ++it, ++itLE) { |
1222 | if ( *it == "Department" ) | 1190 | if ( *it == "Department" ) |
1223 | ent.setDepartment( (*itLE)->text() ); | 1191 | ent.setDepartment( (*itLE)->text() ); |
1224 | 1192 | ||
1225 | if ( *it == "Company" ) | 1193 | if ( *it == "Company" ) |
1226 | ent.setCompany( (*itLE)->text() ); | 1194 | ent.setCompany( (*itLE)->text() ); |
1227 | 1195 | ||
1228 | if ( *it == "Office" ) | 1196 | if ( *it == "Office" ) |
1229 | ent.setOffice( (*itLE)->text() ); | 1197 | ent.setOffice( (*itLE)->text() ); |
1230 | 1198 | ||
1231 | if ( *it == "Profession" ) | 1199 | if ( *it == "Profession" ) |
1232 | ent.setProfession( (*itLE)->text() ); | 1200 | ent.setProfession( (*itLE)->text() ); |
1233 | 1201 | ||
1234 | if ( *it == "Assistant" ) | 1202 | if ( *it == "Assistant" ) |
1235 | ent.setAssistant( (*itLE)->text() ); | 1203 | ent.setAssistant( (*itLE)->text() ); |
1236 | 1204 | ||
1237 | if ( *it == "Manager" ) | 1205 | if ( *it == "Manager" ) |
1238 | ent.setManager( (*itLE)->text() ); | 1206 | ent.setManager( (*itLE)->text() ); |
1239 | 1207 | ||
1240 | if ( *it == "Spouse" ) | 1208 | if ( *it == "Spouse" ) |
1241 | ent.setSpouse( (*itLE)->text() ); | 1209 | ent.setSpouse( (*itLE)->text() ); |
1242 | 1210 | ||
1243 | if ( *it == "Birthday" ) | 1211 | if ( *it == "Birthday" ) |
1244 | ent.setBirthday( (*itLE)->text() ); | 1212 | ent.setBirthday( (*itLE)->text() ); |
1245 | 1213 | ||
1246 | if ( *it == "Anniversary" ) | 1214 | if ( *it == "Anniversary" ) |
1247 | ent.setAnniversary( (*itLE)->text() ); | 1215 | ent.setAnniversary( (*itLE)->text() ); |
1248 | 1216 | ||
1249 | if ( *it == "Nickname" ) | 1217 | if ( *it == "Nickname" ) |
1250 | ent.setNickname( (*itLE)->text() ); | 1218 | ent.setNickname( (*itLE)->text() ); |
1251 | 1219 | ||
1252 | if ( *it == "Children" ) | 1220 | if ( *it == "Children" ) |
1253 | ent.setChildren( (*itLE)->text() ); | 1221 | ent.setChildren( (*itLE)->text() ); |
1254 | 1222 | ||
1255 | } | 1223 | } |
1256 | 1224 | ||
1257 | QStringList::ConstIterator itV; | 1225 | QStringList::ConstIterator itV; |
1258 | for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { | 1226 | for ( it = slChooserNames->begin(), itV = slChooserValues->begin(); it != slChooserNames->end(); ++it, ++itV ) { |
1259 | 1227 | ||
1260 | if ( *it == "Business Phone" || *it == "Work Phone" ) | 1228 | if ( *it == "Business Phone" || *it == "Work Phone" ) |
1261 | ent.setBusinessPhone( *itV ); | 1229 | ent.setBusinessPhone( *itV ); |
1262 | /* | 1230 | /* |
1263 | if ( *it == "Business 2 Phone" ) | 1231 | if ( *it == "Business 2 Phone" ) |
1264 | ent.setBusiness2Phone( *itV ); | 1232 | ent.setBusiness2Phone( *itV ); |
1265 | */ | 1233 | */ |
1266 | if ( *it == "Business Fax" || *it == "Work Fax" ) | 1234 | if ( *it == "Business Fax" || *it == "Work Fax" ) |
1267 | ent.setBusinessFax( *itV ); | 1235 | ent.setBusinessFax( *itV ); |
1268 | 1236 | ||
1269 | if ( *it == "Business Mobile" || *it == "Work Mobile" ) | 1237 | if ( *it == "Business Mobile" || *it == "Work Mobile" ) |
1270 | ent.setBusinessMobile( *itV ); | 1238 | ent.setBusinessMobile( *itV ); |
1271 | /* | 1239 | /* |
1272 | if ( *it == "Company Phone" ) | 1240 | if ( *it == "Company Phone" ) |
1273 | ent.setCompanyPhone( *itV ); | 1241 | ent.setCompanyPhone( *itV ); |
1274 | */ | 1242 | */ |
1275 | //if ( *it == "Default Email" ) | 1243 | //if ( *it == "Default Email" ) |
1276 | //ent.setDefaultEmail( *itV ); | 1244 | //ent.setDefaultEmail( *itV ); |
1277 | 1245 | ||
1278 | if ( *it == "Emails" ) { | 1246 | if ( *it == "Emails" ) { |
1279 | QString allemail; | 1247 | QString allemail; |
1280 | QString defaultmail; | 1248 | QString defaultmail; |
1281 | parseEmailFrom( *itV, defaultmail, allemail ); | 1249 | parseEmailFrom( *itV, defaultmail, allemail ); |
1282 | ent.setDefaultEmail( defaultmail ); | 1250 | ent.setDefaultEmail( defaultmail ); |
1283 | ent.setEmails( *itV ); | 1251 | ent.setEmails( *itV ); |
1284 | } | 1252 | } |
1285 | 1253 | ||
1286 | if ( *it == "Home Phone" ) | 1254 | if ( *it == "Home Phone" ) |
1287 | ent.setHomePhone( *itV ); | 1255 | ent.setHomePhone( *itV ); |
1288 | /* | 1256 | /* |
1289 | if ( *it == "Home 2 Phone" ) | 1257 | if ( *it == "Home 2 Phone" ) |
1290 | ent.setHome2Phone( *itV ); | 1258 | ent.setHome2Phone( *itV ); |
1291 | */ | 1259 | */ |
1292 | if ( *it == "Home Fax" ) | 1260 | if ( *it == "Home Fax" ) |
1293 | ent.setHomeFax( *itV ); | 1261 | ent.setHomeFax( *itV ); |
1294 | 1262 | ||
1295 | if ( *it == "Home Mobile" ) | 1263 | if ( *it == "Home Mobile" ) |
1296 | ent.setHomeMobile( *itV ); | 1264 | ent.setHomeMobile( *itV ); |
1297 | /* | 1265 | /* |
1298 | if ( *it == "Car Phone" ) | 1266 | if ( *it == "Car Phone" ) |
1299 | ent.setCarPhone( *itV ); | 1267 | ent.setCarPhone( *itV ); |
1300 | 1268 | ||
1301 | if ( *it == "ISDN Phone" ) | 1269 | if ( *it == "ISDN Phone" ) |
1302 | ent.setISDNPhone( *itV ); | 1270 | ent.setISDNPhone( *itV ); |
1303 | 1271 | ||
1304 | if ( *it == "Other Phone" ) | 1272 | if ( *it == "Other Phone" ) |
1305 | ent.setOtherPhone( *itV ); | 1273 | ent.setOtherPhone( *itV ); |
1306 | */ | 1274 | */ |
1307 | if ( *it == "Business Pager" || *it == "Work Pager" ) | 1275 | if ( *it == "Business Pager" || *it == "Work Pager" ) |
1308 | ent.setBusinessPager( *itV ); | 1276 | ent.setBusinessPager( *itV ); |
1309 | /* | 1277 | /* |
1310 | if ( *it == "Home Pager" ) | 1278 | if ( *it == "Home Pager" ) |
1311 | ent.setHomePager( *itV ); | 1279 | ent.setHomePager( *itV ); |
1312 | 1280 | ||
1313 | if ( *it == "AIM IM" ) | 1281 | if ( *it == "AIM IM" ) |
1314 | ent.setAIMIM( *itV ); | 1282 | ent.setAIMIM( *itV ); |
1315 | 1283 | ||
1316 | if ( *it == "ICQ IM" ) | 1284 | if ( *it == "ICQ IM" ) |
1317 | ent.setICQIM( *itV ); | 1285 | ent.setICQIM( *itV ); |
1318 | 1286 | ||
1319 | if ( *it == "Jabber IM" ) | 1287 | if ( *it == "Jabber IM" ) |
1320 | ent.setJabberIM( *itV ); | 1288 | ent.setJabberIM( *itV ); |
1321 | 1289 | ||
1322 | if ( *it == "MSN IM" ) | 1290 | if ( *it == "MSN IM" ) |
1323 | ent.setMSNIM( *itV ); | 1291 | ent.setMSNIM( *itV ); |
1324 | 1292 | ||
1325 | if ( *it == "Yahoo IM" ) | 1293 | if ( *it == "Yahoo IM" ) |
1326 | ent.setYahooIM( *itV ); | 1294 | ent.setYahooIM( *itV ); |
1327 | */ | 1295 | */ |
1328 | if ( *it == "Home Web Page" ) | 1296 | if ( *it == "Home Web Page" ) |
1329 | ent.setHomeWebpage( *itV ); | 1297 | ent.setHomeWebpage( *itV ); |
1330 | if ( *it == "Business Web Page" || *it == "Work Web Page" ) | 1298 | if ( *it == "Business Web Page" || *it == "Work Web Page" ) |
1331 | ent.setBusinessWebpage( *itV ); | 1299 | ent.setBusinessWebpage( *itV ); |
1332 | 1300 | ||
1333 | 1301 | ||
1334 | } | 1302 | } |
1335 | 1303 | ||
1336 | int gender = cmbGender->currentItem(); | 1304 | int gender = cmbGender->currentItem(); |
1337 | ent.setGender( QString::number( gender ) ); | 1305 | ent.setGender( QString::number( gender ) ); |
1338 | 1306 | ||
1339 | QString str = txtNote->text(); | 1307 | QString str = txtNote->text(); |
1340 | if ( !str.isNull() ) | 1308 | if ( !str.isNull() ) |
1341 | ent.setNotes( str ); | 1309 | ent.setNotes( str ); |
1342 | 1310 | ||
1343 | } | 1311 | } |
1344 | 1312 | ||
1345 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, | 1313 | void parseEmailFrom( const QString &txt, QString &strDefaultEmail, |
1346 | QString &strAll ) | 1314 | QString &strAll ) |
1347 | { | 1315 | { |
1348 | int where, | 1316 | int where, |
1349 | start; | 1317 | start; |
1350 | if ( txt.isEmpty() ) | 1318 | if ( txt.isEmpty() ) |
1351 | return; | 1319 | return; |
1352 | // find the first | 1320 | // find the first |
1353 | where = txt.find( ',' ); | 1321 | where = txt.find( ',' ); |
1354 | if ( where < 0 ) { | 1322 | if ( where < 0 ) { |
1355 | strDefaultEmail = txt; | 1323 | strDefaultEmail = txt; |
1356 | strAll = txt; | 1324 | strAll = txt; |
1357 | } else { | 1325 | } else { |
1358 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); | 1326 | strDefaultEmail = txt.left( where ).stripWhiteSpace(); |
1359 | strAll = strDefaultEmail; | 1327 | strAll = strDefaultEmail; |
1360 | while ( where > -1 ) { | 1328 | while ( where > -1 ) { |
1361 | strAll.append(" "); | 1329 | strAll.append(" "); |
1362 | start = where; | 1330 | start = where; |
1363 | where = txt.find( ',', where + 1 ); | 1331 | where = txt.find( ',', where + 1 ); |
1364 | if ( where > - 1 ) | 1332 | if ( where > - 1 ) |
1365 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); | 1333 | strAll.append( txt.mid(start + 1, where - start - 1).stripWhiteSpace() ); |
1366 | else // grab until the end... | 1334 | else // grab until the end... |
1367 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); | 1335 | strAll.append( txt.right(txt.length() - start - 1).stripWhiteSpace() ); |
1368 | } | 1336 | } |
1369 | } | 1337 | } |
1370 | } | 1338 | } |
1371 | 1339 | ||
1372 | void parseEmailTo( const QString &strDefaultEmail, | 1340 | void parseEmailTo( const QString &strDefaultEmail, |
1373 | const QString &strOtherEmail, QString &strBack ) | 1341 | const QString &strOtherEmail, QString &strBack ) |
1374 | { | 1342 | { |
1375 | // create a comma dilimeted set of emails... | 1343 | // create a comma dilimeted set of emails... |
1376 | // use the power of short circuiting... | 1344 | // use the power of short circuiting... |
1377 | bool foundDefault = false; | 1345 | bool foundDefault = false; |
1378 | QString strTmp; | 1346 | QString strTmp; |
1379 | int start = 0; | 1347 | int start = 0; |
1380 | int where; | 1348 | int where; |
1381 | // start at the beginng. | 1349 | // start at the beginng. |
1382 | strBack = strDefaultEmail; | 1350 | strBack = strDefaultEmail; |
1383 | where = 0; | 1351 | where = 0; |
1384 | while ( where > -1 ) { | 1352 | while ( where > -1 ) { |
1385 | start = where; | 1353 | start = where; |
1386 | where = strOtherEmail.find( ' ', where + 1 ); | 1354 | where = strOtherEmail.find( ' ', where + 1 ); |
1387 | if ( where > 0 ) { | 1355 | if ( where > 0 ) { |
1388 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); | 1356 | strTmp = strOtherEmail.mid( start, where - start ).stripWhiteSpace(); |
1389 | } else | 1357 | } else |