aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r--src-qt5/core/libLumina/LFileInfo.cpp15
-rw-r--r--src-qt5/core/libLumina/LFileInfo.h1
-rw-r--r--src-qt5/core/libLumina/LIconCache.cpp1
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.cpp5
4 files changed, 22 insertions, 0 deletions
diff --git a/src-qt5/core/libLumina/LFileInfo.cpp b/src-qt5/core/libLumina/LFileInfo.cpp
index 3021d74a..82e9ac50 100644
--- a/src-qt5/core/libLumina/LFileInfo.cpp
+++ b/src-qt5/core/libLumina/LFileInfo.cpp
@@ -133,10 +133,25 @@ QString LFileInfo::iconfile(){
//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]; }
+ else if(desk!=0 && iconList[i] == desk->icon){
+ //See if this icon is in the old "pixmaps" icon directory
+ QDir dir("/usr/local/share/pixmaps");
+ QStringList matches = dir.entryList(QStringList() << desk->icon+".png" << desk->icon+".jpg");
+ if(!matches.isEmpty()){
+ return dir.absoluteFilePath(matches.first());
+ }
+ }
}
return ""; //Fall back to nothing
}
+QIcon LFileInfo::icon(){
+ QString ifile = iconfile();
+ if(ifile.startsWith("/")){ return QIcon(ifile); }
+ else if(ifile.isEmpty()){ return QIcon::fromTheme("unknown"); }
+ else{ return QIcon::fromTheme(ifile); }
+}
+
// -- Check if this is an XDG desktop file
bool LFileInfo::isDesktopFile(){
if(desk==0){ return false; }
diff --git a/src-qt5/core/libLumina/LFileInfo.h b/src-qt5/core/libLumina/LFileInfo.h
index 21aae19d..94a113bc 100644
--- a/src-qt5/core/libLumina/LFileInfo.h
+++ b/src-qt5/core/libLumina/LFileInfo.h
@@ -40,6 +40,7 @@ public:
// -- Return the icon file to use for this file
QString iconfile(); //Note: This string is auto-formatted for use in the LXDG::findIcon() routine.
+ QIcon icon();
// -- Check if this is an XDG desktop file
bool isDesktopFile();
diff --git a/src-qt5/core/libLumina/LIconCache.cpp b/src-qt5/core/libLumina/LIconCache.cpp
index c3b0cc1b..03f818bb 100644
--- a/src-qt5/core/libLumina/LIconCache.cpp
+++ b/src-qt5/core/libLumina/LIconCache.cpp
@@ -122,6 +122,7 @@ QString LIconCache::findFile(QString icon){
void LIconCache::loadIcon(QAbstractButton *button, QString icon, bool noThumb){
if(icon.isEmpty()){ return; }
+ if(icon=="appcafe"){ qDebug() << "appcafe icon:" << isThemeIcon(icon) << HASH.contains(icon); }
if(isThemeIcon(icon)){
button->setIcon( iconFromTheme(icon));
return ;
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp
index aad63a5e..c6a81dbf 100644
--- a/src-qt5/core/libLumina/LuminaXDG.cpp
+++ b/src-qt5/core/libLumina/LuminaXDG.cpp
@@ -94,6 +94,8 @@ void XDGDesktop::sync(){
else if(comment.isEmpty() && loc==slang){ comment = val; } //short locale code
else if(loc == lang){ comment = val; }
}else if(var=="Icon"){
+ //Quick fix for bad-registrations which add the icon suffix for theme icons
+ if(!val.startsWith("/") && val.endsWith(".png") ){ val = val.section(".",0,-2); }
if(insection){
if(icon.isEmpty() && loc.isEmpty()){ icon = val; }
else if(icon.isEmpty() && loc==slang){ icon = val; } //short locale code
@@ -156,6 +158,7 @@ void XDGDesktop::sync(){
}
}
}
+
}
@@ -963,6 +966,7 @@ QIcon LXDG::findIcon(QString iconName, QString fallback){
}
//If still no icon found, look for any image format in the "pixmaps" directory
if(ico.isNull()){
+ //qDebug() << "Null Icon:" << iconName << LOS::AppPrefix();
if(QFile::exists(LOS::AppPrefix()+"share/pixmaps/"+iconName)){
ico.addFile(LOS::AppPrefix()+"share/pixmaps/"+iconName);
}else{
@@ -975,6 +979,7 @@ QIcon LXDG::findIcon(QString iconName, QString fallback){
//Use the first one found that is a valid format
for(int i=0; i<found.length(); i++){
if( formats.contains(found[i].section(".",-1).toLower()) ){
+ //qDebug() << " - Found non-theme icon:" << found[i];
ico.addFile( pix.absoluteFilePath(found[i]) );
break;
}
bgstack15