URL handling: redirected the URL handling for 'http' and 'https' URLs to the main user interface and the man web browser interface (for standalone web browsers).

Sun, 13 May 2018 12:57:00 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 13 May 2018 12:57:00 +0200
changeset 6287
9a193ff6d24a
parent 6286
2c8a751d6137
child 6288
67ae52179c8b

URL handling: redirected the URL handling for 'http' and 'https' URLs to the main user interface and the man web browser interface (for standalone web browsers).

APIs/Python3/eric6.api file | annotate | diff | comparison | revisions
Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Documentation/Help/source.qhp file | annotate | diff | comparison | revisions
Documentation/Source/eric6.Helpviewer.HelpWindow.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.QScintilla.QsciScintillaCompat.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.UI.Previewers.PreviewerHTML.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.UI.UserInterface.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.WebBrowser.Download.DownloadItem.html file | annotate | diff | comparison | revisions
Documentation/Source/eric6.WebBrowser.WebBrowserWindow.html file | annotate | diff | comparison | revisions
Helpviewer/HelpWindow.py file | annotate | diff | comparison | revisions
Plugins/AboutPlugin/AboutDialog.py file | annotate | diff | comparison | revisions
Plugins/PluginAbout.py file | annotate | diff | comparison | revisions
Plugins/UiExtensionPlugins/PipInterface/PipPackageDetailsDialog.py file | annotate | diff | comparison | revisions
Plugins/UiExtensionPlugins/PipInterface/PipSearchDialog.py file | annotate | diff | comparison | revisions
UI/Previewers/PreviewerHTML.py file | annotate | diff | comparison | revisions
UI/UserInterface.py file | annotate | diff | comparison | revisions
WebBrowser/WebBrowserWindow.py file | annotate | diff | comparison | revisions
--- a/APIs/Python3/eric6.api	Sun May 13 12:55:08 2018 +0200
+++ b/APIs/Python3/eric6.api	Sun May 13 12:57:00 2018 +0200
@@ -2669,6 +2669,7 @@
 eric6.Helpviewer.HelpWindow.HelpWindow.shutdown?4()
 eric6.Helpviewer.HelpWindow.HelpWindow.speedDial?4()
 eric6.Helpviewer.HelpWindow.HelpWindow.syncManager?4()
+eric6.Helpviewer.HelpWindow.HelpWindow.urlHandler?4(url)
 eric6.Helpviewer.HelpWindow.HelpWindow.userAgentsManager?4()
 eric6.Helpviewer.HelpWindow.HelpWindow.zoomManager?4()
 eric6.Helpviewer.HelpWindow.HelpWindow.zoomTextOnlyChanged?7
@@ -9901,6 +9902,7 @@
 eric6.UI.UserInterface.UserInterface.getToolBarIconSize?4()
 eric6.UI.UserInterface.UserInterface.getToolbar?4(name)
 eric6.UI.UserInterface.UserInterface.getViewProfile?4()
+eric6.UI.UserInterface.UserInterface.handleUrl?4(url)
 eric6.UI.UserInterface.UserInterface.isOnline?4()
 eric6.UI.UserInterface.UserInterface.launchHelpViewer?4(home, searchWord=None, useSingle=False)
 eric6.UI.UserInterface.UserInterface.masterPasswordChanged?7
@@ -11053,7 +11055,7 @@
 eric6.WebBrowser.Download.DownloadItem.DownloadItem.setData?4(data)
 eric6.WebBrowser.Download.DownloadItem.DownloadItem.setIcon?4(icon)
 eric6.WebBrowser.Download.DownloadItem.DownloadItem.statusChanged?7
-eric6.WebBrowser.Download.DownloadItem.DownloadItem?1(downloadItem=None, pageUrl="", parent=None)
+eric6.WebBrowser.Download.DownloadItem.DownloadItem?1(downloadItem=None, pageUrl=None, parent=None)
 eric6.WebBrowser.Download.DownloadManager.DownloadManager.RemoveExit?7
 eric6.WebBrowser.Download.DownloadManager.DownloadManager.RemoveNever?7
 eric6.WebBrowser.Download.DownloadManager.DownloadManager.RemoveSuccessFullDownload?7
@@ -12426,6 +12428,7 @@
 eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.tabManager?4()
 eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.tabWidget?4()
 eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.toggleFullScreen?4()
+eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.urlHandler?4(url)
 eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.userAgentsManager?4()
 eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.webBrowserClosed?7
 eric6.WebBrowser.WebBrowserWindow.WebBrowserWindow.webBrowserOpened?7
Binary file Documentation/Help/source.qch has changed
--- a/Documentation/Help/source.qhp	Sun May 13 12:55:08 2018 +0200
+++ b/Documentation/Help/source.qhp	Sun May 13 12:57:00 2018 +0200
@@ -8043,6 +8043,7 @@
       <keyword name="HelpWindow.shutdown" id="HelpWindow.shutdown" ref="eric6.Helpviewer.HelpWindow.html#HelpWindow.shutdown" />
       <keyword name="HelpWindow.speedDial" id="HelpWindow.speedDial" ref="eric6.Helpviewer.HelpWindow.html#HelpWindow.speedDial" />
       <keyword name="HelpWindow.syncManager" id="HelpWindow.syncManager" ref="eric6.Helpviewer.HelpWindow.html#HelpWindow.syncManager" />
+      <keyword name="HelpWindow.urlHandler" id="HelpWindow.urlHandler" ref="eric6.Helpviewer.HelpWindow.html#HelpWindow.urlHandler" />
       <keyword name="HelpWindow.userAgentsManager" id="HelpWindow.userAgentsManager" ref="eric6.Helpviewer.HelpWindow.html#HelpWindow.userAgentsManager" />
       <keyword name="HelpWindow.zoomManager" id="HelpWindow.zoomManager" ref="eric6.Helpviewer.HelpWindow.html#HelpWindow.zoomManager" />
       <keyword name="Helpviewer (Package)" id="Helpviewer (Package)" ref="index-eric6.Helpviewer.html" />
@@ -16818,6 +16819,7 @@
       <keyword name="UserInterface.getToolBarIconSize" id="UserInterface.getToolBarIconSize" ref="eric6.UI.UserInterface.html#UserInterface.getToolBarIconSize" />
       <keyword name="UserInterface.getToolbar" id="UserInterface.getToolbar" ref="eric6.UI.UserInterface.html#UserInterface.getToolbar" />
       <keyword name="UserInterface.getViewProfile" id="UserInterface.getViewProfile" ref="eric6.UI.UserInterface.html#UserInterface.getViewProfile" />
+      <keyword name="UserInterface.handleUrl" id="UserInterface.handleUrl" ref="eric6.UI.UserInterface.html#UserInterface.handleUrl" />
       <keyword name="UserInterface.isOnline" id="UserInterface.isOnline" ref="eric6.UI.UserInterface.html#UserInterface.isOnline" />
       <keyword name="UserInterface.launchHelpViewer" id="UserInterface.launchHelpViewer" ref="eric6.UI.UserInterface.html#UserInterface.launchHelpViewer" />
       <keyword name="UserInterface.notificationsEnabled" id="UserInterface.notificationsEnabled" ref="eric6.UI.UserInterface.html#UserInterface.notificationsEnabled" />
@@ -18025,6 +18027,7 @@
       <keyword name="WebBrowserWindow.tabManager" id="WebBrowserWindow.tabManager" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.tabManager" />
       <keyword name="WebBrowserWindow.tabWidget" id="WebBrowserWindow.tabWidget" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.tabWidget" />
       <keyword name="WebBrowserWindow.toggleFullScreen" id="WebBrowserWindow.toggleFullScreen" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.toggleFullScreen" />
+      <keyword name="WebBrowserWindow.urlHandler" id="WebBrowserWindow.urlHandler" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.urlHandler" />
       <keyword name="WebBrowserWindow.userAgentsManager" id="WebBrowserWindow.userAgentsManager" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.userAgentsManager" />
       <keyword name="WebBrowserWindow.webProfile" id="WebBrowserWindow.webProfile" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.webProfile" />
       <keyword name="WebBrowserWindow.webSettings" id="WebBrowserWindow.webSettings" ref="eric6.WebBrowser.WebBrowserWindow.html#WebBrowserWindow.webSettings" />
