summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-04-11 00:29:46 (UTC)
committer zautrix <zautrix>2005-04-11 00:29:46 (UTC)
commit93b536533e1c908085adb61553907615c31786c0 (patch) (unidiff)
tree42b150b957c815416143c4ba82be4099d254ba37 /kaddressbook
parent726d9302b230f53cc058d2dbfd89c7a3c4f18fb2 (diff)
downloadkdepimpi-93b536533e1c908085adb61553907615c31786c0.zip
kdepimpi-93b536533e1c908085adb61553907615c31786c0.tar.gz
kdepimpi-93b536533e1c908085adb61553907615c31786c0.tar.bz2
fixxxxxx
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/views/contactlistview.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index 09d9c03..9accf78 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -1,429 +1,429 @@
1/* 1/*
2 This file is part of KAddressBook. 2 This file is part of KAddressBook.
3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com> 3 Copyright (c) 2002 Mike Pilone <mpilone@slac.com>
4 4
5 This program is free software; you can redistribute it and/or modify 5 This program is free software; you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by 6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation; either version 2 of the License, or 7 the Free Software Foundation; either version 2 of the License, or
8 (at your option) any later version. 8 (at your option) any later version.
9 9
10 This program is distributed in the hope that it will be useful, 10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of 11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details. 13 GNU General Public License for more details.
14 14
15 You should have received a copy of the GNU General Public License 15 You should have received a copy of the GNU General Public License
16 along with this program; if not, write to the Free Software 16 along with this program; if not, write to the Free Software
17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 17 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18 18
19 As a special exception, permission is given to link this program 19 As a special exception, permission is given to link this program
20 with any edition of Qt, and distribute the resulting executable, 20 with any edition of Qt, and distribute the resulting executable,
21 without including the source code for Qt in the source distribution. 21 without including the source code for Qt in the source distribution.
22*/ 22*/
23 23
24#include <qheader.h> 24#include <qheader.h>
25#include <qiconset.h> 25#include <qiconset.h>
26#include <qimage.h> 26#include <qimage.h>
27#include <qdragobject.h> 27#include <qdragobject.h>
28#include <qcombobox.h> 28#include <qcombobox.h>
29#include <qpainter.h> 29#include <qpainter.h>
30#include <qbrush.h> 30#include <qbrush.h>
31#include <qevent.h> 31#include <qevent.h>
32#include <qapplication.h> 32#include <qapplication.h>
33 33
34#include <klocale.h> 34#include <klocale.h>
35#include <kglobalsettings.h> 35#include <kglobalsettings.h>
36#include <kiconloader.h> 36#include <kiconloader.h>
37#include <kdebug.h> 37#include <kdebug.h>
38#include <kconfig.h> 38#include <kconfig.h>
39#include <kapplication.h> 39#include <kapplication.h>
40#include <kurl.h> 40#include <kurl.h>
41 41
42#include "kaddressbooktableview.h" 42#include "kaddressbooktableview.h"
43 43
44#include "contactlistview.h" 44#include "contactlistview.h"
45 45
46///////////////////////////////// 46/////////////////////////////////
47// DynamicTip Methods 47// DynamicTip Methods
48 48
49DynamicTip::DynamicTip( ContactListView *parent) 49DynamicTip::DynamicTip( ContactListView *parent)
50 : QToolTip( parent ) 50 : QToolTip( parent )
51{ 51{
52} 52}
53 53
54void DynamicTip::maybeTip( const QPoint &pos ) 54void DynamicTip::maybeTip( const QPoint &pos )
55{ 55{
56 static bool ishidden = true; 56 static bool ishidden = true;
57 if (!parentWidget()->inherits( "ContactListView" )) 57 if (!parentWidget()->inherits( "ContactListView" ))
58 return; 58 return;
59 59
60 ContactListView *plv = (ContactListView*)parentWidget(); 60 ContactListView *plv = (ContactListView*)parentWidget();
61 if (!plv->tooltips()) 61 if (!plv->tooltips())
62 return; 62 return;
63 63
64 QPoint posVp = plv->viewport()->pos(); 64 QPoint posVp = plv->viewport()->pos();
65 65
66 QListViewItem *lvi = plv->itemAt( pos - posVp ); 66 QListViewItem *lvi = plv->itemAt( pos - posVp );
67 if (!lvi) 67 if (!lvi)
68 return; 68 return;
69 69
70#ifndef KAB_EMBEDDED 70#ifndef KAB_EMBEDDED
71 ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi); 71 ContactListViewItem *plvi = dynamic_cast< ContactListViewItem* >(lvi);
72#else //KAB_EMBEDDED 72#else //KAB_EMBEDDED
73 ContactListViewItem *plvi = (ContactListViewItem*)(lvi); 73 ContactListViewItem *plvi = (ContactListViewItem*)(lvi);
74#endif //KAB_EMBEDDED 74#endif //KAB_EMBEDDED
75 75
76 if (!plvi) 76 if (!plvi)
77 return; 77 return;
78 78
79 if (ishidden) { 79 if (ishidden) {
80 QString s; 80 QString s;
81 QRect r = plv->itemRect( lvi ); 81 QRect r = plv->itemRect( lvi );
82 r.moveBy( posVp.x(), posVp.y() ); 82 r.moveBy( posVp.x(), posVp.y() );
83 83
84 //kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width() 84 //kdDebug() << "Tip rec: " << r.x() << "," << r.y() << "," << r.width()
85 // << "," << r.height() << endl; 85 // << "," << r.height() << endl;
86 86
87 KABC::Addressee a = plvi->addressee(); 87 KABC::Addressee a = plvi->addressee();
88 if (a.isEmpty()) 88 if (a.isEmpty())
89 return; 89 return;
90 90
91 s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel()) 91 s += i18n("label: value", "%1: %2").arg(a.formattedNameLabel())
92 .arg(a.formattedName()); 92 .arg(a.formattedName());
93 93
94 s += '\n'; 94 s += '\n';
95 s += i18n("label: value", "%1: %2").arg(a.organizationLabel()) 95 s += i18n("label: value", "%1: %2").arg(a.organizationLabel())
96 .arg(a.organization()); 96 .arg(a.organization());
97 97
98 QString notes = a.note().stripWhiteSpace(); 98 QString notes = a.note().stripWhiteSpace();
99 if ( !notes.isEmpty() ) { 99 if ( !notes.isEmpty() ) {
100 notes += '\n'; 100 notes += '\n';
101 s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel()); 101 s += '\n' + i18n("label: value", "%1: \n").arg(a.noteLabel());
102 QFontMetrics fm( font() ); 102 QFontMetrics fm( font() );
103 103
104 // Begin word wrap code based on QMultiLineEdit code 104 // Begin word wrap code based on QMultiLineEdit code
105 int i = 0; 105 int i = 0;
106 bool doBreak = false; 106 bool doBreak = false;
107 int linew = 0; 107 int linew = 0;
108 int lastSpace = -1; 108 int lastSpace = -1;
109 int a = 0; 109 int a = 0;
110 int lastw = 0; 110 int lastw = 0;
111 111
112 while ( i < int(notes.length()) ) { 112 while ( i < int(notes.length()) ) {
113 doBreak = FALSE; 113 doBreak = FALSE;
114 if ( notes[i] != '\n' ) 114 if ( notes[i] != '\n' )
115 linew += fm.width( notes[i] ); 115 linew += fm.width( notes[i] );
116 116
117 if ( lastSpace >= a && notes[i] != '\n' ) 117 if ( lastSpace >= a && notes[i] != '\n' )
118 if (linew >= parentWidget()->width()) { 118 if (linew >= parentWidget()->width()) {
119 doBreak = TRUE; 119 doBreak = TRUE;
120 if ( lastSpace > a ) { 120 if ( lastSpace > a ) {
121 i = lastSpace; 121 i = lastSpace;
122 linew = lastw; 122 linew = lastw;
123 } 123 }
124 else 124 else
125 i = QMAX( a, i-1 ); 125 i = QMAX( a, i-1 );
126 } 126 }
127 127
128 if ( notes[i] == '\n' || doBreak ) { 128 if ( notes[i] == '\n' || doBreak ) {
129 s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n"; 129 s += notes.mid( a, i - a + (doBreak?1:0) ) +"\n";
130 130
131 a = i + 1; 131 a = i + 1;
132 lastSpace = a; 132 lastSpace = a;
133 linew = 0; 133 linew = 0;
134 } 134 }
135 135
136 if ( notes[i].isSpace() ) { 136 if ( notes[i].isSpace() ) {
137 lastSpace = i; 137 lastSpace = i;
138 lastw = linew; 138 lastw = linew;
139 } 139 }
140 140
141 if ( lastSpace <= a ) { 141 if ( lastSpace <= a ) {
142 lastw = linew; 142 lastw = linew;
143 } 143 }
144 144
145 ++i; 145 ++i;
146 } 146 }
147 } 147 }
148 148
149 tip( r, s ); 149 tip( r, s );
150 } 150 }
151 else 151 else
152 hide(); 152 hide();
153 ishidden = !ishidden; 153 ishidden = !ishidden;
154 154
155} 155}
156 156
157/////////////////////////// 157///////////////////////////
158// ContactListViewItem Methods 158// ContactListViewItem Methods
159 159
160ContactListViewItem::ContactListViewItem(const KABC::Addressee &a, 160ContactListViewItem::ContactListViewItem(const KABC::Addressee &a,
161 ContactListView *parent, 161 ContactListView *parent,
162 KABC::AddressBook *doc, 162 KABC::AddressBook *doc,
163 const KABC::Field::List &fields ) 163 const KABC::Field::List &fields )
164 : KListViewItem(parent), mAddressee(a), mFields( fields ), 164 : KListViewItem(parent), mAddressee(a), mFields( fields ),
165 parentListView( parent ), mDocument(doc) 165 parentListView( parent ), mDocument(doc)
166{ 166{
167 refresh(); 167 refresh();
168} 168}
169 169
170QString ContactListViewItem::key(int column, bool ascending) const 170QString ContactListViewItem::key(int column, bool ascending) const
171{ 171{
172#ifndef DESKTOP_VERSION 172#ifndef DESKTOP_VERSION
173 int lan = KGlobal::locale()->language(); 173 int lan = KGlobal::locale()->language();
174 //qDebug("language %d ", lan); 174 //qDebug("language %d ", lan);
175 if ( lan == 1 ) { //GERMAN 175 if ( lan == 1 ) { //GERMAN
176 QString ret = QListViewItem::key(column, ascending).lower().utf8(); 176 QString ret = QListViewItem::key(column, ascending).lower().utf8();
177 int start = -1; 177 int start = -1;
178 while ( (start = ret.find( 'ä', start+1)) > 0 ) { 178 while ( (start = ret.find( 'ä', start+1)) > 0 ) {
179 ret.at(start-1) = 'a'; 179 ret.at(start-1) = 'a';
180 } 180 }
181 start = -1; 181 start = -1;
182 while ( (start = ret.find( 'ö', start+1)) > 0 ) { 182 while ( (start = ret.find( 'ö', start+1)) > 0 ) {
183 ret.at(start-1) = 'o'; 183 ret.at(start-1) = 'o';
184 } 184 }
185 start = -1; 185 start = -1;
186 while ( (start = ret.find( 'ü', start+1)) > 0 ) { 186 while ( (start = ret.find( 'ü', start+1)) > 0 ) {
187 ret.at(start-1) = 'o'; 187 ret.at(start-1) = 'o';
188 } 188 }
189 start = -1; 189 start = -1;
190 while ( (start = ret.find( 'ß', start+1)) > 0 ) { 190 while ( (start = ret.find( 'ß', start+1)) > 0 ) {
191 ret.at(start-1) = 's'; 191 ret.at(start-1) = 's';
192 } 192 }
193 //qDebug("conv string %s ", ret.latin1()); 193 //qDebug("conv string %s ", ret.latin1());
194 194
195 return ret; 195 return ret;
196 196
197 } 197 }
198 else 198 else
199#endif 199#endif
200 return QListViewItem::key(column, ascending).lower(); 200 return QListViewItem::key(column, ascending).lower();
201} 201}
202 202
203void ContactListViewItem::paintCell(QPainter * p, 203void ContactListViewItem::paintCell(QPainter * p,
204 const QColorGroup & cg, 204 const QColorGroup & cg,
205 int column, 205 int column,
206 int width, 206 int width,
207 int align) 207 int align)
208{ 208{
209 KListViewItem::paintCell(p, cg, column, width, align); 209 KListViewItem::paintCell(p, cg, column, width, align);
210 210
211 if ( !p ) 211 if ( !p )
212 return; 212 return;
213 213
214 if (parentListView->singleLine()) { 214 if (parentListView->singleLine()) {
215 p->setPen( parentListView->alternateColor() ); 215 p->setPen( parentListView->alternateColor() );
216 p->drawLine( 0, height() - 1, width, height() - 1 ); 216 p->drawLine( 0, height() - 1, width, height() - 1 );
217 } 217 }
218} 218}
219 219
220 220
221ContactListView *ContactListViewItem::parent() 221ContactListView *ContactListViewItem::parent()
222{ 222{
223 return parentListView; 223 return parentListView;
224} 224}
225 225
226 226
227void ContactListViewItem::refresh() 227void ContactListViewItem::refresh()
228{ 228{
229 // Update our addressee, since it may have changed else were 229 // Update our addressee, since it may have changed else were
230 mAddressee = mDocument->findByUid(mAddressee.uid()); 230 mAddressee = mDocument->findByUid(mAddressee.uid());
231 if (mAddressee.isEmpty()) 231 if (mAddressee.isEmpty())
232 return; 232 return;
233 233
234 int i = 0; 234 int i = 0;
235 KABC::Field::List::ConstIterator it; 235 KABC::Field::List::ConstIterator it;
236 for( it = mFields.begin(); it != mFields.end(); ++it ) { 236 for( it = mFields.begin(); it != mFields.end(); ++it ) {
237 setText( i++, (*it)->value( mAddressee ) ); 237 setText( i++, (*it)->value( mAddressee ) );
238 } 238 }
239} 239}
240 240
241/////////////////////////////// 241///////////////////////////////
242// ContactListView 242// ContactListView
243 243
244ContactListView::ContactListView(KAddressBookTableView *view, 244ContactListView::ContactListView(KAddressBookTableView *view,
245 KABC::AddressBook* /* doc */, 245 KABC::AddressBook* /* doc */,
246 QWidget *parent, 246 QWidget *parent,
247 const char *name ) 247 const char *name )
248 : KListView( parent, name ), 248 : KListView( parent, name ),
249 pabWidget( view ), 249 pabWidget( view ),
250 oldColumn( 0 ) 250 oldColumn( 0 )
251{ 251{
252 mFlagBlockKeyPressed = false; 252 mFlagBlockKeyPressed = false;
253 mFlagKeyPressed = false; 253 mFlagKeyPressed = false;
254 mABackground = true; 254 mABackground = true;
255 mSingleLine = false; 255 mSingleLine = false;
256 mToolTips = true; 256 mToolTips = true;
257#ifndef KAB_EMBEDDED 257
258 mAlternateColor = KGlobalSettings::alternateBackgroundColor(); 258 mAlternateColor = KGlobalSettings::alternateBackgroundColor();
259#else //KAB_EMBEDDED 259
260 mAlternateColor = QColor(240, 240, 240); 260
261#endif //KAB_EMBEDDED 261
262 262
263 setAlternateBackgroundEnabled(mABackground); 263 setAlternateBackgroundEnabled(mABackground);
264 setAcceptDrops( true ); 264 setAcceptDrops( true );
265 viewport()->setAcceptDrops( true ); 265 viewport()->setAcceptDrops( true );
266 setAllColumnsShowFocus( true ); 266 setAllColumnsShowFocus( true );
267 setShowSortIndicator(true); 267 setShowSortIndicator(true);
268 268
269 setSelectionModeExt( KListView::Extended ); 269 setSelectionModeExt( KListView::Extended );
270 setDropVisualizer(false); 270 setDropVisualizer(false);
271 // setFrameStyle(QFrame::NoFrame); 271 // setFrameStyle(QFrame::NoFrame);
272 //setLineWidth ( 0 ); 272 //setLineWidth ( 0 );
273 //setMidLineWidth ( 0 ); 273 //setMidLineWidth ( 0 );
274 //setMargin ( 0 ); 274 //setMargin ( 0 );
275#ifndef KAB_EMBEDDED 275#ifndef KAB_EMBEDDED
276 connect(this, SIGNAL(dropped(QDropEvent*)), 276 connect(this, SIGNAL(dropped(QDropEvent*)),
277 this, SLOT(itemDropped(QDropEvent*))); 277 this, SLOT(itemDropped(QDropEvent*)));
278#endif //KAB_EMBEDDED 278#endif //KAB_EMBEDDED
279 279
280 280
281 new DynamicTip( this ); 281 new DynamicTip( this );
282} 282}
283void ContactListView::printMe() 283void ContactListView::printMe()
284{ 284{
285#ifdef DESKTOP_VERSION 285#ifdef DESKTOP_VERSION
286 QPrinter printer; 286 QPrinter printer;
287 if (!printer.setup() ) 287 if (!printer.setup() )
288 return; 288 return;
289 QPainter p; 289 QPainter p;
290 p.begin ( &printer ); 290 p.begin ( &printer );
291 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer ); 291 QPaintDeviceMetrics m = QPaintDeviceMetrics ( &printer );
292 float dx, dy; 292 float dx, dy;
293 int wid = (m.width() * 9)/10; 293 int wid = (m.width() * 9)/10;
294 dx = (float) wid/(float)contentsWidth (); 294 dx = (float) wid/(float)contentsWidth ();
295 dy = (float)(m.height()) / (float)contentsHeight (); 295 dy = (float)(m.height()) / (float)contentsHeight ();
296 float scale; 296 float scale;
297 // scale to fit the width or height of the paper 297 // scale to fit the width or height of the paper
298 if ( dx < dy ) 298 if ( dx < dy )
299 scale = dx; 299 scale = dx;
300 else 300 else
301 scale = dy; 301 scale = dy;
302 p.translate( m.width()/10,0 ); 302 p.translate( m.width()/10,0 );
303 p.scale( scale, scale ); 303 p.scale( scale, scale );
304 qDebug("scale %f ", scale); 304 qDebug("scale %f ", scale);
305 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () ); 305 drawContents ( &p, 0,0, contentsWidth (), contentsHeight () );
306 p.end(); 306 p.end();
307 qDebug("Why does it not print??? "); 307 qDebug("Why does it not print??? ");
308#endif 308#endif
309} 309}
310 310
311void ContactListView::setAlternateColor(const QColor &m_AlternateColor) 311void ContactListView::setAlternateColor(const QColor &m_AlternateColor)
312{ 312{
313 mAlternateColor = m_AlternateColor; 313 mAlternateColor = m_AlternateColor;
314} 314}
315 315
316void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect ) 316void ContactListView::paintEmptyArea( QPainter * p, const QRect & rect )
317{ 317{
318 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base); 318 QBrush b = palette().brush(QPalette::Active, QColorGroup::Base);
319 319
320 // Get the brush, which will have the background pixmap if there is one. 320 // Get the brush, which will have the background pixmap if there is one.
321 if (b.pixmap()) 321 if (b.pixmap())
322 { 322 {
323 p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(), 323 p->drawTiledPixmap( rect.left(), rect.top(), rect.width(), rect.height(),
324 *(b.pixmap()), 324 *(b.pixmap()),
325 rect.left() + contentsX(), 325 rect.left() + contentsX(),
326 rect.top() + contentsY() ); 326 rect.top() + contentsY() );
327 } 327 }
328 328
329 else 329 else
330 { 330 {
331 // Do a normal paint 331 // Do a normal paint
332 KListView::paintEmptyArea(p, rect); 332 KListView::paintEmptyArea(p, rect);
333 } 333 }
334} 334}
335 335
336void ContactListView::contentsMousePressEvent(QMouseEvent* e) 336void ContactListView::contentsMousePressEvent(QMouseEvent* e)
337{ 337{
338 presspos = e->pos(); 338 presspos = e->pos();
339 KListView::contentsMousePressEvent(e); 339 KListView::contentsMousePressEvent(e);
340} 340}
341 341
342 342
343// To initiate a drag operation 343// To initiate a drag operation
344void ContactListView::contentsMouseMoveEvent( QMouseEvent *e ) 344void ContactListView::contentsMouseMoveEvent( QMouseEvent *e )
345{ 345{
346 if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) { 346 if ((e->state() & LeftButton) && (e->pos() - presspos).manhattanLength() > 4 ) {
347 emit startAddresseeDrag(); 347 emit startAddresseeDrag();
348 } 348 }
349 else 349 else
350 KListView::contentsMouseMoveEvent( e ); 350 KListView::contentsMouseMoveEvent( e );
351} 351}
352 352
353bool ContactListView::acceptDrag(QDropEvent *e) const 353bool ContactListView::acceptDrag(QDropEvent *e) const
354{ 354{
355#ifndef KAB_EMBEDDED 355#ifndef KAB_EMBEDDED
356 return QTextDrag::canDecode(e); 356 return QTextDrag::canDecode(e);
357#else //KAB_EMBEDDED 357#else //KAB_EMBEDDED
358qDebug("ContactListView::acceptDrag has to be fixed"); 358qDebug("ContactListView::acceptDrag has to be fixed");
359 return false; 359 return false;
360#endif //KAB_EMBEDDED 360#endif //KAB_EMBEDDED
361} 361}
362 362
363void ContactListView::itemDropped(QDropEvent *e) 363void ContactListView::itemDropped(QDropEvent *e)
364{ 364{
365 contentsDropEvent(e); 365 contentsDropEvent(e);
366} 366}
367 367
368void ContactListView::contentsDropEvent( QDropEvent *e ) 368void ContactListView::contentsDropEvent( QDropEvent *e )
369{ 369{
370 emit addresseeDropped(e); 370 emit addresseeDropped(e);
371} 371}
372 372
373void ContactListView::setAlternateBackgroundEnabled(bool enabled) 373void ContactListView::setAlternateBackgroundEnabled(bool enabled)
374{ 374{
375 mABackground = enabled; 375 mABackground = enabled;
376 376
377 if (mABackground) 377 if (mABackground)
378 { 378 {
379 setAlternateBackground(mAlternateColor); 379 setAlternateBackground(mAlternateColor);
380 } 380 }
381 else 381 else
382 { 382 {
383 setAlternateBackground(QColor()); 383 setAlternateBackground(QColor());
384 } 384 }
385} 385}
386 386
387void ContactListView::setBackgroundPixmap(const QString &filename) 387void ContactListView::setBackgroundPixmap(const QString &filename)
388{ 388{
389 if (filename.isEmpty()) 389 if (filename.isEmpty())
390 { 390 {
391 unsetPalette(); 391 unsetPalette();
392 } 392 }
393 else 393 else
394 { 394 {
395 qDebug("ContactListView::setBackgroundPixmap has to be verified"); 395 qDebug("ContactListView::setBackgroundPixmap has to be verified");
396//US setPaletteBackgroundPixmap(QPixmap(filename)); 396//US setPaletteBackgroundPixmap(QPixmap(filename));
397 KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename)); 397 KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename));
398 } 398 }
399 399
400} 400}
401 401
402void ContactListView::keyPressEvent ( QKeyEvent * e ) 402void ContactListView::keyPressEvent ( QKeyEvent * e )
403{ 403{
404 if ( mFlagBlockKeyPressed ) 404 if ( mFlagBlockKeyPressed )
405 return; 405 return;
406 qApp->processEvents(); 406 qApp->processEvents();
407 if ( e->isAutoRepeat() && !mFlagKeyPressed ) { 407 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
408 e->accept(); 408 e->accept();
409 return; 409 return;
410 } 410 }
411 if (! e->isAutoRepeat() ) 411 if (! e->isAutoRepeat() )
412 mFlagKeyPressed = true; 412 mFlagKeyPressed = true;
413 KListView::keyPressEvent ( e ); 413 KListView::keyPressEvent ( e );
414} 414}
415void ContactListView::keyReleaseEvent ( QKeyEvent * e ) 415void ContactListView::keyReleaseEvent ( QKeyEvent * e )
416{ 416{
417 if ( mFlagBlockKeyPressed ) 417 if ( mFlagBlockKeyPressed )
418 return; 418 return;
419 if ( !e->isAutoRepeat() ) { 419 if ( !e->isAutoRepeat() ) {
420 mFlagBlockKeyPressed = true; 420 mFlagBlockKeyPressed = true;
421 qApp->processEvents(); 421 qApp->processEvents();
422 mFlagBlockKeyPressed = false; 422 mFlagBlockKeyPressed = false;
423 mFlagKeyPressed = false; 423 mFlagKeyPressed = false;
424 } 424 }
425 KListView::keyReleaseEvent ( e ); 425 KListView::keyReleaseEvent ( e );
426} 426}
427#ifndef KAB_EMBEDDED 427#ifndef KAB_EMBEDDED
428#include "contactlistview.moc" 428#include "contactlistview.moc"
429#endif //KAB_EMBEDDED 429#endif //KAB_EMBEDDED