Added support for search schemes ("s:" or "search:") and "about:home" to the web browser.

Sun, 20 Mar 2011 18:18:12 +0100

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 20 Mar 2011 18:18:12 +0100
changeset 953
7c42d54ba205
parent 952
cc3e2e5558e9
child 954
a096fdc38f71

Added support for search schemes ("s:" or "search:") and "about:home" to the web browser.

Documentation/Help/source.qch file | annotate | diff | comparison | revisions
Helpviewer/HelpTabWidget.py file | annotate | diff | comparison | revisions
changelog file | annotate | diff | comparison | revisions
Binary file Documentation/Help/source.qch has changed
--- a/Helpviewer/HelpTabWidget.py	Sun Mar 20 17:10:35 2011 +0100
+++ b/Helpviewer/HelpTabWidget.py	Sun Mar 20 18:18:12 2011 +0100
@@ -665,10 +665,11 @@
         Private slot to handle the entering of an URL.
         """
         edit = self.sender()
+        url = self.__guessUrlFromPath(edit.text())
         if e5App().keyboardModifiers() == Qt.AltModifier:
-            self.newBrowser(edit.text())
+            self.newBrowser(url)
         else:
-            self.currentBrowser().setSource(QUrl(edit.text()))
+            self.currentBrowser().setSource(url)
             self.currentBrowser().setFocus()
     
     def __pathSelected(self, path):
@@ -694,9 +695,25 @@
             return url
         
         try:
-            return QUrl.fromUserInput(path)
+            url = QUrl.fromUserInput(path)
         except AttributeError:
-            return QUrl(path)
+            url = QUrl(path)
+        
+        if url.scheme() == "about" and \
+           url.path() == "home":
+            url = QUrl("pyrc:home")
+        
+        if url.scheme() in ["s", "search"]:
+            url = manager.currentEngine().searchUrl(url.path().strip())
+        
+        if url.scheme() != "" and \
+           (url.host() != "" or url.path() != ""):
+            return url
+        
+        urlString = Preferences.getHelp("DefaultScheme") + path.strip()
+        url = QUrl.fromEncoded(urlString.encode(), QUrl.TolerantMode)
+        
+        return url
     
     def __currentChanged(self, index):
         """
--- a/changelog	Sun Mar 20 17:10:35 2011 +0100
+++ b/changelog	Sun Mar 20 18:18:12 2011 +0100
@@ -15,6 +15,8 @@
   (as of QScintilla 2.5)
 - added support for new lexer properties (as of QScintilla 2.5)
 - added support for access keys and drag & drop to the web browser
+- added support for search schemes ("s:" or "search:") and "about:home" to
+  the web browser
 
 Version 5.1-snapshot-20110123:
 - bug fixes

eric ide

mercurial