Use backend nid filter in addcards and mediacheck

This commit is contained in:
RumovZ 2021-01-28 18:59:20 +01:00
parent da6f3b7e76
commit a930aa41f0
3 changed files with 5 additions and 4 deletions

View File

@ -144,7 +144,7 @@ class AddCards(QDialog):
def onHistory(self) -> None:
m = QMenu(self)
for nid in self.history:
if self.mw.col.findNotes("nid:%s" % nid):
if self.mw.col.findNotes(self.col.search_string(nids=[nid])):
note = self.mw.col.getNote(nid)
fields = note.fields
txt = htmlToTextLine(", ".join(fields))
@ -162,7 +162,7 @@ class AddCards(QDialog):
def editHistory(self, nid):
browser = aqt.dialogs.open("Browser", self.mw)
browser.form.searchEdit.lineEdit().setText("nid:%d" % nid)
browser.form.searchEdit.lineEdit().setText(self.col.search_string(nids=[nid]))
browser.onSearchActivated()
def addNote(self, note) -> Optional[Note]:

View File

@ -1705,7 +1705,7 @@ where id in %s"""
t += (
"""<li><a href=# onclick="pycmd('%s');return false;">%s</a>: %s</a>"""
% (
self.col.search_string(nids=nids).replace('"', '&quot;'),
self.col.search_string(nids=nids).replace('"', "&quot;"),
tr(TR.BROWSING_NOTE_COUNT, count=len(nids)),
html.escape(val),
)

View File

@ -146,7 +146,8 @@ class MediaChecker:
if out is not None:
nid, err = out
browser = aqt.dialogs.open("Browser", self.mw)
browser.form.searchEdit.lineEdit().setText("nid:%d" % nid)
search = self.mw.col.search_string(nids=[nid])
browser.form.searchEdit.lineEdit().setText(search)
browser.onSearchActivated()
showText(err, type="html")
else: