Commit dcd9d018 authored by Laurent Montel's avatar Laurent Montel 😁

Make it compile against qt5.15. SkipEmptyParts is part of Qt::.

parent 2dca85b4
......@@ -122,7 +122,11 @@ void DiscoverBackendsFactory::setupCommandLine(QCommandLineParser* parser)
void DiscoverBackendsFactory::processCommandLine(QCommandLineParser* parser, bool test)
{
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
QStringList backends = test ? QStringList{ QStringLiteral("dummy-backend") } : parser->value(QStringLiteral("backends")).split(QLatin1Char(','), QString::SkipEmptyParts);
#else
QStringList backends = test ? QStringList{ QStringLiteral("dummy-backend") } : parser->value(QStringLiteral("backends")).split(QLatin1Char(','), Qt::SkipEmptyParts);
#endif
for(auto &backend: backends) {
if (!backend.endsWith(QLatin1String("-backend")))
backend.append(QLatin1String("-backend"));
......
......@@ -111,7 +111,11 @@ QStringList AppStreamUtils::appstreamIds(const QUrl &appstreamUrl)
ret += appstreamUrl.host().isEmpty() ? appstreamUrl.path() : appstreamUrl.host();
if (appstreamUrl.hasQuery()) {
QUrlQuery query(appstreamUrl);
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
ret << query.queryItemValue(QStringLiteral("alt")).split(QLatin1Char(','), QString::SkipEmptyParts);
#else
ret << query.queryItemValue(QStringLiteral("alt")).split(QLatin1Char(','), Qt::SkipEmptyParts);
#endif
}
return ret;
}
......@@ -142,11 +142,7 @@ void OdrsReviewsBackend::reviewsFetched()
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
QScopedPointer<QNetworkReply, QScopedPointerDeleteLater> replyPtr(reply);
const QByteArray data = reply->readAll();
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
const auto networkError = reply->error();
#else
const auto networkError = reply->networkError();
#endif
if (networkError != QNetworkReply::NoError) {
qCWarning(LIBDISCOVER_LOG) << "error fetching reviews:" << reply->errorString() << data;
m_isFetching = false;
......@@ -189,11 +185,7 @@ void OdrsReviewsBackend::submitUsefulness(Review *review, bool useful)
void OdrsReviewsBackend::usefulnessSubmitted()
{
QNetworkReply* reply = qobject_cast<QNetworkReply*>(sender());
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
const auto networkError = reply->error();
#else
const auto networkError = reply->networkError();
#endif
if (networkError == QNetworkReply::NoError) {
qCWarning(LIBDISCOVER_LOG) << "Usefulness submitted";
} else {
......@@ -239,11 +231,7 @@ void OdrsReviewsBackend::submitReview(AbstractResource *res, const QString &summ
void OdrsReviewsBackend::reviewSubmitted(QNetworkReply *reply)
{
#if (QT_VERSION < QT_VERSION_CHECK(5, 15, 0))
const auto networkError = reply->error();
#else
const auto networkError = reply->networkError();
#endif
if (networkError == QNetworkReply::NoError) {
qCWarning(LIBDISCOVER_LOG) << "Review submitted";
AbstractResource *resource = qobject_cast<AbstractResource*>(reply->request().originatingObject());
......
......@@ -554,7 +554,11 @@ ResultsStream * KNSBackend::findResourceByPackageName(const QUrl& search)
if (search.scheme() != QLatin1String("kns") || search.host() != name())
return voidStream();
#if QT_VERSION < QT_VERSION_CHECK(5, 15, 0)
const auto pathParts = search.path().split(QLatin1Char('/'), QString::SkipEmptyParts);
#else
const auto pathParts = search.path().split(QLatin1Char('/'), Qt::SkipEmptyParts);
#endif
if (pathParts.size() != 2) {
Q_EMIT passiveMessage(i18n("Wrong KNewStuff URI: %1", search.toString()));
return voidStream();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment