diff options
author | Weblate <noreply@weblate.org> | 2018-01-02 22:18:34 +0000 |
---|---|---|
committer | Weblate <noreply@weblate.org> | 2018-01-02 22:18:34 +0000 |
commit | 4bf6d3f38634dbb517055444a22d824d6eba99d8 (patch) | |
tree | bbe3e3e511f37222cdd9db145bde2f41a35e1260 /src-qt5/src-cpp/plugins-desktop.cpp | |
parent | Translated using Weblate (Danish) (diff) | |
parent | Merge remote-tracking branch 'origin/master' (diff) | |
download | lumina-4bf6d3f38634dbb517055444a22d824d6eba99d8.tar.gz lumina-4bf6d3f38634dbb517055444a22d824d6eba99d8.tar.bz2 lumina-4bf6d3f38634dbb517055444a22d824d6eba99d8.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; +} |