diff options
author | Weblate <noreply@weblate.org> | 2018-01-02 20:53:45 +0000 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2018-01-02 20:53:45 +0000 |
commit | 42e4f35c9a2ea2689b62ef8c5461b14a2b820e4f (patch) | |
tree | a92f81f73b37b7de76cc5238f1ec393ae5a18ecd /src-qt5/src-cpp/plugins-desktop.cpp | |
parent | Translated using Weblate (Dutch) (diff) | |
parent | Updated project files for plugin system (diff) | |
download | lumina-42e4f35c9a2ea2689b62ef8c5461b14a2b820e4f.tar.gz lumina-42e4f35c9a2ea2689b62ef8c5461b14a2b820e4f.tar.bz2 lumina-42e4f35c9a2ea2689b62ef8c5461b14a2b820e4f.zip |
Merge remote-tracking branch 'origin/master'
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; +} |