diff options
author | Ken Moore <ken@pcbsd.org> | 2016-09-22 16:41:42 -0400 |
---|---|---|
committer | Ken Moore <ken@pcbsd.org> | 2016-09-22 16:41:42 -0400 |
commit | 82ebebfb8a5867b400c1df726a478bdcb9d7c005 (patch) | |
tree | 6c799a122fba9dc9068695f95e967e417f6b1636 /src-qt5/core/lumina-open/main.cpp | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | lumina-82ebebfb8a5867b400c1df726a478bdcb9d7c005.tar.gz lumina-82ebebfb8a5867b400c1df726a478bdcb9d7c005.tar.bz2 lumina-82ebebfb8a5867b400c1df726a478bdcb9d7c005.zip |
Large update to how XDGDesktop files are created/used.
This impacts almost all tools/utilities within Lumina - please test (passed internal tests so far).
This cleans up a lot of the backend XDG compliance class, moving lots of functionality into child functions of the XDGDesktop class and ensuring that they get cleaned up more regularly/properly. This *seems* to make the desktop startup a lot faster, even if the overall memory savings are slight (so far).
Diffstat (limited to 'src-qt5/core/lumina-open/main.cpp')
-rw-r--r-- | src-qt5/core/lumina-open/main.cpp | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/src-qt5/core/lumina-open/main.cpp b/src-qt5/core/lumina-open/main.cpp index 756bef25..68d2575b 100644 --- a/src-qt5/core/lumina-open/main.cpp +++ b/src-qt5/core/lumina-open/main.cpp @@ -80,17 +80,19 @@ void showOSD(int argc, char **argv, QString message){ } void LaunchAutoStart(){ - QList<XDGDesktop> xdgapps = LXDG::findAutoStartFiles(); + QList<XDGDesktop*> xdgapps = LXDG::findAutoStartFiles(); for(int i=0; i<xdgapps.length(); i++){ //Generate command and clean up any stray "Exec" field codes (should not be any here) - QString cmd = LXDG::getDesktopExec(xdgapps[i]); + QString cmd = xdgapps[i]->getDesktopExec(); if(cmd.contains("%")){cmd = cmd.remove("%U").remove("%u").remove("%F").remove("%f").remove("%i").remove("%c").remove("%k").simplified(); } //Now run the command if(!cmd.isEmpty()){ - qDebug() << " - Auto-Starting File:" << xdgapps[i].filePath; + qDebug() << " - Auto-Starting File:" << xdgapps[i]->filePath; QProcess::startDetached(cmd); } } + //make sure we clean up all the xdgapps structures + for(int i=0; i<xdgapps.length(); i++){ xdgapps[i]->deleteLater(); } } QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QString& path, bool showDLG=false){ @@ -109,11 +111,10 @@ QString cmdFromUser(int argc, char **argv, QString inFile, QString extension, QS }else{ defApp = LFileDialog::getDefaultApp(extension); } //qDebug() << "extension:" << extension << "defApp:" << defApp; if( !defApp.isEmpty() && !showDLG ){ - bool ok = false; if(defApp.endsWith(".desktop")){ - XDGDesktop DF = LXDG::loadDesktopFile(defApp, ok); - if(ok){ - QString exec = LXDG::getDesktopExec(DF); + XDGDesktop DF(defApp); + if(DF.isValid()){ + QString exec = DF.getDesktopExec(); if(!exec.isEmpty()){ qDebug() << "[lumina-open] Using default application:" << DF.name << "File:" << inFile; if(!DF.path.isEmpty()){ path = DF.path; } @@ -258,15 +259,14 @@ void getCMD(int argc, char ** argv, QString& binary, QString& args, QString& pat QString cmd; bool useInputFile = false; if(extension=="desktop" && !showDLG){ - bool ok = false; - XDGDesktop DF = LXDG::loadDesktopFile(inFile, ok); - if(!ok){ + XDGDesktop DF(inFile); + if(!DF.isValid()){ ShowErrorDialog( argc, argv, QString(QObject::tr("File could not be opened: %1")).arg(inFile) ); } switch(DF.type){ case XDGDesktop::APP: if(!DF.exec.isEmpty()){ - cmd = LXDG::getDesktopExec(DF,ActionID); + cmd = DF.getDesktopExec(ActionID); if(!DF.path.isEmpty()){ path = DF.path; } watch = DF.startupNotify || !DF.filePath.contains("/xdg/autostart/"); }else{ |