Diffstat (limited to 'kaddressbook/views/kaddressbookcardview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | kaddressbook/views/kaddressbookcardview.cpp | 20 |
1 files changed, 18 insertions, 2 deletions
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 @@ -24,12 +24,13 @@ #include <qdragobject.h> #include <qevent.h> #include <qiconview.h> #include <qlayout.h> #include <qstringlist.h> #include <qregexp.h> +#include <qapplication.h> #include <kabc/addressbook.h> #include <kabc/addressee.h> #include <kconfig.h> #include <kdebug.h> #include <klocale.h> @@ -166,12 +167,23 @@ KAddressBookCardView::KAddressBookCardView( KABC::AddressBook *ab, } 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) { KAddressBookView::readConfig(config); // costum colors? if ( config->readBoolEntry( "EnableCustomColors", false ) ) @@ -287,14 +299,18 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) } } } } mCardView->viewport()->setUpdatesEnabled( true ); mCardView->viewport()->update(); - // by default nothing is selected - emit selected(QString::null); + if ( mCardView->firstItem() ) { + mCardView->setCurrentItem ( mCardView->firstItem() ); + mCardView->setSelected ( mCardView->firstItem() , true ); + } + else + emit selected(QString::null); } QStringList KAddressBookCardView::selectedUids() { QStringList uidList; CardViewItem *item; AddresseeCardViewItem *aItem; |