summaryrefslogtreecommitdiffabout
path: root/kabc/phonenumber.cpp
authorzautrix <zautrix>2004-10-12 20:14:39 (UTC)
committer zautrix <zautrix>2004-10-12 20:14:39 (UTC)
commit77e3a7bc670f4c9b7eb5a5d6652a7986ea196533 (patch) (unidiff)
tree963c068c7648899a4c3ac26542605f05492019c5 /kabc/phonenumber.cpp
parentd3759373291c08d2cde93d85a76d190dc8a33830 (diff)
downloadkdepimpi-77e3a7bc670f4c9b7eb5a5d6652a7986ea196533.zip
kdepimpi-77e3a7bc670f4c9b7eb5a5d6652a7986ea196533.tar.gz
kdepimpi-77e3a7bc670f4c9b7eb5a5d6652a7986ea196533.tar.bz2
Changed phone number sorting in details view
Diffstat (limited to 'kabc/phonenumber.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--kabc/phonenumber.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/kabc/phonenumber.cpp b/kabc/phonenumber.cpp
index 6e94c7e..d7e3925 100644
--- a/kabc/phonenumber.cpp
+++ b/kabc/phonenumber.cpp
@@ -105,119 +105,119 @@ void PhoneNumber::setNumber( const QString &number )
105QString PhoneNumber::number() const 105QString PhoneNumber::number() const
106{ 106{
107 return mNumber; 107 return mNumber;
108} 108}
109 109
110void PhoneNumber::setType( int type ) 110void PhoneNumber::setType( int type )
111{ 111{
112 mType = type; 112 mType = type;
113} 113}
114 114
115int PhoneNumber::type() const 115int PhoneNumber::type() const
116{ 116{
117 return mType; 117 return mType;
118} 118}
119 119
120QString PhoneNumber::typeLabel() const 120QString PhoneNumber::typeLabel() const
121{ 121{
122 QString label; 122 QString label;
123 bool first = true; 123 bool first = true;
124 124
125 TypeList list = typeList(); 125 TypeList list = typeList();
126 126
127 TypeList::Iterator it; 127 TypeList::Iterator it;
128 for ( it = list.begin(); it != list.end(); ++it ) { 128 for ( it = list.begin(); it != list.end(); ++it ) {
129 if ( ( type() & (*it) ) && ( (*it) != Pref ) ) { 129 if ( ( type() & (*it) ) && ( (*it) != Pref ) ) {
130 label.append( ( first ? "" : "/" ) + typeLabel( *it ) ); 130 label.append( ( first ? "" : "/" ) + typeLabel( *it ) );
131 if ( first ) 131 if ( first )
132 first = false; 132 first = false;
133 } 133 }
134 } 134 }
135 135
136 return label; 136 return label;
137} 137}
138 138
139QString PhoneNumber::label() const 139QString PhoneNumber::label() const
140{ 140{
141 return typeLabel( type() ); 141 return typeLabel( type() );
142} 142}
143 143
144PhoneNumber::TypeList PhoneNumber::typeList() 144PhoneNumber::TypeList PhoneNumber::typeList()
145{ 145{
146 TypeList list; 146 TypeList list;
147 147
148 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video 148 list << Home << Work << Msg << Pref << Voice << Fax << Cell << Video
149 << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip; 149 << Bbs << Modem << Car << Isdn << Pcs << Pager << Sip;
150 150
151 return list; 151 return list;
152} 152}
153 153
154QString PhoneNumber::label( int type ) 154QString PhoneNumber::label( int type )
155{ 155{
156 return typeLabel( type ); 156 return typeLabel( type );
157} 157}
158 158
159QString PhoneNumber::typeLabel( int type ) 159QString PhoneNumber::typeLabel( int type )
160{ 160{
161 QString typeString; 161 QString typeString;
162 162
163 if ((type & Home) == Home) 163 if ((type & Home) == Home)
164 typeString += i18n("Home"); 164 typeString += i18n("Home");
165 else if ((type & Work) == Work) 165 else if ((type & Work) == Work)
166 typeString += i18n("Work"); 166 typeString += i18n("Work");
167 167
168 if (!typeString.isEmpty()) 168 if (!typeString.isEmpty())
169 typeString += " "; 169 typeString += " ";
170 170
171 if ((type & Cell) == Cell) 171 if ((type & Cell) == Cell)
172 typeString += i18n("Mobile"); 172 typeString += i18n("Mobile");
173 else if ((type & Fax) == Fax) 173 else if ((type & Fax) == Fax)
174 typeString += i18n("Fax"); 174 typeString += i18n("Fax");
175 else if ((type & Msg) == Msg) 175 else if ((type & Msg) == Msg)
176 typeString += i18n("Messenger"); 176 typeString += i18n("Messenger");
177 else if ((type & Voice) == Voice) { 177 else if ((type & Voice) == Voice) {
178// add nothing in case of the Voice flag 178// add nothing in case of the Voice flag
179// typeString += i18n("Voice"); 179// typeString += i18n("Voice");
180 } 180 }
181 else if ((type & Video) == Video) 181 else if ((type & Video) == Video)
182 typeString += i18n("Video"); 182 typeString += i18n("Video");
183 else if ((type & Bbs) == Bbs) 183 else if ((type & Bbs) == Bbs)
184 typeString += i18n("Mailbox"); 184 typeString += i18n("Mailbox");
185 else if ((type & Modem) == Modem) 185 else if ((type & Modem) == Modem)
186 typeString += i18n("Modem"); 186 typeString += i18n("Modem");
187 else if ((type & Car) == Car) 187 else if ((type & Car) == Car)
188 typeString += i18n("Car"); 188 typeString += i18n("Car");
189 else if ((type & Isdn) == Isdn) 189 else if ((type & Isdn) == Isdn)
190 typeString += i18n("ISDN"); 190 typeString += i18n("ISDN");
191 else if ((type & Pcs) == Pcs) 191 else if ((type & Pcs) == Pcs)
192 typeString += i18n("PCS"); 192 typeString += i18n("PCS");
193 else if ((type & Pager) == Pager) 193 else if ((type & Pager) == Pager)
194 typeString += i18n("Pager"); 194 typeString += i18n("Pager");
195 else if ((type & Sip) == Sip) 195 else if ((type & Sip) == Sip)
196 typeString += i18n("SIP"); 196 typeString += i18n("SIP");
197 197
198 // add the prefered flag 198 // add the prefered flag
199 if (!typeString.isEmpty()) 199 if (!typeString.isEmpty())
200 typeString += " "; 200 typeString += " ";
201 201 /*
202 if ((type & Pref) == Pref) 202 if ((type & Pref) == Pref)
203 typeString += i18n("(p)"); 203 typeString += i18n("(p)");
204 204 */
205 //if we still have no match, return "other" 205 //if we still have no match, return "other"
206 if (typeString.isEmpty()) 206 if (typeString.isEmpty())
207 return i18n("Other"); 207 return i18n("Other");
208 208
209 209
210 return typeString; 210 return typeString;
211} 211}
212 212
213QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone ) 213QDataStream &KABC::operator<<( QDataStream &s, const PhoneNumber &phone )
214{ 214{
215 return s << phone.mId << phone.mType << phone.mNumber; 215 return s << phone.mId << phone.mType << phone.mNumber;
216} 216}
217 217
218QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone ) 218QDataStream &KABC::operator>>( QDataStream &s, PhoneNumber &phone )
219{ 219{
220 s >> phone.mId >> phone.mType >> phone.mNumber; 220 s >> phone.mId >> phone.mType >> phone.mNumber;
221 221
222 return s; 222 return s;
223} 223}