5 |
5 |
6 """ |
6 """ |
7 Module implementing the AdBlock icon for the main window status bar. |
7 Module implementing the AdBlock icon for the main window status bar. |
8 """ |
8 """ |
9 |
9 |
10 from PyQt5.QtCore import Qt |
10 from PyQt6.QtCore import Qt |
11 from PyQt5.QtWidgets import QAction, QMenu |
11 from PyQt6.QtGui import QAction |
|
12 from PyQt6.QtWidgets import QMenu |
12 |
13 |
13 from E5Gui.E5ClickableLabel import E5ClickableLabel |
14 from E5Gui.E5ClickableLabel import E5ClickableLabel |
14 |
15 |
15 import UI.PixmapCache |
16 import UI.PixmapCache |
16 |
17 |
92 menu.addSeparator() |
93 menu.addSeparator() |
93 menu.addAction( |
94 menu.addAction( |
94 UI.PixmapCache.getIcon("adBlockPlus"), |
95 UI.PixmapCache.getIcon("adBlockPlus"), |
95 self.tr("AdBlock Configuration..."), manager.showDialog) |
96 self.tr("AdBlock Configuration..."), manager.showDialog) |
96 |
97 |
|
98 # TODO: change this to return a QMenu |
97 def menuAction(self): |
99 def menuAction(self): |
98 """ |
100 """ |
99 Public method to get a reference to the menu action. |
101 Public method to get a reference to the menu action. |
100 |
102 |
101 @return reference to the menu action |
103 @return reference to the menu action |
102 @rtype QAction |
104 @rtype QAction |
103 """ |
105 """ |
104 if not self.__menuAction: |
106 if not self.__menuAction: |
105 self.__menuAction = QAction(self.tr("AdBlock"), self) |
107 self.__menuAction = QAction(self.tr("AdBlock"), self) |
|
108 # TODO: replace this obsolete function |
106 self.__menuAction.setMenu(QMenu()) |
109 self.__menuAction.setMenu(QMenu()) |
107 self.__menuAction.menu().aboutToShow.connect( |
110 self.__menuAction.menu().aboutToShow.connect( |
108 lambda: self.__createMenu(self.__menuAction.menu())) |
111 lambda: self.__createMenu(self.__menuAction.menu())) |
109 |
112 |
110 if self.__enabled: |
113 if self.__enabled: |