diff --git a/src/handlers/xdgurl.cpp b/src/handlers/xdgurl.cpp index c5d4dbfd881d171673dad6694ff1d4d9671451ff..b73698d2804fe8f64c335c664d49500ad3cf4621 100644 --- a/src/handlers/xdgurl.cpp +++ b/src/handlers/xdgurl.cpp @@ -3,6 +3,7 @@ #include <QTemporaryFile> #include <QMimeDatabase> #include <QNetworkReply> +#include <QDesktopServices> #include "../core/config.h" #include "../core/network.h" @@ -131,6 +132,8 @@ void XdgUrl::_saveDownloadedFile(QNetworkReply *reply) return; } + _destination = destination; + result["status"] = QString("success_download"); result["message"] = QString("The file has been stored into " + destination); emit finished(Utility::Json::convertObjToStr(result)); @@ -207,6 +210,8 @@ void XdgUrl::_installDownloadedFile(QNetworkReply *reply) return; } + _destination = destination; + result["status"] = QString("success_install"); emit finished(Utility::Json::convertObjToStr(result)); } @@ -303,4 +308,11 @@ void XdgUrl::process() emit started(); } +void XdgUrl::openDestination() +{ + if (!_destination.isEmpty()) { + QDesktopServices::openUrl(QUrl("file://" + _destination)); + } +} + } // namespace Handlers diff --git a/src/handlers/xdgurl.h b/src/handlers/xdgurl.h index becb66906f6a9c0a0a93cda79390ac5db35b67a9..427025240052f6928850f8a3f9488e87f5f377c7 100644 --- a/src/handlers/xdgurl.h +++ b/src/handlers/xdgurl.h @@ -24,6 +24,7 @@ private: QJsonObject _metadata; QJsonObject _destinations; + QString _destination; public: explicit XdgUrl(const QString &xdgUrl, Core::Config *config, Core::Network *network, QObject *parent = 0); @@ -43,6 +44,7 @@ public slots: QString getMetadata(); bool isValid(); void process(); + void openDestination(); signals: void started();