mirror of
https://github.com/ankitects/anki.git
synced 2025-09-22 16:02:23 -04:00
hyperlink added cards
This commit is contained in:
parent
23d39daeaa
commit
af67f6fa9c
3 changed files with 20 additions and 2 deletions
|
@ -88,6 +88,14 @@ class AddCards(QDialog):
|
||||||
c = unicode(p.color(QPalette.Window).name())
|
c = unicode(p.color(QPalette.Window).name())
|
||||||
self.dialog.status.setStyleSheet(
|
self.dialog.status.setStyleSheet(
|
||||||
"* { background: %s; color: #000000; }" % c)
|
"* { background: %s; color: #000000; }" % c)
|
||||||
|
self.connect(self.dialog.status, SIGNAL("anchorClicked(QUrl)"),
|
||||||
|
self.onLink)
|
||||||
|
|
||||||
|
def onLink(self, url):
|
||||||
|
browser = ui.dialogs.get("CardList", self.parent)
|
||||||
|
browser.dialog.filterEdit.setText("fid:" + url.toString())
|
||||||
|
browser.updateSearch()
|
||||||
|
browser.onFact()
|
||||||
|
|
||||||
def modelChanged(self, model):
|
def modelChanged(self, model):
|
||||||
oldFact = self.editor.fact
|
oldFact = self.editor.fact
|
||||||
|
@ -129,8 +137,11 @@ class AddCards(QDialog):
|
||||||
The input you have provided would make an empty
|
The input you have provided would make an empty
|
||||||
question or answer on all cards."""), parent=self)
|
question or answer on all cards."""), parent=self)
|
||||||
return
|
return
|
||||||
self.dialog.status.append(_("Added %(num)d card(s) for '%(str)s'.") % {
|
self.dialog.status.append(
|
||||||
|
_("Added %(num)d card(s) for <a href=\"%(id)d\">"
|
||||||
|
"%(str)s</a>.") % {
|
||||||
"num": len(fact.cards),
|
"num": len(fact.cards),
|
||||||
|
"id": fact.id,
|
||||||
# we're guaranteed that all fields will exist now
|
# we're guaranteed that all fields will exist now
|
||||||
"str": stripHTML(fact[fact.fields[0].name]),
|
"str": stripHTML(fact[fact.fields[0].name]),
|
||||||
})
|
})
|
||||||
|
|
|
@ -1057,6 +1057,7 @@ where id in %s""" % ids2str(sf))
|
||||||
|
|
||||||
def onFind(self):
|
def onFind(self):
|
||||||
self.dialog.filterEdit.setFocus()
|
self.dialog.filterEdit.setFocus()
|
||||||
|
self.dialog.filterEdit.selectAll()
|
||||||
|
|
||||||
def onFact(self):
|
def onFact(self):
|
||||||
self.editor.focusFirst()
|
self.editor.focusFirst()
|
||||||
|
|
|
@ -71,7 +71,7 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QTextEdit" name="status" >
|
<widget class="QTextBrowser" name="status" >
|
||||||
<property name="enabled" >
|
<property name="enabled" >
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
|
@ -143,6 +143,12 @@ p, li { white-space: pre-wrap; }
|
||||||
</style></head><body style=" font-family:'Sans Serif'; font-size:8pt; font-weight:400; font-style:normal;">
|
</style></head><body style=" font-family:'Sans Serif'; font-size:8pt; font-weight:400; font-style:normal;">
|
||||||
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial';"></p></body></html></string>
|
<p style="-qt-paragraph-type:empty; margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Arial';"></p></body></html></string>
|
||||||
</property>
|
</property>
|
||||||
|
<property name="textInteractionFlags" >
|
||||||
|
<set>Qt::TextBrowserInteraction</set>
|
||||||
|
</property>
|
||||||
|
<property name="openLinks" >
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|
Loading…
Reference in a new issue