--- a/Documentation/Source/eric6.Helpviewer.HelpWindow.html	Sun May 13 12:55:08 2018 +0200
+++ b/Documentation/Source/eric6.Helpviewer.HelpWindow.html	Sun May 13 12:57:00 2018 +0200
@@ -546,6 +546,9 @@
 </tr><tr>
 <td><a href="#HelpWindow.shutdown">shutdown</a></td>
 <td>Public method to shut down the web browser.</td>
+</tr><tr>
+<td><a href="#HelpWindow.urlHandler">urlHandler</a></td>
+<td>Private slot used as desktop URL handler.</td>
 </tr>
 </table>
 <h3>Static Methods</h3>
@@ -1111,9 +1114,9 @@
 <p>
         Private slot to handle the selection of a link in the TOC window.
 </p><dl>
-<dt><i>url</i></dt>
+<dt><i>url</i> (QUrl)</dt>
 <dd>
-URL to be shown (QUrl)
+URL to be shown
 </dd>
 </dl><a NAME="HelpWindow.__linksActivated" ID="HelpWindow.__linksActivated"></a>
 <h4>HelpWindow.__linksActivated</h4>
@@ -1867,6 +1870,16 @@
 <dd>
 flag indicating successful shutdown (boolean)
 </dd>
+</dl><a NAME="HelpWindow.urlHandler" ID="HelpWindow.urlHandler"></a>
+<h4>HelpWindow.urlHandler</h4>
+<b>urlHandler</b>(<i>url</i>)
+<p>
+        Private slot used as desktop URL handler.
+</p><dl>
+<dt><i>url</i> (QUrl)</dt>
+<dd>
+URL to be handled
+</dd>
 </dl><a NAME="HelpWindow.__getWebIcon" ID="HelpWindow.__getWebIcon"></a>
 <h4>HelpWindow.__getWebIcon (static)</h4>
 <b>__getWebIcon</b>(<i></i>)
--- a/Documentation/Source/eric6.QScintilla.QsciScintillaCompat.html	Sun May 13 12:55:08 2018 +0200
+++ b/Documentation/Source/eric6.QScintilla.QsciScintillaCompat.html	Sun May 13 12:57:00 2018 +0200
@@ -686,7 +686,7 @@
         Public method to handle events.
 </p><p>
         Note: We are not interested in the standard QsciScintilla event
-        handling because we do it our self.
+        handling because we do it ourselves.
 </p><dl>
 <dt><i>evt</i></dt>
 <dd>
--- a/Documentation/Source/eric6.UI.Previewers.PreviewerHTML.html	Sun May 13 12:55:08 2018 +0200
+++ b/Documentation/Source/eric6.UI.Previewers.PreviewerHTML.html	Sun May 13 12:57:00 2018 +0200
@@ -492,9 +492,9 @@
 <p>
         Private slot handling the clicking of a link.
 </p><dl>
-<dt><i>url</i></dt>
+<dt><i>url</i> (QUrl)</dt>
 <dd>
-url of the clicked link (QUrl)
+URL of the clicked link
 </dd>
 </dl><a NAME="PreviewerHTML.on_previewView_titleChanged" ID="PreviewerHTML.on_previewView_titleChanged"></a>
 <h4>PreviewerHTML.on_previewView_titleChanged</h4>
--- a/Documentation/Source/eric6.UI.UserInterface.html	Sun May 13 12:55:08 2018 +0200
+++ b/Documentation/Source/eric6.UI.UserInterface.html	Sun May 13 12:57:00 2018 +0200
@@ -756,11 +756,14 @@
 <td><a href="#UserInterface.getViewProfile">getViewProfile</a></td>
 <td>Public method to get the current view profile.</td>
 </tr><tr>
+<td><a href="#UserInterface.handleUrl">handleUrl</a></td>
+<td>Public slot to handle opening a URL.</td>
+</tr><tr>
 <td><a href="#UserInterface.isOnline">isOnline</a></td>
 <td>Public method to get the online state.</td>
 </tr><tr>
 <td><a href="#UserInterface.launchHelpViewer">launchHelpViewer</a></td>
-<td>Public slot to start the help viewer.</td>
+<td>Public slot to start the help viewer/web browser.</td>
 </tr><tr>
 <td><a href="#UserInterface.notificationsEnabled">notificationsEnabled</a></td>
 <td>Public method to check, if notifications are enabled.</td>
@@ -2379,6 +2382,16 @@
 <dd>
 the name of the current view profile (string)
 </dd>
