From 058a61912c23af97c1b4b8835af1bbbe47d97f44 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Thu, 4 Sep 2014 13:38:12 +0530 Subject: [PATCH] When removing a library from calibre, allow undoing the action --- src/calibre/gui2/actions/choose_library.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/src/calibre/gui2/actions/choose_library.py b/src/calibre/gui2/actions/choose_library.py index 7f02b88176..92a6b494e6 100644 --- a/src/calibre/gui2/actions/choose_library.py +++ b/src/calibre/gui2/actions/choose_library.py @@ -413,14 +413,17 @@ class ChooseLibraryAction(InterfaceAction): def delete_requested(self, name, location): loc = location.replace('/', os.sep) + if not question_dialog( + self.gui, _('Library removed'), _( + 'The library %s has been removed from calibre. ' + 'The files remain on your computer, if you want ' + 'to delete them, you will have to do so manually.') % ('%s' % loc), + override_icon='dialog_information.png', + yes_text=_('&OK'), no_text=_('&Undo'), yes_icon='ok.png', no_icon='edit-undo.png'): + return self.stats.remove(location) self.build_menus() self.gui.iactions['Copy To Library'].build_menus() - info_dialog(self.gui, _('Library removed'), - _('The library %s has been removed from calibre. ' - 'The files remain on your computer, if you want ' - 'to delete them, you will have to do so manually.') % loc, - show=True) if os.path.exists(loc): open_local_file(loc)