Diffstat (limited to 'core/pim/addressbook/contacteditor.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | core/pim/addressbook/contacteditor.cpp | 84 |
1 files changed, 59 insertions, 25 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp index bae3a2b..e7f2ebd 100644 --- a/core/pim/addressbook/contacteditor.cpp +++ b/core/pim/addressbook/contacteditor.cpp | |||
@@ -337,13 +337,12 @@ void ContactEditor::init() { | |||
337 | if ( (*it) == "Home Country" ) { | 337 | if ( (*it) == "Home Country" ) { |
338 | hasCountry = TRUE; | 338 | hasCountry = TRUE; |
339 | //slDynamicEntries->remove( it ); | 339 | //slDynamicEntries->remove( it ); |
340 | continue; | 340 | continue; |
341 | } | 341 | } |
342 | 342 | ||
343 | |||
344 | slDynamicEntries.append( *it ); | 343 | slDynamicEntries.append( *it ); |
345 | } | 344 | } |
346 | } | 345 | } |
347 | 346 | ||
348 | QVBoxLayout *vb = new QVBoxLayout( this ); | 347 | QVBoxLayout *vb = new QVBoxLayout( this ); |
349 | 348 | ||
@@ -705,21 +704,24 @@ void ContactEditor::init() { | |||
705 | 704 | ||
706 | container = new QWidget( svDetails->viewport() ); | 705 | container = new QWidget( svDetails->viewport() ); |
707 | svDetails->addChild( container ); | 706 | svDetails->addChild( container ); |
708 | 707 | ||
709 | gl = new QGridLayout( container, 1, 2, 2, 4 ); | 708 | gl = new QGridLayout( container, 1, 2, 2, 4 ); |
710 | 709 | ||
710 | // Create Labels and lineedit fields for every dynamic entry | ||
711 | QStringList::ConstIterator it = slDynamicEntries.begin(); | 711 | QStringList::ConstIterator it = slDynamicEntries.begin(); |
712 | for (i = 0; it != slDynamicEntries.end(); i++, ++it) { | 712 | for (i = 0; it != slDynamicEntries.end(); i++, ++it) { |
713 | l = new QLabel( *it, container ); | 713 | l = new QLabel( QString::null , container ); |
714 | listName.append( l ); | 714 | listName.append( l ); |
715 | gl->addWidget( l, i, 0 ); | 715 | gl->addWidget( l, i, 0 ); |
716 | QLineEdit *e = new QLineEdit( container ); | 716 | QLineEdit *e = new QLineEdit( container ); |
717 | listValue.append( e ); | 717 | listValue.append( e ); |
718 | gl->addWidget( e, i, 1); | 718 | gl->addWidget( e, i, 1); |
719 | } | 719 | } |
720 | // Fill labels with names.. | ||
721 | loadFields(); | ||
720 | 722 | ||
721 | l = new QLabel( tr("Gender"), container ); | 723 | l = new QLabel( tr("Gender"), container ); |
722 | gl->addWidget( l, slDynamicEntries.count(), 0 ); | 724 | gl->addWidget( l, slDynamicEntries.count(), 0 ); |
723 | cmbGender = new QComboBox( container ); | 725 | cmbGender = new QComboBox( container ); |
724 | cmbGender->insertItem( "", 0 ); | 726 | cmbGender->insertItem( "", 0 ); |
725 | cmbGender->insertItem( tr("Male"), 1); | 727 | cmbGender->insertItem( tr("Male"), 1); |
@@ -1009,13 +1011,45 @@ void ContactEditor::slotFullNameChange( const QString &textChanged ) { | |||
1009 | 1011 | ||
1010 | void ContactEditor::loadFields() { | 1012 | void ContactEditor::loadFields() { |
1011 | 1013 | ||
1012 | QStringList::ConstIterator it; | 1014 | QStringList::ConstIterator it; |
1013 | QListIterator<QLabel> lit( listName ); | 1015 | QListIterator<QLabel> lit( listName ); |
1014 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { | 1016 | for ( it = slDynamicEntries.begin(); *lit; ++lit, ++it) { |
1015 | (*lit)->setText( *it ); | 1017 | |
1018 | if ( *it == "Department" ) | ||
1019 | (*lit)->setText( tr( "Department" ) ); | ||
1020 | |||
1021 | if ( *it == "Company" ) | ||
1022 | (*lit)->setText( tr( "Company" ) ); | ||
1023 | |||
1024 | if ( *it == "Office" ) | ||
1025 | (*lit)->setText( tr( "Office" ) ); | ||
1026 | |||
1027 | if ( *it == "Profession" ) | ||
1028 | (*lit)->setText( tr( "Profession" ) ); | ||
1029 | |||
1030 | if ( *it == "Assistant" ) | ||
1031 | (*lit)->setText( tr( "Assistant" ) ); | ||
1032 | |||
1033 | if ( *it == "Manager" ) | ||
1034 | (*lit)->setText( tr( "Manager" ) ); | ||
1035 | |||
1036 | if ( *it == "Spouse" ) | ||
1037 | (*lit)->setText( tr( "Spouse" ) ); | ||
1038 | |||
1039 | if ( *it == "Birthday" ) | ||
1040 | (*lit)->setText( tr( "Birthday" ) ); | ||
1041 | |||
1042 | if ( *it == "Anniversary" ) | ||
1043 | (*lit)->setText( tr( "Anniversary" ) ); | ||
1044 | |||
1045 | if ( *it == "Nickname" ) | ||
1046 | (*lit)->setText( tr( "Nickname" ) ); | ||
1047 | |||
1048 | if ( *it == "Children" ) | ||
1049 | (*lit)->setText( tr( "Children" ) ); | ||
1016 | } | 1050 | } |
1017 | } | 1051 | } |
1018 | 1052 | ||
1019 | void ContactEditor::accept() { | 1053 | void ContactEditor::accept() { |
1020 | 1054 | ||
1021 | if ( isEmpty() ) { | 1055 | if ( isEmpty() ) { |
@@ -1371,43 +1405,43 @@ void ContactEditor::setEntry( const OContact &entry ) { | |||
1371 | slBusinessAddress[6] = ent.businessCountry(); | 1405 | slBusinessAddress[6] = ent.businessCountry(); |
1372 | } | 1406 | } |
1373 | 1407 | ||
1374 | QStringList::ConstIterator it; | 1408 | QStringList::ConstIterator it; |
1375 | QListIterator<QLineEdit> itLE( listValue ); | 1409 | QListIterator<QLineEdit> itLE( listValue ); |
1376 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1410 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1377 | if ( *it == tr( "Department" ) ) | 1411 | if ( *it == "Department" ) |
1378 | (*itLE)->setText( ent.department() ); | 1412 | (*itLE)->setText( ent.department() ); |
1379 | 1413 | ||
1380 | if ( *it == tr( "Company" ) ) | 1414 | if ( *it == "Company" ) |
1381 | (*itLE)->setText( ent.company() ); | 1415 | (*itLE)->setText( ent.company() ); |
1382 | 1416 | ||
1383 | if ( *it == tr( "Office" ) ) | 1417 | if ( *it == "Office" ) |
1384 | (*itLE)->setText( ent.office() ); | 1418 | (*itLE)->setText( ent.office() ); |
1385 | 1419 | ||
1386 | if ( *it == tr( "Profession" ) ) | 1420 | if ( *it == "Profession" ) |
1387 | (*itLE)->setText( ent.profession() ); | 1421 | (*itLE)->setText( ent.profession() ); |
1388 | 1422 | ||
1389 | if ( *it == tr( "Assistant" ) ) | 1423 | if ( *it == "Assistant" ) |
1390 | (*itLE)->setText( ent.assistant() ); | 1424 | (*itLE)->setText( ent.assistant() ); |
1391 | 1425 | ||
1392 | if ( *it == tr( "Manager" ) ) | 1426 | if ( *it == "Manager" ) |
1393 | (*itLE)->setText( ent.manager() ); | 1427 | (*itLE)->setText( ent.manager() ); |
1394 | 1428 | ||
1395 | if ( *it == tr( "Spouse" ) ) | 1429 | if ( *it == "Spouse" ) |
1396 | (*itLE)->setText( ent.spouse() ); | 1430 | (*itLE)->setText( ent.spouse() ); |
1397 | 1431 | ||
1398 | if ( *it == tr( "Birthday" ) ) | 1432 | if ( *it == "Birthday" ) |
1399 | (*itLE)->setText( ent.birthday() ); | 1433 | (*itLE)->setText( ent.birthday() ); |
1400 | 1434 | ||
1401 | if ( *it == tr( "Anniversary" ) ) | 1435 | if ( *it == "Anniversary" ) |
1402 | (*itLE)->setText( ent.anniversary() ); | 1436 | (*itLE)->setText( ent.anniversary() ); |
1403 | 1437 | ||
1404 | if ( *it == tr( "Nickname" ) ) | 1438 | if ( *it == "Nickname" ) |
1405 | (*itLE)->setText( ent.nickname() ); | 1439 | (*itLE)->setText( ent.nickname() ); |
1406 | 1440 | ||
1407 | if ( *it == tr( "Children" ) ) | 1441 | if ( *it == "Children" ) |
1408 | (*itLE)->setText( ent.children() ); | 1442 | (*itLE)->setText( ent.children() ); |
1409 | 1443 | ||
1410 | } | 1444 | } |
1411 | 1445 | ||
1412 | QStringList::Iterator itV; | 1446 | QStringList::Iterator itV; |
1413 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1447 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |
@@ -1569,43 +1603,43 @@ void ContactEditor::saveEntry() { | |||
1569 | ent.setBusinessCountry( slBusinessAddress[6] ); | 1603 | ent.setBusinessCountry( slBusinessAddress[6] ); |
1570 | } | 1604 | } |
1571 | 1605 | ||
1572 | QStringList::ConstIterator it; | 1606 | QStringList::ConstIterator it; |
1573 | QListIterator<QLineEdit> itLE( listValue ); | 1607 | QListIterator<QLineEdit> itLE( listValue ); |
1574 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { | 1608 | for ( it = slDynamicEntries.begin(); it != slDynamicEntries.end(); ++it, ++itLE) { |
1575 | if ( *it == tr( "Department" ) ) | 1609 | if ( *it == "Department" ) |
1576 | ent.setDepartment( (*itLE)->text() ); | 1610 | ent.setDepartment( (*itLE)->text() ); |
1577 | 1611 | ||
1578 | if ( *it == tr( "Company" ) ) | 1612 | if ( *it == "Company" ) |
1579 | ent.setCompany( (*itLE)->text() ); | 1613 | ent.setCompany( (*itLE)->text() ); |
1580 | 1614 | ||
1581 | if ( *it == tr( "Office" ) ) | 1615 | if ( *it == "Office" ) |
1582 | ent.setOffice( (*itLE)->text() ); | 1616 | ent.setOffice( (*itLE)->text() ); |
1583 | 1617 | ||
1584 | if ( *it == tr( "Profession" ) ) | 1618 | if ( *it == "Profession" ) |
1585 | ent.setProfession( (*itLE)->text() ); | 1619 | ent.setProfession( (*itLE)->text() ); |
1586 | 1620 | ||
1587 | if ( *it == tr( "Assistant" ) ) | 1621 | if ( *it == "Assistant" ) |
1588 | ent.setAssistant( (*itLE)->text() ); | 1622 | ent.setAssistant( (*itLE)->text() ); |
1589 | 1623 | ||
1590 | if ( *it == tr( "Manager" ) ) | 1624 | if ( *it == "Manager" ) |
1591 | ent.setManager( (*itLE)->text() ); | 1625 | ent.setManager( (*itLE)->text() ); |
1592 | 1626 | ||
1593 | if ( *it == tr( "Spouse" ) ) | 1627 | if ( *it == "Spouse" ) |
1594 | ent.setSpouse( (*itLE)->text() ); | 1628 | ent.setSpouse( (*itLE)->text() ); |
1595 | 1629 | ||
1596 | if ( *it == tr( "Birthday" ) ) | 1630 | if ( *it == "Birthday" ) |
1597 | ent.setBirthday( (*itLE)->text() ); | 1631 | ent.setBirthday( (*itLE)->text() ); |
1598 | 1632 | ||
1599 | if ( *it == tr( "Anniversary" ) ) | 1633 | if ( *it == "Anniversary" ) |
1600 | ent.setAnniversary( (*itLE)->text() ); | 1634 | ent.setAnniversary( (*itLE)->text() ); |
1601 | 1635 | ||
1602 | if ( *it == tr( "Nickname" ) ) | 1636 | if ( *it == "Nickname" ) |
1603 | ent.setNickname( (*itLE)->text() ); | 1637 | ent.setNickname( (*itLE)->text() ); |
1604 | 1638 | ||
1605 | if ( *it == tr( "Children" ) ) | 1639 | if ( *it == "Children" ) |
1606 | ent.setChildren( (*itLE)->text() ); | 1640 | ent.setChildren( (*itLE)->text() ); |
1607 | 1641 | ||
1608 | } | 1642 | } |
1609 | 1643 | ||
1610 | QStringList::ConstIterator itV; | 1644 | QStringList::ConstIterator itV; |
1611 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { | 1645 | for ( it = slChooserNames.begin(), itV = slChooserValues.begin(); it != slChooserNames.end(); ++it, ++itV ) { |