summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/contacteditor.cpp4
-rw-r--r--core/pim/addressbook/ocontactfields.cpp257
-rw-r--r--core/pim/addressbook/ocontactfields.h2
3 files changed, 176 insertions, 87 deletions
diff --git a/core/pim/addressbook/contacteditor.cpp b/core/pim/addressbook/contacteditor.cpp
index d830ad3..9efb8c0 100644
--- a/core/pim/addressbook/contacteditor.cpp
+++ b/core/pim/addressbook/contacteditor.cpp
@@ -528,54 +528,56 @@ void ContactEditor::init() {
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 );
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,219 +1,226 @@
1 1
2#include "ocontactfields.h" 2#include "ocontactfields.h"
3 3
4#include <qstringlist.h> 4#include <qstringlist.h>
5#include <qobject.h> 5#include <qobject.h>
6 6
7// We should use our own enum in the future .. 7// We should use our own enum in the future ..
8#include <qpe/recordfields.h> 8#include <qpe/recordfields.h>
9#include <qpe/config.h> 9#include <qpe/config.h>
10#include <opie/ocontact.h> 10#include <opie/ocontact.h>
11 11
12/*! 12/*!
13 \internal 13 \internal
14 Returns a list of details field names for a contact. 14 Returns a list of details field names for a contact.
15*/ 15*/
16QStringList OContactFields::untrdetailsfields( bool sorted ) 16QStringList OContactFields::untrdetailsfields( bool sorted )
17{ 17{
18 QStringList list; 18 QStringList list;
19 QMap<int, QString> mapIdToStr = idToUntrFields();
19 20
20 list.append( "Office" ); 21 list.append( mapIdToStr[ Qtopia::Office ] );
21 list.append( "Profession" ); 22 list.append( mapIdToStr[ Qtopia::Profession ] );
22 list.append( "Assistant" ); 23 list.append( mapIdToStr[ Qtopia::Assistant ] );
23 list.append( "Manager" ); 24 list.append( mapIdToStr[ Qtopia::Manager ] );
24 25
25 list.append( "Spouse" ); 26 list.append( mapIdToStr[ Qtopia::Spouse ] );
26 list.append( "Gender" ); 27 list.append( mapIdToStr[ Qtopia::Gender ] );
27 list.append( "Birthday" ); 28 list.append( mapIdToStr[ Qtopia::Birthday ] );
28 list.append( "Anniversary" ); 29 list.append( mapIdToStr[ Qtopia::Anniversary ] );
29 list.append( "Nickname" ); 30 list.append( mapIdToStr[ Qtopia::Nickname ] );
30 list.append( "Children" ); 31 list.append( mapIdToStr[ Qtopia::Children ] );
31 32
32 if (sorted) list.sort(); 33 if (sorted) list.sort();
33 return list; 34 return list;
34} 35}
35 36
36/*! 37/*!
37 \internal 38 \internal
38 Returns a translated list of details field names for a contact. 39 Returns a translated list of details field names for a contact.
39*/ 40*/
40QStringList OContactFields::trdetailsfields( bool sorted ) 41QStringList OContactFields::trdetailsfields( bool sorted )
41{ 42{
42 QStringList list; 43 QStringList list;
44 QMap<int, QString> mapIdToStr = idToTrFields();
43 45
44 list.append( QObject::tr( "Office" ) ); 46 list.append( mapIdToStr[Qtopia::Office] );
45 list.append( QObject::tr( "Profession" ) ); 47 list.append( mapIdToStr[Qtopia::Profession] );
46 list.append( QObject::tr( "Assistant" ) ); 48 list.append( mapIdToStr[Qtopia::Assistant] );
47 list.append( QObject::tr( "Manager" ) ); 49 list.append( mapIdToStr[Qtopia::Manager] );
48 50
49 list.append( QObject::tr( "Spouse" ) ); 51 list.append( mapIdToStr[Qtopia::Spouse] );
50 list.append( QObject::tr( "Gender" ) ); 52 list.append( mapIdToStr[Qtopia::Gender] );
51 list.append( QObject::tr( "Birthday" ) ); 53 list.append( mapIdToStr[Qtopia::Birthday] );
52 list.append( QObject::tr( "Anniversary" ) ); 54 list.append( mapIdToStr[Qtopia::Anniversary] );
53 list.append( QObject::tr( "Nickname" ) ); 55 list.append( mapIdToStr[Qtopia::Nickname] );
54 list.append( QObject::tr( "Children" ) ); 56 list.append( mapIdToStr[Qtopia::Children] );
55 57
56 if (sorted) list.sort(); 58 if (sorted) list.sort();
57 return list; 59 return list;
58} 60}
59 61
60 62
61/*! 63/*!
62 \internal 64 \internal
63 Returns a translated list of phone field names for a contact. 65 Returns a translated list of phone field names for a contact.
64*/ 66*/
65QStringList OContactFields::trphonefields( bool sorted ) 67QStringList OContactFields::trphonefields( bool sorted )
66{ 68{
67 QStringList list; 69 QStringList list;
68 list.append( QObject::tr( "Business Phone" ) ); 70 QMap<int, QString> mapIdToStr = idToTrFields();
69 list.append( QObject::tr( "Business Fax" ) );
70 list.append( QObject::tr( "Business Mobile" ) );
71 71
72 list.append( QObject::tr( "Default Email" ) ); 72 list.append( mapIdToStr[Qtopia::BusinessPhone] );
73 list.append( QObject::tr( "Emails" ) ); 73 list.append( mapIdToStr[Qtopia::BusinessFax] );
74 list.append( mapIdToStr[Qtopia::BusinessMobile] );
74 75
75 list.append( QObject::tr( "Home Phone" ) ); 76 list.append( mapIdToStr[Qtopia::DefaultEmail] );
76 list.append( QObject::tr( "Home Fax" ) ); 77 list.append( mapIdToStr[Qtopia::Emails] );
77 list.append( QObject::tr( "Home Mobile" ) ); 78
79 list.append( mapIdToStr[Qtopia::HomePhone] );
80 list.append( mapIdToStr[Qtopia::HomeFax] );
81 list.append( mapIdToStr[Qtopia::HomeMobile] );
78 82
79 if (sorted) list.sort(); 83 if (sorted) list.sort();
80 84
81 return list; 85 return list;
82} 86}
83 87
84 88
85/*! 89/*!
86 \internal 90 \internal
87 Returns a list of phone field names for a contact. 91 Returns a list of phone field names for a contact.
88*/ 92*/
89QStringList OContactFields::untrphonefields( bool sorted ) 93QStringList OContactFields::untrphonefields( bool sorted )
90{ 94{
91 QStringList list; 95 QStringList list;
96 QMap<int, QString> mapIdToStr = idToUntrFields();
92 97
93 list.append( "Business Phone" ); 98 list.append( mapIdToStr[ Qtopia::BusinessPhone ] );
94 list.append( "Business Fax" ); 99 list.append( mapIdToStr[ Qtopia::BusinessFax ] );
95 list.append( "Business Mobile" ); 100 list.append( mapIdToStr[ Qtopia::BusinessMobile ] );
96 101
97 list.append( "Default Email" ); 102 list.append( mapIdToStr[ Qtopia::DefaultEmail ] );
98 list.append( "Emails" ); 103 list.append( mapIdToStr[ Qtopia::Emails ] );
99 104
100 list.append( "Home Phone" ); 105 list.append( mapIdToStr[ Qtopia::HomePhone ] );
101 list.append( "Home Fax" ); 106 list.append( mapIdToStr[ Qtopia::HomeFax ] );
102 list.append( "Home Mobile" ); 107 list.append( mapIdToStr[ Qtopia::HomeMobile ] );
103 108
104 if (sorted) list.sort(); 109 if (sorted) list.sort();
105 110
106 return list; 111 return list;
107} 112}
108 113
109 114
110/*! 115/*!
111 \internal 116 \internal
112 Returns a translated list of field names for a contact. 117 Returns a translated list of field names for a contact.
113*/ 118*/
114QStringList OContactFields::trfields( bool sorted ) 119QStringList OContactFields::trfields( bool sorted )
115{ 120{
116 QStringList list; 121 QStringList list;
122 QMap<int, QString> mapIdToStr = idToTrFields();
117 123
118 list.append( QObject::tr( "Name Title") ); 124 list.append( mapIdToStr[Qtopia::Title]);
119 list.append( QObject::tr( "First Name" ) ); 125 list.append( mapIdToStr[Qtopia::FirstName] );
120 list.append( QObject::tr( "Middle Name" ) ); 126 list.append( mapIdToStr[Qtopia::MiddleName] );
121 list.append( QObject::tr( "Last Name" ) ); 127 list.append( mapIdToStr[Qtopia::LastName] );
122 list.append( QObject::tr( "Suffix" ) ); 128 list.append( mapIdToStr[Qtopia::Suffix] );
123 list.append( QObject::tr( "File As" ) ); 129 list.append( mapIdToStr[Qtopia::FileAs] );
124 130
125 list.append( QObject::tr( "Job Title" ) ); 131 list.append( mapIdToStr[Qtopia::JobTitle] );
126 list.append( QObject::tr( "Department" ) ); 132 list.append( mapIdToStr[Qtopia::Department] );
127 list.append( QObject::tr( "Company" ) ); 133 list.append( mapIdToStr[Qtopia::Company] );
128 134
129 list += trphonefields( sorted ); 135 list += trphonefields( sorted );
130 136
131 list.append( QObject::tr( "Business Street" ) ); 137 list.append( mapIdToStr[Qtopia::BusinessStreet] );
132 list.append( QObject::tr( "Business City" ) ); 138 list.append( mapIdToStr[Qtopia::BusinessCity] );
133 list.append( QObject::tr( "Business State" ) ); 139 list.append( mapIdToStr[Qtopia::BusinessState] );
134 list.append( QObject::tr( "Business Zip" ) ); 140 list.append( mapIdToStr[Qtopia::BusinessZip] );
135 list.append( QObject::tr( "Business Country" ) ); 141 list.append( mapIdToStr[Qtopia::BusinessCountry] );
136 list.append( QObject::tr( "Business Pager" ) ); 142 list.append( mapIdToStr[Qtopia::BusinessPager] );
137 list.append( QObject::tr( "Business WebPage" ) ); 143 list.append( mapIdToStr[Qtopia::BusinessWebPage] );
138 144
139 list.append( QObject::tr( "Home Street" ) ); 145 list.append( mapIdToStr[Qtopia::HomeStreet] );
140 list.append( QObject::tr( "Home City" ) ); 146 list.append( mapIdToStr[Qtopia::HomeCity] );
141 list.append( QObject::tr( "Home State" ) ); 147 list.append( mapIdToStr[Qtopia::HomeState] );
142 list.append( QObject::tr( "Home Zip" ) ); 148 list.append( mapIdToStr[Qtopia::HomeZip] );
143 list.append( QObject::tr( "Home Country" ) ); 149 list.append( mapIdToStr[Qtopia::HomeCountry] );
144 list.append( QObject::tr( "Home Web Page" ) ); 150 list.append( mapIdToStr[Qtopia::HomeWebPage] );
145 151
146 list += trdetailsfields( sorted ); 152 list += trdetailsfields( sorted );
147 153
148 list.append( QObject::tr( "Notes" ) ); 154 list.append( mapIdToStr[Qtopia::Notes] );
149 list.append( QObject::tr( "Groups" ) ); 155 list.append( mapIdToStr[Qtopia::Groups] );
150 156
151 if (sorted) list.sort(); 157 if (sorted) list.sort();
152 158
153 return list; 159 return list;
154} 160}
155 161
156/*! 162/*!
157 \internal 163 \internal
158 Returns an untranslated list of field names for a contact. 164 Returns an untranslated list of field names for a contact.
159*/ 165*/
160QStringList OContactFields::untrfields( bool sorted ) 166QStringList OContactFields::untrfields( bool sorted )
161{ 167{
162 QStringList list; 168 QStringList list;
169 QMap<int, QString> mapIdToStr = idToUntrFields();
163 170
164 list.append( "Name Title" ); 171 list.append( mapIdToStr[ Qtopia::Title ] );
165 list.append( "First Name" ); 172 list.append( mapIdToStr[ Qtopia::FirstName ] );
166 list.append( "Middle Name" ); 173 list.append( mapIdToStr[ Qtopia::MiddleName ] );
167 list.append( "Last Name" ); 174 list.append( mapIdToStr[ Qtopia::LastName ] );
168 list.append( "Suffix" ); 175 list.append( mapIdToStr[ Qtopia::Suffix ] );
169 list.append( "File As" ); 176 list.append( mapIdToStr[ Qtopia::FileAs ] );
170 177
171 list.append( "Job Title" ); 178 list.append( mapIdToStr[ Qtopia::JobTitle ] );
172 list.append( "Department" ); 179 list.append( mapIdToStr[ Qtopia::Department ] );
173 list.append( "Company" ); 180 list.append( mapIdToStr[ Qtopia::Company ] );
174 181
175 list += untrphonefields( sorted ); 182 list += untrphonefields( sorted );
176 183
177 list.append( "Business Street" ); 184 list.append( mapIdToStr[ Qtopia::BusinessStreet ] );
178 list.append( "Business City" ); 185 list.append( mapIdToStr[ Qtopia::BusinessCity ] );
179 list.append( "Business State" ); 186 list.append( mapIdToStr[ Qtopia::BusinessState ] );
180 list.append( "Business Zip" ); 187 list.append( mapIdToStr[ Qtopia::BusinessZip ] );
181 list.append( "Business Country" ); 188 list.append( mapIdToStr[ Qtopia::BusinessCountry ] );
182 list.append( "Business Pager" ); 189 list.append( mapIdToStr[ Qtopia::BusinessPager ] );
183 list.append( "Business WebPage" ); 190 list.append( mapIdToStr[ Qtopia::BusinessWebPage ] );
184 191
185 list.append( "Home Street" ); 192 list.append( mapIdToStr[ Qtopia::HomeStreet ] );
186 list.append( "Home City" ); 193 list.append( mapIdToStr[ Qtopia::HomeCity ] );
187 list.append( "Home State" ); 194 list.append( mapIdToStr[ Qtopia::HomeState ] );
188 list.append( "Home Zip" ); 195 list.append( mapIdToStr[ Qtopia::HomeZip ] );
189 list.append( "Home Country" ); 196 list.append( mapIdToStr[ Qtopia::HomeCountry ] );
190 list.append( "Home Web Page" ); 197 list.append( mapIdToStr[ Qtopia::HomeWebPage] );
191 198
192 list += untrdetailsfields( sorted ); 199 list += untrdetailsfields( sorted );
193 200
194 list.append( "Notes" ); 201 list.append( mapIdToStr[ Qtopia::Notes ] );
195 list.append( "Groups" ); 202 list.append( mapIdToStr[ Qtopia::Groups ] );
196 203
197 if (sorted) list.sort(); 204 if (sorted) list.sort();
198 205
199 return list; 206 return list;
200} 207}
201QMap<int, QString> OContactFields::idToTrFields() 208QMap<int, QString> OContactFields::idToTrFields()
202{ 209{
203 QMap<int, QString> ret_map; 210 QMap<int, QString> ret_map;
204 211
205 ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); 212 ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") );
206 ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); 213 ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) );
207 ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); 214 ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) );
208 ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); 215 ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) );
209 ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); 216 ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" ));
210 ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); 217 ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) );
211 218
212 ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); 219 ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) );
213 ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); 220 ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) );
214 ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); 221 ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) );
215 ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); 222 ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) );
216 ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); 223 ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) );
217 ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); 224 ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" ));
218 225
219 // email 226 // email
@@ -240,62 +247,140 @@ QMap<int, QString> OContactFields::idToTrFields()
240 247
241 // home 248 // home
242 ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); 249 ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) );
243 ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); 250 ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) );
244 ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); 251 ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) );
245 ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); 252 ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) );
246 ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); 253 ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) );
247 ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); 254 ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) );
248 255
249 //personal 256 //personal
250 ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); 257 ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) );
251 ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); 258 ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) );
252 ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); 259 ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) );
253 ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); 260 ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) );
254 ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); 261 ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) );
255 ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); 262 ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) );
256 263
257 // other 264 // other
258 ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); 265 ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) );
259 266
260 267
261 return ret_map; 268 return ret_map;
262} 269}
263 270
271QMap<int, QString> OContactFields::idToUntrFields()
272{
273 QMap<int, QString> ret_map;
274
275 ret_map.insert( Qtopia::Title, "Name Title" );
276 ret_map.insert( Qtopia::FirstName, "First Name" );
277 ret_map.insert( Qtopia::MiddleName, "Middle Name" );
278 ret_map.insert( Qtopia::LastName, "Last Name" );
279 ret_map.insert( Qtopia::Suffix, "Suffix" );
280 ret_map.insert( Qtopia::FileAs, "File As" );
281
282 ret_map.insert( Qtopia::JobTitle, "Job Title" );
283 ret_map.insert( Qtopia::Department, "Department" );
284 ret_map.insert( Qtopia::Company, "Company" );
285 ret_map.insert( Qtopia::BusinessPhone, "Business Phone" );
286 ret_map.insert( Qtopia::BusinessFax, "Business Fax" );
287 ret_map.insert( Qtopia::BusinessMobile, "Business Mobile" );
288
289 // email
290 ret_map.insert( Qtopia::DefaultEmail, "Default Email" );
291 ret_map.insert( Qtopia::Emails, "Emails" );
292
293 ret_map.insert( Qtopia::HomePhone, "Home Phone" );
294 ret_map.insert( Qtopia::HomeFax, "Home Fax" );
295 ret_map.insert( Qtopia::HomeMobile, "Home Mobile" );
296
297 // business
298 ret_map.insert( Qtopia::BusinessStreet, "Business Street" );
299 ret_map.insert( Qtopia::BusinessCity, "Business City" );
300 ret_map.insert( Qtopia::BusinessState, "Business State" );
301 ret_map.insert( Qtopia::BusinessZip, "Business Zip" );
302 ret_map.insert( Qtopia::BusinessCountry, "Business Country" );
303 ret_map.insert( Qtopia::BusinessPager, "Business Pager" );
304 ret_map.insert( Qtopia::BusinessWebPage, "Business WebPage" );
305
306 ret_map.insert( Qtopia::Office, "Office" );
307 ret_map.insert( Qtopia::Profession, "Profession" );
308 ret_map.insert( Qtopia::Assistant, "Assistant" );
309 ret_map.insert( Qtopia::Manager, "Manager" );
310
311 // home
312 ret_map.insert( Qtopia::HomeStreet, "Home Street" );
313 ret_map.insert( Qtopia::HomeCity, "Home City" );
314 ret_map.insert( Qtopia::HomeState, "Home State" );
315 ret_map.insert( Qtopia::HomeZip, "Home Zip" );
316 ret_map.insert( Qtopia::HomeCountry, "Home Country" );
317 ret_map.insert( Qtopia::HomeWebPage, "Home Web Page" );
318
319 //personal
320 ret_map.insert( Qtopia::Spouse, "Spouse" );
321 ret_map.insert( Qtopia::Gender, "Gender" );
322 ret_map.insert( Qtopia::Birthday, "Birthday" );
323 ret_map.insert( Qtopia::Anniversary, "Anniversary" );
324 ret_map.insert( Qtopia::Nickname, "Nickname" );
325 ret_map.insert( Qtopia::Children, "Children" );
326
327 // other
328 ret_map.insert( Qtopia::Notes, "Notes" );
329
330
331 return ret_map;
332}
333
264QMap<QString, int> OContactFields::trFieldsToId() 334QMap<QString, int> OContactFields::trFieldsToId()
265{ 335{
266 QMap<int, QString> idtostr = idToTrFields(); 336 QMap<int, QString> idtostr = idToTrFields();
267 QMap<QString, int> ret_map; 337 QMap<QString, int> ret_map;
268 338
269 339
270 QMap<int, QString>::Iterator it; 340 QMap<int, QString>::Iterator it;
271 for( it = idtostr.begin(); it != idtostr.end(); ++it ) 341 for( it = idtostr.begin(); it != idtostr.end(); ++it )
272 ret_map.insert( *it, it.key() ); 342 ret_map.insert( *it, it.key() );
273 343
274 344
275 return ret_map; 345 return ret_map;
276} 346}
277 347
348QMap<QString, int> OContactFields::untrFieldsToId()
349{
350 QMap<int, QString> idtostr = idToUntrFields();
351 QMap<QString, int> ret_map;
352
353
354 QMap<int, QString>::Iterator it;
355 for( it = idtostr.begin(); it != idtostr.end(); ++it )
356 ret_map.insert( *it, it.key() );
357
358
359 return ret_map;
360}
361
362
278OContactFields::OContactFields(): 363OContactFields::OContactFields():
279 fieldOrder( DEFAULT_FIELD_ORDER ), 364 fieldOrder( DEFAULT_FIELD_ORDER ),
280 changedFieldOrder( false ) 365 changedFieldOrder( false )
281{ 366{
282 // Get the global field order from the config file and 367 // Get the global field order from the config file and
283 // use it as a start pattern 368 // use it as a start pattern
284 Config cfg ( "AddressBook" ); 369 Config cfg ( "AddressBook" );
285 cfg.setGroup( "ContactFieldOrder" ); 370 cfg.setGroup( "ContactFieldOrder" );
286 globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER ); 371 globalFieldOrder = cfg.readEntry( "General", DEFAULT_FIELD_ORDER );
287} 372}
288 373
289OContactFields::~OContactFields(){ 374OContactFields::~OContactFields(){
290 375
291 // We will store the fieldorder into the config file 376 // We will store the fieldorder into the config file
292 // to reuse it for the future.. 377 // to reuse it for the future..
293 if ( changedFieldOrder ){ 378 if ( changedFieldOrder ){
294 Config cfg ( "AddressBook" ); 379 Config cfg ( "AddressBook" );
295 cfg.setGroup( "ContactFieldOrder" ); 380 cfg.setGroup( "ContactFieldOrder" );
296 cfg.writeEntry( "General", globalFieldOrder ); 381 cfg.writeEntry( "General", globalFieldOrder );
297 } 382 }
298} 383}
299 384
300 385
301 386
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
@@ -31,28 +31,30 @@ class OContactFields{
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