-rw-r--r-- | kabc/phonenumber.cpp | 112 |
1 files changed, 110 insertions, 2 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp index 4c6231d..0d46ba7 100644 --- a/kabc/phonenumber.cpp +++ b/kabc/phonenumber.cpp | |||
@@ -65,7 +65,62 @@ bool PhoneNumber::operator!=( const PhoneNumber &p ) const | |||
65 | { | 65 | { |
66 | return !( p == *this ); | 66 | return !( p == *this ); |
67 | } | 67 | } |
68 | void PhoneNumber::makeCompat() | ||
69 | { | ||
70 | mType = getCompatType( mType ); | ||
71 | } | ||
72 | int PhoneNumber::getCompatType( int type ) | ||
73 | { | ||
74 | |||
75 | if ((type & Cell) == Cell) { | ||
76 | if ((type & Work) == Work) | ||
77 | return Car; | ||
78 | return Cell; | ||
79 | } | ||
80 | if ((type & Home) == Home) { | ||
81 | if ((type & Pref) == Pref) | ||
82 | return (Home | Pref); | ||
83 | if ((type & Fax) == Fax) | ||
84 | return (Home | Fax); | ||
85 | return (Home); | ||
86 | } | ||
87 | if ((type & Work) == Work) { | ||
88 | if ((type & Pref) == Pref) | ||
89 | return (Work| Pref); | ||
90 | if ((type & Fax) == Fax) | ||
91 | return (Fax |Work); | ||
92 | if ((type & Msg) == Msg) { | ||
93 | if ((type & Voice) == Voice) | ||
94 | return ( Msg | Voice |Work); | ||
95 | return ( Msg | Work); | ||
96 | } | ||
97 | return Work; | ||
98 | } | ||
99 | if ((type & Pcs) == Pcs) { | ||
100 | if ((type & Pref) == Pref) | ||
101 | return Pcs | Pref; | ||
102 | return Pcs; | ||
103 | } | ||
104 | if ((type & Car) == Car) | ||
105 | return Car; | ||
106 | if ((type & Pager) == Pager) | ||
107 | return Pager; | ||
108 | if ((type & Isdn) == Isdn) | ||
109 | return Isdn; | ||
110 | if ((type & Video) == Video) | ||
111 | return Video; | ||
112 | |||
113 | if ((type & Msg) == Msg) | ||
114 | return Msg; | ||
115 | if ((type & Fax) == Fax) | ||
116 | return Fax; | ||
117 | |||
118 | if ((type & Pref) == Pref) | ||
119 | return Pref; | ||
68 | 120 | ||
121 | return Voice; | ||
122 | |||
123 | } | ||
69 | bool PhoneNumber::simplifyNumber() | 124 | bool PhoneNumber::simplifyNumber() |
70 | { | 125 | { |
71 | QString Number; | 126 | QString Number; |
@@ -163,7 +218,7 @@ PhoneNumber::TypeList PhoneNumber::typeList() | |||
163 | TypeList list; | 218 | TypeList list; |
164 | 219 | ||
165 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video | 220 | list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video |
166 | << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; | 221 | << Bbs << Modem << Car << Isdn << Pcs << Pager; |
167 | 222 | ||
168 | return list; | 223 | return list; |
169 | } | 224 | } |
@@ -175,8 +230,60 @@ QString PhoneNumber::label( int type ) | |||
175 | 230 | ||
176 | QString PhoneNumber::typeLabel( int type ) | 231 | QString PhoneNumber::typeLabel( int type ) |
177 | { | 232 | { |
178 | QString typeString; | 233 | if ((type & Cell) == Cell) |
234 | return i18n("Mobile"); | ||
235 | if ((type & Home) == Home) { | ||
236 | if ((type & Pref) == Pref) | ||
237 | return i18n("Home"); | ||
238 | if ((type & Fax) == Fax) | ||
239 | return i18n("Fax (Home)"); | ||
240 | return i18n("Home2"); | ||
241 | } | ||
179 | 242 | ||
243 | if ((type & Work) == Work) { | ||
244 | if ((type & Pref) == Pref) | ||
245 | return i18n("Work"); | ||
246 | if ((type & Fax) == Fax) | ||
247 | return i18n("Fax (Work)"); | ||
248 | if ((type & Msg) == Msg) { | ||
249 | if ((type & Voice) == Voice) | ||
250 | return i18n("Assistent"); | ||
251 | return i18n("Company"); | ||
252 | } | ||
253 | return i18n("Work2"); | ||
254 | } | ||
255 | if ((type & Pcs) == Pcs) { | ||
256 | if ((type & Pref) == Pref) | ||
257 | return i18n("SIP"); | ||
258 | return i18n("VoIP"); | ||
259 | } | ||
260 | if ((type & Car) == Car) | ||
261 | return i18n("Mobile2 (Work)"); | ||
262 | if ((type & Pager) == Pager) | ||
263 | return i18n("Pager"); | ||
264 | if ((type & Isdn) == Isdn) | ||
265 | return i18n("ISDN"); | ||
266 | if ((type & Video) == Video) | ||
267 | return i18n("Video"); | ||
268 | |||
269 | if ((type & Msg) == Msg) | ||
270 | return i18n("Callback"); | ||
271 | if ((type & Fax) == Fax) | ||
272 | return i18n("Fax (Other)"); | ||
273 | |||
274 | if ((type & Pref) == Pref) | ||
275 | return i18n("Primary"); | ||
276 | |||
277 | |||
278 | return i18n("Other"); | ||
279 | |||
280 | |||
281 | #if 0 | ||
282 | |||
283 | |||
284 | |||
285 | QString typeString; | ||
286 | |||
180 | 287 | ||
181 | if ((type & Cell) == Cell) | 288 | if ((type & Cell) == Cell) |
182 | typeString += i18n("Mobile") +" "; | 289 | typeString += i18n("Mobile") +" "; |
@@ -220,6 +327,7 @@ QString PhoneNumber::typeLabel( int type ) | |||
220 | } | 327 | } |
221 | 328 | ||
222 | return typeString.stripWhiteSpace(); | 329 | return typeString.stripWhiteSpace(); |
330 | #endif | ||
223 | } | 331 | } |
224 | 332 | ||
225 | QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) | 333 | QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) |