summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp4
-rw-r--r--core/pim/addressbook/ocontactfields.cpp257
-rw-r--r--core/pim/addressbook/ocontactfields.h2
3 files changed, 176 insertions, 87 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index d830ad3..9efb8c0 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -360,390 +360,392 @@ void ContactEditor::init() {
360 cmbCountry->insertItem( tr ( "Madagascar" ) ); 360 cmbCountry->insertItem( tr ( "Madagascar" ) );
361 cmbCountry->insertItem( tr ( "Malawi" ) ); 361 cmbCountry->insertItem( tr ( "Malawi" ) );
362 cmbCountry->insertItem( tr ( "Malaysia" ) ); 362 cmbCountry->insertItem( tr ( "Malaysia" ) );
363 cmbCountry->insertItem( tr ( "Maldives" ) ); 363 cmbCountry->insertItem( tr ( "Maldives" ) );
364 cmbCountry->insertItem( tr ( "Mali" ) ); 364 cmbCountry->insertItem( tr ( "Mali" ) );
365 cmbCountry->insertItem( tr ( "Malta" ) ); 365 cmbCountry->insertItem( tr ( "Malta" ) );
366 cmbCountry->insertItem( tr ( "Martinique" ) ); 366 cmbCountry->insertItem( tr ( "Martinique" ) );
367 cmbCountry->insertItem( tr ( "Mauritania" ) ); 367 cmbCountry->insertItem( tr ( "Mauritania" ) );
368 cmbCountry->insertItem( tr ( "Mauritius" ) ); 368 cmbCountry->insertItem( tr ( "Mauritius" ) );
369 cmbCountry->insertItem( tr ( "Mayotte" ) ); 369 cmbCountry->insertItem( tr ( "Mayotte" ) );
370 cmbCountry->insertItem( tr ( "Mexico" ) ); 370 cmbCountry->insertItem( tr ( "Mexico" ) );
371 cmbCountry->insertItem( tr ( "Micronesia" ) ); 371 cmbCountry->insertItem( tr ( "Micronesia" ) );
372 cmbCountry->insertItem( tr ( "Moldova" ) ); 372 cmbCountry->insertItem( tr ( "Moldova" ) );
373 cmbCountry->insertItem( tr ( "Monaco" ) ); 373 cmbCountry->insertItem( tr ( "Monaco" ) );
374 cmbCountry->insertItem( tr ( "Mongolia" ) ); 374 cmbCountry->insertItem( tr ( "Mongolia" ) );
375 cmbCountry->insertItem( tr ( "Montserrat" ) ); 375 cmbCountry->insertItem( tr ( "Montserrat" ) );
376 cmbCountry->insertItem( tr ( "Morocco" ) ); 376 cmbCountry->insertItem( tr ( "Morocco" ) );
377 cmbCountry->insertItem( tr ( "Mozambique" ) ); 377 cmbCountry->insertItem( tr ( "Mozambique" ) );
378 cmbCountry->insertItem( tr ( "Myanmar" ) ); 378 cmbCountry->insertItem( tr ( "Myanmar" ) );
379 cmbCountry->insertItem( tr ( "Namibia" ) ); 379 cmbCountry->insertItem( tr ( "Namibia" ) );
380 cmbCountry->insertItem( tr ( "Nauru" ) ); 380 cmbCountry->insertItem( tr ( "Nauru" ) );
381 cmbCountry->insertItem( tr ( "Nepal" ) ); 381 cmbCountry->insertItem( tr ( "Nepal" ) );
382 cmbCountry->insertItem( tr ( "Netherlands" ) ); 382 cmbCountry->insertItem( tr ( "Netherlands" ) );
383 cmbCountry->insertItem( tr ( "New Caledonia" ) ); 383 cmbCountry->insertItem( tr ( "New Caledonia" ) );
384 cmbCountry->insertItem( tr ( "New Zealand" ) ); 384 cmbCountry->insertItem( tr ( "New Zealand" ) );
385 cmbCountry->insertItem( tr ( "Nicaragua" ) ); 385 cmbCountry->insertItem( tr ( "Nicaragua" ) );
386 cmbCountry->insertItem( tr ( "Niger" ) ); 386 cmbCountry->insertItem( tr ( "Niger" ) );
387 cmbCountry->insertItem( tr ( "Nigeria" ) ); 387 cmbCountry->insertItem( tr ( "Nigeria" ) );
388 cmbCountry->insertItem( tr ( "Niue" ) ); 388 cmbCountry->insertItem( tr ( "Niue" ) );
389 cmbCountry->insertItem( tr ( "Norway" ) ); 389 cmbCountry->insertItem( tr ( "Norway" ) );
390 cmbCountry->insertItem( tr ( "Oman" ) ); 390 cmbCountry->insertItem( tr ( "Oman" ) );
391 cmbCountry->insertItem( tr ( "Pakistan" ) ); 391 cmbCountry->insertItem( tr ( "Pakistan" ) );
392 cmbCountry->insertItem( tr ( "Palau" ) ); 392 cmbCountry->insertItem( tr ( "Palau" ) );
393 cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) ); 393 cmbCountry->insertItem( tr ( "Palestinian Sovereign Areas" ) );
394 cmbCountry->insertItem( tr ( "Panama" ) ); 394 cmbCountry->insertItem( tr ( "Panama" ) );
395 cmbCountry->insertItem( tr ( "Papua New Guinea" ) ); 395 cmbCountry->insertItem( tr ( "Papua New Guinea" ) );
396 cmbCountry->insertItem( tr ( "Paraguay" ) ); 396 cmbCountry->insertItem( tr ( "Paraguay" ) );
397 cmbCountry->insertItem( tr ( "Peru" ) ); 397 cmbCountry->insertItem( tr ( "Peru" ) );
398 cmbCountry->insertItem( tr ( "Philippines" ) ); 398 cmbCountry->insertItem( tr ( "Philippines" ) );
399 cmbCountry->insertItem( tr ( "Pitcairn Islands" ) ); 399 cmbCountry->insertItem( tr ( "Pitcairn Islands" ) );
400 cmbCountry->insertItem( tr ( "Poland" ) ); 400 cmbCountry->insertItem( tr ( "Poland" ) );
401 cmbCountry->insertItem( tr ( "Portugal" ) ); 401 cmbCountry->insertItem( tr ( "Portugal" ) );
402 cmbCountry->insertItem( tr ( "Puerto Rico" ) ); 402 cmbCountry->insertItem( tr ( "Puerto Rico" ) );
403 cmbCountry->insertItem( tr ( "Qatar" ) ); 403 cmbCountry->insertItem( tr ( "Qatar" ) );
404 cmbCountry->insertItem( tr ( "Reunion" ) ); 404 cmbCountry->insertItem( tr ( "Reunion" ) );
405 cmbCountry->insertItem( tr ( "Romania" ) ); 405 cmbCountry->insertItem( tr ( "Romania" ) );
406 cmbCountry->insertItem( tr ( "Russia" ) ); 406 cmbCountry->insertItem( tr ( "Russia" ) );
407 cmbCountry->insertItem( tr ( "Rwanda" ) ); 407 cmbCountry->insertItem( tr ( "Rwanda" ) );
408 cmbCountry->insertItem( tr ( "Saint Lucia" ) ); 408 cmbCountry->insertItem( tr ( "Saint Lucia" ) );
409 cmbCountry->insertItem( tr ( "Samoa" ) ); 409 cmbCountry->insertItem( tr ( "Samoa" ) );
410 cmbCountry->insertItem( tr ( "San Marino" ) ); 410 cmbCountry->insertItem( tr ( "San Marino" ) );
411 cmbCountry->insertItem( tr ( "Saudi Arabia" ) ); 411 cmbCountry->insertItem( tr ( "Saudi Arabia" ) );
412 cmbCountry->insertItem( tr ( "Senegal" ) ); 412 cmbCountry->insertItem( tr ( "Senegal" ) );
413 cmbCountry->insertItem( tr ( "Seychelles" ) ); 413 cmbCountry->insertItem( tr ( "Seychelles" ) );
414 cmbCountry->insertItem( tr ( "Sierra Leone" ) ); 414 cmbCountry->insertItem( tr ( "Sierra Leone" ) );
415 cmbCountry->insertItem( tr ( "Singapore" ) ); 415 cmbCountry->insertItem( tr ( "Singapore" ) );
416 cmbCountry->insertItem( tr ( "Slovakia" ) ); 416 cmbCountry->insertItem( tr ( "Slovakia" ) );
417 cmbCountry->insertItem( tr ( "Slovenia" ) ); 417 cmbCountry->insertItem( tr ( "Slovenia" ) );
418 cmbCountry->insertItem( tr ( "Solomon Islands" ) ); 418 cmbCountry->insertItem( tr ( "Solomon Islands" ) );
419 cmbCountry->insertItem( tr ( "Somalia" ) ); 419 cmbCountry->insertItem( tr ( "Somalia" ) );
420 cmbCountry->insertItem( tr ( "South Africa" ) ); 420 cmbCountry->insertItem( tr ( "South Africa" ) );
421 cmbCountry->insertItem( tr ( "Spain" ) ); 421 cmbCountry->insertItem( tr ( "Spain" ) );
422 cmbCountry->insertItem( tr ( "Sri Lanka" ) ); 422 cmbCountry->insertItem( tr ( "Sri Lanka" ) );
423 cmbCountry->insertItem( tr ( "St. Helena" ) ); 423 cmbCountry->insertItem( tr ( "St. Helena" ) );
424 cmbCountry->insertItem( tr ( "Sudan" ) ); 424 cmbCountry->insertItem( tr ( "Sudan" ) );
425 cmbCountry->insertItem( tr ( "Suriname" ) ); 425 cmbCountry->insertItem( tr ( "Suriname" ) );
426 cmbCountry->insertItem( tr ( "Swaziland" ) ); 426 cmbCountry->insertItem( tr ( "Swaziland" ) );
427 cmbCountry->insertItem( tr ( "Sweden" ) ); 427 cmbCountry->insertItem( tr ( "Sweden" ) );
428 cmbCountry->insertItem( tr ( "Switzerland" ) ); 428 cmbCountry->insertItem( tr ( "Switzerland" ) );
429 cmbCountry->insertItem( tr ( "Taiwan" ) ); 429 cmbCountry->insertItem( tr ( "Taiwan" ) );
430 cmbCountry->insertItem( tr ( "Tajikistan" ) ); 430 cmbCountry->insertItem( tr ( "Tajikistan" ) );
431 cmbCountry->insertItem( tr ( "Tanzania" ) ); 431 cmbCountry->insertItem( tr ( "Tanzania" ) );
432 cmbCountry->insertItem( tr ( "Thailand" ) ); 432 cmbCountry->insertItem( tr ( "Thailand" ) );
433 cmbCountry->insertItem( tr ( "Togo" ) ); 433 cmbCountry->insertItem( tr ( "Togo" ) );
434 cmbCountry->insertItem( tr ( "Tokelau" ) ); 434 cmbCountry->insertItem( tr ( "Tokelau" ) );
435 cmbCountry->insertItem( tr ( "Tonga" ) ); 435 cmbCountry->insertItem( tr ( "Tonga" ) );
436 cmbCountry->insertItem( tr ( "Tunisia" ) ); 436 cmbCountry->insertItem( tr ( "Tunisia" ) );
437 cmbCountry->insertItem( tr ( "Turkey" ) ); 437 cmbCountry->insertItem( tr ( "Turkey" ) );
438 cmbCountry->insertItem( tr ( "Turkmenistan" ) ); 438 cmbCountry->insertItem( tr ( "Turkmenistan" ) );
439 cmbCountry->insertItem( tr ( "Tuvalu" ) ); 439 cmbCountry->insertItem( tr ( "Tuvalu" ) );
440 cmbCountry->insertItem( tr ( "Uganda" ) ); 440 cmbCountry->insertItem( tr ( "Uganda" ) );
441 cmbCountry->insertItem( tr ( "Ukraine" ) ); 441 cmbCountry->insertItem( tr ( "Ukraine" ) );
442 cmbCountry->insertItem( tr ( "Uruguay" ) ); 442 cmbCountry->insertItem( tr ( "Uruguay" ) );
443 cmbCountry->insertItem( tr ( "Uzbekistan" ) ); 443 cmbCountry->insertItem( tr ( "Uzbekistan" ) );
444 cmbCountry->insertItem( tr ( "Vanuatu" ) ); 444 cmbCountry->insertItem( tr ( "Vanuatu" ) );
445 cmbCountry->insertItem( tr ( "Venezuela" ) ); 445 cmbCountry->insertItem( tr ( "Venezuela" ) );
446 cmbCountry->insertItem( tr ( "Vietnam" ) ); 446 cmbCountry->insertItem( tr ( "Vietnam" ) );
447 cmbCountry->insertItem( tr ( "Virgin Islands" ) ); 447 cmbCountry->insertItem( tr ( "Virgin Islands" ) );
448 cmbCountry->insertItem( tr ( "Western Sahara" ) ); 448 cmbCountry->insertItem( tr ( "Western Sahara" ) );
449 cmbCountry->insertItem( tr ( "Yemen" ) ); 449 cmbCountry->insertItem( tr ( "Yemen" ) );
450 cmbCountry->insertItem( tr ( "Yugoslavia" ) ); 450 cmbCountry->insertItem( tr ( "Yugoslavia" ) );
451 cmbCountry->insertItem( tr ( "Zambia" ) ); 451 cmbCountry->insertItem( tr ( "Zambia" ) );
452 cmbCountry->insertItem( tr ( "Zimbabwe" ) ); 452 cmbCountry->insertItem( tr ( "Zimbabwe" ) );
453 if (cmbCountry->listBox()!=0) 453 if (cmbCountry->listBox()!=0)
454 cmbCountry->listBox()->sort(); 454 cmbCountry->listBox()->sort();
455 455
456 cmbCountry->setMaximumWidth( 135 ); 456 cmbCountry->setMaximumWidth( 135 );
457 457
458 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 ); 458 gl->addMultiCellWidget( cmbCountry, 5, 5, 1, 2 );
459 459
460 cmbChooserField4 = new QComboBox( FALSE, container ); 460 cmbChooserField4 = new QComboBox( FALSE, container );
461 cmbChooserField4->setMaximumWidth( 90 ); 461 cmbChooserField4->setMaximumWidth( 90 );
462 gl->addWidget( cmbChooserField4, 6, 0 ); 462 gl->addWidget( cmbChooserField4, 6, 0 );
463 txtChooserField4 = new QLineEdit( container ); 463 txtChooserField4 = new QLineEdit( container );
464 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 ); 464 gl->addMultiCellWidget( txtChooserField4, 6, 6, 1, 2 );
465 465
466 QSpacerItem *space = new QSpacerItem(1,1, 466 QSpacerItem *space = new QSpacerItem(1,1,
467 QSizePolicy::Maximum, 467 QSizePolicy::Maximum,
468 QSizePolicy::MinimumExpanding ); 468 QSizePolicy::MinimumExpanding );
469 gl->addItem( space, 7, 0 ); 469 gl->addItem( space, 7, 0 );
470 470
471 tabMain->insertTab( tabViewport, tr( "Address" ) ); 471 tabMain->insertTab( tabViewport, tr( "Address" ) );
472 472
473 tabViewport = new QWidget ( tabMain ); 473 tabViewport = new QWidget ( tabMain );
474 474
475 vb = new QVBoxLayout( tabViewport ); 475 vb = new QVBoxLayout( tabViewport );
476 476
477 svDetails = new QScrollView( tabViewport ); 477 svDetails = new QScrollView( tabViewport );
478 vb->addWidget( svDetails, 0, 0 ); 478 vb->addWidget( svDetails, 0, 0 );
479 svDetails->setResizePolicy( QScrollView::AutoOneFit ); 479 svDetails->setResizePolicy( QScrollView::AutoOneFit );
480 svDetails->setFrameStyle( QFrame::NoFrame ); 480 svDetails->setFrameStyle( QFrame::NoFrame );
481 481
482 container = new QWidget( svDetails->viewport() ); 482 container = new QWidget( svDetails->viewport() );
483 svDetails->addChild( container ); 483 svDetails->addChild( container );
484 484
485 gl = new QGridLayout( container, 1, 2, 2, 4 ); 485 gl = new QGridLayout( container, 1, 2, 2, 4 );
486 486
487 int counter = 0; 487 int counter = 0;
488 488
489 // Birthday 489 // Birthday
490 QHBox* hBox = new QHBox( container ); 490 QHBox* hBox = new QHBox( container );
491 l = new QLabel( tr("Birthday"), container ); 491 l = new QLabel( tr("Birthday"), container );
492 gl->addWidget( l, counter, 0 ); 492 gl->addWidget( l, counter, 0 );
493 493
494 QPopupMenu* m1 = new QPopupMenu( container ); 494 QPopupMenu* m1 = new QPopupMenu( container );
495 birthdayPicker = new DateBookMonth( m1, 0, TRUE ); 495 birthdayPicker = new DateBookMonth( m1, 0, TRUE );
496 m1->insertItem( birthdayPicker ); 496 m1->insertItem( birthdayPicker );
497 497
498 birthdayButton= new QToolButton( hBox, "buttonStart" ); 498 birthdayButton= new QToolButton( hBox, "buttonStart" );
499 birthdayButton->setPopup( m1 ); 499 birthdayButton->setPopup( m1 );
500 birthdayButton->setPopupDelay(0); 500 birthdayButton->setPopupDelay(0);
501 501
502 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 502 QPushButton* deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
503 tr( "Delete" ), 503 tr( "Delete" ),
504 hBox, 0 ); 504 hBox, 0 );
505 505
506 gl->addWidget( hBox, counter , 1 ); 506 gl->addWidget( hBox, counter , 1 );
507 507
508 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ), 508 connect( birthdayPicker, SIGNAL( dateClicked( int, int, int ) ),
509 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) ); 509 this, SLOT( slotBirthdayDateChanged( int, int, int ) ) );
510 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) ); 510 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveBirthday() ) );
511 511
512 ++counter; 512 ++counter;
513 513
514 // Anniversary 514 // Anniversary
515 hBox = new QHBox( container ); 515 hBox = new QHBox( container );
516 l = new QLabel( tr("Anniversary"), container ); 516 l = new QLabel( tr("Anniversary"), container );
517 gl->addWidget( l, counter, 0 ); 517 gl->addWidget( l, counter, 0 );
518 518
519 m1 = new QPopupMenu( container ); 519 m1 = new QPopupMenu( container );
520 anniversaryPicker = new DateBookMonth( m1, 0, TRUE ); 520 anniversaryPicker = new DateBookMonth( m1, 0, TRUE );
521 m1->insertItem( anniversaryPicker ); 521 m1->insertItem( anniversaryPicker );
522 522
523 anniversaryButton= new QToolButton( hBox, "buttonStart" ); 523 anniversaryButton= new QToolButton( hBox, "buttonStart" );
524 anniversaryButton->setPopup( m1 ); 524 anniversaryButton->setPopup( m1 );
525 anniversaryButton->setPopupDelay(0); 525 anniversaryButton->setPopupDelay(0);
526 526
527 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ), 527 deleteButton = new QPushButton( QIconSet( Resource::loadPixmap( "trash" ) ),
528 tr( "Delete" ), 528 tr( "Delete" ),
529 hBox, 0 ); 529 hBox, 0 );
530 gl->addWidget( hBox, counter , 1 ); 530 gl->addWidget( hBox, counter , 1 );
531 531
532 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ), 532 connect( anniversaryPicker, SIGNAL( dateClicked( int, int, int ) ),
533 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) ); 533 this, SLOT( slotAnniversaryDateChanged( int, int, int ) ) );
534 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) ); 534 connect( deleteButton, SIGNAL( clicked() ), this, SLOT( slotRemoveAnniversary() ) );
535 535
536 ++counter; 536 ++counter;
537 537
538 // Gender 538 // Gender
539 l = new QLabel( tr("Gender"), container ); 539 l = new QLabel( tr("Gender"), container );
540 gl->addWidget( l, counter, 0 ); 540 gl->addWidget( l, counter, 0 );
541 cmbGender = new QComboBox( container ); 541 cmbGender = new QComboBox( container );
542 cmbGender->insertItem( "", 0 ); 542 cmbGender->insertItem( "", 0 );
543 cmbGender->insertItem( tr("Male"), 1); 543 cmbGender->insertItem( tr("Male"), 1);
544 cmbGender->insertItem( tr("Female"), 2); 544 cmbGender->insertItem( tr("Female"), 2);
545 gl->addWidget( cmbGender, counter, 1 ); 545 gl->addWidget( cmbGender, counter, 1 );
546 546
547 ++counter; 547 ++counter;
548 548
549 // Create Labels and lineedit fields for every dynamic entry 549 // Create Labels and lineedit fields for every dynamic entry
550 QStringList::ConstIterator it = slDynamicEntries.begin(); 550 QStringList::ConstIterator it = slDynamicEntries.begin();
551 QStringList::ConstIterator trit = trlDynamicEntries.begin(); 551 QStringList::ConstIterator trit = trlDynamicEntries.begin();
552 QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId();
553 QMap<int, QString> mapIdToStr = OContactFields::idToTrFields();
552 for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { 554 for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) {
553 555
554 if (((*it) == "Anniversary") || 556 if (((*it) == "Anniversary") ||
555 ((*it) == "Birthday")|| ((*it) == "Gender")) continue; 557 ((*it) == "Birthday")|| ((*it) == "Gender")) continue;
556 558
557 l = new QLabel( (*it).utf8() , container ); 559 l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container );
558 listName.append( l ); 560 listName.append( l );
559 gl->addWidget( l, i, 0 ); 561 gl->addWidget( l, i, 0 );
560 QLineEdit *e = new QLineEdit( container ); 562 QLineEdit *e = new QLineEdit( container );
561 listValue.append( e ); 563 listValue.append( e );
562 gl->addWidget( e, i, 1); 564 gl->addWidget( e, i, 1);
563 } 565 }
564 // Fill labels with names.. 566 // Fill labels with names..
565 //loadFields(); 567 //loadFields();
566 568
567 569
568 tabMain->insertTab( tabViewport, tr( "Details" ) ); 570 tabMain->insertTab( tabViewport, tr( "Details" ) );
569 571
570 dlgNote = new QDialog( this, "Note Dialog", TRUE ); 572 dlgNote = new QDialog( this, "Note Dialog", TRUE );
571 dlgNote->setCaption( tr("Enter Note") ); 573 dlgNote->setCaption( tr("Enter Note") );
572 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote ); 574 QVBoxLayout *vbNote = new QVBoxLayout( dlgNote );
573 txtNote = new QMultiLineEdit( dlgNote ); 575 txtNote = new QMultiLineEdit( dlgNote );
574 vbNote->addWidget( txtNote ); 576 vbNote->addWidget( txtNote );
575 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) ); 577 connect( btnNote, SIGNAL(clicked()), this, SLOT(slotNote()) );
576 578
577 dlgName = new QDialog( this, "Name Dialog", TRUE ); 579 dlgName = new QDialog( this, "Name Dialog", TRUE );
578 dlgName->setCaption( tr("Edit Name") ); 580 dlgName->setCaption( tr("Edit Name") );
579 gl = new QGridLayout( dlgName, 5, 2, 2, 3 ); 581 gl = new QGridLayout( dlgName, 5, 2, 2, 3 );
580 582
581 l = new QLabel( tr("First Name"), dlgName ); 583 l = new QLabel( tr("First Name"), dlgName );
582 gl->addWidget( l, 0, 0 ); 584 gl->addWidget( l, 0, 0 );
583 txtFirstName = new QLineEdit( dlgName ); 585 txtFirstName = new QLineEdit( dlgName );
584 gl->addWidget( txtFirstName, 0, 1 ); 586 gl->addWidget( txtFirstName, 0, 1 );
585 587
586 l = new QLabel( tr("Middle Name"), dlgName ); 588 l = new QLabel( tr("Middle Name"), dlgName );
587 gl->addWidget( l, 1, 0 ); 589 gl->addWidget( l, 1, 0 );
588 txtMiddleName = new QLineEdit( dlgName ); 590 txtMiddleName = new QLineEdit( dlgName );
589 gl->addWidget( txtMiddleName, 1, 1 ); 591 gl->addWidget( txtMiddleName, 1, 1 );
590 592
591 l = new QLabel( tr("Last Name"), dlgName ); 593 l = new QLabel( tr("Last Name"), dlgName );
592 gl->addWidget( l, 2, 0 ); 594 gl->addWidget( l, 2, 0 );
593 txtLastName = new QLineEdit( dlgName ); 595 txtLastName = new QLineEdit( dlgName );
594 gl->addWidget( txtLastName, 2, 1 ); 596 gl->addWidget( txtLastName, 2, 1 );
595 597
596 l = new QLabel( tr("Suffix"), dlgName ); 598 l = new QLabel( tr("Suffix"), dlgName );
597 gl->addWidget( l, 3, 0 ); 599 gl->addWidget( l, 3, 0 );
598 txtSuffix = new QLineEdit( dlgName ); 600 txtSuffix = new QLineEdit( dlgName );
599 gl->addWidget( txtSuffix, 3, 1 ); 601 gl->addWidget( txtSuffix, 3, 1 );
600 space = new QSpacerItem(1,1, 602 space = new QSpacerItem(1,1,
601 QSizePolicy::Maximum, 603 QSizePolicy::Maximum,
602 QSizePolicy::MinimumExpanding ); 604 QSizePolicy::MinimumExpanding );
603 gl->addItem( space, 4, 0 ); 605 gl->addItem( space, 4, 0 );
604 606
605 cmbChooserField1->insertStringList( trlChooserNames ); 607 cmbChooserField1->insertStringList( trlChooserNames );
606 cmbChooserField2->insertStringList( trlChooserNames ); 608 cmbChooserField2->insertStringList( trlChooserNames );
607 cmbChooserField3->insertStringList( trlChooserNames ); 609 cmbChooserField3->insertStringList( trlChooserNames );
608 cmbChooserField4->insertStringList( trlChooserNames ); 610 cmbChooserField4->insertStringList( trlChooserNames );
609 611
610 cmbChooserField1->setCurrentItem( 0 ); 612 cmbChooserField1->setCurrentItem( 0 );
611 cmbChooserField2->setCurrentItem( 1 ); 613 cmbChooserField2->setCurrentItem( 1 );
612 cmbChooserField3->setCurrentItem( 2 ); 614 cmbChooserField3->setCurrentItem( 2 );
613 615
614 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) ); 616 connect( btnFullName, SIGNAL(clicked()), this, SLOT(slotName()) );
615 617
616 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) ); 618 connect( txtFullName, SIGNAL(textChanged(const QString &)), this, SLOT(slotFullNameChange(const QString &)) );
617 619
618 connect( txtChooserField1, SIGNAL(textChanged(const QString &)), 620 connect( txtChooserField1, SIGNAL(textChanged(const QString &)),
619 this, SLOT(slotChooser1Change(const QString &)) ); 621 this, SLOT(slotChooser1Change(const QString &)) );
620 connect( txtChooserField2, SIGNAL(textChanged(const QString &)), 622 connect( txtChooserField2, SIGNAL(textChanged(const QString &)),
621 this, SLOT(slotChooser2Change(const QString &)) ); 623 this, SLOT(slotChooser2Change(const QString &)) );
622 connect( txtChooserField3, SIGNAL(textChanged(const QString &)), 624 connect( txtChooserField3, SIGNAL(textChanged(const QString &)),
623 this, SLOT(slotChooser3Change(const QString &)) ); 625 this, SLOT(slotChooser3Change(const QString &)) );
624 connect( txtChooserField4, SIGNAL(textChanged(const QString &)), 626 connect( txtChooserField4, SIGNAL(textChanged(const QString &)),
625 this, SLOT(slotChooser4Change(const QString &)) ); 627 this, SLOT(slotChooser4Change(const QString &)) );
626 connect( txtAddress, SIGNAL(textChanged(const QString &)), 628 connect( txtAddress, SIGNAL(textChanged(const QString &)),
627 this, SLOT(slotAddressChange(const QString &)) ); 629 this, SLOT(slotAddressChange(const QString &)) );
628 connect( txtCity, SIGNAL(textChanged(const QString &)), 630 connect( txtCity, SIGNAL(textChanged(const QString &)),
629 this, SLOT(slotCityChange(const QString &)) ); 631 this, SLOT(slotCityChange(const QString &)) );
630 connect( txtState, SIGNAL(textChanged(const QString &)), 632 connect( txtState, SIGNAL(textChanged(const QString &)),
631 this, SLOT(slotStateChange(const QString &)) ); 633 this, SLOT(slotStateChange(const QString &)) );
632 connect( txtZip, SIGNAL(textChanged(const QString &)), 634 connect( txtZip, SIGNAL(textChanged(const QString &)),
633 this, SLOT(slotZipChange(const QString &)) ); 635 this, SLOT(slotZipChange(const QString &)) );
634 connect( cmbCountry, SIGNAL(textChanged(const QString &)), 636 connect( cmbCountry, SIGNAL(textChanged(const QString &)),
635 this, SLOT(slotCountryChange(const QString &)) ); 637 this, SLOT(slotCountryChange(const QString &)) );
636 connect( cmbCountry, SIGNAL(activated(const QString &)), 638 connect( cmbCountry, SIGNAL(activated(const QString &)),
637 this, SLOT(slotCountryChange(const QString &)) ); 639 this, SLOT(slotCountryChange(const QString &)) );
638 connect( cmbChooserField1, SIGNAL(activated(int)), 640 connect( cmbChooserField1, SIGNAL(activated(int)),
639 this, SLOT(slotCmbChooser1Change(int)) ); 641 this, SLOT(slotCmbChooser1Change(int)) );
640 connect( cmbChooserField2, SIGNAL(activated(int)), 642 connect( cmbChooserField2, SIGNAL(activated(int)),
641 this, SLOT(slotCmbChooser2Change(int)) ); 643 this, SLOT(slotCmbChooser2Change(int)) );
642 connect( cmbChooserField3, SIGNAL(activated(int)), 644 connect( cmbChooserField3, SIGNAL(activated(int)),
643 this, SLOT(slotCmbChooser3Change(int)) ); 645 this, SLOT(slotCmbChooser3Change(int)) );
644 connect( cmbChooserField4, SIGNAL(activated(int)), 646 connect( cmbChooserField4, SIGNAL(activated(int)),
645 this, SLOT(slotCmbChooser4Change(int)) ); 647 this, SLOT(slotCmbChooser4Change(int)) );
646 connect( cmbAddress, SIGNAL(activated(int)), 648 connect( cmbAddress, SIGNAL(activated(int)),
647 this, SLOT(slotAddressTypeChange(int)) ); 649 this, SLOT(slotAddressTypeChange(int)) );
648 650
649 new QPEDialogListener(this); 651 new QPEDialogListener(this);
650 652
651 setPersonalView ( m_personalView ); 653 setPersonalView ( m_personalView );
652 654
653 qWarning("init() END"); 655 qWarning("init() END");
654} 656}
655 657
656void ContactEditor::defaultEmailChanged(int i){ 658void ContactEditor::defaultEmailChanged(int i){
657 qDebug("defaultEmailChanged"); 659 qDebug("defaultEmailChanged");
658 660
659 // was sollte das ? (se) 661 // was sollte das ? (se)
660 // int index = cmbChooserField1->currentItem(); 662 // int index = cmbChooserField1->currentItem();
661 // slChooserValues[index] = cmbDefaultEmail->text(i); 663 // slChooserValues[index] = cmbDefaultEmail->text(i);
662 664
663 defaultEmail = cmbDefaultEmail->text(i); 665 defaultEmail = cmbDefaultEmail->text(i);
664 qDebug ("Changed to: %s", defaultEmail.latin1()); 666 qDebug ("Changed to: %s", defaultEmail.latin1());
665 667
666} 668}
667 669
668void ContactEditor::populateDefaultEmailCmb(){ 670void ContactEditor::populateDefaultEmailCmb(){
669 671
670 // if the default-email combo was not selected and therfore not created 672 // if the default-email combo was not selected and therfore not created
671 // we get a lot of trouble.. Therfore create an invisible one.. 673 // we get a lot of trouble.. Therfore create an invisible one..
672 if ( !cmbDefaultEmail ){ 674 if ( !cmbDefaultEmail ){
673 cmbDefaultEmail = new QComboBox(this); 675 cmbDefaultEmail = new QComboBox(this);
674 cmbDefaultEmail -> hide(); 676 cmbDefaultEmail -> hide();
675 } 677 }
676 cmbDefaultEmail->clear(); 678 cmbDefaultEmail->clear();
677 cmbDefaultEmail->insertStringList( emails ); 679 cmbDefaultEmail->insertStringList( emails );
678 // cmbDefaultEmail->show(); 680 // cmbDefaultEmail->show();
679 681
680 // Select default email in combo.. 682 // Select default email in combo..
681 bool found = false; 683 bool found = false;
682 for ( int i = 0; i < cmbDefaultEmail->count(); i++){ 684 for ( int i = 0; i < cmbDefaultEmail->count(); i++){
683 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<", 685 qDebug(" populateDefaultEmailCmb text >%s< defaultEmail >%s<",
684 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1()); 686 cmbDefaultEmail->text( i ).latin1(), defaultEmail.latin1());
685 687
686 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){ 688 if ( cmbDefaultEmail->text( i ).stripWhiteSpace() == defaultEmail.stripWhiteSpace() ){
687 cmbDefaultEmail->setCurrentItem( i ); 689 cmbDefaultEmail->setCurrentItem( i );
688 qDebug("set"); 690 qDebug("set");
689 found = true; 691 found = true;
690 } 692 }
691 } 693 }
692 694
693 // If the current default email is not found in the list, we choose the 695 // If the current default email is not found in the list, we choose the
694 // first one.. 696 // first one..
695 if ( !found ) 697 if ( !found )
696 defaultEmail = cmbDefaultEmail->text(0); 698 defaultEmail = cmbDefaultEmail->text(0);
697} 699}
698 700
699// Called when any combobox was changed. 701// Called when any combobox was changed.
700// "true" returned if the change was chandled by this function, else it should 702// "true" returned if the change was chandled by this function, else it should
701// be handled by something else.. 703// be handled by something else..
702bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) { 704bool ContactEditor::cmbChooserChange( int index, QLineEdit *inputWid, int widgetPos ) {
703 QString type = slChooserNames[index]; 705 QString type = slChooserNames[index];
704 qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos ); 706 qWarning("ContactEditor::cmbChooserChange -> Type: %s, WidgetPos: %d", type.latin1(), widgetPos );
705 707
706 if ( !initializing ) 708 if ( !initializing )
707 contactfields.setFieldOrder( widgetPos-1, index ); 709 contactfields.setFieldOrder( widgetPos-1, index );
708 710
709 // Create and connect combobox for selecting the default email 711 // Create and connect combobox for selecting the default email
710 if ( type == "Default Email"){ 712 if ( type == "Default Email"){
711 qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition); 713 qWarning("Choosing default-email (defaultEmailChooserPosition= %d) ", defaultEmailChooserPosition);
712 714
713 // More than one defaul-email chooser is not allowed ! 715 // More than one defaul-email chooser is not allowed !
714 if ( ( defaultEmailChooserPosition != -1 ) && 716 if ( ( defaultEmailChooserPosition != -1 ) &&
715 defaultEmailChooserPosition != widgetPos && !initializing){ 717 defaultEmailChooserPosition != widgetPos && !initializing){
716 chooserError( widgetPos ); 718 chooserError( widgetPos );
717 return true; 719 return true;
718 } 720 }
719 721
720 if ( cmbDefaultEmail ){ 722 if ( cmbDefaultEmail ){
721 delete cmbDefaultEmail; 723 delete cmbDefaultEmail;
722 cmbDefaultEmail = 0l; 724 cmbDefaultEmail = 0l;
723 } 725 }
724 cmbDefaultEmail = new QComboBox(inputWid->parentWidget()); 726 cmbDefaultEmail = new QComboBox(inputWid->parentWidget());
725 cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); /* :SX */ 727 cmbDefaultEmail->setGeometry(inputWid->frameGeometry()); /* :SX */
726 728
727 QRect rect = inputWid->frameGeometry(); 729 QRect rect = inputWid->frameGeometry();
728 qWarning("Geometrie: X=%d, Y=%d, Left=%d, Top=%d, Right=%d, Bottom=%d", 730 qWarning("Geometrie: X=%d, Y=%d, Left=%d, Top=%d, Right=%d, Bottom=%d",
729 rect.x(), rect.y(), rect.left(), rect.top(), rect.right(), rect.bottom()); 731 rect.x(), rect.y(), rect.left(), rect.top(), rect.right(), rect.bottom());
730 QPoint pnt = inputWid->pos(); 732 QPoint pnt = inputWid->pos();
731 qWarning("Position : X=%d, Y=%d", pnt.x(), pnt.y() ); 733 qWarning("Position : X=%d, Y=%d", pnt.x(), pnt.y() );
732 734
733 connect( cmbDefaultEmail,SIGNAL( activated(int) ), 735 connect( cmbDefaultEmail,SIGNAL( activated(int) ),
734 SLOT( defaultEmailChanged(int) ) ); 736 SLOT( defaultEmailChanged(int) ) );
735 737
736 cmbDefaultEmail->clear(); 738 cmbDefaultEmail->clear();
737 cmbDefaultEmail->insertStringList( emails ); 739 cmbDefaultEmail->insertStringList( emails );
738 cmbDefaultEmail->show(); 740 cmbDefaultEmail->show();
739 741
740 defaultEmailChooserPosition = widgetPos; 742 defaultEmailChooserPosition = widgetPos;
741 743
742 // Set current default email 744 // Set current default email
743 populateDefaultEmailCmb(); 745 populateDefaultEmailCmb();
744 746
745 747
746 } else { 748 } else {
747 // Something else was selected: Hide combo.. 749 // Something else was selected: Hide combo..
748 qWarning(" Hiding default-email combo" ); 750 qWarning(" Hiding default-email combo" );
749 if ( defaultEmailChooserPosition == widgetPos ){ 751 if ( defaultEmailChooserPosition == widgetPos ){
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp
index 75a7641..18b68c4 100644
--- a/core/pim/addressbook/ocontactfields.cpp
+++ b/core/pim/addressbook/ocontactfields.cpp
@@ -1,369 +1,454 @@
1 1
2#include "ocontactfields.h" 2#include "ocontactfields.h"
3 3
4#include <qstringlist.h> 4#include <qstringlist.h>
5#include <qobject.h> 5#include <qobject.h>
6 6
7// We should use our own enum in the future .. 7// We should use our own enum in the future ..
8#include <qpe/recordfields.h> 8#include <qpe/recordfields.h>
9#include <qpe/config.h> 9#include <qpe/config.h>
10#include <opie/ocontact.h> 10#include <opie/ocontact.h>
11 11
12/*! 12/*!
13 \internal 13 \internal
14 Returns a list of details field names for a contact. 14 Returns a list of details field names for a contact.
15*/ 15*/
16QStringList OContactFields::untrdetailsfields( bool sorted ) 16QStringList OContactFields::untrdetailsfields( bool sorted )
17{ 17{
18 QStringList list; 18 QStringList list;
19 QMap<int, QString> mapIdToStr = idToUntrFields();
19 20
20 list.append( "Office" ); 21 list.append( mapIdToStr[ Qtopia::Office ] );
21 list.append( "Profession" ); 22 list.append( mapIdToStr[ Qtopia::Profession ] );
22 list.append( "Assistant" ); 23 list.append( mapIdToStr[ Qtopia::Assistant ] );
23 list.append( "Manager" ); 24 list.append( mapIdToStr[ Qtopia::Manager ] );
24 25
25 list.append( "Spouse" ); 26 list.append( mapIdToStr[ Qtopia::Spouse ] );
26 list.append( "Gender" ); 27 list.append( mapIdToStr[ Qtopia::Gender ] );
27 list.append( "Birthday" ); 28 list.append( mapIdToStr[ Qtopia::Birthday ] );
28 list.append( "Anniversary" ); 29 list.append( mapIdToStr[ Qtopia::Anniversary ] );
29 list.append( "Nickname" ); 30 list.append( mapIdToStr[ Qtopia::Nickname ] );
30 list.append( "Children" ); 31 list.append( mapIdToStr[ Qtopia::Children ] );
31 32
32 if (sorted) list.sort(); 33 if (sorted) list.sort();
33 return list; 34 return list;
34} 35}
35 36
36/*! 37/*!
37 \internal 38 \internal
38 Returns a translated list of details field names for a contact. 39 Returns a translated list of details field names for a contact.
39*/ 40*/
40QStringList OContactFields::trdetailsfields( bool sorted ) 41QStringList OContactFields::trdetailsfields( bool sorted )
41{ 42{
42 QStringList list; 43 QStringList list;
44 QMap<int, QString> mapIdToStr = idToTrFields();
43 45
44 list.append( QObject::tr( "Office" ) ); 46 list.append( mapIdToStr[Qtopia::Office] );
45 list.append( QObject::tr( "Profession" ) ); 47 list.append( mapIdToStr[Qtopia::Profession] );
46 list.append( QObject::tr( "Assistant" ) ); 48 list.append( mapIdToStr[Qtopia::Assistant] );
47 list.append( QObject::tr( "Manager" ) ); 49 list.append( mapIdToStr[Qtopia::Manager] );
48 50
49 list.append( QObject::tr( "Spouse" ) ); 51 list.append( mapIdToStr[Qtopia::Spouse] );
50 list.append( QObject::tr( "Gender" ) ); 52 list.append( mapIdToStr[Qtopia::Gender] );
51 list.append( QObject::tr( "Birthday" ) ); 53 list.append( mapIdToStr[Qtopia::Birthday] );
52 list.append( QObject::tr( "Anniversary" ) ); 54 list.append( mapIdToStr[Qtopia::Anniversary] );
53 list.append( QObject::tr( "Nickname" ) ); 55 list.append( mapIdToStr[Qtopia::Nickname] );
54 list.append( QObject::tr( "Children" ) ); 56 list.append( mapIdToStr[Qtopia::Children] );
55 57
56 if (sorted) list.sort(); 58 if (sorted) list.sort();
57 return list; 59 return list;
58} 60}
59 61
60 62
61/*! 63/*!
62 \internal 64 \internal
63 Returns a translated list of phone field names for a contact. 65 Returns a translated list of phone field names for a contact.
64*/ 66*/
65QStringList OContactFields::trphonefields( bool sorted ) 67QStringList OContactFields::trphonefields( bool sorted )
66{ 68{
67 QStringList list; 69 QStringList list;
68 list.append( QObject::tr( "Business Phone" ) ); 70 QMap<int, QString> mapIdToStr = idToTrFields();
69 list.append( QObject::tr( "Business Fax" ) );
70 list.append( QObject::tr( "Business Mobile" ) );
71 71
72 list.append( QObject::tr( "Default Email" ) ); 72 list.append( mapIdToStr[Qtopia::BusinessPhone] );
73 list.append( QObject::tr( "Emails" ) ); 73 list.append( mapIdToStr[Qtopia::BusinessFax] );
74 list.append( mapIdToStr[Qtopia::BusinessMobile] );
74 75
75 list.append( QObject::tr( "Home Phone" ) ); 76 list.append( mapIdToStr[Qtopia::DefaultEmail] );
76 list.append( QObject::tr( "Home Fax" ) ); 77 list.append( mapIdToStr[Qtopia::Emails] );
77 list.append( QObject::tr( "Home Mobile" ) ); 78
79 list.append( mapIdToStr[Qtopia::HomePhone] );
80 list.append( mapIdToStr[Qtopia::HomeFax] );
81 list.append( mapIdToStr[Qtopia::HomeMobile] );
78 82
79 if (sorted) list.sort(); 83 if (sorted) list.sort();
80 84
81 return list; 85 return list;
82} 86}
83 87
84 88
85/*! 89/*!
86 \internal 90 \internal
87 Returns a list of phone field names for a contact. 91 Returns a list of phone field names for a contact.
88*/ 92*/
89QStringList OContactFields::untrphonefields( bool sorted ) 93QStringList OContactFields::untrphonefields( bool sorted )
90{ 94{
91 QStringList list; 95 QStringList list;
96 QMap<int, QString> mapIdToStr = idToUntrFields();
92 97
93 list.append( "Business Phone" ); 98 list.append( mapIdToStr[ Qtopia::BusinessPhone ] );
94 list.append( "Business Fax" ); 99 list.append( mapIdToStr[ Qtopia::BusinessFax ] );
95 list.append( "Business Mobile" ); 100 list.append( mapIdToStr[ Qtopia::BusinessMobile ] );
96 101
97 list.append( "Default Email" ); 102 list.append( mapIdToStr[ Qtopia::DefaultEmail ] );
98 list.append( "Emails" ); 103 list.append( mapIdToStr[ Qtopia::Emails ] );
99 104
100 list.append( "Home Phone" ); 105 list.append( mapIdToStr[ Qtopia::HomePhone ] );
101 list.append( "Home Fax" ); 106 list.append( mapIdToStr[ Qtopia::HomeFax ] );
102 list.append( "Home Mobile" ); 107 list.append( mapIdToStr[ Qtopia::HomeMobile ] );
103 108
104 if (sorted) list.sort(); 109 if (sorted) list.sort();
105 110
106 return list; 111 return list;
107} 112}
108 113
109 114
110/*! 115/*!
111 \internal 116 \internal
112 Returns a translated list of field names for a contact. 117 Returns a translated list of field names for a contact.
113*/ 118*/
114QStringList OContactFields::trfields( bool sorted ) 119QStringList OContactFields::trfields( bool sorted )
115{ 120{
116 QStringList list; 121 QStringList list;
122 QMap<int, QString> mapIdToStr = idToTrFields();
117 123
118 list.append( QObject::tr( "Name Title") ); 124 list.append( mapIdToStr[Qtopia::Title]);
119 list.append( QObject::tr( "First Name" ) ); 125 list.append( mapIdToStr[Qtopia::FirstName] );
120 list.append( QObject::tr( "Middle Name" ) ); 126 list.append( mapIdToStr[Qtopia::MiddleName] );
121 list.append( QObject::tr( "Last Name" ) ); 127 list.append( mapIdToStr[Qtopia::LastName] );
122 list.append( QObject::tr( "Suffix" ) ); 128 list.append( mapIdToStr[Qtopia::Suffix] );
123 list.append( QObject::tr( "File As" ) ); 129 list.append( mapIdToStr[Qtopia::FileAs] );
124 130
125 list.append( QObject::tr( "Job Title" ) ); 131 list.append( mapIdToStr[Qtopia::JobTitle] );
126 list.append( QObject::tr( "Department" ) ); 132 list.append( mapIdToStr[Qtopia::Department] );
127 list.append( QObject::tr( "Company" ) ); 133 list.append( mapIdToStr[Qtopia::Company] );
128 134
129 list += trphonefields( sorted ); 135 list += trphonefields( sorted );
130 136
131 list.append( QObject::tr( "Business Street" ) ); 137 list.append( mapIdToStr[Qtopia::BusinessStreet] );
132 list.append( QObject::tr( "Business City" ) ); 138 list.append( mapIdToStr[Qtopia::BusinessCity] );
133 list.append( QObject::tr( "Business State" ) ); 139 list.append( mapIdToStr[Qtopia::BusinessState] );
134 list.append( QObject::tr( "Business Zip" ) ); 140 list.append( mapIdToStr[Qtopia::BusinessZip] );
135 list.append( QObject::tr( "Business Country" ) ); 141 list.append( mapIdToStr[Qtopia::BusinessCountry] );
136 list.append( QObject::tr( "Business Pager" ) ); 142 list.append( mapIdToStr[Qtopia::BusinessPager] );
137 list.append( QObject::tr( "Business WebPage" ) ); 143 list.append( mapIdToStr[Qtopia::BusinessWebPage] );
138 144
139 list.append( QObject::tr( "Home Street" ) ); 145 list.append( mapIdToStr[Qtopia::HomeStreet] );
140 list.append( QObject::tr( "Home City" ) ); 146 list.append( mapIdToStr[Qtopia::HomeCity] );
141 list.append( QObject::tr( "Home State" ) ); 147 list.append( mapIdToStr[Qtopia::HomeState] );
142 list.append( QObject::tr( "Home Zip" ) ); 148 list.append( mapIdToStr[Qtopia::HomeZip] );
143 list.append( QObject::tr( "Home Country" ) ); 149 list.append( mapIdToStr[Qtopia::HomeCountry] );
144 list.append( QObject::tr( "Home Web Page" ) ); 150 list.append( mapIdToStr[Qtopia::HomeWebPage] );
145 151
146 list += trdetailsfields( sorted ); 152 list += trdetailsfields( sorted );
147 153
148 list.append( QObject::tr( "Notes" ) ); 154 list.append( mapIdToStr[Qtopia::Notes] );
149 list.append( QObject::tr( "Groups" ) ); 155 list.append( mapIdToStr[Qtopia::Groups] );
150 156
151 if (sorted) list.sort(); 157 if (sorted) list.sort();
152 158
153 return list; 159 return list;
154} 160}
155 161
156/*! 162/*!
157 \internal 163 \internal
158 Returns an untranslated list of field names for a contact. 164 Returns an untranslated list of field names for a contact.
159*/ 165*/
160QStringList OContactFields::untrfields( bool sorted ) 166QStringList OContactFields::untrfields( bool sorted )
161{ 167{
162 QStringList list; 168 QStringList list;
169 QMap<int, QString> mapIdToStr = idToUntrFields();
163 170
164 list.append( "Name Title" ); 171 list.append( mapIdToStr[ Qtopia::Title ] );
165 list.append( "First Name" ); 172 list.append( mapIdToStr[ Qtopia::FirstName ] );
166 list.append( "Middle Name" ); 173 list.append( mapIdToStr[ Qtopia::MiddleName ] );
167 list.append( "Last Name" ); 174 list.append( mapIdToStr[ Qtopia::LastName ] );
168 list.append( "Suffix" ); 175 list.append( mapIdToStr[ Qtopia::Suffix ] );
169 list.append( "File As" ); 176 list.append( mapIdToStr[ Qtopia::FileAs ] );
170 177
171 list.append( "Job Title" ); 178 list.append( mapIdToStr[ Qtopia::JobTitle ] );
172 list.append( "Department" ); 179 list.append( mapIdToStr[ Qtopia::Department ] );
173 list.append( "Company" ); 180 list.append( mapIdToStr[ Qtopia::Company ] );
174 181
175 list += untrphonefields( sorted ); 182 list += untrphonefields( sorted );
176 183
177 list.append( "Business Street" ); 184 list.append( mapIdToStr[ Qtopia::BusinessStreet ] );
178 list.append( "Business City" ); 185 list.append( mapIdToStr[ Qtopia::BusinessCity ] );
179 list.append( "Business State" ); 186 list.append( mapIdToStr[ Qtopia::BusinessState ] );
180 list.append( "Business Zip" ); 187 list.append( mapIdToStr[ Qtopia::BusinessZip ] );
181 list.append( "Business Country" ); 188 list.append( mapIdToStr[ Qtopia::BusinessCountry ] );
182 list.append( "Business Pager" ); 189 list.append( mapIdToStr[ Qtopia::BusinessPager ] );
183 list.append( "Business WebPage" ); 190 list.append( mapIdToStr[ Qtopia::BusinessWebPage ] );
184 191
185 list.append( "Home Street" ); 192 list.append( mapIdToStr[ Qtopia::HomeStreet ] );
186 list.append( "Home City" ); 193 list.append( mapIdToStr[ Qtopia::HomeCity ] );
187 list.append( "Home State" ); 194 list.append( mapIdToStr[ Qtopia::HomeState ] );
188 list.append( "Home Zip" ); 195 list.append( mapIdToStr[ Qtopia::HomeZip ] );
189 list.append( "Home Country" ); 196 list.append( mapIdToStr[ Qtopia::HomeCountry ] );
190 list.append( "Home Web Page" ); 197 list.append( mapIdToStr[ Qtopia::HomeWebPage] );
191 198
192 list += untrdetailsfields( sorted ); 199 list += untrdetailsfields( sorted );
193 200
194 list.append( "Notes" ); 201 list.append( mapIdToStr[ Qtopia::Notes ] );
195 list.append( "Groups" ); 202 list.append( mapIdToStr[ Qtopia::Groups ] );
196 203
197 if (sorted) list.sort(); 204 if (sorted) list.sort();
198 205
199 return list; 206 return list;
200} 207}
201QMap<int, QString> OContactFields::idToTrFields() 208QMap<int, QString> OContactFields::idToTrFields()
202{ 209{
203 QMap<int, QString> ret_map; 210 QMap<int, QString> ret_map;
204 211
205 ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); 212 ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") );
206 ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); 213 ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) );
207 ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); 214 ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) );
208 ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); 215 ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) );
209 ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); 216 ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" ));
210 ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); 217 ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) );
211 218
212 ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); 219 ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) );
213 ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); 220 ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) );
214 ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); 221 ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) );
215 ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); 222 ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) );
216 ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); 223 ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) );
217 ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); 224 ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" ));
218 225
219 // email 226 // email
220 ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); 227 ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) );
221 ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); 228 ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) );
222 229
223 ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); 230 ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) );
224 ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); 231 ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) );
225 ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); 232 ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) );
226 233
227 // business 234 // business
228 ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); 235 ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) );
229 ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) ); 236 ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) );
230 ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) ); 237 ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) );
231 ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) ); 238 ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) );
232 ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) ); 239 ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) );
233 ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) ); 240 ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) );
234 ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) ); 241 ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) );
235 242
236 ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); 243 ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) );
237 ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); 244 ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) );
238 ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); 245 ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) );
239 ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); 246 ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) );
240 247
241 // home 248 // home
242 ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); 249 ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) );
243 ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); 250 ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) );
244 ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); 251 ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) );
245 ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); 252 ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) );
246 ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); 253 ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) );
247 ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); 254 ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) );
248 255
249 //personal 256 //personal
250 ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); 257 ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) );
251 ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); 258 ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) );
252 ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); 259 ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) );
253 ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); 260 ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) );
254 ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); 261 ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) );
255 ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); 262 ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) );
256 263
257 // other 264 // other
258 ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); 265 ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) );
259 266
260 267
261 return ret_map; 268 return ret_map;
262} 269}
263 270
271QMap<int, QString> OContactFields::idToUntrFields()
272{
273 QMap<int, QString> ret_map;
274
275 ret_map.insert( Qtopia::Title, "Name Title" );
276 ret_map.insert( Qtopia::FirstName, "First Name" );
277 ret_map.insert( Qtopia::MiddleName, "Middle Name" );
278 ret_map.insert( Qtopia::LastName, "Last Name" );
279 ret_map.insert( Qtopia::Suffix, "Suffix" );
280 ret_map.insert( Qtopia::FileAs, "File As" );
281
282 ret_map.insert( Qtopia::JobTitle, "Job Title" );
283 ret_map.insert( Qtopia::Department, "Department" );
284 ret_map.insert( Qtopia::Company, "Company" );
285 ret_map.insert( Qtopia::BusinessPhone, "Business Phone" );
286 ret_map.insert( Qtopia::BusinessFax, "Business Fax" );
287 ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" );
288
289 // email
290 ret_map.insert( Qtopia::DefaultEmail, "Default Email" );
291 ret_map.insert( Qtopia::Emails, "Emails" );
292
293 ret_map.insert( Qtopia::HomePhone, "Home Phone" );
294 ret_map.insert( Qtopia::HomeFax, "Home Fax" );
295 ret_map.insert( Qtopia::HomeMobile, "Home Mobile" );
296
297 // business
298 ret_map.insert( Qtopia::BusinessStreet, "Business Street" );
299 ret_map.insert( Qtopia::BusinessCity, "Business City" );
300 ret_map.insert( Qtopia::BusinessState, "Business State" );
301 ret_map.insert( Qtopia::BusinessZip, "Business Zip" );
302 ret_map.insert( Qtopia::BusinessCountry, "Business Country" );
303 ret_map.insert( Qtopia::BusinessPager, "Business Pager" );
304 ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" );
305
306 ret_map.insert( Qtopia::Office, "Office" );
307 ret_map.insert( Qtopia::Profession, "Profession" );
308 ret_map.insert( Qtopia::Assistant, "Assistant" );
309 ret_map.insert( Qtopia::Manager, "Manager" );
310
311 // home
312 ret_map.insert( Qtopia::HomeStreet, "Home Street" );
313 ret_map.insert( Qtopia::HomeCity, "Home City" );
314 ret_map.insert( Qtopia::HomeState, "Home State" );
315 ret_map.insert( Qtopia::HomeZip, "Home Zip" );
316 ret_map.insert( Qtopia::HomeCountry, "Home Country" );
317 ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" );
318
319 //personal
320 ret_map.insert( Qtopia::Spouse, "Spouse" );
321 ret_map.insert( Qtopia::Gender, "Gender" );
322 ret_map.insert( Qtopia::Birthday, "Birthday" );
323 ret_map.insert( Qtopia::Anniversary, "Anniversary" );
324 ret_map.insert( Qtopia::Nickname, "Nickname" );
325 ret_map.insert( Qtopia::Children, "Children" );
326
327 // other
328 ret_map.insert( Qtopia::Notes, "Notes" );
329
330
331 return ret_map;
332}
333
264QMap<QString, int> OContactFields::trFieldsToId() 334QMap<QString, int> OContactFields::trFieldsToId()
265{ 335{
266 QMap<int, QString> idtostr = idToTrFields(); 336 QMap<int, QString> idtostr = idToTrFields();
267 QMap<QString, int> ret_map; 337 QMap<QString, int> ret_map;
268 338
269 339
270 QMap<int, QString>::Iterator it; 340 QMap<int, QString>::Iterator it;
271 for( it = idtostr.begin(); it != idtostr.end(); ++it ) 341 for( it = idtostr.begin(); it != idtostr.end(); ++it )
272 ret_map.insert( *it, it.key() ); 342 ret_map.insert( *it, it.key() );
273 343
274 344
275 return ret_map; 345 return ret_map;
276} 346}
277 347
348QMap<QString, int> OContactFields::untrFieldsToId()
349{
350 QMap<int, QString> idtostr = idToUntrFields();
351 QMap<QString, int> ret_map;
352
353
354 QMap<int, QString>::Iterator it;
355 for( it = idtostr.begin(); it != idtostr.end(); ++it )
356 ret_map.insert( *it, it.key() );
357
358
359 return ret_map;
360}
361
362
278OContactFields::OContactFields(): 363OContactFields::OContactFields():
279 fieldOrder( DEFAULT_FIELD_ORDER ), 364 fieldOrder( DEFAULT_FIELD_ORDER ),
280 changedFieldOrder( false ) 365 changedFieldOrder( false )
281{ 366{
282 // Get the global field order from the config file and 367 // Get the global field order from the config file and
283 // use it as a start pattern 368 // use it as a start pattern
284 Config cfg ( "AddressBook" ); 369 Config cfg ( "AddressBook" );
285 cfg.setGroup( "ContactFieldOrder" ); 370 cfg.setGroup( "ContactFieldOrder" );
286 globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); 371 globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER );
287} 372}
288 373
289OContactFields::~OContactFields(){ 374OContactFields::~OContactFields(){
290 375
291 // We will store the fieldorder into the config file 376 // We will store the fieldorder into the config file
292 // to reuse it for the future.. 377 // to reuse it for the future..
293 if ( changedFieldOrder ){ 378 if ( changedFieldOrder ){
294 Config cfg ( "AddressBook" ); 379 Config cfg ( "AddressBook" );
295 cfg.setGroup( "ContactFieldOrder" ); 380 cfg.setGroup( "ContactFieldOrder" );
296 cfg.writeEntry( "General", globalFieldOrder ); 381 cfg.writeEntry( "General", globalFieldOrder );
297 } 382 }
298} 383}
299 384
300 385
301 386
302void OContactFields::saveToRecord( OContact &cnt ){ 387void OContactFields::saveToRecord( OContact &cnt ){
303 388
304 qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1()); 389 qDebug("ocontactfields saveToRecord: >%s<",fieldOrder.latin1());
305 390
306 // Store fieldorder into this contact. 391 // Store fieldorder into this contact.
307 cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder ); 392 cnt.setCustomField( CONTACT_FIELD_ORDER_NAME, fieldOrder );
308 393
309 globalFieldOrder = fieldOrder; 394 globalFieldOrder = fieldOrder;
310 changedFieldOrder = true; 395 changedFieldOrder = true;
311 396
312} 397}
313 398
314void OContactFields::loadFromRecord( const OContact &cnt ){ 399void OContactFields::loadFromRecord( const OContact &cnt ){
315 qDebug("ocontactfields loadFromRecord"); 400 qDebug("ocontactfields loadFromRecord");
316 qDebug("loading >%s<",cnt.fullName().latin1()); 401 qDebug("loading >%s<",cnt.fullName().latin1());
317 402
318 // Get fieldorder for this contact. If none is defined, 403 // Get fieldorder for this contact. If none is defined,
319 // we will use the global one from the config file.. 404 // we will use the global one from the config file..
320 405
321 fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME ); 406 fieldOrder = cnt.customField( CONTACT_FIELD_ORDER_NAME );
322 407
323 qDebug("fieldOrder from contact>%s<",fieldOrder.latin1()); 408 qDebug("fieldOrder from contact>%s<",fieldOrder.latin1());
324 409
325 if (fieldOrder.isEmpty()){ 410 if (fieldOrder.isEmpty()){
326 fieldOrder = globalFieldOrder; 411 fieldOrder = globalFieldOrder;
327 } 412 }
328 413
329 414
330 qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1()); 415 qDebug("effective fieldOrder in loadFromRecord >%s<",fieldOrder.latin1());
331} 416}
332 417
333void OContactFields::setFieldOrder( int num, int index ){ 418void OContactFields::setFieldOrder( int num, int index ){
334 qDebug("qcontactfields setfieldorder pos %i -> %i",num,index); 419 qDebug("qcontactfields setfieldorder pos %i -> %i",num,index);
335 420
336 fieldOrder[num] = QString::number( index )[0]; 421 fieldOrder[num] = QString::number( index )[0];
337 422
338 // We will store this new fieldorder globally to 423 // We will store this new fieldorder globally to
339 // remember it for contacts which have none 424 // remember it for contacts which have none
340 globalFieldOrder = fieldOrder; 425 globalFieldOrder = fieldOrder;
341 changedFieldOrder = true; 426 changedFieldOrder = true;
342 427
343 qDebug("fieldOrder >%s<",fieldOrder.latin1()); 428 qDebug("fieldOrder >%s<",fieldOrder.latin1());
344} 429}
345 430
346int OContactFields::getFieldOrder( int num, int defIndex ){ 431int OContactFields::getFieldOrder( int num, int defIndex ){
347 qDebug("ocontactfields getFieldOrder"); 432 qDebug("ocontactfields getFieldOrder");
348 qDebug("fieldOrder >%s<",fieldOrder.latin1()); 433 qDebug("fieldOrder >%s<",fieldOrder.latin1());
349 434
350 // Get index of combo as char.. 435 // Get index of combo as char..
351 QChar poschar = fieldOrder[num]; 436 QChar poschar = fieldOrder[num];
352 437
353 bool ok; 438 bool ok;
354 int ret = 0; 439 int ret = 0;
355 // Convert char to number.. 440 // Convert char to number..
356 if ( !( poschar == QChar::null ) ) 441 if ( !( poschar == QChar::null ) )
357 ret = QString( poschar ).toInt(&ok, 10); 442 ret = QString( poschar ).toInt(&ok, 10);
358 else 443 else
359 ok = false; 444 ok = false;
360 445
361 // Return default value if index for 446 // Return default value if index for
362 // num was not set or if anything else happened.. 447 // num was not set or if anything else happened..
363 if ( !ok ) ret = defIndex; 448 if ( !ok ) ret = defIndex;
364 449
365 qDebug("returning >%i<",ret); 450 qDebug("returning >%i<",ret);
366 451
367 return ret; 452 return ret;
368 453
369} 454}
diff --git a/core/pim/addressbook/ocontactfields.h b/core/pim/addressbook/ocontactfields.h
index bf3a7f5..9f6171b 100644
--- a/core/pim/addressbook/ocontactfields.h
+++ b/core/pim/addressbook/ocontactfields.h
@@ -1,58 +1,60 @@
1#ifndef OPIE_CONTACTS_FIELDS 1#ifndef OPIE_CONTACTS_FIELDS
2#define OPIE_CONTACTS_FIELDS 2#define OPIE_CONTACTS_FIELDS
3 3
4class QStringList; 4class QStringList;
5 5
6#include <qmap.h> 6#include <qmap.h>
7#include <qstring.h> 7#include <qstring.h>
8#include <opie/ocontact.h> 8#include <opie/ocontact.h>
9 9
10#define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order" 10#define CONTACT_FIELD_ORDER_NAME "opie-contactfield-order"
11#define DEFAULT_FIELD_ORDER "__________" 11#define DEFAULT_FIELD_ORDER "__________"
12 12
13class OContactFields{ 13class OContactFields{
14 14
15 public: 15 public:
16 OContactFields(); 16 OContactFields();
17 ~OContactFields(); 17 ~OContactFields();
18 /** Set the index for combo boxes. 18 /** Set the index for combo boxes.
19 * Sets the <b>index</b> of combo <b>num</b>. 19 * Sets the <b>index</b> of combo <b>num</b>.
20 * @param num selects the number of the combo 20 * @param num selects the number of the combo
21 * @param index sets the index in the combo 21 * @param index sets the index in the combo
22 */ 22 */
23 void setFieldOrder( int num, int index ); 23 void setFieldOrder( int num, int index );
24 24
25 /** Get the index for combo boxes. 25 /** Get the index for combo boxes.
26 * Returns the index of combo <b>num</b> or defindex 26 * Returns the index of combo <b>num</b> or defindex
27 * if none was defined.. 27 * if none was defined..
28 * @param num Selects the number of the combo 28 * @param num Selects the number of the combo
29 * @param defIndex will be returned if none was defined (either 29 * @param defIndex will be returned if none was defined (either
30 * globally in the config file, nor by the contact which was used 30 * globally in the config file, nor by the contact which was used
31 * by loadFromRecord() ) 31 * by loadFromRecord() )
32 */ 32 */
33 int getFieldOrder( int num, int defIndex); 33 int getFieldOrder( int num, int defIndex);
34 34
35 /** Store fieldorder to contact. */ 35 /** Store fieldorder to contact. */
36 void saveToRecord( OContact& ); 36 void saveToRecord( OContact& );
37 /** Get Fieldorder from contact. */ 37 /** Get Fieldorder from contact. */
38 void loadFromRecord( const OContact& ); 38 void loadFromRecord( const OContact& );
39 39
40 private: 40 private:
41 QString fieldOrder; 41 QString fieldOrder;
42 QString globalFieldOrder; 42 QString globalFieldOrder;
43 bool changedFieldOrder; 43 bool changedFieldOrder;
44 44
45 public: 45 public:
46 static QStringList trphonefields( bool sorted = true ); 46 static QStringList trphonefields( bool sorted = true );
47 static QStringList untrphonefields( bool sorted = true ); 47 static QStringList untrphonefields( bool sorted = true );
48 static QStringList trdetailsfields( bool sorted = true ); 48 static QStringList trdetailsfields( bool sorted = true );
49 static QStringList untrdetailsfields( bool sorted = true ); 49 static QStringList untrdetailsfields( bool sorted = true );
50 static QStringList trfields( bool sorted = true ); 50 static QStringList trfields( bool sorted = true );
51 static QStringList untrfields( bool sorted = true ); 51 static QStringList untrfields( bool sorted = true );
52 52
53 static QMap<int, QString> idToTrFields(); 53 static QMap<int, QString> idToTrFields();
54 static QMap<QString, int> trFieldsToId(); 54 static QMap<QString, int> trFieldsToId();
55 static QMap<int, QString> idToUntrFields();
56 static QMap<QString, int> untrFieldsToId();
55 57
56}; 58};
57 59
58#endif 60#endif