summaryrefslogtreecommitdiff
path: root/core/pim/addressbook/abtable.cpp
Unidiff
Diffstat (limited to 'core/pim/addressbook/abtable.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/pim/addressbook/abtable.cpp45
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
@@ -121,24 +121,25 @@ void AbPickItem::setContentFromEditor( QWidget *w )
121 121
122AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *name ) 122AbTable::AbTable( const QValueList<int> *order, QWidget *parent, const char *name )
123 // #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR 123 // #ifdef QT_QTABLE_NOHEADER_CONSTRUCTOR
124 // : QTable( 0, 0, parent, name, TRUE ), 124 // : QTable( 0, 0, parent, name, TRUE ),
125 // #else 125 // #else
126 : QTable( parent, name ), 126 : QTable( parent, name ),
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 );
139 connect( this, SIGNAL(clicked(int,int,int,const QPoint &)), 140 connect( this, SIGNAL(clicked(int,int,int,const QPoint &)),
140 this, SLOT(itemClicked(int,int)) ); 141 this, SLOT(itemClicked(int,int)) );
141} 142}
142 143
143AbTable::~AbTable() 144AbTable::~AbTable()
144{ 145{
@@ -251,32 +252,58 @@ void AbTable::refresh()
251 static_cast<AbTableItem*>( item(r, 1) )->setItem( value, abi->text() ); 252 static_cast<AbTableItem*>( item(r, 1) )->setItem( value, abi->text() );
252 } 253 }
253 resort(); 254 resort();
254} 255}
255 256
256void AbTable::keyPressEvent( QKeyEvent *e ) 257void 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
274void AbTable::moveTo( char c ) 301void AbTable::moveTo( char c )
275{ 302{
276 303
277 int rows = numRows(); 304 int rows = numRows();
278 QString value; 305 QString value;
279 AbTableItem *abi; 306 AbTableItem *abi;
280 int r; 307 int r;
281 if ( asc ) { 308 if ( asc ) {
282 r = 0; 309 r = 0;
@@ -674,25 +701,25 @@ void AbTable::slotDoFind( const QString &findString, bool caseSensitive, bool us
674 } 701 }
675 } 702 }
676 if ( row >= rows || row < 0 ) { 703 if ( row >= rows || row < 0 ) {
677 if ( row < 0 ) 704 if ( row < 0 )
678 currFindRow = rows; 705 currFindRow = rows;
679 else 706 else
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 );
693 addSelection( foundSelection ); 720 addSelection( foundSelection );
694 setCurrentCell( currFindRow, 0 /* numCols() - 1 */ ); 721 setCurrentCell( currFindRow, 0 /* numCols() - 1 */ );
695 wrapAround = true; 722 wrapAround = true;
696 } 723 }
697} 724}
698 725