aboutsummaryrefslogtreecommitdiff
path: root/libLumina
diff options
context:
space:
mode:
authorwi <william.os4y@gmail.com>2015-04-30 19:38:51 +0200
committerwi <william.os4y@gmail.com>2015-04-30 19:38:51 +0200
commitd845c59e78ae6f1ebe831d896a760e9e4839ca4e (patch)
tree10fa0bfba440868f34946667686c4f3a9b20a2c5 /libLumina
parentFix/Fix a couple important bugs before announcing 0.8.4-release: (diff)
downloadlumina-d845c59e78ae6f1ebe831d896a760e9e4839ca4e.tar.gz
lumina-d845c59e78ae6f1ebe831d896a760e9e4839ca4e.tar.bz2
lumina-d845c59e78ae6f1ebe831d896a760e9e4839ca4e.zip
improve the decision regarding valid desktop files by check if Name and Type are well present.
Diffstat (limited to 'libLumina')
-rw-r--r--libLumina/LuminaXDG.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/libLumina/LuminaXDG.cpp b/libLumina/LuminaXDG.cpp
index 57757fc9..95d3ab02 100644
--- a/libLumina/LuminaXDG.cpp
+++ b/libLumina/LuminaXDG.cpp
@@ -16,6 +16,8 @@ static qint64 mimechecktime;
XDGDesktop LXDG::loadDesktopFile(QString filePath, bool& ok){
//Create the outputs
ok=false;
+ //following the specifications, Name and Type are the mandatory in any .desktop file
+ bool hasName=false, hasType=false;
XDGDesktop DF;
DF.isHidden=false;
DF.useTerminal=false;
@@ -51,6 +53,7 @@ XDGDesktop LXDG::loadDesktopFile(QString filePath, bool& ok){
if(var=="Name"){
if(DF.name.isEmpty() && loc.isEmpty()){ DF.name = val; }
else if(loc == lang){ DF.name = val; }
+ hasName = true;
}else if(var=="GenericName"){
if(DF.genericName.isEmpty() && loc.isEmpty()){ DF.genericName = val; }
else if(loc == lang){ DF.genericName = val; }
@@ -84,6 +87,7 @@ XDGDesktop LXDG::loadDesktopFile(QString filePath, bool& ok){
else if(val.toLower()=="link"){ DF.type = XDGDesktop::LINK; }
else if(val.toLower()=="dir"){ DF.type = XDGDesktop::DIR; }
else{ DF.type = XDGDesktop::BAD; } //Unknown type
+ hasType = true;
}
} //end reading file
file.close();
@@ -105,7 +109,7 @@ XDGDesktop LXDG::loadDesktopFile(QString filePath, bool& ok){
DF.catList << "Wine"; //Internal Lumina category only (not in XDG specs as of 11/14/14)
}
//Return the structure
- ok=true;
+ if (hasName && hasType) ok = true; //without Name and Type, the structure cannot be a valid .desktop file
return DF;
}
bgstack15