Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | core/pim/addressbook/abtable.cpp | 45 |
1 files changed, 36 insertions, 9 deletions
diff --git a/core/pim/addressbook/abtable.cpp b/core/pim/addressbook/abtable.cpp index d4dcf7b..97b26db 100644 --- a/core/pim/addressbook/abtable.cpp +++ b/core/pim/addressbook/abtable.cpp | |||
@@ -127,12 +127,13 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam | |||
127 | // #endif | 127 | // #endif |
128 | lastSortCol( -1 ), | 128 | lastSortCol( -1 ), |
129 | asc( TRUE ), | 129 | asc( TRUE ), |
130 | intFields( order ), | 130 | intFields( order ), |
131 | currFindRow( -1 ), | 131 | currFindRow( -1 ), |
132 | mCat( 0 ), | 132 | mCat( 0 ), |
133 | m_inSearch (false), | ||
133 | m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. ! | 134 | m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. ! |
134 | { | 135 | { |
135 | mCat.load( categoryFileName() ); | 136 | mCat.load( categoryFileName() ); |
136 | setSelectionMode( NoSelection ); | 137 | setSelectionMode( NoSelection ); |
137 | init(); | 138 | init(); |
138 | setSorting( TRUE ); | 139 | setSorting( TRUE ); |
@@ -257,20 +258,46 @@ void AbTable::keyPressEvent( QKeyEvent *e ) | |||
257 | { | 258 | { |
258 | char key = toupper( e->ascii() ); | 259 | char key = toupper( e->ascii() ); |
259 | 260 | ||
260 | if ( key >= 'A' && key <= 'Z' ) | 261 | if ( key >= 'A' && key <= 'Z' ) |
261 | moveTo( key ); | 262 | moveTo( key ); |
262 | 263 | ||
263 | switch( e->key() ) { | 264 | if ( m_inSearch ) { |
264 | case Qt::Key_Space: | 265 | // Running in seach-mode, therefore we will interprete |
265 | case Qt::Key_Return: | 266 | // some key differently |
266 | case Qt::Key_Enter: | 267 | qWarning("Received key in search mode"); |
267 | emit details(); | 268 | switch( e->key() ) { |
268 | break; | 269 | case Qt::Key_Space: |
269 | default: | 270 | case Qt::Key_Return: |
270 | QTable::keyPressEvent( e ); | 271 | case Qt::Key_Enter: |
272 | emit details(); | ||
273 | break; | ||
274 | case Qt::Key_Up: | ||
275 | qWarning("a"); | ||
276 | emit signalSearchBackward(); | ||
277 | break; | ||
278 | case Qt::Key_Down: | ||
279 | qWarning("b"); | ||
280 | emit signalSearchNext(); | ||
281 | break; | ||
282 | default: | ||
283 | QTable::keyPressEvent( e ); | ||
284 | } | ||
285 | |||
286 | } else { | ||
287 | qWarning("Received key in NON search mode"); | ||
288 | |||
289 | switch( e->key() ) { | ||
290 | case Qt::Key_Space: | ||
291 | case Qt::Key_Return: | ||
292 | case Qt::Key_Enter: | ||
293 | emit details(); | ||
294 | break; | ||
295 | default: | ||
296 | QTable::keyPressEvent( e ); | ||
297 | } | ||
271 | } | 298 | } |
272 | } | 299 | } |
273 | 300 | ||
274 | void AbTable::moveTo( char c ) | 301 | void AbTable::moveTo( char c ) |
275 | { | 302 | { |
276 | 303 | ||
@@ -680,13 +707,13 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive, bool us | |||
680 | currFindRow = -1; | 707 | currFindRow = -1; |
681 | 708 | ||
682 | if ( wrapAround ) | 709 | if ( wrapAround ) |
683 | emit signalWrapAround(); | 710 | emit signalWrapAround(); |
684 | else | 711 | else |
685 | emit signalNotFound(); | 712 | emit signalNotFound(); |
686 | 713 | ||
687 | wrapAround = !wrapAround; | 714 | wrapAround = !wrapAround; |
688 | } else { | 715 | } else { |
689 | currFindRow = row; | 716 | currFindRow = row; |
690 | QTableSelection foundSelection; | 717 | QTableSelection foundSelection; |
691 | foundSelection.init( currFindRow, 0 ); | 718 | foundSelection.init( currFindRow, 0 ); |
692 | foundSelection.expandTo( currFindRow, numCols() - 1 ); | 719 | foundSelection.expandTo( currFindRow, numCols() - 1 ); |