From 06ad80583cb567a98dcd863e718a3f8d1ab22f81 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Fri, 22 Feb 2013 01:25:28 +0330 Subject: [PATCH 1/3] IconProvider: fixed, return a fallback icon on non-linux OSes --- src/lib/data/icons.qrc | 1 + src/lib/data/icons/faenza/go-up.png | Bin 0 -> 494 bytes src/lib/tools/iconprovider.cpp | 13 ++++++------- 3 files changed, 7 insertions(+), 7 deletions(-) create mode 100644 src/lib/data/icons/faenza/go-up.png diff --git a/src/lib/data/icons.qrc b/src/lib/data/icons.qrc index 2617cc71d..14510c25e 100644 --- a/src/lib/data/icons.qrc +++ b/src/lib/data/icons.qrc @@ -6,6 +6,7 @@ icons/preferences/applications-system.png icons/preferences/applications-webbrowsers.png icons/preferences/preferences-desktop.png + icons/faenza/go-up.png icons/faenza/back.png icons/faenza/close.png icons/faenza/forward.png diff --git a/src/lib/data/icons/faenza/go-up.png b/src/lib/data/icons/faenza/go-up.png new file mode 100644 index 0000000000000000000000000000000000000000..b82d7a992d61f84dd2b2a099b76e3b4bb4b2c7d0 GIT binary patch literal 494 zcmVzaf)kBl_gc8hW;0R51DE+b_YC*U9VH_C2aO-j6tE2l zke1^TydMO*K@gk-L2wFmSF%LJ6>CY743ttsrPMG?_c{>fpM$V zx&|1HMhC!tRiM#m+-j{K%H_9-^;RwbM5N%;yl>2AvqEcK)cEedptTl0jr$c&fquVl kMdZ1*J#}&Gjr3=H0E{cixm!I+_5c6?07*qoM6N<$g0bhzSO5S3 literal 0 HcmV?d00001 diff --git a/src/lib/tools/iconprovider.cpp b/src/lib/tools/iconprovider.cpp index ef1e59069..5553d3e90 100644 --- a/src/lib/tools/iconprovider.cpp +++ b/src/lib/tools/iconprovider.cpp @@ -158,10 +158,7 @@ QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon) case QStyle::SP_MessageBoxWarning: return QIcon::fromTheme("dialog-warning", mApp->style()->standardIcon(QStyle::SP_MessageBoxWarning)); -#ifdef QZ_WS_X11 - default: - return mApp->style()->standardIcon(icon); -#else +#ifndef QZ_WS_X11 case QStyle::SP_DialogCloseButton: return QIcon(":/icons/faenza/close.png"); @@ -171,6 +168,9 @@ QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon) case QStyle::SP_BrowserReload: return QIcon(":/icons/faenza/reload.png"); + case QStyle::SP_FileDialogToParent: + return QIcon(":/icons/faenza/go-up.png"); + case QStyle::SP_ArrowForward: //RTL Support if (QApplication::layoutDirection() == Qt::RightToLeft) { @@ -188,10 +188,9 @@ QIcon IconProvider::standardIcon(QStyle::StandardPixmap icon) else { return QIcon(":/icons/faenza/back.png"); } - - default: - return QIcon(); #endif + default: + return mApp->style()->standardIcon(icon); } } From 17591ce89fcc8c476f303f59b830f5e79474bc55 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Fri, 22 Feb 2013 01:28:22 +0330 Subject: [PATCH 2/3] [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(" Date: Fri, 22 Feb 2013 03:43:59 +0330 Subject: [PATCH 3/3] Used qIconProvider instead of QFileIconProvider() and removed msgHandler on Windows. --- src/lib/network/schemehandlers/ftpschemehandler.cpp | 2 +- src/main/main.cpp | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib/network/schemehandlers/ftpschemehandler.cpp b/src/lib/network/schemehandlers/ftpschemehandler.cpp index bab7b7225..ec074ee5c 100644 --- a/src/lib/network/schemehandlers/ftpschemehandler.cpp +++ b/src/lib/network/schemehandlers/ftpschemehandler.cpp @@ -312,7 +312,7 @@ QString FtpSchemeReply::loadDirectory() itemIcon = QzTools::iconFromFileName(itemPath); } else { - itemIcon = QFileIconProvider().icon(QFileIconProvider::Folder); + itemIcon = qIconProvider->standardIcon(QStyle::SP_DirIcon); } line += QLatin1String(">