WebBrowserWindow: removed the 'initShortcutsOnly' functionality because it is not needed anymore.

Fri, 14 Dec 2018 19:49:55 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Fri, 14 Dec 2018 19:49:55 +0100
changeset 6627
acd62f281a99
parent 6626
9a9e485949a4
child 6628
c3f0f6bffd21

WebBrowserWindow: removed the 'initShortcutsOnly' functionality because it is not needed anymore.

WebBrowser/WebBrowserWindow.py file | annotate | diff | comparison | revisions
--- a/WebBrowser/WebBrowserWindow.py	Wed Dec 12 19:53:39 2018 +0100
+++ b/WebBrowser/WebBrowserWindow.py	Fri Dec 14 19:49:55 2018 +0100
@@ -18,7 +18,7 @@
 import sys
 
 from PyQt5.QtCore import pyqtSlot, pyqtSignal, Qt, QByteArray, QSize, QTimer, \
-    QUrl, QTextCodec, QProcess, QEvent
+    QUrl, QTextCodec, QProcess, QEvent, QFileInfo
 from PyQt5.QtGui import QDesktopServices, QKeySequence, QFont, QFontMetrics
 from PyQt5.QtWidgets import QWidget, QVBoxLayout, QSizePolicy, QDockWidget, \
     QComboBox, QLabel, QMenu, QLineEdit, QApplication, \
