71 def __mimeFromUrl(self, url): |
71 def __mimeFromUrl(self, url): |
72 """ |
72 """ |
73 Private method to guess the mime type given an URL. |
73 Private method to guess the mime type given an URL. |
74 |
74 |
75 @param url URL to guess the mime type from (QUrl) |
75 @param url URL to guess the mime type from (QUrl) |
|
76 @return mime type for the given URL (string) |
76 """ |
77 """ |
77 path = url.path() |
78 path = url.path() |
78 ext = os.path.splitext(path)[1].lower() |
79 ext = os.path.splitext(path)[1].lower() |
79 if ext in ExtensionMap: |
80 if ext in ExtensionMap: |
80 return ExtensionMap[ext] |
81 return ExtensionMap[ext] |
83 |
84 |
84 def createRequest(self, op, request, outgoingData=None): |
85 def createRequest(self, op, request, outgoingData=None): |
85 """ |
86 """ |
86 Protected method to create a request. |
87 Protected method to create a request. |
87 |
88 |
88 @param op the operation to be performed (QNetworkAccessManager.Operation) |
89 @param op the operation to be performed |
|
90 (QNetworkAccessManager.Operation) |
89 @param request reference to the request object (QNetworkRequest) |
91 @param request reference to the request object (QNetworkRequest) |
90 @param outgoingData reference to an IODevice containing data to be sent |
92 @param outgoingData reference to an IODevice containing data to be sent |
91 (QIODevice) |
93 (QIODevice) |
92 @return reference to the created reply object (QNetworkReply) |
94 @return reference to the created reply object (QNetworkReply) |
93 """ |
95 """ |
94 url = request.url() |
96 url = request.url() |
95 strUrl = url.toString() |
97 strUrl = url.toString() |
96 |
98 |
97 # For some reason the url to load is already wrong (passed from webkit) |
99 # For some reason the url to load is already wrong (passed from webkit) |
98 # though the css file and the references inside should work that way. One |
100 # though the css file and the references inside should work that way. |
99 # possible problem might be that the css is loaded at the same level as the |
101 # One possible problem might be that the css is loaded at the same |
100 # html, thus a path inside the css like (../images/foo.png) might cd out of |
102 # level as the html, thus a path inside the css like |
101 # the virtual folder |
103 # (../images/foo.png) might cd out of the virtual folder |
102 if not self.__engine.findFile(url).isValid(): |
104 if not self.__engine.findFile(url).isValid(): |
103 if strUrl.startswith(QtDocPath): |
105 if strUrl.startswith(QtDocPath): |
104 newUrl = request.url() |
106 newUrl = request.url() |
105 if not newUrl.path().startswith("/qdoc/"): |
107 if not newUrl.path().startswith("/qdoc/"): |
106 newUrl.setPath("qdoc" + newUrl.path()) |
108 newUrl.setPath("qdoc" + newUrl.path()) |