Helpviewer/WebPlugins/ClickToFlash/ClickToFlash.py

changeset 2087
795992a5c561
parent 1970
02cf3bac079b
child 2107
1690f30db6f3
equal deleted inserted replaced
2085:b4c1f0b6dac2 2087:795992a5c561
6 """ 6 """
7 Module implementing the Flash blocker. 7 Module implementing the Flash blocker.
8 """ 8 """
9 9
10 10
11 from PyQt4.QtCore import pyqtSlot, QUrl, Qt, QByteArray, QTimer 11 from PyQt4.QtCore import pyqtSlot, QUrl, Qt, QByteArray, QTimer, qVersion
12 from PyQt4.QtGui import QWidget, QMenu, QCursor, QDialog, QLabel, QFormLayout 12 from PyQt4.QtGui import QWidget, QMenu, QCursor, QDialog, QLabel, QFormLayout
13 from PyQt4.QtNetwork import QNetworkRequest 13 from PyQt4.QtNetwork import QNetworkRequest
14 from PyQt4.QtWebKit import QWebHitTestResult, QWebElement, QWebView, QWebElementCollection 14 from PyQt4.QtWebKit import QWebHitTestResult, QWebElement, QWebView, QWebElementCollection
15 15
16 from .Ui_ClickToFlash import Ui_ClickToFlash 16 from .Ui_ClickToFlash import Ui_ClickToFlash
213 if checkString == "": 213 if checkString == "":
214 checkString = element.attribute("data") 214 checkString = element.attribute("data")
215 if checkString == "": 215 if checkString == "":
216 checkString = element.attribute("value") 216 checkString = element.attribute("value")
217 217
218 checkString = view.url().resolved(QUrl(checkString)).toString(QUrl.RemoveQuery) 218 if qVersion() >= "5.0.0":
219 checkString = view.url().resolved(QUrl(checkString)).toString(
220 QUrl.ComponentFormattingOptions(QUrl.RemoveQuery))
221 else:
222 checkString = view.url().resolved(QUrl(checkString)).toString(
223 QUrl.RemoveQuery)
219 return self.__url.toEncoded().contains(QByteArray(checkString.encode("utf-8"))) 224 return self.__url.toEncoded().contains(QByteArray(checkString.encode("utf-8")))
220 225
221 def __checkElement(self, element): 226 def __checkElement(self, element):
222 """ 227 """
223 Private slot to check an element against the saved arguments. 228 Private slot to check an element against the saved arguments.

eric ide

mercurial