diff options
-rw-r--r-- | src-qt5/core/libLumina/LuminaUtils.cpp | 35 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 10 | ||||
-rw-r--r-- | src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf | 14 |
3 files changed, 51 insertions, 8 deletions
diff --git a/src-qt5/core/libLumina/LuminaUtils.cpp b/src-qt5/core/libLumina/LuminaUtils.cpp index 28ef5ad3..c434febc 100644 --- a/src-qt5/core/libLumina/LuminaUtils.cpp +++ b/src-qt5/core/libLumina/LuminaUtils.cpp @@ -593,7 +593,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ } } //Now setup the default "desktopsettings.conf" and "sessionsettings.conf" files - QStringList deskset, sesset, lopenset; + QStringList deskset, sesset;//, lopenset; // -- SESSION SETTINGS -- QStringList tmp = sysDefaults.filter("session_"); @@ -619,7 +619,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ } //Parse/save the value - QString loset, sset; //temporary strings + QString sset; //temporary strings if(var=="session_enablenumlock"){ sset = "EnableNumlock="+ istrue; } else if(var=="session_playloginaudio"){ sset = "PlayStartupAudio="+istrue; } else if(var=="session_playlogoutaudio"){ sset = "PlayLogoutAudio="+istrue; } @@ -639,19 +639,42 @@ void LUtils::LoadSystemDefaults(bool skipOS){ //loset = "email="+val; } //Put the line into the file (overwriting any previous assignment as necessary) - if(!loset.isEmpty()){ + /*if(!loset.isEmpty()){ int index = lopenset.indexOf(QRegExp(loset.section("=",0,0)+"=*", Qt::CaseSensitive, QRegExp::Wildcard)); qDebug() << "loset line:" << loset << index << lopenset; if(index<0){ lopenset << loset; } //new line else{ lopenset[index] = loset; } //overwrite the other line - } + }*/ if(!sset.isEmpty()){ int index = sesset.indexOf(QRegExp(sset.section("=",0,0)+"=*", Qt::CaseSensitive, QRegExp::Wildcard)); if(index<0){ sesset << sset; } //new line else{ sesset[index] = sset; } //overwrite the other line } } - if(!lopenset.isEmpty()){ lopenset.prepend("[default]"); } //the session options exist within this set + //if(!lopenset.isEmpty()){ lopenset.prepend("[default]"); } //the session options exist within this set + + // -- MIMETYPE DEFAULTS -- + tmp = sysDefaults.filter("mime_default_"); + for(int i=0; i<tmp.length(); i++){ + if(tmp[i].startsWith("#") || !tmp[i].contains("=") ){ continue; } + QString var = tmp[i].section("=",0,0).toLower().simplified(); + QString val = tmp[i].section("=",1,1).section("#",0,0).simplified(); + if(val.isEmpty()){ continue; } + QString istrue = (val.toLower()=="true") ? "true": "false"; + //Change in 0.8.5 - use "_" instead of "." within variables names - need backwards compat for a little while + if(var.contains(".")){ var.replace(".","_"); } + //Now parse the variable and put the value in the proper file + val = AppToAbsolute(val); + //Special handling for values which need to exist first + if(var.endsWith("_ifexists") ){ + var = var.remove("_ifexists"); //remove this flag from the variable + //Check if the value exists (absolute path only) + if(!QFile::exists(val)){ continue; } //skip this line - value/file does not exist + } + //Now turn this variable into the mimetype only + var = var.section("_default_",1,-1); + LXDG::setDefaultAppForMime(var, val); + } // -- DESKTOP SETTINGS -- //(only works for the primary desktop at the moment) @@ -808,7 +831,7 @@ void LUtils::LoadSystemDefaults(bool skipOS){ if(setTheme){ LTHEME::setCurrentSettings( themesettings[0], themesettings[1], themesettings[2], themesettings[3], themesettings[4]); } LUtils::writeFile(setdir+"/sessionsettings.conf", sesset, true); LUtils::writeFile(setdir+"/desktopsettings.conf", deskset, true); - LUtils::writeFile(setdir+"/lumina-open.conf", lopenset, true); + //LUtils::writeFile(setdir+"/lumina-open.conf", lopenset, true); } bool LUtils::checkUserFiles(QString lastversion){ diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index 68cd84bc..f92d4fa1 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -866,10 +866,16 @@ QString LXDG::findDefaultAppForMime(QString mime){ for(int d=def+1; d<info.length(); d++){ //qDebug() << "Check Line:" << info[d]; if(info[d].startsWith("[")){ break; } //starting a new section now - finished with defaults - if(info[d].contains(mime+"=")){ + if(info[d].contains(mime+"=") ){ white << info[d].section("=",1,-1).split(";"); break; - } + }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; + } + } } } // Now check for any white-listed files in this work dir diff --git a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf index f88ad2d0..251e8309 100644 --- a/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf +++ b/src-qt5/core/lumina-desktop/defaults/luminaDesktop.conf @@ -31,6 +31,20 @@ session_default_webbrowser_ifexists=firefox.desktop session_default_webbrowser_ifexists=qupzilla.desktop session_default_email_ifexists=trojita.desktop +#DEFAULT UTILITIES FOR INDIVIDUAL MIME TYPES +# Format: mime_default_<mimetype>[_ifexists]=<*.desktop file> +mime_default_text/*_ifexists=lumina-textedit.desktop +mime_default_audio/*_ifexists=vlc.desktop +mime_default_video/*_ifexists=vlc.desktop +mime_default_application/zip_ifexists=peazip.desktop +mime_default_application/x-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-bzip-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-lrzip-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-lzma-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-xz-compressed-tar_ifexists=peazip.desktop +mime_default_application/x-tar_ifexists=peazip.desktop + + #THEME SETTINGS theme_themefile=Glass #Name of the theme to use (disable for Lumina-Default) theme_colorfile=Black #Name of the color spec file to use for theming |