summaryrefslogtreecommitdiffabout
path: root/kaddressbook/views
Unidiff
Diffstat (limited to 'kaddressbook/views') (more/less context) (show whitespace changes)
-rw-r--r--kaddressbook/views/contactlistview.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index 4cc22ea..c74f8cf 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -123,96 +123,122 @@ 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
159ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, 159ContactListViewItem::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
169QString ContactListViewItem::key(int column, bool ascending) const 169QString ContactListViewItem::key(int column, bool ascending) const
170{ 170{
171 int lan = KGlobal::locale()->language();
172 //qDebug("language %d ", lan);
173 if ( lan == 1 ) { //GERMAN
174 QString ret = QListViewItem::key(column, ascending).utf8();
175 int start = -1;
176 while ( (start = ret.find( 'ä', start+1)) > 0 ) {
177 ret.at(start-1) = 'a';
178 }
179 start = -1;
180 while ( (start = ret.find( 'ö', start+1)) > 0 ) {
181 ret.at(start-1) = 'o';
182 }
183 start = -1;
184 while ( (start = ret.find( 'ü', start+1)) > 0 ) {
185 ret.at(start-1) = 'o';
186 }
187 start = -1;
188 while ( (start = ret.find( 'ß', start+1)) > 0 ) {
189 ret.at(start-1) = 's';
190 }
191 //qDebug("conv string %s ", ret.latin1());
192
193 return ret;
194
195 }
196 else
171 return QListViewItem::key(column, ascending).lower(); 197 return QListViewItem::key(column, ascending).lower();
172} 198}
173 199
174void ContactListViewItem::paintCell(QPainter * p, 200void ContactListViewItem::paintCell(QPainter * p,
175 const QColorGroup & cg, 201 const QColorGroup & cg,
176 int column, 202 int column,
177 int width, 203 int width,
178 int align) 204 int align)
179{ 205{
180 KListViewItem::paintCell(p, cg, column, width, align); 206 KListViewItem::paintCell(p, cg, column, width, align);
181 207
182 if ( !p ) 208 if ( !p )
183 return; 209 return;
184 210
185 if (parentListView->singleLine()) { 211 if (parentListView->singleLine()) {
186 p->setPen( parentListView->alternateColor() ); 212 p->setPen( parentListView->alternateColor() );
187 p->drawLine( 0, height() - 1, width, height() - 1 ); 213 p->drawLine( 0, height() - 1, width, height() - 1 );
188 } 214 }
189} 215}
190 216
191 217
192ContactListView *ContactListViewItem::parent() 218ContactListView *ContactListViewItem::parent()
193{ 219{
194 return parentListView; 220 return parentListView;
195} 221}
196 222
197 223
198void ContactListViewItem::refresh() 224void ContactListViewItem::refresh()
199{ 225{
200 // Update our addressee, since it may have changed else were 226 // Update our addressee, since it may have changed else were
201 mAddressee = mDocument->findByUid(mAddressee.uid()); 227 mAddressee = mDocument->findByUid(mAddressee.uid());
202 if (mAddressee.isEmpty()) 228 if (mAddressee.isEmpty())
203 return; 229 return;
204 230
205 int i = 0; 231 int i = 0;
206 KABC::Field::List::ConstIterator it; 232 KABC::Field::List::ConstIterator it;
207 for( it = mFields.begin(); it != mFields.end(); ++it ) { 233 for( it = mFields.begin(); it != mFields.end(); ++it ) {
208 setText( i++, (*it)->value( mAddressee ) ); 234 setText( i++, (*it)->value( mAddressee ) );
209 } 235 }
210} 236}
211 237
212/////////////////////////////// 238///////////////////////////////
213// ContactListView 239// ContactListView
214 240
215ContactListView::ContactListView(KAddressBookTableView *view, 241ContactListView::ContactListView(KAddressBookTableView *view,
216 KABC::AddressBook* /* doc */, 242 KABC::AddressBook* /* doc */,
217 QWidget *parent, 243 QWidget *parent,
218 const char *name ) 244 const char *name )