aboutsummaryrefslogtreecommitdiff
path: root/libLumina/LuminaUtils.cpp
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2015-07-29 10:13:49 -0400
committerKen Moore <moorekou@gmail.com>2015-07-29 10:13:49 -0400
commit7cfcc0e6d4dc8c10fd694eb4e87a9badbdf42f8b (patch)
tree449119c9c2bfa5f4369e7ce6a39a70688b8cadb9 /libLumina/LuminaUtils.cpp
parentAdd the ability to use an optional "_ifexists" tag at the end of any "session... (diff)
downloadlumina-7cfcc0e6d4dc8c10fd694eb4e87a9badbdf42f8b.tar.gz
lumina-7cfcc0e6d4dc8c10fd694eb4e87a9badbdf42f8b.tar.bz2
lumina-7cfcc0e6d4dc8c10fd694eb4e87a9badbdf42f8b.zip
Oops, make sure that any new duplicate session setting overwrites the previous setting.
Diffstat (limited to 'libLumina/LuminaUtils.cpp')
-rw-r--r--libLumina/LuminaUtils.cpp28
1 files changed, 20 insertions, 8 deletions
diff --git a/libLumina/LuminaUtils.cpp b/libLumina/LuminaUtils.cpp
index 4633c765..88dec8b9 100644
--- a/libLumina/LuminaUtils.cpp
+++ b/libLumina/LuminaUtils.cpp
@@ -446,16 +446,28 @@ void LUtils::LoadSystemDefaults(bool skipOS){
if(!QFile::exists(val)){ continue; } //skip this line - value/file does not exist
}
//Parse/save the value
- if(var=="session_enablenumlock"){ sesset << "EnableNumlock="+ istrue; }
- else if(var=="session_playloginaudio"){ sesset << "PlayStartupAudio="+istrue; }
- else if(var=="session_playlogoutaudio"){ sesset << "PlayLogoutAudio="+istrue; }
- else if(var=="session_default_terminal"){ sesset << "default-terminal="+val; }
+ QString loset, 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; }
+ else if(var=="session_default_terminal"){ sset = "default-terminal="+val; }
else if(var=="session_default_filemanager"){
- sesset << "default-filemanager="+val;
- lopenset << "directory="+val;
+ sset = "default-filemanager="+val;
+ loset = "directory="+val;
+ }
+ else if(var=="session_default_webbrowser"){ loset = "webbrowser="+val; }
+ else if(var=="session_default_email"){ loset = "email="+val; }
+ //Put the line into the file (overwriting any previous assignment as necessary)
+ if(!loset.isEmpty()){
+ int index = lopenset.indexOf(loset.section("=",0,0)+"=*");
+ if(index<0){ lopenset << loset; } //new line
+ else{ lopenset[index] = loset; } //overwrite the other line
+ }
+ if(!sset.isEmpty()){
+ int index = sesset.indexOf(sset.section("=",0,0)+"=*");
+ if(index<0){ sesset << sset; } //new line
+ else{ sesset[index] = sset; } //overwrite the other line
}
- else if(var=="session_default_webbrowser"){ lopenset << "webbrowser="+val; }
- else if(var=="session_default_email"){ lopenset << "email="+val; }
}
if(!lopenset.isEmpty()){ lopenset.prepend("[default]"); } //the session options exist within this set
bgstack15