From c4a82de4c7ae655d1e2cf3bcb1eed08ad832e63f Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Wed, 7 Aug 2013 12:50:24 +0530 Subject: [PATCH] Confirm quit while delete in progress --- src/calibre/db/delete_service.py | 5 +++++ src/calibre/gui2/ui.py | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/src/calibre/db/delete_service.py b/src/calibre/db/delete_service.py index a79afc7d4b..ce5578f888 100644 --- a/src/calibre/db/delete_service.py +++ b/src/calibre/db/delete_service.py @@ -113,4 +113,9 @@ def shutdown(timeout=20): __ds.shutdown(timeout) __ds = None +def has_jobs(): + global __ds + if __ds is not None: + return (not __ds.requests.empty()) or __ds.requests.unfinished_tasks + return False diff --git a/src/calibre/gui2/ui.py b/src/calibre/gui2/ui.py index 90eac209b2..196de7cb6a 100644 --- a/src/calibre/gui2/ui.py +++ b/src/calibre/gui2/ui.py @@ -809,6 +809,14 @@ class Main(MainWindow, MainWindowMixin, DeviceMixin, EmailMixin, # {{{ if not question_dialog(self, _('Active jobs'), msg): return False + from calibre.db.delete_service import has_jobs + if has_jobs(): + msg = _('Some deleted books are still being moved to the Recycle ' + 'Bin, if you quit now, they will be left behind. Are you ' + 'sure you want to quit?') + if not question_dialog(self, _('Active jobs'), msg): + return False + return True def shutdown(self, write_settings=True):