Commit 5bb1bb24 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

pk: Make sure we notify about resources' versions changing

This way we don't get a poorer version string if we start right into
updates than if we navigate into it.
parent ff875ff8
......@@ -275,7 +275,7 @@ DiscoverPage
Label {
Layout.fillWidth: true
elide: truncated ? Text.ElideLeft : Text.ElideRight
text: upgradeText
text: resource.upgradeText
opacity: listItem.hovered? 0.8 : 0.6
}
}
......
......@@ -112,8 +112,6 @@ QVariant UpdateModel::data(const QModelIndex &index, int role) const
return item->icon();
case Qt::CheckStateRole:
return item->checked();
case UpgradeTextRole:
return item->resource()->upgradeText();
case SizeRole:
return KFormat().formatByteSize(item->size());
case ResourceRole:
......
......@@ -153,6 +153,8 @@ void PackageKitResource::addPackageId(PackageKit::Transaction::Info info, const
if (oldState != state())
emit stateChanged();
Q_EMIT versionsChanged();
}
QStringList PackageKitResource::categories()
......
......@@ -19,6 +19,7 @@ AbstractResource::AbstractResource(AbstractResourcesBackend* parent)
: QObject(parent)
{
connect(this, &AbstractResource::stateChanged, this, &AbstractResource::sizeChanged);
connect(this, &AbstractResource::stateChanged, this, &AbstractResource::versionsChanged);
connect(this, &AbstractResource::stateChanged, this, &AbstractResource::reportNewState);
}
......
......@@ -55,8 +55,8 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
Q_PROPERTY(QString displayOrigin READ displayOrigin CONSTANT)
Q_PROPERTY(int size READ size NOTIFY sizeChanged)
Q_PROPERTY(QString sizeDescription READ sizeDescription NOTIFY sizeChanged)
Q_PROPERTY(QString installedVersion READ installedVersion NOTIFY stateChanged)
Q_PROPERTY(QString availableVersion READ availableVersion NOTIFY stateChanged)
Q_PROPERTY(QString installedVersion READ installedVersion NOTIFY versionsChanged)
Q_PROPERTY(QString availableVersion READ availableVersion NOTIFY versionsChanged)
Q_PROPERTY(QString section READ section CONSTANT)
Q_PROPERTY(QStringList mimetypes READ mimetypes CONSTANT)
Q_PROPERTY(AbstractResourcesBackend* backend READ backend CONSTANT)
......@@ -67,8 +67,8 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
Q_PROPERTY(QString executeLabel READ executeLabel CONSTANT)
Q_PROPERTY(QString sourceIcon READ sourceIcon CONSTANT)
Q_PROPERTY(QString author READ author CONSTANT)
Q_PROPERTY(QDate releaseDate READ releaseDate NOTIFY stateChanged)
Q_PROPERTY(QString upgradeText READ upgradeText NOTIFY stateChanged)
Q_PROPERTY(QDate releaseDate READ releaseDate NOTIFY versionsChanged)
Q_PROPERTY(QString upgradeText READ upgradeText NOTIFY versionsChanged)
public:
/**
* This describes the state of the resource
......@@ -218,6 +218,7 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
void stateChanged();
void ratingFetched();
void longDescriptionChanged();
void versionsChanged();
///response to the fetchScreenshots method
///@p thumbnails and @p screenshots should have the same number of elements
......
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