From 7e6701db3f95788ed55249e3f1f76873cb1a723b Mon Sep 17 00:00:00 2001 From: Akira Ohgaki <akiraohgaki@gmail.com> Date: Wed, 5 Oct 2016 15:17:18 +0900 Subject: [PATCH] Process --- src/handlers/xdgurl.cpp | 20 ++++++++++++++++---- src/handlers/xdgurl.h | 6 +++--- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/handlers/xdgurl.cpp b/src/handlers/xdgurl.cpp index 277f4d8..09a449e 100644 --- a/src/handlers/xdgurl.cpp +++ b/src/handlers/xdgurl.cpp @@ -188,12 +188,12 @@ bool XdgUrl::_uncompressArchive(const QString &path, const QString &targetDir) return false; } -bool XdgUrl::_download() +void XdgUrl::_download() { return true; } -bool XdgUrl::_install() +void XdgUrl::_install() { return true; } @@ -243,9 +243,21 @@ bool XdgUrl::isValid() return isValid; } -bool XdgUrl::process() +void XdgUrl::process() { - return true; + /** + * xdgs scheme is a reserved name, so the process of xdgs + * is the same process of the xdg scheme currently. + */ + + if (isValid()) { + if (_metadata["command"].toString() == "download") { + _download(); + } + else if (_metadata["command"].toString() == "install") { + _install(); + } + } } } // namespace Handlers diff --git a/src/handlers/xdgurl.h b/src/handlers/xdgurl.h index e89df2d..340438d 100644 --- a/src/handlers/xdgurl.h +++ b/src/handlers/xdgurl.h @@ -37,8 +37,8 @@ private: QJsonObject _loadArchiveTypes(); bool _installPlasmapkg(const QString &path, const QString &type = "plasmoid"); bool _uncompressArchive(const QString &path, const QString &targetDir); - bool _download(); - bool _install(); + void _download(); + void _install(); private slots: @@ -46,7 +46,7 @@ public slots: QString getXdgUrl(); QString getMetadata(); bool isValid(); - bool process(); + void process(); signals: void downloaded(const QString &result); -- GitLab