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

Don't show the uninstall button when it's noop

This applies to ostree and fwupd resources as well as packagekit's
system update mock one.

BUG: 436365
parent af1b5b4f
......@@ -41,6 +41,7 @@ ConditionalLoader
name: application.isInstalled ? "edit-delete" : "download"
color: !enabled ? Kirigami.Theme.backgroundColor : !listener.isActive ? (application.isInstalled ? Kirigami.Theme.negativeTextColor : Kirigami.Theme.positiveTextColor) : Kirigami.Theme.backgroundColor
}
visible: listener.isActive || !application.isInstalled || application.isRemovable
enabled: !listener.isActive && root.isStateAvailable
onTriggered: root.click()
}
......
......@@ -115,6 +115,10 @@ public:
}
QString cacheFile() const;
bool isRemovable() const override
{
return false;
}
private:
void setDeviceDetails(FwupdDevice *device);
......
......@@ -102,6 +102,10 @@ public:
{
return Technical;
}
bool isRemovable() const override
{
return false;
}
QVector<PackageKitResource *> withoutDuplicates() const
{
......
......@@ -42,6 +42,10 @@ public:
{
return QList<PackageState>();
}
bool isRemovable() const override
{
return false;
}
QString availableVersion() const override;
void setNewVersion(QString);
QString installedVersion() const override;
......@@ -115,4 +119,4 @@ private:
QDate m_releaseDate;
};
#endif
\ No newline at end of file
#endif
......@@ -69,6 +69,7 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
Q_PROPERTY(QString author READ author CONSTANT)
Q_PROPERTY(QDate releaseDate READ releaseDate NOTIFY versionsChanged)
Q_PROPERTY(QString upgradeText READ upgradeText NOTIFY versionsChanged)
Q_PROPERTY(bool isRemovable READ isRemovable CONSTANT)
public:
/**
* This describes the state of the resource
......@@ -215,6 +216,14 @@ public:
virtual QString upgradeText() const;
/**
* @returns whether the package can ever be removed
*/
virtual bool isRemovable() const
{
return true;
}
public Q_SLOTS:
virtual void fetchScreenshots();
virtual void fetchChangelog() = 0;
......
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