-rw-r--r-- | kaddressbook/incsearchwidget.cpp | 8 | ||||
-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 | 20 | ||||
-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 | 18 | ||||
-rw-r--r-- | kaddressbook/views/kaddressbooktableview.h | 2 |
12 files changed, 82 insertions, 7 deletions
diff --git a/kaddressbook/incsearchwidget.cpp b/kaddressbook/incsearchwidget.cpp index 3533427..78eaf65 100644 --- a/kaddressbook/incsearchwidget.cpp +++ b/kaddressbook/incsearchwidget.cpp | |||
@@ -81,6 +81,12 @@ IncSearchWidget::IncSearchWidget( QWidget *parent, const char *name ) | |||
81 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), | 81 | connect( mFieldCombo, SIGNAL( activated( const QString& ) ), |
82 | SLOT( announceFieldChanged() ) ); | 82 | SLOT( announceFieldChanged() ) ); |
83 | 83 | ||
84 | |||
85 | |||
86 | connect( mSearchText, SIGNAL( scrollUP() ), this, SIGNAL( scrollUP() )); | ||
87 | connect( mSearchText, SIGNAL( scrollDOWN() ), this, SIGNAL( scrollDOWN() )); | ||
88 | |||
89 | |||
84 | setFocusProxy( mSearchText ); | 90 | setFocusProxy( mSearchText ); |
85 | } | 91 | } |
86 | 92 | ||
@@ -96,7 +102,7 @@ void IncSearchWidget::announceDoSearch2() | |||
96 | //qDebug("emit dosreach "); | 102 | //qDebug("emit dosreach "); |
97 | } | 103 | } |
98 | 104 | ||
99 | void IncSearchWidget::announceDoSearch() | 105 | void IncSearchWidget::announceDoSearch() |
100 | { | 106 | { |
101 | 107 | ||
102 | emit doSearch( mSearchText->text() ); | 108 | emit doSearch( mSearchText->text() ); |
diff --git a/kaddressbook/incsearchwidget.h b/kaddressbook/incsearchwidget.h index 5c95438..1546a51 100644 --- a/kaddressbook/incsearchwidget.h +++ b/kaddressbook/incsearchwidget.h | |||
@@ -48,6 +48,8 @@ class IncSearchWidget : public QWidget | |||
48 | int currentItem() const; | 48 | int currentItem() const; |
49 | 49 | ||
50 | signals: | 50 | signals: |
51 | void scrollUP(); | ||
52 | void scrollDOWN(); | ||
51 | /** | 53 | /** |
52 | This signal is emmited whenever the text in the input | 54 | This signal is emmited whenever the text in the input |
53 | widget is changed. You can get the sorting field by | 55 | widget is changed. You can get the sorting field by |
diff --git a/kaddressbook/kabcore.cpp b/kaddressbook/kabcore.cpp index cd261f6..f2d4cd6 100644 --- a/kaddressbook/kabcore.cpp +++ b/kaddressbook/kabcore.cpp | |||
@@ -1673,7 +1673,8 @@ void KABCore::initGUI() | |||
1673 | // mIncSearchWidget->hide(); | 1673 | // mIncSearchWidget->hide(); |
1674 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), | 1674 | connect( mIncSearchWidget, SIGNAL( doSearch( const QString& ) ), |
1675 | SLOT( incrementalSearch( const QString& ) ) ); | 1675 | SLOT( incrementalSearch( const QString& ) ) ); |
1676 | 1676 | connect( mIncSearchWidget, SIGNAL( scrollUP() ),mViewManager, SLOT( scrollUP() ) ); | |
1677 | connect( mIncSearchWidget, SIGNAL( scrollDOWN() ),mViewManager, SLOT( scrollDOWN() ) ); | ||
1677 | 1678 | ||
1678 | mJumpButtonBar = new JumpButtonBar( this, this ); | 1679 | mJumpButtonBar = new JumpButtonBar( this, this ); |
1679 | 1680 | ||
diff --git a/kaddressbook/kaddressbookview.h b/kaddressbook/kaddressbookview.h index 17106e8..c134e96 100644 --- a/kaddressbook/kaddressbookview.h +++ b/kaddressbook/kaddressbookview.h | |||
@@ -65,6 +65,8 @@ class KAddressBookView : public QWidget | |||
65 | */ | 65 | */ |
66 | virtual QStringList selectedUids() = 0; | 66 | virtual QStringList selectedUids() = 0; |
67 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; | 67 | virtual void doSearch( const QString& s ,KABC::Field *field ) = 0; |
68 | virtual void scrollUP() = 0; | ||
69 | virtual void scrollDOWN() = 0; | ||
68 | 70 | ||
69 | /** | 71 | /** |
70 | Called whenever this view should read the config. This can be used | 72 | Called whenever this view should read the config. This can be used |
diff --git a/kaddressbook/viewmanager.cpp b/kaddressbook/viewmanager.cpp index c6baeac..f4fb08b 100644 --- a/kaddressbook/viewmanager.cpp +++ b/kaddressbook/viewmanager.cpp | |||
@@ -85,7 +85,16 @@ ViewManager::~ViewManager() | |||
85 | unloadViews(); | 85 | unloadViews(); |
86 | mViewFactoryDict.clear(); | 86 | mViewFactoryDict.clear(); |
87 | } | 87 | } |
88 | 88 | void ViewManager::scrollUP() | |
89 | { | ||
90 | if ( mActiveView ) | ||
91 | mActiveView->scrollUP(); | ||
92 | } | ||
93 | void ViewManager::scrollDOWN() | ||
94 | { | ||
95 | if ( mActiveView ) | ||
96 | mActiveView->scrollDOWN(); | ||
97 | } | ||
89 | void ViewManager::restoreSettings() | 98 | void ViewManager::restoreSettings() |
90 | { | 99 | { |
91 | mViewNameList = KABPrefs::instance()->mViewNames; | 100 | mViewNameList = KABPrefs::instance()->mViewNames; |
diff --git a/kaddressbook/viewmanager.h b/kaddressbook/viewmanager.h index 6def6b6..585f4e9 100644 --- a/kaddressbook/viewmanager.h +++ b/kaddressbook/viewmanager.h | |||
@@ -66,6 +66,8 @@ class ViewManager : public QWidget | |||
66 | void setListSelected(QStringList); | 66 | void setListSelected(QStringList); |
67 | 67 | ||
68 | public slots: | 68 | public slots: |
69 | void scrollUP(); | ||
70 | void scrollDOWN(); | ||
69 | 71 | ||
70 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); | 72 | //US void setSelected( const QString &uid = QString::null, bool selected = true ); |
71 | void setSelected( const QString &uid, bool); | 73 | void setSelected( const QString &uid, bool); |
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 | |||
@@ -27,6 +27,7 @@ | |||
27 | #include <qlayout.h> | 27 | #include <qlayout.h> |
28 | #include <qstringlist.h> | 28 | #include <qstringlist.h> |
29 | #include <qregexp.h> | 29 | #include <qregexp.h> |
30 | #include <qapplication.h> | ||
30 | 31 | ||
31 | #include <kabc/addressbook.h> | 32 | #include <kabc/addressbook.h> |
32 | #include <kabc/addressee.h> | 33 | #include <kabc/addressee.h> |
@@ -169,6 +170,17 @@ KAddressBookCardView::~KAddressBookCardView() | |||
169 | { | 170 | { |
170 | } | 171 | } |
171 | 172 | ||
173 | void KAddressBookCardView::scrollUP() | ||
174 | { | ||
175 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | ||
176 | QApplication::postEvent( mCardView, ev ); | ||
177 | |||
178 | } | ||
179 | void KAddressBookCardView::scrollDOWN() | ||
180 | { | ||
181 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | ||
182 | QApplication::postEvent( mCardView, ev ); | ||
183 | } | ||
172 | void KAddressBookCardView::readConfig(KConfig *config) | 184 | void KAddressBookCardView::readConfig(KConfig *config) |
173 | { | 185 | { |
174 | KAddressBookView::readConfig(config); | 186 | KAddressBookView::readConfig(config); |
@@ -290,8 +302,12 @@ void KAddressBookCardView::doSearch( const QString& s,KABC::Field *field ) | |||
290 | } | 302 | } |
291 | mCardView->viewport()->setUpdatesEnabled( true ); | 303 | mCardView->viewport()->setUpdatesEnabled( true ); |
292 | mCardView->viewport()->update(); | 304 | mCardView->viewport()->update(); |
293 | // by default nothing is selected | 305 | if ( mCardView->firstItem() ) { |
294 | emit selected(QString::null); | 306 | mCardView->setCurrentItem ( mCardView->firstItem() ); |
307 | mCardView->setSelected ( mCardView->firstItem() , true ); | ||
308 | } | ||
309 | else | ||
310 | emit selected(QString::null); | ||
295 | } | 311 | } |
296 | QStringList KAddressBookCardView::selectedUids() | 312 | QStringList KAddressBookCardView::selectedUids() |
297 | { | 313 | { |
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 | |||
@@ -60,6 +60,8 @@ class KAddressBookCardView : public KAddressBookView | |||
60 | 60 | ||
61 | virtual void readConfig(KConfig *config); | 61 | virtual void readConfig(KConfig *config); |
62 | virtual void writeConfig(KConfig *); | 62 | virtual void writeConfig(KConfig *); |
63 | virtual void scrollUP(); | ||
64 | virtual void scrollDOWN(); | ||
63 | 65 | ||
64 | public slots: | 66 | public slots: |
65 | void refresh(QString uid = QString::null); | 67 | void refresh(QString uid = QString::null); |
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 | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "kaddressbookiconview.h" | 41 | #include "kaddressbookiconview.h" |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
43 | #include <qregexp.h> | 43 | #include <qregexp.h> |
44 | #include <qapplication.h> | ||
44 | #include <kglobal.h> | 45 | #include <kglobal.h> |
45 | /*US transfered to the headerfile | 46 | /*US transfered to the headerfile |
46 | class IconViewFactory : public ViewFactory | 47 | class IconViewFactory : public ViewFactory |
@@ -211,6 +212,16 @@ KAddressBookIconView::~KAddressBookIconView() | |||
211 | { | 212 | { |
212 | } | 213 | } |
213 | 214 | ||
215 | void KAddressBookIconView::scrollUP() | ||
216 | { | ||
217 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | ||
218 | QApplication::postEvent( mIconView, ev ); | ||
219 | } | ||
220 | void KAddressBookIconView::scrollDOWN() | ||
221 | { | ||
222 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | ||
223 | QApplication::postEvent( mIconView, ev ); | ||
224 | } | ||
214 | void KAddressBookIconView::readConfig(KConfig *config) | 225 | void KAddressBookIconView::readConfig(KConfig *config) |
215 | { | 226 | { |
216 | KAddressBookView::readConfig(config); | 227 | KAddressBookView::readConfig(config); |
@@ -280,6 +291,12 @@ void KAddressBookIconView::doSearch( const QString& s ,KABC::Field *field ) | |||
280 | } | 291 | } |
281 | } | 292 | } |
282 | mIconView->arrangeItemsInGrid( true ); | 293 | mIconView->arrangeItemsInGrid( true ); |
294 | if ( mIconView->firstItem() ) { | ||
295 | mIconView->setCurrentItem ( mIconView->firstItem() ); | ||
296 | mIconView->setSelected ( mIconView->firstItem() , true ); | ||
297 | } | ||
298 | else | ||
299 | emit selected(QString::null); | ||
283 | } | 300 | } |
284 | QStringList KAddressBookIconView::selectedUids() | 301 | QStringList KAddressBookIconView::selectedUids() |
285 | { | 302 | { |
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 | |||
@@ -61,6 +61,8 @@ class KAddressBookIconView : public KAddressBookView | |||
61 | void doSearch( const QString& s ,KABC::Field *field ); | 61 | void doSearch( const QString& s ,KABC::Field *field ); |
62 | 62 | ||
63 | virtual void readConfig(KConfig *config); | 63 | virtual void readConfig(KConfig *config); |
64 | virtual void scrollUP(); | ||
65 | virtual void scrollDOWN(); | ||
64 | 66 | ||
65 | public slots: | 67 | public slots: |
66 | void refresh(QString uid = QString::null); | 68 | void refresh(QString uid = QString::null); |
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 | |||
@@ -51,7 +51,16 @@ KAddressBookTableView::KAddressBookTableView( KABC::AddressBook *ab, | |||
51 | KAddressBookTableView::~KAddressBookTableView() | 51 | KAddressBookTableView::~KAddressBookTableView() |
52 | { | 52 | { |
53 | } | 53 | } |
54 | 54 | void KAddressBookTableView::scrollUP() | |
55 | { | ||
56 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Up, 0,0 ); | ||
57 | QApplication::postEvent( mListView, ev ); | ||
58 | } | ||
59 | void KAddressBookTableView::scrollDOWN() | ||
60 | { | ||
61 | QKeyEvent * ev = new QKeyEvent ( QEvent::KeyPress, Qt::Key_Down, 0,0 ); | ||
62 | QApplication::postEvent( mListView, ev ); | ||
63 | } | ||
55 | void KAddressBookTableView::reconstructListView() | 64 | void KAddressBookTableView::reconstructListView() |
56 | { | 65 | { |
57 | if (mListView) | 66 | if (mListView) |
@@ -159,7 +168,12 @@ void KAddressBookTableView::doSearch( const QString& s, KABC::Field *field ) | |||
159 | // Sometimes the background pixmap gets messed up when we add lots | 168 | // Sometimes the background pixmap gets messed up when we add lots |
160 | // of items. | 169 | // of items. |
161 | mListView->repaint(); | 170 | mListView->repaint(); |
162 | emit selected(QString::null); | 171 | if ( mListView->firstChild() ) { |
172 | mListView->setCurrentItem ( mListView->firstChild() ); | ||
173 | mListView->setSelected ( mListView->firstChild(), true ); | ||
174 | } | ||
175 | else | ||
176 | emit selected(QString::null); | ||
163 | 177 | ||
164 | } | 178 | } |
165 | void KAddressBookTableView::writeConfig(KConfig *config) | 179 | void KAddressBookTableView::writeConfig(KConfig *config) |
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 | |||
@@ -63,6 +63,8 @@ friend class ContactListView; | |||
63 | virtual void writeConfig(KConfig *config); | 63 | virtual void writeConfig(KConfig *config); |
64 | virtual QString type() const { return "Table"; } | 64 | virtual QString type() const { return "Table"; } |
65 | void doSearch( const QString& s ,KABC::Field *field ); | 65 | void doSearch( const QString& s ,KABC::Field *field ); |
66 | virtual void scrollUP(); | ||
67 | virtual void scrollDOWN(); | ||
66 | 68 | ||
67 | public slots: | 69 | public slots: |
68 | virtual void reconstructListView(); | 70 | virtual void reconstructListView(); |