Diffstat (limited to 'kaddressbook/views/contactlistview.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | kaddressbook/views/contactlistview.cpp | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp index c74f8cf..5fb4163 100644 --- a/kaddressbook/views/contactlistview.cpp +++ b/kaddressbook/views/contactlistview.cpp | |||
@@ -123,122 +123,124 @@ void DynamicTip::maybeTip( const QPoint &pos ) | |||
123 | else | 123 | else |
124 | i = QMAX( a, i-1 ); | 124 | i = QMAX( a, i-1 ); |
125 | } | 125 | } |
126 | 126 | ||
127 | if ( notes[i] == '\n' || doBreak ) { | 127 | if ( notes[i] == '\n' || doBreak ) { |
128 | s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; | 128 | s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; |
129 | 129 | ||
130 | a = i + 1; | 130 | a = i + 1; |
131 | lastSpace = a; | 131 | lastSpace = a; |
132 | linew = 0; | 132 | linew = 0; |
133 | } | 133 | } |
134 | 134 | ||
135 | if ( notes[i].isSpace() ) { | 135 | if ( notes[i].isSpace() ) { |
136 | lastSpace = i; | 136 | lastSpace = i; |
137 | lastw = linew; | 137 | lastw = linew; |
138 | } | 138 | } |
139 | 139 | ||
140 | if ( lastSpace <= a ) { | 140 | if ( lastSpace <= a ) { |
141 | lastw = linew; | 141 | lastw = linew; |
142 | } | 142 | } |
143 | 143 | ||
144 | ++i; | 144 | ++i; |
145 | } | 145 | } |
146 | } | 146 | } |
147 | 147 | ||
148 | tip( r, s ); | 148 | tip( r, s ); |
149 | } | 149 | } |
150 | else | 150 | else |
151 | hide(); | 151 | hide(); |
152 | ishidden = !ishidden; | 152 | ishidden = !ishidden; |
153 | 153 | ||
154 | } | 154 | } |
155 | 155 | ||
156 | /////////////////////////// | 156 | /////////////////////////// |
157 | // ContactListViewItem Methods | 157 | // ContactListViewItem Methods |
158 | 158 | ||
159 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, | 159 | ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, |
160 | ContactListView *parent, | 160 | ContactListView *parent, |
161 | KABC::AddressBook *doc, | 161 | KABC::AddressBook *doc, |
162 | const KABC::Field::List &fields ) | 162 | const KABC::Field::List &fields ) |
163 | : KListViewItem(parent), mAddressee(a), mFields( fields ), | 163 | : KListViewItem(parent), mAddressee(a), mFields( fields ), |
164 | parentListView( parent ), mDocument(doc) | 164 | parentListView( parent ), mDocument(doc) |
165 | { | 165 | { |
166 | refresh(); | 166 | refresh(); |
167 | } | 167 | } |
168 | 168 | ||
169 | QString ContactListViewItem::key(int column, bool ascending) const | 169 | QString ContactListViewItem::key(int column, bool ascending) const |
170 | { | 170 | { |
171 | #ifndef DESKTOP_VERSION | ||
171 | int lan = KGlobal::locale()->language(); | 172 | int lan = KGlobal::locale()->language(); |
172 | //qDebug("language %d ", lan); | 173 | //qDebug("language %d ", lan); |
173 | if ( lan == 1 ) { //GERMAN | 174 | if ( lan == 1 ) { //GERMAN |
174 | QString ret = QListViewItem::key(column, ascending).utf8(); | 175 | QString ret = QListViewItem::key(column, ascending).utf8(); |
175 | int start = -1; | 176 | int start = -1; |
176 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { | 177 | while ( (start = ret.find( 'ä', start+1)) > 0 ) { |
177 | ret.at(start-1) = 'a'; | 178 | ret.at(start-1) = 'a'; |
178 | } | 179 | } |
179 | start = -1; | 180 | start = -1; |
180 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { | 181 | while ( (start = ret.find( 'ö', start+1)) > 0 ) { |
181 | ret.at(start-1) = 'o'; | 182 | ret.at(start-1) = 'o'; |
182 | } | 183 | } |
183 | start = -1; | 184 | start = -1; |
184 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { | 185 | while ( (start = ret.find( 'ü', start+1)) > 0 ) { |
185 | ret.at(start-1) = 'o'; | 186 | ret.at(start-1) = 'o'; |
186 | } | 187 | } |
187 | start = -1; | 188 | start = -1; |
188 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { | 189 | while ( (start = ret.find( 'ß', start+1)) > 0 ) { |
189 | ret.at(start-1) = 's'; | 190 | ret.at(start-1) = 's'; |
190 | } | 191 | } |
191 | //qDebug("conv string %s ", ret.latin1()); | 192 | //qDebug("conv string %s ", ret.latin1()); |
192 | 193 | ||
193 | return ret; | 194 | return ret; |
194 | 195 | ||
195 | } | 196 | } |
196 | else | 197 | else |
198 | #endif | ||
197 | return QListViewItem::key(column, ascending).lower(); | 199 | return QListViewItem::key(column, ascending).lower(); |
198 | } | 200 | } |
199 | 201 | ||
200 | void ContactListViewItem::paintCell(QPainter * p, | 202 | void ContactListViewItem::paintCell(QPainter * p, |
201 | const QColorGroup & cg, | 203 | const QColorGroup & cg, |
202 | int column, | 204 | int column, |
203 | int width, | 205 | int width, |
204 | int align) | 206 | int align) |
205 | { | 207 | { |
206 | KListViewItem::paintCell(p, cg, column, width, align); | 208 | KListViewItem::paintCell(p, cg, column, width, align); |
207 | 209 | ||
208 | if ( !p ) | 210 | if ( !p ) |
209 | return; | 211 | return; |
210 | 212 | ||
211 | if (parentListView->singleLine()) { | 213 | if (parentListView->singleLine()) { |
212 | p->setPen( parentListView->alternateColor() ); | 214 | p->setPen( parentListView->alternateColor() ); |
213 | p->drawLine( 0, height() - 1, width, height() - 1 ); | 215 | p->drawLine( 0, height() - 1, width, height() - 1 ); |
214 | } | 216 | } |
215 | } | 217 | } |
216 | 218 | ||
217 | 219 | ||
218 | ContactListView *ContactListViewItem::parent() | 220 | ContactListView *ContactListViewItem::parent() |
219 | { | 221 | { |
220 | return parentListView; | 222 | return parentListView; |
221 | } | 223 | } |
222 | 224 | ||
223 | 225 | ||
224 | void ContactListViewItem::refresh() | 226 | void ContactListViewItem::refresh() |
225 | { | 227 | { |
226 | // Update our addressee, since it may have changed else were | 228 | // Update our addressee, since it may have changed else were |
227 | mAddressee = mDocument->findByUid(mAddressee.uid()); | 229 | mAddressee = mDocument->findByUid(mAddressee.uid()); |
228 | if (mAddressee.isEmpty()) | 230 | if (mAddressee.isEmpty()) |
229 | return; | 231 | return; |
230 | 232 | ||
231 | int i = 0; | 233 | int i = 0; |
232 | KABC::Field::List::ConstIterator it; | 234 | KABC::Field::List::ConstIterator it; |
233 | for( it = mFields.begin(); it != mFields.end(); ++it ) { | 235 | for( it = mFields.begin(); it != mFields.end(); ++it ) { |
234 | setText( i++, (*it)->value( mAddressee ) ); | 236 | setText( i++, (*it)->value( mAddressee ) ); |
235 | } | 237 | } |
236 | } | 238 | } |
237 | 239 | ||
238 | /////////////////////////////// | 240 | /////////////////////////////// |
239 | // ContactListView | 241 | // ContactListView |
240 | 242 | ||
241 | ContactListView::ContactListView(KAddressBookTableView *view, | 243 | ContactListView::ContactListView(KAddressBookTableView *view, |
242 | KABC::AddressBook* /* doc */, | 244 | KABC::AddressBook* /* doc */, |
243 | QWidget *parent, | 245 | QWidget *parent, |
244 | const char *name ) | 246 | const char *name ) |