hyperlink added cards

This commit is contained in:
Damien Elmes 2009-05-30 18:22:30 +09:00
parent 23d39daeaa
commit af67f6fa9c
3 changed files with 20 additions and 2 deletions

View file

@ -88,6 +88,14 @@ class AddCards(QDialog):
c = unicode(p.color(QPalette.Window).name())
self.dialog.status.setStyleSheet(
"* { 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):
oldFact = self.editor.fact
@ -129,8 +137,11 @@ class AddCards(QDialog):
The input you have provided would make an empty
question or answer on all cards."""), parent=self)
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),
"id": fact.id,
# we're guaranteed that all fields will exist now
"str": stripHTML(fact[fact.fields[0].name]),
})

View file

@ -1057,6 +1057,7 @@ where id in %s""" % ids2str(sf))
def onFind(self):
self.dialog.filterEdit.setFocus()
self.dialog.filterEdit.selectAll()
def onFact(self):
self.editor.focusFirst()

View file

@ -71,7 +71,7 @@
<bool>true</bool>
</property>
</widget>
<widget class="QTextEdit" name="status" >
<widget class="QTextBrowser" name="status" >
<property name="enabled" >
<bool>true</bool>
</property>
@ -143,6 +143,12 @@ p, li { white-space: pre-wrap; }
&lt;/style>&lt;/head>&lt;body style=" font-family:'Sans Serif'; font-size:8pt; font-weight:400; font-style:normal;">
&lt;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';">&lt;/p>&lt;/body>&lt;/html></string>
</property>
<property name="textInteractionFlags" >
<set>Qt::TextBrowserInteraction</set>
</property>
<property name="openLinks" >
<bool>false</bool>
</property>
</widget>
</widget>
</item>