aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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
-rw-r--r--src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp7
5 files changed, 27 insertions, 2 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;
}
diff --git a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
index d8014f4c..c2f0bea1 100644
--- a/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
+++ b/src-qt5/core/lumina-desktop/panel-plugins/systemstart/LStartButton.cpp
@@ -9,6 +9,9 @@
#include <LuminaXDG.h>
#include <LUtils.h> //This contains the "ResizeMenu" class
+//#include <LIconCache.h>
+
+//extern LIconCache *ICONS;
LStartButtonPlugin::LStartButtonPlugin(QWidget *parent, QString id, bool horizontal) : LPPlugin(parent, id, horizontal){
button = new QToolButton(this);
@@ -64,7 +67,7 @@ void LStartButtonPlugin::updateQuickLaunch(QStringList apps){
//App still listed - update the button
old << QUICKL[i]->whatsThis(); //add the list of current buttons
LFileInfo info(QUICKL[i]->whatsThis());
- QUICKL[i]->setIcon( LXDG::findIcon(info.iconfile(),"unknown") );
+ QUICKL[i]->setIcon( info.icon() );
if(info.isDesktopFile()){ QUICKL[i]->setToolTip( info.XDG()->name ); }
else{ QUICKL[i]->setToolTip( info.fileName() ); }
}
@@ -76,7 +79,7 @@ void LStartButtonPlugin::updateQuickLaunch(QStringList apps){
LQuickLaunchButton *tmp = new LQuickLaunchButton(apps[i], this);
QUICKL << tmp;
LFileInfo info(apps[i]);
- tmp->setIcon( LXDG::findIcon( info.iconfile() ) );
+ tmp->setIcon( info.icon() );
if(info.isDesktopFile()){ tmp->setToolTip( info.XDG()->name ); }
else{ tmp->setToolTip( info.fileName() ); }
//Now add the button to the layout and connect the signal/slots
bgstack15