mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Quickview: Double clicking an item now searches for it
Fixes #1878393 [[Enhancement - Quickview] Remove or edit item](https://bugs.launchpad.net/calibre/+bug/1878393) Merge branch 'master' of https://github.com/cbhaley/calibre
This commit is contained in:
commit
5ece776a43
@ -179,6 +179,7 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
self.items.setSelectionMode(QAbstractItemView.SingleSelection)
|
||||
self.items.currentTextChanged.connect(self.item_selected)
|
||||
self.items.setProperty('highlight_current_item', 150)
|
||||
self.items.itemDoubleClicked.connect(self.item_doubleclicked)
|
||||
|
||||
focus_filter = WidgetFocusFilter(self.items)
|
||||
focus_filter.focus_entered_signal.connect(self.focus_entered)
|
||||
@ -277,6 +278,12 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
self.close_button.setToolTip(_('Alternate shortcut: ') +
|
||||
toggle_shortcut.toString())
|
||||
|
||||
def item_doubleclicked(self, item):
|
||||
tb = self.gui.stack.tb_widget
|
||||
tb.set_focus_to_find_box()
|
||||
tb.item_search.lineEdit().setText(self.current_key + ':' + item.text())
|
||||
tb.do_find()
|
||||
|
||||
def show_context_menu(self, point):
|
||||
index = self.books_table.indexAt(point)
|
||||
item = self.books_table.item(index.row(), 0)
|
||||
@ -495,6 +502,10 @@ class Quickview(QDialog, Ui_Quickview):
|
||||
|
||||
for v in vals:
|
||||
a = QListWidgetItem(v)
|
||||
a.setToolTip('<p>' +
|
||||
_('Click to show only books with this item. '
|
||||
'Double click to search for this item in the tag browser')
|
||||
+ '</p>')
|
||||
self.items.addItem(a)
|
||||
self.items.setCurrentRow(0)
|
||||
|
||||
|
@ -616,11 +616,14 @@ class TagBrowserWidget(QFrame): # {{{
|
||||
self.item_search.lineEdit().blockSignals(False)
|
||||
|
||||
key = None
|
||||
colon = txt.rfind(':') if len(txt) > 2 else 0
|
||||
colon = txt.find(':') if len(txt) > 2 else 0
|
||||
if colon > 0:
|
||||
key = self._parent.library_view.model().db.\
|
||||
field_metadata.search_term_to_field_key(txt[:colon])
|
||||
if self._parent.library_view.model().db.field_metadata.has_key(key):
|
||||
txt = txt[colon+1:]
|
||||
else:
|
||||
key = None
|
||||
|
||||
self.current_find_position = \
|
||||
model.find_item_node(key, txt, self.current_find_position)
|
||||
|
Loading…
x
Reference in New Issue
Block a user