diff options
author | Ken Moore <ken@ixsystems.com> | 2017-10-27 09:24:11 -0400 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2017-10-27 09:24:11 -0400 |
commit | f8b26186ce5b6a018d2c833188fb1e9ee7f902d5 (patch) | |
tree | 2b9a65b2df9b6c20e6b863862913c28572afb9ff /src-qt5 | |
parent | Add the ability to use a "directory" as the target for desktop wallpapers. Wi... (diff) | |
download | lumina-f8b26186ce5b6a018d2c833188fb1e9ee7f902d5.tar.gz lumina-f8b26186ce5b6a018d2c833188fb1e9ee7f902d5.tar.bz2 lumina-f8b26186ce5b6a018d2c833188fb1e9ee7f902d5.zip |
Ensure that "Exec" and "TryExec" strings with quotes are handled properly.
Diffstat (limited to 'src-qt5')
-rw-r--r-- | src-qt5/core/libLumina/LUtils.cpp | 3 | ||||
-rw-r--r-- | src-qt5/core/libLumina/LuminaXDG.cpp | 5 | ||||
-rw-r--r-- | src-qt5/core/lumina-open/main.cpp | 5 |
3 files changed, 9 insertions, 4 deletions
diff --git a/src-qt5/core/libLumina/LUtils.cpp b/src-qt5/core/libLumina/LUtils.cpp index 820b55e8..65c6ac96 100644 --- a/src-qt5/core/libLumina/LUtils.cpp +++ b/src-qt5/core/libLumina/LUtils.cpp @@ -121,6 +121,9 @@ bool LUtils::writeFile(QString filepath, QStringList contents, bool overwrite){ } bool LUtils::isValidBinary(QString& bin){ + //Trim off any quotes + if(bin.startsWith("\"") && bin.endsWith("\"")){ bin.chop(1); bin = bin.remove(0,1); } + //Now look for relative/absolute path if(!bin.startsWith("/")){ //Relative path: search for it on the current "PATH" settings QStringList paths = QString(qgetenv("PATH")).split(":"); diff --git a/src-qt5/core/libLumina/LuminaXDG.cpp b/src-qt5/core/libLumina/LuminaXDG.cpp index 53b59165..aaca7bb1 100644 --- a/src-qt5/core/libLumina/LuminaXDG.cpp +++ b/src-qt5/core/libLumina/LuminaXDG.cpp @@ -72,6 +72,7 @@ void XDGDesktop::sync(){ QString loc = var.section("[",1,1).section("]",0,0).simplified(); // localization var = var.section("[",0,0).simplified(); //remove the localization QString val = line.section("=",1,50).simplified(); + if( val.count("\"")==2 && val.startsWith("\"") && val.endsWith("\"")){ val.chop(1); val = val.remove(0,1); } //remove the starting/ending quotes //------------------- if(var=="Name"){ if(insection){ @@ -727,6 +728,8 @@ bool LFileInfo::isAVFile(){ //==== LXDG Functions ==== bool LXDG::checkExec(QString exec){ //Return true(good) or false(bad) + //Check for quotes around the exec, and remove them as needed + if(exec.startsWith("\"") && exec.count("\"")>=2){ exec = exec.section("\"",1,1); } if(exec.startsWith("/")){ return QFile::exists(exec); } else{ QStringList paths = QString(getenv("PATH")).split(":"); @@ -748,7 +751,7 @@ QStringList LXDG::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"); } diff --git a/src-qt5/core/lumina-open/main.cpp b/src-qt5/core/lumina-open/main.cpp index 945f0d1f..7b6cb2ad 100644 --- a/src-qt5/core/lumina-open/main.cpp +++ b/src-qt5/core/lumina-open/main.cpp @@ -29,7 +29,7 @@ #include <LuminaOS.h> #include <LuminaThemes.h> -#define DEBUG 0 +#define DEBUG 1 void printUsageInfo(){ qDebug() << "lumina-open: Application launcher for the Lumina Desktop Environment"; @@ -369,7 +369,7 @@ int main(int argc, char **argv){ QString bin = cmd.section(" ",0,0); if( !LUtils::isValidBinary(bin) ){ //invalid binary for some reason - open a dialog to warn the user instead - QMessageBox::warning(0, QObject::tr("Binary Missing"), QString(QObject::tr("Could not find \"%1\". Please ensure it is installed first.")).arg(bin)+"\n\n"+cmd); + ShowErrorDialog(argc,argv, QString(QObject::tr("Could not find \"%1\". Please ensure it is installed first.")).arg(bin)+"\n\n"+cmd); return 1; } if(DEBUG) qDebug() << "[lumina-open] Running Cmd:" << cmd; @@ -416,7 +416,6 @@ int main(int argc, char **argv){ //Setup the application QApplication App(argc, argv); App.setAttribute(Qt::AA_UseHighDpiPixmaps); - LuminaThemeEngine theme(&App); LUtils::LoadTranslation(&App,"lumina-open"); //App.setApplicationName("LuminaOpen"); QMessageBox dlg(QMessageBox::Critical, QObject::tr("Application Error"), QObject::tr("The following application experienced an error and needed to close:")+"\n\n"+cmd ); |