author | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
---|---|---|
committer | eilers <eilers> | 2002-11-18 09:38:28 (UTC) |
commit | 8401def65aa4f19d91873bc57a3dcf25c358c490 (patch) (unidiff) | |
tree | 3e64bd2d1b6f92c77304cc2d2c0fd06b07d718e5 /core/pim/addressbook/ocontactfields.cpp | |
parent | 4d0773414a0fb59e53f30d4d2363f73304f474dc (diff) | |
download | opie-8401def65aa4f19d91873bc57a3dcf25c358c490.zip opie-8401def65aa4f19d91873bc57a3dcf25c358c490.tar.gz opie-8401def65aa4f19d91873bc57a3dcf25c358c490.tar.bz2 |
Back to main tree. Back to main tree.
Back to main tree. Waiting for moving to feature freeze ..
Diffstat (limited to 'core/pim/addressbook/ocontactfields.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/ocontactfields.cpp | 283 |
1 files changed, 283 insertions, 0 deletions
diff --git a/core/pim/addressbook/ocontactfields.cpp b/core/pim/addressbook/ocontactfields.cpp new file mode 100644 index 0000000..7823a9c --- a/dev/null +++ b/core/pim/addressbook/ocontactfields.cpp | |||
@@ -0,0 +1,283 @@ | |||
1 | |||
2 | #include "ocontactfields.h" | ||
3 | |||
4 | #include <qstringlist.h> | ||
5 | #include <qobject.h> | ||
6 | |||
7 | // We should use our own enum in the future .. | ||
8 | #include <qpe/recordfields.h> | ||
9 | |||
10 | /*! | ||
11 | \internal | ||
12 | Returns a list of details field names for a contact. | ||
13 | */ | ||
14 | QStringList OContactFields::untrdetailsfields( bool sorted ) | ||
15 | { | ||
16 | QStringList list; | ||
17 | |||
18 | list.append( "Office" ); | ||
19 | list.append( "Profession" ); | ||
20 | list.append( "Assistant" ); | ||
21 | list.append( "Manager" ); | ||
22 | list.append( "Spouse" ); | ||
23 | list.append( "Gender" ); | ||
24 | list.append( "Birthday" ); | ||
25 | list.append( "Anniversary" ); | ||
26 | list.append( "Nickname" ); | ||
27 | list.append( "Children" ); | ||
28 | |||
29 | if (sorted) list.sort(); | ||
30 | |||
31 | return list; | ||
32 | } | ||
33 | |||
34 | /*! | ||
35 | \internal | ||
36 | Returns a translated list of phone field names for a contact. | ||
37 | */ | ||
38 | QStringList OContactFields::trphonefields( bool sorted ) | ||
39 | { | ||
40 | QStringList list; | ||
41 | list.append( QObject::tr( "Business Phone" ) ); | ||
42 | list.append( QObject::tr( "Business Fax" ) ); | ||
43 | list.append( QObject::tr( "Business Mobile" ) ); | ||
44 | |||
45 | list.append( QObject::tr( "Default Email" ) ); | ||
46 | list.append( QObject::tr( "Emails" ) ); | ||
47 | |||
48 | list.append( QObject::tr( "Home Phone" ) ); | ||
49 | list.append( QObject::tr( "Home Fax" ) ); | ||
50 | list.append( QObject::tr( "Home Mobile" ) ); | ||
51 | |||
52 | if (sorted) list.sort(); | ||
53 | |||
54 | return list; | ||
55 | } | ||
56 | |||
57 | |||
58 | /*! | ||
59 | \internal | ||
60 | Returns a translated list of details field names for a contact. | ||
61 | */ | ||
62 | QStringList OContactFields::trdetailsfields( bool sorted ) | ||
63 | { | ||
64 | QStringList list; | ||
65 | |||
66 | list.append( QObject::tr( "Office" ) ); | ||
67 | list.append( QObject::tr( "Profession" ) ); | ||
68 | list.append( QObject::tr( "Assistant" ) ); | ||
69 | list.append( QObject::tr( "Manager" ) ); | ||
70 | |||
71 | list.append( QObject::tr( "Spouse" ) ); | ||
72 | list.append( QObject::tr( "Gender" ) ); | ||
73 | list.append( QObject::tr( "Birthday" ) ); | ||
74 | list.append( QObject::tr( "Anniversary" ) ); | ||
75 | list.append( QObject::tr( "Nickname" ) ); | ||
76 | list.append( QObject::tr( "Children" ) ); | ||
77 | |||
78 | if (sorted) list.sort(); | ||
79 | return list; | ||
80 | } | ||
81 | |||
82 | |||
83 | /*! | ||
84 | \internal | ||
85 | Returns a translated list of field names for a contact. | ||
86 | */ | ||
87 | QStringList OContactFields::trfields( bool sorted ) | ||
88 | { | ||
89 | QStringList list; | ||
90 | |||
91 | list.append( QObject::tr( "Name Title") ); | ||
92 | list.append( QObject::tr( "First Name" ) ); | ||
93 | list.append( QObject::tr( "Middle Name" ) ); | ||
94 | list.append( QObject::tr( "Last Name" ) ); | ||
95 | list.append( QObject::tr( "Suffix" ) ); | ||
96 | list.append( QObject::tr( "File As" ) ); | ||
97 | |||
98 | list.append( QObject::tr( "Job Title" ) ); | ||
99 | list.append( QObject::tr( "Department" ) ); | ||
100 | list.append( QObject::tr( "Company" ) ); | ||
101 | |||
102 | list += trphonefields( sorted ); | ||
103 | |||
104 | list.append( QObject::tr( "Business Street" ) ); | ||
105 | list.append( QObject::tr( "Business City" ) ); | ||
106 | list.append( QObject::tr( "Business State" ) ); | ||
107 | list.append( QObject::tr( "Business Zip" ) ); | ||
108 | list.append( QObject::tr( "Business Country" ) ); | ||
109 | list.append( QObject::tr( "Business Pager" ) ); | ||
110 | list.append( QObject::tr( "Business WebPage" ) ); | ||
111 | |||
112 | list.append( QObject::tr( "Home Street" ) ); | ||
113 | list.append( QObject::tr( "Home City" ) ); | ||
114 | list.append( QObject::tr( "Home State" ) ); | ||
115 | list.append( QObject::tr( "Home Zip" ) ); | ||
116 | list.append( QObject::tr( "Home Country" ) ); | ||
117 | list.append( QObject::tr( "Home Web Page" ) ); | ||
118 | |||
119 | list += trdetailsfields( sorted ); | ||
120 | |||
121 | list.append( QObject::tr( "Notes" ) ); | ||
122 | list.append( QObject::tr( "Groups" ) ); | ||
123 | |||
124 | if (sorted) list.sort(); | ||
125 | |||
126 | return list; | ||
127 | } | ||
128 | |||
129 | /*! | ||
130 | \internal | ||
131 | Returns a list of phone field names for a contact. | ||
132 | */ | ||
133 | QStringList OContactFields::untrphonefields( bool sorted ) | ||
134 | { | ||
135 | QStringList list; | ||
136 | |||
137 | list.append( "Business Phone" ); | ||
138 | list.append( "Business Fax" ); | ||
139 | list.append( "Business Mobile" ); | ||
140 | |||
141 | list.append( "Default Email" ); | ||
142 | list.append( "Emails" ); | ||
143 | |||
144 | list.append( "Home Phone" ); | ||
145 | list.append( "Home Fax" ); | ||
146 | list.append( "Home Mobile" ); | ||
147 | |||
148 | if (sorted) list.sort(); | ||
149 | |||
150 | return list; | ||
151 | } | ||
152 | |||
153 | /*! | ||
154 | \internal | ||
155 | Returns an untranslated list of field names for a contact. | ||
156 | */ | ||
157 | QStringList OContactFields::untrfields( bool sorted ) | ||
158 | { | ||
159 | QStringList list; | ||
160 | |||
161 | list.append( "Name Title" ); | ||
162 | list.append( "First Name" ); | ||
163 | list.append( "Middle Name" ); | ||
164 | list.append( "Last Name" ); | ||
165 | list.append( "Suffix" ); | ||
166 | list.append( "File As" ); | ||
167 | |||
168 | list.append( "Job Title" ); | ||
169 | list.append( "Department" ); | ||
170 | list.append( "Company" ); | ||
171 | |||
172 | list += untrphonefields( sorted ); | ||
173 | |||
174 | list.append( "Business Street" ); | ||
175 | list.append( "Business City" ); | ||
176 | list.append( "Business State" ); | ||
177 | list.append( "Business Zip" ); | ||
178 | list.append( "Business Country" ); | ||
179 | list.append( "Business Pager" ); | ||
180 | list.append( "Business WebPage" ); | ||
181 | |||
182 | list.append( "Office" ); | ||
183 | list.append( "Profession" ); | ||
184 | list.append( "Assistant" ); | ||
185 | list.append( "Manager" ); | ||
186 | |||
187 | list.append( "Home Street" ); | ||
188 | list.append( "Home City" ); | ||
189 | list.append( "Home State" ); | ||
190 | list.append( "Home Zip" ); | ||
191 | list.append( "Home Country" ); | ||
192 | list.append( "Home Web Page" ); | ||
193 | |||
194 | list.append( "Spouse" ); | ||
195 | list.append( "Gender" ); | ||
196 | list.append( "Birthday" ); | ||
197 | list.append( "Anniversary" ); | ||
198 | list.append( "Nickname" ); | ||
199 | list.append( "Children" ); | ||
200 | |||
201 | list.append( "Notes" ); | ||
202 | list.append( "Groups" ); | ||
203 | |||
204 | if (sorted) list.sort(); | ||
205 | |||
206 | return list; | ||
207 | } | ||
208 | QMap<int, QString> OContactFields::idToTrFields() | ||
209 | { | ||
210 | QMap<int, QString> ret_map; | ||
211 | |||
212 | ret_map.insert( Qtopia::Title, QObject::tr( "Name Title") ); | ||
213 | ret_map.insert( Qtopia::FirstName, QObject::tr( "First Name" ) ); | ||
214 | ret_map.insert( Qtopia::MiddleName, QObject::tr( "Middle Name" ) ); | ||
215 | ret_map.insert( Qtopia::LastName, QObject::tr( "Last Name" ) ); | ||
216 | ret_map.insert( Qtopia::Suffix, QObject::tr( "Suffix" )); | ||
217 | ret_map.insert( Qtopia::FileAs, QObject::tr( "File As" ) ); | ||
218 | |||
219 | ret_map.insert( Qtopia::JobTitle, QObject::tr( "Job Title" ) ); | ||
220 | ret_map.insert( Qtopia::Department, QObject::tr( "Department" ) ); | ||
221 | ret_map.insert( Qtopia::Company, QObject::tr( "Company" ) ); | ||
222 | ret_map.insert( Qtopia::BusinessPhone, QObject::tr( "Business Phone" ) ); | ||
223 | ret_map.insert( Qtopia::BusinessFax, QObject::tr( "Business Fax" ) ); | ||
224 | ret_map.insert( Qtopia::BusinessMobile, QObject::tr( "Business Mobile" )); | ||
225 | |||
226 | |||
227 | ret_map.insert( Qtopia::DefaultEmail, QObject::tr( "Default Email" ) ); | ||
228 | ret_map.insert( Qtopia::Emails, QObject::tr( "Emails" ) ); | ||
229 | |||
230 | ret_map.insert( Qtopia::HomePhone, QObject::tr( "Home Phone" ) ); | ||
231 | ret_map.insert( Qtopia::HomeFax, QObject::tr( "Home Fax" ) ); | ||
232 | ret_map.insert( Qtopia::HomeMobile, QObject::tr( "Home Mobile" ) ); | ||
233 | |||
234 | // business | ||
235 | ret_map.insert( Qtopia::BusinessStreet, QObject::tr( "Business Street" ) ); | ||
236 | ret_map.insert( Qtopia::BusinessCity, QObject::tr( "Business City" ) ); | ||
237 | ret_map.insert( Qtopia::BusinessState, QObject::tr( "Business State" ) ); | ||
238 | ret_map.insert( Qtopia::BusinessZip, QObject::tr( "Business Zip" ) ); | ||
239 | ret_map.insert( Qtopia::BusinessCountry, QObject::tr( "Business Country" ) ); | ||
240 | ret_map.insert( Qtopia::BusinessPager, QObject::tr( "Business Pager" ) ); | ||
241 | ret_map.insert( Qtopia::BusinessWebPage, QObject::tr( "Business WebPage" ) ); | ||
242 | |||
243 | ret_map.insert( Qtopia::Office, QObject::tr( "Office" ) ); | ||
244 | ret_map.insert( Qtopia::Profession, QObject::tr( "Profession" ) ); | ||
245 | ret_map.insert( Qtopia::Assistant, QObject::tr( "Assistant" ) ); | ||
246 | ret_map.insert( Qtopia::Manager, QObject::tr( "Manager" ) ); | ||
247 | |||
248 | // home | ||
249 | ret_map.insert( Qtopia::HomeStreet, QObject::tr( "Home Street" ) ); | ||
250 | ret_map.insert( Qtopia::HomeCity, QObject::tr( "Home City" ) ); | ||
251 | ret_map.insert( Qtopia::HomeState, QObject::tr( "Home State" ) ); | ||
252 | ret_map.insert( Qtopia::HomeZip, QObject::tr( "Home Zip" ) ); | ||
253 | ret_map.insert( Qtopia::HomeCountry, QObject::tr( "Home Country" ) ); | ||
254 | ret_map.insert( Qtopia::HomeWebPage, QObject::tr( "Home Web Page" ) ); | ||
255 | |||
256 | //personal | ||
257 | ret_map.insert( Qtopia::Spouse, QObject::tr( "Spouse" ) ); | ||
258 | ret_map.insert( Qtopia::Gender, QObject::tr( "Gender" ) ); | ||
259 | ret_map.insert( Qtopia::Birthday, QObject::tr( "Birthday" ) ); | ||
260 | ret_map.insert( Qtopia::Anniversary, QObject::tr( "Anniversary" ) ); | ||
261 | ret_map.insert( Qtopia::Nickname, QObject::tr( "Nickname" ) ); | ||
262 | ret_map.insert( Qtopia::Children, QObject::tr( "Children" ) ); | ||
263 | |||
264 | // other | ||
265 | ret_map.insert( Qtopia::Notes, QObject::tr( "Notes" ) ); | ||
266 | |||
267 | |||
268 | return ret_map; | ||
269 | } | ||
270 | |||
271 | QMap<QString, int> OContactFields::trFieldsToId() | ||
272 | { | ||
273 | QMap<int, QString> idtostr = idToTrFields(); | ||
274 | QMap<QString, int> ret_map; | ||
275 | |||
276 | |||
277 | QMap<int, QString>::Iterator it; | ||
278 | for( it = idtostr.begin(); it != idtostr.end(); ++it ) | ||
279 | ret_map.insert( *it, it.key() ); | ||
280 | |||
281 | |||
282 | return ret_map; | ||
283 | } | ||