+</dl><a NAME="UserInterface.handleUrl" ID="UserInterface.handleUrl"></a>
+<h4>UserInterface.handleUrl</h4>
+<b>handleUrl</b>(<i>url</i>)
+<p>
+        Public slot to handle opening a URL.
+</p><dl>
+<dt><i>url</i> (QUrl)</dt>
+<dd>
+URL to be shown
+</dd>
 </dl><a NAME="UserInterface.isOnline" ID="UserInterface.isOnline"></a>
 <h4>UserInterface.isOnline</h4>
 <b>isOnline</b>(<i></i>)
@@ -2398,18 +2411,17 @@
 <h4>UserInterface.launchHelpViewer</h4>
 <b>launchHelpViewer</b>(<i>home, searchWord=None, useSingle=False</i>)
 <p>
-        Public slot to start the help viewer.
+        Public slot to start the help viewer/web browser.
 </p><dl>
-<dt><i>home</i></dt>
+<dt><i>home</i> (str or QUrl)</dt>
 <dd>
-filename of file to be shown (string)
-</dd><dt><i>searchWord=</i></dt>
+filename of file to be shown or URL to be opened
+</dd><dt><i>searchWord=</i> (str)</dt>
 <dd>
-word to search for (string)
-</dd><dt><i>useSingle=</i></dt>
+word to search for
+</dd><dt><i>useSingle=</i> (bool)</dt>
 <dd>
 flag indicating to use a single browser window
-            (boolean)
 </dd>
 </dl><a NAME="UserInterface.notificationsEnabled" ID="UserInterface.notificationsEnabled"></a>
 <h4>UserInterface.notificationsEnabled</h4>
--- a/Documentation/Source/eric6.WebBrowser.Download.DownloadItem.html	Sun May 13 12:55:08 2018 +0200
+++ b/Documentation/Source/eric6.WebBrowser.Download.DownloadItem.html	Sun May 13 12:57:00 2018 +0200
@@ -172,7 +172,7 @@
 </table>
 <a NAME="DownloadItem.__init__" ID="DownloadItem.__init__"></a>
 <h4>DownloadItem (Constructor)</h4>
-<b>DownloadItem</b>(<i>downloadItem=None, pageUrl="", parent=None</i>)
+<b>DownloadItem</b>(<i>downloadItem=None, pageUrl=None, parent=None</i>)
 <p>
         Constructor
 </p><dl>
--- a/Documentation/Source/eric6.WebBrowser.WebBrowserWindow.html	Sun May 13 12:55:08 2018 +0200
+++ b/Documentation/Source/eric6.WebBrowser.WebBrowserWindow.html	Sun May 13 12:57:00 2018 +0200
@@ -654,6 +654,9 @@
 </tr><tr>
 <td><a href="#WebBrowserWindow.toggleFullScreen">toggleFullScreen</a></td>
 <td>Public slot called to toggle the full screen mode.</td>
+</tr><tr>
+<td><a href="#WebBrowserWindow.urlHandler">urlHandler</a></td>
+<td>Private slot used as desktop URL handler.</td>
 </tr>
 </table>
 <h3>Static Methods</h3>
@@ -1406,9 +1409,9 @@
 <p>
         Private slot to handle the selection of a link.
 </p><dl>
-<dt><i>url</i></dt>
+<dt><i>url</i> (QUrl)</dt>
 <dd>
-URL to be shown (QUrl)
+URL to be shown
 </dd>
 </dl><a NAME="WebBrowserWindow.__lookForNewDocumentation" ID="WebBrowserWindow.__lookForNewDocumentation"></a>
 <h4>WebBrowserWindow.__lookForNewDocumentation</h4>
@@ -2414,7 +2417,17 @@
 <b>toggleFullScreen</b>(<i></i>)
 <p>
         Public slot called to toggle the full screen mode.
-</p>
+</p><a NAME="WebBrowserWindow.urlHandler" ID="WebBrowserWindow.urlHandler"></a>
+<h4>WebBrowserWindow.urlHandler</h4>
+<b>urlHandler</b>(<i>url</i>)
+<p>
+        Private slot used as desktop URL handler.
+</p><dl>
+<dt><i>url</i> (QUrl)</dt>
+<dd>
+URL to be handled
+</dd>
+</dl>
 <div align="right"><a href="#top">Up</a></div>
 <hr />
 </body></html>
