author | eilers <eilers> | 2003-10-20 15:58:00 (UTC) |
---|---|---|
committer | eilers <eilers> | 2003-10-20 15:58:00 (UTC) |
commit | fccc5d110dea3bc32176694c8e5fc7f014706be6 (patch) (unidiff) | |
tree | 6dd44a78cadfd55fc8935dc661318e3ab12dd7b7 /libopie2/opiepim/ocontactfields.cpp | |
parent | 758775c190470e569a0616bbd87d1a378c19b747 (diff) | |
download | opie-fccc5d110dea3bc32176694c8e5fc7f014706be6.zip opie-fccc5d110dea3bc32176694c8e5fc7f014706be6.tar.gz opie-fccc5d110dea3bc32176694c8e5fc7f014706be6.tar.bz2 |
Pushing todo closer to sql support. Recurrances and custom entries still missing.
But before I add this, I have to do some cleanup..
Diffstat (limited to 'libopie2/opiepim/ocontactfields.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/ocontactfields.cpp | 209 |
1 files changed, 110 insertions, 99 deletions
diff --git a/libopie2/opiepim/ocontactfields.cpp b/libopie2/opiepim/ocontactfields.cpp index 7206f0d..0f08a5a 100644 --- a/libopie2/opiepim/ocontactfields.cpp +++ b/libopie2/opiepim/ocontactfields.cpp | |||
@@ -13,20 +13,29 @@ | |||
13 | \internal | 13 | \internal |
14 | Returns a list of details field names for a contact. | 14 | Returns a list of personal field names for a contact. |
15 | */ | 15 | */ |
16 | QStringList OContactFields::untrdetailsfields( bool sorted ) | 16 | QStringList OContactFields::personalfields( bool sorted, bool translated ) |
17 | { | 17 | { |
18 | QStringList list; | 18 | QStringList list; |
19 | QMap<int, QString> mapIdToStr = idToUntrFields(); | 19 | QMap<int, QString> mapIdToStr; |
20 | if ( translated ) | ||
21 | mapIdToStr = idToTrFields(); | ||
22 | else | ||
23 | mapIdToStr = idToUntrFields(); | ||
20 | 24 | ||
21 | list.append( mapIdToStr[ Qtopia::Office ] ); | 25 | list.append( mapIdToStr[ Qtopia::AddressUid ] ); |
22 | list.append( mapIdToStr[ Qtopia::Profession ] ); | 26 | list.append( mapIdToStr[ Qtopia::AddressCategory ] ); |
23 | list.append( mapIdToStr[ Qtopia::Assistant ] ); | ||
24 | list.append( mapIdToStr[ Qtopia::Manager ] ); | ||
25 | 27 | ||
26 | list.append( mapIdToStr[ Qtopia::Spouse ] ); | 28 | list.append( mapIdToStr[ Qtopia::Title ] ); |
27 | list.append( mapIdToStr[ Qtopia::Gender ] ); | 29 | list.append( mapIdToStr[ Qtopia::FirstName ] ); |
28 | list.append( mapIdToStr[ Qtopia::Birthday ] ); | 30 | list.append( mapIdToStr[ Qtopia::MiddleName ] ); |
29 | list.append( mapIdToStr[ Qtopia::Anniversary ] ); | 31 | list.append( mapIdToStr[ Qtopia::LastName ] ); |
30 | list.append( mapIdToStr[ Qtopia::Nickname ] ); | 32 | list.append( mapIdToStr[ Qtopia::Suffix ] ); |
31 | list.append( mapIdToStr[ Qtopia::Children ] ); | 33 | list.append( mapIdToStr[ Qtopia::FileAs ] ); |
34 | |||
35 | list.append( mapIdToStr[ Qtopia::JobTitle ] ); | ||
36 | list.append( mapIdToStr[ Qtopia::Department ] ); | ||
37 | list.append( mapIdToStr[ Qtopia::Company ] ); | ||
38 | |||
39 | list.append( mapIdToStr[ Qtopia::Notes ] ); | ||
40 | list.append( mapIdToStr[ Qtopia::Groups ] ); | ||
32 | 41 | ||
@@ -38,8 +47,12 @@ QStringList OContactFields::untrdetailsfields( bool sorted ) | |||
38 | \internal | 47 | \internal |
39 | Returns a translated list of details field names for a contact. | 48 | Returns a list of details field names for a contact. |
40 | */ | 49 | */ |
41 | QStringList OContactFields::trdetailsfields( bool sorted ) | 50 | QStringList OContactFields::detailsfields( bool sorted, bool translated ) |
42 | { | 51 | { |
43 | QStringList list; | 52 | QStringList list; |
44 | QMap<int, QString> mapIdToStr = idToTrFields(); | 53 | QMap<int, QString> mapIdToStr; |
54 | if ( translated ) | ||
55 | mapIdToStr = idToTrFields(); | ||
56 | else | ||
57 | mapIdToStr = idToUntrFields(); | ||
45 | 58 | ||
@@ -61,33 +74,2 @@ QStringList OContactFields::trdetailsfields( bool sorted ) | |||
61 | 74 | ||
62 | |||
63 | /*! | ||
64 | \internal | ||
65 | Returns a translated list of phone field names for a contact. | ||
66 | */ | ||
67 | QStringList OContactFields::trphonefields( bool sorted ) | ||
68 | { | ||
69 | QStringList list; | ||
70 | QMap<int, QString> mapIdToStr = idToTrFields(); | ||
71 | |||
72 | list.append( mapIdToStr[Qtopia::BusinessPhone] ); | ||
73 | list.append( mapIdToStr[Qtopia::BusinessFax] ); | ||
74 | list.append( mapIdToStr[Qtopia::BusinessMobile] ); | ||
75 | list.append( mapIdToStr[Qtopia::BusinessPager] ); | ||
76 | list.append( mapIdToStr[Qtopia::BusinessWebPage] ); | ||
77 | |||
78 | list.append( mapIdToStr[Qtopia::DefaultEmail] ); | ||
79 | list.append( mapIdToStr[Qtopia::Emails] ); | ||
80 | |||
81 | list.append( mapIdToStr[Qtopia::HomePhone] ); | ||
82 | list.append( mapIdToStr[Qtopia::HomeFax] ); | ||
83 | list.append( mapIdToStr[Qtopia::HomeMobile] ); | ||
84 | // list.append( mapIdToStr[Qtopia::HomePager] ); | ||
85 | list.append( mapIdToStr[Qtopia::HomeWebPage] ); | ||
86 | |||
87 | if (sorted) list.sort(); | ||
88 | |||
89 | return list; | ||
90 | } | ||
91 | |||
92 | |||
93 | /*! | 75 | /*! |
@@ -96,6 +78,10 @@ QStringList OContactFields::trphonefields( bool sorted ) | |||
96 | */ | 78 | */ |
97 | QStringList OContactFields::untrphonefields( bool sorted ) | 79 | QStringList OContactFields::phonefields( bool sorted, bool translated ) |
98 | { | 80 | { |
99 | QStringList list; | 81 | QStringList list; |
100 | QMap<int, QString> mapIdToStr = idToUntrFields(); | 82 | QMap<int, QString> mapIdToStr; |
83 | if ( translated ) | ||
84 | mapIdToStr = idToTrFields(); | ||
85 | else | ||
86 | mapIdToStr = idToUntrFields(); | ||
101 | 87 | ||
@@ -121,24 +107,18 @@ QStringList OContactFields::untrphonefields( bool sorted ) | |||
121 | 107 | ||
122 | |||
123 | /*! | 108 | /*! |
124 | \internal | 109 | \internal |
125 | Returns a translated list of field names for a contact. | 110 | Returns a list of field names for a contact. |
126 | */ | 111 | */ |
127 | QStringList OContactFields::trfields( bool sorted ) | 112 | QStringList OContactFields::fields( bool sorted, bool translated ) |
128 | { | 113 | { |
129 | QStringList list; | 114 | QStringList list; |
130 | QMap<int, QString> mapIdToStr = idToTrFields(); | 115 | QMap<int, QString> mapIdToStr; |
131 | 116 | if ( translated ) | |
132 | list.append( mapIdToStr[Qtopia::Title]); | 117 | mapIdToStr = idToTrFields(); |
133 | list.append( mapIdToStr[Qtopia::FirstName] ); | 118 | else |
134 | list.append( mapIdToStr[Qtopia::MiddleName] ); | 119 | mapIdToStr = idToUntrFields(); |
135 | list.append( mapIdToStr[Qtopia::LastName] ); | ||
136 | list.append( mapIdToStr[Qtopia::Suffix] ); | ||
137 | list.append( mapIdToStr[Qtopia::FileAs] ); | ||
138 | 120 | ||
139 | list.append( mapIdToStr[Qtopia::JobTitle] ); | 121 | list += personalfields( sorted, translated ); |
140 | list.append( mapIdToStr[Qtopia::Department] ); | ||
141 | list.append( mapIdToStr[Qtopia::Company] ); | ||
142 | 122 | ||
143 | list += trphonefields( sorted ); | 123 | list += phonefields( sorted, translated ); |
144 | 124 | ||
@@ -156,6 +136,3 @@ QStringList OContactFields::trfields( bool sorted ) | |||
156 | 136 | ||
157 | list += trdetailsfields( sorted ); | 137 | list += detailsfields( sorted, translated ); |
158 | |||
159 | list.append( mapIdToStr[Qtopia::Notes] ); | ||
160 | list.append( mapIdToStr[Qtopia::Groups] ); | ||
161 | 138 | ||
@@ -166,48 +143,80 @@ QStringList OContactFields::trfields( bool sorted ) | |||
166 | 143 | ||
144 | |||
167 | /*! | 145 | /*! |
168 | \internal | 146 | \internal |
169 | Returns an untranslated list of field names for a contact. | 147 | Returns an untranslated list of personal field names for a contact. |
170 | */ | 148 | */ |
171 | QStringList OContactFields::untrfields( bool sorted ) | 149 | QStringList OContactFields::untrpersonalfields( bool sorted ) |
172 | { | 150 | { |
173 | QStringList list; | 151 | return personalfields( sorted, false ); |
174 | QMap<int, QString> mapIdToStr = idToUntrFields(); | 152 | } |
175 | 153 | ||
176 | list.append( mapIdToStr[ Qtopia::AddressUid ] ); | ||
177 | list.append( mapIdToStr[ Qtopia::AddressCategory ] ); | ||
178 | 154 | ||
179 | list.append( mapIdToStr[ Qtopia::Title ] ); | 155 | /*! |
180 | list.append( mapIdToStr[ Qtopia::FirstName ] ); | 156 | \internal |
181 | list.append( mapIdToStr[ Qtopia::MiddleName ] ); | 157 | Returns a translated list of personal field names for a contact. |
182 | list.append( mapIdToStr[ Qtopia::LastName ] ); | 158 | */ |
183 | list.append( mapIdToStr[ Qtopia::Suffix ] ); | 159 | QStringList OContactFields::trpersonalfields( bool sorted ) |
184 | list.append( mapIdToStr[ Qtopia::FileAs ] ); | 160 | { |
161 | return personalfields( sorted, true ); | ||
162 | } | ||
185 | 163 | ||
186 | list.append( mapIdToStr[ Qtopia::JobTitle ] ); | ||
187 | list.append( mapIdToStr[ Qtopia::Department ] ); | ||
188 | list.append( mapIdToStr[ Qtopia::Company ] ); | ||
189 | 164 | ||
190 | list += untrphonefields( sorted ); | 165 | /*! |
166 | \internal | ||
167 | Returns an untranslated list of details field names for a contact. | ||
168 | */ | ||
169 | QStringList OContactFields::untrdetailsfields( bool sorted ) | ||
170 | { | ||
171 | return detailsfields( sorted, false ); | ||
172 | } | ||
191 | 173 | ||
192 | list.append( mapIdToStr[ Qtopia::BusinessStreet ] ); | ||
193 | list.append( mapIdToStr[ Qtopia::BusinessCity ] ); | ||
194 | list.append( mapIdToStr[ Qtopia::BusinessState ] ); | ||
195 | list.append( mapIdToStr[ Qtopia::BusinessZip ] ); | ||
196 | list.append( mapIdToStr[ Qtopia::BusinessCountry ] ); | ||
197 | 174 | ||
198 | list.append( mapIdToStr[ Qtopia::HomeStreet ] ); | 175 | /*! |
199 | list.append( mapIdToStr[ Qtopia::HomeCity ] ); | 176 | \internal |
200 | list.append( mapIdToStr[ Qtopia::HomeState ] ); | 177 | Returns a translated list of details field names for a contact. |
201 | list.append( mapIdToStr[ Qtopia::HomeZip ] ); | 178 | */ |
202 | list.append( mapIdToStr[ Qtopia::HomeCountry ] ); | 179 | QStringList OContactFields::trdetailsfields( bool sorted ) |
180 | { | ||
181 | return detailsfields( sorted, true ); | ||
182 | } | ||
203 | 183 | ||
204 | list += untrdetailsfields( sorted ); | ||
205 | 184 | ||
206 | list.append( mapIdToStr[ Qtopia::Notes ] ); | 185 | /*! |
207 | list.append( mapIdToStr[ Qtopia::Groups ] ); | 186 | \internal |
187 | Returns a translated list of phone field names for a contact. | ||
188 | */ | ||
189 | QStringList OContactFields::trphonefields( bool sorted ) | ||
190 | { | ||
191 | return phonefields( sorted, true ); | ||
192 | } | ||
208 | 193 | ||
209 | if (sorted) list.sort(); | 194 | /*! |
195 | \internal | ||
196 | Returns an untranslated list of phone field names for a contact. | ||
197 | */ | ||
198 | QStringList OContactFields::untrphonefields( bool sorted ) | ||
199 | { | ||
200 | return phonefields( sorted, false ); | ||
201 | } | ||
210 | 202 | ||
211 | return list; | 203 | |
204 | /*! | ||
205 | \internal | ||
206 | Returns a translated list of field names for a contact. | ||
207 | */ | ||
208 | QStringList OContactFields::trfields( bool sorted ) | ||
209 | { | ||
210 | return fields( sorted, true ); | ||
212 | } | 211 | } |
212 | |||
213 | /*! | ||
214 | \internal | ||
215 | Returns an untranslated list of field names for a contact. | ||
216 | */ | ||
217 | QStringList OContactFields::untrfields( bool sorted ) | ||
218 | { | ||
219 | return fields( sorted, false ); | ||
220 | } | ||
221 | |||
213 | QMap<int, QString> OContactFields::idToTrFields() | 222 | QMap<int, QString> OContactFields::idToTrFields() |
@@ -359,2 +368,4 @@ QMap<QString, int> OContactFields::trFieldsToId() | |||
359 | 368 | ||
369 | /* ======================================================================= */ | ||
370 | |||
360 | QMap<QString, int> OContactFields::untrFieldsToId() | 371 | QMap<QString, int> OContactFields::untrFieldsToId() |