1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Merge pull request #777 from srazi/master

[FTP] fixed problem with 'link to file'+show shortcut icon for links
This commit is contained in:
David Rosca 2013-02-22 00:04:26 -08:00
commit 915b972e48
5 changed files with 24 additions and 11 deletions

View File

@ -6,6 +6,7 @@
<file>icons/preferences/applications-system.png</file>
<file>icons/preferences/applications-webbrowsers.png</file>
<file>icons/preferences/preferences-desktop.png</file>
<file>icons/faenza/go-up.png</file>
<file>icons/faenza/back.png</file>
<file>icons/faenza/close.png</file>
<file>icons/faenza/forward.png</file>

Binary file not shown.

After

Width:  |  Height:  |  Size: 494 B

View File

@ -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 = qIconProvider->standardIcon(QStyle::SP_DirIcon);
}
line += QLatin1String("><td class=\"td-name\" style=\"background-image:url(data:image/png;base64,");
line += QzTools::pixmapToByteArray(item.isFile()
? QzTools::iconFromFileName(itemPath).pixmap(16)
: QFileIconProvider().icon(QFileIconProvider::Folder).pixmap(16));
line += QzTools::pixmapToByteArray(itemIcon.pixmap(16));
line += QLatin1String(");\">");
line += QLatin1String("<a href=\"");
line += itemUrl.toEncoded();

View File

@ -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);
}
}

View File

@ -161,11 +161,13 @@ int main(int argc, char* argv[])
{
QT_REQUIRE_VERSION(argc, argv, "4.7.0");
#ifndef Q_OS_WIN
#if (QT_VERSION < 0x050000)
qInstallMsgHandler(&msgHandler);
#else
qInstallMessageHandler(&msgHandler);
#endif
#endif
#if defined(QZ_WS_X11) && QT_VERSION < 0x050000
QApplication::setGraphicsSystem("raster"); // Better overall performance on X11