\ No newline at end of file
--- a/Helpviewer/HelpWindow.py	Sun May 13 12:55:08 2018 +0200
+++ b/Helpviewer/HelpWindow.py	Sun May 13 12:57:00 2018 +0200
@@ -256,8 +256,11 @@
             self.networkIcon = E5NetworkIcon(self)
             self.statusBar().addPermanentWidget(self.networkIcon)
             
-            QDesktopServices.setUrlHandler("http", self.__linkActivated)
-            QDesktopServices.setUrlHandler("https", self.__linkActivated)
+            if not self.fromEric and len(HelpWindow.helpwindows):
+                QDesktopServices.setUrlHandler(
+                    "http", HelpWindow.helpwindows[0].urlHandler)
+                QDesktopServices.setUrlHandler(
+                    "https", HelpWindow.helpwindows[0].urlHandler)
             
             # setup connections
             self.__activating = False
@@ -2285,9 +2288,22 @@
             Preferences.setGeometry("HelpViewerGeometry", QByteArray())
         
         try:
-            if self.fromEric or len(self.__class__.helpwindows) > 1:
-                del self.__class__.helpwindows[
-                    self.__class__.helpwindows.index(self)]
+            browserIndex = HelpWindow.helpwindows.index(self)
+            if not self.__fromEric and len(HelpWindow.helpwindows):
+                if browserIndex == 0:
+                    if len(HelpWindow.helpwindows) > 1:
+                        # first window will be deleted
+                        QDesktopServices.setUrlHandler(
+                            "http",
+                            HelpWindow.helpwindows[1].urlHandler)
+                        QDesktopServices.setUrlHandler(
+                            "https",
+                            HelpWindow.helpwindows[1].urlHandler)
+                    else:
+                        QDesktopServices.unsetUrlHandler("http")
+                        QDesktopServices.unsetUrlHandler("https")
+            if self.fromEric or len(HelpWindow.helpwindows) > 0:
+                del HelpWindow.helpwindows[browserIndex]
         except ValueError:
             pass
         
@@ -2658,11 +2674,22 @@
         QWebSettings.clearIconDatabase()
         
     @pyqtSlot(QUrl)
+    def urlHandler(self, url):
+        """
+        Private slot used as desktop URL handler.
+        
+        @param url URL to be handled
+        @type QUrl
+        """
+        self.__linkActivated(url)
+    
+    @pyqtSlot(QUrl)
     def __linkActivated(self, url):
         """
         Private slot to handle the selection of a link in the TOC window.
         
-        @param url URL to be shown (QUrl)
+        @param url URL to be shown
+        @type QUrl
         """
         if not self.__activating:
             self.__activating = True
--- a/Plugins/AboutPlugin/AboutDialog.py	Sun May 13 12:55:08 2018 +0200
+++ b/Plugins/AboutPlugin/AboutDialog.py	Sun May 13 12:57:00 2018 +0200
@@ -9,7 +9,7 @@
 
 from __future__ import unicode_literals
 
-from PyQt5.QtCore import QCoreApplication
+from PyQt5.QtCore import Qt, QCoreApplication
 from PyQt5.QtWidgets import QDialog
 
 from .Ui_AboutDialog import Ui_AboutDialog
@@ -748,6 +748,7 @@
         """
         super(AboutDialog, self).__init__(parent)
         self.setupUi(self)
+        self.setWindowFlags(Qt.Window)
         
         self.ericLabel.setText(titleText)
         self.ericPixmap.setPixmap(
--- a/Plugins/PluginAbout.py	Sun May 13 12:55:08 2018 +0200
+++ b/Plugins/PluginAbout.py	Sun May 13 12:57:00 2018 +0200
@@ -47,6 +47,8 @@
         """
         super(AboutPlugin, self).__init__(ui)
         self.__ui = ui
+        
+        self.__aboutDialog = None
 
     def activate(self):
         """
@@ -126,8 +128,9 @@
         Private slot to handle the About dialog.
         """
         from AboutPlugin.AboutDialog import AboutDialog
