From 7fa44e6a7fd92b281a2e3359a33f820ae9a81015 Mon Sep 17 00:00:00 2001 From: Timothy Pearson Date: Tue, 8 Jul 2014 09:16:22 -0500 Subject: [PATCH] Fix abort on startup due to oversized tray icon creation when icon widget has not yet been shown --- src/tdepowersave.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tdepowersave.cpp b/src/tdepowersave.cpp index 50413f8..6779aae 100644 --- a/src/tdepowersave.cpp +++ b/src/tdepowersave.cpp @@ -369,10 +369,11 @@ void tdepowersave::loadIcon(bool forceReload){ if ((pixmap_name_tmp != pixmap_name) || (forceReload)) { pixmap_name = pixmap_name_tmp; if (pixmap_name.startsWith("ERROR")) { - pixmap = SmallIcon("laptoppower", width(), TDEIcon::DisabledState); + pixmap = SmallIcon("laptoppower", isShown() ? width() : 22, TDEIcon::DisabledState); + } + else { + pixmap = SmallIcon(pixmap_name, isShown() ? width() : 22); } - else - pixmap = SmallIcon(pixmap_name, width()); } kdDebugFuncOut(trace); @@ -443,7 +444,9 @@ void tdepowersave::drawIcon(){ } } quit: - image = image.smoothScale(width(), height()); + if (isShown()) { + image = image.smoothScale(width(), height()); + } fullIcon.convertFromImage(image); setPixmap(fullIcon);