make sure to open a browser when link clicked in preview

This commit is contained in:
Damien Elmes 2010-02-12 15:16:20 +09:00
parent 3bb16dc50a
commit 64cd0499ba

View file

@ -1089,6 +1089,9 @@ class PreviewDialog(QDialog):
self.dialog.setupUi(self)
self.dialog.webView.page().setLinkDelegationPolicy(
QWebPage.DelegateExternalLinks)
self.connect(self.dialog.webView,
SIGNAL("linkClicked(QUrl)"),
self.linkClicked)
self.dialog.comboBox.addItems(QStringList(
[c.cardModel.name for c in self.cards]))
self.connect(self.dialog.comboBox, SIGNAL("activated(int)"),
@ -1097,6 +1100,9 @@ class PreviewDialog(QDialog):
restoreGeom(self, "preview")
self.exec_()
def linkClicked(self, url):
QDesktopServices.openUrl(QUrl(url))
def updateCard(self):
c = self.cards[self.currentCard]
styles = (self.deck.css +