349 html = html.replace( |
349 html = html.replace( |
350 "@FAVICON@", imageBuffer.buffer().toBase64()) |
350 "@FAVICON@", imageBuffer.buffer().toBase64()) |
351 html = html.replace("@TITLE@", title.encode("utf8")) |
351 html = html.replace("@TITLE@", title.encode("utf8")) |
352 html = html.replace("@H1@", info.errorString.encode("utf8")) |
352 html = html.replace("@H1@", info.errorString.encode("utf8")) |
353 html = html.replace( |
353 html = html.replace( |
354 "@H2@", self.trUtf8("When connecting to: {0}.") |
354 "@H2@", self.tr("When connecting to: {0}.") |
355 .format(urlString).encode("utf8")) |
355 .format(urlString).encode("utf8")) |
356 html = html.replace( |
356 html = html.replace( |
357 "@LI-1@", |
357 "@LI-1@", |
358 self.trUtf8("Check the address for errors such as " |
358 self.tr("Check the address for errors such as " |
359 "<b>ww</b>.example.org instead of " |
359 "<b>ww</b>.example.org instead of " |
360 "<b>www</b>.example.org").encode("utf8")) |
360 "<b>www</b>.example.org").encode("utf8")) |
361 html = html.replace( |
361 html = html.replace( |
362 "@LI-2@", |
362 "@LI-2@", |
363 self.trUtf8( |
363 self.tr( |
364 "If the address is correct, try checking the network " |
364 "If the address is correct, try checking the network " |
365 "connection.").encode("utf8")) |
365 "connection.").encode("utf8")) |
366 html = html.replace( |
366 html = html.replace( |
367 "@LI-3@", |
367 "@LI-3@", |
368 self.trUtf8( |
368 self.tr( |
369 "If your computer or network is protected by a firewall " |
369 "If your computer or network is protected by a firewall " |
370 "or proxy, make sure that the browser is permitted to " |
370 "or proxy, make sure that the browser is permitted to " |
371 "access the network.").encode("utf8")) |
371 "access the network.").encode("utf8")) |
372 html = html.replace( |
372 html = html.replace( |
373 "@LI-4@", |
373 "@LI-4@", |
374 self.trUtf8("If your cache policy is set to offline browsing," |
374 self.tr("If your cache policy is set to offline browsing," |
375 "only pages in the local cache are available.") |
375 "only pages in the local cache are available.") |
376 .encode("utf8")) |
376 .encode("utf8")) |
377 html = html.replace( |
377 html = html.replace( |
378 "@BUTTON@", self.trUtf8("Try Again").encode("utf8")) |
378 "@BUTTON@", self.tr("Try Again").encode("utf8")) |
379 errorPage.content = html |
379 errorPage.content = html |
380 return True |
380 return True |
381 |
381 |
382 return QWebPage.extension(self, extension, option, output) |
382 return QWebPage.extension(self, extension, option, output) |
383 |
383 |
833 name.toLocalFile().endswith(".CHM"): |
833 name.toLocalFile().endswith(".CHM"): |
834 started = QDesktopServices.openUrl(name) |
834 started = QDesktopServices.openUrl(name) |
835 if not started: |
835 if not started: |
836 E5MessageBox.critical( |
836 E5MessageBox.critical( |
837 self, |
837 self, |
838 self.trUtf8("eric5 Web Browser"), |
838 self.tr("eric5 Web Browser"), |
839 self.trUtf8( |
839 self.tr( |
840 """<p>Could not start a viewer""" |
840 """<p>Could not start a viewer""" |
841 """ for file <b>{0}</b>.</p>""") |
841 """ for file <b>{0}</b>.</p>""") |
842 .format(name.path())) |
842 .format(name.path())) |
843 return |
843 return |
844 elif name.scheme() in ["mailto"]: |
844 elif name.scheme() in ["mailto"]: |
845 started = QDesktopServices.openUrl(name) |
845 started = QDesktopServices.openUrl(name) |
846 if not started: |
846 if not started: |
847 E5MessageBox.critical( |
847 E5MessageBox.critical( |
848 self, |
848 self, |
849 self.trUtf8("eric5 Web Browser"), |
849 self.tr("eric5 Web Browser"), |
850 self.trUtf8( |
850 self.tr( |
851 """<p>Could not start an application""" |
851 """<p>Could not start an application""" |
852 """ for URL <b>{0}</b>.</p>""") |
852 """ for URL <b>{0}</b>.</p>""") |
853 .format(name.toString())) |
853 .format(name.toString())) |
854 return |
854 return |
855 elif name.scheme() == "javascript": |
855 elif name.scheme() == "javascript": |
1074 frameAtPos = self.page().frameAt(evt.pos()) |
1074 frameAtPos = self.page().frameAt(evt.pos()) |
1075 hit = self.page().mainFrame().hitTestContent(evt.pos()) |
1075 hit = self.page().mainFrame().hitTestContent(evt.pos()) |
1076 if not hit.linkUrl().isEmpty(): |
1076 if not hit.linkUrl().isEmpty(): |
1077 menu.addAction( |
1077 menu.addAction( |
1078 UI.PixmapCache.getIcon("openNewTab.png"), |
1078 UI.PixmapCache.getIcon("openNewTab.png"), |
1079 self.trUtf8("Open Link in New Tab\tCtrl+LMB"), |
1079 self.tr("Open Link in New Tab\tCtrl+LMB"), |
1080 self.__openLinkInNewTab).setData(hit.linkUrl()) |
1080 self.__openLinkInNewTab).setData(hit.linkUrl()) |
1081 menu.addSeparator() |
1081 menu.addSeparator() |
1082 menu.addAction( |
1082 menu.addAction( |
1083 UI.PixmapCache.getIcon("download.png"), |
1083 UI.PixmapCache.getIcon("download.png"), |
1084 self.trUtf8("Save Lin&k"), self.__downloadLink) |
1084 self.tr("Save Lin&k"), self.__downloadLink) |
1085 menu.addAction( |
1085 menu.addAction( |
1086 UI.PixmapCache.getIcon("bookmark22.png"), |
1086 UI.PixmapCache.getIcon("bookmark22.png"), |
1087 self.trUtf8("Bookmark this Link"), self.__bookmarkLink)\ |
1087 self.tr("Bookmark this Link"), self.__bookmarkLink)\ |
1088 .setData(hit.linkUrl()) |
1088 .setData(hit.linkUrl()) |
1089 menu.addSeparator() |
1089 menu.addSeparator() |
1090 menu.addAction( |
1090 menu.addAction( |
1091 UI.PixmapCache.getIcon("editCopy.png"), |
1091 UI.PixmapCache.getIcon("editCopy.png"), |
1092 self.trUtf8("Copy Link to Clipboard"), self.__copyLink) |
1092 self.tr("Copy Link to Clipboard"), self.__copyLink) |
1093 menu.addAction( |
1093 menu.addAction( |
1094 UI.PixmapCache.getIcon("mailSend.png"), |
1094 UI.PixmapCache.getIcon("mailSend.png"), |
1095 self.trUtf8("Send Link"), |
1095 self.tr("Send Link"), |
1096 self.__sendLink).setData(hit.linkUrl()) |
1096 self.__sendLink).setData(hit.linkUrl()) |
1097 if Preferences.getHelp("VirusTotalEnabled") and \ |
1097 if Preferences.getHelp("VirusTotalEnabled") and \ |
1098 Preferences.getHelp("VirusTotalServiceKey") != "": |
1098 Preferences.getHelp("VirusTotalServiceKey") != "": |
1099 menu.addAction( |
1099 menu.addAction( |
1100 UI.PixmapCache.getIcon("virustotal.png"), |
1100 UI.PixmapCache.getIcon("virustotal.png"), |
1101 self.trUtf8("Scan Link with VirusTotal"), |
1101 self.tr("Scan Link with VirusTotal"), |
1102 self.__virusTotal).setData(hit.linkUrl()) |
1102 self.__virusTotal).setData(hit.linkUrl()) |
1103 |
1103 |
1104 if not hit.imageUrl().isEmpty(): |
1104 if not hit.imageUrl().isEmpty(): |
1105 if not menu.isEmpty(): |
1105 if not menu.isEmpty(): |
1106 menu.addSeparator() |
1106 menu.addSeparator() |
1107 menu.addAction( |
1107 menu.addAction( |
1108 UI.PixmapCache.getIcon("openNewTab.png"), |
1108 UI.PixmapCache.getIcon("openNewTab.png"), |
1109 self.trUtf8("Open Image in New Tab"), |
1109 self.tr("Open Image in New Tab"), |
1110 self.__openLinkInNewTab).setData(hit.imageUrl()) |
1110 self.__openLinkInNewTab).setData(hit.imageUrl()) |
1111 menu.addSeparator() |
1111 menu.addSeparator() |
1112 menu.addAction( |
1112 menu.addAction( |
1113 UI.PixmapCache.getIcon("download.png"), |
1113 UI.PixmapCache.getIcon("download.png"), |
1114 self.trUtf8("Save Image"), self.__downloadImage) |
1114 self.tr("Save Image"), self.__downloadImage) |
1115 menu.addAction( |
1115 menu.addAction( |
1116 self.trUtf8("Copy Image to Clipboard"), self.__copyImage) |
1116 self.tr("Copy Image to Clipboard"), self.__copyImage) |
1117 menu.addAction( |
1117 menu.addAction( |
1118 UI.PixmapCache.getIcon("editCopy.png"), |
1118 UI.PixmapCache.getIcon("editCopy.png"), |
1119 self.trUtf8("Copy Image Location to Clipboard"), |
1119 self.tr("Copy Image Location to Clipboard"), |
1120 self.__copyLocation).setData(hit.imageUrl().toString()) |
1120 self.__copyLocation).setData(hit.imageUrl().toString()) |
1121 menu.addAction( |
1121 menu.addAction( |
1122 UI.PixmapCache.getIcon("mailSend.png"), |
1122 UI.PixmapCache.getIcon("mailSend.png"), |
1123 self.trUtf8("Send Image Link"), |
1123 self.tr("Send Image Link"), |
1124 self.__sendLink).setData(hit.imageUrl()) |
1124 self.__sendLink).setData(hit.imageUrl()) |
1125 menu.addSeparator() |
1125 menu.addSeparator() |
1126 menu.addAction( |
1126 menu.addAction( |
1127 UI.PixmapCache.getIcon("adBlockPlus.png"), |
1127 UI.PixmapCache.getIcon("adBlockPlus.png"), |
1128 self.trUtf8("Block Image"), self.__blockImage)\ |
1128 self.tr("Block Image"), self.__blockImage)\ |
1129 .setData(hit.imageUrl().toString()) |
1129 .setData(hit.imageUrl().toString()) |
1130 if Preferences.getHelp("VirusTotalEnabled") and \ |
1130 if Preferences.getHelp("VirusTotalEnabled") and \ |
1131 Preferences.getHelp("VirusTotalServiceKey") != "": |
1131 Preferences.getHelp("VirusTotalServiceKey") != "": |
1132 menu.addAction( |
1132 menu.addAction( |
1133 UI.PixmapCache.getIcon("virustotal.png"), |
1133 UI.PixmapCache.getIcon("virustotal.png"), |
1134 self.trUtf8("Scan Image with VirusTotal"), |
1134 self.tr("Scan Image with VirusTotal"), |
1135 self.__virusTotal).setData(hit.imageUrl()) |
1135 self.__virusTotal).setData(hit.imageUrl()) |
1136 |
1136 |
1137 element = hit.element() |
1137 element = hit.element() |
1138 if not element.isNull(): |
1138 if not element.isNull(): |
1139 if self.__isMediaElement(element): |
1139 if self.__isMediaElement(element): |
1147 videoUrl = QUrl(element.evaluateJavaScript("this.currentSrc")) |
1147 videoUrl = QUrl(element.evaluateJavaScript("this.currentSrc")) |
1148 |
1148 |
1149 if paused: |
1149 if paused: |
1150 menu.addAction( |
1150 menu.addAction( |
1151 UI.PixmapCache.getIcon("mediaPlaybackStart.png"), |
1151 UI.PixmapCache.getIcon("mediaPlaybackStart.png"), |
1152 self.trUtf8("Play"), self.__pauseMedia) |
1152 self.tr("Play"), self.__pauseMedia) |
1153 else: |
1153 else: |
1154 menu.addAction( |
1154 menu.addAction( |
1155 UI.PixmapCache.getIcon("mediaPlaybackPause.png"), |
1155 UI.PixmapCache.getIcon("mediaPlaybackPause.png"), |
1156 self.trUtf8("Pause"), self.__pauseMedia) |
1156 self.tr("Pause"), self.__pauseMedia) |
1157 if muted: |
1157 if muted: |
1158 menu.addAction( |
1158 menu.addAction( |
1159 UI.PixmapCache.getIcon("audioVolumeHigh.png"), |
1159 UI.PixmapCache.getIcon("audioVolumeHigh.png"), |
1160 self.trUtf8("Unmute"), self.__muteMedia) |
1160 self.tr("Unmute"), self.__muteMedia) |
1161 else: |
1161 else: |
1162 menu.addAction( |
1162 menu.addAction( |
1163 UI.PixmapCache.getIcon("audioVolumeMuted.png"), |
1163 UI.PixmapCache.getIcon("audioVolumeMuted.png"), |
1164 self.trUtf8("Mute"), self.__muteMedia) |
1164 self.tr("Mute"), self.__muteMedia) |
1165 menu.addSeparator() |
1165 menu.addSeparator() |
1166 menu.addAction( |
1166 menu.addAction( |
1167 UI.PixmapCache.getIcon("editCopy.png"), |
1167 UI.PixmapCache.getIcon("editCopy.png"), |
1168 self.trUtf8("Copy Media Address to Clipboard"), |
1168 self.tr("Copy Media Address to Clipboard"), |
1169 self.__copyLocation).setData(videoUrl.toString()) |
1169 self.__copyLocation).setData(videoUrl.toString()) |
1170 menu.addAction( |
1170 menu.addAction( |
1171 UI.PixmapCache.getIcon("mailSend.png"), |
1171 UI.PixmapCache.getIcon("mailSend.png"), |
1172 self.trUtf8("Send Media Address"), self.__sendLink)\ |
1172 self.tr("Send Media Address"), self.__sendLink)\ |
1173 .setData(videoUrl) |
1173 .setData(videoUrl) |
1174 menu.addAction( |
1174 menu.addAction( |
1175 UI.PixmapCache.getIcon("download.png"), |
1175 UI.PixmapCache.getIcon("download.png"), |
1176 self.trUtf8("Save Media"), self.__downloadMedia)\ |
1176 self.tr("Save Media"), self.__downloadMedia)\ |
1177 .setData(videoUrl) |
1177 .setData(videoUrl) |
1178 |
1178 |
1179 if element.tagName().lower() in ["input", "textarea"]: |
1179 if element.tagName().lower() in ["input", "textarea"]: |
1180 if menu.isEmpty(): |
1180 if menu.isEmpty(): |
1181 pageMenu = self.page().createStandardContextMenu() |
1181 pageMenu = self.page().createStandardContextMenu() |
1212 menu.addAction(self.mw.saveAsAct) |
1212 menu.addAction(self.mw.saveAsAct) |
1213 menu.addSeparator() |
1213 menu.addSeparator() |
1214 |
1214 |
1215 if frameAtPos and self.page().mainFrame() != frameAtPos: |
1215 if frameAtPos and self.page().mainFrame() != frameAtPos: |
1216 self.__clickedFrame = frameAtPos |
1216 self.__clickedFrame = frameAtPos |
1217 fmenu = QMenu(self.trUtf8("This Frame")) |
1217 fmenu = QMenu(self.tr("This Frame")) |
1218 frameUrl = self.__clickedFrame.url() |
1218 frameUrl = self.__clickedFrame.url() |
1219 if frameUrl.isValid(): |
1219 if frameUrl.isValid(): |
1220 fmenu.addAction( |
1220 fmenu.addAction( |
1221 self.trUtf8("Show &only this frame"), |
1221 self.tr("Show &only this frame"), |
1222 self.__loadClickedFrame) |
1222 self.__loadClickedFrame) |
1223 fmenu.addAction( |
1223 fmenu.addAction( |
1224 UI.PixmapCache.getIcon("openNewTab.png"), |
1224 UI.PixmapCache.getIcon("openNewTab.png"), |
1225 self.trUtf8("Show in new &tab"), |
1225 self.tr("Show in new &tab"), |
1226 self.__openLinkInNewTab).setData(self.__clickedFrame.url()) |
1226 self.__openLinkInNewTab).setData(self.__clickedFrame.url()) |
1227 fmenu.addSeparator() |
1227 fmenu.addSeparator() |
1228 fmenu.addAction( |
1228 fmenu.addAction( |
1229 UI.PixmapCache.getIcon("print.png"), |
1229 UI.PixmapCache.getIcon("print.png"), |
1230 self.trUtf8("&Print"), self.__printClickedFrame) |
1230 self.tr("&Print"), self.__printClickedFrame) |
1231 fmenu.addAction( |
1231 fmenu.addAction( |
1232 UI.PixmapCache.getIcon("printPreview.png"), |
1232 UI.PixmapCache.getIcon("printPreview.png"), |
1233 self.trUtf8("Print Preview"), self.__printPreviewClickedFrame) |
1233 self.tr("Print Preview"), self.__printPreviewClickedFrame) |
1234 fmenu.addAction( |
1234 fmenu.addAction( |
1235 UI.PixmapCache.getIcon("printPdf.png"), |
1235 UI.PixmapCache.getIcon("printPdf.png"), |
1236 self.trUtf8("Print as PDF"), self.__printPdfClickedFrame) |
1236 self.tr("Print as PDF"), self.__printPdfClickedFrame) |
1237 fmenu.addSeparator() |
1237 fmenu.addSeparator() |
1238 fmenu.addAction( |
1238 fmenu.addAction( |
1239 UI.PixmapCache.getIcon("zoomIn.png"), |
1239 UI.PixmapCache.getIcon("zoomIn.png"), |
1240 self.trUtf8("Zoom &in"), self.__zoomInClickedFrame) |
1240 self.tr("Zoom &in"), self.__zoomInClickedFrame) |
1241 fmenu.addAction( |
1241 fmenu.addAction( |
1242 UI.PixmapCache.getIcon("zoomReset.png"), |
1242 UI.PixmapCache.getIcon("zoomReset.png"), |
1243 self.trUtf8("Zoom &reset"), self.__zoomResetClickedFrame) |
1243 self.tr("Zoom &reset"), self.__zoomResetClickedFrame) |
1244 fmenu.addAction( |
1244 fmenu.addAction( |
1245 UI.PixmapCache.getIcon("zoomOut.png"), |
1245 UI.PixmapCache.getIcon("zoomOut.png"), |
1246 self.trUtf8("Zoom &out"), self.__zoomOutClickedFrame) |
1246 self.tr("Zoom &out"), self.__zoomOutClickedFrame) |
1247 fmenu.addSeparator() |
1247 fmenu.addSeparator() |
1248 fmenu.addAction( |
1248 fmenu.addAction( |
1249 self.trUtf8("Show frame so&urce"), |
1249 self.tr("Show frame so&urce"), |
1250 self.__showClickedFrameSource) |
1250 self.__showClickedFrameSource) |
1251 |
1251 |
1252 menu.addMenu(fmenu) |
1252 menu.addMenu(fmenu) |
1253 menu.addSeparator() |
1253 menu.addSeparator() |
1254 |
1254 |
1255 menu.addAction( |
1255 menu.addAction( |
1256 UI.PixmapCache.getIcon("bookmark22.png"), |
1256 UI.PixmapCache.getIcon("bookmark22.png"), |
1257 self.trUtf8("Bookmark this Page"), self.addBookmark) |
1257 self.tr("Bookmark this Page"), self.addBookmark) |
1258 menu.addAction( |
1258 menu.addAction( |
1259 UI.PixmapCache.getIcon("mailSend.png"), |
1259 UI.PixmapCache.getIcon("mailSend.png"), |
1260 self.trUtf8("Send Page Link"), self.__sendLink).setData(self.url()) |
1260 self.tr("Send Page Link"), self.__sendLink).setData(self.url()) |
1261 menu.addSeparator() |
1261 menu.addSeparator() |
1262 self.__userAgentMenu = UserAgentMenu(self.trUtf8("User Agent"), |
1262 self.__userAgentMenu = UserAgentMenu(self.tr("User Agent"), |
1263 url=self.url()) |
1263 url=self.url()) |
1264 menu.addMenu(self.__userAgentMenu) |
1264 menu.addMenu(self.__userAgentMenu) |
1265 menu.addSeparator() |
1265 menu.addSeparator() |
1266 menu.addAction(self.mw.backAct) |
1266 menu.addAction(self.mw.backAct) |
1267 menu.addAction(self.mw.forwardAct) |
1267 menu.addAction(self.mw.forwardAct) |
1273 menu.addSeparator() |
1273 menu.addSeparator() |
1274 if self.selectedText(): |
1274 if self.selectedText(): |
1275 menu.addAction(self.mw.copyAct) |
1275 menu.addAction(self.mw.copyAct) |
1276 menu.addAction( |
1276 menu.addAction( |
1277 UI.PixmapCache.getIcon("mailSend.png"), |
1277 UI.PixmapCache.getIcon("mailSend.png"), |
1278 self.trUtf8("Send Text"), |
1278 self.tr("Send Text"), |
1279 self.__sendLink).setData(self.selectedText()) |
1279 self.__sendLink).setData(self.selectedText()) |
1280 menu.addAction(self.mw.findAct) |
1280 menu.addAction(self.mw.findAct) |
1281 menu.addSeparator() |
1281 menu.addSeparator() |
1282 if self.selectedText(): |
1282 if self.selectedText(): |
1283 self.__searchMenu = menu.addMenu(self.trUtf8("Search with...")) |
1283 self.__searchMenu = menu.addMenu(self.tr("Search with...")) |
1284 |
1284 |
1285 from .OpenSearch.OpenSearchEngineAction import \ |
1285 from .OpenSearch.OpenSearchEngineAction import \ |
1286 OpenSearchEngineAction |
1286 OpenSearchEngineAction |
1287 engineNames = self.mw.openSearchManager().allEnginesNames() |
1287 engineNames = self.mw.openSearchManager().allEnginesNames() |
1288 for engineName in engineNames: |
1288 for engineName in engineNames: |
1305 googleTranslatorUrl = QUrl( |
1305 googleTranslatorUrl = QUrl( |
1306 "http://translate.google.com/#auto|{0}|{1}".format( |
1306 "http://translate.google.com/#auto|{0}|{1}".format( |
1307 langCode, self.selectedText())) |
1307 langCode, self.selectedText())) |
1308 menu.addAction( |
1308 menu.addAction( |
1309 UI.PixmapCache.getIcon("translate.png"), |
1309 UI.PixmapCache.getIcon("translate.png"), |
1310 self.trUtf8("Google Translate"), self.__openLinkInNewTab)\ |
1310 self.tr("Google Translate"), self.__openLinkInNewTab)\ |
1311 .setData(googleTranslatorUrl) |
1311 .setData(googleTranslatorUrl) |
1312 wiktionaryUrl = QUrl( |
1312 wiktionaryUrl = QUrl( |
1313 "http://{0}.wiktionary.org/wiki/Special:Search?search={1}" |
1313 "http://{0}.wiktionary.org/wiki/Special:Search?search={1}" |
1314 .format(langCode, self.selectedText())) |
1314 .format(langCode, self.selectedText())) |
1315 menu.addAction( |
1315 menu.addAction( |
1316 UI.PixmapCache.getIcon("wikipedia.png"), |
1316 UI.PixmapCache.getIcon("wikipedia.png"), |
1317 self.trUtf8("Dictionary"), self.__openLinkInNewTab)\ |
1317 self.tr("Dictionary"), self.__openLinkInNewTab)\ |
1318 .setData(wiktionaryUrl) |
1318 .setData(wiktionaryUrl) |
1319 menu.addSeparator() |
1319 menu.addSeparator() |
1320 |
1320 |
1321 guessedUrl = QUrl.fromUserInput(self.selectedText().strip()) |
1321 guessedUrl = QUrl.fromUserInput(self.selectedText().strip()) |
1322 if self.__isUrlValid(guessedUrl): |
1322 if self.__isUrlValid(guessedUrl): |
1323 menu.addAction( |
1323 menu.addAction( |
1324 self.trUtf8("Go to web address"), |
1324 self.tr("Go to web address"), |
1325 self.__openLinkInNewTab).setData(guessedUrl) |
1325 self.__openLinkInNewTab).setData(guessedUrl) |
1326 menu.addSeparator() |
1326 menu.addSeparator() |
1327 |
1327 |
1328 element = hit.element() |
1328 element = hit.element() |
1329 if not element.isNull() and \ |
1329 if not element.isNull() and \ |
1330 element.tagName().lower() == "input" and \ |
1330 element.tagName().lower() == "input" and \ |
1331 element.attribute("type", "text") == "text": |
1331 element.attribute("type", "text") == "text": |
1332 menu.addAction(self.trUtf8("Add to web search toolbar"), |
1332 menu.addAction(self.tr("Add to web search toolbar"), |
1333 self.__addSearchEngine).setData(element) |
1333 self.__addSearchEngine).setData(element) |
1334 menu.addSeparator() |
1334 menu.addSeparator() |
1335 |
1335 |
1336 menu.addAction( |
1336 menu.addAction( |
1337 UI.PixmapCache.getIcon("webInspector.png"), |
1337 UI.PixmapCache.getIcon("webInspector.png"), |
1338 self.trUtf8("Web Inspector..."), self.__webInspector) |
1338 self.tr("Web Inspector..."), self.__webInspector) |
1339 |
1339 |
1340 menu.exec_(evt.globalPos()) |
1340 menu.exec_(evt.globalPos()) |
1341 |
1341 |
1342 def __isUrlValid(self, url): |
1342 def __isUrlValid(self, url): |
1343 """ |
1343 """ |
1950 if pixmap.save(imageBuffer, "PNG"): |
1950 if pixmap.save(imageBuffer, "PNG"): |
1951 html = html.replace("@FAVICON@", imageBuffer.buffer().toBase64()) |
1951 html = html.replace("@FAVICON@", imageBuffer.buffer().toBase64()) |
1952 html = html.replace("@TITLE@", title.encode("utf8")) |
1952 html = html.replace("@TITLE@", title.encode("utf8")) |
1953 html = html.replace("@H1@", reply.errorString().encode("utf8")) |
1953 html = html.replace("@H1@", reply.errorString().encode("utf8")) |
1954 html = html.replace( |
1954 html = html.replace( |
1955 "@H2@", self.trUtf8("When connecting to: {0}.") |
1955 "@H2@", self.tr("When connecting to: {0}.") |
1956 .format(urlString).encode("utf8")) |
1956 .format(urlString).encode("utf8")) |
1957 html = html.replace( |
1957 html = html.replace( |
1958 "@LI-1@", |
1958 "@LI-1@", |
1959 self.trUtf8("Check the address for errors such as " |
1959 self.tr("Check the address for errors such as " |
1960 "<b>ww</b>.example.org instead of " |
1960 "<b>ww</b>.example.org instead of " |
1961 "<b>www</b>.example.org").encode("utf8")) |
1961 "<b>www</b>.example.org").encode("utf8")) |
1962 html = html.replace( |
1962 html = html.replace( |
1963 "@LI-2@", |
1963 "@LI-2@", |
1964 self.trUtf8("If the address is correct, try checking the network " |
1964 self.tr("If the address is correct, try checking the network " |
1965 "connection.").encode("utf8")) |
1965 "connection.").encode("utf8")) |
1966 html = html.replace( |
1966 html = html.replace( |
1967 "@LI-3@", |
1967 "@LI-3@", |
1968 self.trUtf8( |
1968 self.tr( |
1969 "If your computer or network is protected by a firewall " |
1969 "If your computer or network is protected by a firewall " |
1970 "or proxy, make sure that the browser is permitted to " |
1970 "or proxy, make sure that the browser is permitted to " |
1971 "access the network.").encode("utf8")) |
1971 "access the network.").encode("utf8")) |
1972 html = html.replace( |
1972 html = html.replace( |
1973 "@LI-4@", |
1973 "@LI-4@", |
1974 self.trUtf8("If your cache policy is set to offline browsing," |
1974 self.tr("If your cache policy is set to offline browsing," |
1975 "only pages in the local cache are available.") |
1975 "only pages in the local cache are available.") |
1976 .encode("utf8")) |
1976 .encode("utf8")) |
1977 html = html.replace( |
1977 html = html.replace( |
1978 "@BUTTON@", self.trUtf8("Try Again").encode("utf8")) |
1978 "@BUTTON@", self.tr("Try Again").encode("utf8")) |
1979 notFoundFrame.setHtml(bytes(html).decode("utf8"), replyUrl) |
1979 notFoundFrame.setHtml(bytes(html).decode("utf8"), replyUrl) |
1980 self.mw.historyManager().removeHistoryEntry(replyUrl, self.title()) |
1980 self.mw.historyManager().removeHistoryEntry(replyUrl, self.title()) |
1981 self.loadFinished.emit(False) |
1981 self.loadFinished.emit(False) |
1982 |
1982 |
1983 def __downloadRequested(self, request): |
1983 def __downloadRequested(self, request): |
2002 # accessed for the first time |
2002 # accessed for the first time |
2003 return |
2003 return |
2004 |
2004 |
2005 res = E5MessageBox.yesNo( |
2005 res = E5MessageBox.yesNo( |
2006 self, |
2006 self, |
2007 self.trUtf8("Web Database Quota"), |
2007 self.tr("Web Database Quota"), |
2008 self.trUtf8( |
2008 self.tr( |
2009 """<p>The database quota of <strong>{0}</strong> has""" |
2009 """<p>The database quota of <strong>{0}</strong> has""" |
2010 """ been exceeded while accessing database <strong>{1}""" |
2010 """ been exceeded while accessing database <strong>{1}""" |
2011 """</strong>.</p><p>Shall it be changed?</p>""") |
2011 """</strong>.</p><p>Shall it be changed?</p>""") |
2012 .format(self.__dataString(securityOrigin.databaseQuota()), |
2012 .format(self.__dataString(securityOrigin.databaseQuota()), |
2013 databaseName), |
2013 databaseName), |
2014 yesDefault=True) |
2014 yesDefault=True) |
2015 if res: |
2015 if res: |
2016 newQuota, ok = QInputDialog.getInt( |
2016 newQuota, ok = QInputDialog.getInt( |
2017 self, |
2017 self, |
2018 self.trUtf8("New Web Database Quota"), |
2018 self.tr("New Web Database Quota"), |
2019 self.trUtf8( |
2019 self.tr( |
2020 "Enter the new quota in MB (current = {0}, used = {1}; " |
2020 "Enter the new quota in MB (current = {0}, used = {1}; " |
2021 "step size = 5 MB):" |
2021 "step size = 5 MB):" |
2022 .format( |
2022 .format( |
2023 self.__dataString(securityOrigin.databaseQuota()), |
2023 self.__dataString(securityOrigin.databaseQuota()), |
2024 self.__dataString(securityOrigin.databaseUsage()))), |
2024 self.__dataString(securityOrigin.databaseUsage()))), |