@@ -116,8 +116,7 @@
     _lastActiveWindow = None
     
     def __init__(self, home, path, parent, name,
-                 initShortcutsOnly=False, searchWord=None,
-                 private=False, qthelp=False, settingsDir="",
+                 searchWord=None, private=False, qthelp=False, settingsDir="",
                  restoreSession=False, single=False, saname=""):
         """
         Constructor
@@ -130,9 +129,6 @@
         @type QWidget
         @param name name of this window
         @type str
-        @keyparam initShortcutsOnly flag indicating to just initialize the
-            keyboard shortcuts
-        @type bool
         @keyparam searchWord word to search for
         @type str
         @keyparam private flag indicating a private browsing window
@@ -158,7 +154,6 @@
             self.setWindowTitle(self.tr("eric6 Web Browser"))
         
         self.__settingsDir = settingsDir
-        self.__initShortcutsOnly = initShortcutsOnly
         self.setWindowIcon(UI.PixmapCache.getIcon("ericWeb.png"))
 
         self.__mHistory = []
@@ -171,329 +166,325 @@
         self.__eventMouseButtons = Qt.NoButton
         self.__eventKeyboardModifiers = Qt.NoModifier
         
-        if self.__initShortcutsOnly:
-            WebBrowserWindow.setUseQtHelp(qthelp or bool(searchWord))
-            self.__initActions()
+        if qVersionTuple() < (5, 11, 0) and \
+           Preferences.getWebBrowser("WebInspectorEnabled"):
+            os.environ["QTWEBENGINE_REMOTE_DEBUGGING"] = \
+                str(Preferences.getWebBrowser("WebInspectorPort"))
+        
+        WebBrowserWindow.setUseQtHelp(qthelp or bool(searchWord))
+        
+        self.webProfile(private)
+        self.networkManager()
+        
+        self.__htmlFullScreen = False
+        self.__windowStates = Qt.WindowNoState
+        self.__isClosing = False
+        
+        from .SearchWidget import SearchWidget
+        from .QtHelp.HelpTocWidget import HelpTocWidget
+        from .QtHelp.HelpIndexWidget import HelpIndexWidget
+        from .QtHelp.HelpSearchWidget import HelpSearchWidget
+        from .WebBrowserView import WebBrowserView
+        from .WebBrowserTabWidget import WebBrowserTabWidget
+        from .AdBlock.AdBlockIcon import AdBlockIcon
+        from .StatusBar.JavaScriptIcon import JavaScriptIcon
+        from .StatusBar.ImagesIcon import ImagesIcon
+        from .VirusTotal.VirusTotalApi import VirusTotalAPI
+        from .Navigation.NavigationBar import NavigationBar
+        from .Navigation.NavigationContainer import NavigationContainer
+        from .Bookmarks.BookmarksToolBar import BookmarksToolBar
+        
+        self.setStyle(Preferences.getUI("Style"),
+                      Preferences.getUI("StyleSheet"))
+        
+        # initialize some SSL stuff
+        from E5Network.E5SslUtilities import initSSL
+        initSSL()
+        
+        if WebBrowserWindow._useQtHelp:
+            self.__helpEngine = QHelpEngine(
+                WebBrowserWindow.getQtHelpCollectionFileName(),
+                self)
+            self.__removeOldDocumentation()
+            self.__helpEngine.warning.connect(self.__warning)
         else:
-            if qVersionTuple() < (5, 11, 0) and \
-               Preferences.getWebBrowser("WebInspectorEnabled"):
-                os.environ["QTWEBENGINE_REMOTE_DEBUGGING"] = \
-                    str(Preferences.getWebBrowser("WebInspectorPort"))
-            
-            WebBrowserWindow.setUseQtHelp(qthelp or bool(searchWord))
-            
-            self.webProfile(private)
-            self.networkManager()
-            
-            self.__htmlFullScreen = False
-            self.__windowStates = Qt.WindowNoState
-            self.__isClosing = False
-            
-            from .SearchWidget import SearchWidget
-            from .QtHelp.HelpTocWidget import HelpTocWidget
-            from .QtHelp.HelpIndexWidget import HelpIndexWidget
-            from .QtHelp.HelpSearchWidget import HelpSearchWidget
-            from .WebBrowserView import WebBrowserView
-            from .WebBrowserTabWidget import WebBrowserTabWidget
-            from .AdBlock.AdBlockIcon import AdBlockIcon
-            from .StatusBar.JavaScriptIcon import JavaScriptIcon
-            from .StatusBar.ImagesIcon import ImagesIcon
-            from .VirusTotal.VirusTotalApi import VirusTotalAPI
-            from .Navigation.NavigationBar import NavigationBar
-            from .Navigation.NavigationContainer import NavigationContainer
-            from .Bookmarks.BookmarksToolBar import BookmarksToolBar
-            
-            self.setStyle(Preferences.getUI("Style"),
-                          Preferences.getUI("StyleSheet"))
-            
-            # initialize some SSL stuff
-            from E5Network.E5SslUtilities import initSSL
-            initSSL()
-            
-            if WebBrowserWindow._useQtHelp:
-                self.__helpEngine = QHelpEngine(
-                    WebBrowserWindow.getQtHelpCollectionFileName(),
-                    self)
-                self.__removeOldDocumentation()
-                self.__helpEngine.warning.connect(self.__warning)
-            else:
-                self.__helpEngine = None
-            self.__helpInstaller = None
-            
-            self.__zoomWidget = E5ZoomWidget(
-                UI.PixmapCache.getPixmap("zoomOut.png"),
-                UI.PixmapCache.getPixmap("zoomIn.png"),
-                UI.PixmapCache.getPixmap("zoomReset.png"), self)
-            self.statusBar().addPermanentWidget(self.__zoomWidget)
-            self.__zoomWidget.setMapping(
-                WebBrowserView.ZoomLevels, WebBrowserView.ZoomLevelDefault)
-            self.__zoomWidget.valueChanged.connect(self.__zoomValueChanged)
-            
-            self.__tabWidget = WebBrowserTabWidget(self)
-            self.__tabWidget.currentChanged[int].connect(self.__currentChanged)
-            self.__tabWidget.titleChanged.connect(self.__titleChanged)
-            self.__tabWidget.showMessage.connect(self.statusBar().showMessage)
-            self.__tabWidget.browserZoomValueChanged.connect(
-                self.__zoomWidget.setValue)
-            self.__tabWidget.browserClosed.connect(self.webBrowserClosed)
-            self.__tabWidget.browserOpened.connect(self.webBrowserOpened)
-            
-            self.__searchWidget = SearchWidget(self, self)
-            
-            self.__setIconDatabasePath()
-            
-            bookmarksModel = self.bookmarksManager().bookmarksModel()
-            self.__bookmarksToolBar = BookmarksToolBar(self, bookmarksModel,
-                                                       self)
-            self.__bookmarksToolBar.setIconSize(UI.Config.ToolBarIconSize)
-            self.__bookmarksToolBar.openUrl.connect(self.openUrl)
-            self.__bookmarksToolBar.newTab.connect(self.openUrlNewTab)
-            self.__bookmarksToolBar.newWindow.connect(self.openUrlNewWindow)
+            self.__helpEngine = None
+        self.__helpInstaller = None
+        
+        self.__zoomWidget = E5ZoomWidget(
+            UI.PixmapCache.getPixmap("zoomOut.png"),
+            UI.PixmapCache.getPixmap("zoomIn.png"),
+            UI.PixmapCache.getPixmap("zoomReset.png"), self)
+        self.statusBar().addPermanentWidget(self.__zoomWidget)
+        self.__zoomWidget.setMapping(
+            WebBrowserView.ZoomLevels, WebBrowserView.ZoomLevelDefault)
+        self.__zoomWidget.valueChanged.connect(self.__zoomValueChanged)
+        
+        self.__tabWidget = WebBrowserTabWidget(self)
+        self.__tabWidget.currentChanged[int].connect(self.__currentChanged)
+        self.__tabWidget.titleChanged.connect(self.__titleChanged)
+        self.__tabWidget.showMessage.connect(self.statusBar().showMessage)
+        self.__tabWidget.browserZoomValueChanged.connect(
+            self.__zoomWidget.setValue)
+        self.__tabWidget.browserClosed.connect(self.webBrowserClosed)
+        self.__tabWidget.browserOpened.connect(self.webBrowserOpened)
+        
+        self.__searchWidget = SearchWidget(self, self)
+        
+        self.__setIconDatabasePath()
+        
+        bookmarksModel = self.bookmarksManager().bookmarksModel()
+        self.__bookmarksToolBar = BookmarksToolBar(self, bookmarksModel,
+                                                   self)
+        self.__bookmarksToolBar.setIconSize(UI.Config.ToolBarIconSize)
+        self.__bookmarksToolBar.openUrl.connect(self.openUrl)
+        self.__bookmarksToolBar.newTab.connect(self.openUrlNewTab)
+        self.__bookmarksToolBar.newWindow.connect(self.openUrlNewWindow)
+        
+        self.__navigationBar = NavigationBar(self)
+        
+        self.__navigationContainer = NavigationContainer(self)
+        self.__navigationContainer.addWidget(self.__navigationBar)
+        self.__navigationContainer.addWidget(self.__bookmarksToolBar)
+        
+        centralWidget = QWidget()
+        layout = QVBoxLayout()
+        layout.setContentsMargins(1, 1, 1, 1)
+        layout.setSpacing(0)
+        layout.addWidget(self.__navigationContainer)
+        layout.addWidget(self.__tabWidget)
+        layout.addWidget(self.__searchWidget)
+        self.__tabWidget.setSizePolicy(
+            QSizePolicy.Preferred, QSizePolicy.Expanding)
+        centralWidget.setLayout(layout)
+        self.setCentralWidget(centralWidget)
+        self.__searchWidget.hide()
+        
+        if WebBrowserWindow._useQtHelp:
+            # setup the TOC widget
+            self.__tocWindow = HelpTocWidget(self.__helpEngine)
+            self.__tocDock = QDockWidget(self.tr("Contents"), self)
+            self.__tocDock.setObjectName("TocWindow")
+            self.__tocDock.setWidget(self.__tocWindow)
+            self.addDockWidget(Qt.LeftDockWidgetArea, self.__tocDock)
             
-            self.__navigationBar = NavigationBar(self)
-            
-            self.__navigationContainer = NavigationContainer(self)
-            self.__navigationContainer.addWidget(self.__navigationBar)
-            self.__navigationContainer.addWidget(self.__bookmarksToolBar)
-            
-            centralWidget = QWidget()
-            layout = QVBoxLayout()
-            layout.setContentsMargins(1, 1, 1, 1)
-            layout.setSpacing(0)
-            layout.addWidget(self.__navigationContainer)
-            layout.addWidget(self.__tabWidget)
-            layout.addWidget(self.__searchWidget)
-            self.__tabWidget.setSizePolicy(
-                QSizePolicy.Preferred, QSizePolicy.Expanding)
-            centralWidget.setLayout(layout)
-            self.setCentralWidget(centralWidget)
-            self.__searchWidget.hide()
-            
-            if WebBrowserWindow._useQtHelp:
-                # setup the TOC widget
-                self.__tocWindow = HelpTocWidget(self.__helpEngine)
-                self.__tocDock = QDockWidget(self.tr("Contents"), self)
-                self.__tocDock.setObjectName("TocWindow")
-                self.__tocDock.setWidget(self.__tocWindow)
-                self.addDockWidget(Qt.LeftDockWidgetArea, self.__tocDock)
-                
-                # setup the index widget
-                self.__indexWindow = HelpIndexWidget(self.__helpEngine)
-                self.__indexDock = QDockWidget(self.tr("Index"), self)
-                self.__indexDock.setObjectName("IndexWindow")
-                self.__indexDock.setWidget(self.__indexWindow)
-                self.addDockWidget(Qt.LeftDockWidgetArea, self.__indexDock)
-                
-                # setup the search widget
-                self.__searchWord = searchWord
-                self.__indexing = False
-                self.__indexingProgress = None
-                self.__searchEngine = self.__helpEngine.searchEngine()
-                self.__searchEngine.indexingStarted.connect(
-                    self.__indexingStarted)
-                self.__searchEngine.indexingFinished.connect(
-                    self.__indexingFinished)
-                self.__searchWindow = HelpSearchWidget(self.__searchEngine)
-                self.__searchDock = QDockWidget(self.tr("Search"), self)
-                self.__searchDock.setObjectName("SearchWindow")
-                self.__searchDock.setWidget(self.__searchWindow)
-                self.addDockWidget(Qt.LeftDockWidgetArea, self.__searchDock)
-            
-            # JavaScript Console window
-            from .WebBrowserJavaScriptConsole import \
-                WebBrowserJavaScriptConsole
-            self.__javascriptConsole = WebBrowserJavaScriptConsole(self)
-            self.__javascriptConsoleDock = QDockWidget(
-                self.tr("JavaScript Console"))
-            self.__javascriptConsoleDock.setObjectName("JavascriptConsole")
-            self.__javascriptConsoleDock.setAllowedAreas(
-                Qt.BottomDockWidgetArea | Qt.TopDockWidgetArea)
-            self.__javascriptConsoleDock.setWidget(self.__javascriptConsole)
-            self.addDockWidget(Qt.BottomDockWidgetArea,
-                               self.__javascriptConsoleDock)
-            
-            if Preferences.getWebBrowser("SaveGeometry"):
-                g = Preferences.getGeometry("WebBrowserGeometry")
-            else:
-                g = QByteArray()
-            if g.isEmpty():
-                s = QSize(800, 800)
-                self.resize(s)
-            else:
-                self.restoreGeometry(g)
-            
-            WebBrowserWindow.BrowserWindows.append(self)
-            
-            self.__initWebEngineSettings()
-            
-            # initialize some of our class objects
-            self.passwordManager()
-            self.historyManager()
-            self.greaseMonkeyManager()
+            # setup the index widget
+            self.__indexWindow = HelpIndexWidget(self.__helpEngine)
+            self.__indexDock = QDockWidget(self.tr("Index"), self)
+            self.__indexDock.setObjectName("IndexWindow")
+            self.__indexDock.setWidget(self.__indexWindow)
+            self.addDockWidget(Qt.LeftDockWidgetArea, self.__indexDock)
             
-            # initialize the actions
-            self.__initActions()
-            
-            # initialize the menus
-            self.__initMenus()
-            self.__initSuperMenu()
-            if Preferences.getWebBrowser("MenuBarVisible"):
-                self.__navigationBar.superMenuButton().hide()
+            # setup the search widget
+            self.__searchWord = searchWord
+            self.__indexing = False
+            self.__indexingProgress = None
+            self.__searchEngine = self.__helpEngine.searchEngine()
+            self.__searchEngine.indexingStarted.connect(
+                self.__indexingStarted)
+            self.__searchEngine.indexingFinished.connect(
+                self.__indexingFinished)
+            self.__searchWindow = HelpSearchWidget(self.__searchEngine)
+            self.__searchDock = QDockWidget(self.tr("Search"), self)
+            self.__searchDock.setObjectName("SearchWindow")
+            self.__searchDock.setWidget(self.__searchWindow)
+            self.addDockWidget(Qt.LeftDockWidgetArea, self.__searchDock)
+        
+        # JavaScript Console window
+        from .WebBrowserJavaScriptConsole import \
+            WebBrowserJavaScriptConsole
+        self.__javascriptConsole = WebBrowserJavaScriptConsole(self)
+        self.__javascriptConsoleDock = QDockWidget(
+            self.tr("JavaScript Console"))
+        self.__javascriptConsoleDock.setObjectName("JavascriptConsole")
+        self.__javascriptConsoleDock.setAllowedAreas(
+            Qt.BottomDockWidgetArea | Qt.TopDockWidgetArea)
+        self.__javascriptConsoleDock.setWidget(self.__javascriptConsole)
+        self.addDockWidget(Qt.BottomDockWidgetArea,
+                           self.__javascriptConsoleDock)
+        
+        if Preferences.getWebBrowser("SaveGeometry"):
+            g = Preferences.getGeometry("WebBrowserGeometry")
+        else:
+            g = QByteArray()
+        if g.isEmpty():
+            s = QSize(800, 800)
+            self.resize(s)
+        else:
+            self.restoreGeometry(g)
+        
+        WebBrowserWindow.BrowserWindows.append(self)
+        
+        self.__initWebEngineSettings()
+        
+        # initialize some of our class objects
+        self.passwordManager()
+        self.historyManager()
+        self.greaseMonkeyManager()
+        
+        # initialize the actions
+        self.__initActions()
+        
+        # initialize the menus
+        self.__initMenus()
+        self.__initSuperMenu()
+        if Preferences.getWebBrowser("MenuBarVisible"):
+            self.__navigationBar.superMenuButton().hide()
+        else:
+            self.menuBar().hide()
+        
+        # save references to toolbars in order to hide them
+        # when going full screen
+        self.__toolbars = {}
+        # initialize toolbars
+        if Preferences.getWebBrowser("ShowToolbars"):
+            self.__initToolbars()
+        self.__bookmarksToolBar.setVisible(
+            Preferences.getWebBrowser("BookmarksToolBarVisible"))
+        
+        syncMgr = self.syncManager()
+        syncMgr.syncMessage.connect(self.statusBar().showMessage)
+        syncMgr.syncError.connect(self.statusBar().showMessage)
+        
+        restoreSessionData = {}
+        if WebBrowserWindow._performingStartup and not home and \
+                not WebBrowserWindow.isPrivate():
+            startupBehavior = Preferences.getWebBrowser("StartupBehavior")
+            if not private and startupBehavior in [3, 4]:
+                if startupBehavior == 3:
+                    # restore last session
+                    restoreSessionFile = \
+                        self.sessionManager().lastActiveSessionFile()
+                elif startupBehavior == 4:
+                    # select session
+                    restoreSessionFile = \
+                        self.sessionManager().selectSession()
+                sessionData = \
+                    self.sessionManager().readSessionFromFile(
+                        restoreSessionFile)
+                if self.sessionManager().isValidSession(sessionData):
+                    restoreSessionData = sessionData
+                    restoreSession = True
             else:
-                self.menuBar().hide()
-            
-            # save references to toolbars in order to hide them
-            # when going full screen
-            self.__toolbars = {}
-            # initialize toolbars
-            if Preferences.getWebBrowser("ShowToolbars"):
-                self.__initToolbars()
-            self.__bookmarksToolBar.setVisible(
-                Preferences.getWebBrowser("BookmarksToolBarVisible"))
-            
-            syncMgr = self.syncManager()
-            syncMgr.syncMessage.connect(self.statusBar().showMessage)
-            syncMgr.syncError.connect(self.statusBar().showMessage)
-            
-            restoreSessionData = {}
-            if WebBrowserWindow._performingStartup and not home and \
-                    not WebBrowserWindow.isPrivate():
-                startupBehavior = Preferences.getWebBrowser("StartupBehavior")
-                if not private and startupBehavior in [3, 4]:
-                    if startupBehavior == 3:
-                        # restore last session
-                        restoreSessionFile = \
-                            self.sessionManager().lastActiveSessionFile()
-                    elif startupBehavior == 4:
-                        # select session
-                        restoreSessionFile = \
-                            self.sessionManager().selectSession()
-                    sessionData = \
-                        self.sessionManager().readSessionFromFile(
-                            restoreSessionFile)
-                    if self.sessionManager().isValidSession(sessionData):
-                        restoreSessionData = sessionData
-                        restoreSession = True
-                else:
-                    if Preferences.getWebBrowser("StartupBehavior") == 0:
-                        home = "about:blank"
-                    elif Preferences.getWebBrowser("StartupBehavior") == 1:
-                        home = Preferences.getWebBrowser("HomePage")
-                    elif Preferences.getWebBrowser("StartupBehavior") == 2:
-                        home = "eric:speeddial"
-            
-            if not restoreSession:
-                self.__tabWidget.newBrowser(QUrl.fromUserInput(home))
-                self.__tabWidget.currentBrowser().setFocus()
-            WebBrowserWindow._performingStartup = False
-            
-            self.__imagesIcon = ImagesIcon(self)
-            self.statusBar().addPermanentWidget(self.__imagesIcon)
-            self.__javaScriptIcon = JavaScriptIcon(self)
-            self.statusBar().addPermanentWidget(self.__javaScriptIcon)
-            
-            self.__adBlockIcon = AdBlockIcon(self)
-            self.statusBar().addPermanentWidget(self.__adBlockIcon)
-            self.__adBlockIcon.setEnabled(
-                Preferences.getWebBrowser("AdBlockEnabled"))
-            self.__tabWidget.currentChanged[int].connect(
-                self.__adBlockIcon.currentChanged)
-            self.__tabWidget.sourceChanged.connect(
-                self.__adBlockIcon.sourceChanged)
-            
-            self.__tabManagerIcon = self.tabManager().createStatusBarIcon()
-            self.statusBar().addPermanentWidget(self.__tabManagerIcon)
-            
-            self.networkIcon = E5NetworkIcon(self)
-            self.statusBar().addPermanentWidget(self.networkIcon)
-            
-            if not Preferences.getWebBrowser("StatusBarVisible"):
-                self.statusBar().hide()
+                if Preferences.getWebBrowser("StartupBehavior") == 0:
+                    home = "about:blank"
+                elif Preferences.getWebBrowser("StartupBehavior") == 1:
+                    home = Preferences.getWebBrowser("HomePage")
+                elif Preferences.getWebBrowser("StartupBehavior") == 2:
+                    home = "eric:speeddial"
+        
+        if not restoreSession:
+            self.__tabWidget.newBrowser(QUrl.fromUserInput(home))
+            self.__tabWidget.currentBrowser().setFocus()
+        WebBrowserWindow._performingStartup = False
+        
+        self.__imagesIcon = ImagesIcon(self)
+        self.statusBar().addPermanentWidget(self.__imagesIcon)
+        self.__javaScriptIcon = JavaScriptIcon(self)
+        self.statusBar().addPermanentWidget(self.__javaScriptIcon)
+        
+        self.__adBlockIcon = AdBlockIcon(self)
+        self.statusBar().addPermanentWidget(self.__adBlockIcon)
+        self.__adBlockIcon.setEnabled(
+            Preferences.getWebBrowser("AdBlockEnabled"))
+        self.__tabWidget.currentChanged[int].connect(
+            self.__adBlockIcon.currentChanged)
+        self.__tabWidget.sourceChanged.connect(
+            self.__adBlockIcon.sourceChanged)
+        
+        self.__tabManagerIcon = self.tabManager().createStatusBarIcon()
+        self.statusBar().addPermanentWidget(self.__tabManagerIcon)
+        
+        self.networkIcon = E5NetworkIcon(self)
+        self.statusBar().addPermanentWidget(self.networkIcon)
+        
+        if not Preferences.getWebBrowser("StatusBarVisible"):
+            self.statusBar().hide()
+        
+        if len(WebBrowserWindow.BrowserWindows):
+            QDesktopServices.setUrlHandler(
+                "http", WebBrowserWindow.BrowserWindows[0].urlHandler)
+            QDesktopServices.setUrlHandler(
+                "https", WebBrowserWindow.BrowserWindows[0].urlHandler)
+        
+        # setup connections
+        self.__activating = False
+        if WebBrowserWindow._useQtHelp:
+            # TOC window
+            self.__tocWindow.escapePressed.connect(
+                self.__activateCurrentBrowser)
+            self.__tocWindow.openUrl.connect(self.openUrl)
+            self.__tocWindow.newTab.connect(self.openUrlNewTab)
+            self.__tocWindow.newBackgroundTab.connect(
+                self.openUrlNewBackgroundTab)
+            self.__tocWindow.newWindow.connect(self.openUrlNewWindow)
             
-            if len(WebBrowserWindow.BrowserWindows):
-                QDesktopServices.setUrlHandler(
-                    "http", WebBrowserWindow.BrowserWindows[0].urlHandler)
-                QDesktopServices.setUrlHandler(
-                    "https", WebBrowserWindow.BrowserWindows[0].urlHandler)
-            
-            # setup connections
-            self.__activating = False
-            if WebBrowserWindow._useQtHelp:
-                # TOC window
-                self.__tocWindow.escapePressed.connect(
-                    self.__activateCurrentBrowser)
-                self.__tocWindow.openUrl.connect(self.openUrl)
-                self.__tocWindow.newTab.connect(self.openUrlNewTab)
-                self.__tocWindow.newBackgroundTab.connect(
-                    self.openUrlNewBackgroundTab)
-                self.__tocWindow.newWindow.connect(self.openUrlNewWindow)
-                
-                # index window
-                self.__indexWindow.escapePressed.connect(
-                    self.__activateCurrentBrowser)
-                self.__indexWindow.openUrl.connect(self.openUrl)
-                self.__indexWindow.newTab.connect(self.openUrlNewTab)
-                self.__indexWindow.newBackgroundTab.connect(
-                    self.openUrlNewBackgroundTab)
-                self.__indexWindow.newWindow.connect(self.openUrlNewWindow)
-                
-                # search window
-                self.__searchWindow.escapePressed.connect(
-                    self.__activateCurrentBrowser)
-                self.__searchWindow.openUrl.connect(self.openUrl)
-                self.__searchWindow.newTab.connect(self.openUrlNewTab)
-                self.__searchWindow.newBackgroundTab.connect(
-                    self.openUrlNewBackgroundTab)
-                self.__searchWindow.newWindow.connect(self.openUrlNewWindow)
-            
-            state = Preferences.getWebBrowser("WebBrowserState")
-            self.restoreState(state)
-            
-            self.__initHelpDb()
+            # index window
+            self.__indexWindow.escapePressed.connect(
+                self.__activateCurrentBrowser)
+            self.__indexWindow.openUrl.connect(self.openUrl)
+            self.__indexWindow.newTab.connect(self.openUrlNewTab)
+            self.__indexWindow.newBackgroundTab.connect(
+                self.openUrlNewBackgroundTab)
+            self.__indexWindow.newWindow.connect(self.openUrlNewWindow)
             
-            self.__virusTotal = VirusTotalAPI(self)
-            self.__virusTotal.submitUrlError.connect(
-                self.__virusTotalSubmitUrlError)
-            self.__virusTotal.urlScanReport.connect(
-                self.__virusTotalUrlScanReport)
-            self.__virusTotal.fileScanReport.connect(
-                self.__virusTotalFileScanReport)
-            
-            self.flashCookieManager()
-            
-            e5App().focusChanged.connect(self.__appFocusChanged)
-            
-            self.__toolbarStates = self.saveState()
-            
-            if single:
-                self.SAServer = WebBrowserSingleApplicationServer(saname)
-                self.SAServer.loadUrl.connect(self.__saLoadUrl)
-                self.SAServer.newTab.connect(self.__saNewTab)
-                self.SAServer.search.connect(self.__saSearchWord)
-                self.SAServer.shutdown.connect(self.shutdown)
-            else:
-                self.SAServer = None
-            
-            self.__hideNavigationTimer = QTimer(self)
-            self.__hideNavigationTimer.setInterval(1000)
-            self.__hideNavigationTimer.setSingleShot(True)
-            self.__hideNavigationTimer.timeout.connect(self.__hideNavigation)
-            
-            self.__forcedClose = False
-            
-            if restoreSessionData and not WebBrowserWindow.isPrivate():
-                self.sessionManager().restoreSessionFromData(
-                    self, restoreSessionData)
-            
-            if not WebBrowserWindow.isPrivate():
-                self.sessionManager().activateTimer()
-            
-            QTimer.singleShot(0, syncMgr.loadSettings)
-            
-            if WebBrowserWindow._useQtHelp:
-                QTimer.singleShot(50, self.__lookForNewDocumentation)
-                if self.__searchWord is not None:
-                    QTimer.singleShot(0, self.__searchForWord)
+            # search window
+            self.__searchWindow.escapePressed.connect(
+                self.__activateCurrentBrowser)
+            self.__searchWindow.openUrl.connect(self.openUrl)
+            self.__searchWindow.newTab.connect(self.openUrlNewTab)
+            self.__searchWindow.newBackgroundTab.connect(
+                self.openUrlNewBackgroundTab)
+            self.__searchWindow.newWindow.connect(self.openUrlNewWindow)
+        
+        state = Preferences.getWebBrowser("WebBrowserState")
+        self.restoreState(state)
+        
+        self.__initHelpDb()
+        
+        self.__virusTotal = VirusTotalAPI(self)
+        self.__virusTotal.submitUrlError.connect(
+            self.__virusTotalSubmitUrlError)
+        self.__virusTotal.urlScanReport.connect(
+            self.__virusTotalUrlScanReport)
+        self.__virusTotal.fileScanReport.connect(
+            self.__virusTotalFileScanReport)
+        
+        self.flashCookieManager()
+        
+        e5App().focusChanged.connect(self.__appFocusChanged)
+        
+        self.__toolbarStates = self.saveState()
+        
+        if single:
+            self.SAServer = WebBrowserSingleApplicationServer(saname)
+            self.SAServer.loadUrl.connect(self.__saLoadUrl)
+            self.SAServer.newTab.connect(self.__saNewTab)
+            self.SAServer.search.connect(self.__saSearchWord)
+            self.SAServer.shutdown.connect(self.shutdown)
+        else:
+            self.SAServer = None
+        
+        self.__hideNavigationTimer = QTimer(self)
+        self.__hideNavigationTimer.setInterval(1000)
+        self.__hideNavigationTimer.setSingleShot(True)
+        self.__hideNavigationTimer.timeout.connect(self.__hideNavigation)
+        
+        self.__forcedClose = False
+        
+        if restoreSessionData and not WebBrowserWindow.isPrivate():
+            self.sessionManager().restoreSessionFromData(
+                self, restoreSessionData)
+        
+        if not WebBrowserWindow.isPrivate():
+            self.sessionManager().activateTimer()
+        
+        QTimer.singleShot(0, syncMgr.loadSettings)
+        
+        if WebBrowserWindow._useQtHelp:
+            QTimer.singleShot(50, self.__lookForNewDocumentation)
+            if self.__searchWord is not None:
+                QTimer.singleShot(0, self.__searchForWord)
     
     def __del__(self):
         """
