637:4e4c729e86cf | 638:265c31231d9d |
---|---|
13 from PyQt4.QtGui import * | 13 from PyQt4.QtGui import * |
14 from PyQt4.QtWebKit import QWebSettings, QWebDatabase, QWebSecurityOrigin | 14 from PyQt4.QtWebKit import QWebSettings, QWebDatabase, QWebSecurityOrigin |
15 from PyQt4.QtHelp import QHelpEngine, QHelpEngineCore, QHelpSearchQuery | 15 from PyQt4.QtHelp import QHelpEngine, QHelpEngineCore, QHelpSearchQuery |
16 | 16 |
17 from .SearchWidget import SearchWidget | 17 from .SearchWidget import SearchWidget |
18 from .HelpBrowserWV import HelpBrowser | |
19 from .HelpTocWidget import HelpTocWidget | 18 from .HelpTocWidget import HelpTocWidget |
20 from .HelpIndexWidget import HelpIndexWidget | 19 from .HelpIndexWidget import HelpIndexWidget |
21 from .HelpSearchWidget import HelpSearchWidget | 20 from .HelpSearchWidget import HelpSearchWidget |
22 from .HelpTopicDialog import HelpTopicDialog | 21 from .HelpTopicDialog import HelpTopicDialog |
23 from .QtHelpDocumentationDialog import QtHelpDocumentationDialog | 22 from .QtHelpDocumentationDialog import QtHelpDocumentationDialog |
40 from .Passwords.PasswordManager import PasswordManager | 39 from .Passwords.PasswordManager import PasswordManager |
41 from .Network.NetworkAccessManager import NetworkAccessManager | 40 from .Network.NetworkAccessManager import NetworkAccessManager |
42 from .AdBlock.AdBlockManager import AdBlockManager | 41 from .AdBlock.AdBlockManager import AdBlockManager |
43 from .OfflineStorage.OfflineStorageConfigDialog import OfflineStorageConfigDialog | 42 from .OfflineStorage.OfflineStorageConfigDialog import OfflineStorageConfigDialog |
44 from .UserAgent.UserAgentMenu import UserAgentMenu | 43 from .UserAgent.UserAgentMenu import UserAgentMenu |
45 from .HelpTabBar import HelpTabBar | 44 from .HelpTabWidget import HelpTabWidget |
46 | 45 |
47 from E5Gui.E5TabWidget import E5TabWidget | |
48 from E5Gui.E5Action import E5Action | 46 from E5Gui.E5Action import E5Action |
49 from E5Gui import E5MessageBox | 47 from E5Gui import E5MessageBox |
50 | 48 |
51 from E5Network.E5NetworkMonitor import E5NetworkMonitor | 49 from E5Network.E5NetworkMonitor import E5NetworkMonitor |
52 | 50 |
57 import Utilities | 55 import Utilities |
58 | 56 |
59 import UI.PixmapCache | 57 import UI.PixmapCache |
60 import UI.Config | 58 import UI.Config |
61 | 59 |
62 from eric5config import getConfig | |
63 | |
64 class HelpWindow(QMainWindow): | 60 class HelpWindow(QMainWindow): |
65 """ | 61 """ |
66 Class implementing the web browser main window. | 62 Class implementing the web browser main window. |
67 | 63 |
68 @signal helpClosed() emitted after the window was requested to close down | 64 @signal helpClosed() emitted after the window was requested to close down |
120 self.__helpInstaller = None | 116 self.__helpInstaller = None |
121 | 117 |
122 # Attributes for WebKit based browser | 118 # Attributes for WebKit based browser |
123 self.__progressBar = None | 119 self.__progressBar = None |
124 | 120 |
125 self.tabContextMenuIndex = -1 | 121 self.tabWidget = HelpTabWidget(self) |
126 self.tabWidget = E5TabWidget(self, dnd = True, tabBar = HelpTabBar(self)) | |
127 self.tabWidget.currentChanged[int].connect(self.__currentChanged) | 122 self.tabWidget.currentChanged[int].connect(self.__currentChanged) |
128 self.tabWidget.setTabContextMenuPolicy(Qt.CustomContextMenu) | 123 self.tabWidget.sourceChanged.connect(self.__sourceChanged) |
129 self.tabWidget.customTabContextMenuRequested.connect(self.__showContextMenu) | 124 self.tabWidget.titleChanged.connect(self.__titleChanged) |
125 self.tabWidget.showMessage.connect(self.statusBar().showMessage) | |
130 | 126 |
131 self.findDlg = SearchWidget(self, self) | 127 self.findDlg = SearchWidget(self, self) |
132 centralWidget = QWidget() | 128 centralWidget = QWidget() |
133 layout = QVBoxLayout() | 129 layout = QVBoxLayout() |
134 layout.setContentsMargins(1, 1, 1, 1) | 130 layout.setContentsMargins(1, 1, 1, 1) |
165 self.__searchDock = QDockWidget(self.trUtf8("Search"), self) | 161 self.__searchDock = QDockWidget(self.trUtf8("Search"), self) |
166 self.__searchDock.setObjectName("SearchWindow") | 162 self.__searchDock.setObjectName("SearchWindow") |
167 self.__searchDock.setWidget(self.__searchWindow) | 163 self.__searchDock.setWidget(self.__searchWindow) |
168 self.addDockWidget(Qt.LeftDockWidgetArea, self.__searchDock) | 164 self.addDockWidget(Qt.LeftDockWidgetArea, self.__searchDock) |
169 | 165 |
170 self.rightCornerWidget = QWidget(self) | |
171 self.rightCornerWidgetLayout = QHBoxLayout(self.rightCornerWidget) | |
172 self.rightCornerWidgetLayout.setMargin(0) | |
173 self.rightCornerWidgetLayout.setSpacing(0) | |
174 | |
175 self.__navigationMenu = QMenu(self) | |
176 self.__navigationMenu.aboutToShow.connect(self.__showNavigationMenu) | |
177 self.__navigationMenu.triggered.connect(self.__navigationMenuTriggered) | |
178 | |
179 self.navigationButton = QToolButton(self.tabWidget) | |
180 self.navigationButton.setIcon(UI.PixmapCache.getIcon("1downarrow.png")) | |
181 self.navigationButton.setToolTip(self.trUtf8("Show a navigation menu")) | |
182 self.navigationButton.setPopupMode(QToolButton.InstantPopup) | |
183 self.navigationButton.setMenu(self.__navigationMenu) | |
184 self.navigationButton.setEnabled(False) | |
185 self.rightCornerWidgetLayout.addWidget(self.navigationButton) | |
186 | |
187 if Preferences.getUI("SingleCloseButton") or \ | |
188 not hasattr(self.tabWidget, 'setTabsClosable'): | |
189 self.closeButton = QToolButton(self.tabWidget) | |
190 self.closeButton.setIcon(UI.PixmapCache.getIcon("close.png")) | |
191 self.closeButton.setToolTip(self.trUtf8("Close the current help window")) | |
192 self.closeButton.setEnabled(False) | |
193 self.closeButton.clicked[bool].connect(self.__close) | |
194 self.rightCornerWidgetLayout.addWidget(self.closeButton) | |
195 else: | |
196 self.tabWidget.setTabsClosable(True) | |
197 self.tabWidget.tabCloseRequested.connect(self.__closeAt) | |
198 self.closeButton = None | |
199 | |
200 self.tabWidget.setCornerWidget(self.rightCornerWidget, Qt.TopRightCorner) | |
201 | |
202 self.newTabButton = QToolButton(self.tabWidget) | |
203 self.newTabButton.setIcon(UI.PixmapCache.getIcon("new.png")) | |
204 self.newTabButton.setToolTip(self.trUtf8("Open a new help window tab")) | |
205 self.tabWidget.setCornerWidget(self.newTabButton, Qt.TopLeftCorner) | |
206 self.newTabButton.clicked[bool].connect(self.newTab) | |
207 | |
208 if Preferences.getHelp("SaveGeometry"): | 166 if Preferences.getHelp("SaveGeometry"): |
209 g = Preferences.getGeometry("HelpViewerGeometry") | 167 g = Preferences.getGeometry("HelpViewerGeometry") |
210 else: | 168 else: |
211 g = QByteArray() | 169 g = QByteArray() |
212 if g.isEmpty(): | 170 if g.isEmpty(): |
219 self.__initWebSettings() | 177 self.__initWebSettings() |
220 | 178 |
221 self.__initActions() | 179 self.__initActions() |
222 self.__initMenus() | 180 self.__initMenus() |
223 self.__initToolbars() | 181 self.__initToolbars() |
224 self.__initTabContextMenu() | |
225 | 182 |
226 self.historyManager() | 183 self.historyManager() |
227 | 184 |
228 self.newBrowser(home) | 185 self.tabWidget.newBrowser(home) |
229 self.currentBrowser().setFocus() | 186 self.tabWidget.currentBrowser().setFocus() |
230 | 187 |
231 self.__class__.helpwindows.append(self) | 188 self.__class__.helpwindows.append(self) |
232 | 189 |
233 QDesktopServices.setUrlHandler("http", self.__linkActivated) | 190 QDesktopServices.setUrlHandler("http", self.__linkActivated) |
234 QDesktopServices.setUrlHandler("https", self.__linkActivated) | 191 QDesktopServices.setUrlHandler("https", self.__linkActivated) |
350 """ | 307 """ |
351 # list of all actions | 308 # list of all actions |
352 self.__actions = [] | 309 self.__actions = [] |
353 | 310 |
354 self.newTabAct = E5Action(self.trUtf8('New Tab'), | 311 self.newTabAct = E5Action(self.trUtf8('New Tab'), |
355 UI.PixmapCache.getIcon("new.png"), | 312 UI.PixmapCache.getIcon("tabNew.png"), |
356 self.trUtf8('&New Tab'), | 313 self.trUtf8('&New Tab'), |
357 QKeySequence(self.trUtf8("Ctrl+T","File|New Tab")), | 314 QKeySequence(self.trUtf8("Ctrl+T","File|New Tab")), |
358 0, self, 'help_file_new_tab') | 315 0, self, 'help_file_new_tab') |
359 self.newTabAct.setStatusTip(self.trUtf8('Open a new help window tab')) | 316 self.newTabAct.setStatusTip(self.trUtf8('Open a new help window tab')) |
360 self.newTabAct.setWhatsThis(self.trUtf8( | 317 self.newTabAct.setWhatsThis(self.trUtf8( |
361 """<b>New Tab</b>""" | 318 """<b>New Tab</b>""" |
362 """<p>This opens a new help window tab.</p>""" | 319 """<p>This opens a new help window tab.</p>""" |
363 )) | 320 )) |
364 self.newTabAct.triggered[()].connect(self.newTab) | 321 if not self.initShortcutsOnly: |
322 self.newTabAct.triggered[()].connect(self.newTab) | |
365 self.__actions.append(self.newTabAct) | 323 self.__actions.append(self.newTabAct) |
366 | 324 |
367 self.newAct = E5Action(self.trUtf8('New Window'), | 325 self.newAct = E5Action(self.trUtf8('New Window'), |
368 UI.PixmapCache.getIcon("newWindow.png"), | 326 UI.PixmapCache.getIcon("newWindow.png"), |
369 self.trUtf8('New &Window'), | 327 self.trUtf8('New &Window'), |
372 self.newAct.setStatusTip(self.trUtf8('Open a new help browser window')) | 330 self.newAct.setStatusTip(self.trUtf8('Open a new help browser window')) |
373 self.newAct.setWhatsThis(self.trUtf8( | 331 self.newAct.setWhatsThis(self.trUtf8( |
374 """<b>New Window</b>""" | 332 """<b>New Window</b>""" |
375 """<p>This opens a new help browser window.</p>""" | 333 """<p>This opens a new help browser window.</p>""" |
376 )) | 334 )) |
377 self.newAct.triggered[()].connect(self.newWindow) | 335 if not self.initShortcutsOnly: |
336 self.newAct.triggered[()].connect(self.newWindow) | |
378 self.__actions.append(self.newAct) | 337 self.__actions.append(self.newAct) |
379 | 338 |
380 self.openAct = E5Action(self.trUtf8('Open File'), | 339 self.openAct = E5Action(self.trUtf8('Open File'), |
381 UI.PixmapCache.getIcon("open.png"), | 340 UI.PixmapCache.getIcon("open.png"), |
382 self.trUtf8('&Open File'), | 341 self.trUtf8('&Open File'), |
386 self.openAct.setWhatsThis(self.trUtf8( | 345 self.openAct.setWhatsThis(self.trUtf8( |
387 """<b>Open File</b>""" | 346 """<b>Open File</b>""" |
388 """<p>This opens a new help file for display.""" | 347 """<p>This opens a new help file for display.""" |
389 """ It pops up a file selection dialog.</p>""" | 348 """ It pops up a file selection dialog.</p>""" |
390 )) | 349 )) |
391 self.openAct.triggered[()].connect(self.__openFile) | 350 if not self.initShortcutsOnly: |
351 self.openAct.triggered[()].connect(self.__openFile) | |
392 self.__actions.append(self.openAct) | 352 self.__actions.append(self.openAct) |
393 | 353 |
394 self.openTabAct = E5Action(self.trUtf8('Open File in New Tab'), | 354 self.openTabAct = E5Action(self.trUtf8('Open File in New Tab'), |
395 UI.PixmapCache.getIcon("openNewTab.png"), | 355 UI.PixmapCache.getIcon("openNewTab.png"), |
396 self.trUtf8('Open File in New &Tab'), | 356 self.trUtf8('Open File in New &Tab'), |
401 self.openTabAct.setWhatsThis(self.trUtf8( | 361 self.openTabAct.setWhatsThis(self.trUtf8( |
402 """<b>Open File in New Tab</b>""" | 362 """<b>Open File in New Tab</b>""" |
403 """<p>This opens a new help file for display in a new tab.""" | 363 """<p>This opens a new help file for display in a new tab.""" |
404 """ It pops up a file selection dialog.</p>""" | 364 """ It pops up a file selection dialog.</p>""" |
405 )) | 365 )) |
406 self.openTabAct.triggered[()].connect(self.__openFileNewTab) | 366 if not self.initShortcutsOnly: |
367 self.openTabAct.triggered[()].connect(self.__openFileNewTab) | |
407 self.__actions.append(self.openTabAct) | 368 self.__actions.append(self.openTabAct) |
408 | 369 |
409 self.saveAsAct = E5Action(self.trUtf8('Save As '), | 370 self.saveAsAct = E5Action(self.trUtf8('Save As '), |
410 UI.PixmapCache.getIcon("fileSaveAs.png"), | 371 UI.PixmapCache.getIcon("fileSaveAs.png"), |
411 self.trUtf8('&Save As...'), | 372 self.trUtf8('&Save As...'), |
415 self.trUtf8('Save the current page to disk')) | 376 self.trUtf8('Save the current page to disk')) |
416 self.saveAsAct.setWhatsThis(self.trUtf8( | 377 self.saveAsAct.setWhatsThis(self.trUtf8( |
417 """<b>Save As...</b>""" | 378 """<b>Save As...</b>""" |
418 """<p>Saves the current page to disk.</p>""" | 379 """<p>Saves the current page to disk.</p>""" |
419 )) | 380 )) |
420 self.saveAsAct.triggered[()].connect(self.__savePageAs) | 381 if not self.initShortcutsOnly: |
382 self.saveAsAct.triggered[()].connect(self.__savePageAs) | |
421 self.__actions.append(self.saveAsAct) | 383 self.__actions.append(self.saveAsAct) |
422 | 384 |
423 bookmarksManager = self.bookmarksManager() | 385 bookmarksManager = self.bookmarksManager() |
424 self.importBookmarksAct = E5Action(self.trUtf8('Import Bookmarks'), | 386 self.importBookmarksAct = E5Action(self.trUtf8('Import Bookmarks'), |
425 self.trUtf8('&Import Bookmarks...'), | 387 self.trUtf8('&Import Bookmarks...'), |
428 self.trUtf8('Import bookmarks from other browsers')) | 390 self.trUtf8('Import bookmarks from other browsers')) |
429 self.importBookmarksAct.setWhatsThis(self.trUtf8( | 391 self.importBookmarksAct.setWhatsThis(self.trUtf8( |
430 """<b>Import Bookmarks</b>""" | 392 """<b>Import Bookmarks</b>""" |
431 """<p>Import bookmarks from other browsers.</p>""" | 393 """<p>Import bookmarks from other browsers.</p>""" |
432 )) | 394 )) |
433 self.importBookmarksAct.triggered[()].connect(bookmarksManager.importBookmarks) | 395 if not self.initShortcutsOnly: |
396 self.importBookmarksAct.triggered[()].connect( | |
397 bookmarksManager.importBookmarks) | |
434 self.__actions.append(self.importBookmarksAct) | 398 self.__actions.append(self.importBookmarksAct) |
435 | 399 |
436 self.exportBookmarksAct = E5Action(self.trUtf8('Export Bookmarks'), | 400 self.exportBookmarksAct = E5Action(self.trUtf8('Export Bookmarks'), |
437 self.trUtf8('&Export Bookmarks...'), | 401 self.trUtf8('&Export Bookmarks...'), |
438 0, 0, self, 'help_file_export_bookmarks') | 402 0, 0, self, 'help_file_export_bookmarks') |
440 self.trUtf8('Export the bookmarks into a file')) | 404 self.trUtf8('Export the bookmarks into a file')) |
441 self.exportBookmarksAct.setWhatsThis(self.trUtf8( | 405 self.exportBookmarksAct.setWhatsThis(self.trUtf8( |
442 """<b>Export Bookmarks</b>""" | 406 """<b>Export Bookmarks</b>""" |
443 """<p>Export the bookmarks into a file.</p>""" | 407 """<p>Export the bookmarks into a file.</p>""" |
444 )) | 408 )) |
445 self.exportBookmarksAct.triggered[()].connect(bookmarksManager.exportBookmarks) | 409 if not self.initShortcutsOnly: |
410 self.exportBookmarksAct.triggered[()].connect( | |
411 bookmarksManager.exportBookmarks) | |
446 self.__actions.append(self.exportBookmarksAct) | 412 self.__actions.append(self.exportBookmarksAct) |
447 | 413 |
448 self.printAct = E5Action(self.trUtf8('Print'), | 414 self.printAct = E5Action(self.trUtf8('Print'), |
449 UI.PixmapCache.getIcon("print.png"), | 415 UI.PixmapCache.getIcon("print.png"), |
450 self.trUtf8('&Print'), | 416 self.trUtf8('&Print'), |
453 self.printAct.setStatusTip(self.trUtf8('Print the displayed help')) | 419 self.printAct.setStatusTip(self.trUtf8('Print the displayed help')) |
454 self.printAct.setWhatsThis(self.trUtf8( | 420 self.printAct.setWhatsThis(self.trUtf8( |
455 """<b>Print</b>""" | 421 """<b>Print</b>""" |
456 """<p>Print the displayed help text.</p>""" | 422 """<p>Print the displayed help text.</p>""" |
457 )) | 423 )) |
458 self.printAct.triggered[()].connect(self.__printFile) | 424 if not self.initShortcutsOnly: |
425 self.printAct.triggered[()].connect(self.tabWidget.printBrowser) | |
459 self.__actions.append(self.printAct) | 426 self.__actions.append(self.printAct) |
460 | 427 |
461 self.printPdfAct = E5Action(self.trUtf8('Print as PDF'), | 428 self.printPdfAct = E5Action(self.trUtf8('Print as PDF'), |
462 UI.PixmapCache.getIcon("printPdf.png"), | 429 UI.PixmapCache.getIcon("printPdf.png"), |
463 self.trUtf8('Print as PDF'), | 430 self.trUtf8('Print as PDF'), |
465 self.printPdfAct.setStatusTip(self.trUtf8('Print the displayed help as PDF')) | 432 self.printPdfAct.setStatusTip(self.trUtf8('Print the displayed help as PDF')) |
466 self.printPdfAct.setWhatsThis(self.trUtf8( | 433 self.printPdfAct.setWhatsThis(self.trUtf8( |
467 """<b>Print as PDF</b>""" | 434 """<b>Print as PDF</b>""" |
468 """<p>Print the displayed help text as a PDF file.</p>""" | 435 """<p>Print the displayed help text as a PDF file.</p>""" |
469 )) | 436 )) |
470 self.printPdfAct.triggered[()].connect(self.__printFilePdf) | 437 if not self.initShortcutsOnly: |
438 self.printPdfAct.triggered[()].connect(self.tabWidget.printBrowserPdf) | |
471 self.__actions.append(self.printPdfAct) | 439 self.__actions.append(self.printPdfAct) |
472 | 440 |
473 self.printPreviewAct = E5Action(self.trUtf8('Print Preview'), | 441 self.printPreviewAct = E5Action(self.trUtf8('Print Preview'), |
474 UI.PixmapCache.getIcon("printPreview.png"), | 442 UI.PixmapCache.getIcon("printPreview.png"), |
475 self.trUtf8('Print Preview'), | 443 self.trUtf8('Print Preview'), |
478 'Print preview of the displayed help')) | 446 'Print preview of the displayed help')) |
479 self.printPreviewAct.setWhatsThis(self.trUtf8( | 447 self.printPreviewAct.setWhatsThis(self.trUtf8( |
480 """<b>Print Preview</b>""" | 448 """<b>Print Preview</b>""" |
481 """<p>Print preview of the displayed help text.</p>""" | 449 """<p>Print preview of the displayed help text.</p>""" |
482 )) | 450 )) |
483 self.printPreviewAct.triggered[()].connect(self.__printPreviewFile) | 451 if not self.initShortcutsOnly: |
452 self.printPreviewAct.triggered[()].connect(self.tabWidget.printPreviewBrowser) | |
484 self.__actions.append(self.printPreviewAct) | 453 self.__actions.append(self.printPreviewAct) |
485 | 454 |
486 self.closeAct = E5Action(self.trUtf8('Close'), | 455 self.closeAct = E5Action(self.trUtf8('Close'), |
487 UI.PixmapCache.getIcon("close.png"), | 456 UI.PixmapCache.getIcon("close.png"), |
488 self.trUtf8('&Close'), | 457 self.trUtf8('&Close'), |
491 self.closeAct.setStatusTip(self.trUtf8('Close the current help window')) | 460 self.closeAct.setStatusTip(self.trUtf8('Close the current help window')) |
492 self.closeAct.setWhatsThis(self.trUtf8( | 461 self.closeAct.setWhatsThis(self.trUtf8( |
493 """<b>Close</b>""" | 462 """<b>Close</b>""" |
494 """<p>Closes the current help window.</p>""" | 463 """<p>Closes the current help window.</p>""" |
495 )) | 464 )) |
496 self.closeAct.triggered[()].connect(self.__close) | 465 if not self.initShortcutsOnly: |
466 self.closeAct.triggered[()].connect(self.tabWidget.closeBrowser) | |
497 self.__actions.append(self.closeAct) | 467 self.__actions.append(self.closeAct) |
498 | 468 |
499 self.closeAllAct = E5Action(self.trUtf8('Close All'), | 469 self.closeAllAct = E5Action(self.trUtf8('Close All'), |
500 self.trUtf8('Close &All'), | 470 self.trUtf8('Close &All'), |
501 0, 0, self, 'help_file_close_all') | 471 0, 0, self, 'help_file_close_all') |
502 self.closeAllAct.setStatusTip(self.trUtf8('Close all help windows')) | 472 self.closeAllAct.setStatusTip(self.trUtf8('Close all help windows')) |
503 self.closeAllAct.setWhatsThis(self.trUtf8( | 473 self.closeAllAct.setWhatsThis(self.trUtf8( |
504 """<b>Close All</b>""" | 474 """<b>Close All</b>""" |
505 """<p>Closes all help windows except the first one.</p>""" | 475 """<p>Closes all help windows except the first one.</p>""" |
506 )) | 476 )) |
507 self.closeAllAct.triggered[()].connect(self.__closeAll) | 477 if not self.initShortcutsOnly: |
478 self.closeAllAct.triggered[()].connect(self.tabWidget.closeAllBrowsers) | |
508 self.__actions.append(self.closeAllAct) | 479 self.__actions.append(self.closeAllAct) |
509 | 480 |
510 self.privateBrowsingAct = E5Action(self.trUtf8('Private Browsing'), | 481 self.privateBrowsingAct = E5Action(self.trUtf8('Private Browsing'), |
511 UI.PixmapCache.getIcon("privateBrowsing.png"), | 482 UI.PixmapCache.getIcon("privateBrowsing.png"), |
512 self.trUtf8('Private &Browsing'), | 483 self.trUtf8('Private &Browsing'), |
515 self.privateBrowsingAct.setWhatsThis(self.trUtf8( | 486 self.privateBrowsingAct.setWhatsThis(self.trUtf8( |
516 """<b>Private Browsing</b>""" | 487 """<b>Private Browsing</b>""" |
517 """<p>Enables private browsing. In this mode no history is""" | 488 """<p>Enables private browsing. In this mode no history is""" |
518 """ recorded anymore.</p>""" | 489 """ recorded anymore.</p>""" |
519 )) | 490 )) |
520 self.privateBrowsingAct.triggered[()].connect(self.__privateBrowsing) | 491 if not self.initShortcutsOnly: |
492 self.privateBrowsingAct.triggered[()].connect(self.__privateBrowsing) | |
521 self.privateBrowsingAct.setCheckable(True) | 493 self.privateBrowsingAct.setCheckable(True) |
522 self.__actions.append(self.privateBrowsingAct) | 494 self.__actions.append(self.privateBrowsingAct) |
523 | 495 |
524 self.exitAct = E5Action(self.trUtf8('Quit'), | 496 self.exitAct = E5Action(self.trUtf8('Quit'), |
525 UI.PixmapCache.getIcon("exit.png"), | 497 UI.PixmapCache.getIcon("exit.png"), |
529 self.exitAct.setStatusTip(self.trUtf8('Quit the web browser')) | 501 self.exitAct.setStatusTip(self.trUtf8('Quit the web browser')) |
530 self.exitAct.setWhatsThis(self.trUtf8( | 502 self.exitAct.setWhatsThis(self.trUtf8( |
531 """<b>Quit</b>""" | 503 """<b>Quit</b>""" |
532 """<p>Quit the web browser.</p>""" | 504 """<p>Quit the web browser.</p>""" |
533 )) | 505 )) |
534 if self.fromEric: | 506 if not self.initShortcutsOnly: |
535 self.exitAct.triggered[()].connect(self.close) | 507 if self.fromEric: |
536 else: | 508 self.exitAct.triggered[()].connect(self.close) |
537 self.exitAct.triggered[()].connect(qApp.closeAllWindows) | 509 else: |
510 self.exitAct.triggered[()].connect(qApp.closeAllWindows) | |
538 self.__actions.append(self.exitAct) | 511 self.__actions.append(self.exitAct) |
539 | 512 |
540 self.backAct = E5Action(self.trUtf8('Backward'), | 513 self.backAct = E5Action(self.trUtf8('Backward'), |
541 UI.PixmapCache.getIcon("back.png"), | 514 UI.PixmapCache.getIcon("back.png"), |
542 self.trUtf8('&Backward'), | 515 self.trUtf8('&Backward'), |
547 self.backAct.setWhatsThis(self.trUtf8( | 520 self.backAct.setWhatsThis(self.trUtf8( |
548 """<b>Backward</b>""" | 521 """<b>Backward</b>""" |
549 """<p>Moves one help screen backward. If none is""" | 522 """<p>Moves one help screen backward. If none is""" |
550 """ available, this action is disabled.</p>""" | 523 """ available, this action is disabled.</p>""" |
551 )) | 524 )) |
552 self.backAct.triggered[()].connect(self.__backward) | 525 if not self.initShortcutsOnly: |
526 self.backAct.triggered[()].connect(self.__backward) | |
553 self.__actions.append(self.backAct) | 527 self.__actions.append(self.backAct) |
554 | 528 |
555 self.forwardAct = E5Action(self.trUtf8('Forward'), | 529 self.forwardAct = E5Action(self.trUtf8('Forward'), |
556 UI.PixmapCache.getIcon("forward.png"), | 530 UI.PixmapCache.getIcon("forward.png"), |
557 self.trUtf8('&Forward'), | 531 self.trUtf8('&Forward'), |
562 self.forwardAct.setWhatsThis(self.trUtf8( | 536 self.forwardAct.setWhatsThis(self.trUtf8( |
563 """<b>Forward</b>""" | 537 """<b>Forward</b>""" |
564 """<p>Moves one help screen forward. If none is""" | 538 """<p>Moves one help screen forward. If none is""" |
565 """ available, this action is disabled.</p>""" | 539 """ available, this action is disabled.</p>""" |
566 )) | 540 )) |
567 self.forwardAct.triggered[()].connect(self.__forward) | 541 if not self.initShortcutsOnly: |
542 self.forwardAct.triggered[()].connect(self.__forward) | |
568 self.__actions.append(self.forwardAct) | 543 self.__actions.append(self.forwardAct) |
569 | 544 |
570 self.homeAct = E5Action(self.trUtf8('Home'), | 545 self.homeAct = E5Action(self.trUtf8('Home'), |
571 UI.PixmapCache.getIcon("home.png"), | 546 UI.PixmapCache.getIcon("home.png"), |
572 self.trUtf8('&Home'), | 547 self.trUtf8('&Home'), |
575 self.homeAct.setStatusTip(self.trUtf8('Move to the initial help screen')) | 550 self.homeAct.setStatusTip(self.trUtf8('Move to the initial help screen')) |
576 self.homeAct.setWhatsThis(self.trUtf8( | 551 self.homeAct.setWhatsThis(self.trUtf8( |
577 """<b>Home</b>""" | 552 """<b>Home</b>""" |
578 """<p>Moves to the initial help screen.</p>""" | 553 """<p>Moves to the initial help screen.</p>""" |
579 )) | 554 )) |
580 self.homeAct.triggered[()].connect(self.__home) | 555 if not self.initShortcutsOnly: |
556 self.homeAct.triggered[()].connect(self.__home) | |
581 self.__actions.append(self.homeAct) | 557 self.__actions.append(self.homeAct) |
582 | 558 |
583 self.reloadAct = E5Action(self.trUtf8('Reload'), | 559 self.reloadAct = E5Action(self.trUtf8('Reload'), |
584 UI.PixmapCache.getIcon("reload.png"), | 560 UI.PixmapCache.getIcon("reload.png"), |
585 self.trUtf8('&Reload'), | 561 self.trUtf8('&Reload'), |
589 self.reloadAct.setStatusTip(self.trUtf8('Reload the current help screen')) | 565 self.reloadAct.setStatusTip(self.trUtf8('Reload the current help screen')) |
590 self.reloadAct.setWhatsThis(self.trUtf8( | 566 self.reloadAct.setWhatsThis(self.trUtf8( |
591 """<b>Reload</b>""" | 567 """<b>Reload</b>""" |
592 """<p>Reloads the current help screen.</p>""" | 568 """<p>Reloads the current help screen.</p>""" |
593 )) | 569 )) |
594 self.reloadAct.triggered[()].connect(self.__reload) | 570 if not self.initShortcutsOnly: |
571 self.reloadAct.triggered[()].connect(self.__reload) | |
595 self.__actions.append(self.reloadAct) | 572 self.__actions.append(self.reloadAct) |
596 | 573 |
597 self.stopAct = E5Action(self.trUtf8('Stop'), | 574 self.stopAct = E5Action(self.trUtf8('Stop'), |
598 UI.PixmapCache.getIcon("stopLoading.png"), | 575 UI.PixmapCache.getIcon("stopLoading.png"), |
599 self.trUtf8('&Stop'), | 576 self.trUtf8('&Stop'), |
603 self.stopAct.setStatusTip(self.trUtf8('Stop loading')) | 580 self.stopAct.setStatusTip(self.trUtf8('Stop loading')) |
604 self.stopAct.setWhatsThis(self.trUtf8( | 581 self.stopAct.setWhatsThis(self.trUtf8( |
605 """<b>Stop</b>""" | 582 """<b>Stop</b>""" |
606 """<p>Stops loading of the current tab.</p>""" | 583 """<p>Stops loading of the current tab.</p>""" |
607 )) | 584 )) |
608 self.stopAct.triggered[()].connect(self.__stopLoading) | 585 if not self.initShortcutsOnly: |
586 self.stopAct.triggered[()].connect(self.__stopLoading) | |
609 self.__actions.append(self.stopAct) | 587 self.__actions.append(self.stopAct) |
610 | 588 |
611 self.copyAct = E5Action(self.trUtf8('Copy'), | 589 self.copyAct = E5Action(self.trUtf8('Copy'), |
612 UI.PixmapCache.getIcon("editCopy.png"), | 590 UI.PixmapCache.getIcon("editCopy.png"), |
613 self.trUtf8('&Copy'), | 591 self.trUtf8('&Copy'), |
616 self.copyAct.setStatusTip(self.trUtf8('Copy the selected text')) | 594 self.copyAct.setStatusTip(self.trUtf8('Copy the selected text')) |
617 self.copyAct.setWhatsThis(self.trUtf8( | 595 self.copyAct.setWhatsThis(self.trUtf8( |
618 """<b>Copy</b>""" | 596 """<b>Copy</b>""" |
619 """<p>Copy the selected text to the clipboard.</p>""" | 597 """<p>Copy the selected text to the clipboard.</p>""" |
620 )) | 598 )) |
621 self.copyAct.triggered[()].connect(self.__copy) | 599 if not self.initShortcutsOnly: |
600 self.copyAct.triggered[()].connect(self.__copy) | |
622 self.__actions.append(self.copyAct) | 601 self.__actions.append(self.copyAct) |
623 | 602 |
624 self.findAct = E5Action(self.trUtf8('Find...'), | 603 self.findAct = E5Action(self.trUtf8('Find...'), |
625 UI.PixmapCache.getIcon("find.png"), | 604 UI.PixmapCache.getIcon("find.png"), |
626 self.trUtf8('&Find...'), | 605 self.trUtf8('&Find...'), |
629 self.findAct.setStatusTip(self.trUtf8('Find text in page')) | 608 self.findAct.setStatusTip(self.trUtf8('Find text in page')) |
630 self.findAct.setWhatsThis(self.trUtf8( | 609 self.findAct.setWhatsThis(self.trUtf8( |
631 """<b>Find</b>""" | 610 """<b>Find</b>""" |
632 """<p>Find text in the current page.</p>""" | 611 """<p>Find text in the current page.</p>""" |
633 )) | 612 )) |
634 self.findAct.triggered[()].connect(self.__find) | 613 if not self.initShortcutsOnly: |
614 self.findAct.triggered[()].connect(self.__find) | |
635 self.__actions.append(self.findAct) | 615 self.__actions.append(self.findAct) |
636 | 616 |
637 self.findNextAct = E5Action(self.trUtf8('Find next'), | 617 self.findNextAct = E5Action(self.trUtf8('Find next'), |
638 UI.PixmapCache.getIcon("findNext.png"), | 618 UI.PixmapCache.getIcon("findNext.png"), |
639 self.trUtf8('Find &next'), | 619 self.trUtf8('Find &next'), |
671 'Open a dialog to manage the bookmarks.')) | 651 'Open a dialog to manage the bookmarks.')) |
672 self.bookmarksManageAct.setWhatsThis(self.trUtf8( | 652 self.bookmarksManageAct.setWhatsThis(self.trUtf8( |
673 """<b>Manage Bookmarks...</b>""" | 653 """<b>Manage Bookmarks...</b>""" |
674 """<p>Open a dialog to manage the bookmarks.</p>""" | 654 """<p>Open a dialog to manage the bookmarks.</p>""" |
675 )) | 655 )) |
676 self.bookmarksManageAct.triggered[()].connect(self.__showBookmarksDialog) | 656 if not self.initShortcutsOnly: |
657 self.bookmarksManageAct.triggered[()].connect(self.__showBookmarksDialog) | |
677 self.__actions.append(self.bookmarksManageAct) | 658 self.__actions.append(self.bookmarksManageAct) |
678 | 659 |
679 self.bookmarksAddAct = E5Action(self.trUtf8('Add Bookmark'), | 660 self.bookmarksAddAct = E5Action(self.trUtf8('Add Bookmark'), |
680 UI.PixmapCache.getIcon("addBookmark.png"), | 661 UI.PixmapCache.getIcon("addBookmark.png"), |
681 self.trUtf8('Add &Bookmark...'), | 662 self.trUtf8('Add &Bookmark...'), |
685 self.bookmarksAddAct.setStatusTip(self.trUtf8('Open a dialog to add a bookmark.')) | 666 self.bookmarksAddAct.setStatusTip(self.trUtf8('Open a dialog to add a bookmark.')) |
686 self.bookmarksAddAct.setWhatsThis(self.trUtf8( | 667 self.bookmarksAddAct.setWhatsThis(self.trUtf8( |
687 """<b>Add Bookmark</b>""" | 668 """<b>Add Bookmark</b>""" |
688 """<p>Open a dialog to add the current URL as a bookmark.</p>""" | 669 """<p>Open a dialog to add the current URL as a bookmark.</p>""" |
689 )) | 670 )) |
690 self.bookmarksAddAct.triggered[()].connect(self.__addBookmark) | 671 if not self.initShortcutsOnly: |
672 self.bookmarksAddAct.triggered[()].connect(self.__addBookmark) | |
691 self.__actions.append(self.bookmarksAddAct) | 673 self.__actions.append(self.bookmarksAddAct) |
692 | 674 |
693 self.bookmarksAddFolderAct = E5Action(self.trUtf8('Add Folder'), | 675 self.bookmarksAddFolderAct = E5Action(self.trUtf8('Add Folder'), |
694 self.trUtf8('Add &Folder...'), | 676 self.trUtf8('Add &Folder...'), |
695 0, 0, self, 'help_bookmark_show_all') | 677 0, 0, self, 'help_bookmark_show_all') |
697 'Open a dialog to add a new bookmarks folder.')) | 679 'Open a dialog to add a new bookmarks folder.')) |
698 self.bookmarksAddFolderAct.setWhatsThis(self.trUtf8( | 680 self.bookmarksAddFolderAct.setWhatsThis(self.trUtf8( |
699 """<b>Add Folder...</b>""" | 681 """<b>Add Folder...</b>""" |
700 """<p>Open a dialog to add a new bookmarks folder.</p>""" | 682 """<p>Open a dialog to add a new bookmarks folder.</p>""" |
701 )) | 683 )) |
702 self.bookmarksAddFolderAct.triggered[()].connect(self.__addBookmarkFolder) | 684 if not self.initShortcutsOnly: |
685 self.bookmarksAddFolderAct.triggered[()].connect(self.__addBookmarkFolder) | |
703 self.__actions.append(self.bookmarksAddFolderAct) | 686 self.__actions.append(self.bookmarksAddFolderAct) |
704 | 687 |
705 self.bookmarksAllTabsAct = E5Action(self.trUtf8('Bookmark All Tabs'), | 688 self.bookmarksAllTabsAct = E5Action(self.trUtf8('Bookmark All Tabs'), |
706 self.trUtf8('Bookmark All Tabs...'), | 689 self.trUtf8('Bookmark All Tabs...'), |
707 0, 0, self, 'help_bookmark_all_tabs') | 690 0, 0, self, 'help_bookmark_all_tabs') |
710 self.bookmarksAllTabsAct.setWhatsThis(self.trUtf8( | 693 self.bookmarksAllTabsAct.setWhatsThis(self.trUtf8( |
711 """<b>Bookmark All Tabs...</b>""" | 694 """<b>Bookmark All Tabs...</b>""" |
712 """<p>Open a dialog to add a new bookmarks folder for""" | 695 """<p>Open a dialog to add a new bookmarks folder for""" |
713 """ all open tabs.</p>""" | 696 """ all open tabs.</p>""" |
714 )) | 697 )) |
715 self.bookmarksAllTabsAct.triggered[()].connect(self.__bookmarkAll) | 698 if not self.initShortcutsOnly: |
699 self.bookmarksAllTabsAct.triggered[()].connect(self.bookmarkAll) | |
716 self.__actions.append(self.bookmarksAllTabsAct) | 700 self.__actions.append(self.bookmarksAllTabsAct) |
717 | 701 |
718 self.whatsThisAct = E5Action(self.trUtf8('What\'s This?'), | 702 self.whatsThisAct = E5Action(self.trUtf8('What\'s This?'), |
719 UI.PixmapCache.getIcon("whatsThis.png"), | 703 UI.PixmapCache.getIcon("whatsThis.png"), |
720 self.trUtf8('&What\'s This?'), | 704 self.trUtf8('&What\'s This?'), |
727 """ question mark, and you can click on the interface elements to get""" | 711 """ question mark, and you can click on the interface elements to get""" |
728 """ a short description of what they do and how to use them. In""" | 712 """ a short description of what they do and how to use them. In""" |
729 """ dialogs, this feature can be accessed using the context help button""" | 713 """ dialogs, this feature can be accessed using the context help button""" |
730 """ in the titlebar.</p>""" | 714 """ in the titlebar.</p>""" |
731 )) | 715 )) |
732 self.whatsThisAct.triggered[()].connect(self.__whatsThis) | 716 if not self.initShortcutsOnly: |
717 self.whatsThisAct.triggered[()].connect(self.__whatsThis) | |
733 self.__actions.append(self.whatsThisAct) | 718 self.__actions.append(self.whatsThisAct) |
734 | 719 |
735 self.aboutAct = E5Action(self.trUtf8('About'), | 720 self.aboutAct = E5Action(self.trUtf8('About'), |
736 self.trUtf8('&About'), | 721 self.trUtf8('&About'), |
737 0, 0, self, 'help_help_about') | 722 0, 0, self, 'help_help_about') |
738 self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) | 723 self.aboutAct.setStatusTip(self.trUtf8('Display information about this software')) |
739 self.aboutAct.setWhatsThis(self.trUtf8( | 724 self.aboutAct.setWhatsThis(self.trUtf8( |
740 """<b>About</b>""" | 725 """<b>About</b>""" |
741 """<p>Display some information about this software.</p>""" | 726 """<p>Display some information about this software.</p>""" |
742 )) | 727 )) |
743 self.aboutAct.triggered[()].connect(self.__about) | 728 if not self.initShortcutsOnly: |
729 self.aboutAct.triggered[()].connect(self.__about) | |
744 self.__actions.append(self.aboutAct) | 730 self.__actions.append(self.aboutAct) |
745 | 731 |
746 self.aboutQtAct = E5Action(self.trUtf8('About Qt'), | 732 self.aboutQtAct = E5Action(self.trUtf8('About Qt'), |
747 self.trUtf8('About &Qt'), | 733 self.trUtf8('About &Qt'), |
748 0, 0, self, 'help_help_about_qt') | 734 0, 0, self, 'help_help_about_qt') |
750 self.trUtf8('Display information about the Qt toolkit')) | 736 self.trUtf8('Display information about the Qt toolkit')) |
751 self.aboutQtAct.setWhatsThis(self.trUtf8( | 737 self.aboutQtAct.setWhatsThis(self.trUtf8( |
752 """<b>About Qt</b>""" | 738 """<b>About Qt</b>""" |
753 """<p>Display some information about the Qt toolkit.</p>""" | 739 """<p>Display some information about the Qt toolkit.</p>""" |
754 )) | 740 )) |
755 self.aboutQtAct.triggered[()].connect(self.__aboutQt) | 741 if not self.initShortcutsOnly: |
742 self.aboutQtAct.triggered[()].connect(self.__aboutQt) | |
756 self.__actions.append(self.aboutQtAct) | 743 self.__actions.append(self.aboutQtAct) |
757 | 744 |
758 self.zoomInAct = E5Action(self.trUtf8('Zoom in'), | 745 self.zoomInAct = E5Action(self.trUtf8('Zoom in'), |
759 UI.PixmapCache.getIcon("zoomIn.png"), | 746 UI.PixmapCache.getIcon("zoomIn.png"), |
760 self.trUtf8('Zoom &in'), | 747 self.trUtf8('Zoom &in'), |
763 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the text')) | 750 self.zoomInAct.setStatusTip(self.trUtf8('Zoom in on the text')) |
764 self.zoomInAct.setWhatsThis(self.trUtf8( | 751 self.zoomInAct.setWhatsThis(self.trUtf8( |
765 """<b>Zoom in</b>""" | 752 """<b>Zoom in</b>""" |
766 """<p>Zoom in on the text. This makes the text bigger.</p>""" | 753 """<p>Zoom in on the text. This makes the text bigger.</p>""" |
767 )) | 754 )) |
768 self.zoomInAct.triggered[()].connect(self.__zoomIn) | 755 if not self.initShortcutsOnly: |
756 self.zoomInAct.triggered[()].connect(self.__zoomIn) | |
769 self.__actions.append(self.zoomInAct) | 757 self.__actions.append(self.zoomInAct) |
770 | 758 |
771 self.zoomOutAct = E5Action(self.trUtf8('Zoom out'), | 759 self.zoomOutAct = E5Action(self.trUtf8('Zoom out'), |
772 UI.PixmapCache.getIcon("zoomOut.png"), | 760 UI.PixmapCache.getIcon("zoomOut.png"), |
773 self.trUtf8('Zoom &out'), | 761 self.trUtf8('Zoom &out'), |
776 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the text')) | 764 self.zoomOutAct.setStatusTip(self.trUtf8('Zoom out on the text')) |
777 self.zoomOutAct.setWhatsThis(self.trUtf8( | 765 self.zoomOutAct.setWhatsThis(self.trUtf8( |
778 """<b>Zoom out</b>""" | 766 """<b>Zoom out</b>""" |
779 """<p>Zoom out on the text. This makes the text smaller.</p>""" | 767 """<p>Zoom out on the text. This makes the text smaller.</p>""" |
780 )) | 768 )) |
781 self.zoomOutAct.triggered[()].connect(self.__zoomOut) | 769 if not self.initShortcutsOnly: |
770 self.zoomOutAct.triggered[()].connect(self.__zoomOut) | |
782 self.__actions.append(self.zoomOutAct) | 771 self.__actions.append(self.zoomOutAct) |
783 | 772 |
784 self.zoomResetAct = E5Action(self.trUtf8('Zoom reset'), | 773 self.zoomResetAct = E5Action(self.trUtf8('Zoom reset'), |
785 UI.PixmapCache.getIcon("zoomReset.png"), | 774 UI.PixmapCache.getIcon("zoomReset.png"), |
786 self.trUtf8('Zoom &reset'), | 775 self.trUtf8('Zoom &reset'), |
790 self.zoomResetAct.setWhatsThis(self.trUtf8( | 779 self.zoomResetAct.setWhatsThis(self.trUtf8( |
791 """<b>Zoom reset</b>""" | 780 """<b>Zoom reset</b>""" |
792 """<p>Reset the zoom of the text. """ | 781 """<p>Reset the zoom of the text. """ |
793 """This sets the zoom factor to 100%.</p>""" | 782 """This sets the zoom factor to 100%.</p>""" |
794 )) | 783 )) |
795 self.zoomResetAct.triggered[()].connect(self.__zoomReset) | 784 if not self.initShortcutsOnly: |
785 self.zoomResetAct.triggered[()].connect(self.__zoomReset) | |
796 self.__actions.append(self.zoomResetAct) | 786 self.__actions.append(self.zoomResetAct) |
797 | 787 |
798 if hasattr(QWebSettings, 'ZoomTextOnly'): | 788 if hasattr(QWebSettings, 'ZoomTextOnly'): |
799 self.zoomTextOnlyAct = E5Action(self.trUtf8('Zoom text only'), | 789 self.zoomTextOnlyAct = E5Action(self.trUtf8('Zoom text only'), |
800 self.trUtf8('Zoom &text only'), | 790 self.trUtf8('Zoom &text only'), |
804 'Zoom text only; pictures remain constant')) | 794 'Zoom text only; pictures remain constant')) |
805 self.zoomTextOnlyAct.setWhatsThis(self.trUtf8( | 795 self.zoomTextOnlyAct.setWhatsThis(self.trUtf8( |
806 """<b>Zoom text only</b>""" | 796 """<b>Zoom text only</b>""" |
807 """<p>Zoom text only; pictures remain constant.</p>""" | 797 """<p>Zoom text only; pictures remain constant.</p>""" |
808 )) | 798 )) |
809 self.zoomTextOnlyAct.triggered[bool].connect(self.__zoomTextOnly) | 799 if not self.initShortcutsOnly: |
800 self.zoomTextOnlyAct.triggered[bool].connect(self.__zoomTextOnly) | |
810 self.__actions.append(self.zoomTextOnlyAct) | 801 self.__actions.append(self.zoomTextOnlyAct) |
811 else: | 802 else: |
812 self.zoomTextOnlyAct = None | 803 self.zoomTextOnlyAct = None |
813 | 804 |
814 self.pageSourceAct = E5Action(self.trUtf8('Show page source'), | 805 self.pageSourceAct = E5Action(self.trUtf8('Show page source'), |
818 self.pageSourceAct.setStatusTip(self.trUtf8('Show the page source in an editor')) | 809 self.pageSourceAct.setStatusTip(self.trUtf8('Show the page source in an editor')) |
819 self.pageSourceAct.setWhatsThis(self.trUtf8( | 810 self.pageSourceAct.setWhatsThis(self.trUtf8( |
820 """<b>Show page source</b>""" | 811 """<b>Show page source</b>""" |
821 """<p>Show the page source in an editor.</p>""" | 812 """<p>Show the page source in an editor.</p>""" |
822 )) | 813 )) |
823 self.pageSourceAct.triggered[()].connect(self.__showPageSource) | 814 if not self.initShortcutsOnly: |
815 self.pageSourceAct.triggered[()].connect(self.__showPageSource) | |
824 self.__actions.append(self.pageSourceAct) | 816 self.__actions.append(self.pageSourceAct) |
825 self.addAction(self.pageSourceAct) | 817 self.addAction(self.pageSourceAct) |
826 | 818 |
827 self.fullScreenAct = E5Action(self.trUtf8('Full Screen'), | 819 self.fullScreenAct = E5Action(self.trUtf8('Full Screen'), |
828 UI.PixmapCache.getIcon("windowFullscreen.png"), | 820 UI.PixmapCache.getIcon("windowFullscreen.png"), |
829 self.trUtf8('&Full Screen'), | 821 self.trUtf8('&Full Screen'), |
830 QKeySequence(self.trUtf8('F11')), 0, | 822 QKeySequence(self.trUtf8('F11')), 0, |
831 self, 'help_view_full_scree') | 823 self, 'help_view_full_scree') |
832 self.fullScreenAct.triggered[()].connect(self.__viewFullScreen) | 824 if not self.initShortcutsOnly: |
825 self.fullScreenAct.triggered[()].connect(self.__viewFullScreen) | |
833 self.__actions.append(self.fullScreenAct) | 826 self.__actions.append(self.fullScreenAct) |
834 self.addAction(self.fullScreenAct) | 827 self.addAction(self.fullScreenAct) |
835 | 828 |
836 self.nextTabAct = E5Action(self.trUtf8('Show next tab'), | 829 self.nextTabAct = E5Action(self.trUtf8('Show next tab'), |
837 self.trUtf8('Show next tab'), | 830 self.trUtf8('Show next tab'), |
838 QKeySequence(self.trUtf8('Ctrl+Alt+Tab')), 0, | 831 QKeySequence(self.trUtf8('Ctrl+Alt+Tab')), 0, |
839 self, 'help_view_next_tab') | 832 self, 'help_view_next_tab') |
840 self.nextTabAct.triggered[()].connect(self.__nextTab) | 833 if not self.initShortcutsOnly: |
834 self.nextTabAct.triggered[()].connect(self.__nextTab) | |
841 self.__actions.append(self.nextTabAct) | 835 self.__actions.append(self.nextTabAct) |
842 self.addAction(self.nextTabAct) | 836 self.addAction(self.nextTabAct) |
843 | 837 |
844 self.prevTabAct = E5Action(self.trUtf8('Show previous tab'), | 838 self.prevTabAct = E5Action(self.trUtf8('Show previous tab'), |
845 self.trUtf8('Show previous tab'), | 839 self.trUtf8('Show previous tab'), |
846 QKeySequence(self.trUtf8('Shift+Ctrl+Alt+Tab')), 0, | 840 QKeySequence(self.trUtf8('Shift+Ctrl+Alt+Tab')), 0, |
847 self, 'help_view_previous_tab') | 841 self, 'help_view_previous_tab') |
848 self.prevTabAct.triggered[()].connect(self.__prevTab) | 842 if not self.initShortcutsOnly: |
843 self.prevTabAct.triggered[()].connect(self.__prevTab) | |
849 self.__actions.append(self.prevTabAct) | 844 self.__actions.append(self.prevTabAct) |
850 self.addAction(self.prevTabAct) | 845 self.addAction(self.prevTabAct) |
851 | 846 |
852 self.switchTabAct = E5Action(self.trUtf8('Switch between tabs'), | 847 self.switchTabAct = E5Action(self.trUtf8('Switch between tabs'), |
853 self.trUtf8('Switch between tabs'), | 848 self.trUtf8('Switch between tabs'), |
854 QKeySequence(self.trUtf8('Ctrl+1')), 0, | 849 QKeySequence(self.trUtf8('Ctrl+1')), 0, |
855 self, 'help_switch_tabs') | 850 self, 'help_switch_tabs') |
856 self.switchTabAct.triggered[()].connect(self.__switchTab) | 851 if not self.initShortcutsOnly: |
852 self.switchTabAct.triggered[()].connect(self.__switchTab) | |
857 self.__actions.append(self.switchTabAct) | 853 self.__actions.append(self.switchTabAct) |
858 self.addAction(self.switchTabAct) | 854 self.addAction(self.switchTabAct) |
859 | 855 |
860 self.prefAct = E5Action(self.trUtf8('Preferences'), | 856 self.prefAct = E5Action(self.trUtf8('Preferences'), |
861 UI.PixmapCache.getIcon("configure.png"), | 857 UI.PixmapCache.getIcon("configure.png"), |
864 self.prefAct.setWhatsThis(self.trUtf8( | 860 self.prefAct.setWhatsThis(self.trUtf8( |
865 """<b>Preferences</b>""" | 861 """<b>Preferences</b>""" |
866 """<p>Set the configuration items of the application""" | 862 """<p>Set the configuration items of the application""" |
867 """ with your prefered values.</p>""" | 863 """ with your prefered values.</p>""" |
868 )) | 864 )) |
869 self.prefAct.triggered[()].connect(self.__showPreferences) | 865 if not self.initShortcutsOnly: |
866 self.prefAct.triggered[()].connect(self.__showPreferences) | |
870 self.__actions.append(self.prefAct) | 867 self.__actions.append(self.prefAct) |
871 | 868 |
872 self.acceptedLanguagesAct = E5Action(self.trUtf8('Languages'), | 869 self.acceptedLanguagesAct = E5Action(self.trUtf8('Languages'), |
873 UI.PixmapCache.getIcon("flag.png"), | 870 UI.PixmapCache.getIcon("flag.png"), |
874 self.trUtf8('&Languages...'), 0, 0, self, 'help_accepted_languages') | 871 self.trUtf8('&Languages...'), 0, 0, self, 'help_accepted_languages') |
876 'Configure the accepted languages for web pages')) | 873 'Configure the accepted languages for web pages')) |
877 self.acceptedLanguagesAct.setWhatsThis(self.trUtf8( | 874 self.acceptedLanguagesAct.setWhatsThis(self.trUtf8( |
878 """<b>Languages</b>""" | 875 """<b>Languages</b>""" |
879 """<p>Configure the accepted languages for web pages.</p>""" | 876 """<p>Configure the accepted languages for web pages.</p>""" |
880 )) | 877 )) |
881 self.acceptedLanguagesAct.triggered[()].connect(self.__showAcceptedLanguages) | 878 if not self.initShortcutsOnly: |
879 self.acceptedLanguagesAct.triggered[()].connect(self.__showAcceptedLanguages) | |
882 self.__actions.append(self.acceptedLanguagesAct) | 880 self.__actions.append(self.acceptedLanguagesAct) |
883 | 881 |
884 self.cookiesAct = E5Action(self.trUtf8('Cookies'), | 882 self.cookiesAct = E5Action(self.trUtf8('Cookies'), |
885 UI.PixmapCache.getIcon("cookie.png"), | 883 UI.PixmapCache.getIcon("cookie.png"), |
886 self.trUtf8('C&ookies...'), 0, 0, self, 'help_cookies') | 884 self.trUtf8('C&ookies...'), 0, 0, self, 'help_cookies') |
888 'Configure cookies handling')) | 886 'Configure cookies handling')) |
889 self.cookiesAct.setWhatsThis(self.trUtf8( | 887 self.cookiesAct.setWhatsThis(self.trUtf8( |
890 """<b>Cookies</b>""" | 888 """<b>Cookies</b>""" |
891 """<p>Configure cookies handling.</p>""" | 889 """<p>Configure cookies handling.</p>""" |
892 )) | 890 )) |
893 self.cookiesAct.triggered[()].connect(self.__showCookiesConfiguration) | 891 if not self.initShortcutsOnly: |
892 self.cookiesAct.triggered[()].connect(self.__showCookiesConfiguration) | |
894 self.__actions.append(self.cookiesAct) | 893 self.__actions.append(self.cookiesAct) |
895 | 894 |
896 self.offlineStorageAct = E5Action(self.trUtf8('Offline Storage'), | 895 self.offlineStorageAct = E5Action(self.trUtf8('Offline Storage'), |
897 UI.PixmapCache.getIcon("preferences-html5.png"), | 896 UI.PixmapCache.getIcon("preferences-html5.png"), |
898 self.trUtf8('Offline &Storage...'), 0, 0, self, 'help_offline_storage') | 897 self.trUtf8('Offline &Storage...'), 0, 0, self, 'help_offline_storage') |
900 'Configure offline storage')) | 899 'Configure offline storage')) |
901 self.offlineStorageAct.setWhatsThis(self.trUtf8( | 900 self.offlineStorageAct.setWhatsThis(self.trUtf8( |
902 """<b>Offline Storage</b>""" | 901 """<b>Offline Storage</b>""" |
903 """<p>Opens a dialog to configure offline storage.</p>""" | 902 """<p>Opens a dialog to configure offline storage.</p>""" |
904 )) | 903 )) |
905 self.offlineStorageAct.triggered[()].connect(self.__showOfflineStorageConfiguration) | 904 if not self.initShortcutsOnly: |
905 self.offlineStorageAct.triggered[()].connect(self.__showOfflineStorageConfiguration) | |
906 self.__actions.append(self.offlineStorageAct) | 906 self.__actions.append(self.offlineStorageAct) |
907 | 907 |
908 self.syncTocAct = E5Action(self.trUtf8('Sync with Table of Contents'), | 908 self.syncTocAct = E5Action(self.trUtf8('Sync with Table of Contents'), |
909 UI.PixmapCache.getIcon("syncToc.png"), | 909 UI.PixmapCache.getIcon("syncToc.png"), |
910 self.trUtf8('Sync with Table of Contents'), | 910 self.trUtf8('Sync with Table of Contents'), |
913 'Synchronizes the table of contents with current page')) | 913 'Synchronizes the table of contents with current page')) |
914 self.syncTocAct.setWhatsThis(self.trUtf8( | 914 self.syncTocAct.setWhatsThis(self.trUtf8( |
915 """<b>Sync with Table of Contents</b>""" | 915 """<b>Sync with Table of Contents</b>""" |
916 """<p>Synchronizes the table of contents with current page.</p>""" | 916 """<p>Synchronizes the table of contents with current page.</p>""" |
917 )) | 917 )) |
918 self.syncTocAct.triggered[()].connect(self.__syncTOC) | 918 if not self.initShortcutsOnly: |
919 self.syncTocAct.triggered[()].connect(self.__syncTOC) | |
919 self.__actions.append(self.syncTocAct) | 920 self.__actions.append(self.syncTocAct) |
920 | 921 |
921 self.showTocAct = E5Action(self.trUtf8('Table of Contents'), | 922 self.showTocAct = E5Action(self.trUtf8('Table of Contents'), |
922 self.trUtf8('Table of Contents'), | 923 self.trUtf8('Table of Contents'), |
923 0, 0, self, 'help_show_toc') | 924 0, 0, self, 'help_show_toc') |
925 'Shows the table of contents window')) | 926 'Shows the table of contents window')) |
926 self.showTocAct.setWhatsThis(self.trUtf8( | 927 self.showTocAct.setWhatsThis(self.trUtf8( |
927 """<b>Table of Contents</b>""" | 928 """<b>Table of Contents</b>""" |
928 """<p>Shows the table of contents window.</p>""" | 929 """<p>Shows the table of contents window.</p>""" |
929 )) | 930 )) |
930 self.showTocAct.triggered[()].connect(self.__showTocWindow) | 931 if not self.initShortcutsOnly: |
932 self.showTocAct.triggered[()].connect(self.__showTocWindow) | |
931 self.__actions.append(self.showTocAct) | 933 self.__actions.append(self.showTocAct) |
932 | 934 |
933 self.showIndexAct = E5Action(self.trUtf8('Index'), | 935 self.showIndexAct = E5Action(self.trUtf8('Index'), |
934 self.trUtf8('Index'), | 936 self.trUtf8('Index'), |
935 0, 0, self, 'help_show_index') | 937 0, 0, self, 'help_show_index') |
937 'Shows the index window')) | 939 'Shows the index window')) |
938 self.showIndexAct.setWhatsThis(self.trUtf8( | 940 self.showIndexAct.setWhatsThis(self.trUtf8( |
939 """<b>Index</b>""" | 941 """<b>Index</b>""" |
940 """<p>Shows the index window.</p>""" | 942 """<p>Shows the index window.</p>""" |
941 )) | 943 )) |
942 self.showIndexAct.triggered[()].connect(self.__showIndexWindow) | 944 if not self.initShortcutsOnly: |
945 self.showIndexAct.triggered[()].connect(self.__showIndexWindow) | |
943 self.__actions.append(self.showIndexAct) | 946 self.__actions.append(self.showIndexAct) |
944 | 947 |
945 self.showSearchAct = E5Action(self.trUtf8('Search'), | 948 self.showSearchAct = E5Action(self.trUtf8('Search'), |
946 self.trUtf8('Search'), | 949 self.trUtf8('Search'), |
947 0, 0, self, 'help_show_search') | 950 0, 0, self, 'help_show_search') |
949 'Shows the search window')) | 952 'Shows the search window')) |
950 self.showSearchAct.setWhatsThis(self.trUtf8( | 953 self.showSearchAct.setWhatsThis(self.trUtf8( |
951 """<b>Search</b>""" | 954 """<b>Search</b>""" |
952 """<p>Shows the search window.</p>""" | 955 """<p>Shows the search window.</p>""" |
953 )) | 956 )) |
954 self.showSearchAct.triggered[()].connect(self.__showSearchWindow) | 957 if not self.initShortcutsOnly: |
958 self.showSearchAct.triggered[()].connect(self.__showSearchWindow) | |
955 self.__actions.append(self.showSearchAct) | 959 self.__actions.append(self.showSearchAct) |
956 | 960 |
957 self.manageQtHelpDocsAct = E5Action(self.trUtf8('Manage QtHelp Documents'), | 961 self.manageQtHelpDocsAct = E5Action(self.trUtf8('Manage QtHelp Documents'), |
958 self.trUtf8('Manage QtHelp &Documents'), | 962 self.trUtf8('Manage QtHelp &Documents'), |
959 0, 0, self, 'help_qthelp_documents') | 963 0, 0, self, 'help_qthelp_documents') |
961 'Shows a dialog to manage the QtHelp documentation set')) | 965 'Shows a dialog to manage the QtHelp documentation set')) |
962 self.manageQtHelpDocsAct.setWhatsThis(self.trUtf8( | 966 self.manageQtHelpDocsAct.setWhatsThis(self.trUtf8( |
963 """<b>Manage QtHelp Documents</b>""" | 967 """<b>Manage QtHelp Documents</b>""" |
964 """<p>Shows a dialog to manage the QtHelp documentation set.</p>""" | 968 """<p>Shows a dialog to manage the QtHelp documentation set.</p>""" |
965 )) | 969 )) |
966 self.manageQtHelpDocsAct.triggered[()].connect(self.__manageQtHelpDocumentation) | 970 if not self.initShortcutsOnly: |
971 self.manageQtHelpDocsAct.triggered[()].connect(self.__manageQtHelpDocumentation) | |
967 self.__actions.append(self.manageQtHelpDocsAct) | 972 self.__actions.append(self.manageQtHelpDocsAct) |
968 | 973 |
969 self.manageQtHelpFiltersAct = E5Action(self.trUtf8('Manage QtHelp Filters'), | 974 self.manageQtHelpFiltersAct = E5Action(self.trUtf8('Manage QtHelp Filters'), |
970 self.trUtf8('Manage QtHelp &Filters'), | 975 self.trUtf8('Manage QtHelp &Filters'), |
971 0, 0, self, 'help_qthelp_filters') | 976 0, 0, self, 'help_qthelp_filters') |
973 'Shows a dialog to manage the QtHelp filters')) | 978 'Shows a dialog to manage the QtHelp filters')) |
974 self.manageQtHelpFiltersAct.setWhatsThis(self.trUtf8( | 979 self.manageQtHelpFiltersAct.setWhatsThis(self.trUtf8( |
975 """<b>Manage QtHelp Filters</b>""" | 980 """<b>Manage QtHelp Filters</b>""" |
976 """<p>Shows a dialog to manage the QtHelp filters.</p>""" | 981 """<p>Shows a dialog to manage the QtHelp filters.</p>""" |
977 )) | 982 )) |
978 self.manageQtHelpFiltersAct.triggered[()].connect(self.__manageQtHelpFilters) | 983 if not self.initShortcutsOnly: |
984 self.manageQtHelpFiltersAct.triggered[()].connect(self.__manageQtHelpFilters) | |
979 self.__actions.append(self.manageQtHelpFiltersAct) | 985 self.__actions.append(self.manageQtHelpFiltersAct) |
980 | 986 |
981 self.reindexDocumentationAct = E5Action(self.trUtf8('Reindex Documentation'), | 987 self.reindexDocumentationAct = E5Action(self.trUtf8('Reindex Documentation'), |
982 self.trUtf8('&Reindex Documentation'), | 988 self.trUtf8('&Reindex Documentation'), |
983 0, 0, self, 'help_qthelp_reindex') | 989 0, 0, self, 'help_qthelp_reindex') |
986 self.reindexDocumentationAct.setWhatsThis(self.trUtf8( | 992 self.reindexDocumentationAct.setWhatsThis(self.trUtf8( |
987 """<b>Reindex Documentation</b>""" | 993 """<b>Reindex Documentation</b>""" |
988 """<p>Reindexes the documentation set.</p>""" | 994 """<p>Reindexes the documentation set.</p>""" |
989 )) | 995 )) |
990 if not self.initShortcutsOnly: | 996 if not self.initShortcutsOnly: |
991 self.reindexDocumentationAct.triggered[()].connect(self.__searchEngine.reindexDocumentation) | 997 self.reindexDocumentationAct.triggered[()].connect( |
998 self.__searchEngine.reindexDocumentation) | |
992 self.__actions.append(self.reindexDocumentationAct) | 999 self.__actions.append(self.reindexDocumentationAct) |
993 | 1000 |
994 self.clearPrivateDataAct = E5Action(self.trUtf8('Clear private data'), | 1001 self.clearPrivateDataAct = E5Action(self.trUtf8('Clear private data'), |
995 self.trUtf8('&Clear private data'), | 1002 self.trUtf8('&Clear private data'), |
996 0, 0, | 1003 0, 0, |
999 self.clearPrivateDataAct.setWhatsThis(self.trUtf8( | 1006 self.clearPrivateDataAct.setWhatsThis(self.trUtf8( |
1000 """<b>Clear private data</b>""" | 1007 """<b>Clear private data</b>""" |
1001 """<p>Clears the private data like browsing history, search history""" | 1008 """<p>Clears the private data like browsing history, search history""" |
1002 """ or the favicons database.</p>""" | 1009 """ or the favicons database.</p>""" |
1003 )) | 1010 )) |
1004 self.clearPrivateDataAct.triggered[()].connect(self.__clearPrivateData) | 1011 if not self.initShortcutsOnly: |
1012 self.clearPrivateDataAct.triggered[()].connect(self.__clearPrivateData) | |
1005 self.__actions.append(self.clearPrivateDataAct) | 1013 self.__actions.append(self.clearPrivateDataAct) |
1006 | 1014 |
1007 self.clearIconsAct = E5Action(self.trUtf8('Clear icons database'), | 1015 self.clearIconsAct = E5Action(self.trUtf8('Clear icons database'), |
1008 self.trUtf8('Clear &icons database'), | 1016 self.trUtf8('Clear &icons database'), |
1009 0, 0, | 1017 0, 0, |
1011 self.clearIconsAct.setStatusTip(self.trUtf8('Clear the database of favicons')) | 1019 self.clearIconsAct.setStatusTip(self.trUtf8('Clear the database of favicons')) |
1012 self.clearIconsAct.setWhatsThis(self.trUtf8( | 1020 self.clearIconsAct.setWhatsThis(self.trUtf8( |
1013 """<b>Clear icons database</b>""" | 1021 """<b>Clear icons database</b>""" |
1014 """<p>Clears the database of favicons of previously visited URLs.</p>""" | 1022 """<p>Clears the database of favicons of previously visited URLs.</p>""" |
1015 )) | 1023 )) |
1016 self.clearIconsAct.triggered[()].connect(self.__clearIconsDatabase) | 1024 if not self.initShortcutsOnly: |
1025 self.clearIconsAct.triggered[()].connect(self.__clearIconsDatabase) | |
1017 self.__actions.append(self.clearIconsAct) | 1026 self.__actions.append(self.clearIconsAct) |
1018 | 1027 |
1019 self.searchEnginesAct = E5Action(self.trUtf8('Configure Search Engines'), | 1028 self.searchEnginesAct = E5Action(self.trUtf8('Configure Search Engines'), |
1020 self.trUtf8('Configure Search &Engines...'), | 1029 self.trUtf8('Configure Search &Engines...'), |
1021 0, 0, | 1030 0, 0, |
1024 'Configure the available search engines')) | 1033 'Configure the available search engines')) |
1025 self.searchEnginesAct.setWhatsThis(self.trUtf8( | 1034 self.searchEnginesAct.setWhatsThis(self.trUtf8( |
1026 """<b>Configure Search Engines...</b>""" | 1035 """<b>Configure Search Engines...</b>""" |
1027 """<p>Opens a dialog to configure the available search engines.</p>""" | 1036 """<p>Opens a dialog to configure the available search engines.</p>""" |
1028 )) | 1037 )) |
1029 self.searchEnginesAct.triggered[()].connect(self.__showEnginesConfigurationDialog) | 1038 if not self.initShortcutsOnly: |
1039 self.searchEnginesAct.triggered[()].connect(self.__showEnginesConfigurationDialog) | |
1030 self.__actions.append(self.searchEnginesAct) | 1040 self.__actions.append(self.searchEnginesAct) |
1031 | 1041 |
1032 self.passwordsAct = E5Action(self.trUtf8('Manage Saved Passwords'), | 1042 self.passwordsAct = E5Action(self.trUtf8('Manage Saved Passwords'), |
1033 self.trUtf8('Manage Saved Passwords...'), | 1043 self.trUtf8('Manage Saved Passwords...'), |
1034 0, 0, | 1044 0, 0, |
1037 'Manage the saved passwords')) | 1047 'Manage the saved passwords')) |
1038 self.passwordsAct.setWhatsThis(self.trUtf8( | 1048 self.passwordsAct.setWhatsThis(self.trUtf8( |
1039 """<b>Manage Saved Passwords...</b>""" | 1049 """<b>Manage Saved Passwords...</b>""" |
1040 """<p>Opens a dialog to manage the saved passwords.</p>""" | 1050 """<p>Opens a dialog to manage the saved passwords.</p>""" |
1041 )) | 1051 )) |
1042 self.passwordsAct.triggered[()].connect(self.__showPasswordsDialog) | 1052 if not self.initShortcutsOnly: |
1053 self.passwordsAct.triggered[()].connect(self.__showPasswordsDialog) | |
1043 self.__actions.append(self.passwordsAct) | 1054 self.__actions.append(self.passwordsAct) |
1044 | 1055 |
1045 self.adblockAct = E5Action(self.trUtf8('Ad Block'), | 1056 self.adblockAct = E5Action(self.trUtf8('Ad Block'), |
1046 self.trUtf8('&Ad Block...'), | 1057 self.trUtf8('&Ad Block...'), |
1047 0, 0, | 1058 0, 0, |
1050 'Configure AdBlock subscriptions and rules')) | 1061 'Configure AdBlock subscriptions and rules')) |
1051 self.adblockAct.setWhatsThis(self.trUtf8( | 1062 self.adblockAct.setWhatsThis(self.trUtf8( |
1052 """<b>Ad Block...</b>""" | 1063 """<b>Ad Block...</b>""" |
1053 """<p>Opens a dialog to configure AdBlock subscriptions and rules.</p>""" | 1064 """<p>Opens a dialog to configure AdBlock subscriptions and rules.</p>""" |
1054 )) | 1065 )) |
1055 self.adblockAct.triggered[()].connect(self.__showAdBlockDialog) | 1066 if not self.initShortcutsOnly: |
1067 self.adblockAct.triggered[()].connect(self.__showAdBlockDialog) | |
1056 self.__actions.append(self.adblockAct) | 1068 self.__actions.append(self.adblockAct) |
1057 | 1069 |
1058 self.toolsMonitorAct = E5Action(self.trUtf8('Show Network Monitor'), | 1070 self.toolsMonitorAct = E5Action(self.trUtf8('Show Network Monitor'), |
1059 self.trUtf8('Show &Network Monitor'), | 1071 self.trUtf8('Show &Network Monitor'), |
1060 0, 0, | 1072 0, 0, |
1062 self.toolsMonitorAct.setStatusTip(self.trUtf8('Show the network monitor dialog')) | 1074 self.toolsMonitorAct.setStatusTip(self.trUtf8('Show the network monitor dialog')) |
1063 self.toolsMonitorAct.setWhatsThis(self.trUtf8( | 1075 self.toolsMonitorAct.setWhatsThis(self.trUtf8( |
1064 """<b>Show Network Monitor</b>""" | 1076 """<b>Show Network Monitor</b>""" |
1065 """<p>Shows the network monitor dialog.</p>""" | 1077 """<p>Shows the network monitor dialog.</p>""" |
1066 )) | 1078 )) |
1067 self.toolsMonitorAct.triggered[()].connect(self.__showNetworkMonitor) | 1079 if not self.initShortcutsOnly: |
1080 self.toolsMonitorAct.triggered[()].connect(self.__showNetworkMonitor) | |
1068 self.__actions.append(self.toolsMonitorAct) | 1081 self.__actions.append(self.toolsMonitorAct) |
1069 | 1082 |
1070 self.backAct.setEnabled(False) | 1083 self.backAct.setEnabled(False) |
1071 self.forwardAct.setEnabled(False) | 1084 self.forwardAct.setEnabled(False) |
1072 | 1085 |
1206 menu.addAction(self.aboutAct) | 1219 menu.addAction(self.aboutAct) |
1207 menu.addAction(self.aboutQtAct) | 1220 menu.addAction(self.aboutQtAct) |
1208 menu.addSeparator() | 1221 menu.addSeparator() |
1209 menu.addAction(self.whatsThisAct) | 1222 menu.addAction(self.whatsThisAct) |
1210 | 1223 |
1211 def __initTabContextMenu(self): | |
1212 """ | |
1213 Private mezhod to create the tab context menu. | |
1214 """ | |
1215 self.__tabContextMenu = QMenu(self.tabWidget) | |
1216 self.tabContextNewAct = \ | |
1217 self.__tabContextMenu.addAction(self.newTabAct) | |
1218 self.__tabContextMenu.addSeparator() | |
1219 self.leftMenuAct = \ | |
1220 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("1leftarrow.png"), | |
1221 self.trUtf8('Move Left'), self.__tabContextMenuMoveLeft) | |
1222 self.rightMenuAct = \ | |
1223 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("1rightarrow.png"), | |
1224 self.trUtf8('Move Right'), self.__tabContextMenuMoveRight) | |
1225 self.__tabContextMenu.addSeparator() | |
1226 self.tabContextCloneAct = \ | |
1227 self.__tabContextMenu.addAction(self.trUtf8("Duplicate Page"), | |
1228 self.__tabContextMenuClone) | |
1229 self.__tabContextMenu.addSeparator() | |
1230 self.tabContextCloseAct = \ | |
1231 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("close.png"), | |
1232 self.trUtf8('Close'), self.__tabContextMenuClose) | |
1233 self.tabContextCloseOthersAct = \ | |
1234 self.__tabContextMenu.addAction(self.trUtf8("Close Others"), | |
1235 self.__tabContextMenuCloseOthers) | |
1236 self.__tabContextMenu.addAction(self.closeAllAct) | |
1237 self.__tabContextMenu.addSeparator() | |
1238 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("printPreview.png"), | |
1239 self.trUtf8('Print Preview'), self.__tabContextMenuPrintPreview) | |
1240 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("print.png"), | |
1241 self.trUtf8('Print'), self.__tabContextMenuPrint) | |
1242 self.__tabContextMenu.addAction(UI.PixmapCache.getIcon("printPdf.png"), | |
1243 self.trUtf8('Print as PDF'), self.__tabContextMenuPrintPdf) | |
1244 self.__tabContextMenu.addSeparator() | |
1245 self.__tabContextMenu.addAction(self.bookmarksAllTabsAct) | |
1246 | |
1247 def __initToolbars(self): | 1224 def __initToolbars(self): |
1248 """ | 1225 """ |
1249 Private method to create the toolbars. | 1226 Private method to create the toolbars. |
1250 """ | 1227 """ |
1251 filetb = self.addToolBar(self.trUtf8("File")) | 1228 filetb = self.addToolBar(self.trUtf8("File")) |
1479 else: | 1456 else: |
1480 p.setBrush(QPalette.Base, QBrush(Preferences.getHelp("SaveUrlColor"))) | 1457 p.setBrush(QPalette.Base, QBrush(Preferences.getHelp("SaveUrlColor"))) |
1481 le.setPalette(p) | 1458 le.setPalette(p) |
1482 le.update() | 1459 le.update() |
1483 | 1460 |
1484 def __elide(self, txt, mode = Qt.ElideRight, length = 40): | |
1485 """ | |
1486 Private method to elide some text. | |
1487 | |
1488 @param txt text to be elided (string) | |
1489 @keyparam mode elide mode (Qt.TextElideMode) | |
1490 @keyparam length amount of characters to be used (integer) | |
1491 @return the elided text (string) | |
1492 """ | |
1493 if mode == Qt.ElideNone or len(txt) < length: | |
1494 return txt | |
1495 elif mode == Qt.ElideLeft: | |
1496 return "...{0}".format(txt[-length:]) | |
1497 elif mode == Qt.ElideMiddle: | |
1498 return "{0}...{1}".format(txt[:length // 2], txt[-(length // 2):]) | |
1499 elif mode == Qt.ElideRight: | |
1500 return "{0}...".format(txt[:length]) | |
1501 else: | |
1502 # just in case | |
1503 return txt | |
1504 | |
1505 def __sourceChanged(self, url): | 1461 def __sourceChanged(self, url): |
1506 """ | 1462 """ |
1507 Private slot called when the displayed text of the combobox is changed. | 1463 Private slot called when the displayed text of the combobox is changed. |
1508 | 1464 |
1509 @param url URL of the new site (QUrl) | 1465 @param url URL of the new site (QUrl) |
1527 """ | 1483 """ |
1528 Private slot called to handle a change of the current browsers title. | 1484 Private slot called to handle a change of the current browsers title. |
1529 | 1485 |
1530 @param title new title (string) | 1486 @param title new title (string) |
1531 """ | 1487 """ |
1532 if title == "": | |
1533 title = self.currentBrowser().url().toString() | |
1534 | |
1535 self.tabWidget.setTabText(self.tabWidget.currentIndex(), | |
1536 self.__elide(title.replace("&", "&&"))) | |
1537 self.tabWidget.setTabToolTip(self.tabWidget.currentIndex(), | |
1538 title) | |
1539 self.historyManager().updateHistoryEntry( | 1488 self.historyManager().updateHistoryEntry( |
1540 self.currentBrowser().url().toString(), title) | 1489 self.currentBrowser().url().toString(), title) |
1541 | 1490 |
1542 def newTab(self, link = None): | 1491 def newTab(self, link = None): |
1543 """ | 1492 """ |
1544 Public slot called to open a new help window tab. | 1493 Public slot called to open a new help window tab. |
1545 | 1494 |
1546 @param link file to be displayed in the new window (string or QUrl) | 1495 @param link file to be displayed in the new window (string or QUrl) |
1547 """ | 1496 """ |
1548 if link is None: | 1497 self.tabWidget.newBrowser(link) |
1549 linkName = "" | |
1550 elif isinstance(link, QUrl): | |
1551 linkName = link.toString() | |
1552 else: | |
1553 linkName = link | |
1554 self.newBrowser(linkName) | |
1555 | 1498 |
1556 def newWindow(self, link = None): | 1499 def newWindow(self, link = None): |
1557 """ | 1500 """ |
1558 Public slot called to open a new help browser dialog. | 1501 Public slot called to open a new help browser dialog. |
1559 | 1502 |
1614 """ | 1557 """ |
1615 browser = self.currentBrowser() | 1558 browser = self.currentBrowser() |
1616 if browser is not None: | 1559 if browser is not None: |
1617 browser.saveAs() | 1560 browser.saveAs() |
1618 | 1561 |
1619 def __printFile(self, browser = None): | |
1620 """ | |
1621 Private slot called to print the displayed file. | |
1622 | |
1623 @param browser reference to the browser to be printed (HelpBrowserWV) | |
1624 """ | |
1625 if browser is None: | |
1626 browser = self.currentBrowser() | |
1627 | |
1628 self.__printRequested(browser.page().mainFrame()) | |
1629 | |
1630 def __printRequested(self, frame): | |
1631 """ | |
1632 Private slot to handle a print request. | |
1633 | |
1634 @param frame reference to the frame to be printed (QWebFrame) | |
1635 """ | |
1636 printer = QPrinter(mode = QPrinter.HighResolution) | |
1637 if Preferences.getPrinter("ColorMode"): | |
1638 printer.setColorMode(QPrinter.Color) | |
1639 else: | |
1640 printer.setColorMode(QPrinter.GrayScale) | |
1641 if Preferences.getPrinter("FirstPageFirst"): | |
1642 printer.setPageOrder(QPrinter.FirstPageFirst) | |
1643 else: | |
1644 printer.setPageOrder(QPrinter.LastPageFirst) | |
1645 printer.setPrinterName(Preferences.getPrinter("PrinterName")) | |
1646 | |
1647 printDialog = QPrintDialog(printer, self) | |
1648 if printDialog.exec_() == QDialog.Accepted: | |
1649 try: | |
1650 frame.print_(printer) | |
1651 except AttributeError: | |
1652 E5MessageBox.critical(self, | |
1653 self.trUtf8("Eric Web Browser"), | |
1654 self.trUtf8("""<p>Printing is not available due to a bug in PyQt4.""" | |
1655 """Please upgrade.</p>""")) | |
1656 return | |
1657 | |
1658 def __printFilePdf(self, browser = None): | |
1659 """ | |
1660 Private slot called to print the displayed file to PDF. | |
1661 | |
1662 @param browser reference to the browser to be printed (HelpBrowserWV) | |
1663 """ | |
1664 if browser is None: | |
1665 browser = self.currentBrowser() | |
1666 | |
1667 self.__printPdfRequested(browser.page().mainFrame()) | |
1668 | |
1669 def __printPdfRequested(self, frame): | |
1670 """ | |
1671 Private slot to handle a print to PDF request. | |
1672 | |
1673 @param frame reference to the frame to be printed (QWebFrame) | |
1674 """ | |
1675 printer = QPrinter(mode = QPrinter.HighResolution) | |
1676 if Preferences.getPrinter("ColorMode"): | |
1677 printer.setColorMode(QPrinter.Color) | |
1678 else: | |
1679 printer.setColorMode(QPrinter.GrayScale) | |
1680 printer.setPrinterName(Preferences.getPrinter("PrinterName")) | |
1681 printer.setOutputFormat(QPrinter.PdfFormat) | |
1682 name = frame.url().path().rsplit('/', 1)[-1] | |
1683 if name: | |
1684 name = name.rsplit('.', 1)[0] | |
1685 name += '.pdf' | |
1686 printer.setOutputFileName(name) | |
1687 | |
1688 printDialog = QPrintDialog(printer, self) | |
1689 if printDialog.exec_() == QDialog.Accepted: | |
1690 try: | |
1691 frame.print_(printer) | |
1692 except AttributeError: | |
1693 E5MessageBox.critical(self, | |
1694 self.trUtf8("Eric Web Browser"), | |
1695 self.trUtf8("""<p>Printing is not available due to a bug in PyQt4.""" | |
1696 """Please upgrade.</p>""")) | |
1697 return | |
1698 | |
1699 def __printPreviewFile(self, browser = None): | |
1700 """ | |
1701 Private slot called to show a print preview of the displayed file. | |
1702 | |
1703 @param browser reference to the browser to be printed (HelpBrowserWV) | |
1704 """ | |
1705 from PyQt4.QtGui import QPrintPreviewDialog | |
1706 | |
1707 if browser is None: | |
1708 browser = self.currentBrowser() | |
1709 | |
1710 printer = QPrinter(mode = QPrinter.HighResolution) | |
1711 if Preferences.getPrinter("ColorMode"): | |
1712 printer.setColorMode(QPrinter.Color) | |
1713 else: | |
1714 printer.setColorMode(QPrinter.GrayScale) | |
1715 if Preferences.getPrinter("FirstPageFirst"): | |
1716 printer.setPageOrder(QPrinter.FirstPageFirst) | |
1717 else: | |
1718 printer.setPageOrder(QPrinter.LastPageFirst) | |
1719 printer.setPrinterName(Preferences.getPrinter("PrinterName")) | |
1720 | |
1721 self.__printPreviewBrowser = browser | |
1722 preview = QPrintPreviewDialog(printer, self) | |
1723 preview.paintRequested.connect(self.__printPreview) | |
1724 preview.exec_() | |
1725 | |
1726 def __printPreview(self, printer): | |
1727 """ | |
1728 Public slot to generate a print preview. | |
1729 | |
1730 @param printer reference to the printer object (QPrinter) | |
1731 """ | |
1732 try: | |
1733 self.__printPreviewBrowser.print_(printer) | |
1734 except AttributeError: | |
1735 E5MessageBox.critical(self, | |
1736 self.trUtf8("Eric Web Browser"), | |
1737 self.trUtf8("""<p>Printing is not available due to a bug in PyQt4.""" | |
1738 """Please upgrade.</p>""")) | |
1739 return | |
1740 | |
1741 def __about(self): | 1562 def __about(self): |
1742 """ | 1563 """ |
1743 Private slot to show the about information. | 1564 Private slot to show the about information. |
1744 """ | 1565 """ |
1745 E5MessageBox.about(self, self.trUtf8("Eric Web Browser"), self.trUtf8( | 1566 E5MessageBox.about(self, self.trUtf8("Eric Web Browser"), self.trUtf8( |
1751 """ | 1572 """ |
1752 Private slot to show info about Qt. | 1573 Private slot to show info about Qt. |
1753 """ | 1574 """ |
1754 E5MessageBox.aboutQt(self, self.trUtf8("Eric Web Browser")) | 1575 E5MessageBox.aboutQt(self, self.trUtf8("Eric Web Browser")) |
1755 | 1576 |
1756 def __setBackwardAvailable(self, b): | 1577 def setBackwardAvailable(self, b): |
1757 """ | 1578 """ |
1758 Private slot called when backward references are available. | 1579 Public slot called when backward references are available. |
1759 | 1580 |
1760 @param b flag indicating availability of the backwards action (boolean) | 1581 @param b flag indicating availability of the backwards action (boolean) |
1761 """ | 1582 """ |
1762 self.backAct.setEnabled(b) | 1583 self.backAct.setEnabled(b) |
1763 | 1584 |
1764 def __setForwardAvailable(self, b): | 1585 def setForwardAvailable(self, b): |
1765 """ | 1586 """ |
1766 Private slot called when forward references are available. | 1587 Public slot called when forward references are available. |
1767 | 1588 |
1768 @param b flag indicating the availability of the forwards action (boolean) | 1589 @param b flag indicating the availability of the forwards action (boolean) |
1769 """ | 1590 """ |
1770 self.forwardAct.setEnabled(b) | 1591 self.forwardAct.setEnabled(b) |
1771 | 1592 |
1772 def __setLoadingActions(self, b): | 1593 def setLoadingActions(self, b): |
1773 """ | 1594 """ |
1774 Private slot to set the loading dependent actions. | 1595 Public slot to set the loading dependent actions. |
1775 | 1596 |
1776 @param b flag indicating the loading state to consider (boolean) | 1597 @param b flag indicating the loading state to consider (boolean) |
1777 """ | 1598 """ |
1778 self.reloadAct.setEnabled(not b) | 1599 self.reloadAct.setEnabled(not b) |
1779 self.stopAct.setEnabled(b) | 1600 self.stopAct.setEnabled(b) |
1813 self.__bookmarksDialog.setAttribute(Qt.WA_DeleteOnClose) | 1634 self.__bookmarksDialog.setAttribute(Qt.WA_DeleteOnClose) |
1814 self.__bookmarksDialog.openUrl.connect(self.__openUrl) | 1635 self.__bookmarksDialog.openUrl.connect(self.__openUrl) |
1815 self.__bookmarksDialog.newUrl.connect(self.__openUrlNewTab) | 1636 self.__bookmarksDialog.newUrl.connect(self.__openUrlNewTab) |
1816 self.__bookmarksDialog.show() | 1637 self.__bookmarksDialog.show() |
1817 | 1638 |
1818 def __bookmarkAll(self): | 1639 def bookmarkAll(self): |
1819 """ | 1640 """ |
1820 Private slot to bookmark all open tabs. | 1641 Public slot to bookmark all open tabs. |
1821 """ | 1642 """ |
1822 dlg = AddBookmarkDialog() | 1643 dlg = AddBookmarkDialog() |
1823 dlg.setFolder(True) | 1644 dlg.setFolder(True) |
1824 dlg.setTitle(self.trUtf8("Saved Tabs")) | 1645 dlg.setTitle(self.trUtf8("Saved Tabs")) |
1825 dlg.exec_() | 1646 dlg.exec_() |
1826 | 1647 |
1827 folder = dlg.addedNode() | 1648 folder = dlg.addedNode() |
1828 if folder is None: | 1649 if folder is None: |
1829 return | 1650 return |
1830 | 1651 |
1831 for index in range(self.tabWidget.count()): | 1652 for browser in self.tabWidget.browsers(): |
1832 tab = self.tabWidget.widget(index) | |
1833 if tab is None: | |
1834 continue | |
1835 | |
1836 bookmark = BookmarkNode(BookmarkNode.Bookmark) | 1653 bookmark = BookmarkNode(BookmarkNode.Bookmark) |
1837 bookmark.url = bytes(tab.url().toEncoded()).decode() | 1654 bookmark.url = bytes(browser.url().toEncoded()).decode() |
1838 bookmark.title = tab.title() | 1655 bookmark.title = browser.title() |
1839 | 1656 |
1840 self.bookmarksManager().addBookmark(folder, bookmark) | 1657 self.bookmarksManager().addBookmark(folder, bookmark) |
1841 | 1658 |
1842 def __find(self): | 1659 def __find(self): |
1843 """ | 1660 """ |
1854 | 1671 |
1855 @param e the close event (QCloseEvent) | 1672 @param e the close event (QCloseEvent) |
1856 <br />This event is simply accepted after the history has been | 1673 <br />This event is simply accepted after the history has been |
1857 saved and all window references have been deleted. | 1674 saved and all window references have been deleted. |
1858 """ | 1675 """ |
1676 if not self.tabWidget.shallShutDown(): | |
1677 e.ignore() | |
1678 return | |
1679 | |
1859 self.__closeNetworkMonitor() | 1680 self.__closeNetworkMonitor() |
1860 | 1681 |
1861 self.cookieJar().close() | 1682 self.cookieJar().close() |
1862 | 1683 |
1863 self.bookmarksManager().close() | 1684 self.bookmarksManager().close() |
1981 def __copy(self): | 1802 def __copy(self): |
1982 """ | 1803 """ |
1983 Private slot called to handle the copy action. | 1804 Private slot called to handle the copy action. |
1984 """ | 1805 """ |
1985 self.currentBrowser().copy() | 1806 self.currentBrowser().copy() |
1986 | |
1987 def __close(self): | |
1988 """ | |
1989 Private slot called to handle the close action. | |
1990 """ | |
1991 browser = self.currentBrowser() | |
1992 self.tabWidget.removeTab(self.tabWidget.currentIndex()) | |
1993 del browser | |
1994 if self.tabWidget.count() == 0: | |
1995 self.newTab() | |
1996 else: | |
1997 self.__currentChanged(self.tabWidget.currentIndex()) | |
1998 | |
1999 def __closeAll(self): | |
2000 """ | |
2001 Private slot called to handle the close all action. | |
2002 """ | |
2003 for index in range(self.tabWidget.count() - 1, -1, -1): | |
2004 self.__closeAt(index) | |
2005 | |
2006 def __closeAt(self, index): | |
2007 """ | |
2008 Private slot to close a window based on it's index. | |
2009 | |
2010 @param index index of window to close (integer) | |
2011 """ | |
2012 browser = self.tabWidget.widget(index) | |
2013 self.tabWidget.removeTab(index) | |
2014 del browser | |
2015 if self.tabWidget.count() == 0: | |
2016 self.newTab() | |
2017 else: | |
2018 self.__currentChanged(self.tabWidget.currentIndex()) | |
2019 | |
2020 def __windowCloseRequested(self): | |
2021 """ | |
2022 Private slot to handle the windowCloseRequested signal of a browser. | |
2023 """ | |
2024 page = self.sender() | |
2025 if page is None: | |
2026 return | |
2027 | |
2028 browser = page.view() | |
2029 if browser is None: | |
2030 return | |
2031 | |
2032 index = self.tabWidget.indexOf(browser) | |
2033 self.tabWidget.removeTab(index) | |
2034 del browser | |
2035 if self.tabWidget.count() == 0: | |
2036 self.newTab() | |
2037 else: | |
2038 self.__currentChanged(self.tabWidget.currentIndex()) | |
2039 | 1807 |
2040 def __privateBrowsing(self): | 1808 def __privateBrowsing(self): |
2041 """ | 1809 """ |
2042 Private slot to switch private browsing. | 1810 Private slot to switch private browsing. |
2043 """ | 1811 """ |
2070 """ | 1838 """ |
2071 Public method to get a reference to the current help browser. | 1839 Public method to get a reference to the current help browser. |
2072 | 1840 |
2073 @return reference to the current help browser (HelpBrowser) | 1841 @return reference to the current help browser (HelpBrowser) |
2074 """ | 1842 """ |
2075 return self.tabWidget.currentWidget() | 1843 return self.tabWidget.currentBrowser() |
2076 | 1844 |
2077 def browserAt(self, index): | 1845 def browserAt(self, index): |
2078 """ | 1846 """ |
2079 Public method to get a reference to the help browser with the given index. | 1847 Public method to get a reference to the help browser with the given index. |
2080 | 1848 |
2081 @param index index of the browser to get (integer) | 1849 @param index index of the browser to get (integer) |
2082 @return reference to the indexed help browser (HelpBrowser) | 1850 @return reference to the indexed help browser (HelpBrowser) |
2083 """ | 1851 """ |
2084 return self.tabWidget.widget(index) | 1852 return self.tabWidget.browserAt(index) |
2085 | 1853 |
2086 def browsers(self): | 1854 def browsers(self): |
2087 """ | 1855 """ |
2088 Public method to get a list of references to all help browsers. | 1856 Public method to get a list of references to all help browsers. |
2089 | 1857 |
2090 @return list of references to help browsers (list of HelpBrowser) | 1858 @return list of references to help browsers (list of HelpBrowser) |
2091 """ | 1859 """ |
2092 l = [] | 1860 return self.tabWidget.browsers() |
2093 for index in range(self.tabWidget.count()): | |
2094 l.append(self.tabWidget.widget(index)) | |
2095 return l | |
2096 | |
2097 def newBrowser(self, link): | |
2098 """ | |
2099 Public method to create a new help browser tab. | |
2100 | |
2101 @param link link to be shown (string) | |
2102 """ | |
2103 browser = HelpBrowser(self) | |
2104 | |
2105 browser.sourceChanged.connect(self.__sourceChanged) | |
2106 browser.titleChanged.connect(self.__titleChanged) | |
2107 | |
2108 index = self.tabWidget.addTab(browser, self.trUtf8("...")) | |
2109 self.tabWidget.setCurrentIndex(index) | |
2110 | |
2111 if not link and Preferences.getHelp("StartupBehavior") == 0: | |
2112 link = Preferences.getHelp("HomePage") | |
2113 | |
2114 if link: | |
2115 browser.setSource(QUrl(link)) | |
2116 if not browser.documentTitle(): | |
2117 self.tabWidget.setTabText(index, self.__elide(link, Qt.ElideMiddle)) | |
2118 self.tabWidget.setTabToolTip(index, link) | |
2119 else: | |
2120 self.tabWidget.setTabText(index, | |
2121 self.__elide(browser.documentTitle().replace("&", "&&"))) | |
2122 self.tabWidget.setTabToolTip(index, browser.documentTitle()) | |
2123 | |
2124 browser.highlighted.connect(self.statusBar().showMessage) | |
2125 browser.backwardAvailable.connect(self.__setBackwardAvailable) | |
2126 browser.forwardAvailable.connect(self.__setForwardAvailable) | |
2127 browser.page().windowCloseRequested.connect(self.__windowCloseRequested) | |
2128 browser.page().printRequested.connect(self.__printRequested) | |
2129 browser.search.connect(self.newTab) | |
2130 | |
2131 self.closeAct.setEnabled(True) | |
2132 self.closeAllAct.setEnabled(True) | |
2133 self.closeButton and self.closeButton.setEnabled(True) | |
2134 self.navigationButton.setEnabled(True) | |
2135 | 1861 |
2136 def __currentChanged(self, index): | 1862 def __currentChanged(self, index): |
2137 """ | 1863 """ |
2138 Private slot to handle the currentChanged signal. | 1864 Private slot to handle the currentChanged signal. |
2139 | 1865 |
2140 @param index index of the current tab (integer) | 1866 @param index index of the current tab (integer) |
2141 """ | 1867 """ |
2142 if index > -1: | 1868 if index > -1: |
2143 cb = self.currentBrowser() | 1869 cb = self.currentBrowser() |
2144 if cb is not None: | 1870 if cb is not None: |
2145 self.__setForwardAvailable(cb.isForwardAvailable()) | 1871 self.setForwardAvailable(cb.isForwardAvailable()) |
2146 self.__setBackwardAvailable(cb.isBackwardAvailable()) | 1872 self.setBackwardAvailable(cb.isBackwardAvailable()) |
2147 self.__setLoadingActions(cb.isLoading()) | 1873 self.setLoadingActions(cb.isLoading()) |
2148 | 1874 |
2149 url = cb.source().toString() | 1875 url = cb.source().toString() |
2150 index2 = self.pathCombo.findText(url) | 1876 index2 = self.pathCombo.findText(url) |
2151 if index2 > -1: | 1877 if index2 > -1: |
2152 self.pathCombo.setCurrentIndex(index2) | 1878 self.pathCombo.setCurrentIndex(index2) |
2153 else: | 1879 else: |
2154 self.pathCombo.clearEditText() | 1880 self.pathCombo.clearEditText() |
2155 | 1881 |
2156 self.__setPathComboBackground() | 1882 self.__setPathComboBackground() |
2157 | 1883 |
2158 self.printAct.setEnabled(hasattr(cb, 'print_')) | |
2159 self.printPdfAct.setEnabled(hasattr(cb, 'print_')) | |
2160 if self.printPreviewAct: | |
2161 self.printPreviewAct.setEnabled(hasattr(cb, 'print_')) | |
2162 | |
2163 self.iconChanged(cb.icon()) | 1884 self.iconChanged(cb.icon()) |
2164 | |
2165 def __showContextMenu(self, coord, index): | |
2166 """ | |
2167 Private slot to show the tab context menu. | |
2168 | |
2169 @param coord the position of the mouse pointer (QPoint) | |
2170 @param index index of the tab the menu is requested for (integer) | |
2171 """ | |
2172 self.tabContextMenuIndex = index | |
2173 self.leftMenuAct.setEnabled(index > 0) | |
2174 self.rightMenuAct.setEnabled(index < self.tabWidget.count() - 1) | |
2175 | |
2176 self.tabContextCloseOthersAct.setEnabled(self.tabWidget.count() > 1) | |
2177 | |
2178 coord = self.tabWidget.mapToGlobal(coord) | |
2179 self.__tabContextMenu.popup(coord) | |
2180 | |
2181 def __tabContextMenuMoveLeft(self): | |
2182 """ | |
2183 Private method to move a tab one position to the left. | |
2184 """ | |
2185 self.tabWidget.moveTab(self.tabContextMenuIndex, self.tabContextMenuIndex - 1) | |
2186 | |
2187 def __tabContextMenuMoveRight(self): | |
2188 """ | |
2189 Private method to move a tab one position to the right. | |
2190 """ | |
2191 self.tabWidget.moveTab(self.tabContextMenuIndex, self.tabContextMenuIndex + 1) | |
2192 | |
2193 def __tabContextMenuClone(self): | |
2194 """ | |
2195 Private method to clone the selected tab. | |
2196 """ | |
2197 idx = self.tabContextMenuIndex | |
2198 if idx < 0: | |
2199 idx = self.tabWidget.currentIndex() | |
2200 if idx < 0 or idx > self.tabWidget.count(): | |
2201 return | |
2202 | |
2203 self.newTab(self.tabWidget.widget(idx).url()) | |
2204 | |
2205 def __tabContextMenuClose(self): | |
2206 """ | |
2207 Private method to close the selected tab. | |
2208 """ | |
2209 self.__closeAt(self.tabContextMenuIndex) | |
2210 | |
2211 def __tabContextMenuCloseOthers(self): | |
2212 """ | |
2213 Private slot to close all other tabs. | |
2214 """ | |
2215 index = self.tabContextMenuIndex | |
2216 for i in list(range(self.tabWidget.count() - 1, index, -1)) + \ | |
2217 list(range(index - 1, -1, -1)): | |
2218 self.__closeAt(i) | |
2219 | |
2220 def __tabContextMenuPrint(self): | |
2221 """ | |
2222 Private method to print the selected tab. | |
2223 """ | |
2224 browser = self.tabWidget.widget(self.tabContextMenuIndex) | |
2225 self.__printFile(browser) | |
2226 | |
2227 def __tabContextMenuPrintPdf(self): | |
2228 """ | |
2229 Private method to print the selected tab. | |
2230 """ | |
2231 browser = self.tabWidget.widget(self.tabContextMenuIndex) | |
2232 self.__printFilePdf(browser) | |
2233 | |
2234 def __tabContextMenuPrintPreview(self): | |
2235 """ | |
2236 Private method to show a print preview of the selected tab. | |
2237 """ | |
2238 browser = self.tabWidget.widget(self.tabContextMenuIndex) | |
2239 self.__printPreviewFile(browser) | |
2240 | 1885 |
2241 def __showPreferences(self): | 1886 def __showPreferences(self): |
2242 """ | 1887 """ |
2243 Private slot to set the preferences. | 1888 Private slot to set the preferences. |
2244 """ | 1889 """ |
2265 | 1910 |
2266 self.networkAccessManager().preferencesChanged() | 1911 self.networkAccessManager().preferencesChanged() |
2267 | 1912 |
2268 self.historyManager().preferencesChanged() | 1913 self.historyManager().preferencesChanged() |
2269 | 1914 |
2270 for index in range(self.tabWidget.count()): | 1915 self.tabWidget.preferencesChanged() |
2271 self.tabWidget.widget(index).preferencesChanged() | |
2272 | 1916 |
2273 self.searchEdit.preferencesChanged() | 1917 self.searchEdit.preferencesChanged() |
2274 | 1918 |
2275 def __showAcceptedLanguages(self): | 1919 def __showAcceptedLanguages(self): |
2276 """ | 1920 """ |
2293 """ | 1937 """ |
2294 dlg = OfflineStorageConfigDialog(self) | 1938 dlg = OfflineStorageConfigDialog(self) |
2295 if dlg.exec_() == QDialog.Accepted: | 1939 if dlg.exec_() == QDialog.Accepted: |
2296 dlg.storeData() | 1940 dlg.storeData() |
2297 self.__initWebSettings() | 1941 self.__initWebSettings() |
2298 | |
2299 def setLoading(self, widget): | |
2300 """ | |
2301 Public method to set the loading icon. | |
2302 | |
2303 @param widget reference to the widget to set the icon for (QWidget) | |
2304 """ | |
2305 index = self.tabWidget.indexOf(widget) | |
2306 anim = self.tabWidget.animationLabel( | |
2307 index, os.path.join(getConfig("ericPixDir"), "loading.gif")) | |
2308 if not anim: | |
2309 loading = QIcon(os.path.join(getConfig("ericPixDir"), "loading.gif")) | |
2310 self.tabWidget.setTabIcon(index, loading) | |
2311 self.statusBar().showMessage(self.trUtf8("Loading...")) | |
2312 | |
2313 self.__setLoadingActions(True) | |
2314 | |
2315 def resetLoading(self, widget, ok): | |
2316 """ | |
2317 Public method to reset the loading icon. | |
2318 | |
2319 @param widget reference to the widget to reset the icon for (QWidget) | |
2320 @param ok flag indicating the result (boolean) | |
2321 """ | |
2322 index = self.tabWidget.indexOf(widget) | |
2323 self.tabWidget.resetAnimation(index) | |
2324 self.tabWidget.setTabIcon(index, widget.icon()) | |
2325 if ok: | |
2326 self.statusBar().showMessage(self.trUtf8("Finished loading")) | |
2327 else: | |
2328 self.statusBar().showMessage(self.trUtf8("Failed to load")) | |
2329 | |
2330 self.__setLoadingActions(False) | |
2331 | 1942 |
2332 ############################################################################ | 1943 ############################################################################ |
2333 ## Methods to support Webkit based browser below. | 1944 ## Methods to support Webkit based browser below. |
2334 ############################################################################ | 1945 ############################################################################ |
2335 | 1946 |
2390 """ | 2001 """ |
2391 Public slot to change the icon shown to the left of the URL entry. | 2002 Public slot to change the icon shown to the left of the URL entry. |
2392 | 2003 |
2393 @param icon icon to be shown (QIcon) | 2004 @param icon icon to be shown (QIcon) |
2394 """ | 2005 """ |
2395 self.tabWidget.setTabIcon(self.tabWidget.currentIndex(), icon) | |
2396 self.iconLabel.setPixmap(icon.pixmap(16, 16)) | 2006 self.iconLabel.setPixmap(icon.pixmap(16, 16)) |
2397 | 2007 |
2398 def __clearIconsDatabase(self): | 2008 def __clearIconsDatabase(self): |
2399 """ | 2009 """ |
2400 Private slot to clear the icons databse. | 2010 Private slot to clear the icons databse. |
2514 """ | 2124 """ |
2515 dlg = QtHelpDocumentationDialog(self.__helpEngine, self) | 2125 dlg = QtHelpDocumentationDialog(self.__helpEngine, self) |
2516 dlg.exec_() | 2126 dlg.exec_() |
2517 if dlg.hasChanges(): | 2127 if dlg.hasChanges(): |
2518 for i in sorted(dlg.getTabsToClose(), reverse = True): | 2128 for i in sorted(dlg.getTabsToClose(), reverse = True): |
2519 self.__closeAt(i) | 2129 self.tabWidget.closeBrowserAt(i) |
2520 self.__helpEngine.setupData() | 2130 self.__helpEngine.setupData() |
2521 | 2131 |
2522 def getSourceFileList(self): | 2132 def getSourceFileList(self): |
2523 """ | 2133 """ |
2524 Public method to get a list of all opened source files. | 2134 Public method to get a list of all opened source files. |
2525 | 2135 |
2526 @return dictionary with tab id as key and host/namespace as value | 2136 @return dictionary with tab id as key and host/namespace as value |
2527 """ | 2137 """ |
2528 sourceList = {} | 2138 return self.tabWidget.getSourceFileList() |
2529 for i in range(self.tabWidget.count()): | |
2530 viewer = self.tabWidget.widget(i) | |
2531 if viewer is not None and \ | |
2532 viewer.source().isValid(): | |
2533 sourceList[i] = viewer.source().host() | |
2534 | |
2535 return sourceList | |
2536 | 2139 |
2537 def __manageQtHelpFilters(self): | 2140 def __manageQtHelpFilters(self): |
2538 """ | 2141 """ |
2539 Private slot to manage the QtHelp filters. | 2142 Private slot to manage the QtHelp filters. |
2540 """ | 2143 """ |
2653 | 2256 |
2654 @param msg message sent by the help engine (string) | 2257 @param msg message sent by the help engine (string) |
2655 """ | 2258 """ |
2656 E5MessageBox.warning(self, | 2259 E5MessageBox.warning(self, |
2657 self.trUtf8("Help Engine"), msg) | 2260 self.trUtf8("Help Engine"), msg) |
2658 | |
2659 def __showNavigationMenu(self): | |
2660 """ | |
2661 Private slot to show the navigation button menu. | |
2662 """ | |
2663 self.__navigationMenu.clear() | |
2664 for index in range(self.tabWidget.count()): | |
2665 act = self.__navigationMenu.addAction(self.tabWidget.tabIcon(index), | |
2666 self.tabWidget.tabText(index)) | |
2667 act.setData(index) | |
2668 | |
2669 def __navigationMenuTriggered(self, act): | |
2670 """ | |
2671 Private slot called to handle the navigation button menu selection. | |
2672 | |
2673 @param act reference to the selected action (QAction) | |
2674 """ | |
2675 index = act.data() | |
2676 if index is not None: | |
2677 self.tabWidget.setCurrentIndex(index) | |
2678 | 2261 |
2679 def __showBackMenu(self): | 2262 def __showBackMenu(self): |
2680 """ | 2263 """ |
2681 Private slot showing the backwards navigation menu. | 2264 Private slot showing the backwards navigation menu. |
2682 """ | 2265 """ |
2942 if defaultTextEncoding in codecs: | 2525 if defaultTextEncoding in codecs: |
2943 currentCodec = defaultTextEncoding | 2526 currentCodec = defaultTextEncoding |
2944 else: | 2527 else: |
2945 currentCodec = "" | 2528 currentCodec = "" |
2946 | 2529 |
2947 defaultEncodingAct = self.__textEncodingMenu.addAction(self.trUtf8("Default")) | 2530 isDefaultEncodingUsed = True |
2948 defaultEncodingAct.setData("") | 2531 isoMenu = QMenu(self.trUtf8("ISO"), self.__textEncodingMenu) |
2949 defaultEncodingAct.setCheckable(True) | 2532 winMenu = QMenu(self.trUtf8("Windows"), self.__textEncodingMenu) |
2950 if currentCodec == "": | 2533 isciiMenu = QMenu(self.trUtf8("ISCII"), self.__textEncodingMenu) |
2951 defaultEncodingAct.setChecked(True) | 2534 uniMenu = QMenu(self.trUtf8("Unicode"), self.__textEncodingMenu) |
2952 self.__textEncodingMenu.addSeparator() | 2535 otherMenu = QMenu(self.trUtf8("Other"), self.__textEncodingMenu) |
2536 ibmMenu = QMenu(self.trUtf8("IBM"), self.__textEncodingMenu) | |
2953 | 2537 |
2954 for codec in codecs: | 2538 for codec in codecs: |
2955 act = self.__textEncodingMenu.addAction(codec) | 2539 if codec.startswith(("iso", "latin", "csisolatin")): |
2540 act = isoMenu.addAction(codec) | |
2541 elif codec.startswith(("windows", "cp1")): | |
2542 act = winMenu.addAction(codec) | |
2543 elif codec.startswith("iscii"): | |
2544 act = isciiMenu.addAction(codec) | |
2545 elif codec.startswith("utf"): | |
2546 act = uniMenu.addAction(codec) | |
2547 elif codec.startswith(("ibm", "csibm", "cp")): | |
2548 act = ibmMenu.addAction(codec) | |
2549 else: | |
2550 act = otherMenu.addAction(codec) | |
2551 | |
2956 act.setData(codec) | 2552 act.setData(codec) |
2957 act.setCheckable(True) | 2553 act.setCheckable(True) |
2958 if currentCodec == codec: | 2554 if currentCodec == codec: |
2959 act.setChecked(True) | 2555 act.setChecked(True) |
2556 isDefaultEncodingUsed = False | |
2557 | |
2558 act = self.__textEncodingMenu.addAction(self.trUtf8("Default Encoding")) | |
2559 act.setData("") | |
2560 act.setCheckable(True) | |
2561 act.setChecked(isDefaultEncodingUsed) | |
2562 self.__textEncodingMenu.addMenu(uniMenu) | |
2563 self.__textEncodingMenu.addMenu(isoMenu) | |
2564 self.__textEncodingMenu.addMenu(winMenu) | |
2565 self.__textEncodingMenu.addMenu(ibmMenu) | |
2566 self.__textEncodingMenu.addMenu(isciiMenu) | |
2567 self.__textEncodingMenu.addMenu(otherMenu) | |
2960 | 2568 |
2961 def __setTextEncoding(self, act): | 2569 def __setTextEncoding(self, act): |
2962 """ | 2570 """ |
2963 Private slot to set the selected text encoding as the default for | 2571 Private slot to set the selected text encoding as the default for |
2964 this session. | 2572 this session. |