mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Ask for confirmation if user requests to edit toc of more than 5 books at once
This commit is contained in:
parent
c3aed85cbf
commit
a81967e742
@ -8,11 +8,11 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
from collections import OrderedDict
|
from collections import OrderedDict
|
||||||
|
from qt.core import (
|
||||||
|
QCheckBox, QDialog, QDialogButtonBox, QGridLayout, QIcon, QLabel, QTimer
|
||||||
|
)
|
||||||
|
|
||||||
from qt.core import (QTimer, QDialog, QGridLayout, QCheckBox, QLabel,
|
from calibre.gui2 import error_dialog, gprefs, question_dialog
|
||||||
QDialogButtonBox, QIcon)
|
|
||||||
|
|
||||||
from calibre.gui2 import error_dialog, gprefs
|
|
||||||
from calibre.gui2.actions import InterfaceAction
|
from calibre.gui2.actions import InterfaceAction
|
||||||
from calibre.utils.monotonic import monotonic
|
from calibre.utils.monotonic import monotonic
|
||||||
from polyglot.builtins import iteritems, unicode_type
|
from polyglot.builtins import iteritems, unicode_type
|
||||||
@ -116,6 +116,12 @@ class ToCEditAction(InterfaceAction):
|
|||||||
' formats. Convert to one of those formats before polishing.')
|
' formats. Convert to one of those formats before polishing.')
|
||||||
%_(' or ').join(sorted(supported)), show=True)
|
%_(' or ').join(sorted(supported)), show=True)
|
||||||
ans = OrderedDict(ans)
|
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
|
return ans
|
||||||
|
|
||||||
def get_books_for_editing(self):
|
def get_books_for_editing(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user