Browse Source

Fix lupdate errors

I suspect lupdate isn't smart enough to figure out what tr() is suppose
to do, so just make it a static function in class.
The error was: tr() cannot be called without context
adaptive-webui-19844
Chocobo1 6 years ago
parent
commit
6f2b1823ad
No known key found for this signature in database
GPG Key ID: 210D9C873253A68C
  1. 14
      src/base/net/downloadhandler.cpp
  2. 5
      src/base/net/downloadhandler.h

14
src/base/net/downloadhandler.cpp

@ -34,7 +34,6 @@ @@ -34,7 +34,6 @@
#include <QNetworkAccessManager>
#include <QNetworkCookie>
#include <QNetworkProxy>
#include <QNetworkReply>
#include <QNetworkRequest>
#include <QTemporaryFile>
#include <QUrl>
@ -46,9 +45,6 @@ @@ -46,9 +45,6 @@
namespace
{
QString tr(const char *message);
QString errorCodeToString(QNetworkReply::NetworkError status);
bool saveToFile(const QByteArray &replyData, QString &filePath)
{
QTemporaryFile tmpfile {Utils::Fs::tempPath() + "XXXXXX"};
@ -203,14 +199,7 @@ void Net::DownloadHandler::handleRedirection(QUrl newUrl) @@ -203,14 +199,7 @@ void Net::DownloadHandler::handleRedirection(QUrl newUrl)
}
}
namespace
{
QString tr(const char *message)
{
return QCoreApplication::translate("DownloadHandler", message);
}
QString errorCodeToString(QNetworkReply::NetworkError status)
QString Net::DownloadHandler::errorCodeToString(const QNetworkReply::NetworkError status)
{
switch (status) {
case QNetworkReply::HostNotFoundError:
@ -259,4 +248,3 @@ namespace @@ -259,4 +248,3 @@ namespace
return tr("Unknown error");
}
}
}

5
src/base/net/downloadhandler.h

@ -30,10 +30,11 @@ @@ -30,10 +30,11 @@
#ifndef NET_DOWNLOADHANDLER_H
#define NET_DOWNLOADHANDLER_H
#include <QNetworkReply>
#include <QObject>
#include "downloadmanager.h"
class QNetworkReply;
class QUrl;
namespace Net
@ -68,6 +69,8 @@ namespace Net @@ -68,6 +69,8 @@ namespace Net
void assignNetworkReply(QNetworkReply *reply);
void handleRedirection(QUrl newUrl);
static QString errorCodeToString(QNetworkReply::NetworkError status);
QNetworkReply *m_reply;
DownloadManager *m_manager;
const DownloadRequest m_downloadRequest;

Loading…
Cancel
Save