7 Module implementing a dialog to add RSS feeds. |
7 Module implementing a dialog to add RSS feeds. |
8 """ |
8 """ |
9 |
9 |
10 from __future__ import unicode_literals |
10 from __future__ import unicode_literals |
11 |
11 |
12 from PyQt5.QtCore import QUrl |
12 from PyQt5.QtCore import QUrl, qVersion |
13 from PyQt5.QtWidgets import QDialog, QPushButton, QLabel |
13 from PyQt5.QtWidgets import QDialog, QPushButton, QLabel |
14 |
14 |
15 from E5Gui import E5MessageBox |
15 from E5Gui import E5MessageBox |
16 |
16 |
17 from .Ui_FeedsDialog import Ui_FeedsDialog |
17 from .Ui_FeedsDialog import Ui_FeedsDialog |
59 Private slot to add a RSS feed. |
59 Private slot to add a RSS feed. |
60 """ |
60 """ |
61 button = self.sender() |
61 button = self.sender() |
62 urlString = button.feed[1] |
62 urlString = button.feed[1] |
63 url = QUrl(urlString) |
63 url = QUrl(urlString) |
64 if not url.host(): |
64 if url.isRelative(): |
65 if not urlString.startswith("/"): |
65 url = self.__browser.url().resolved(url) |
66 urlString = "/" + urlString |
66 if qVersion() >= "5.0.0": |
67 urlString = self.__browser.url().host() + urlString |
67 urlString = url.toDisplayString(QUrl.FullyDecoded) |
68 tmpUrl = QUrl(urlString) |
68 else: |
69 if not tmpUrl.scheme(): |
69 urlString = url.toString() |
70 urlString = "http://" + urlString |
70 ## if not urlString.startswith("/"): |
71 tmpUrl = QUrl(urlString) |
71 ## urlString = "/" + urlString |
72 if not tmpUrl.scheme() or not tmpUrl.host(): |
72 ## urlString = self.__browser.url().host() + urlString |
73 return |
73 ## tmpUrl = QUrl(urlString) |
|
74 ## if not tmpUrl.scheme(): |
|
75 ## urlString = "http://" + urlString |
|
76 ## tmpUrl = QUrl(urlString) |
|
77 ## if not tmpUrl.scheme() or not tmpUrl.host(): |
|
78 ## return |
74 if not url.isValid(): |
79 if not url.isValid(): |
75 return |
80 return |
76 |
81 |
77 if button.feed[0]: |
82 if button.feed[0]: |
78 title = button.feed[0] |
83 title = button.feed[0] |