diff options
author | Weblate <noreply@weblate.org> | 2017-08-19 14:57:31 +0000 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2017-08-19 14:57:31 +0000 |
commit | dcf0d4cc38374186cd2c1e2d795ec81e2f047394 (patch) | |
tree | 9afe57786de1bd53b2c8fecaca6ee9458a42a2b8 /src-qt5/core/libLumina | |
parent | Translated using Weblate (Danish) (diff) | |
parent | Add the ability to generate symlinks in the Desktop folder the first time Lum... (diff) | |
download | lumina-dcf0d4cc38374186cd2c1e2d795ec81e2f047394.tar.gz lumina-dcf0d4cc38374186cd2c1e2d795ec81e2f047394.tar.bz2 lumina-dcf0d4cc38374186cd2c1e2d795ec81e2f047394.zip |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'src-qt5/core/libLumina')
-rw-r--r-- | src-qt5/core/libLumina/LDesktopUtils.cpp | 22 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LDesktopUtils.h | 4 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LUtils.cpp | 21 |
3 files changed, 33 insertions, 14 deletions
diff --git a/src-qt5/core/libLumina/LDesktopUtils.cpp b/src-qt5/core/libLumina/LDesktopUtils.cpp index b79f777d..4c87ae22 100644 --- a/src-qt5/core/libLumina/LDesktopUtils.cpp +++ b/src-qt5/core/libLumina/LDesktopUtils.cpp @@ -337,6 +337,16 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){ else if(var=="favorites_remove"){ qDebug() << " - Removing:"; LDesktopUtils::removeFavorite(val); } } + tmp = sysDefaults.filter("desktoplinks_"); + QString desktopFolder = QDir::homePath()+"/Desktop/"; //need to make this translatable and dynamic later + 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(); + val = LUtils::AppToAbsolute(val); //turn any relative files into absolute + if(var=="desktoplinks_add" && QFile::exists(val) && !QFile::exists(desktopFolder+val.section("/",-1)) ){ QFile::link(val, desktopFolder+val.section("/",-1)); } + } + // -- QUICKLAUNCH -- tmp = sysDefaults.filter("quicklaunch_"); if(tmp.isEmpty()){ tmp = sysDefaults.filter("quicklaunch."); } @@ -409,6 +419,7 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){ } } } + } //qDebug() << " - Final Theme Color:" << themesettings[1]; @@ -419,7 +430,16 @@ void LDesktopUtils::LoadSystemDefaults(bool skipOS){ dir.mkpath(setdir); } //Now save the settings files - if(setTheme){ LTHEME::setCurrentSettings( themesettings[0], themesettings[1], themesettings[2], themesettings[3], themesettings[4]); } + if(setTheme){ + LTHEME::setCurrentSettings( themesettings[0], themesettings[1], themesettings[2], themesettings[3], themesettings[4]); + QSettings themeset("lthemeengine","lthemeengine"); + themeset.setValue("Appearance/icon_theme",themesettings[2]); + //Quick hack for a "dark" theme/color to be uniform across the desktop/applications + if(themesettings[0].contains("DarkGlass") || themesettings[1].contains("Black")){ + themeset.setValue("Appearance/custom_palette", true); + themeset.setValue("Appearance/color_scheme_path", LOS::LuminaShare().section("/",0,-3)+"/lthemeengine/colors/darker.conf"); + } + } LUtils::writeFile(setdir+"/sessionsettings.conf", sesset, true); LUtils::writeFile(setdir+"/desktopsettings.conf", deskset, true); diff --git a/src-qt5/core/libLumina/LDesktopUtils.h b/src-qt5/core/libLumina/LDesktopUtils.h index b21bc78a..a9b44c67 100644 --- a/src-qt5/core/libLumina/LDesktopUtils.h +++ b/src-qt5/core/libLumina/LDesktopUtils.h @@ -30,7 +30,7 @@ public: static QString findQuickPluginFile(QString ID); static QStringList listQuickPlugins(); //List of valid ID's static QStringList infoQuickPlugin(QString ID); //Returns: [Name, Description, Icon] - + //Various functions for the favorites sub-system // Formatting Note: "<name>::::[dir/app/<mimetype>]::::<path>" // the <name> field might not be used for "app" flagged entries @@ -40,7 +40,7 @@ public: static bool addFavorite(QString path, QString name = ""); static void removeFavorite(QString path); static void upgradeFavorites(int fromoldversionnumber); - + //Load the default setup for the system static void LoadSystemDefaults(bool skipOS = false); static bool checkUserFiles(QString lastversion); //returns true if something changed diff --git a/src-qt5/core/libLumina/LUtils.cpp b/src-qt5/core/libLumina/LUtils.cpp index fa0173dc..e4f1c517 100644 --- a/src-qt5/core/libLumina/LUtils.cpp +++ b/src-qt5/core/libLumina/LUtils.cpp @@ -26,7 +26,7 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ if(args.isEmpty()){ proc.start(cmd, QIODevice::ReadOnly); }else{ - proc.start(cmd,args ,QIODevice::ReadOnly); + proc.start(cmd,args ,QIODevice::ReadOnly); } QString info; while(!proc.waitForFinished(1000)){ @@ -37,7 +37,7 @@ inline QStringList ProcessRun(QString cmd, QStringList args){ } out[0] = QString::number(proc.exitCode()); out[1] = info+QString(proc.readAllStandardOutput()); - return out; + return out; } //============= // LUtils Functions @@ -59,7 +59,6 @@ int LUtils::runCmd(QString cmd, QStringList args){ return ret;*/ QFuture<QStringList> future = QtConcurrent::run(ProcessRun, cmd, args); return future.result()[0].toInt(); //turn it back into an integer return code - } QStringList LUtils::getCmdOutput(QString cmd, QStringList args){ @@ -72,7 +71,7 @@ QStringList LUtils::getCmdOutput(QString cmd, QStringList args){ if(args.isEmpty()){ proc.start(cmd); }else{ - proc.start(cmd,args); + proc.start(cmd,args); } //if(!proc.waitForStarted(30000)){ return QStringList(); } //process never started - max wait of 30 seconds while(!proc.waitForFinished(300)){ @@ -118,7 +117,7 @@ bool LUtils::isValidBinary(QString& bin){ //Relative path: search for it on the current "PATH" settings QStringList paths = QString(qgetenv("PATH")).split(":"); for(int i=0; i<paths.length(); i++){ - if(QFile::exists(paths[i]+"/"+bin)){ bin = paths[i]+"/"+bin; break;} + if(QFile::exists(paths[i]+"/"+bin)){ bin = paths[i]+"/"+bin; break;} } } //bin should be the full path by now @@ -150,7 +149,7 @@ QSettings* LUtils::openSettings(QString org, QString name, QObject *parent){ }else{ return (new QSettings(filepath, QSettings::IniFormat, parent)); } - + } QStringList LUtils::systemApplicationDirs(){ @@ -164,7 +163,7 @@ QStringList LUtils::systemApplicationDirs(){ for(int i=0; i<appDirs.length(); i++){ if( QFile::exists(appDirs[i]+"/applications") ){ out << appDirs[i]+"/applications"; - //Also check any subdirs within this directory + //Also check any subdirs within this directory // (looking at you KDE - stick to the standards!!) out << LUtils::listSubDirectories(appDirs[i]+"/applications"); } @@ -197,7 +196,7 @@ QString LUtils::GenerateOpenTerminalExec(QString term, QString dirpath){ }else if(term=="konsole" || term == "qterminal"){ exec = term+" --workdir \""+dirpath+"\""; }else{ - //-e is the parameter for most of the terminal appliction to execute an external command. + //-e is the parameter for most of the terminal appliction to execute an external command. //In this case we start a shell in the selected directory //Need the user's shell first QString shell = QString(getenv("SHELL")); @@ -258,7 +257,7 @@ QStringList LUtils::imageExtensions(bool wildcards){ static QStringList imgExtensions; if(imgExtensions.isEmpty()){ QList<QByteArray> fmt = QImageReader::supportedImageFormats(); - for(int i=0; i<fmt.length(); i++){ + for(int i=0; i<fmt.length(); i++){ if(wildcards){ imgExtensions << "*."+QString::fromLocal8Bit(fmt[i]); } else{ imgExtensions << QString::fromLocal8Bit(fmt[i]); } } @@ -308,7 +307,7 @@ QStringList LUtils::imageExtensions(bool wildcards){ qDebug() << "Loading System Encoding:" << langEnc; } //Load current encoding for this locale - QTextCodec::setCodecForLocale( QTextCodec::codecForName(langEnc.toUtf8()) ); + QTextCodec::setCodecForLocale( QTextCodec::codecForName(langEnc.toUtf8()) ); return cTrans; } @@ -379,7 +378,7 @@ void LUtils::setLocaleEnv(QString lang, QString msg, QString time, QString num,Q else{ if(!ctype.contains(".")){ ctype.append(".UTF-8"); } setenv("LC_CTYPE",ctype.toUtf8(),1); - } + } } QString LUtils::currentLocale(){ |