Members of the KDE Community are recommended to subscribe to the kde-community mailing list at https://mail.kde.org/mailman/listinfo/kde-community to allow them to participate in important discussions and receive other important announcements

Commit f48ca758 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Show the origin in the ApplicationPage

It's important to know who is offering the resource

BUG: 380976
parent 2374dfe4
......@@ -153,6 +153,9 @@ DiscoverPage {
Label {
text: i18n("Size: %1", appInfo.application.sizeDescription)
}
Label {
text: i18n("Origin: %1 (%2)", appInfo.application.origin, appInfo.application.backend.displayName)
}
Label {
visible: text.length>0
text: appInfo.application.license ? i18n("License: %1", appInfo.application.license) : ""
......
......@@ -179,4 +179,9 @@ AbstractResource * DummyBackend::resourceForFile(const QUrl& path)
return res;
}
QString DummyBackend::displayName() const
{
return QStringLiteral("Dummy");
}
#include "DummyBackend.moc"
......@@ -50,6 +50,7 @@ public:
bool isFetching() const override { return m_fetching; }
AbstractResource * resourceForFile(const QUrl & ) override;
void checkForUpdates() override;
QString displayName() const override;
public Q_SLOTS:
void toggleFetching();
......
......@@ -1056,4 +1056,9 @@ AbstractResource * FlatpakBackend::resourceForFile(const QUrl &url)
return resource;
}
QString FlatpakBackend::displayName() const
{
return QStringLiteral("Flatpak");
}
#include "FlatpakBackend.moc"
......@@ -60,6 +60,7 @@ public:
bool isFetching() const override { return m_fetching; }
AbstractResource * resourceForFile(const QUrl & ) override;
void checkForUpdates() override;
QString displayName() const override;
private Q_SLOTS:
void onFetchMetadataFinished(FlatpakInstallation *flatpakInstallation, FlatpakResource *resource, const QByteArray &metadata);
......
......@@ -385,4 +385,9 @@ AbstractBackendUpdater* KNSBackend::backendUpdater() const
return m_updater;
}
QString KNSBackend::displayName() const
{
return QStringLiteral("KNewStuff");
}
#include "KNSBackend.moc"
......@@ -64,6 +64,8 @@ public:
void checkForUpdates() override {}
QString displayName() const override;
Q_SIGNALS:
void receivedResources(const QVector<AbstractResource*> &resources);
void searchFinished();
......
......@@ -593,5 +593,22 @@ AbstractResource * PackageKitBackend::resourceForFile(const QUrl& file)
return nullptr;
}
static QString readDistroName()
{
QProcess process;
process.setEnvironment({QStringLiteral("LC_ALL=C")});
process.start(QStringLiteral("lsb_release"), {QStringLiteral("-sd")});
process.waitForFinished();
auto output = process.readAll().trimmed();
if (output.startsWith('\"') && output.endsWith('\"'))
output = output.mid(1, output.length()-2);
return QString::fromLocal8Bit(output);
}
QString PackageKitBackend::displayName() const
{
static const QString distro = readDistroName();
return distro;
}
#include "PackageKitBackend.moc"
......@@ -69,6 +69,7 @@ class DISCOVERCOMMON_EXPORT PackageKitBackend : public AbstractResourcesBackend
AbstractResource * resourceForFile(const QUrl & ) override;
void checkForUpdates() override;
QString displayName() const override;
public Q_SLOTS:
void reloadPackageList();
......
......@@ -152,4 +152,9 @@ void SnapBackend::removeApplication(AbstractResource* _app)
transModel->addTransaction(new SnapTransaction(app, job, &m_socket, Transaction::RemoveRole));
}
QString SnapBackend::displayName() const
{
return QStringLiteral("Snap");
}
#include "SnapBackend.moc"
......@@ -39,11 +39,13 @@ public:
ResultsStream * search(const AbstractResourcesBackend::Filters & search) override;
ResultsStream * findResourceByPackageName(const QUrl& search) override;
QString displayName() const override;
int updatesCount() const override;
AbstractBackendUpdater* backendUpdater() const override;
AbstractReviewsBackend* reviewsBackend() const override;
bool isValid() const override { return true; } // No external file dependencies that could cause runtime errors
QList<QAction*> messageActions() const override { return {}; }
void checkForUpdates() override {}
void installApplication(AbstractResource* app) override;
void installApplication(AbstractResource* app, const AddonList& addons) override;
......
......@@ -74,6 +74,7 @@ class DISCOVERCOMMON_EXPORT AbstractResourcesBackend : public QObject
{
Q_OBJECT
Q_PROPERTY(QString name READ name CONSTANT)
Q_PROPERTY(QString displayName READ displayName CONSTANT)
Q_PROPERTY(AbstractReviewsBackend* reviewsBackend READ reviewsBackend CONSTANT)
Q_PROPERTY(int updatesCount READ updatesCount NOTIFY updatesCountChanged)
Q_PROPERTY(bool isFetching READ isFetching NOTIFY fetchingChanged)
......@@ -158,6 +159,8 @@ class DISCOVERCOMMON_EXPORT AbstractResourcesBackend : public QObject
/** @internal only to be used by the factory */
void setName(const QString& name);
virtual QString displayName() const = 0;
/**
* emits a change for all rating properties
*/
......
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