@@ -703,8 +694,7 @@
             """<b>New Tab</b>"""
             """<p>This opens a new web browser tab.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.newTabAct.triggered.connect(self.newTab)
+        self.newTabAct.triggered.connect(self.newTab)
         self.__actions.append(self.newTabAct)
         
         self.newAct = E5Action(
@@ -719,8 +709,7 @@
             """<p>This opens a new web browser window in the current"""
             """ privacy mode.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.newAct.triggered.connect(self.newWindow)
+        self.newAct.triggered.connect(self.newWindow)
         self.__actions.append(self.newAct)
         
         self.newPrivateAct = E5Action(
@@ -736,8 +725,7 @@
             """<p>This opens a new private web browser window by starting"""
             """ a new web browser instance in private mode.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.newPrivateAct.triggered.connect(self.newPrivateWindow)
+        self.newPrivateAct.triggered.connect(self.newPrivateWindow)
         self.__actions.append(self.newPrivateAct)
         
         self.openAct = E5Action(
@@ -752,8 +740,7 @@
             """<p>This opens a new file for display."""
             """ It pops up a file selection dialog.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.openAct.triggered.connect(self.__openFile)
+        self.openAct.triggered.connect(self.__openFile)
         self.__actions.append(self.openAct)
         
         self.openTabAct = E5Action(
@@ -769,8 +756,7 @@
             """<p>This opens a new file for display in a new tab."""
             """ It pops up a file selection dialog.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.openTabAct.triggered.connect(self.__openFileNewTab)
+        self.openTabAct.triggered.connect(self.__openFileNewTab)
         self.__actions.append(self.openTabAct)
         
         if hasattr(QWebEnginePage, "SavePage"):
@@ -786,8 +772,7 @@
                 """<b>Save As...</b>"""
                 """<p>Saves the current page to disk.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.saveAsAct.triggered.connect(self.__savePageAs)
+            self.saveAsAct.triggered.connect(self.__savePageAs)
             self.__actions.append(self.saveAsAct)
         else:
             self.saveAsAct = None
@@ -805,9 +790,8 @@
             """<p>Saves the visible part of the current page as a"""
             """ screen shot.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.saveVisiblePageScreenAct.triggered.connect(
-                self.__saveVisiblePageScreen)
+        self.saveVisiblePageScreenAct.triggered.connect(
+            self.__saveVisiblePageScreen)
         self.__actions.append(self.saveVisiblePageScreenAct)
         
         bookmarksManager = self.bookmarksManager()
@@ -821,9 +805,8 @@
             """<b>Import Bookmarks</b>"""
             """<p>Import bookmarks from other browsers.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.importBookmarksAct.triggered.connect(
-                bookmarksManager.importBookmarks)
+        self.importBookmarksAct.triggered.connect(
+            bookmarksManager.importBookmarks)
         self.__actions.append(self.importBookmarksAct)
         
         self.exportBookmarksAct = E5Action(
@@ -836,9 +819,8 @@
             """<b>Export Bookmarks</b>"""
             """<p>Export the bookmarks into a file.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.exportBookmarksAct.triggered.connect(
-                bookmarksManager.exportBookmarks)
+        self.exportBookmarksAct.triggered.connect(
+            bookmarksManager.exportBookmarks)
         self.__actions.append(self.exportBookmarksAct)
         
         if qVersionTuple() >= (5, 8, 0) or (
@@ -854,8 +836,7 @@
                 """<b>Print</b>"""
                 """<p>Print the displayed help text.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.printAct.triggered.connect(self.__tabWidget.printBrowser)
+            self.printAct.triggered.connect(self.__tabWidget.printBrowser)
             self.__actions.append(self.printAct)
         else:
             self.printAct = None
@@ -872,9 +853,8 @@
                 """<b>Print as PDF</b>"""
                 """<p>Print the displayed help text as a PDF file.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.printPdfAct.triggered.connect(
-                    self.__tabWidget.printBrowserPdf)
+            self.printPdfAct.triggered.connect(
+                self.__tabWidget.printBrowserPdf)
             self.__actions.append(self.printPdfAct)
         else:
             self.printPdfAct = None
@@ -892,9 +872,8 @@
                 """<b>Print Preview</b>"""
                 """<p>Print preview of the displayed help text.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.printPreviewAct.triggered.connect(
-                    self.__tabWidget.printPreviewBrowser)
+            self.printPreviewAct.triggered.connect(
+                self.__tabWidget.printPreviewBrowser)
             self.__actions.append(self.printPreviewAct)
         else:
             self.printPreviewAct = None
@@ -910,8 +889,7 @@
             """<b>Send Page Link</b>"""
             """<p>Send the link of the current page via email.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.sendPageLinkAct.triggered.connect(self.__sendPageLink)
+        self.sendPageLinkAct.triggered.connect(self.__sendPageLink)
         self.__actions.append(self.sendPageLinkAct)
         
         self.closeAct = E5Action(
@@ -926,8 +904,7 @@
             """<b>Close</b>"""
             """<p>Closes the current web browser window.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.closeAct.triggered.connect(self.__tabWidget.closeBrowser)
+        self.closeAct.triggered.connect(self.__tabWidget.closeBrowser)
         self.__actions.append(self.closeAct)
         
         self.closeAllAct = E5Action(
@@ -939,9 +916,8 @@
             """<b>Close All</b>"""
             """<p>Closes all web browser windows except the first one.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.closeAllAct.triggered.connect(
-                self.__tabWidget.closeAllBrowsers)
+        self.closeAllAct.triggered.connect(
+            self.__tabWidget.closeAllBrowsers)
         self.__actions.append(self.closeAllAct)
         
         self.exitAct = E5Action(
@@ -955,8 +931,7 @@
             """<b>Quit</b>"""
             """<p>Quit the eric6 Web Browser.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.exitAct.triggered.connect(self.shutdown)
+        self.exitAct.triggered.connect(self.shutdown)
         self.__actions.append(self.exitAct)
         
         self.backAct = E5Action(
@@ -971,8 +946,7 @@
             """<p>Moves one screen backward. If none is"""
             """ available, this action is disabled.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.backAct.triggered.connect(self.__backward)
+        self.backAct.triggered.connect(self.__backward)
         self.__actions.append(self.backAct)
         
         self.forwardAct = E5Action(
@@ -988,8 +962,7 @@
             """<p>Moves one screen forward. If none is"""
             """ available, this action is disabled.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.forwardAct.triggered.connect(self.__forward)
+        self.forwardAct.triggered.connect(self.__forward)
         self.__actions.append(self.forwardAct)
         
         self.homeAct = E5Action(
@@ -1004,8 +977,7 @@
             """<b>Home</b>"""
             """<p>Moves to the initial screen.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.homeAct.triggered.connect(self.__home)
+        self.homeAct.triggered.connect(self.__home)
         self.__actions.append(self.homeAct)
         
         self.reloadAct = E5Action(
@@ -1021,8 +993,7 @@
             """<b>Reload</b>"""
             """<p>Reloads the current screen.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.reloadAct.triggered.connect(self.__reload)
+        self.reloadAct.triggered.connect(self.__reload)
         self.__actions.append(self.reloadAct)
         
         self.stopAct = E5Action(
@@ -1037,8 +1008,7 @@
             """<b>Stop</b>"""
             """<p>Stops loading of the current tab.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.stopAct.triggered.connect(self.__stopLoading)
+        self.stopAct.triggered.connect(self.__stopLoading)
         self.__actions.append(self.stopAct)
         
         self.copyAct = E5Action(
@@ -1052,8 +1022,7 @@
             """<b>Copy</b>"""
             """<p>Copy the selected text to the clipboard.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.copyAct.triggered.connect(self.__copy)
+        self.copyAct.triggered.connect(self.__copy)
         self.__actions.append(self.copyAct)
         
         self.cutAct = E5Action(
@@ -1067,8 +1036,7 @@
             """<b>Cut</b>"""
             """<p>Cut the selected text to the clipboard.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.cutAct.triggered.connect(self.__cut)
+        self.cutAct.triggered.connect(self.__cut)
         self.__actions.append(self.cutAct)
         
         self.pasteAct = E5Action(
@@ -1082,8 +1050,7 @@
             """<b>Paste</b>"""
             """<p>Paste some text from the clipboard.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.pasteAct.triggered.connect(self.__paste)
+        self.pasteAct.triggered.connect(self.__paste)
         self.__actions.append(self.pasteAct)
         
         self.undoAct = E5Action(
@@ -1097,8 +1064,7 @@
             """<b>Undo</b>"""
             """<p>Undo the last edit action.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.undoAct.triggered.connect(self.__undo)
+        self.undoAct.triggered.connect(self.__undo)
         self.__actions.append(self.undoAct)
         
         self.redoAct = E5Action(
@@ -1112,8 +1078,7 @@
             """<b>Redo</b>"""
             """<p>Redo the last edit action.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.redoAct.triggered.connect(self.__redo)
+        self.redoAct.triggered.connect(self.__redo)
         self.__actions.append(self.redoAct)
         
         self.selectAllAct = E5Action(
@@ -1127,8 +1092,7 @@
             """<b>Select All</b>"""
             """<p>Select all text of the current browser.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.selectAllAct.triggered.connect(self.__selectAll)
+        self.selectAllAct.triggered.connect(self.__selectAll)
         self.__actions.append(self.selectAllAct)
         
         self.unselectAct = E5Action(
@@ -1141,8 +1105,7 @@
             """<b>Unselect</b>"""
             """<p>Clear the selection of the current browser.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.unselectAct.triggered.connect(self.__unselect)
+        self.unselectAct.triggered.connect(self.__unselect)
         self.__actions.append(self.unselectAct)
         
         self.findAct = E5Action(
@@ -1156,8 +1119,7 @@
             """<b>Find</b>"""
             """<p>Find text in the current page.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.findAct.triggered.connect(self.__find)
+        self.findAct.triggered.connect(self.__find)
         self.__actions.append(self.findAct)
         
         self.findNextAct = E5Action(
@@ -1172,8 +1134,7 @@
             """<b>Find next</b>"""
             """<p>Find the next occurrence of text in the current page.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.findNextAct.triggered.connect(self.__searchWidget.findNext)
+        self.findNextAct.triggered.connect(self.__searchWidget.findNext)
         self.__actions.append(self.findNextAct)
         
         self.findPrevAct = E5Action(
@@ -1189,9 +1150,8 @@
             """<p>Find the previous occurrence of text in the current"""
             """ page.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.findPrevAct.triggered.connect(
-                self.__searchWidget.findPrevious)
+        self.findPrevAct.triggered.connect(
+            self.__searchWidget.findPrevious)
         self.__actions.append(self.findPrevAct)
         
         self.bookmarksManageAct = E5Action(
@@ -1205,9 +1165,8 @@
             """<b>Manage Bookmarks...</b>"""
             """<p>Open a dialog to manage the bookmarks.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.bookmarksManageAct.triggered.connect(
-                self.__showBookmarksDialog)
+        self.bookmarksManageAct.triggered.connect(
+            self.__showBookmarksDialog)
         self.__actions.append(self.bookmarksManageAct)
         
         self.bookmarksAddAct = E5Action(
@@ -1223,8 +1182,7 @@
             """<b>Add Bookmark</b>"""
             """<p>Open a dialog to add the current URL as a bookmark.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.bookmarksAddAct.triggered.connect(self.__addBookmark)
+        self.bookmarksAddAct.triggered.connect(self.__addBookmark)
         self.__actions.append(self.bookmarksAddAct)
         
         self.bookmarksAddFolderAct = E5Action(
@@ -1237,9 +1195,8 @@
             """<b>Add Folder...</b>"""
             """<p>Open a dialog to add a new bookmarks folder.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.bookmarksAddFolderAct.triggered.connect(
-                self.__addBookmarkFolder)
+        self.bookmarksAddFolderAct.triggered.connect(
+            self.__addBookmarkFolder)
         self.__actions.append(self.bookmarksAddFolderAct)
         
         self.bookmarksAllTabsAct = E5Action(
@@ -1253,8 +1210,7 @@
             """<p>Open a dialog to add a new bookmarks folder for"""
             """ all open tabs.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.bookmarksAllTabsAct.triggered.connect(self.bookmarkAll)
+        self.bookmarksAllTabsAct.triggered.connect(self.bookmarkAll)
         self.__actions.append(self.bookmarksAllTabsAct)
         
         self.whatsThisAct = E5Action(
@@ -1272,8 +1228,7 @@
             """ to use them. In dialogs, this feature can be accessed using"""
             """ the context help button in the titlebar.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.whatsThisAct.triggered.connect(self.__whatsThis)
+        self.whatsThisAct.triggered.connect(self.__whatsThis)
         self.__actions.append(self.whatsThisAct)
         
         self.aboutAct = E5Action(
@@ -1286,8 +1241,7 @@
             """<b>About</b>"""
             """<p>Display some information about this software.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.aboutAct.triggered.connect(self.__about)
+        self.aboutAct.triggered.connect(self.__about)
         self.__actions.append(self.aboutAct)
         
         self.aboutQtAct = E5Action(
@@ -1300,8 +1254,7 @@
             """<b>About Qt</b>"""
             """<p>Display some information about the Qt toolkit.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.aboutQtAct.triggered.connect(self.__aboutQt)
+        self.aboutQtAct.triggered.connect(self.__aboutQt)
         self.__actions.append(self.aboutQtAct)
         
         self.zoomInAct = E5Action(
@@ -1317,8 +1270,7 @@
             """<p>Zoom in on the web page."""
             """ This makes the web page bigger.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.zoomInAct.triggered.connect(self.__zoomIn)
+        self.zoomInAct.triggered.connect(self.__zoomIn)
         self.__actions.append(self.zoomInAct)
         
         self.zoomOutAct = E5Action(
@@ -1334,8 +1286,7 @@
             """<p>Zoom out on the web page."""
             """ This makes the web page smaller.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.zoomOutAct.triggered.connect(self.__zoomOut)
+        self.zoomOutAct.triggered.connect(self.__zoomOut)
         self.__actions.append(self.zoomOutAct)
         
         self.zoomResetAct = E5Action(
@@ -1351,8 +1302,7 @@
             """<p>Reset the zoom of the web page. """
             """This sets the zoom factor to 100%.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.zoomResetAct.triggered.connect(self.__zoomReset)
+        self.zoomResetAct.triggered.connect(self.__zoomReset)
         self.__actions.append(self.zoomResetAct)
         
         self.pageSourceAct = E5Action(
@@ -1366,8 +1316,7 @@
             """<b>Show page source</b>"""
             """<p>Show the page source in an editor.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.pageSourceAct.triggered.connect(self.__showPageSource)
+        self.pageSourceAct.triggered.connect(self.__showPageSource)
         self.__actions.append(self.pageSourceAct)
         self.addAction(self.pageSourceAct)
         
@@ -1382,8 +1331,7 @@
                 QKeySequence(self.tr("Meta+Ctrl+F")))
         else:
             self.fullScreenAct.setShortcut(QKeySequence(self.tr('F11')))
-        if not self.__initShortcutsOnly:
-            self.fullScreenAct.triggered.connect(self.toggleFullScreen)
+        self.fullScreenAct.triggered.connect(self.toggleFullScreen)
         self.__actions.append(self.fullScreenAct)
         self.addAction(self.fullScreenAct)
         
@@ -1392,8 +1340,7 @@
             self.tr('Show next tab'),
             QKeySequence(self.tr('Ctrl+Alt+Tab')), 0,
             self, 'webbrowser_view_next_tab')
-        if not self.__initShortcutsOnly:
-            self.nextTabAct.triggered.connect(self.__nextTab)
+        self.nextTabAct.triggered.connect(self.__nextTab)
         self.__actions.append(self.nextTabAct)
         self.addAction(self.nextTabAct)
         
@@ -1402,8 +1349,7 @@
             self.tr('Show previous tab'),
             QKeySequence(self.tr('Shift+Ctrl+Alt+Tab')), 0,
             self, 'webbrowser_view_previous_tab')
-        if not self.__initShortcutsOnly:
-            self.prevTabAct.triggered.connect(self.__prevTab)
+        self.prevTabAct.triggered.connect(self.__prevTab)
         self.__actions.append(self.prevTabAct)
         self.addAction(self.prevTabAct)
         
@@ -1412,8 +1358,7 @@
             self.tr('Switch between tabs'),
             QKeySequence(self.tr('Ctrl+1')), 0,
             self, 'webbrowser_switch_tabs')
-        if not self.__initShortcutsOnly:
-            self.switchTabAct.triggered.connect(self.__switchTab)
+        self.switchTabAct.triggered.connect(self.__switchTab)
         self.__actions.append(self.switchTabAct)
         self.addAction(self.switchTabAct)
         
@@ -1428,8 +1373,7 @@
             """<p>Set the configuration items of the application"""
             """ with your prefered values.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.prefAct.triggered.connect(self.__showPreferences)
+        self.prefAct.triggered.connect(self.__showPreferences)
         self.__actions.append(self.prefAct)
         
         self.acceptedLanguagesAct = E5Action(
@@ -1443,9 +1387,8 @@
             """<b>Languages</b>"""
             """<p>Configure the accepted languages for web pages.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.acceptedLanguagesAct.triggered.connect(
-                self.__showAcceptedLanguages)
+        self.acceptedLanguagesAct.triggered.connect(
+            self.__showAcceptedLanguages)
         self.__actions.append(self.acceptedLanguagesAct)
         
         self.cookiesAct = E5Action(
@@ -1458,9 +1401,8 @@
             """<b>Cookies</b>"""
             """<p>Configure cookies handling.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.cookiesAct.triggered.connect(
-                self.__showCookiesConfiguration)
+        self.cookiesAct.triggered.connect(
+            self.__showCookiesConfiguration)
         self.__actions.append(self.cookiesAct)
         
         self.flashCookiesAct = E5Action(
@@ -1474,9 +1416,8 @@
             """<b>Flash Cookies</b>"""
             """<p>Show a dialog to manage the flash cookies.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.flashCookiesAct.triggered.connect(
-                self.__showFlashCookiesManagement)
+        self.flashCookiesAct.triggered.connect(
+            self.__showFlashCookiesManagement)
         self.__actions.append(self.flashCookiesAct)
         
         self.personalDataAct = E5Action(
@@ -1492,9 +1433,8 @@
             """<p>Opens a dialog to configure the personal information"""
             """ used for completing form fields.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.personalDataAct.triggered.connect(
-                self.__showPersonalInformationDialog)
+        self.personalDataAct.triggered.connect(
+            self.__showPersonalInformationDialog)
         self.__actions.append(self.personalDataAct)
         
         self.greaseMonkeyAct = E5Action(
@@ -1510,9 +1450,8 @@
             """<p>Opens a dialog to configure the available GreaseMonkey"""
             """ Scripts.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.greaseMonkeyAct.triggered.connect(
-                self.__showGreaseMonkeyConfigDialog)
+        self.greaseMonkeyAct.triggered.connect(
+            self.__showGreaseMonkeyConfigDialog)
         self.__actions.append(self.greaseMonkeyAct)
         
         self.editMessageFilterAct = E5Action(
@@ -1528,9 +1467,8 @@
             """ suppress unwanted messages been shown in an error"""
             """ window.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.editMessageFilterAct.triggered.connect(
-                E5ErrorMessage.editMessageFilters)
+        self.editMessageFilterAct.triggered.connect(
+            E5ErrorMessage.editMessageFilters)
         self.__actions.append(self.editMessageFilterAct)
         
         self.featurePermissionAct = E5Action(
@@ -1545,12 +1483,11 @@
             """<p>Opens a dialog to edit the remembered HTML5"""
             """ feature permissions.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.featurePermissionAct.triggered.connect(
-                self.__showFeaturePermissionDialog)
+        self.featurePermissionAct.triggered.connect(
+            self.__showFeaturePermissionDialog)
         self.__actions.append(self.featurePermissionAct)
         
-        if WebBrowserWindow._useQtHelp or self.__initShortcutsOnly:
+        if WebBrowserWindow._useQtHelp:
             self.syncTocAct = E5Action(
                 self.tr('Sync with Table of Contents'),
                 UI.PixmapCache.getIcon("syncToc.png"),
@@ -1563,8 +1500,7 @@
                 """<p>Synchronizes the table of contents with current"""
                 """ page.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.syncTocAct.triggered.connect(self.__syncTOC)
+            self.syncTocAct.triggered.connect(self.__syncTOC)
             self.__actions.append(self.syncTocAct)
             
             self.showTocAct = E5Action(
@@ -1577,8 +1513,7 @@
                 """<b>Table of Contents</b>"""
                 """<p>Shows the table of contents window.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.showTocAct.triggered.connect(self.__showTocWindow)
+            self.showTocAct.triggered.connect(self.__showTocWindow)
             self.__actions.append(self.showTocAct)
             
             self.showIndexAct = E5Action(
@@ -1591,8 +1526,7 @@
                 """<b>Index</b>"""
                 """<p>Shows the index window.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.showIndexAct.triggered.connect(self.__showIndexWindow)
+            self.showIndexAct.triggered.connect(self.__showIndexWindow)
             self.__actions.append(self.showIndexAct)
             
             self.showSearchAct = E5Action(
@@ -1605,9 +1539,8 @@
                 """<b>Search</b>"""
                 """<p>Shows the search window.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.showSearchAct.triggered.connect(
-                    self.__showSearchWindow)
+            self.showSearchAct.triggered.connect(
+                self.__showSearchWindow)
             self.__actions.append(self.showSearchAct)
             
             self.manageQtHelpDocsAct = E5Action(
@@ -1621,9 +1554,8 @@
                 """<p>Shows a dialog to manage the QtHelp documentation"""
                 """ set.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.manageQtHelpDocsAct.triggered.connect(
-                    self.__manageQtHelpDocumentation)
+            self.manageQtHelpDocsAct.triggered.connect(
+                self.__manageQtHelpDocumentation)
             self.__actions.append(self.manageQtHelpDocsAct)
             
             self.manageQtHelpFiltersAct = E5Action(
@@ -1636,9 +1568,8 @@
                 """<b>Manage QtHelp Filters</b>"""
                 """<p>Shows a dialog to manage the QtHelp filters.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.manageQtHelpFiltersAct.triggered.connect(
-                    self.__manageQtHelpFilters)
+            self.manageQtHelpFiltersAct.triggered.connect(
+                self.__manageQtHelpFilters)
             self.__actions.append(self.manageQtHelpFiltersAct)
             
             self.reindexDocumentationAct = E5Action(
@@ -1651,9 +1582,8 @@
                 """<b>Reindex Documentation</b>"""
                 """<p>Reindexes the documentation set.</p>"""
             ))
-            if not self.__initShortcutsOnly:
-                self.reindexDocumentationAct.triggered.connect(
-                    self.__searchEngine.reindexDocumentation)
+            self.reindexDocumentationAct.triggered.connect(
+                self.__searchEngine.reindexDocumentation)
             self.__actions.append(self.reindexDocumentationAct)
         
         self.clearPrivateDataAct = E5Action(
@@ -1669,9 +1599,8 @@
             """<p>Clears the private data like browsing history, search"""
             """ history or the favicons database.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.clearPrivateDataAct.triggered.connect(
-                self.__clearPrivateData)
+        self.clearPrivateDataAct.triggered.connect(
+            self.__clearPrivateData)
         self.__actions.append(self.clearPrivateDataAct)
         
         self.clearIconsAct = E5Action(
@@ -1686,8 +1615,7 @@
             """<p>Clears the database of favicons of previously visited"""
             """ URLs.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.clearIconsAct.triggered.connect(self.__clearIconsDatabase)
+        self.clearIconsAct.triggered.connect(self.__clearIconsDatabase)
         self.__actions.append(self.clearIconsAct)
         
         self.manageIconsAct = E5Action(
@@ -1703,8 +1631,7 @@
             """<p>This shows a dialog to manage the saved favicons of"""
             """ previously visited URLs.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.manageIconsAct.triggered.connect(self.__showWebIconsDialog)
+        self.manageIconsAct.triggered.connect(self.__showWebIconsDialog)
         self.__actions.append(self.manageIconsAct)
         
         self.searchEnginesAct = E5Action(
@@ -1719,9 +1646,8 @@
             """<p>Opens a dialog to configure the available search"""
             """ engines.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.searchEnginesAct.triggered.connect(
-                self.__showEnginesConfigurationDialog)
+        self.searchEnginesAct.triggered.connect(
+            self.__showEnginesConfigurationDialog)
         self.__actions.append(self.searchEnginesAct)
         
         self.passwordsAct = E5Action(
@@ -1736,8 +1662,7 @@
             """<b>Manage Saved Passwords...</b>"""
             """<p>Opens a dialog to manage the saved passwords.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.passwordsAct.triggered.connect(self.__showPasswordsDialog)
+        self.passwordsAct.triggered.connect(self.__showPasswordsDialog)
         self.__actions.append(self.passwordsAct)
         
         self.adblockAct = E5Action(
@@ -1753,8 +1678,7 @@
             """<p>Opens a dialog to configure AdBlock subscriptions and"""
             """ rules.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.adblockAct.triggered.connect(self.__showAdBlockDialog)
+        self.adblockAct.triggered.connect(self.__showAdBlockDialog)
         self.__actions.append(self.adblockAct)
         
         self.certificateErrorsAct = E5Action(
@@ -1770,9 +1694,8 @@
             """<p>Opens a dialog to manage the accepted SSL"""
             """ certificate errors.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.certificateErrorsAct.triggered.connect(
-                self.__showCertificateErrorsDialog)
+        self.certificateErrorsAct.triggered.connect(
+            self.__showCertificateErrorsDialog)
         self.__actions.append(self.certificateErrorsAct)
         
         self.safeBrowsingAct = E5Action(
@@ -1787,9 +1710,8 @@
             """<p>This opens a dialog to configure Safe Browsing and"""
             """ to manage the local cache.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.safeBrowsingAct.triggered.connect(
-                self.__showSafeBrowsingDialog)
+        self.safeBrowsingAct.triggered.connect(
+            self.__showSafeBrowsingDialog)
         self.__actions.append(self.safeBrowsingAct)
         
         self.showDownloadManagerAct = E5Action(
@@ -1802,9 +1724,8 @@
             """<b>Downloads</b>"""
             """<p>Shows the downloads window.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.showDownloadManagerAct.triggered.connect(
-                self.__showDownloadsWindow)
+        self.showDownloadManagerAct.triggered.connect(
+            self.__showDownloadsWindow)
         self.__actions.append(self.showDownloadManagerAct)
         
         self.feedsManagerAct = E5Action(
@@ -1821,8 +1742,7 @@
             """ It can be used to mange the feeds and to show their"""
             """ contents.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.feedsManagerAct.triggered.connect(self.__showFeedsManager)
+        self.feedsManagerAct.triggered.connect(self.__showFeedsManager)
         self.__actions.append(self.feedsManagerAct)
         
         self.siteInfoAct = E5Action(
@@ -1838,8 +1758,7 @@
             """<p>Opens a dialog showing some information about the current"""
             """ site.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.siteInfoAct.triggered.connect(self.__showSiteinfoDialog)
+        self.siteInfoAct.triggered.connect(self.__showSiteinfoDialog)
         self.__actions.append(self.siteInfoAct)
         
         self.userAgentManagerAct = E5Action(
@@ -1852,9 +1771,8 @@
             """<b>Manage User Agent Settings</b>"""
             """<p>Shows a dialog to manage the User Agent settings.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.userAgentManagerAct.triggered.connect(
-                self.__showUserAgentsDialog)
+        self.userAgentManagerAct.triggered.connect(
+            self.__showUserAgentsDialog)
         self.__actions.append(self.userAgentManagerAct)
         
         self.synchronizationAct = E5Action(
@@ -1869,9 +1787,8 @@
             """<p>This shows a dialog to synchronize data via the"""
             """ network.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.synchronizationAct.triggered.connect(
-                self.__showSyncDialog)
+        self.synchronizationAct.triggered.connect(
+            self.__showSyncDialog)
         self.__actions.append(self.synchronizationAct)
         
         self.zoomValuesAct = E5Action(
@@ -1886,8 +1803,7 @@
             """<b>Manage Saved Zoom Values...</b>"""
             """<p>Opens a dialog to manage the saved zoom values.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.zoomValuesAct.triggered.connect(self.__showZoomValuesDialog)
+        self.zoomValuesAct.triggered.connect(self.__showZoomValuesDialog)
         self.__actions.append(self.zoomValuesAct)
         
         self.showJavaScriptConsoleAct = E5Action(
@@ -1900,9 +1816,8 @@
             """<b>JavaScript Console</b>"""
             """<p>This toggles the JavaScript console window.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.showJavaScriptConsoleAct.triggered.connect(
-                self.__toggleJavaScriptConsole)
+        self.showJavaScriptConsoleAct.triggered.connect(
+            self.__toggleJavaScriptConsole)
         self.__actions.append(self.showJavaScriptConsoleAct)
         
         self.showTabManagerAct = E5Action(
@@ -1915,9 +1830,8 @@
             """<b>Tab Manager</b>"""
             """<p>Shows the tab manager window.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.showTabManagerAct.triggered.connect(
-                lambda: self.__showTabManager(self.showTabManagerAct))
+        self.showTabManagerAct.triggered.connect(
+            lambda: self.__showTabManager(self.showTabManagerAct))
         self.__actions.append(self.showTabManagerAct)
         
         self.showSessionsManagerAct = E5Action(
@@ -1930,9 +1844,8 @@
             """<b>Session Manager</b>"""
             """<p>Shows the session manager window.</p>"""
         ))
-        if not self.__initShortcutsOnly:
-            self.showSessionsManagerAct.triggered.connect(
-                self.__showSessionManagerDialog)
+        self.showSessionsManagerAct.triggered.connect(
+            self.__showSessionManagerDialog)
         self.__actions.append(self.showSessionsManagerAct)
         
         self.virustotalScanCurrentAct = E5Action(
@@ -1941,9 +1854,8 @@
             self.tr("Scan current site"),
             0, 0,
             self, 'webbrowser_virustotal_scan_site')
-        if not self.__initShortcutsOnly:
-            self.virustotalScanCurrentAct.triggered.connect(
-                self.__virusTotalScanCurrentSite)
+        self.virustotalScanCurrentAct.triggered.connect(
+            self.__virusTotalScanCurrentSite)
         self.__actions.append(self.virustotalScanCurrentAct)
         
         self.virustotalIpReportAct = E5Action(
@@ -1952,9 +1864,8 @@
             self.tr("IP Address Report"),
             0, 0,
             self, 'webbrowser_virustotal_ip_report')
-        if not self.__initShortcutsOnly:
-            self.virustotalIpReportAct.triggered.connect(
-                self.__virusTotalIpAddressReport)
+        self.virustotalIpReportAct.triggered.connect(
+            self.__virusTotalIpAddressReport)
         self.__actions.append(self.virustotalIpReportAct)
         
         self.virustotalDomainReportAct = E5Action(
@@ -1963,9 +1874,8 @@
             self.tr("Domain Report"),
             0, 0,
             self, 'webbrowser_virustotal_domain_report')
-        if not self.__initShortcutsOnly:
-            self.virustotalDomainReportAct.triggered.connect(
-                self.__virusTotalDomainReport)
+        self.virustotalDomainReportAct.triggered.connect(
+            self.__virusTotalDomainReport)
         self.__actions.append(self.virustotalDomainReportAct)
         
         if not Preferences.getWebBrowser("VirusTotalEnabled") or \
@@ -1989,6 +1899,34 @@
         ))
         self.shortcutsAct.triggered.connect(self.__configShortcuts)
         self.__actions.append(self.shortcutsAct)
+
+        self.exportShortcutsAct = E5Action(
+            self.tr('Export Keyboard Shortcuts'),
+            UI.PixmapCache.getIcon("exportShortcuts.png"),
+            self.tr('&Export Keyboard Shortcuts...'),
+            0, 0, self, 'export_keyboard_shortcuts')
+        self.exportShortcutsAct.setStatusTip(self.tr(
+            'Export the keyboard shortcuts'))
+        self.exportShortcutsAct.setWhatsThis(self.tr(
+            """<b>Export Keyboard Shortcuts</b>"""
+            """<p>Export the keyboard shortcuts of the application.</p>"""
+        ))
+        self.exportShortcutsAct.triggered.connect(self.__exportShortcuts)
+        self.__actions.append(self.exportShortcutsAct)
+
+        self.importShortcutsAct = E5Action(
+            self.tr('Import Keyboard Shortcuts'),
+            UI.PixmapCache.getIcon("importShortcuts.png"),
+            self.tr('&Import Keyboard Shortcuts...'),
+            0, 0, self, 'import_keyboard_shortcuts')
+        self.importShortcutsAct.setStatusTip(self.tr(
+            'Import the keyboard shortcuts'))
+        self.importShortcutsAct.setWhatsThis(self.tr(
+            """<b>Import Keyboard Shortcuts</b>"""
+            """<p>Import the keyboard shortcuts of the application.</p>"""
+        ))
+        self.importShortcutsAct.triggered.connect(self.__importShortcuts)
+        self.__actions.append(self.importShortcutsAct)
         
         self.backAct.setEnabled(False)
         self.forwardAct.setEnabled(False)
@@ -2127,6 +2065,8 @@
         menu.addAction(self.prefAct)
         menu.addSeparator()
         menu.addAction(self.shortcutsAct)
+        menu.addAction(self.exportShortcutsAct)
+        menu.addAction(self.importShortcutsAct)
         menu.addSeparator()
         menu.addAction(self.acceptedLanguagesAct)
         menu.addAction(self.cookiesAct)
@@ -2252,6 +2192,8 @@
         
         menu = self.__superMenu.addMenu(self.tr('Settings'))
         menu.addAction(self.shortcutsAct)
+        menu.addAction(self.exportShortcutsAct)
+        menu.addAction(self.importShortcutsAct)
         menu.addSeparator()
         menu.addAction(self.acceptedLanguagesAct)
         menu.addAction(self.cookiesAct)
@@ -5058,3 +5000,41 @@
             self.__shortcutsDialog = ShortcutsDialog(self)
         self.__shortcutsDialog.populate(helpViewer=self)
         self.__shortcutsDialog.show()
+    
+    def __exportShortcuts(self):
+        """
+        Private slot to export the keyboard shortcuts.
+        """
+        fn, selectedFilter = E5FileDialog.getSaveFileNameAndFilter(
+            None,
+            self.tr("Export Keyboard Shortcuts"),
+            "",
+            self.tr("Keyboard shortcut file (*.e4k)"),
+            "",
+            E5FileDialog.Options(E5FileDialog.DontConfirmOverwrite))
+        
+        if not fn:
+            return
+        
+        ext = QFileInfo(fn).suffix()
+        if not ext:
+            ex = selectedFilter.split("(*")[1].split(")")[0]
+            if ex:
+                fn += ex
+        
+        from Preferences import Shortcuts
+        Shortcuts.exportShortcuts(fn, helpViewer=self)
+
+    def __importShortcuts(self):
+        """
+        Private slot to import the keyboard shortcuts.
+        """
+        fn = E5FileDialog.getOpenFileName(
+            None,
+            self.tr("Import Keyboard Shortcuts"),
+            "",
+            self.tr("Keyboard shortcut file (*.e4k)"))
+        
+        if fn:
+            from Preferences import Shortcuts
+            Shortcuts.importShortcuts(fn, helpViewer=self)

eric ide

mercurial