diff --git a/src/handlers/xdgurl.cpp b/src/handlers/xdgurl.cpp index a4eb4202217d7c238d4da157e7f216130dd3ad75..6dc8fcfb6740fec647eaabaf2a4ed0e45d136f78 100644 --- a/src/handlers/xdgurl.cpp +++ b/src/handlers/xdgurl.cpp @@ -16,7 +16,7 @@ namespace Handlers { XdgUrl::XdgUrl(const QString &xdgUrl, Core::Config *appConfig, Core::Config *userConfig, Core::Network *asyncNetwork, QObject *parent) : QObject(parent), _xdgUrl(xdgUrl), _appConfig(appConfig), _userConfig(userConfig), _asyncNetwork(asyncNetwork) { - _meta = _parse(); + _metadata = _parse(); _destinations = _importDestinations(); _archiveTypes = _importArchiveTypes(); } @@ -210,27 +210,32 @@ QString XdgUrl::getXdgUrl() return _xdgUrl; } +QString XdgUrl::getMetadata() +{ + return Utility::Json::convertObjToStr(_metadata); +} + bool XdgUrl::isValid() { bool isValid = true; - if (_meta["scheme"].toString() != "xdg" && _meta["scheme"].toString() != "xdgs") { + if (_metadata["scheme"].toString() != "xdg" && _metadata["scheme"].toString() != "xdgs") { isValid = false; } - if (_meta["command"].toString() != "download" && _meta["command"].toString() != "install") { + if (_metadata["command"].toString() != "download" && _metadata["command"].toString() != "install") { isValid = false; } - if (!QUrl(_meta["url"].toString()).isValid()) { + if (!QUrl(_metadata["url"].toString()).isValid()) { isValid = false; } - if (!_destinations.contains(_meta["type"].toString())) { + if (!_destinations.contains(_metadata["type"].toString())) { isValid = false; } - if (_meta["filename"].toString().isEmpty()) { + if (_metadata["filename"].toString().isEmpty()) { isValid = false; } diff --git a/src/handlers/xdgurl.h b/src/handlers/xdgurl.h index 619e2aec346579ca3b0469374365ed0a928f142c..d1c0cdfd08b1a956e4e79e9a4270bbd11736a126 100644 --- a/src/handlers/xdgurl.h +++ b/src/handlers/xdgurl.h @@ -23,7 +23,7 @@ private: Core::Config *_userConfig; Core::Network *_asyncNetwork; - QJsonObject _meta; + QJsonObject _metadata; QJsonObject _destinations; QJsonObject _archiveTypes; @@ -44,6 +44,7 @@ private slots: public slots: QString getXdgUrl(); + QString getMetadata(); bool isValid(); bool process();