Commit d52521ea authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧
Browse files

kns: Get the distributor name from attica rather than from KNS

We get a slighlty better string, although possibly not yet end game.
It's good to show a domain though, which does tell us where it's getting
it from.

Special-case the KDE Store, which is probably what we'll be finding on
most instances.

BUG: 451726
parent 389725b6
Pipeline #210344 passed with stage
in 2 minutes and 43 seconds
......@@ -14,6 +14,7 @@
#include "ReviewsBackend/Rating.h"
#include <appstream/AppStreamUtils.h>
#include <attica/provider.h>
KNSResource::KNSResource(const KNSCore::EntryInternal &entry, QStringList categories, KNSBackend *parent)
: AbstractResource(parent)
......@@ -158,6 +159,18 @@ QString KNSResource::origin() const
return m_entry.providerId();
}
QString KNSResource::displayOrigin() const
{
if (auto providers = knsBackend()->engine()->atticaProviders(); !providers.isEmpty()) {
auto provider = providers.constFirst();
if (provider->name() == QLatin1String("api.kde-look.org")) {
return i18nc("The name of the KDE Store", "KDE Store");
}
return providers.constFirst()->name();
}
return QUrl(m_entry.providerId()).host();
}
QString KNSResource::section()
{
return m_entry.category();
......
......@@ -38,6 +38,7 @@ public:
QString availableVersion() const override;
QString installedVersion() const override;
QString origin() const override;
QString displayOrigin() const override;
QString section() override;
void fetchScreenshots() override;
quint64 size() override;
......
Supports Markdown
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