-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 | |||
@@ -549,12 +549,14 @@ void ContactEditor::init() { | |||
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 ); |
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 | |||
@@ -16,18 +16,19 @@ | |||
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; |
@@ -40,18 +41,19 @@ QStringList OContactFields::untrdetailsfields( bool sorted ) | |||
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; |
@@ -65,16 +67,18 @@ QStringList OContactFields::trdetailsfields( bool sorted ) | |||
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 | ||
@@ -89,17 +93,18 @@ QStringList OContactFields::trphonefields( bool sorted ) | |||
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 | ||
@@ -114,39 +119,40 @@ QStringList OContactFields::untrphonefields( bool sorted ) | |||
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 | ||
@@ -160,39 +166,40 @@ QStringList OContactFields::trfields( bool sorted ) | |||
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 | ||
@@ -261,6 +268,69 @@ QMap<int, QString> OContactFields::idToTrFields() | |||
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(); |
@@ -275,6 +345,21 @@ QMap<QString, int> OContactFields::trFieldsToId() | |||
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 ) |
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 | |||
@@ -52,6 +52,8 @@ class OContactFields{ | |||
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 | ||