-        dlg = AboutDialog(self.__ui)
-        dlg.exec_()
+        if self.__aboutDialog is None:
+            self.__aboutDialog = AboutDialog(self.__ui)
+        self.__aboutDialog.show()
         
     def __aboutQt(self):
         """
--- a/Plugins/UiExtensionPlugins/PipInterface/PipPackageDetailsDialog.py	Sun May 13 12:55:08 2018 +0200
+++ b/Plugins/UiExtensionPlugins/PipInterface/PipPackageDetailsDialog.py	Sun May 13 12:57:00 2018 +0200
@@ -34,6 +34,7 @@
         """
         super(PipPackageDetailsDialog, self).__init__(parent)
         self.setupUi(self)
+        self.setWindowFlags(Qt.Window)
         
         self.__locale = QLocale()
         self.__packageTypeMap = {
--- a/Plugins/UiExtensionPlugins/PipInterface/PipSearchDialog.py	Sun May 13 12:55:08 2018 +0200
+++ b/Plugins/UiExtensionPlugins/PipInterface/PipSearchDialog.py	Sun May 13 12:57:00 2018 +0200
@@ -79,6 +79,8 @@
         self.__canceled = False
         self.__detailsData = {}
         self.__query = []
+        
+        self.__packageDetailsDialog = None
     
     def closeEvent(self, e):
         """
@@ -87,6 +89,10 @@
         @param e close event (QCloseEvent)
         """
         QApplication.restoreOverrideCursor()
+        
+        if self.__packageDetailsDialog is not None:
+            self.__packageDetailsDialog.close()
+        
         e.accept()
     
     @pyqtSlot(str)
@@ -400,11 +406,17 @@
         @param data result data (tuple) with downloads information in the first
             element
         """
+        from .PipPackageDetailsDialog import PipPackageDetailsDialog
+        
         self.__finish()
         self.__showDetailsButton.setEnabled(True)
-        from .PipPackageDetailsDialog import PipPackageDetailsDialog
-        dlg = PipPackageDetailsDialog(self.__detailsData, data[0], self)
-        dlg.exec_()
+        
+        if self.__packageDetailsDialog is not None:
+            self.__packageDetailsDialog.close()
+        
+        self.__packageDetailsDialog = \
+            PipPackageDetailsDialog(self.__detailsData, data[0], self)
+        self.__packageDetailsDialog.show()
     
     def __detailsError(self, errorCode, errorString):
         """
--- a/UI/Previewers/PreviewerHTML.py	Sun May 13 12:55:08 2018 +0200
+++ b/UI/Previewers/PreviewerHTML.py	Sun May 13 12:57:00 2018 +0200
@@ -329,9 +329,10 @@
         """
         Private slot handling the clicking of a link.
         
-        @param url url of the clicked link (QUrl)
+        @param url URL of the clicked link
+        @type QUrl
         """
-        e5App().getObject("UserInterface").launchHelpViewer(url.toString())
+        e5App().getObject("UserInterface").launchHelpViewer(url)
     
     def __execJavaScript(self, script):
         """
--- a/UI/UserInterface.py	Sun May 13 12:55:08 2018 +0200
+++ b/UI/UserInterface.py	Sun May 13 12:57:00 2018 +0200
@@ -280,7 +280,7 @@
         self.stdout = Redirector(False)
         self.stderr = Redirector(True)
         
-        # set a few dialog members for dialogs created on demand
+        # set a few dialog members for non-modal dialogs created on demand
         self.programsDialog = None
         self.shortcutsDialog = None
         self.unittestDialog = None
@@ -291,6 +291,7 @@
         self.replaceFilesDialog = None
         self.__notification = None
         self.__readingSession = False
+        self.__versionsDialog = None
         
         # now setup the connections
         splash.showMessage(self.tr("Setting up connections..."))
@@ -540,6 +541,11 @@
         else:
             self.dummyHelpViewer = None
         
+        # redirect handling of http and https URLs to ourselves
+        if WEBENGINE_AVAILABLE or WEBKIT_AVAILABLE:
+            QDesktopServices.setUrlHandler("http", self.handleUrl)
+            QDesktopServices.setUrlHandler("https", self.handleUrl)
+        
         # register all relevant objects
         splash.showMessage(self.tr("Registering Objects..."))
         e5App().registerObject("UserInterface", self)
@@ -5422,15 +5428,30 @@
         else:
             self.__customViewer(home)
         
+    @pyqtSlot(QUrl)
+    def handleUrl(self, url):
+        """
+        Public slot to handle opening a URL.
+        
+        @param url URL to be shown
+        @type QUrl
+        """
+        self.launchHelpViewer(url)
+    
     def launchHelpViewer(self, home, searchWord=None, useSingle=False):
         """
-        Public slot to start the help viewer.
-        
-        @param home filename of file to be shown (string)
-        @keyparam searchWord word to search for (string)
+        Public slot to start the help viewer/web browser.
+        
+        @param home filename of file to be shown or URL to be opened
+        @type str or QUrl
+        @keyparam searchWord word to search for
+        @type str
         @keyparam useSingle flag indicating to use a single browser window
-            (boolean)
-        """
+        @type bool
+        """
+        if isinstance(home, QUrl):
+            home = home.toString(QUrl.None_)
+        
         if len(home) > 0:
             homeUrl = QUrl(home)
             if not homeUrl.scheme():
@@ -6692,7 +6713,17 @@
             line += 2
         versionText += self.tr("""</table>""")
         
-        E5MessageBox.about(self, Program, versionText)
+        self.__versionsDialog = E5MessageBox.E5MessageBox(
+            E5MessageBox.NoIcon,
+            Program,
+            versionText,
+            modal=False,
+            buttons=E5MessageBox.Ok,
+            parent=self
+        )
+        self.__versionsDialog.setIconPixmap(
+            UI.PixmapCache.getPixmap("eric.png").scaled(64, 64))
+        self.__versionsDialog.show()
         
     def __sslErrors(self, reply, errors):
         """
--- a/WebBrowser/WebBrowserWindow.py	Sun May 13 12:55:08 2018 +0200
+++ b/WebBrowser/WebBrowserWindow.py	Sun May 13 12:57:00 2018 +0200
@@ -409,8 +409,11 @@
             if not Preferences.getWebBrowser("StatusBarVisible"):
                 self.statusBar().hide()
             
-            QDesktopServices.setUrlHandler("http", self.__linkActivated)
-            QDesktopServices.setUrlHandler("https", self.__linkActivated)
+            if not self.__fromEric and len(WebBrowserWindow.BrowserWindows):
+                QDesktopServices.setUrlHandler(
+                    "http", WebBrowserWindow.BrowserWindows[0].urlHandler)
+                QDesktopServices.setUrlHandler(
+                    "https", WebBrowserWindow.BrowserWindows[0].urlHandler)
             
             # setup connections
             self.__activating = False
@@ -2851,9 +2854,22 @@
             Preferences.setGeometry("WebBrowserGeometry", QByteArray())
         
         try:
+            browserIndex = WebBrowserWindow.BrowserWindows.index(self)
+            if not self.__fromEric and len(WebBrowserWindow.BrowserWindows):
+                if browserIndex == 0:
+                    if len(WebBrowserWindow.BrowserWindows) > 1:
+                        # first window will be deleted
+                        QDesktopServices.setUrlHandler(
+                            "http",
+                            WebBrowserWindow.BrowserWindows[1].urlHandler)
+                        QDesktopServices.setUrlHandler(
+                            "https",
+                            WebBrowserWindow.BrowserWindows[1].urlHandler)
+                    else:
+                        QDesktopServices.unsetUrlHandler("http")
+                        QDesktopServices.unsetUrlHandler("https")
             if self.__fromEric or len(WebBrowserWindow.BrowserWindows) > 0:
-                del WebBrowserWindow.BrowserWindows[
-                    WebBrowserWindow.BrowserWindows.index(self)]
+                del WebBrowserWindow.BrowserWindows[browserIndex]
         except ValueError:
             pass
         
@@ -3394,11 +3410,22 @@
         WebIconProvider.instance().showWebIconDialog()
         
     @pyqtSlot(QUrl)
+    def urlHandler(self, url):
+        """
+        Private slot used as desktop URL handler.
+        
+        @param url URL to be handled
+        @type QUrl
+        """
+        self.__linkActivated(url)
+    
+    @pyqtSlot(QUrl)
     def __linkActivated(self, url):
         """
         Private slot to handle the selection of a link.
         
-        @param url URL to be shown (QUrl)
+        @param url URL to be shown
+        @type QUrl
         """
         if not self.__activating:
             self.__activating = True

eric ide

mercurial