aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Moore <moorekou@gmail.com>2016-06-21 10:07:38 -0400
committerKen Moore <moorekou@gmail.com>2016-06-21 10:07:38 -0400
commitcd2847a8048f50a9cd3e3d3e63ba94363ae0f981 (patch)
treeaeeaa50710a52d00621251bd9bc2ef76b219c72d
parentCleanup the PC-BSD options in the Lumina desktop defaults. (diff)
downloadlumina-cd2847a8048f50a9cd3e3d3e63ba94363ae0f981.tar.gz
lumina-cd2847a8048f50a9cd3e3d3e63ba94363ae0f981.tar.bz2
lumina-cd2847a8048f50a9cd3e3d3e63ba94363ae0f981.zip
Add the ability for custom, system-wide environment variable settings within L_ETCDIR/lumina-environment.conf[.dist] This allows a system admin the ability to setup customized build env settings on a global basis - and the user settings are treated as overrides for the system settings.
-rw-r--r--src-qt5/core/libLumina/LuminaThemes.cpp22
-rw-r--r--src-qt5/core/libLumina/LuminaThemes.h2
2 files changed, 13 insertions, 11 deletions
diff --git a/src-qt5/core/libLumina/LuminaThemes.cpp b/src-qt5/core/libLumina/LuminaThemes.cpp
index d9ca537b..7fe625a7 100644
--- a/src-qt5/core/libLumina/LuminaThemes.cpp
+++ b/src-qt5/core/libLumina/LuminaThemes.cpp
@@ -272,19 +272,21 @@ QStringList LTHEME::cursorInformation(QString name){
return out;
}
-QStringList LTHEME::CustomEnvSettings(){ //view all the key=value settings
- static QStringList info = QStringList();
- static QDateTime lastcheck = QDateTime();
- if(lastcheck.isNull() || lastcheck < QFileInfo(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/envsettings.conf").lastModified()){
- lastcheck = QDateTime::currentDateTime();
- info = LUtils::readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/envsettings.conf");
+QStringList LTHEME::CustomEnvSettings(bool useronly){ //view all the key=value settings
+ QStringList newinfo;
+ if(!useronly){
+ QStringList sysfiles; sysfiles << L_ETCDIR+"/lumina_environment.conf" << LOS::LuminaShare()+"lumina_environment.conf";
+ for(int i=0; i<sysfiles.length() && newinfo.isEmpty(); i++){
+ newinfo << LUtils::readFile(sysfiles[i]);
+ }
}
- return info;
+ newinfo << LUtils::readFile(QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/envsettings.conf");
+ return newinfo;
}
void LTHEME::LoadCustomEnvSettings(){
//will push the custom settings into the environment (recommended before loading the initial QApplication)
- QStringList info = LTHEME::CustomEnvSettings();
+ QStringList info = LTHEME::CustomEnvSettings(false); //all settings
if(info.isEmpty()){
//Ensure the file exists, and create it otherwise;
if(!QFile::exists( QString(getenv("XDG_CONFIG_HOME"))+"/lumina-desktop/envsettings.conf")){
@@ -304,7 +306,7 @@ void LTHEME::LoadCustomEnvSettings(){
bool LTHEME::setCustomEnvSetting(QString var, QString val){
//variable/value pair (use an empty val to clear it)
- QStringList info = LTHEME::CustomEnvSettings();
+ QStringList info = LTHEME::CustomEnvSettings(true); //user only
bool changed = false;
if(!info.filter(var+"=").isEmpty()){
for(int i=0; i<info.length(); i++){
@@ -321,7 +323,7 @@ bool LTHEME::setCustomEnvSetting(QString var, QString val){
QString LTHEME::readCustomEnvSetting(QString var){
QStringList info = LTHEME::CustomEnvSettings().filter(var+"=");
- for(int i=0; i<info.length(); i++){
+ for(int i=info.length()-1; i>=0; i--){
if(info[i].startsWith(var+"=")){
return info[i].section("=",1,100).simplified();
}
diff --git a/src-qt5/core/libLumina/LuminaThemes.h b/src-qt5/core/libLumina/LuminaThemes.h
index f0b8c2b6..39602f58 100644
--- a/src-qt5/core/libLumina/LuminaThemes.h
+++ b/src-qt5/core/libLumina/LuminaThemes.h
@@ -50,7 +50,7 @@ public:
static QStringList cursorInformation(QString name); //returns: [Name, Comment, Sample Image File]
//Environment settings
- static QStringList CustomEnvSettings(); //view all the key=value settings
+ static QStringList CustomEnvSettings(bool useronly = false); //view all the key=value settings
static void LoadCustomEnvSettings(); //will push the custom settings into the environment (recommended before loading the initial QApplication)
static bool setCustomEnvSetting(QString var, QString val); //variable/value pair (use an empty val to clear it)
static QString readCustomEnvSetting(QString var);
bgstack15