aboutsummaryrefslogtreecommitdiff
path: root/src-qt5/core/libLumina/LuminaXDG.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src-qt5/core/libLumina/LuminaXDG.cpp')
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.cpp13
1 files changed, 5 insertions, 8 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp
index d92285c5..cbc90f25 100644
--- a/src-qt5/core/libLumina/LuminaXDG.cpp
+++ b/src-qt5/core/libLumina/LuminaXDG.cpp
@@ -127,9 +127,8 @@ void XDGDesktop::sync(){
else if(var=="Type" && insection){
if(val.toLower()=="application"){ type = XDGDesktop::APP; }
else if(val.toLower()=="link"){ type = XDGDesktop::LINK; }
- else if(val.toLower()=="dir"){ type = XDGDesktop::DIR; }
+ else if(val.toLower().startsWith("dir")){ type = XDGDesktop::DIR; } //older specs are "Dir", newer specs are "Directory"
else{ type = XDGDesktop::BAD; } //Unknown type
- //hasType = true;
}
} //end reading file
file.clear(); //done with contents of file
@@ -176,7 +175,7 @@ bool XDGDesktop::isValid(bool showAll){
//if(DEBUG && !ok){ qDebug() << " - Link with missing URL"; }
break;
case XDGDesktop::DIR:
- ok = !path.isEmpty();
+ ok = !path.isEmpty() && QFile::exists(path);
//if(DEBUG && !ok){ qDebug() << " - Dir with missing path"; }
break;
default:
@@ -477,7 +476,7 @@ void XDGDesktopList::updateList(){
bool firstrun = lastCheck.isNull() || oldkeys.isEmpty();
lastCheck = QDateTime::currentDateTime();
//Variables for internal loop use only (to prevent re-initializing variable on every iteration)
- bool ok; QString path; QDir dir; QStringList apps;
+ QString path; QDir dir; QStringList apps;
for(int i=0; i<appDirs.length(); i++){
if( !dir.cd(appDirs[i]) ){ continue; } //could not open dir for some reason
apps = dir.entryList(QStringList() << "*.desktop",QDir::Files, QDir::Name);
@@ -486,11 +485,9 @@ void XDGDesktopList::updateList(){
if(files.contains(path) && (files.value(path)->lastRead>QFileInfo(path).lastModified()) ){
//Re-use previous data for this file (nothing changed)
found << files[path]->name; //keep track of which files were already found
- ok=true;
}else{
- ok=false;
- if(files.contains(path)){ appschanged = true; files.take(path)->deleteLater(); } //files.remove(path); }
- XDGDesktop *dFile = new XDGDesktop(path, this); //will change the "ok" variable as needed
+ if(files.contains(path)){ appschanged = true; files.take(path)->deleteLater(); }
+ XDGDesktop *dFile = new XDGDesktop(path, this);
if(dFile->type!=XDGDesktop::BAD){
appschanged = true; //flag that something changed - needed to load a file
if(!oldkeys.contains(path)){ newfiles << path; } //brand new file (not an update to a previously-read file)
bgstack15