This commit is contained in:
Kovid Goyal 2011-05-04 09:24:44 -06:00
commit 43287a5b55
3 changed files with 30 additions and 9 deletions

View File

@ -44,18 +44,19 @@ class LocationManager(QObject): # {{{
receiver = partial(self._location_selected, name)
ac.triggered.connect(receiver)
self.tooltips[name] = tooltip
if name != 'library':
m = QMenu(parent)
self._mem.append(m)
a = m.addAction(icon, tooltip)
a.triggered.connect(receiver)
if name != 'library':
self._mem.append(a)
a = m.addAction(QIcon(I('eject.png')), _('Eject this device'))
a.triggered.connect(self._eject_requested)
ac.setMenu(m)
self._mem.append(a)
else:
ac.setToolTip(tooltip)
ac.setMenu(m)
ac.calibre_name = name
return ac
@ -71,7 +72,12 @@ class LocationManager(QObject): # {{{
def set_switch_actions(self, quick_actions, rename_actions, delete_actions,
switch_actions, choose_action):
self.switch_menu = self.library_action.menu()
if self.switch_menu:
self.switch_menu.addSeparator()
else:
self.switch_menu = QMenu()
self.switch_menu.addAction(choose_action)
self.cs_menus = []
for t, acs in [(_('Quick switch'), quick_actions),
@ -85,6 +91,8 @@ class LocationManager(QObject): # {{{
self.switch_menu.addSeparator()
for ac in switch_actions:
self.switch_menu.addAction(ac)
if self.switch_menu != self.library_action.menu():
self.library_action.setMenu(self.switch_menu)
def _location_selected(self, location, *args):

View File

@ -155,6 +155,7 @@ class SearchDialog(QDialog, Ui_Dialog):
self.config['results_view_column_width'] = [self.results_view.columnWidth(i) for i in range(self.results_view.model().columnCount())]
self.config['sort_col'] = self.results_view.model().sort_col
self.config['sort_order'] = self.results_view.model().sort_order
self.config['open_external'] = self.open_external.isChecked()
store_check = {}
for n in self.store_plugins:
@ -179,6 +180,8 @@ class SearchDialog(QDialog, Ui_Dialog):
else:
self.resize_columns()
self.open_external.setChecked(self.config.get('open_external', False))
store_check = self.config.get('store_checked', None)
if store_check:
for n in store_check:
@ -212,7 +215,7 @@ class SearchDialog(QDialog, Ui_Dialog):
def open_store(self, index):
result = self.results_view.model().get_result(index)
self.store_plugins[result.store_name].open(self, result.detail_item)
self.store_plugins[result.store_name].open(self, result.detail_item, self.open_external.isChecked())
def check_progress(self):
if not self.search_pool.threads_running() and not self.results_view.model().cover_pool.threads_running() and not self.results_view.model().details_pool.threads_running():

View File

@ -70,7 +70,7 @@
<x>0</x>
<y>0</y>
<width>215</width>
<height>116</height>
<height>93</height>
</rect>
</property>
</widget>
@ -101,6 +101,16 @@
</item>
</layout>
</item>
<item>
<widget class="QCheckBox" name="open_external">
<property name="toolTip">
<string>Open a selected book in the system's web browser</string>
</property>
<property name="text">
<string>Open in &amp;external browser</string>
</property>
</widget>
</item>
</layout>
</widget>
<widget class="QSplitter" name="splitter_2">