diff --git a/src/calibre/gui2/actions/delete.py b/src/calibre/gui2/actions/delete.py index 82a7cb817e..fc7f0e4522 100644 --- a/src/calibre/gui2/actions/delete.py +++ b/src/calibre/gui2/actions/delete.py @@ -170,8 +170,8 @@ class DeleteAction(InterfaceAction): title = self.gui.current_db.title(book_id, index_is_id=True) if not confirm('
'+(_( 'The %(fmt)s format will be permanently deleted from ' - '%(title)s. Are you sure?')%dict(fmt=fmt, title=title)) - +'
', 'library_delete_specific_format', self.gui): + '%(title)s. Are you sure?')%dict(fmt=fmt, title=title)) + + '', 'library_delete_specific_format', self.gui): return self.gui.library_view.model().db.remove_format(book_id, fmt, @@ -240,8 +240,8 @@ class DeleteAction(InterfaceAction): return if not confirm(''+_('All formats for the selected books will '
'be deleted from your library.
'
- 'The book metadata will be kept. Are you sure?')
- +'
'+_('The %d selected book(s) will be ' 'permanently deleted and the files ' - 'removed from your calibre library. Are you sure?')%len(to_delete_ids) - +'
', 'library_delete_books', self.gui): + 'removed from your calibre library. Are you sure?')%len(to_delete_ids) + + '', 'library_delete_books', self.gui): return if len(to_delete_ids) < 5: try: @@ -392,6 +399,9 @@ class DeleteAction(InterfaceAction): self.do_library_delete(to_delete_ids) # Device view is visible. else: + cv, row = self.gui.current_view(), -1 + if cv is not self.gui.library_view: + row = cv.currentIndex().row() if self.gui.stack.currentIndex() == 1: view = self.gui.memory_view elif self.gui.stack.currentIndex() == 2: @@ -402,11 +412,13 @@ class DeleteAction(InterfaceAction): ids = view.model().indices(rows) if not confirm(''+_('The %d selected book(s) will be ' 'permanently deleted ' - 'from your device. Are you sure?')%len(paths) - +'
', 'device_delete_books', self.gui): + 'from your device. Are you sure?')%len(paths) + + '', 'device_delete_books', self.gui): return job = self.gui.remove_paths(paths) self.delete_memory[job] = (paths, view.model()) view.model().mark_for_deletion(job, ids, rows_are_ids=True) self.gui.status_bar.show_message(_('Deleting books from device.'), 1000) - + if row > -1: + nrow = row - 1 if row > 0 else row + 1 + cv.set_current_row(max(0, nrow))