123 line.setLineWidth(1) |
123 line.setLineWidth(1) |
124 line.setFrameStyle(QFrame.Shape.HLine | QFrame.Shadow.Sunken) |
124 line.setFrameStyle(QFrame.Shape.HLine | QFrame.Shadow.Sunken) |
125 layout.addWidget(line, rows, 0, 1, -1) |
125 layout.addWidget(line, rows, 0, 1, -1) |
126 rows += 1 |
126 rows += 1 |
127 |
127 |
128 page = self.__browser.page() |
|
129 scheme = page.registerProtocolHandlerRequestScheme() |
|
130 registeredUrl = WebBrowserWindow.protocolHandlerManager().protocolHandler( |
|
131 scheme |
|
132 ) |
|
133 if bool(scheme) and registeredUrl != page.registerProtocolHandlerRequestUrl(): |
|
134 horizontalLayout = QHBoxLayout() |
|
135 protocolHandlerLabel = QLabel( |
|
136 self.tr("Register as <b>{0}</b> links handler.").format(scheme), self |
|
137 ) |
|
138 protocolHandlerLabel.setSizePolicy( |
|
139 QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Preferred |
|
140 ) |
|
141 |
|
142 horizontalLayout.addWidget(protocolHandlerLabel) |
|
143 protocolHandlerButton = QPushButton(self.tr("Register"), self) |
|
144 horizontalLayout.addWidget(protocolHandlerButton) |
|
145 protocolHandlerButton.clicked.connect(self.__registerProtocolHandler) |
|
146 layout.addLayout(horizontalLayout, rows, 0, 1, -1) |
|
147 rows += 1 |
|
148 |
|
149 protocolHandlerLine = QFrame(self) |
|
150 protocolHandlerLine.setLineWidth(1) |
|
151 protocolHandlerLine.setFrameStyle(QFrame.Shape.HLine | QFrame.Shadow.Sunken) |
|
152 layout.addWidget(protocolHandlerLine, rows, 0, 1, -1) |
|
153 rows += 1 |
|
154 |
|
155 horizontalLayout = QHBoxLayout() |
128 horizontalLayout = QHBoxLayout() |
156 spacerItem = QSpacerItem( |
129 spacerItem = QSpacerItem( |
157 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum |
130 40, 20, QSizePolicy.Policy.Expanding, QSizePolicy.Policy.Minimum |
158 ) |
131 ) |
159 horizontalLayout.addItem(spacerItem) |
132 horizontalLayout.addItem(spacerItem) |
192 """ |
165 """ |
193 from .SiteInfoDialog import SiteInfoDialog |
166 from .SiteInfoDialog import SiteInfoDialog |
194 |
167 |
195 siteinfoDialog = SiteInfoDialog(self.__browser, self.__browser.mainWindow()) |
168 siteinfoDialog = SiteInfoDialog(self.__browser, self.__browser.mainWindow()) |
196 siteinfoDialog.show() |
169 siteinfoDialog.show() |
197 |
|
198 @pyqtSlot() |
|
199 def __registerProtocolHandler(self): |
|
200 """ |
|
201 Private slot to register a protocol handler. |
|
202 """ |
|
203 self.close() |
|
204 page = self.__browser.page() |
|
205 WebBrowserWindow.protocolHandlerManager().addProtocolHandler( |
|
206 page.registerProtocolHandlerRequestScheme(), |
|
207 page.registerProtocolHandlerRequestUrl(), |
|
208 ) |
|