Skip to content
Permalink
Browse files
Ask for confirmation if user requests to edit toc of more than 5 book…
…s at once
  • Loading branch information
kovidgoyal committed Jul 28, 2021
1 parent c3aed85 commit a81967e7427f0ee7c846847f558e49a2d3690b35
Showing with 10 additions and 4 deletions.
  1. +10 −4 src/calibre/gui2/actions/toc_edit.py
@@ -8,11 +8,11 @@

import os
from collections import OrderedDict
from qt.core import (
QCheckBox, QDialog, QDialogButtonBox, QGridLayout, QIcon, QLabel, QTimer
)

from qt.core import (QTimer, QDialog, QGridLayout, QCheckBox, QLabel,
QDialogButtonBox, QIcon)

from calibre.gui2 import error_dialog, gprefs
from calibre.gui2 import error_dialog, gprefs, question_dialog
from calibre.gui2.actions import InterfaceAction
from calibre.utils.monotonic import monotonic
from polyglot.builtins import iteritems, unicode_type
@@ -116,6 +116,12 @@ def get_supported_books(self, book_ids):
' formats. Convert to one of those formats before polishing.')
%_(' or ').join(sorted(supported)), show=True)
ans = OrderedDict(ans)
if len(ans) > 5:
if not question_dialog(self.gui, _('Are you sure?'), _(
'You have chosen to edit the Table of Contents of {} books at once.'
' Doing so will likely slow your computer to a crawl. Are you sure?'
).format(len(ans))):
return
return ans

def get_books_for_editing(self):

0 comments on commit a81967e

Please sign in to comment.