From d8129e2deeffcb5256c5c9d22fbd1fa743e8b6fe Mon Sep 17 00:00:00 2001 From: zecke Date: Sun, 08 Feb 2004 16:18:37 +0000 Subject: 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 --- (limited to 'core/pim') 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 @@ -596,13 +596,22 @@ void TableView::keyPressEvent( QKeyEvent* event) { 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() ) { @@ -620,7 +629,7 @@ void TableView::keyPressEvent( QKeyEvent* event) { }else if ( col == 3 ) { TodoView::edit( sorted().uidAt(row) ); } - + event->accept(); break; default: QTable::keyPressEvent( event ); -- cgit v0.9.0.2