Commit e9e99023 authored by Nicolas Fella's avatar Nicolas Fella
Browse files

Simplify icon loading

Instead of resolving a name to a path and loading that into a QIcon get the icon directly. We know the icon will always be there so we don't need the error handling
parent a57ca197
Pipeline #60081 passed with stage
in 12 minutes and 3 seconds
......@@ -39,16 +39,12 @@ AlarmDockWindow::AlarmDockWindow()
setTitle(mName);
// Set up icons
const QString iconPath = KIconLoader::global()->iconPath(QStringLiteral("korgac"), KIconLoader::Panel);
const QIcon iconEnabled = QIcon(iconPath);
if (iconEnabled.isNull()) {
KMessageBox::sorry(associatedWidget(), i18nc("@info", "Cannot load system tray icon."));
} else {
KIconLoader loader;
QImage iconDisabled = iconEnabled.pixmap(loader.currentSize(KIconLoader::Panel)).toImage();
KIconEffect::toGray(iconDisabled, 1.0);
mIconDisabled = QIcon(QPixmap::fromImage(iconDisabled));
}
const QIcon iconEnabled = QIcon::fromTheme(QStringLiteral("korgac"));
KIconLoader loader;
QImage iconDisabled = iconEnabled.pixmap(loader.currentSize(KIconLoader::Panel)).toImage();
KIconEffect::toGray(iconDisabled, 1.0);
mIconDisabled = QIcon(QPixmap::fromImage(iconDisabled));
changeSystrayIcon(alarmsEnabled);
......
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