12 from PyQt6.QtCore import QUrl |
12 from PyQt6.QtCore import QUrl |
13 from PyQt6.QtWidgets import QDialog, QPushButton, QLabel |
13 from PyQt6.QtWidgets import QDialog, QPushButton, QLabel |
14 |
14 |
15 from .Ui_FeedsDialog import Ui_FeedsDialog |
15 from .Ui_FeedsDialog import Ui_FeedsDialog |
16 |
16 |
17 import UI.PixmapCache |
17 from eric7.EricGui import EricPixmapCache |
18 from UI.NotificationWidget import NotificationTypes |
18 from eric7.UI.NotificationWidget import NotificationTypes |
19 |
19 |
20 |
20 |
21 class FeedsDialog(QDialog, Ui_FeedsDialog): |
21 class FeedsDialog(QDialog, Ui_FeedsDialog): |
22 """ |
22 """ |
23 Class implementing a dialog to add RSS feeds. |
23 Class implementing a dialog to add RSS feeds. |
33 @param parent reference to the parent widget (QWidget) |
33 @param parent reference to the parent widget (QWidget) |
34 """ |
34 """ |
35 super().__init__(parent) |
35 super().__init__(parent) |
36 self.setupUi(self) |
36 self.setupUi(self) |
37 |
37 |
38 self.iconLabel.setPixmap(UI.PixmapCache.getPixmap("rss48")) |
38 self.iconLabel.setPixmap(EricPixmapCache.getPixmap("rss48")) |
39 |
39 |
40 self.__browser = browser |
40 self.__browser = browser |
41 |
41 |
42 self.__availableFeeds = availableFeeds[:] |
42 self.__availableFeeds = availableFeeds[:] |
43 for row in range(len(self.__availableFeeds)): |
43 for row in range(len(self.__availableFeeds)): |
70 if not url.isValid(): |
70 if not url.isValid(): |
71 return |
71 return |
72 |
72 |
73 title = button.feed[0] if button.feed[0] else self.__browser.url().host() |
73 title = button.feed[0] if button.feed[0] else self.__browser.url().host() |
74 |
74 |
75 from WebBrowser.WebBrowserWindow import WebBrowserWindow |
75 from eric7.WebBrowser.WebBrowserWindow import WebBrowserWindow |
76 |
76 |
77 feedsManager = WebBrowserWindow.feedsManager() |
77 feedsManager = WebBrowserWindow.feedsManager() |
78 if feedsManager.addFeed(urlString, title, self.__browser.icon()): |
78 if feedsManager.addFeed(urlString, title, self.__browser.icon()): |
79 WebBrowserWindow.showNotification( |
79 WebBrowserWindow.showNotification( |
80 UI.PixmapCache.getPixmap("rss48"), |
80 EricPixmapCache.getPixmap("rss48"), |
81 self.tr("Add RSS Feed"), |
81 self.tr("Add RSS Feed"), |
82 self.tr("""The feed was added successfully."""), |
82 self.tr("""The feed was added successfully."""), |
83 ) |
83 ) |
84 else: |
84 else: |
85 WebBrowserWindow.showNotification( |
85 WebBrowserWindow.showNotification( |
86 UI.PixmapCache.getPixmap("rss48"), |
86 EricPixmapCache.getPixmap("rss48"), |
87 self.tr("Add RSS Feed"), |
87 self.tr("Add RSS Feed"), |
88 self.tr("""The feed was already added before."""), |
88 self.tr("""The feed was already added before."""), |
89 kind=NotificationTypes.WARNING, |
89 kind=NotificationTypes.WARNING, |
90 timeout=0, |
90 timeout=0, |
91 ) |
91 ) |