mirror of
https://invent.kde.org/network/falkon.git
synced 2024-12-20 18:56:34 +01:00
[FTP] fixed problem with 'link to file'+show shortcut icon for links
This commit is contained in:
parent
06ad80583c
commit
17591ce89f
@ -121,7 +121,9 @@ void FtpSchemeReply::processCommand(int id, bool err)
|
|||||||
case QFtp::List:
|
case QFtp::List:
|
||||||
if (m_isGoingToDownload) {
|
if (m_isGoingToDownload) {
|
||||||
foreach(const QUrlInfo & item, m_items) {
|
foreach(const QUrlInfo & item, m_items) {
|
||||||
if (item.isFile() && item.name() == m_probablyFileForDownload) {
|
// don't check if it's a file or not,
|
||||||
|
// seems it's a QFtp's bug: for link to a file isDir() returns true
|
||||||
|
if (item.name() == m_probablyFileForDownload) {
|
||||||
QByteArray decodedUrl = QByteArray::fromPercentEncoding(url().toString().toUtf8());
|
QByteArray decodedUrl = QByteArray::fromPercentEncoding(url().toString().toUtf8());
|
||||||
if (QzTools::isUtf8(decodedUrl.constData())) {
|
if (QzTools::isUtf8(decodedUrl.constData())) {
|
||||||
m_request.setUrl(QUrl(QString::fromUtf8(decodedUrl)));
|
m_request.setUrl(QUrl(QString::fromUtf8(decodedUrl)));
|
||||||
@ -302,10 +304,19 @@ QString FtpSchemeReply::loadDirectory()
|
|||||||
itemPath.remove(itemPath.size() - 1, 1);
|
itemPath.remove(itemPath.size() - 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QIcon itemIcon;
|
||||||
|
if (item.isSymLink()) {
|
||||||
|
itemIcon = qIconProvider->standardIcon(QStyle::SP_DirLinkIcon);
|
||||||
|
}
|
||||||
|
else if (item.isFile()) {
|
||||||
|
itemIcon = QzTools::iconFromFileName(itemPath);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
itemIcon = QFileIconProvider().icon(QFileIconProvider::Folder);
|
||||||
|
}
|
||||||
|
|
||||||
line += QLatin1String("><td class=\"td-name\" style=\"background-image:url(data:image/png;base64,");
|
line += QLatin1String("><td class=\"td-name\" style=\"background-image:url(data:image/png;base64,");
|
||||||
line += QzTools::pixmapToByteArray(item.isFile()
|
line += QzTools::pixmapToByteArray(itemIcon.pixmap(16));
|
||||||
? QzTools::iconFromFileName(itemPath).pixmap(16)
|
|
||||||
: QFileIconProvider().icon(QFileIconProvider::Folder).pixmap(16));
|
|
||||||
line += QLatin1String(");\">");
|
line += QLatin1String(");\">");
|
||||||
line += QLatin1String("<a href=\"");
|
line += QLatin1String("<a href=\"");
|
||||||
line += itemUrl.toEncoded();
|
line += itemUrl.toEncoded();
|
||||||
|
Loading…
Reference in New Issue
Block a user