aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--dev-tools/iconprobe/main.cpp5
-rw-r--r--src-qt5/core/libLumina/LFileInfo.cpp45
-rw-r--r--src-qt5/core/libLumina/LFileInfo.h3
3 files changed, 30 insertions, 23 deletions
diff --git a/dev-tools/iconprobe/main.cpp b/dev-tools/iconprobe/main.cpp
index 694292c3..06599bf7 100644
--- a/dev-tools/iconprobe/main.cpp
+++ b/dev-tools/iconprobe/main.cpp
@@ -51,7 +51,9 @@ int main(int argc, char ** argv)
QApplication a(argc, argv);
QString icondir="/usr/local/share/icons";
- QStringList iconfiles; iconfiles << "user-home" << "falkon" << "firefox" << "utilities-terminal";
+ QStringList iconfiles;
+ if(argc<2){ iconfiles << "folder-downloads" << "start-here-lumina" << "firefox" << "utilities-terminal"; }
+ else{ iconfiles = QString(argv[1]).split(" "); }
QDir dir(icondir);
QStringList themes = dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot, QDir::Name);
@@ -69,6 +71,7 @@ int main(int argc, char ** argv)
qDebug() << " -------------------------";
qDebug() << " - Looking for icon:" << iconfiles[j];
qDebug() << " - Found File:" << findInDir(themepath, iconfiles[j]);
+ qDebug() << " - Has Theme Icon:" << QIcon::hasThemeIcon(iconfiles[j]);
qDebug() << " - Found Icon:" << QIcon::fromTheme(iconfiles[j]).name();
}
qDebug() << " ================";
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();
bgstack15