272 if lines[1][:3] == "530": |
272 if lines[1][:3] == "530": |
273 if "usage" in "\n".join(lines[1:].lower()): |
273 if "usage" in "\n".join(lines[1:].lower()): |
274 # found a not supported proxy |
274 # found a not supported proxy |
275 self.setError( |
275 self.setError( |
276 QNetworkReply.ProxyConnectionRefusedError, |
276 QNetworkReply.ProxyConnectionRefusedError, |
277 self.trUtf8("The proxy type seems to be wrong." |
277 self.tr("The proxy type seems to be wrong." |
278 " If it is not in the list of" |
278 " If it is not in the list of" |
279 " supported proxy types please report" |
279 " supported proxy types please report" |
280 " it with the instructions given by" |
280 " it with the instructions given by" |
281 " the proxy.\n{0}").format( |
281 " the proxy.\n{0}").format( |
282 "\n".join(lines[1:]))) |
282 "\n".join(lines[1:]))) |
283 self.error.emit( |
283 self.error.emit( |
284 QNetworkReply.ProxyConnectionRefusedError) |
284 QNetworkReply.ProxyConnectionRefusedError) |
285 return False, False |
285 return False, False |
286 else: |
286 else: |
287 from UI.AuthenticationDialog import \ |
287 from UI.AuthenticationDialog import \ |
288 AuthenticationDialog |
288 AuthenticationDialog |
289 info = self.trUtf8( |
289 info = self.tr( |
290 "<b>Connect to proxy '{0}' using:</b>")\ |
290 "<b>Connect to proxy '{0}' using:</b>")\ |
291 .format(Utilities.html_encode( |
291 .format(Utilities.html_encode( |
292 Preferences.getUI("ProxyHost/Ftp"))) |
292 Preferences.getUI("ProxyHost/Ftp"))) |
293 dlg = AuthenticationDialog( |
293 dlg = AuthenticationDialog( |
294 info, Preferences.getUI("ProxyUser/Ftp"), True) |
294 info, Preferences.getUI("ProxyUser/Ftp"), True) |
419 parent = u.resolved(QUrl("..")) |
419 parent = u.resolved(QUrl("..")) |
420 if parent.isParentOf(u): |
420 if parent.isParentOf(u): |
421 icon = UI.PixmapCache.getIcon("up.png") |
421 icon = UI.PixmapCache.getIcon("up.png") |
422 linkClasses["link_parent"] = \ |
422 linkClasses["link_parent"] = \ |
423 self.__cssLinkClass(icon, iconSize).format("link_parent") |
423 self.__cssLinkClass(icon, iconSize).format("link_parent") |
424 parentStr = self.trUtf8( |
424 parentStr = self.tr( |
425 """ <p><a class="link_parent" href="{0}">""" |
425 """ <p><a class="link_parent" href="{0}">""" |
426 """Change to parent directory</a></p>""" |
426 """Change to parent directory</a></p>""" |
427 ).format(parent.toString()) |
427 ).format(parent.toString()) |
428 else: |
428 else: |
429 parentStr = "" |
429 parentStr = "" |
432 """ <tr class="{0}">"""\ |
432 """ <tr class="{0}">"""\ |
433 """<td class="name"><a class="{1}" href="{2}">{3}</a></td>"""\ |
433 """<td class="name"><a class="{1}" href="{2}">{3}</a></td>"""\ |
434 """<td class="size">{4}</td>"""\ |
434 """<td class="size">{4}</td>"""\ |
435 """<td class="modified">{5}</td>"""\ |
435 """<td class="modified">{5}</td>"""\ |
436 """</tr>\n""" |
436 """</tr>\n""" |
437 table = self.trUtf8( |
437 table = self.tr( |
438 """ <tr>""" |
438 """ <tr>""" |
439 """<th align="left">Name</th>""" |
439 """<th align="left">Name</th>""" |
440 """<th>Size</th>""" |
440 """<th>Size</th>""" |
441 """<th align="left">Last modified</th>""" |
441 """<th align="left">Last modified</th>""" |
442 """</tr>\n""" |
442 """</tr>\n""" |
458 size = newSize |
458 size = newSize |
459 unit += 1 |
459 unit += 1 |
460 else: |
460 else: |
461 break |
461 break |
462 |
462 |
463 sizeStr = self.trUtf8("{0} {1}", "size unit")\ |
463 sizeStr = self.tr("{0} {1}", "size unit")\ |
464 .format(size, self.__units[unit]) |
464 .format(size, self.__units[unit]) |
465 linkClass = "link_file" |
465 linkClass = "link_file" |
466 if linkClass not in linkClasses: |
466 if linkClass not in linkClasses: |
467 icon = UI.PixmapCache.getIcon("fileMisc.png") |
467 icon = UI.PixmapCache.getIcon("fileMisc.png") |
468 linkClasses[linkClass] = \ |
468 linkClasses[linkClass] = \ |
485 i = 1 - i |
485 i = 1 - i |
486 |
486 |
487 content = ftpListPage_html.format( |
487 content = ftpListPage_html.format( |
488 Utilities.html_encode(baseUrl), |
488 Utilities.html_encode(baseUrl), |
489 "".join(linkClasses.values()), |
489 "".join(linkClasses.values()), |
490 self.trUtf8("Listing of {0}").format(basePath), |
490 self.tr("Listing of {0}").format(basePath), |
491 parentStr, |
491 parentStr, |
492 table |
492 table |
493 ) |
493 ) |
494 self.__content = QByteArray(content.encode("utf8")) |
494 self.__content = QByteArray(content.encode("utf8")) |
495 self.__content.append(512 * b' ') |
495 self.__content.append(512 * b' ') |