summaryrefslogtreecommitdiff
path: root/Applications/FileManager
diff options
context:
space:
mode:
authorAndreas Kling <awesomekling@gmail.com>2019-03-22 12:54:27 +0100
committerAndreas Kling <awesomekling@gmail.com>2019-03-22 12:54:27 +0100
commit9d4b4c2689578b2c059bdcecd33c5eea8b5771e4 (patch)
treed6efd03e04a419d49137ccf0fda2da60f6b80e27 /Applications/FileManager
parent5ca62f356bc304c4c34cad9f63e6309eb624fdc3 (diff)
downloadserenity-9d4b4c2689578b2c059bdcecd33c5eea8b5771e4.zip
FileManager: Add a default icon for image files.
Diffstat (limited to 'Applications/FileManager')
-rw-r--r--Applications/FileManager/DirectoryTableModel.cpp3
-rw-r--r--Applications/FileManager/DirectoryTableModel.h1
2 files changed, 4 insertions, 0 deletions
diff --git a/Applications/FileManager/DirectoryTableModel.cpp b/Applications/FileManager/DirectoryTableModel.cpp
index 6cae3a9d83..6b093a6181 100644
--- a/Applications/FileManager/DirectoryTableModel.cpp
+++ b/Applications/FileManager/DirectoryTableModel.cpp
@@ -14,6 +14,7 @@ DirectoryTableModel::DirectoryTableModel()
m_symlink_icon = GraphicsBitmap::load_from_file("/res/icons/link16.png");
m_socket_icon = GraphicsBitmap::load_from_file("/res/icons/socket16.png");
m_executable_icon = GraphicsBitmap::load_from_file("/res/icons/executable16.png");
+ m_filetype_image_icon = GraphicsBitmap::load_from_file("/res/icons/16x16/filetype-image.png");
setpwent();
while (auto* passwd = getpwent())
@@ -78,6 +79,8 @@ const GraphicsBitmap& DirectoryTableModel::icon_for(const Entry& entry) const
return *m_socket_icon;
if (entry.mode & S_IXUSR)
return *m_executable_icon;
+ if (entry.name.ends_with(".png"))
+ return *m_filetype_image_icon;
return *m_file_icon;
}
diff --git a/Applications/FileManager/DirectoryTableModel.h b/Applications/FileManager/DirectoryTableModel.h
index f89251b16c..44fd01e524 100644
--- a/Applications/FileManager/DirectoryTableModel.h
+++ b/Applications/FileManager/DirectoryTableModel.h
@@ -67,6 +67,7 @@ private:
RetainPtr<GraphicsBitmap> m_symlink_icon;
RetainPtr<GraphicsBitmap> m_socket_icon;
RetainPtr<GraphicsBitmap> m_executable_icon;
+ RetainPtr<GraphicsBitmap> m_filetype_image_icon;
HashMap<uid_t, String> m_user_names;
HashMap<gid_t, String> m_group_names;