Helpviewer/Network/QtHelpAccessHandler.py

Sun, 26 Sep 2010 15:18:07 +0200

author
Detlev Offenbach <detlev@die-offenbachs.de>
date
Sun, 26 Sep 2010 15:18:07 +0200
changeset 641
b06d4df23797
parent 168
3383117f894b
child 791
9ec2ac20e54e
permissions
-rw-r--r--

Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.

0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
1 # -*- coding: utf-8 -*-
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
2
13
1af94a91f439 Changed copyright for 2010.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 12
diff changeset
3 # Copyright (c) 2009 - 2010 Detlev Offenbach <detlev@die-offenbachs.de>
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
4 #
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
5
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
6 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
7 Module implementing a scheme access handler for QtHelp.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
8 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
9
641
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
10 import mimetypes
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
11 import os
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
12
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
13 from PyQt4.QtCore import QByteArray
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
14
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
15 from .SchemeAccessHandler import SchemeAccessHandler
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
16
12
1d8dd9706f46 First commit after changing to Python 3.1.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 0
diff changeset
17 from .NetworkReply import NetworkReply
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
18
641
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
19 QtDocPath = "qthelp://com.trolltech."
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
20
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
21 ExtensionMap = {
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
22 ".bmp" : "image/bmp",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
23 ".css" : "text/css",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
24 ".gif" : "image/gif",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
25 ".html" : "text/html",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
26 ".htm" : "text/html",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
27 ".ico" : "image/x-icon",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
28 ".jpeg" : "image/jpeg",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
29 ".jpg" : "image/jpeg",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
30 ".js" : "application/x-javascript",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
31 ".mng" : "video/x-mng",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
32 ".pbm" : "image/x-portable-bitmap",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
33 ".pgm" : "image/x-portable-graymap",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
34 ".pdf" : "application/pdf",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
35 ".png" : "image/png",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
36 ".ppm" : "image/x-portable-pixmap",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
37 ".rss" : "application/rss+xml",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
38 ".svg" : "image/svg+xml",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
39 ".svgz" : "image/svg+xml",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
40 ".text" : "text/plain",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
41 ".tif" : "image/tiff",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
42 ".tiff" : "image/tiff",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
43 ".txt" : "text/plain",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
44 ".xbm" : "image/x-xbitmap",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
45 ".xml" : "text/xml",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
46 ".xpm" : "image/x-xpm",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
47 ".xsl" : "text/xsl",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
48 ".xhtml" : "application/xhtml+xml",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
49 ".wml" : "text/vnd.wap.wml",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
50 ".wmlc" : "application/vnd.wap.wmlc",
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
51 }
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
52
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
53 class QtHelpAccessHandler(SchemeAccessHandler):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
54 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
55 Class implementing a scheme access handler for QtHelp.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
56 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
57 def __init__(self, engine, parent = None):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
58 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
59 Constructor
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
60
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
61 @param engine reference to the help engine (QHelpEngine)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
62 @param parent reference to the parent object (QObject)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
63 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
64 SchemeAccessHandler.__init__(self, parent)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
65
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
66 self.__engine = engine
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
67
641
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
68 def __mimeFromUrl(self, url):
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
69 """
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
70 Private method to guess the mime type given an URL.
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
71
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
72 @param url URL to guess the mime type from (QUrl)
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
73 """
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
74 path = url.path()
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
75 ext = os.path.splitext(path)[1].lower()
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
76 if ext in ExtensionMap:
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
77 return ExtensionMap[ext]
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
78 else:
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
79 return "application/octet-stream"
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
80
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
81 def createRequest(self, op, request, outgoingData = None):
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
82 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
83 Protected method to create a request.
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
84
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
85 @param op the operation to be performed (QNetworkAccessManager.Operation)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
86 @param request reference to the request object (QNetworkRequest)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
87 @param outgoingData reference to an IODevice containing data to be sent
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
88 (QIODevice)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
89 @return reference to the created reply object (QNetworkReply)
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
90 """
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
91 url = request.url()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
92 strUrl = url.toString()
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
93
641
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
94 # For some reason the url to load is already wrong (passed from webkit)
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
95 # though the css file and the references inside should work that way. One
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
96 # possible problem might be that the css is loaded at the same level as the
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
97 # html, thus a path inside the css like (../images/foo.png) might cd out of
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
98 # the virtual folder
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
99 if not self.__engine.findFile(url).isValid():
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
100 if strUrl.startswith(QtDocPath):
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
101 newUrl = request.url()
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
102 if not newUrl.path().startswith("/qdoc/"):
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
103 newUrl.setPath("qdoc" + newUrl.path())
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
104 url = newUrl
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
105 strUrl = url.toString()
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
106
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
107 mimeType = mimetypes.guess_type(strUrl)[0]
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
108 if mimeType is None:
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
109 # do our own (limited) guessing
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
110 mimeType = self.__mimeFromUrl(url)
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
111
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
112 if self.__engine.findFile(url).isValid():
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
113 data = self.__engine.fileData(url)
0
de9c2efb9d02 Started porting eric4 to Python3
Detlev Offenbach <detlev@die-offenbachs.de>
parents:
diff changeset
114 else:
641
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
115 data = QByteArray(self.trUtf8("""<title>Error 404...</title>"""
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
116 """<div align="center"><br><br>"""
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
117 """<h1>The page could not be found</h1><br>"""
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
118 """<h3>'{0}'</h3></div>""").format(strUrl).encode("utf-8"))
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
119 return NetworkReply(request, data, mimeType, self.parent())
b06d4df23797 Fixed an issue in the web browser related to webkit and Qt help and fixed an issue introduced by the latest refactoring.
Detlev Offenbach <detlev@die-offenbachs.de>
parents: 168
diff changeset
120

eric ide

mercurial