diff options
author | ZackaryWelch <welch.zackary@gmail.com> | 2018-04-18 11:37:51 -0400 |
---|---|---|
committer | ZackaryWelch <welch.zackary@gmail.com> | 2018-04-18 11:37:51 -0400 |
commit | 727a1a17ecf0b534b7d6132326849b9efb760c07 (patch) | |
tree | f210f19bad2f19420fbbe175e1b886fdb64b8d9f /src-qt5/core/libLumina | |
parent | Muted unused variable warnings in the Poppler backend (diff) | |
parent | Clean up the default fluxbox key bindings: (diff) | |
download | lumina-727a1a17ecf0b534b7d6132326849b9efb760c07.tar.gz lumina-727a1a17ecf0b534b7d6132326849b9efb760c07.tar.bz2 lumina-727a1a17ecf0b534b7d6132326849b9efb760c07.zip |
Merge branch 'master' of http://github.com/trueos/lumina
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r-- | src-qt5/core/libLumina/LFileInfo.cpp | 45 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LFileInfo.h | 3 |
2 files changed, 26 insertions, 22 deletions
diff --git a/src-qt5/core/libLumina/LFileInfo.cpp b/src-qt5/core/libLumina/LFileInfo.cpp index e7d2b71a..3b659c75 100644 --- a/src-qt5/core/libLumina/LFileInfo.cpp +++ b/src-qt5/core/libLumina/LFileInfo.cpp @@ -35,29 +35,37 @@ void LFileInfo::loadExtraInfo(){ mime = "inode/directory"; //Special directory icons QString name = this->fileName().toLower(); - if(name=="desktop"){ icon = "user-desktop"; } - else if(name=="tmp"){ icon = "folder-temp"; } - else if(name=="video" || name=="videos"){ icon = "folder-video"; } - else if(name=="music" || name=="audio"){ icon = "folder-sound"; } - else if(name=="projects" || name=="devel"){ icon = "folder-development"; } - else if(name=="notes"){ icon = "folder-txt"; } - else if(name=="downloads"){ icon = "folder-downloads"; } - else if(name=="documents"){ icon = "folder-documents"; } - else if(name=="images" || name=="pictures"){ icon = "folder-image"; } - else if(this->absoluteFilePath().startsWith("/net/")){ icon = "folder-remote"; } - else if( !this->isReadable() ){ icon = "folder-locked"; } + if(name=="desktop"){ iconList << "user-desktop"; } + else if(name=="tmp"){ iconList << "folder-temp"; } + else if(name=="video" || name=="videos"){ iconList << "folder-video" << "camera-photo-film" ; } + else if(name=="music" || name=="audio"){ iconList << "folder-sound" << "media-playlist-audio"; } + else if(name=="projects" || name=="devel"){ iconList << "folder-development"; } + else if(name=="notes"){ iconList << "folder-txt" << "note-multiple-outline" << "note-multiple"; } + else if(name=="downloads"){ iconList << "folder-downloads" << "folder-download"; } + else if(name=="documents"){ iconList << "folder-documents"; } + else if(name=="images" || name=="pictures"){ iconList << "folder-image"; } + else if(this->absoluteFilePath().startsWith("/net/")){ iconList << "folder-remote"; } + else if( !this->isReadable() ){ iconList << "folder-locked"<< "folder-lock"; } + iconList << "folder"; }else if( this->suffix()=="desktop"){ mime = "application/x-desktop"; - icon = "application-x-desktop"; //default value + iconList << "application-x-desktop"; //default value desk = new XDGDesktop(this->absoluteFilePath(), 0); if(desk->type!=XDGDesktop::BAD){ //use the specific desktop file info (if possible) - if(!desk->icon.isEmpty()){ icon = desk->icon; } + if(!desk->icon.isEmpty()){ iconList << desk->icon; } } }else{ //Generic file, just determine the mimetype mime = LXDG::findAppMimeForFile(this->fileName()); } + //check the mimetype for an icon as needed + QString tmp = mime; + tmp.replace("/","-"); + iconList << tmp; + if(this->isExecutable()){ + iconList << "application-x-executable"; + } } bool LFileInfo::zfsAvailable(){ @@ -94,14 +102,9 @@ QString LFileInfo::mimetype(){ // -- Return the icon to use for this file QString LFileInfo::iconfile(){ - if(!icon.isEmpty()){ - return icon; - }else if(!mime.isEmpty()){ - QString tmp = mime; - tmp.replace("/","-"); - return tmp; - }else if(this->isExecutable()){ - return "application-x-executable"; + //Go through the icon list and find the first one that exists in the current theme + for(int i=0; i<iconList.length(); i++){ + if( QIcon::hasThemeIcon(iconList[i])){ return iconList[i]; } } return ""; //Fall back to nothing } diff --git a/src-qt5/core/libLumina/LFileInfo.h b/src-qt5/core/libLumina/LFileInfo.h index df1abb65..f72c8649 100644 --- a/src-qt5/core/libLumina/LFileInfo.h +++ b/src-qt5/core/libLumina/LFileInfo.h @@ -17,7 +17,8 @@ class LFileInfo : public QFileInfo{ private: - QString mime, icon, zfs_ds; + QString mime, zfs_ds; + QStringList iconList; XDGDesktop *desk; void loadExtraInfo(); |