Commit 316cf301 authored by Aleix Pol Gonzalez's avatar Aleix Pol Gonzalez 🐧

Make AbstractResource::state() const

CCMAIL: Nate Graham <pointedstick@zoho.com>
parent dccb04be
......@@ -124,7 +124,7 @@ QString DummyResource::section()
return QStringLiteral("dummy");
}
AbstractResource::State DummyResource::state()
AbstractResource::State DummyResource::state() const
{
return m_state;
}
......
......@@ -40,7 +40,7 @@ public:
int size() override;
QUrl homepage() override;
QStringList categories() override;
AbstractResource::State state() override;
AbstractResource::State state() const override;
QVariant icon() const override;
QString comment() override;
QString name() override;
......
......@@ -344,7 +344,7 @@ QString FlatpakResource::sizeDescription()
}
}
AbstractResource::State FlatpakResource::state()
AbstractResource::State FlatpakResource::state() const
{
return m_state;
}
......
......@@ -97,7 +97,7 @@ public:
QString section() override;
int size() override;
QString sizeDescription() override;
AbstractResource::State state() override;
AbstractResource::State state() const override;
ResourceType type() const;
QString typeAsString() const;
QString uniqueId() const;
......
......@@ -37,7 +37,7 @@ KNSResource::KNSResource(const KNSCore::EntryInternal& entry, QStringList catego
KNSResource::~KNSResource() = default;
AbstractResource::State KNSResource::state()
AbstractResource::State KNSResource::state() const
{
switch(m_entry.status()) {
case KNS3::Entry::Invalid:
......
......@@ -35,7 +35,7 @@ public:
explicit KNSResource(const KNSCore::EntryInternal & c, QStringList categories, KNSBackend* parent);
~KNSResource() override;
AbstractResource::State state() override;
AbstractResource::State state() const override;
QVariant icon() const override;
QString comment() override;
QString name() override;
......
......@@ -32,7 +32,7 @@ class LocalFilePKResource : public PackageKitResource
QString name() override;
QString comment() override;
AbstractResource::State state() override { return m_state; }
AbstractResource::State state() const override { return m_state; }
int size() override;
void markInstalled();
......
......@@ -130,7 +130,7 @@ QString PackageKitResource::section()
return QString();
}
AbstractResource::State PackageKitResource::state()
AbstractResource::State PackageKitResource::state() const
{
if (backend()->isPackageNameUpgradeable(this))
return Upgradeable;
......
......@@ -47,7 +47,7 @@ class PackageKitResource : public AbstractResource
void fetchChangelog() override;
QList<PackageState> addonsInformation() override;
State state() override;
State state() const override;
QString installedVersion() const override;
QString availableVersion() const override;
......
......@@ -136,7 +136,7 @@ QString SnapResource::section()
return QStringLiteral("snap");
}
AbstractResource::State SnapResource::state()
AbstractResource::State SnapResource::state() const
{
return m_state;
}
......
......@@ -44,7 +44,7 @@ public:
int size() override;
QUrl homepage() override;
QStringList categories() override;
AbstractResource::State state() override;
AbstractResource::State state() const override;
QVariant icon() const override;
QString comment() override;
QString name() override;
......
......@@ -53,12 +53,12 @@ QJsonValue AbstractResource::getMetadata(const QString &key)
return m_metadata.value(key);
}
bool AbstractResource::canUpgrade()
bool AbstractResource::canUpgrade() const
{
return state() == Upgradeable;
}
bool AbstractResource::isInstalled()
bool AbstractResource::isInstalled() const
{
return state() >= Installed;
}
......
......@@ -122,7 +122,7 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
///executes the resource, if applies.
Q_SCRIPTABLE virtual void invokeApplication() const = 0;
virtual State state() = 0;
virtual State state() const = 0;
virtual QStringList categories() = 0;
///@returns a URL that points to the content
......@@ -154,8 +154,8 @@ class DISCOVERCOMMON_EXPORT AbstractResource : public QObject
void addMetadata(const QString &key, const QJsonValue &value);
QJsonValue getMetadata(const QString &key);
bool canUpgrade();
bool isInstalled();
bool canUpgrade() const;
bool isInstalled() const;
///@returns a user-readable explaination of the resource status
///by default, it will specify what state() is returning
......
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