mirror of
git://github.com/kovidgoyal/calibre.git
synced 2026-05-09 11:14:02 +02:00
Preferences->Toolbars: Show an error message when the user tries to remove either the Preferences or Location Manager buttons instead of just silently adding them back. Fixes #1689022 [main toolbar device connected massage fails](https://bugs.launchpad.net/calibre/+bug/1689022)
This commit is contained in:
parent
f974854eb1
commit
f1b1dce050
1 changed files with 8 additions and 6 deletions
|
|
@ -11,8 +11,8 @@
|
|||
QItemSelectionModel
|
||||
|
||||
from calibre.gui2.preferences.toolbar_ui import Ui_Form
|
||||
from calibre.gui2 import gprefs, warning_dialog
|
||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget
|
||||
from calibre.gui2 import gprefs, warning_dialog, error_dialog
|
||||
from calibre.gui2.preferences import ConfigWidgetBase, test_widget, AbortCommit
|
||||
|
||||
|
||||
class FakeAction(object):
|
||||
|
|
@ -335,11 +335,13 @@ def commit(self):
|
|||
lm_in_toolbar = self.models['toolbar-device'][1].has_action('Location Manager')
|
||||
lm_in_menubar = self.models['menubar-device'][1].has_action('Location Manager')
|
||||
if not pref_in_toolbar and not pref_in_menubar:
|
||||
self.models['menubar'][1].add(['Preferences'])
|
||||
error_dialog(self, _('Preferences missing'), _(
|
||||
'The Preferences action must be in either the main toolbar or the menubar.'), show=True)
|
||||
raise AbortCommit()
|
||||
if not lm_in_toolbar and not lm_in_menubar:
|
||||
m = self.models['toolbar-device'][1]
|
||||
m.add(['Location Manager'])
|
||||
m.move(m.index(m.rowCount(None)-1), 5-m.rowCount(None))
|
||||
error_dialog(self, _('Location Manager missing'), _(
|
||||
'The Location Manager must be in either the main toolbar or the menubar when a device is connected.'), show=True)
|
||||
raise AbortCommit()
|
||||
|
||||
# Save data.
|
||||
for am, cm in self.models.values():
|
||||
|
|
|
|||
Loading…
Reference in a new issue