diff options
author | Ken Moore <ken@pcbsd.org> | 2015-03-12 18:55:20 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2015-03-12 18:55:20 -0400 |
commit | 4760ae5878a8b9f51450b9ce9f1fcc5b8a6b2e2a (patch) | |
tree | e19ba3c3191a9c8394b31ded1f9a2c4e4a8932c9 | |
parent | Merge branch 'master' of https://github.com/pcbsd/lumina (diff) | |
download | lumina-4760ae5878a8b9f51450b9ce9f1fcc5b8a6b2e2a.tar.gz lumina-4760ae5878a8b9f51450b9ce9f1fcc5b8a6b2e2a.tar.bz2 lumina-4760ae5878a8b9f51450b9ce9f1fcc5b8a6b2e2a.zip |
Make the XDG Exec= field code substitutions a bit more robust for missing fields in the *.desktop file.
Also fix a bug in lumina-open where the field code substitutions were not happening for non-default applications.
-rw-r--r-- | libLumina/LuminaXDG.cpp | 7 | ||||
-rw-r--r-- | lumina-open/LFileDialog.cpp | 4 |
2 files changed, 6 insertions, 5 deletions
diff --git a/libLumina/LuminaXDG.cpp b/libLumina/LuminaXDG.cpp index 9fa69cef..e4839480 100644 --- a/libLumina/LuminaXDG.cpp +++ b/libLumina/LuminaXDG.cpp @@ -255,10 +255,11 @@ QString LXDG::getDesktopExec(XDGDesktop app){ out = app.exec; } //Now perform any of the XDG flag substitutions as appropriate (9/2014 standards) - if(out.contains("%i")){ out.replace("%i", "--icon \'"+app.icon+"\'"); } + if(out.contains("%i") && !app.icon.isEmpty() ){ out.replace("%i", "--icon \'"+app.icon+"\'"); } if(out.contains("%c")){ - if(!app.name.isEmpty()){ out.replace("%c", ""+app.name+""); } - else if(!app.genericName.isEmpty()){ out.replace("%c", ""+app.genericName+""); } + if(!app.name.isEmpty()){ out.replace("%c", "\'"+app.name+"\'"); } + else if(!app.genericName.isEmpty()){ out.replace("%c", "\'"+app.genericName+"\'"); } + else{ out.replace("%c", "\'"+app.filePath.section("/",-1).section(".desktop",0,0)+"\'"); } } if(out.contains("%k")){ out.replace("%k", "\'"+app.filePath+"\'"); } return out; diff --git a/lumina-open/LFileDialog.cpp b/lumina-open/LFileDialog.cpp index d648925b..361cd99f 100644 --- a/lumina-open/LFileDialog.cpp +++ b/lumina-open/LFileDialog.cpp @@ -239,7 +239,7 @@ void LFileDialog::on_tool_ok_clicked(){ bool ok = false; XDGDesktop app = LXDG::loadDesktopFile(PREFAPPS[ui->combo_rec->currentIndex()], ok); //Set the output variables - appExec = app.exec; + appExec = LXDG::getDesktopExec(app); appPath = app.path; appFile = app.filePath; setPreferredApplication(app.filePath); //bump this to the top of the preferred list for next time @@ -248,7 +248,7 @@ void LFileDialog::on_tool_ok_clicked(){ bool ok = false; XDGDesktop app = LXDG::loadDesktopFile(ui->tree_apps->currentItem()->whatsThis(0), ok); //Set the output variables - appExec = app.exec; + appExec = LXDG::getDesktopExec(app); appPath = app.path; appFile = app.filePath; setPreferredApplication(app.filePath); //save this app to this extension as a recommendation |