diff options
author | Ken Moore <ken@ixsystems.com> | 2018-01-02 15:59:01 -0500 |
---|---|---|
committer | Ken Moore <ken@ixsystems.com> | 2018-01-02 15:59:01 -0500 |
commit | be7b418178ddca223a33558351c9cae9d67ccc95 (patch) | |
tree | 7f3f8eb786c03db2fe9518dc9d58b8c68cf8afdd /src-qt5/src-cpp/plugins-desktop.cpp | |
parent | Add the new "DesktopManager" class into lumina2 sources. (diff) | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | lumina-be7b418178ddca223a33558351c9cae9d67ccc95.tar.gz lumina-be7b418178ddca223a33558351c9cae9d67ccc95.tar.bz2 lumina-be7b418178ddca223a33558351c9cae9d67ccc95.zip |
Merge branch 'master' of github.com:trueos/lumina
Diffstat (limited to 'src-qt5/src-cpp/plugins-desktop.cpp')
-rw-r--r-- | src-qt5/src-cpp/plugins-desktop.cpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src-qt5/src-cpp/plugins-desktop.cpp b/src-qt5/src-cpp/plugins-desktop.cpp new file mode 100644 index 00000000..fdbd676d --- /dev/null +++ b/src-qt5/src-cpp/plugins-desktop.cpp @@ -0,0 +1,40 @@ +//=========================================== +// Lumina-desktop source code +// Copyright (c) 2017, Ken Moore +// Available under the 3-clause BSD license +// See the LICENSE file for full details +//=========================================== +#include "plugins-desktop.h" + +// ============ +// DT PLUGIN +// ============ +DTPlugin::DTPlugin(){ + +} + +DTPlugin::~DTPlugin(){ + +} + +bool DTPlugin::isValid(){ + if(data.isEmpty()){ return false; } + bool ok = data.contains("name") && data.contains("qml") && data.contains("description"); + ok &= containsDefault("name"); + ok &= containsDefault("description"); + if(ok) { + QJsonObject tmp = data.value("qml").toObject(); + QStringList mustexist; + QString exec = tmp.value("exec").toString(); + if(exec.isEmpty() || !exec.endsWith(".qml")){ return false; } + mustexist << exec; + QJsonArray tmpA = data.value("additional_files").toArray(); + for(int i=0; i<tmpA.count(); i++){ mustexist << tmpA[i].toString(); } + QString reldir = currentfile.section("/",0,-2) + "/"; + for(int i=0; i<mustexist.length() && ok; i++){ + if(mustexist[i].startsWith("/")){ ok = QFile::exists(mustexist[i]); } + else { ok = QFile::exists(reldir+mustexist[i]); } + } + } + return ok; +} |