diff --git a/src/calibre/gui2/__init__.py b/src/calibre/gui2/__init__.py
index 3a532ec2c0..5fcde65ff5 100644
--- a/src/calibre/gui2/__init__.py
+++ b/src/calibre/gui2/__init__.py
@@ -187,7 +187,7 @@ def _config(): # {{{
c.add_opt('shortcuts_search_history', default=[],
help='Search history for the keyboard preferences')
c.add_opt('jobs_search_history', default=[],
- help='Search history for the keyboard preferences')
+ help='Search history for the tweaks preferences')
c.add_opt('tweaks_search_history', default=[],
help='Search history for tweaks')
c.add_opt('worker_limit', default=6,
diff --git a/src/calibre/gui2/viewer/config.py b/src/calibre/gui2/viewer/config.py
index a744a2c1f9..4132149842 100644
--- a/src/calibre/gui2/viewer/config.py
+++ b/src/calibre/gui2/viewer/config.py
@@ -139,12 +139,20 @@ class ConfigDialog(QDialog, Ui_Dialog):
self.load_options(opts)
self.init_load_themes()
+ self.clear_search_history_button.clicked.connect(self.clear_search_history)
+
+ def clear_search_history(self):
+ from calibre.gui2 import config
+ config['viewer_search_history'] = []
+
def save_theme(self):
themename, ok = QInputDialog.getText(self, _('Theme name'),
_('Choose a name for this theme'))
- if not ok: return
+ if not ok:
+ return
themename = unicode(themename).strip()
- if not themename: return
+ if not themename:
+ return
c = config('')
c.add_opt('theme_name_xxx', default=themename)
self.save_options(c)
@@ -247,7 +255,8 @@ class ConfigDialog(QDialog, Ui_Dialog):
def update_sample_colors(self):
for x in ('text', 'background'):
val = getattr(self, 'current_%s_color'%x)
- if not val: val = 'inherit' if x == 'text' else 'transparent'
+ if not val:
+ val = 'inherit' if x == 'text' else 'transparent'
ss = 'QLabel { %s: %s }'%('background-color' if x == 'background'
else 'color', val)
getattr(self, '%s_color_sample'%x).setStyleSheet(ss)
diff --git a/src/calibre/gui2/viewer/config.ui b/src/calibre/gui2/viewer/config.ui
index b146b571a2..1dce8e1a9e 100644
--- a/src/calibre/gui2/viewer/config.ui
+++ b/src/calibre/gui2/viewer/config.ui
@@ -68,7 +68,7 @@ QToolBox::tab:hover {
0
0
811
- 352
+ 380
@@ -240,8 +240,8 @@ QToolBox::tab:hover {
0
0
- 397
- 232
+ 811
+ 380
@@ -370,8 +370,8 @@ QToolBox::tab:hover {
0
0
- 352
- 176
+ 811
+ 380
@@ -446,8 +446,8 @@ QToolBox::tab:hover {
0
0
- 351
- 76
+ 811
+ 380
@@ -525,8 +525,8 @@ QToolBox::tab:hover {
0
0
- 410
- 120
+ 811
+ 380
@@ -596,8 +596,8 @@ QToolBox::tab:hover {
0
0
- 352
- 151
+ 811
+ 380
@@ -628,27 +628,34 @@ QToolBox::tab:hover {
- -
+
-
+
+
+ Clear search history
+
+
+
+ -
+
+
+ Show &controls in the viewer window
+
+
+
+ -
Remember last used &window size and layout
- -
+
-
Remember the ¤t page when quitting
- -
-
-
- Show &controls in the viewer window
-
-
-
diff --git a/src/calibre/gui2/viewer/main.py b/src/calibre/gui2/viewer/main.py
index 4587a6542b..3b63d51c15 100644
--- a/src/calibre/gui2/viewer/main.py
+++ b/src/calibre/gui2/viewer/main.py
@@ -940,6 +940,9 @@ class EbookViewer(MainWindow, Ui_EbookViewer):
def do_config(self):
self.view.config(self)
self.load_theme_menu()
+ from calibre.gui2 import config
+ if not config['viewer_search_history']:
+ self.search.clear_history()
def bookmark(self, *args):
num = 1