aboutsummaryrefslogtreecommitdiff
path: root/src-qt5
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-06-09 19:42:06 -0400
committerKen Moore <moorekou@gmail.com>2016-06-09 19:42:06 -0400
commit6abcc32a905914f3cc5b299bcd2387bcbadb8b2f (patch)
tree1a7c0b48af1030c6910415b9df76af9c812151f7 /src-qt5
parentFix the RSS reader plugin setting within lumina-config. Now it can add/detect... (diff)
downloadlumina-6abcc32a905914f3cc5b299bcd2387bcbadb8b2f.tar.gz
lumina-6abcc32a905914f3cc5b299bcd2387bcbadb8b2f.tar.bz2
lumina-6abcc32a905914f3cc5b299bcd2387bcbadb8b2f.zip
Make sure that wildard mimetype matches are given lower priority than exact mimetype matches in the default associations routine.
Diffstat (limited to 'src-qt5')
-rw-r--r--src-qt5/core/libLumina/LuminaXDG.cpp11
1 files changed, 5 insertions, 6 deletions
diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp
index f92d4fa1..8f6ada37 100644
--- a/src-qt5/core/libLumina/LuminaXDG.cpp
+++ b/src-qt5/core/libLumina/LuminaXDG.cpp
@@ -854,11 +854,11 @@ QString LXDG::findDefaultAppForMime(QString mime){
//Now go through all the files in order of priority until a default is found
QString cdefault;
- QStringList white; //lists to keep track of during the search (black unused at the moment)
for(int i=0; i<dirs.length() && cdefault.isEmpty(); i++){
if(!QFile::exists(dirs[i])){ continue; }
QStringList info = LUtils::readFile(dirs[i]);
if(info.isEmpty()){ continue; }
+ QStringList white; //lists to keep track of during the search (black unused at the moment)
QString workdir = dirs[i].section("/",0,-2); //just the directory
// qDebug() << "Check File:" << mime << dirs[i] << workdir;
int def = info.indexOf("[Default Applications]"); //find this line to start on
@@ -867,13 +867,12 @@ QString LXDG::findDefaultAppForMime(QString mime){
//qDebug() << "Check Line:" << info[d];
if(info[d].startsWith("[")){ break; } //starting a new section now - finished with defaults
if(info[d].contains(mime+"=") ){
- white << info[d].section("=",1,-1).split(";");
- break;
+ white = info[d].section("=",1,-1).split(";") + white; //exact mime match - put at front of list
+ break; //already found exact match
}else if(info[d].contains("*") && info[d].contains("=") ){
QRegExp rg(info[d].section("=",0,0), Qt::CaseSensitive, QRegExp::WildcardUnix);
if(rg.exactMatch(mime)){
- white << info[d].section("=",1,-1).split(";");
- break;
+ white << info[d].section("=",1,-1).split(";"); //partial mime match - put at end of list
}
}
}
@@ -895,7 +894,7 @@ QString LXDG::findDefaultAppForMime(QString mime){
white[w] = LUtils::AppToAbsolute(white[w]);
if(QFile::exists(white[w])){ cdefault = white[w]; }
}
- }
+ }
/* WRITTEN BUT UNUSED CODE FOR MIMETYPE ASSOCIATIONS
//Skip using this because it is simply an alternate/unsupported standard that conflicts with
the current mimetype database standards. It is better/faster to parse 1 or 2 database glob files
bgstack15