From 17591ce89fcc8c476f303f59b830f5e79474bc55 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Fri, 22 Feb 2013 01:28:22 +0330 Subject: [PATCH] [FTP] fixed problem with 'link to file'+show shortcut icon for links --- .../schemehandlers/ftpschemehandler.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/lib/network/schemehandlers/ftpschemehandler.cpp b/src/lib/network/schemehandlers/ftpschemehandler.cpp index 15e7834db..bab7b7225 100644 --- a/src/lib/network/schemehandlers/ftpschemehandler.cpp +++ b/src/lib/network/schemehandlers/ftpschemehandler.cpp @@ -121,7 +121,9 @@ void FtpSchemeReply::processCommand(int id, bool err) case QFtp::List: if (m_isGoingToDownload) { 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()); if (QzTools::isUtf8(decodedUrl.constData())) { m_request.setUrl(QUrl(QString::fromUtf8(decodedUrl))); @@ -302,10 +304,19 @@ QString FtpSchemeReply::loadDirectory() 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(">"); line += QLatin1String("