Skip to content
Snippets Groups Projects
Commit 80b084d9 authored by akiraohgaki's avatar akiraohgaki
Browse files

Update qtlibs

parent 93d79ba7
No related branches found
No related tags found
No related merge requests found
......@@ -77,7 +77,7 @@ void XdgUrl::openDestination()
void XdgUrl::networkResourceFinished(qtlibs::NetworkResource *resource)
{
if (resource->reply()->error() != QNetworkReply::NoError) {
if (!resource->isFinishedWithNoError()) {
QJsonObject result;
result["status"] = QString("error_network");
result["message"] = resource->reply()->errorString();
......
......@@ -118,10 +118,18 @@ NetworkResource *NetworkResource::get()
return send(async(), networkRequest);
}
bool NetworkResource::isFinishedWithNoError()
{
if (reply()->isFinished() && reply()->error() == QNetworkReply::NoError) {
return true;
}
return false;
}
QByteArray NetworkResource::readData()
{
QByteArray data;
if (reply()->isFinished()) {
if (isFinishedWithNoError()) {
data = reply()->readAll();
}
return data;
......@@ -129,7 +137,7 @@ QByteArray NetworkResource::readData()
bool NetworkResource::saveData(const QString &path)
{
if (reply()->isFinished()) {
if (isFinishedWithNoError()) {
return qtlibs::File(path).writeData(reply()->readAll());
}
return false;
......@@ -144,7 +152,7 @@ void NetworkResource::abort()
void NetworkResource::replyFinished()
{
if (reply()->error() == QNetworkReply::NoError) {
if (isFinishedWithNoError()) {
// Check if redirection
// Note: An auto redirection option is available since Qt 5.6
QString newUrl;
......
......@@ -44,6 +44,7 @@ public:
NetworkResource *head();
NetworkResource *get();
bool isFinishedWithNoError();
QByteArray readData();
bool saveData(const QString &path);
......
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