summaryrefslogtreecommitdiff
path: root/src/gui/itemviews
diff options
context:
space:
mode:
authorArnt Witteveen <arntw@enfocus.com>2012-03-19 12:23:29 +0100
committerQt by Nokia <qt-info@nokia.com>2012-03-19 15:13:43 +0100
commitc0b782e8c516245bd534542f3682e7e25a33c414 (patch)
treead83f3b8213a696302d91baff390e3cf21c66100 /src/gui/itemviews
parent69f84b9514f8f22d27590ac890dbd20aec369702 (diff)
downloadqt4-tools-c0b782e8c516245bd534542f3682e7e25a33c414.tar.gz
Cherry picking qt5 bugfix 437da962c2b486b1a1722aac003bfa00b93ac204 to qt4.
Original description for bugfix: Fix bug showing folder icons for files Fix an issue where the cache was updated with the folder icon, even though this is never used from the cache. This caused files to sometimes be shown with a folder icon: If a folder has an extension (e.g. a folder named 'folder.ext'), this means the folder icon will be written to the cache for the 'ext' extension, and from that point on all .ext files will be shown with the folder icon. The fix is to not save an icon in the cache for those cases where it will not be used from the cache anyway, by using the same condition for updating the cache as for reading it (which is in line 8 of the same function). Change-Id: I349526ff017b1a2409e3dcc494b86bb541740790 Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Diffstat (limited to 'src/gui/itemviews')
-rw-r--r--src/gui/itemviews/qfileiconprovider.cpp18
1 files changed, 10 insertions, 8 deletions
diff --git a/src/gui/itemviews/qfileiconprovider.cpp b/src/gui/itemviews/qfileiconprovider.cpp
index 99100f12e2..d9446c7cbd 100644
--- a/src/gui/itemviews/qfileiconprovider.cpp
+++ b/src/gui/itemviews/qfileiconprovider.cpp
@@ -378,14 +378,16 @@ QIcon QFileIconProviderPrivate::getMacIcon(const QFileInfo &fi) const
qt_mac_constructQIconFromIconRef(iconRef, 0, &retIcon);
ReleaseIconRef(iconRef);
- pixmap = retIcon.pixmap(16);
- QPixmapCache::insert(keyBase + QLatin1String("16"), pixmap);
- pixmap = retIcon.pixmap(32);
- QPixmapCache::insert(keyBase + QLatin1String("32"), pixmap);
- pixmap = retIcon.pixmap(64);
- QPixmapCache::insert(keyBase + QLatin1String("64"), pixmap);
- pixmap = retIcon.pixmap(128);
- QPixmapCache::insert(keyBase + QLatin1String("128"), pixmap);
+ if (fi.isFile() && !fi.isExecutable() && !fi.isSymLink()) {
+ pixmap = retIcon.pixmap(16);
+ QPixmapCache::insert(keyBase + QLatin1String("16"), pixmap);
+ pixmap = retIcon.pixmap(32);
+ QPixmapCache::insert(keyBase + QLatin1String("32"), pixmap);
+ pixmap = retIcon.pixmap(64);
+ QPixmapCache::insert(keyBase + QLatin1String("64"), pixmap);
+ pixmap = retIcon.pixmap(128);
+ QPixmapCache::insert(keyBase + QLatin1String("128"), pixmap);
+ }
return retIcon;
}