Merge pull request 'fix: use fallback icons on buttons, when no supported theme is installed' (#53) from shunf4/squawk:fix/btn_icons into messageFeed

Reviewed-on: blue/squawk#53
This commit is contained in:
Blue 2021-10-16 15:36:57 +00:00
commit e47ba603e0
6 changed files with 48 additions and 28 deletions

View file

@ -292,8 +292,12 @@ void Conversation::addAttachedFile(const QString& path)
QMimeDatabase db;
QMimeType type = db.mimeTypeForFile(path);
QFileInfo info(path);
Badge* badge = new Badge(path, info.fileName(), QIcon::fromTheme(type.iconName()));
QIcon fileIcon = QIcon::fromTheme(type.iconName());
if (fileIcon.isNull()) {
fileIcon.addFile(QString::fromUtf8(":/images/fallback/dark/big/mail-attachment.svg"), QSize(), QIcon::Normal, QIcon::Off);
}
Badge* badge = new Badge(path, info.fileName(), fileIcon);
connect(badge, &Badge::close, this, &Conversation::onBadgeClose);
try {