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 @@ -125,16 +125,17 @@ AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *nam // #else : QTable( parent, name ), // #endif lastSortCol( -1 ), asc( TRUE ), intFields( order ), currFindRow( -1 ), mCat( 0 ), + m_inSearch (false), m_contactdb ("addressbook", 0l, 0l, false) // Handle syncing myself.. ! { mCat.load( categoryFileName() ); setSelectionMode( NoSelection ); init(); setSorting( TRUE ); connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), this, SLOT(itemClicked(int,int)) ); @@ -255,24 +256,50 @@ void AbTable::refresh() void AbTable::keyPressEvent( QKeyEvent *e ) { char key = toupper( e->ascii() ); if ( key >= 'A' && key <= 'Z' ) moveTo( key ); - switch( e->key() ) { - case Qt::Key_Space: - case Qt::Key_Return: - case Qt::Key_Enter: - emit details(); - break; - default: - QTable::keyPressEvent( e ); + if ( m_inSearch ) { + // Running in seach-mode, therefore we will interprete + // some key differently + qWarning("Received key in search mode"); + switch( e->key() ) { + case Qt::Key_Space: + case Qt::Key_Return: + case Qt::Key_Enter: + emit details(); + break; + case Qt::Key_Up: + qWarning("a"); + emit signalSearchBackward(); + break; + case Qt::Key_Down: + qWarning("b"); + emit signalSearchNext(); + break; + default: + QTable::keyPressEvent( e ); + } + + } else { + qWarning("Received key in NON search mode"); + + switch( e->key() ) { + case Qt::Key_Space: + case Qt::Key_Return: + case Qt::Key_Enter: + emit details(); + break; + default: + QTable::keyPressEvent( e ); + } } } void AbTable::moveTo( char c ) { int rows = numRows(); QString value; @@ -678,17 +705,17 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive, bool us currFindRow = rows; else currFindRow = -1; if ( wrapAround ) emit signalWrapAround(); else emit signalNotFound(); - + wrapAround = !wrapAround; } else { currFindRow = row; QTableSelection foundSelection; foundSelection.init( currFindRow, 0 ); foundSelection.expandTo( currFindRow, numCols() - 1 ); addSelection( foundSelection ); setCurrentCell( currFindRow, 0 /* numCols() - 1 */ ); |