From 70a35d68f5db7abd57210bc289a334df8dbc1dd2 Mon Sep 17 00:00:00 2001 From: Ken Moore Date: Thu, 30 Jun 2016 15:05:54 -0400 Subject: Add the new jsonmenu menu plugin to lumina-config, with a new dialog for setting it up. --- .../lumina-config/pages/page_interface_menu.cpp | 25 ++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'src-qt5/core-utils/lumina-config/pages') diff --git a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp index 742c5728..d211d380 100644 --- a/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp +++ b/src-qt5/core-utils/lumina-config/pages/page_interface_menu.cpp @@ -9,7 +9,7 @@ #include "getPage.h" #include "../AppDialog.h" #include "../GetPluginDialog.h" - +#include "../ScriptDialog.h" //========== // PUBLIC //========== @@ -52,7 +52,6 @@ QStringList items = settings.value("menu/itemlist", QStringList() ).toStringList //qDebug() << "Menu Items:" << items; ui->list_menu->clear(); for(int i=0; imenuPluginInfo(items[i]); if(items[i].startsWith("app::::")){ bool ok = false; XDGDesktop desk = LXDG::loadDesktopFile(items[i].section("::::",1,1), ok); @@ -64,7 +63,20 @@ QStringList items = settings.value("menu/itemlist", QStringList() ).toStringList item->setToolTip( desk.comment ); ui->list_menu->addItem(item); continue; //now go to the next item + }else if(items[i].startsWith("jsonmenu::::")){ + LPI info = PINFO->menuPluginInfo( items[i].section("::::",0,0) ); + if(info.ID.isEmpty()){ continue; } //invalid plugin type (no longer available?) + QString exec = items[i].section("::::",1,1); + + QListWidgetItem *item = new QListWidgetItem(); + item->setWhatsThis( items[i] ); + item->setIcon( LXDG::findIcon(items[i].section("::::",3,3),info.icon) ); + item->setText( items[i].section("::::",2,2) +" ("+info.name+")" ); + item->setToolTip( info.description ); + ui->list_menu->addItem(item); + continue; //now go to the next item } + LPI info = PINFO->menuPluginInfo(items[i]); if(info.ID.isEmpty()){ continue; } //invalid plugin //qDebug() << "Add Menu Item:" << info.ID; QListWidgetItem *item = new QListWidgetItem(); @@ -121,6 +133,15 @@ void page_interface_menu::addmenuplugin(){ it = new QListWidgetItem(LXDG::findIcon(desk.icon,""), desk.name ); it->setWhatsThis(info.ID+"::::"+desk.filePath); it->setToolTip( desk.comment ); + }else if(info.ID=="jsonmenu"){ + //Need to prompt for the script file, name, and icon to use + //new ID format: "jsonmenu":::::::::::: + ScriptDialog SD(this); + SD.exec(); + if(!SD.isValid()){ return; } + it = new QListWidgetItem( LXDG::findIcon(SD.icon(),"text-x-script"), SD.name()+" ("+info.ID+")" ); + it->setWhatsThis(info.ID+"::::"+SD.command()+"::::"+SD.name()+"::::"+SD.icon()); + it->setToolTip( info.description ); }else{ it = new QListWidgetItem( LXDG::findIcon(info.icon,""), info.name ); it->setWhatsThis(info.ID); -- cgit