272 None, |
272 None, |
273 self.trUtf8("Select files to upload..."), |
273 self.trUtf8("Select files to upload..."), |
274 suggestedFileName) |
274 suggestedFileName) |
275 return True |
275 return True |
276 |
276 |
277 ## if (extension == ChooseMultipleFilesExtension) { |
|
278 ## const QWebPage::ChooseMultipleFilesExtensionOption* exOption = static_cast<const QWebPage::ChooseMultipleFilesExtensionOption*>(option); |
|
279 ## QWebPage::ChooseMultipleFilesExtensionReturn* exReturn = static_cast<QWebPage::ChooseMultipleFilesExtensionReturn*>(output); |
|
280 ## |
|
281 ## if (!exOption || !exReturn) { |
|
282 ## return QWebPage::extension(extension, option, output); |
|
283 ## } |
|
284 ## |
|
285 ## QString suggestedFileName; |
|
286 ## if (!exOption->suggestedFileNames.isEmpty()) { |
|
287 ## suggestedFileName = exOption->suggestedFileNames.at(0); |
|
288 ## } |
|
289 ## |
|
290 ## exReturn->fileNames = QFileDialog::getOpenFileNames(0, tr("Select files to upload..."), suggestedFileName); |
|
291 ## return true; |
|
292 ## } |
|
293 if extension == QWebPage.ErrorPageExtension: |
277 if extension == QWebPage.ErrorPageExtension: |
294 info = sip.cast(option, QWebPage.ErrorPageExtensionOption) |
278 info = sip.cast(option, QWebPage.ErrorPageExtensionOption) |
295 if info.error == 102: |
279 if info.error == 102: |
296 # this is something of a hack; hopefully it will work in the future |
280 # this is something of a hack; hopefully it will work in the future |
297 return False |
281 return False |
617 |
601 |
618 self.__rss = [] |
602 self.__rss = [] |
619 |
603 |
620 self.__clickedFrame = None |
604 self.__clickedFrame = None |
621 |
605 |
|
606 self.mw.personalInformationManager().connectPage(self.page()) |
|
607 |
622 self.grabGesture(Qt.PinchGesture) |
608 self.grabGesture(Qt.PinchGesture) |
623 |
609 |
624 def __addExternalBinding(self, frame=None): |
610 def __addExternalBinding(self, frame=None): |
625 """ |
611 """ |
626 Private slot to add javascript bindings for adding search providers. |
612 Private slot to add javascript bindings for adding search providers. |
1042 self.trUtf8("Save Media"), self.__downloadMedia)\ |
1028 self.trUtf8("Save Media"), self.__downloadMedia)\ |
1043 .setData(videoUrl) |
1029 .setData(videoUrl) |
1044 |
1030 |
1045 if element.tagName().lower() in ["input", "textarea"]: |
1031 if element.tagName().lower() in ["input", "textarea"]: |
1046 if menu.isEmpty(): |
1032 if menu.isEmpty(): |
1047 self.page().createStandardContextMenu().exec_(evt.globalPos()) |
1033 pageMenu = self.page().createStandardContextMenu() |
1048 return |
1034 directionFound = False # used to detect double direction entry |
|
1035 for act in pageMenu.actions(): |
|
1036 if act.isSeparator(): |
|
1037 menu.addSeparator() |
|
1038 continue |
|
1039 if act.menu(): |
|
1040 if self.pageAction(QWebPage.SetTextDirectionDefault) in \ |
|
1041 act.menu().actions(): |
|
1042 if directionFound: |
|
1043 act.setVisible(False) |
|
1044 directionFound = True |
|
1045 elif self.pageAction(QWebPage.ToggleBold) in \ |
|
1046 act.menu().actions(): |
|
1047 act.setVisible(False) |
|
1048 elif act == self.pageAction(QWebPage.InspectElement): |
|
1049 # we have our own inspect entry |
|
1050 act.setVisible(False) |
|
1051 menu.addAction(act) |
|
1052 pageMenu = None |
1049 |
1053 |
1050 if not menu.isEmpty(): |
1054 if not menu.isEmpty(): |
1051 menu.addSeparator() |
1055 menu.addSeparator() |
|
1056 |
|
1057 self.mw.personalInformationManager().createSubMenu(menu, self, hit) |
|
1058 |
1052 menu.addAction(self.mw.newTabAct) |
1059 menu.addAction(self.mw.newTabAct) |
1053 menu.addAction(self.mw.newAct) |
1060 menu.addAction(self.mw.newAct) |
1054 menu.addSeparator() |
1061 menu.addSeparator() |
1055 menu.addAction(self.mw.saveAsAct) |
1062 menu.addAction(self.mw.saveAsAct) |
1056 menu.addSeparator() |
1063 menu.addSeparator() |
1112 self.__searchMenu = menu.addMenu(self.trUtf8("Search with...")) |
1119 self.__searchMenu = menu.addMenu(self.trUtf8("Search with...")) |
1113 |
1120 |
1114 engineNames = self.mw.openSearchManager().allEnginesNames() |
1121 engineNames = self.mw.openSearchManager().allEnginesNames() |
1115 for engineName in engineNames: |
1122 for engineName in engineNames: |
1116 engine = self.mw.openSearchManager().engine(engineName) |
1123 engine = self.mw.openSearchManager().engine(engineName) |
1117 self.__searchMenu.addAction( |
1124 act = OpenSearchEngineAction(engine, self.__searchMenu) |
1118 OpenSearchEngineAction(engine, self.__searchMenu).setData(engineName)) |
1125 act.setData(engineName) |
|
1126 self.__searchMenu.addAction(act) |
1119 self.__searchMenu.triggered.connect(self.__searchRequested) |
1127 self.__searchMenu.triggered.connect(self.__searchRequested) |
1120 |
1128 |
1121 menu.addSeparator() |
1129 menu.addSeparator() |
1122 |
1130 |
1123 languages = Preferences.toList( |
1131 languages = Preferences.toList( |
1302 return |
1310 return |
1303 |
1311 |
1304 engineName = act.data() |
1312 engineName = act.data() |
1305 if engineName: |
1313 if engineName: |
1306 engine = self.mw.openSearchManager().engine(engineName) |
1314 engine = self.mw.openSearchManager().engine(engineName) |
1307 self.search.connect(engine.searchUrl(searchText)) |
1315 self.search.emit(engine.searchUrl(searchText)) |
1308 |
1316 |
1309 def __addSearchEngine(self): |
1317 def __addSearchEngine(self): |
1310 """ |
1318 """ |
1311 Private slot to add a new search engine. |
1319 Private slot to add a new search engine. |
1312 """ |
1320 """ |
1528 """ |
1536 """ |
1529 Protected method called by a key press. |
1537 Protected method called by a key press. |
1530 |
1538 |
1531 @param evt reference to the key event (QKeyEvent) |
1539 @param evt reference to the key event (QKeyEvent) |
1532 """ |
1540 """ |
|
1541 if self.mw.personalInformationManager().viewKeyPressEvent(self, evt): |
|
1542 return |
|
1543 |
1533 if hasattr(QtWebKit, 'QWebElement'): |
1544 if hasattr(QtWebKit, 'QWebElement'): |
1534 if self.__enableAccessKeys: |
1545 if self.__enableAccessKeys: |
1535 self.__accessKeysPressed = ( |
1546 self.__accessKeysPressed = ( |
1536 evt.modifiers() == Qt.ControlModifier and \ |
1547 evt.modifiers() == Qt.ControlModifier and \ |
1537 evt.key() == Qt.Key_Control) |
1548 evt.key() == Qt.Key_Control) |