summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Unidiff
Diffstat (limited to 'kaddressbook') (more/less context) (ignore whitespace changes)
-rw-r--r--kaddressbook/kaddressbookview.cpp4
-rw-r--r--kaddressbook/kaddressbookview.h6
-rw-r--r--kaddressbook/views/cardview.cpp31
-rw-r--r--kaddressbook/views/cardview.h7
-rw-r--r--kaddressbook/views/contactlistview.cpp29
-rw-r--r--kaddressbook/views/contactlistview.h4
-rw-r--r--kaddressbook/views/kaddressbookcardview.cpp4
-rw-r--r--kaddressbook/views/kaddressbooktableview.cpp4
8 files changed, 83 insertions, 6 deletions
diff --git a/kaddressbook/kaddressbookview.cpp b/kaddressbook/kaddressbookview.cpp
index 09859c2..86898e2 100644
--- a/kaddressbook/kaddressbookview.cpp
+++ b/kaddressbook/kaddressbookview.cpp
@@ -40,13 +40,13 @@
40#include "kaddressbookview.h" 40#include "kaddressbookview.h"
41 41
42KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent, 42KAddressBookView::KAddressBookView( KABC::AddressBook *ab, QWidget *parent,
43 const char *name ) 43 const char *name )
44 : QWidget( parent, name ), mAddressBook( ab ), mFieldList() 44 : QWidget( parent, name ), mAddressBook( ab ), mFieldList()
45{ 45{
46 46
47 initGUI(); 47 initGUI();
48} 48}
49 49
50KAddressBookView::~KAddressBookView() 50KAddressBookView::~KAddressBookView()
51{ 51{
52 52
@@ -178,9 +178,11 @@ ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab,
178 QWidget *parent, 178 QWidget *parent,
179 const char *name ) 179 const char *name )
180{ 180{
181 return new ViewConfigureWidget( ab, parent, name ); 181 return new ViewConfigureWidget( ab, parent, name );
182} 182}
183 183
184
185
184#ifndef KAB_EMBEDDED 186#ifndef KAB_EMBEDDED
185#include "kaddressbookview.moc" 187#include "kaddressbookview.moc"
186#endif //KAB_EMBEDDED 188#endif //KAB_EMBEDDED
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h
index 6bbb9c2..3a3f71a 100644
--- a/kaddressbook/kaddressbookview.h
+++ b/kaddressbook/kaddressbookview.h
@@ -227,13 +227,14 @@ class KAddressBookView : public QWidget
227 This signal is emitted whenever the user drops something on the 227 This signal is emitted whenever the user drops something on the
228 view. The individual view should handle checking if the item is 228 view. The individual view should handle checking if the item is
229 droppable (ie: if it is a vcard). 229 droppable (ie: if it is a vcard).
230 */ 230 */
231 void dropped( QDropEvent* ); 231 void dropped( QDropEvent* );
232 232
233 protected: 233 protected:
234
234 /** 235 /**
235 Returns a list of the addressees that should be displayed. This method 236 Returns a list of the addressees that should be displayed. This method
236 should always be used by the subclass to get a list of addressees. This 237 should always be used by the subclass to get a list of addressees. This
237 method internally takes many factors into account, including the current 238 method internally takes many factors into account, including the current
238 filter. 239 filter.
239 */ 240 */
@@ -301,12 +302,13 @@ class ViewFactory
301 302
302 protected: 303 protected:
303 virtual QObject* createObject( QObject*, const char*, const char*, 304 virtual QObject* createObject( QObject*, const char*, const char*,
304 const QStringList & ) 305 const QStringList & )
305 { 306 {
306 return 0; 307 return 0;
307 } 308 }
309
308 310
309}; 311};
310 312
311 313
312#endif 314#endif
diff --git a/kaddressbook/views/cardview.cpp b/kaddressbook/views/cardview.cpp
index 03df444..84d3116 100644
--- a/kaddressbook/views/cardview.cpp
+++ b/kaddressbook/views/cardview.cpp
@@ -30,12 +30,13 @@
30#include <qtimer.h> 30#include <qtimer.h>
31#include <qdatetime.h> 31#include <qdatetime.h>
32#include <qlabel.h> 32#include <qlabel.h>
33#include <qstyle.h> 33#include <qstyle.h>
34#include <qcursor.h> 34#include <qcursor.h>
35#include <qtooltip.h> 35#include <qtooltip.h>
36#include <qapplication.h>
36 37
37#include "kabprefs.h" 38#include "kabprefs.h"
38#include <kdebug.h> 39#include <kdebug.h>
39#include <kglobalsettings.h> 40#include <kglobalsettings.h>
40//END includes 41//END includes
41 42
@@ -636,12 +637,14 @@ CardViewItem::Field *CardViewItem::fieldAt( const QPoint & itempos ) const
636//BEGIN CardView 637//BEGIN CardView
637 638
638CardView::CardView(QWidget *parent, const char *name) 639CardView::CardView(QWidget *parent, const char *name)
639 : QScrollView(parent, name), 640 : QScrollView(parent, name),
640 d(new CardViewPrivate()) 641 d(new CardViewPrivate())
641{ 642{
643 mFlagKeyPressed = false;
644 mFlagBlockKeyPressed = false;
642 d->mItemList.setAutoDelete(true); 645 d->mItemList.setAutoDelete(true);
643 d->mSeparatorList.setAutoDelete(true); 646 d->mSeparatorList.setAutoDelete(true);
644 647
645 QFont f = font(); 648 QFont f = font();
646 d->mFm = new QFontMetrics(f); 649 d->mFm = new QFontMetrics(f);
647 f.setBold(true); 650 f.setBold(true);
@@ -1348,13 +1351,21 @@ void CardView::keyPressEvent( QKeyEvent *e )
1348{ 1351{
1349 if ( ! ( childCount() && d->mCurrentItem ) ) 1352 if ( ! ( childCount() && d->mCurrentItem ) )
1350 { 1353 {
1351 e->ignore(); 1354 e->ignore();
1352 return; 1355 return;
1353 } 1356 }
1354 1357 if ( mFlagBlockKeyPressed )
1358 return;
1359 qApp->processEvents();
1360 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
1361 e->accept();
1362 return;
1363 }
1364 if (! e->isAutoRepeat() )
1365 mFlagKeyPressed = true;
1355 uint pos = d->mItemList.findRef( d->mCurrentItem ); 1366 uint pos = d->mItemList.findRef( d->mCurrentItem );
1356 CardViewItem *aItem = 0L; // item that gets the focus 1367 CardViewItem *aItem = 0L; // item that gets the focus
1357 CardViewItem *old = d->mCurrentItem; 1368 CardViewItem *old = d->mCurrentItem;
1358 1369
1359 switch ( e->key() ) 1370 switch ( e->key() )
1360 { 1371 {
@@ -1712,11 +1723,29 @@ int CardView::maxFieldLines() const
1712 1723
1713void CardView::setMaxFieldLines( int howmany ) 1724void CardView::setMaxFieldLines( int howmany )
1714{ 1725{
1715 d->mMaxFieldLines = howmany ? howmany : INT_MAX; 1726 d->mMaxFieldLines = howmany ? howmany : INT_MAX;
1716 // FIXME update, forcing the items to recalc height!! 1727 // FIXME update, forcing the items to recalc height!!
1717} 1728}
1729
1730void CardView::keyReleaseEvent ( QKeyEvent * e )
1731{
1732 if ( mFlagBlockKeyPressed )
1733 return;
1734 if ( !e->isAutoRepeat() ) {
1735 mFlagBlockKeyPressed = true;
1736 qApp->processEvents();
1737 mFlagBlockKeyPressed = false;
1738 mFlagKeyPressed = false;
1739 }
1740 QScrollView::keyReleaseEvent ( e );
1741}
1742
1743
1744
1745
1746
1718//END Cardview 1747//END Cardview
1719 1748
1720#ifndef KAB_EMBEDDED 1749#ifndef KAB_EMBEDDED
1721#include "cardview.moc" 1750#include "cardview.moc"
1722#endif //KAB_EMBEDDED 1751#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/cardview.h b/kaddressbook/views/cardview.h
index 37dddb6..2ea3771 100644
--- a/kaddressbook/views/cardview.h
+++ b/kaddressbook/views/cardview.h
@@ -402,13 +402,17 @@ class CardView : public QScrollView
402 void currentChanged( CardViewItem * ); 402 void currentChanged( CardViewItem * );
403 403
404 /** Emitted when the return key is pressed in an item. 404 /** Emitted when the return key is pressed in an item.
405 */ 405 */
406 void returnPressed( CardViewItem * ); 406 void returnPressed( CardViewItem * );
407 407
408 protected: 408 protected:
409 bool mFlagKeyPressed;
410 bool mFlagBlockKeyPressed;
411 virtual void keyPressEvent ( QKeyEvent * );
412 virtual void keyReleaseEvent ( QKeyEvent * );
409 /** Determines which cards intersect that region and tells them to paint 413 /** Determines which cards intersect that region and tells them to paint
410 * themselves. 414 * themselves.
411 */ 415 */
412 void drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph); 416 void drawContents(QPainter *p, int clipx, int clipy, int clipw, int cliph);
413 417
414 /** Sets the layout to dirty and repaints. 418 /** Sets the layout to dirty and repaints.
@@ -441,13 +445,12 @@ class CardView : public QScrollView
441 virtual void enterEvent( QEvent * ); 445 virtual void enterEvent( QEvent * );
442 virtual void leaveEvent( QEvent * ); 446 virtual void leaveEvent( QEvent * );
443 447
444 virtual void focusInEvent( QFocusEvent * ); 448 virtual void focusInEvent( QFocusEvent * );
445 virtual void focusOutEvent( QFocusEvent * ); 449 virtual void focusOutEvent( QFocusEvent * );
446 450
447 virtual void keyPressEvent( QKeyEvent * );
448 451
449 /** Overload this method to be told when a drag should be started. 452 /** Overload this method to be told when a drag should be started.
450 * In most cases you will want to start a drag event with the currently 453 * In most cases you will want to start a drag event with the currently
451 * selected item. 454 * selected item.
452 */ 455 */
453 virtual void startDrag(); 456 virtual void startDrag();
diff --git a/kaddressbook/views/contactlistview.cpp b/kaddressbook/views/contactlistview.cpp
index e75810e..09d9c03 100644
--- a/kaddressbook/views/contactlistview.cpp
+++ b/kaddressbook/views/contactlistview.cpp
@@ -26,12 +26,13 @@
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 33
33#include <klocale.h> 34#include <klocale.h>
34#include <kglobalsettings.h> 35#include <kglobalsettings.h>
35#include <kiconloader.h> 36#include <kiconloader.h>
36#include <kdebug.h> 37#include <kdebug.h>
37#include <kconfig.h> 38#include <kconfig.h>
@@ -245,12 +246,14 @@ ContactListView::ContactListView(KAddressBookTableView *view,
245 QWidget *parent, 246 QWidget *parent,
246 const char *name ) 247 const char *name )
247 : KListView( parent, name ), 248 : KListView( parent, name ),
248 pabWidget( view ), 249 pabWidget( view ),
249 oldColumn( 0 ) 250 oldColumn( 0 )
250{ 251{
252 mFlagBlockKeyPressed = false;
253 mFlagKeyPressed = false;
251 mABackground = true; 254 mABackground = true;
252 mSingleLine = false; 255 mSingleLine = false;
253 mToolTips = true; 256 mToolTips = true;
254#ifndef KAB_EMBEDDED 257#ifndef KAB_EMBEDDED
255 mAlternateColor = KGlobalSettings::alternateBackgroundColor(); 258 mAlternateColor = KGlobalSettings::alternateBackgroundColor();
256#else //KAB_EMBEDDED 259#else //KAB_EMBEDDED
@@ -392,9 +395,35 @@ void ContactListView::setBackgroundPixmap(const QString &filename)
392 qDebug("ContactListView::setBackgroundPixmap has to be verified"); 395 qDebug("ContactListView::setBackgroundPixmap has to be verified");
393//US setPaletteBackgroundPixmap(QPixmap(filename)); 396//US setPaletteBackgroundPixmap(QPixmap(filename));
394 KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename)); 397 KListView::setBackgroundPixmap((const QPixmap&)QPixmap(filename));
395 } 398 }
396 399
397} 400}
401
402void ContactListView::keyPressEvent ( QKeyEvent * e )
403{
404 if ( mFlagBlockKeyPressed )
405 return;
406 qApp->processEvents();
407 if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
408 e->accept();
409 return;
410 }
411 if (! e->isAutoRepeat() )
412 mFlagKeyPressed = true;
413 KListView::keyPressEvent ( e );
414}
415void ContactListView::keyReleaseEvent ( QKeyEvent * e )
416{
417 if ( mFlagBlockKeyPressed )
418 return;
419 if ( !e->isAutoRepeat() ) {
420 mFlagBlockKeyPressed = true;
421 qApp->processEvents();
422 mFlagBlockKeyPressed = false;
423 mFlagKeyPressed = false;
424 }
425 KListView::keyReleaseEvent ( e );
426}
398#ifndef KAB_EMBEDDED 427#ifndef KAB_EMBEDDED
399#include "contactlistview.moc" 428#include "contactlistview.moc"
400#endif //KAB_EMBEDDED 429#endif //KAB_EMBEDDED
diff --git a/kaddressbook/views/contactlistview.h b/kaddressbook/views/contactlistview.h
index 9d1a672..46477e1 100644
--- a/kaddressbook/views/contactlistview.h
+++ b/kaddressbook/views/contactlistview.h
@@ -89,12 +89,16 @@ public:
89 * QString is empty (QString::isEmpty()), then the background 89 * QString is empty (QString::isEmpty()), then the background
90 * pixmap will be disabled. 90 * pixmap will be disabled.
91 */ 91 */
92 void setBackgroundPixmap(const QString &filename); 92 void setBackgroundPixmap(const QString &filename);
93 93
94protected: 94protected:
95 bool mFlagKeyPressed;
96 bool mFlagBlockKeyPressed;
97 virtual void keyPressEvent ( QKeyEvent * );
98 virtual void keyReleaseEvent ( QKeyEvent * );
95 /** Paints the background pixmap in the empty area. This method is needed 99 /** Paints the background pixmap in the empty area. This method is needed
96 * since Qt::FixedPixmap will not scroll with the list view. 100 * since Qt::FixedPixmap will not scroll with the list view.
97 */ 101 */
98 virtual void paintEmptyArea( QPainter * p, const QRect & rect ); 102 virtual void paintEmptyArea( QPainter * p, const QRect & rect );
99 virtual void contentsMousePressEvent(QMouseEvent*); 103 virtual void contentsMousePressEvent(QMouseEvent*);
100 void contentsMouseMoveEvent( QMouseEvent *e ); 104 void contentsMouseMoveEvent( QMouseEvent *e );
diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp
index cce68b9..9c35fd6 100644
--- a/kaddressbook/views/kaddressbookcardview.cpp
+++ b/kaddressbook/views/kaddressbookcardview.cpp
@@ -205,18 +205,22 @@ void KAddressBookCardView::setFocusAV()
205 205
206} 206}
207void KAddressBookCardView::scrollUP() 207void KAddressBookCardView::scrollUP()
208{ 208{
209 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 209 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
210 QApplication::postEvent( mCardView, ev ); 210 QApplication::postEvent( mCardView, ev );
211 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
212 QApplication::postEvent( mCardView, ev );
211 213
212} 214}
213void KAddressBookCardView::scrollDOWN() 215void KAddressBookCardView::scrollDOWN()
214{ 216{
215 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 217 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
216 QApplication::postEvent( mCardView, ev ); 218 QApplication::postEvent( mCardView, ev );
219 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
220 QApplication::postEvent( mCardView, ev );
217} 221}
218void KAddressBookCardView::readConfig(KConfig *config) 222void KAddressBookCardView::readConfig(KConfig *config)
219{ 223{
220 KAddressBookView::readConfig(config); 224 KAddressBookView::readConfig(config);
221 225
222 // costum colors? 226 // costum colors?
diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp
index f4b008c..e322473 100644
--- a/kaddressbook/views/kaddressbooktableview.cpp
+++ b/kaddressbook/views/kaddressbooktableview.cpp
@@ -58,17 +58,21 @@ void KAddressBookTableView::setFocusAV()
58 58
59} 59}
60void KAddressBookTableView::scrollUP() 60void KAddressBookTableView::scrollUP()
61{ 61{
62 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); 62 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
63 QApplication::postEvent( mListView, ev ); 63 QApplication::postEvent( mListView, ev );
64 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
65 QApplication::postEvent( mListView, ev );
64} 66}
65void KAddressBookTableView::scrollDOWN() 67void KAddressBookTableView::scrollDOWN()
66{ 68{
67 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); 69 QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
68 QApplication::postEvent( mListView, ev ); 70 QApplication::postEvent( mListView, ev );
71 ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
72 QApplication::postEvent( mListView, ev );
69} 73}
70void KAddressBookTableView::reconstructListView() 74void KAddressBookTableView::reconstructListView()
71{ 75{
72 if (mListView) 76 if (mListView)
73 { 77 {
74 disconnect(mListView, SIGNAL(selectionChanged()), 78 disconnect(mListView, SIGNAL(selectionChanged()),