author | zautrix <zautrix> | 2005-03-31 11:26:51 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-03-31 11:26:51 (UTC) |
commit | c0fa26aa3b33c293853bdd7d028ddb0545e33c85 (patch) (unidiff) | |
tree | 12bbb65fb6d235415bd7a7007c1e019ccfcf97ac /kabc | |
parent | f39d5000ed2f9a436ee94cbd42f840651afa89d6 (diff) | |
download | kdepimpi-c0fa26aa3b33c293853bdd7d028ddb0545e33c85.zip kdepimpi-c0fa26aa3b33c293853bdd7d028ddb0545e33c85.tar.gz kdepimpi-c0fa26aa3b33c293853bdd7d028ddb0545e33c85.tar.bz2 |
many fixes
-rw-r--r-- | kabc/phonenumber.cpp | 34 |
1 files changed, 15 insertions, 19 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index abb3b3b..041effc 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -139,102 +139,98 @@ QString PhoneNumber::typeLabel() const | |||
139 | QString label; | 139 | QString label; |
140 | bool first = true; | 140 | bool first = true; |
141 | 141 | ||
142 | TypeList list = typeList(); | 142 | TypeList list = typeList(); |
143 | 143 | ||
144 | TypeList::Iterator it; | 144 | TypeList::Iterator it; |
145 | for ( it = list.begin(); it != list.end(); ++it ) { | 145 | for ( it = list.begin(); it != list.end(); ++it ) { |
146 | if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { | 146 | if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { |
147 | label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); | 147 | label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); |
148 | if ( first ) | 148 | if ( first ) |
149 | first = false; | 149 | first = false; |
150 | } | 150 | } |
151 | } | 151 | } |
152 | 152 | ||
153 | return label; | 153 | return label; |
154 | } | 154 | } |
155 | 155 | ||
156 | QString PhoneNumber::label() const | 156 | QString PhoneNumber::label() const |
157 | { | 157 | { |
158 | return typeLabel( type() ); | 158 | return typeLabel( type() ); |
159 | } | 159 | } |
160 | 160 | ||
161 | PhoneNumber::TypeList PhoneNumber::typeList() | 161 | PhoneNumber::TypeList PhoneNumber::typeList() |
162 | { | 162 | { |
163 | TypeList list; | 163 | TypeList list; |
164 | 164 | ||
165 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video | 165 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video |
166 | << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; | 166 | << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; |
167 | 167 | ||
168 | return list; | 168 | return list; |
169 | } | 169 | } |
170 | 170 | ||
171 | QString PhoneNumber::label( int type ) | 171 | QString PhoneNumber::label( int type ) |
172 | { | 172 | { |
173 | return typeLabel( type ); | 173 | return typeLabel( type ); |
174 | } | 174 | } |
175 | 175 | ||
176 | QString PhoneNumber::typeLabel( int type ) | 176 | QString PhoneNumber::typeLabel( int type ) |
177 | { | 177 | { |
178 | QString typeString; | 178 | QString typeString; |
179 | 179 | ||
180 | if ((type & Home) == Home) | 180 | if ((type & Home) == Home) |
181 | typeString += i18n("Home"); | 181 | typeString += i18n("Home"); |
182 | else if ((type & Work) == Work) | 182 | else if ((type & Work) == Work) |
183 | typeString += i18n("Work"); | 183 | typeString += i18n("Work"); |
184 | 184 | ||
185 | if (!typeString.isEmpty()) | 185 | if (!typeString.isEmpty()) |
186 | typeString += " "; | 186 | typeString += " "; |
187 | |||
188 | if ((type & Cell) == Cell) | 187 | if ((type & Cell) == Cell) |
189 | typeString += i18n("Mobile"); | 188 | typeString += i18n("Mobile") +" "; |
190 | else if ((type & Fax) == Fax) | 189 | if ((type & Sip) == Sip) |
190 | typeString += i18n("SIP")+" "; | ||
191 | if ((type & Car) == Car) | ||
192 | typeString += i18n("Car")+" "; | ||
193 | |||
194 | if ((type & Fax) == Fax) | ||
191 | typeString += i18n("Fax"); | 195 | typeString += i18n("Fax"); |
192 | else if ((type & Msg) == Msg) | 196 | else if ((type & Msg) == Msg) |
193 | typeString += i18n("Messenger"); | 197 | typeString += i18n("Messenger"); |
194 | else if ((type & Voice) == Voice) { | ||
195 | // add nothing in case of the Voice flag | ||
196 | // typeString += i18n("Voice"); | ||
197 | } | ||
198 | else if ((type & Video) == Video) | 198 | else if ((type & Video) == Video) |
199 | typeString += i18n("Video"); | 199 | typeString += i18n("Video"); |
200 | else if ((type & Bbs) == Bbs) | 200 | else if ((type & Bbs) == Bbs) |
201 | typeString += i18n("Mailbox"); | 201 | typeString += i18n("Mailbox"); |
202 | else if ((type & Modem) == Modem) | 202 | else if ((type & Modem) == Modem) |
203 | typeString += i18n("Modem"); | 203 | typeString += i18n("Modem"); |
204 | else if ((type & Car) == Car) | ||
205 | typeString += i18n("Car"); | ||
206 | else if ((type & Isdn) == Isdn) | 204 | else if ((type & Isdn) == Isdn) |
207 | typeString += i18n("ISDN"); | 205 | typeString += i18n("ISDN"); |
208 | else if ((type & Pcs) == Pcs) | 206 | else if ((type & Pcs) == Pcs) |
209 | typeString += i18n("PCS"); | 207 | typeString += i18n("PCS"); |
210 | else if ((type & Pager) == Pager) | 208 | else if ((type & Pager) == Pager) |
211 | typeString += i18n("Pager"); | 209 | typeString += i18n("Pager"); |
212 | else if ((type & Sip) == Sip) | ||
213 | typeString += i18n("SIP"); | ||
214 | |||
215 | // add the prefered flag | 210 | // add the prefered flag |
216 | if (!typeString.isEmpty()) | ||
217 | typeString += " "; | ||
218 | /* | 211 | /* |
219 | if ((type & Pref) == Pref) | 212 | if ((type & Pref) == Pref) |
220 | typeString += i18n("(p)"); | 213 | typeString += i18n("(p)"); |
221 | */ | 214 | */ |
222 | //if we still have no match, return "other" | 215 | //if we still have no match, return "other" |
223 | if (typeString.isEmpty()) | 216 | if (typeString.isEmpty()) { |
224 | return i18n("Other"); | 217 | if ((type & Voice) == Voice) |
225 | 218 | return i18n("Voice"); | |
226 | 219 | else | |
227 | return typeString; | 220 | return i18n("Other"); |
221 | } | ||
222 | |||
223 | return typeString.stripWhiteSpace(); | ||
228 | } | 224 | } |
229 | 225 | ||
230 | QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) | 226 | QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) |
231 | { | 227 | { |
232 | return s << phone.mId << phone.mType << phone.mNumber; | 228 | return s << phone.mId << phone.mType << phone.mNumber; |
233 | } | 229 | } |
234 | 230 | ||
235 | QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone ) | 231 | QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone ) |
236 | { | 232 | { |
237 | s >> phone.mId >> phone.mType >> phone.mNumber; | 233 | s >> phone.mId >> phone.mType >> phone.mNumber; |
238 | 234 | ||
239 | return s; | 235 | return s; |
240 | } | 236 | } |