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

Don't take a stock icon for good if it wasn't found

If the metadata is wrong or just the icon isn't present in the theme,
just offer the icon that is shipped with the metadata.
parent de6019e5
......@@ -197,8 +197,12 @@ QVariant FlatpakResource::icon() const
}
}
} break;
case AppStream::Icon::KindStock:
return QIcon::fromTheme(icon.name(), QIcon::fromTheme(QStringLiteral("package-x-generic")));
case AppStream::Icon::KindStock: {
const auto ret = QIcon::fromTheme(icon.name());
if (!ret.isNull())
return ret;
break;
}
case AppStream::Icon::KindRemote: {
const QString fileName = iconCachePath(icon);
if (QFileInfo::exists(fileName)) {
......
......@@ -72,8 +72,12 @@ static QIcon componentIcon(const AppStream::Component &comp)
case AppStream::Icon::KindCached:
ret.addFile(icon.url().toLocalFile(), icon.size());
break;
case AppStream::Icon::KindStock:
return QIcon::fromTheme(icon.name(), QIcon::fromTheme(QStringLiteral("package-x-generic")));
case AppStream::Icon::KindStock: {
const auto ret = QIcon::fromTheme(icon.name());
if (!ret.isNull())
return ret;
break;
}
default:
break;
}
......
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