author | eilers <eilers> | 2003-02-17 14:21:37 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-02-17 14:21:37 (UTC) |
commit | 85c45fe1fb1967135a7c11c27d54724edd29a4c9 (patch) (unidiff) | |
tree | 6c4ba5057460299f298daf94c665b7a668c04292 | |
parent | 24344a3c43b20e1cd8b9ecbf73031b744cdf8197 (diff) | |
download | opie-85c45fe1fb1967135a7c11c27d54724edd29a4c9.zip opie-85c45fe1fb1967135a7c11c27d54724edd29a4c9.tar.gz opie-85c45fe1fb1967135a7c11c27d54724edd29a4c9.tar.bz2 |
I hope translation is fixed, now !
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 4 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 257 | ||||
-rw-r--r-- | core/pim/addressbook/ocontactfields.h | 2 |
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 | |||
@@ -456,198 +456,200 @@ void ContactEditor::init() { | |||
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"); |
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 | */ |
16 | QStringList OContactFields::untrdetailsfields( bool sorted ) | 16 | QStringList 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 | */ |
40 | QStringList OContactFields::trdetailsfields( bool sorted ) | 41 | QStringList 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 | */ |
65 | QStringList OContactFields::trphonefields( bool sorted ) | 67 | QStringList 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 | */ |
89 | QStringList OContactFields::untrphonefields( bool sorted ) | 93 | QStringList 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 | */ |
114 | QStringList OContactFields::trfields( bool sorted ) | 119 | QStringList 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 | */ |
160 | QStringList OContactFields::untrfields( bool sorted ) | 166 | QStringList 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 | } |
201 | QMap<int, QString> OContactFields::idToTrFields() | 208 | QMap<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 | 226 | ||
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 | ||
271 | QMap<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 | |||
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 | |||
264 | QMap<QString, int> OContactFields::trFieldsToId() | 334 | QMap<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 | ||
348 | QMap<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 | |||
278 | OContactFields::OContactFields(): | 363 | OContactFields::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 | ||
289 | OContactFields::~OContactFields(){ | 374 | OContactFields::~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 | ||
302 | void OContactFields::saveToRecord( OContact &cnt ){ | 387 | void 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 | ||
314 | void OContactFields::loadFromRecord( const OContact &cnt ){ | 399 | void 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 | ||
333 | void OContactFields::setFieldOrder( int num, int index ){ | 418 | void 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 | ||
346 | int OContactFields::getFieldOrder( int num, int defIndex ){ | 431 | int 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 | ||
4 | class QStringList; | 4 | class 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 | ||
13 | class OContactFields{ | 13 | class 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 |