author | eilers <eilers> | 2003-02-17 14:21:37 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-02-17 14:21:37 (UTC) |
commit | 85c45fe1fb1967135a7c11c27d54724edd29a4c9 (patch) (side-by-side diff) | |
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 @@ -544,22 +544,24 @@ void ContactEditor::init() { cmbGender->insertItem( tr("Female"), 2); gl->addWidget( cmbGender, counter, 1 ); ++counter; // Create Labels and lineedit fields for every dynamic entry QStringList::ConstIterator it = slDynamicEntries.begin(); QStringList::ConstIterator trit = trlDynamicEntries.begin(); + QMap<QString, int> mapStrToID = OContactFields::untrFieldsToId(); + QMap<int, QString> mapIdToStr = OContactFields::idToTrFields(); for (i = counter; it != slDynamicEntries.end(); i++, ++it, ++trit) { if (((*it) == "Anniversary") || ((*it) == "Birthday")|| ((*it) == "Gender")) continue; - l = new QLabel( (*it).utf8() , container ); + l = new QLabel( mapIdToStr[mapStrToID[*it]].utf8() , container ); listName.append( l ); gl->addWidget( l, i, 0 ); QLineEdit *e = new QLineEdit( container ); listValue.append( e ); gl->addWidget( e, i, 1); } // Fill labels with names.. // loadFields(); 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 @@ -11,193 +11,200 @@ /*! \internal Returns a list of details field names for a contact. */ QStringList OContactFields::untrdetailsfields( bool sorted ) { QStringList list; + QMap<int, QString> mapIdToStr = idToUntrFields(); - list.append( "Office" ); - list.append( "Profession" ); - list.append( "Assistant" ); - list.append( "Manager" ); + list.append( mapIdToStr[ Qtopia::Office ] ); + list.append( mapIdToStr[ Qtopia::Profession ] ); + list.append( mapIdToStr[ Qtopia::Assistant ] ); + list.append( mapIdToStr[ Qtopia::Manager ] ); - list.append( "Spouse" ); - list.append( "Gender" ); - list.append( "Birthday" ); - list.append( "Anniversary" ); - list.append( "Nickname" ); - list.append( "Children" ); + list.append( mapIdToStr[ Qtopia::Spouse ] ); + list.append( mapIdToStr[ Qtopia::Gender ] ); + list.append( mapIdToStr[ Qtopia::Birthday ] ); + list.append( mapIdToStr[ Qtopia::Anniversary ] ); + list.append( mapIdToStr[ Qtopia::Nickname ] ); + list.append( mapIdToStr[ Qtopia::Children ] ); if (sorted) list.sort(); return list; } /*! \internal Returns a translated list of details field names for a contact. */ QStringList OContactFields::trdetailsfields( bool sorted ) { QStringList list; + QMap<int, QString> mapIdToStr = idToTrFields(); - list.append( QObject::tr( "Office" ) ); - list.append( QObject::tr( "Profession" ) ); - list.append( QObject::tr( "Assistant" ) ); - list.append( QObject::tr( "Manager" ) ); + list.append( mapIdToStr[Qtopia::Office] ); + list.append( mapIdToStr[Qtopia::Profession] ); + list.append( mapIdToStr[Qtopia::Assistant] ); + list.append( mapIdToStr[Qtopia::Manager] ); - list.append( QObject::tr( "Spouse" ) ); - list.append( QObject::tr( "Gender" ) ); - list.append( QObject::tr( "Birthday" ) ); - list.append( QObject::tr( "Anniversary" ) ); - list.append( QObject::tr( "Nickname" ) ); - list.append( QObject::tr( "Children" ) ); + list.append( mapIdToStr[Qtopia::Spouse] ); + list.append( mapIdToStr[Qtopia::Gender] ); + list.append( mapIdToStr[Qtopia::Birthday] ); + list.append( mapIdToStr[Qtopia::Anniversary] ); + list.append( mapIdToStr[Qtopia::Nickname] ); + list.append( mapIdToStr[Qtopia::Children] ); if (sorted) list.sort(); return list; } /*! \internal Returns a translated list of phone field names for a contact. */ QStringList OContactFields::trphonefields( bool sorted ) { QStringList list; - list.append( QObject::tr( "Business Phone" ) ); - list.append( QObject::tr( "Business Fax" ) ); - list.append( QObject::tr( "Business Mobile" ) ); + QMap<int, QString> mapIdToStr = idToTrFields(); - list.append( QObject::tr( "Default Email" ) ); - list.append( QObject::tr( "Emails" ) ); + list.append( mapIdToStr[Qtopia::BusinessPhone] ); + list.append( mapIdToStr[Qtopia::BusinessFax] ); + list.append( mapIdToStr[Qtopia::BusinessMobile] ); - list.append( QObject::tr( "Home Phone" ) ); - list.append( QObject::tr( "Home Fax" ) ); - list.append( QObject::tr( "Home Mobile" ) ); + list.append( mapIdToStr[Qtopia::DefaultEmail] ); + list.append( mapIdToStr[Qtopia::Emails] ); + + list.append( mapIdToStr[Qtopia::HomePhone] ); + list.append( mapIdToStr[Qtopia::HomeFax] ); + list.append( mapIdToStr[Qtopia::HomeMobile] ); if (sorted) list.sort(); return list; } /*! \internal Returns a list of phone field names for a contact. */ QStringList OContactFields::untrphonefields( bool sorted ) { QStringList list; + QMap<int, QString> mapIdToStr = idToUntrFields(); - list.append( "Business Phone" ); - list.append( "Business Fax" ); - list.append( "Business Mobile" ); + list.append( mapIdToStr[ Qtopia::BusinessPhone ] ); + list.append( mapIdToStr[ Qtopia::BusinessFax ] ); + list.append( mapIdToStr[ Qtopia::BusinessMobile ] ); - list.append( "Default Email" ); - list.append( "Emails" ); + list.append( mapIdToStr[ Qtopia::DefaultEmail ] ); + list.append( mapIdToStr[ Qtopia::Emails ] ); - list.append( "Home Phone" ); - list.append( "Home Fax" ); - list.append( "Home Mobile" ); + list.append( mapIdToStr[ Qtopia::HomePhone ] ); + list.append( mapIdToStr[ Qtopia::HomeFax ] ); + list.append( mapIdToStr[ Qtopia::HomeMobile ] ); if (sorted) list.sort(); return list; } /*! \internal Returns a translated list of field names for a contact. */ QStringList OContactFields::trfields( bool sorted ) { QStringList list; + QMap<int, QString> mapIdToStr = idToTrFields(); - list.append( QObject::tr( "Name Title") ); - list.append( QObject::tr( "First Name" ) ); - list.append( QObject::tr( "Middle Name" ) ); - list.append( QObject::tr( "Last Name" ) ); - list.append( QObject::tr( "Suffix" ) ); - list.append( QObject::tr( "File As" ) ); + list.append( mapIdToStr[Qtopia::Title]); + list.append( mapIdToStr[Qtopia::FirstName] ); + list.append( mapIdToStr[Qtopia::MiddleName] ); + list.append( mapIdToStr[Qtopia::LastName] ); + list.append( mapIdToStr[Qtopia::Suffix] ); + list.append( mapIdToStr[Qtopia::FileAs] ); - list.append( QObject::tr( "Job Title" ) ); - list.append( QObject::tr( "Department" ) ); - list.append( QObject::tr( "Company" ) ); + list.append( mapIdToStr[Qtopia::JobTitle] ); + list.append( mapIdToStr[Qtopia::Department] ); + list.append( mapIdToStr[Qtopia::Company] ); list += trphonefields( sorted ); - list.append( QObject::tr( "Business Street" ) ); - list.append( QObject::tr( "Business City" ) ); - list.append( QObject::tr( "Business State" ) ); - list.append( QObject::tr( "Business Zip" ) ); - list.append( QObject::tr( "Business Country" ) ); - list.append( QObject::tr( "Business Pager" ) ); - list.append( QObject::tr( "Business WebPage" ) ); - - list.append( QObject::tr( "Home Street" ) ); - list.append( QObject::tr( "Home City" ) ); - list.append( QObject::tr( "Home State" ) ); - list.append( QObject::tr( "Home Zip" ) ); - list.append( QObject::tr( "Home Country" ) ); - list.append( QObject::tr( "Home Web Page" ) ); + list.append( mapIdToStr[Qtopia::BusinessStreet] ); + list.append( mapIdToStr[Qtopia::BusinessCity] ); + list.append( mapIdToStr[Qtopia::BusinessState] ); + list.append( mapIdToStr[Qtopia::BusinessZip] ); + list.append( mapIdToStr[Qtopia::BusinessCountry] ); + list.append( mapIdToStr[Qtopia::BusinessPager] ); + list.append( mapIdToStr[Qtopia::BusinessWebPage] ); + + list.append( mapIdToStr[Qtopia::HomeStreet] ); + list.append( mapIdToStr[Qtopia::HomeCity] ); + list.append( mapIdToStr[Qtopia::HomeState] ); + list.append( mapIdToStr[Qtopia::HomeZip] ); + list.append( mapIdToStr[Qtopia::HomeCountry] ); + list.append( mapIdToStr[Qtopia::HomeWebPage] ); list += trdetailsfields( sorted ); - list.append( QObject::tr( "Notes" ) ); - list.append( QObject::tr( "Groups" ) ); + list.append( mapIdToStr[Qtopia::Notes] ); + list.append( mapIdToStr[Qtopia::Groups] ); if (sorted) list.sort(); return list; } /*! \internal Returns an untranslated list of field names for a contact. */ QStringList OContactFields::untrfields( bool sorted ) { QStringList list; + QMap<int, QString> mapIdToStr = idToUntrFields(); - list.append( "Name Title" ); - list.append( "First Name" ); - list.append( "Middle Name" ); - list.append( "Last Name" ); - list.append( "Suffix" ); - list.append( "File As" ); + list.append( mapIdToStr[ Qtopia::Title ] ); + list.append( mapIdToStr[ Qtopia::FirstName ] ); + list.append( mapIdToStr[ Qtopia::MiddleName ] ); + list.append( mapIdToStr[ Qtopia::LastName ] ); + list.append( mapIdToStr[ Qtopia::Suffix ] ); + list.append( mapIdToStr[ Qtopia::FileAs ] ); - list.append( "Job Title" ); - list.append( "Department" ); - list.append( "Company" ); + list.append( mapIdToStr[ Qtopia::JobTitle ] ); + list.append( mapIdToStr[ Qtopia::Department ] ); + list.append( mapIdToStr[ Qtopia::Company ] ); list += untrphonefields( sorted ); - list.append( "Business Street" ); - list.append( "Business City" ); - list.append( "Business State" ); - list.append( "Business Zip" ); - list.append( "Business Country" ); - list.append( "Business Pager" ); - list.append( "Business WebPage" ); - - list.append( "Home Street" ); - list.append( "Home City" ); - list.append( "Home State" ); - list.append( "Home Zip" ); - list.append( "Home Country" ); - list.append( "Home Web Page" ); + list.append( mapIdToStr[ Qtopia::BusinessStreet ] ); + list.append( mapIdToStr[ Qtopia::BusinessCity ] ); + list.append( mapIdToStr[ Qtopia::BusinessState ] ); + list.append( mapIdToStr[ Qtopia::BusinessZip ] ); + list.append( mapIdToStr[ Qtopia::BusinessCountry ] ); + list.append( mapIdToStr[ Qtopia::BusinessPager ] ); + list.append( mapIdToStr[ Qtopia::BusinessWebPage ] ); + + list.append( mapIdToStr[ Qtopia::HomeStreet ] ); + list.append( mapIdToStr[ Qtopia::HomeCity ] ); + list.append( mapIdToStr[ Qtopia::HomeState ] ); + list.append( mapIdToStr[ Qtopia::HomeZip ] ); + list.append( mapIdToStr[ Qtopia::HomeCountry ] ); + list.append( mapIdToStr[ Qtopia::HomeWebPage] ); list += untrdetailsfields( sorted ); - list.append( "Notes" ); - list.append( "Groups" ); + list.append( mapIdToStr[ Qtopia::Notes ] ); + list.append( mapIdToStr[ Qtopia::Groups ] ); if (sorted) list.sort(); return list; } QMap<int, QString> OContactFields::idToTrFields() { QMap<int, QString> ret_map; @@ -256,30 +263,108 @@ QMap<int, QString> OContactFields::idToTrFields() // other ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); return ret_map; } +QMap<int, QString> OContactFields::idToUntrFields() +{ + QMap<int, QString> ret_map; + + ret_map.insert( Qtopia::Title, "Name Title" ); + ret_map.insert( Qtopia::FirstName, "First Name" ); + ret_map.insert( Qtopia::MiddleName, "Middle Name" ); + ret_map.insert( Qtopia::LastName, "Last Name" ); + ret_map.insert( Qtopia::Suffix, "Suffix" ); + ret_map.insert( Qtopia::FileAs, "File As" ); + + ret_map.insert( Qtopia::JobTitle, "Job Title" ); + ret_map.insert( Qtopia::Department, "Department" ); + ret_map.insert( Qtopia::Company, "Company" ); + ret_map.insert( Qtopia::BusinessPhone, "Business Phone" ); + ret_map.insert( Qtopia::BusinessFax, "Business Fax" ); + ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" ); + + // email + ret_map.insert( Qtopia::DefaultEmail, "Default Email" ); + ret_map.insert( Qtopia::Emails, "Emails" ); + + ret_map.insert( Qtopia::HomePhone, "Home Phone" ); + ret_map.insert( Qtopia::HomeFax, "Home Fax" ); + ret_map.insert( Qtopia::HomeMobile, "Home Mobile" ); + + // business + ret_map.insert( Qtopia::BusinessStreet, "Business Street" ); + ret_map.insert( Qtopia::BusinessCity, "Business City" ); + ret_map.insert( Qtopia::BusinessState, "Business State" ); + ret_map.insert( Qtopia::BusinessZip, "Business Zip" ); + ret_map.insert( Qtopia::BusinessCountry, "Business Country" ); + ret_map.insert( Qtopia::BusinessPager, "Business Pager" ); + ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" ); + + ret_map.insert( Qtopia::Office, "Office" ); + ret_map.insert( Qtopia::Profession, "Profession" ); + ret_map.insert( Qtopia::Assistant, "Assistant" ); + ret_map.insert( Qtopia::Manager, "Manager" ); + + // home + ret_map.insert( Qtopia::HomeStreet, "Home Street" ); + ret_map.insert( Qtopia::HomeCity, "Home City" ); + ret_map.insert( Qtopia::HomeState, "Home State" ); + ret_map.insert( Qtopia::HomeZip, "Home Zip" ); + ret_map.insert( Qtopia::HomeCountry, "Home Country" ); + ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" ); + + //personal + ret_map.insert( Qtopia::Spouse, "Spouse" ); + ret_map.insert( Qtopia::Gender, "Gender" ); + ret_map.insert( Qtopia::Birthday, "Birthday" ); + ret_map.insert( Qtopia::Anniversary, "Anniversary" ); + ret_map.insert( Qtopia::Nickname, "Nickname" ); + ret_map.insert( Qtopia::Children, "Children" ); + + // other + ret_map.insert( Qtopia::Notes, "Notes" ); + + + return ret_map; +} + QMap<QString, int> OContactFields::trFieldsToId() { QMap<int, QString> idtostr = idToTrFields(); QMap<QString, int> ret_map; QMap<int, QString>::Iterator it; for( it = idtostr.begin(); it != idtostr.end(); ++it ) ret_map.insert( *it, it.key() ); return ret_map; } +QMap<QString, int> OContactFields::untrFieldsToId() +{ + QMap<int, QString> idtostr = idToUntrFields(); + QMap<QString, int> ret_map; + + + QMap<int, QString>::Iterator it; + for( it = idtostr.begin(); it != idtostr.end(); ++it ) + ret_map.insert( *it, it.key() ); + + + return ret_map; +} + + OContactFields::OContactFields(): fieldOrder( DEFAULT_FIELD_ORDER ), changedFieldOrder( false ) { // Get the global field order from the config file and // use it as a start pattern Config cfg ( "AddressBook" ); cfg.setGroup( "ContactFieldOrder" ); 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 @@ -47,12 +47,14 @@ class OContactFields{ static QStringList untrphonefields( bool sorted = true ); static QStringList trdetailsfields( bool sorted = true ); static QStringList untrdetailsfields( bool sorted = true ); static QStringList trfields( bool sorted = true ); static QStringList untrfields( bool sorted = true ); static QMap<int, QString> idToTrFields(); static QMap<QString, int> trFieldsToId(); + static QMap<int, QString> idToUntrFields(); + static QMap<QString, int> untrFieldsToId(); }; #endif |