-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 6 | ||||
-rw-r--r-- | kaddressbook/incsearchwidget.h | 2 | ||||
-rw-r--r-- | kaddressbook/kabcore.cpp | 3 | ||||
-rw-r--r-- | kaddressbook/kaddressbookview.h | 2 | ||||
-rw-r--r-- | kaddressbook/viewmanager.cpp | 11 | ||||
-rw-r--r-- | kaddressbook/viewmanager.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 18 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.cpp | 17 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbookiconview.h | 2 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.cpp | 16 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.h | 2 | ||||
-rw-r--r-- | microkde/klineedit.h | 25 |
13 files changed, 103 insertions, 5 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 3533427..78eaf65 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp @@ -83,2 +83,8 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) + + + connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); + connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); + + setFocusProxy( mSearchText ); diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h index 5c95438..1546a51 100644 --- a/kaddressbook/incsearchwidget.h +++ b/kaddressbook/incsearchwidget.h @@ -50,2 +50,4 @@ class IncSearchWidget : public QWidget signals: + void scrollUP(); + void scrollDOWN(); /** diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index cd261f6..f2d4cd6 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp @@ -1675,3 +1675,4 @@ void KABCore::initGUI() SLOT( incrementalSearch( const QString& ) ) ); - + connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); + connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 17106e8..c134e96 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h @@ -67,2 +67,4 @@ class KAddressBookView : public QWidget virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; + virtual void scrollUP() = 0; + virtual void scrollDOWN() = 0; diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index c6baeac..f4fb08b 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp @@ -87,3 +87,12 @@ ViewManager::~ViewManager() } - +void ViewManager::scrollUP() +{ + if ( mActiveView ) + mActiveView->scrollUP(); +} +void ViewManager::scrollDOWN() +{ + if ( mActiveView ) + mActiveView->scrollDOWN(); +} void ViewManager::restoreSettings() diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 6def6b6..585f4e9 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h @@ -68,2 +68,4 @@ class ViewManager : public QWidget public slots: + void scrollUP(); + void scrollDOWN(); diff --git a/kaddressbook/views/kaddressbookcardview.cpp b/kaddressbook/views/kaddressbookcardview.cpp index 4babf67..a7bf6c9 100644 --- a/kaddressbook/views/kaddressbookcardview.cpp +++ b/kaddressbook/views/kaddressbookcardview.cpp @@ -29,2 +29,3 @@ #include <qregexp.h> +#include <qapplication.h> @@ -171,2 +172,13 @@ KAddressBookCardView::~KAddressBookCardView() +void KAddressBookCardView::scrollUP() +{ + QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, 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 ); +} void KAddressBookCardView::readConfig(KConfig *config) @@ -292,3 +304,7 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) mCardView->viewport()->update(); - // by default nothing is selected + if ( mCardView->firstItem() ) { + mCardView->setCurrentItem ( mCardView->firstItem() ); + mCardView->setSelected ( mCardView->firstItem() , true ); + } + else emit selected(QString::null); diff --git a/kaddressbook/views/kaddressbookcardview.h b/kaddressbook/views/kaddressbookcardview.h index b8efb01..45a9781 100644 --- a/kaddressbook/views/kaddressbookcardview.h +++ b/kaddressbook/views/kaddressbookcardview.h @@ -62,2 +62,4 @@ class KAddressBookCardView : public KAddressBookView virtual void writeConfig(KConfig *); + virtual void scrollUP(); + virtual void scrollDOWN(); diff --git a/kaddressbook/views/kaddressbookiconview.cpp b/kaddressbook/views/kaddressbookiconview.cpp index fdc0db9..f4c68b8 100644 --- a/kaddressbook/views/kaddressbookiconview.cpp +++ b/kaddressbook/views/kaddressbookiconview.cpp @@ -43,2 +43,3 @@ #include <qregexp.h> +#include <qapplication.h> #include <kglobal.h> @@ -213,2 +214,12 @@ KAddressBookIconView::~KAddressBookIconView() +void KAddressBookIconView::scrollUP() +{ + QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); + QApplication::postEvent( mIconView, ev ); +} +void KAddressBookIconView::scrollDOWN() +{ + QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); + QApplication::postEvent( mIconView, ev ); +} void KAddressBookIconView::readConfig(KConfig *config) @@ -282,2 +293,8 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) mIconView->arrangeItemsInGrid( true ); + if ( mIconView->firstItem() ) { + mIconView->setCurrentItem ( mIconView->firstItem() ); + mIconView->setSelected ( mIconView->firstItem() , true ); + } + else + emit selected(QString::null); } diff --git a/kaddressbook/views/kaddressbookiconview.h b/kaddressbook/views/kaddressbookiconview.h index 963ee7c..acfcd71 100644 --- a/kaddressbook/views/kaddressbookiconview.h +++ b/kaddressbook/views/kaddressbookiconview.h @@ -63,2 +63,4 @@ class KAddressBookIconView : public KAddressBookView virtual void readConfig(KConfig *config); + virtual void scrollUP(); + virtual void scrollDOWN(); diff --git a/kaddressbook/views/kaddressbooktableview.cpp b/kaddressbook/views/kaddressbooktableview.cpp index fbfddba..2412170 100644 --- a/kaddressbook/views/kaddressbooktableview.cpp +++ b/kaddressbook/views/kaddressbooktableview.cpp @@ -53,3 +53,12 @@ KAddressBookTableView::~KAddressBookTableView() } - +void KAddressBookTableView::scrollUP() +{ + QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, 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 ); +} void KAddressBookTableView::reconstructListView() @@ -161,2 +170,7 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) mListView->repaint(); + if ( mListView->firstChild() ) { + mListView->setCurrentItem ( mListView->firstChild() ); + mListView->setSelected ( mListView->firstChild(), true ); + } + else emit selected(QString::null); diff --git a/kaddressbook/views/kaddressbooktableview.h b/kaddressbook/views/kaddressbooktableview.h index ecfe7a1..865f8d5 100644 --- a/kaddressbook/views/kaddressbooktableview.h +++ b/kaddressbook/views/kaddressbooktableview.h @@ -65,2 +65,4 @@ friend class ContactListView; void doSearch( const QString& s ,KABC::Field *field ); + virtual void scrollUP(); + virtual void scrollDOWN(); diff --git a/microkde/klineedit.h b/microkde/klineedit.h index 65e2f59..70c72d1 100644 --- a/microkde/klineedit.h +++ b/microkde/klineedit.h @@ -12,5 +12,9 @@ class KLineEdit : public QLineEdit { + + Q_OBJECT + public: KLineEdit( QWidget *parent=0, const char *name=0 ) : - QLineEdit( parent, name ) { + QLineEdit( parent, name ) + { #ifndef DESKTOP_VERSION @@ -19,4 +23,23 @@ class KLineEdit : public QLineEdit } + void keyPressEvent ( QKeyEvent * e) + { + switch ( e->key() ) { + case Qt::Key_Down: + emit scrollDOWN(); + e->accept(); + break; + case Qt::Key_Up: + emit scrollUP(); + e->accept(); + break; + default: + QLineEdit::keyPressEvent ( e ); + break; + } + } void setTrapReturnKey( bool ) {} + signals: + void scrollUP(); + void scrollDOWN(); }; |