31 <head> |
31 <head> |
32 <title>{0}</title> |
32 <title>{0}</title> |
33 <style type="text/css"> |
33 <style type="text/css"> |
34 body {{ |
34 body {{ |
35 padding: 3em 0em; |
35 padding: 3em 0em; |
36 background: -webkit-gradient(linear, left top, left bottom, from(#85784A), to(#FDFDFD), color-stop(0.5, #FDFDFD)); |
36 background: -webkit-gradient(linear, left top, left bottom, from(#85784A), |
|
37 to(#FDFDFD), color-stop(0.5, #FDFDFD)); |
37 background-repeat: repeat-x; |
38 background-repeat: repeat-x; |
38 }} |
39 }} |
39 #box {{ |
40 #box {{ |
40 background: white; |
41 background: white; |
41 border: 1px solid #85784A; |
42 border: 1px solid #85784A; |
111 @param parent reference to the parent object (QObject) |
112 @param parent reference to the parent object (QObject) |
112 """ |
113 """ |
113 super(FileReply, self).__init__(parent) |
114 super(FileReply, self).__init__(parent) |
114 |
115 |
115 self.__content = QByteArray() |
116 self.__content = QByteArray() |
116 self.__units = ["Bytes", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"] |
117 self.__units = ["Bytes", "KB", "MB", "GB", "TB", |
|
118 "PB", "EB", "ZB", "YB"] |
117 |
119 |
118 if url.path() == "": |
120 if url.path() == "": |
119 url.setPath("/") |
121 url.setPath("/") |
120 self.setUrl(url) |
122 self.setUrl(url) |
121 |
123 |
166 @return CSS class string (string) |
168 @return CSS class string (string) |
167 """ |
169 """ |
168 cssString = \ |
170 cssString = \ |
169 """a.{{0}} {{{{\n"""\ |
171 """a.{{0}} {{{{\n"""\ |
170 """ padding-left: {0}px;\n"""\ |
172 """ padding-left: {0}px;\n"""\ |
171 """ background: transparent url(data:image/png;base64,{1}) no-repeat center left;\n"""\ |
173 """ background: transparent url(data:image/png;base64,{1})"""\ |
|
174 """ no-repeat center left;\n"""\ |
172 """ font-weight: bold;\n"""\ |
175 """ font-weight: bold;\n"""\ |
173 """}}}}\n""" |
176 """}}}}\n""" |
174 pixmap = icon.pixmap(size, size) |
177 pixmap = icon.pixmap(size, size) |
175 imageBuffer = QBuffer() |
178 imageBuffer = QBuffer() |
176 imageBuffer.open(QIODevice.ReadWrite) |
179 imageBuffer.open(QIODevice.ReadWrite) |
186 def __loadDirectory(self): |
189 def __loadDirectory(self): |
187 """ |
190 """ |
188 Private slot loading the directory and preparing the listing page. |
191 Private slot loading the directory and preparing the listing page. |
189 """ |
192 """ |
190 dir = QDir(self.url().toLocalFile()) |
193 dir = QDir(self.url().toLocalFile()) |
191 dirItems = dir.entryInfoList(QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot, |
194 dirItems = dir.entryInfoList( |
192 QDir.Name | QDir.DirsFirst) |
195 QDir.AllEntries | QDir.Hidden | QDir.NoDotAndDotDot, |
|
196 QDir.Name | QDir.DirsFirst) |
193 |
197 |
194 u = self.url() |
198 u = self.url() |
195 if not u.path().endswith("/"): |
199 if not u.path().endswith("/"): |
196 u.setPath(u.path() + "/") |
200 u.setPath(u.path() + "/") |
197 |
201 |
198 baseUrl = self.url().toString() |
202 baseUrl = self.url().toString() |
199 basePath = u.path() |
203 basePath = u.path() |
200 |
204 |
201 linkClasses = {} |
205 linkClasses = {} |
202 iconSize = QWebSettings.globalSettings().fontSize(QWebSettings.DefaultFontSize) |
206 iconSize = QWebSettings.globalSettings().fontSize( |
|
207 QWebSettings.DefaultFontSize) |
203 |
208 |
204 parent = u.resolved(QUrl("..")) |
209 parent = u.resolved(QUrl("..")) |
205 if parent.isParentOf(u): |
210 if parent.isParentOf(u): |
206 icon = UI.PixmapCache.getIcon("up.png") |
211 icon = UI.PixmapCache.getIcon("up.png") |
207 linkClasses["link_parent"] = \ |
212 linkClasses["link_parent"] = \ |
278 ) |
283 ) |
279 self.__content = QByteArray(content.encode("utf8")) |
284 self.__content = QByteArray(content.encode("utf8")) |
280 self.__content.append(512 * b' ') |
285 self.__content.append(512 * b' ') |
281 |
286 |
282 self.open(QIODevice.ReadOnly | QIODevice.Unbuffered) |
287 self.open(QIODevice.ReadOnly | QIODevice.Unbuffered) |
283 self.setHeader(QNetworkRequest.ContentTypeHeader, "text/html; charset=UTF-8") |
288 self.setHeader( |
284 self.setHeader(QNetworkRequest.ContentLengthHeader, self.__content.size()) |
289 QNetworkRequest.ContentTypeHeader, "text/html; charset=UTF-8") |
|
290 self.setHeader( |
|
291 QNetworkRequest.ContentLengthHeader, self.__content.size()) |
285 self.setAttribute(QNetworkRequest.HttpStatusCodeAttribute, 200) |
292 self.setAttribute(QNetworkRequest.HttpStatusCodeAttribute, 200) |
286 self.setAttribute(QNetworkRequest.HttpReasonPhraseAttribute, "Ok") |
293 self.setAttribute(QNetworkRequest.HttpReasonPhraseAttribute, "Ok") |
287 self.metaDataChanged.emit() |
294 self.metaDataChanged.emit() |
288 self.downloadProgress.emit(self.__content.size(), self.__content.size()) |
295 self.downloadProgress.emit( |
|
296 self.__content.size(), self.__content.size()) |
289 self.readyRead.emit() |
297 self.readyRead.emit() |
290 self.finished.emit() |
298 self.finished.emit() |