add fallback icons for buttons

This commit is contained in:
shunf4 2021-10-06 22:45:10 +08:00
parent 8b3752ef47
commit ebeb4089eb
6 changed files with 48 additions and 28 deletions

View file

@ -255,8 +255,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 {