summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-07-08 09:16:22 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-07-08 09:16:22 -0500
commit7fa44e6a7fd92b281a2e3359a33f820ae9a81015 (patch)
tree8ef0a0999ae733e508819732b51d285340813310
parent937d80a75d553073681dec28ff4e7508edf6bc29 (diff)
downloadtdepowersave-7fa44e6a7fd92b281a2e3359a33f820ae9a81015.tar.gz
tdepowersave-7fa44e6a7fd92b281a2e3359a33f820ae9a81015.zip
Fix abort on startup due to oversized tray icon creation when icon widget has not yet been shown
-rw-r--r--src/tdepowersave.cpp11
1 files 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);