summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/ocontactfields.cpp
blob: 7823a9c4b2cdb8f22372a1a3b8c50ecde5ee5fab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283

#include "ocontactfields.h"

#include <qstringlist.h>
#include <qobject.h>

// We should use our own enum in the future ..
#include <qpe/recordfields.h>

/*!
  \internal
  Returns a  list of details field names for a contact.
*/
QStringList OContactFields::untrdetailsfields( bool sorted )
{
    QStringList list;

    list.append( "Office" );
    list.append( "Profession" );
    list.append( "Assistant" );
    list.append( "Manager" );
    list.append( "Spouse" );
    list.append( "Gender" );
    list.append( "Birthday" );
    list.append( "Anniversary" );
    list.append( "Nickname" );
    list.append( "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" ) );

    list.append( QObject::tr( "Default Email" ) );
    list.append( QObject::tr( "Emails" ) );

    list.append( QObject::tr( "Home Phone" ) );
    list.append( QObject::tr( "Home Fax" ) );
    list.append( QObject::tr( "Home Mobile" ) );

    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;

    list.append( QObject::tr( "Office" ) );
    list.append( QObject::tr( "Profession" ) );
    list.append( QObject::tr( "Assistant" ) );
    list.append( QObject::tr( "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" ) );

    if (sorted) list.sort();
    return list;
}


/*!
  \internal
  Returns a translated list of field names for a contact.
*/
QStringList OContactFields::trfields( bool sorted )
{
    QStringList list;

    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( QObject::tr( "Job Title" ) );
    list.append( QObject::tr( "Department" ) );
    list.append( QObject::tr( "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 += trdetailsfields( sorted );

    list.append( QObject::tr( "Notes" ) );
    list.append( QObject::tr( "Groups" ) );

    if (sorted) list.sort();

    return list;
}

/*!
  \internal
  Returns a list of phone field names for a contact.
*/
QStringList OContactFields::untrphonefields( bool sorted )
{
    QStringList list;

    list.append( "Business Phone" );
    list.append( "Business Fax" );
    list.append( "Business Mobile" );

    list.append( "Default Email" );
    list.append( "Emails" );

    list.append( "Home Phone" );
    list.append( "Home Fax" );
    list.append( "Home Mobile" );

    if (sorted) list.sort();

    return list;
}

/*!
  \internal
  Returns an untranslated list of field names for a contact.
*/
QStringList OContactFields::untrfields( bool sorted )
{
    QStringList list;

    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( "Job Title" );
    list.append( "Department" );
    list.append( "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( "Office" );
    list.append( "Profession" );
    list.append( "Assistant" );
    list.append( "Manager" );

    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( "Spouse" );
    list.append( "Gender" );
    list.append( "Birthday" );
    list.append( "Anniversary" );
    list.append( "Nickname" );
    list.append( "Children" );

    list.append( "Notes" );
    list.append( "Groups" );

    if (sorted) list.sort();

    return list;
}
QMap<int, QString> OContactFields::idToTrFields()
{
	QMap<int, QString> ret_map;
	
	ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") );
	ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) );
	ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) );
	ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) );
	ret_map.insert( Qtopia::Suffix,  QObject::tr( "Suffix" ));
	ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) );

	ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) );
	ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) );
	ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) );
	ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) );
	ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) );
	ret_map.insert( Qtopia::BusinessMobile,  QObject::tr( "Business Mobile" ));

	// email
	ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) );
	ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) );

	ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) );
	ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) );
	ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) );

	// business
	ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) );
	ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) );
	ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) );
	ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) );
	ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) );
	ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) );
	ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) );

	ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) );
	ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) );
	ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) );
	ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) );

	// home
	ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) );
	ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) );
	ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) );
	ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) );
	ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) );
	ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) );

	//personal
	ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) );
	ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) );
	ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) );
	ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) );
	ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) );
	ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) );

	// other
	ret_map.insert( Qtopia::Notes, QObject::tr( "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;
}