This commit is contained in:
Kovid Goyal 2015-02-02 18:29:15 +05:30
commit 052df2b968
2 changed files with 16 additions and 3 deletions

View File

@ -39,6 +39,8 @@ class ShowQuickviewAction(InterfaceAction):
default_keys=('Shift+S',), action=self.search_action,
group=self.action_spec[0])
self.search_action.triggered.connect(self.search_quickview)
self.search_action.changed.connect(self.set_search_shortcut)
self.menuless_qaction.changed.connect(self.set_search_shortcut)
def show_quickview(self, *args):
if self.current_instance:
@ -56,8 +58,14 @@ class ShowQuickviewAction(InterfaceAction):
if index.isValid():
self.current_instance = Quickview(self.gui, index)
self.current_instance.reopen_quickview.connect(self.reopen_quickview)
self.set_search_shortcut()
self.current_instance.show()
def set_search_shortcut(self):
if self.current_instance and not self.current_instance.is_closed:
self.current_instance.set_shortcuts(self.search_action.shortcut().toString(),
self.menuless_qaction.shortcut().toString())
def reopen_quickview(self):
if self.current_instance and not self.current_instance.is_closed:
self.current_instance.reject()

View File

@ -200,7 +200,9 @@ class Quickview(QDialog, Ui_Quickview):
self.view.model().new_bookdisplay_data.connect(self.book_was_changed)
self.close_button.setDefault(False)
self.search_button.setToolTip(_('Search in the library view for the currently highlighted selection'))
self.close_button_tooltip = _('The Quickview shortcut ({0}) shows/hides the Quickview pane')
self.search_button_tooltip = _('Search in the library view for the currently highlighted selection')
self.search_button.setToolTip(self.search_button_tooltip)
if self.is_pane:
self.dock_button.setText(_('Undock'))
self.dock_button.setToolTip(_('Pop up the quickview panel into its own floating window'))
@ -208,8 +210,6 @@ class Quickview(QDialog, Ui_Quickview):
self.lock_qv.setText(_('Lock Quickview contents'))
self.search_button.setText(_('Search'))
self.gui.quickview_splitter.add_quickview_dialog(self)
self.search_button.setToolTip(self.search_button.toolTip() + _(' (has shortcut)'))
self.close_button.setToolTip(_('The Quickview shortcut toggles this pane on/off'))
else:
self.close_button.setText(_('&Close'))
self.dock_button.setText(_('&Dock'))
@ -227,6 +227,11 @@ class Quickview(QDialog, Ui_Quickview):
self.search_button.setEnabled(False)
self.last_search = txt
def set_shortcuts(self, search_sc, qv_sc):
if self.is_pane:
self.search_button.setToolTip(self.search_button_tooltip + ' (' + search_sc + ')')
self.close_button.setToolTip(self.close_button_tooltip.format(qv_sc))
def focus_entered(self, obj):
if obj == self.books_table:
self.books_table_set_search_string(self.books_table.currentRow(),