Verified Commit dc9ced72 authored by Fushan Wen's avatar Fushan Wen
Browse files

libdiscover: Fix Discover doesn't show license or description of local package

When setting details of a package, also emit `licensesChanged` and `longDescriptionChanged`,
so when opening a local package using PackageKit backend, the
application page can show licenses and description when the details are

BUG: 452150
parent 4907ad07
Pipeline #158024 passed with stage
in 1 minute and 57 seconds
......@@ -200,6 +200,8 @@ void PackageKitResource::setDetails(const PackageKit::Details &details)
if (m_details != details) {
const auto oldState = state();
const auto oldSize = m_details.size();
const auto oldLicense = m_details.license();
const auto oldDescription = m_details.description();
m_details = details;
if (oldState != state())
......@@ -211,6 +213,14 @@ void PackageKitResource::setDetails(const PackageKit::Details &details)
if (oldSize != uint(size())) {
Q_EMIT sizeChanged();
if (oldLicense != m_details.license()) {
Q_EMIT licensesChanged();
if (oldDescription != m_details.description()) {
Q_EMIT longDescriptionChanged();
......@@ -49,7 +49,7 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
Q_PROPERTY(bool canUpgrade READ canUpgrade NOTIFY stateChanged)
Q_PROPERTY(bool isInstalled READ isInstalled NOTIFY stateChanged)
Q_PROPERTY(QJsonArray licenses READ licenses CONSTANT)
Q_PROPERTY(QJsonArray licenses READ licenses NOTIFY licensesChanged)
Q_PROPERTY(QString longDescription READ longDescription NOTIFY longDescriptionChanged)
Q_PROPERTY(QString origin READ origin CONSTANT)
Q_PROPERTY(QString displayOrigin READ displayOrigin CONSTANT)
......@@ -239,6 +239,7 @@ Q_SIGNALS:
void iconChanged();
void sizeChanged();
void stateChanged();
void licensesChanged();
void ratingFetched();
void longDescriptionChanged();
void versionsChanged();
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