Members of the KDE Community are recommended to subscribe to the kde-community mailing list at to allow them to participate in important discussions and receive other important announcements

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

Actually provide icons for snaps

parent c166ec57
......@@ -22,6 +22,8 @@
#include "SnapBackend.h"
#include <QDebug>
#include <QProcess>
#include <QBuffer>
#include <QImageReader>
SnapResource::SnapResource(QSnapdSnap* snap, AbstractResource::State state, SnapBackend* parent)
: AbstractResource(parent)
......@@ -57,7 +59,29 @@ QUrl SnapResource::homepage()
QVariant SnapResource::icon() const
return QUrl(m_snap->icon());
const auto iconPath = m_snap->icon();
if (iconPath.isEmpty())
return QStringLiteral("package-x-generic");
if (!iconPath.startsWith(QLatin1Char('/')))
return QUrl(iconPath);
auto backend = qobject_cast<SnapBackend*>(parent());
auto req = backend->client()->getIcon(iconPath);
if (req->error()) {
qWarning() << "icon error" << req->errorString() << iconPath;
return {};
auto icon = req->icon();
QBuffer buffer;
QImageReader reader(&buffer);
return QVariant::fromValue<QImage>(;
QString SnapResource::installedVersion() const
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