summaryrefslogtreecommitdiffabout
path: root/kaddressbook
authorzautrix <zautrix>2005-03-30 23:17:42 (UTC)
committer zautrix <zautrix>2005-03-30 23:17:42 (UTC)
commit529c0fb8a8bf15e7bd375ddeb355c5802baf4c93 (patch) (unidiff)
tree72ebca6de7e54f2cf89d3d6df61d3b40aa66a444 /kaddressbook
parent28ac86e2efbc10f210dbd2d5ac0053f4e6198d57 (diff)
downloadkdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.zip
kdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.tar.gz
kdepimpi-529c0fb8a8bf15e7bd375ddeb355c5802baf4c93.tar.bz2
key fix
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
@@ -43,7 +43,7 @@ KAddressBookView::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
@@ -181,6 +181,8 @@ ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab,
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
@@ -230,7 +230,8 @@ class KAddressBookView : public QWidget
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
@@ -304,7 +305,8 @@ class ViewFactory
304 const QStringList & ) 305 const QStringList & )
305 { 306 {
306 return 0; 307 return 0;
307 } 308 }
309
308 310
309}; 311};
310 312
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
@@ -33,6 +33,7 @@
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>
@@ -639,6 +640,8 @@ CardView::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
@@ -1351,7 +1354,15 @@ void CardView::keyPressEvent( QKeyEvent *e )
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;
@@ -1715,6 +1726,24 @@ void CardView::setMaxFieldLines( int howmany )
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
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
@@ -405,7 +405,11 @@ class CardView : public QScrollView
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 */
@@ -444,7 +448,6 @@ class CardView : public QScrollView
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
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
@@ -29,6 +29,7 @@
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>
@@ -248,6 +249,8 @@ ContactListView::ContactListView(KAddressBookTableView *view,
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;
@@ -395,6 +398,32 @@ void ContactListView::setBackgroundPixmap(const QString &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
@@ -92,6 +92,10 @@ public:
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 */
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
@@ -208,12 +208,16 @@ void 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{
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
@@ -61,11 +61,15 @@ void 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{