WebBrowser/Download/DownloadManager.py

changeset 6093
5ed91fe54bc9
parent 6091
7b989321d74c
child 6118
da9e08920e7c
equal deleted inserted replaced
6092:f0d60c3de700 6093:5ed91fe54bc9
171 url = downloadItem.url() 171 url = downloadItem.url()
172 if url.isEmpty(): 172 if url.isEmpty():
173 return 173 return
174 174
175 # Safe Browsing 175 # Safe Browsing
176 threatLists = WebBrowserWindow.safeBrowsingManager().lookupUrl(url) 176 from WebBrowser.SafeBrowsing.SafeBrowsingManager import \
177 if threatLists: 177 SafeBrowsingManager
178 threatMessages = WebBrowserWindow.safeBrowsingManager()\ 178 if SafeBrowsingManager.isEnabled():
179 .getThreatMessages(threatLists) 179 threatLists = WebBrowserWindow.safeBrowsingManager().lookupUrl(url)
180 res = E5MessageBox.warning( 180 if threatLists:
181 WebBrowserWindow.getWindow(), 181 threatMessages = WebBrowserWindow.safeBrowsingManager()\
182 self.tr("Suspicuous URL detected"), 182 .getThreatMessages(threatLists)
183 self.tr("<p>The URL <b>{0}</b> was found in the Safe Browsing" 183 res = E5MessageBox.warning(
184 " database.</p>{1}").format(url.toString(), 184 WebBrowserWindow.getWindow(),
185 "".join(threatMessages)), 185 self.tr("Suspicuous URL detected"),
186 E5MessageBox.StandardButtons( 186 self.tr("<p>The URL <b>{0}</b> was found in the Safe"
187 E5MessageBox.Abort | 187 " Browsing database.</p>{1}").format(
188 E5MessageBox.Ignore), 188 url.toString(), "".join(threatMessages)),
189 E5MessageBox.Abort) 189 E5MessageBox.StandardButtons(
190 if res == E5MessageBox.Abort: 190 E5MessageBox.Abort |
191 downloadItem.cancel() 191 E5MessageBox.Ignore),
192 return 192 E5MessageBox.Abort)
193 if res == E5MessageBox.Abort:
194 downloadItem.cancel()
195 return
193 196
194 from .DownloadItem import DownloadItem 197 from .DownloadItem import DownloadItem
195 itm = DownloadItem(downloadItem, parent=self) 198 itm = DownloadItem(downloadItem, parent=self)
196 self.__addItem(itm) 199 self.__addItem(itm)
197 200

eric ide

mercurial