Skip to content
Snippets Groups Projects
Commit 74ec3d15 authored by akiraohgaki's avatar akiraohgaki
Browse files

Add openDestination slot

parent 723f5c49
No related branches found
No related tags found
No related merge requests found
......@@ -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
......@@ -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();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment