author | zecke <zecke> | 2004-02-08 16:18:37 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-02-08 16:18:37 (UTC) |
commit | d8129e2deeffcb5256c5c9d22fbd1fa743e8b6fe (patch) (side-by-side diff) | |
tree | 5f57bc4073015cb39ec1ddae12825ae9c3b8c02e | |
parent | 6506eeeeaa8d52ae0895630de00e38bc2b8ff10c (diff) | |
download | opie-d8129e2deeffcb5256c5c9d22fbd1fa743e8b6fe.zip opie-d8129e2deeffcb5256c5c9d22fbd1fa743e8b6fe.tar.gz opie-d8129e2deeffcb5256c5c9d22fbd1fa743e8b6fe.tar.bz2 |
Fix two problems:
1.) accept the key event so it does not reoccur and reoccur
2.) do not crash if asked to delete and there is nothing to delete
-rw-r--r-- | core/pim/todo/tableview.cpp | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/core/pim/todo/tableview.cpp b/core/pim/todo/tableview.cpp index 3daf370..d980a24 100644 --- a/core/pim/todo/tableview.cpp +++ b/core/pim/todo/tableview.cpp @@ -591,23 +591,32 @@ void TableView::contentsMouseMoveEvent( QMouseEvent* e ) { void TableView::keyPressEvent( QKeyEvent* event) { if ( m_editorWidget.cellWidget() ) { // setCellContentFromEditor(m_editorWidget.cellRow(), m_editorWidget.cellCol() ); endEdit(m_editorWidget.cellRow(), m_editorWidget.cellCol(), true, true ); m_editorWidget.releaseCellWidget(); setFocus(); } + + if ( sorted().count() < 1 ) { + QTable::keyPressEvent( event ); + return; + } + int row = currentRow(); int col = currentColumn(); char key = ::toupper( event->ascii() ); - /* let QTable also handle the d later */ - if ( key == 'D' ) + /* let QTable also handle the d letter */ + if ( key == 'D' ) { + event->accept(); removeQuery( sorted().uidAt( row ) ); + return; + } switch( event->key() ) { case Qt::Key_F33: case Qt::Key_Enter: case Qt::Key_Return: case Qt::Key_Space: if ( col == 0 ) { @@ -615,15 +624,15 @@ void TableView::keyPressEvent( QKeyEvent* event) { }else if ( col == 1 ) { QWidget* wid = beginEdit(row, col, FALSE ); m_editorWidget.setCellWidget( wid, row, col ); }else if ( col == 2 ) { showTodo( sorted().uidAt( currentRow() ) ); }else if ( col == 3 ) { TodoView::edit( sorted().uidAt(row) ); } - + event->accept(); break; default: QTable::keyPressEvent( event ); } } |