diff options
author | Mavridis Philippe <mavridisf@gmail.com> | 2024-05-25 22:58:17 +0300 |
---|---|---|
committer | Mavridis Philippe <mavridisf@gmail.com> | 2024-06-02 15:35:41 +0300 |
commit | a599fb978e4f3bc803f2e5963cb1a62d510aa795 (patch) | |
tree | a42b8bbc4f32830ad045e24e38c8580937fd4a4e | |
parent | b54bd51cf9345dada244dfbb96c49dc2c802fbf4 (diff) | |
download | tdebase-a599fb978e4f3bc803f2e5963cb1a62d510aa795.tar.gz tdebase-a599fb978e4f3bc803f2e5963cb1a62d510aa795.zip |
Kate: display file type icons in file list
Signed-off-by: Mavridis Philippe <mavridisf@gmail.com>
(cherry picked from commit 9bb299eeb6e47a050473c3a396ddf8758f11e3cc)
-rw-r--r-- | kate/app/katefilelist.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/kate/app/katefilelist.cpp b/kate/app/katefilelist.cpp index f8371585e..bb11cd6c7 100644 --- a/kate/app/katefilelist.cpp +++ b/kate/app/katefilelist.cpp @@ -48,6 +48,7 @@ #include <kstringhandler.h> #include <kcolorbutton.h> #include <kdialog.h> +#include <kmimetype.h> //END Includes //BEGIN ToolTip @@ -557,20 +558,27 @@ KateFileListItem::~KateFileListItem() { } + const TQPixmap *KateFileListItem::pixmap ( int column ) const { if ( column == 0) { - static TQPixmap noPm = SmallIcon ("null"); + static TQMap<TQString, TQPixmap> mimeIcons; static TQPixmap modPm = SmallIcon("modified"); static TQPixmap discPm = SmallIcon("modonhd"); static TQPixmap modmodPm = SmallIcon("modmod"); const KateDocumentInfo *info = KateDocManager::self()->documentInfo(doc); + KMimeType::Ptr mime = KMimeType::findByURL(doc->url()); + + if (!mimeIcons.contains(mime->name())) + { + mimeIcons.insert(mime->name(), mime->pixmap(TDEIcon::Small)); + } if (info && info->modifiedOnDisc) return doc->isModified() ? &modmodPm : &discPm; else - return doc->isModified() ? &modPm : &noPm; + return doc->isModified() ? &modPm : &mimeIcons[mime->name()]; } return 0; |