diff options
author | Ken Moore <moorekou@gmail.com> | 2016-06-30 09:39:01 -0400 |
---|---|---|
committer | Ken Moore <moorekou@gmail.com> | 2016-06-30 09:39:01 -0400 |
commit | 702d651bad7892126fdf82499f25e6e418499366 (patch) | |
tree | 43667c0bf9ea726795e6db07dfd051b130f4559c /src-qt5/core/lumina-desktop/JsonMenu.h | |
parent | Fix the symlink creation routine so it works properly if INSTALL_ROOT is setup. (diff) | |
download | lumina-702d651bad7892126fdf82499f25e6e418499366.tar.gz lumina-702d651bad7892126fdf82499f25e6e418499366.tar.bz2 lumina-702d651bad7892126fdf82499f25e6e418499366.zip |
Finish up the new JSON recursive menu system as well as the test script for listing the contents of a directory recursively.
Diffstat (limited to 'src-qt5/core/lumina-desktop/JsonMenu.h')
-rw-r--r-- | src-qt5/core/lumina-desktop/JsonMenu.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src-qt5/core/lumina-desktop/JsonMenu.h b/src-qt5/core/lumina-desktop/JsonMenu.h index fbb80d28..87377a73 100644 --- a/src-qt5/core/lumina-desktop/JsonMenu.h +++ b/src-qt5/core/lumina-desktop/JsonMenu.h @@ -18,6 +18,7 @@ #include <LuminaUtils.h> #include <LuminaXDG.h> +#include "LSession.h" class JsonMenu : public QMenu{ Q_OBJECT @@ -28,6 +29,7 @@ public: JsonMenu(QString execpath, QWidget *parent = 0) : QMenu(parent){ exec = execpath; connect(this, SIGNAL(aboutToShow()), this, SLOT(updateMenu()) ); + connect(this, SIGNAL(triggered(QAction*)), this, SLOT(itemTriggered(QAction*)) ); } private slots: @@ -50,6 +52,7 @@ private slots: this->addMenu(menu); } } + void updateMenu(){ this->clear(); QJsonDocument doc = QJsonDocument::fromJson( LUtils::getCmdOutput(exec).join(" ").toLocal8Bit() ); @@ -64,5 +67,13 @@ private slots: } } } + + void itemTriggered(QAction *act){ + if(act->parent()!=this || act->whatsThis().isEmpty() ){ return; } //only handle direct child actions - needed for recursive nature of menu + QString cmd = act->whatsThis(); + QString bin = cmd.section(" ",0,0); + if( !LUtils::isValidBinary(bin) ){ cmd.prepend("lumina-open "); } + LSession::handle()->LaunchApplication(cmd); + } }; #endif |