165 |
165 |
166 @param downloadItem reference to the download object containing the |
166 @param downloadItem reference to the download object containing the |
167 download data. |
167 download data. |
168 @type QWebEngineDownloadItem |
168 @type QWebEngineDownloadItem |
169 """ |
169 """ |
170 if downloadItem.url().isEmpty(): |
170 url = downloadItem.url() |
171 return |
171 if url.isEmpty(): |
|
172 return |
|
173 |
|
174 # Safe Browsing |
|
175 threatLists = WebBrowserWindow.safeBrowsingManager().lookupUrl(url) |
|
176 if threatLists: |
|
177 threatMessages = WebBrowserWindow.safeBrowsingManager()\ |
|
178 .getThreatMessages(threatLists) |
|
179 res = E5MessageBox.warning( |
|
180 WebBrowserWindow.getWindow(), |
|
181 self.tr("Suspicuous URL detected"), |
|
182 self.tr("<p>The URL <b>{0}</b> was found in the Safe Browsing" |
|
183 " database.</p>{1}").format(url.toString(), |
|
184 "".join(threatMessages)), |
|
185 E5MessageBox.StandardButtons( |
|
186 E5MessageBox.Abort | |
|
187 E5MessageBox.Ignore), |
|
188 E5MessageBox.Abort) |
|
189 if res == E5MessageBox.Abort: |
|
190 downloadItem.cancel() |
|
191 return |
172 |
192 |
173 from .DownloadItem import DownloadItem |
193 from .DownloadItem import DownloadItem |
174 itm = DownloadItem(downloadItem, parent=self) |
194 itm = DownloadItem(downloadItem, parent=self) |
175 self.__addItem(itm) |
195 self.__addItem(itm) |
176 |
196 |