When deleting books from the bottom of the booklist, ensure that the bottom book after deleting is selected

This commit is contained in:
Kovid Goyal 2012-05-28 09:43:46 +05:30
commit 7882df7fa3

View File

@ -265,7 +265,9 @@ class DeleteAction(InterfaceAction):
v.model().clear_ondevice(ids_deleted)
if current_row is not None:
ci = view.model().index(current_row, 0)
if ci.isValid():
if not ci.isValid():
# Current row is after the last row, set it to the last row
current_row = view.row_count() - 1
view.set_current_row(current_row)
def delete_books(self, *args):