summaryrefslogtreecommitdiffabout
path: root/kaddressbook
Side-by-side diff
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,
const char *name )
: QWidget( parent, name ), mAddressBook( ab ), mFieldList()
{
-
+
initGUI();
}
@@ -181,6 +181,8 @@ ViewConfigureWidget *ViewFactory::configureWidget( KABC::AddressBook *ab,
return new ViewConfigureWidget( ab, parent, name );
}
+
+
#ifndef KAB_EMBEDDED
#include "kaddressbookview.moc"
#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
*/
void dropped( QDropEvent* );
- protected:
+ protected:
+
/**
Returns a list of the addressees that should be displayed. This method
should always be used by the subclass to get a list of addressees. This
@@ -304,7 +305,8 @@ class ViewFactory
const QStringList & )
{
return 0;
- }
+ }
+
};
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 @@
#include <qstyle.h>
#include <qcursor.h>
#include <qtooltip.h>
+#include <qapplication.h>
#include "kabprefs.h"
#include <kdebug.h>
@@ -639,6 +640,8 @@ CardView::CardView(QWidget *parent, const char *name)
: QScrollView(parent, name),
d(new CardViewPrivate())
{
+ mFlagKeyPressed = false;
+ mFlagBlockKeyPressed = false;
d->mItemList.setAutoDelete(true);
d->mSeparatorList.setAutoDelete(true);
@@ -1351,7 +1354,15 @@ void CardView::keyPressEvent( QKeyEvent *e )
e->ignore();
return;
}
-
+ if ( mFlagBlockKeyPressed )
+ return;
+ qApp->processEvents();
+ if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
+ e->accept();
+ return;
+ }
+ if (! e->isAutoRepeat() )
+ mFlagKeyPressed = true;
uint pos = d->mItemList.findRef( d->mCurrentItem );
CardViewItem *aItem = 0L; // item that gets the focus
CardViewItem *old = d->mCurrentItem;
@@ -1715,6 +1726,24 @@ void CardView::setMaxFieldLines( int howmany )
d->mMaxFieldLines = howmany ? howmany : INT_MAX;
// FIXME update, forcing the items to recalc height!!
}
+
+void CardView::keyReleaseEvent ( QKeyEvent * e )
+{
+ if ( mFlagBlockKeyPressed )
+ return;
+ if ( !e->isAutoRepeat() ) {
+ mFlagBlockKeyPressed = true;
+ qApp->processEvents();
+ mFlagBlockKeyPressed = false;
+ mFlagKeyPressed = false;
+ }
+ QScrollView::keyReleaseEvent ( e );
+}
+
+
+
+
+
//END Cardview
#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
*/
void returnPressed( CardViewItem * );
- protected:
+ protected:
+ bool mFlagKeyPressed;
+ bool mFlagBlockKeyPressed;
+ virtual void keyPressEvent ( QKeyEvent * );
+ virtual void keyReleaseEvent ( QKeyEvent * );
/** Determines which cards intersect that region and tells them to paint
* themselves.
*/
@@ -444,7 +448,6 @@ class CardView : public QScrollView
virtual void focusInEvent( QFocusEvent * );
virtual void focusOutEvent( QFocusEvent * );
- virtual void keyPressEvent( QKeyEvent * );
/** Overload this method to be told when a drag should be started.
* 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 @@
#include <qpainter.h>
#include <qbrush.h>
#include <qevent.h>
+#include <qapplication.h>
#include <klocale.h>
#include <kglobalsettings.h>
@@ -248,6 +249,8 @@ ContactListView::ContactListView(KAddressBookTableView *view,
pabWidget( view ),
oldColumn( 0 )
{
+ mFlagBlockKeyPressed = false;
+ mFlagKeyPressed = false;
mABackground = true;
mSingleLine = false;
mToolTips = true;
@@ -395,6 +398,32 @@ void ContactListView::setBackgroundPixmap(const QString &filename)
}
}
+
+void ContactListView::keyPressEvent ( QKeyEvent * e )
+{
+ if ( mFlagBlockKeyPressed )
+ return;
+ qApp->processEvents();
+ if ( e->isAutoRepeat() && !mFlagKeyPressed ) {
+ e->accept();
+ return;
+ }
+ if (! e->isAutoRepeat() )
+ mFlagKeyPressed = true;
+ KListView::keyPressEvent ( e );
+}
+void ContactListView::keyReleaseEvent ( QKeyEvent * e )
+{
+ if ( mFlagBlockKeyPressed )
+ return;
+ if ( !e->isAutoRepeat() ) {
+ mFlagBlockKeyPressed = true;
+ qApp->processEvents();
+ mFlagBlockKeyPressed = false;
+ mFlagKeyPressed = false;
+ }
+ KListView::keyReleaseEvent ( e );
+}
#ifndef KAB_EMBEDDED
#include "contactlistview.moc"
#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:
void setBackgroundPixmap(const QString &filename);
protected:
+ bool mFlagKeyPressed;
+ bool mFlagBlockKeyPressed;
+ virtual void keyPressEvent ( QKeyEvent * );
+ virtual void keyReleaseEvent ( QKeyEvent * );
/** Paints the background pixmap in the empty area. This method is needed
* since Qt::FixedPixmap will not scroll with the list view.
*/
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()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
QApplication::postEvent( mCardView, ev );
+ ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
+ QApplication::postEvent( mCardView, ev );
}
void KAddressBookCardView::scrollDOWN()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
QApplication::postEvent( mCardView, ev );
+ ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
+ QApplication::postEvent( mCardView, ev );
}
void KAddressBookCardView::readConfig(KConfig *config)
{
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()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 );
QApplication::postEvent( mListView, ev );
+ ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Up, 0,0 );
+ QApplication::postEvent( mListView, ev );
}
void KAddressBookTableView::scrollDOWN()
{
QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 );
QApplication::postEvent( mListView, ev );
+ ev = new QKeyEvent ( QEvent::KeyRelease, Qt::Key_Down, 0,0 );
+ QApplication::postEvent( mListView, ev );
}
void KAddressBookTableView::reconstructListView()
{