From 5b2157d881df58fda4da331536dc9efa0d3458ba Mon Sep 17 00:00:00 2001 From: Jeena Paradies Date: Fri, 28 Dec 2012 13:07:01 +0100 Subject: [PATCH] linux opens external links in browser now --- Linux/Helper.py | 2 ++ Linux/Tentia.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Linux/Helper.py b/Linux/Helper.py index d2a4d64..54c5df8 100644 --- a/Linux/Helper.py +++ b/Linux/Helper.py @@ -8,6 +8,7 @@ from PyQt4.QtWebKit import QWebView class WebPage(QtWebKit.QWebPage): def __init__(self, parent=0, app=None): super(QtWebKit.QWebPage, self).__init__(parent) + self.setLinkDelegationPolicy(QtWebKit.QWebPage.DelegateExternalLinks) self.app = app def javaScriptConsoleMessage(self, message, lineNumber, sourceId): @@ -26,6 +27,7 @@ class WebViewCreator(QtWebKit.QWebView): self.app = app self.is_local = local + self.connect(self, SIGNAL("linkClicked (const QUrl&)"), self.app.controller.openQURL) self.setPage(WebPage(self, self.app)) def load_local(self, callback=None): diff --git a/Linux/Tentia.py b/Linux/Tentia.py index 192260f..7e76bdb 100755 --- a/Linux/Tentia.py +++ b/Linux/Tentia.py @@ -86,9 +86,16 @@ class Controller(QtCore.QObject): return "" @QtCore.pyqtSlot(str) - def openURL(self, url): + def openAuthorizationURL(self, url): self.app.oauth_implementation.handle_authentication(str(url)) + @QtCore.pyqtSlot(str) + def openURL(self, url): + QtGui.QDesktopServices.openUrl(QtCore.QUrl(url, QtCore.QUrl.TolerantMode)) + + def openQURL(self, url): + QtGui.QDesktopServices.openUrl(url) + @QtCore.pyqtSlot() def loggedIn(self): self.app.authentification_succeded()