summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-07-08 09:18:14 -0500
committerTimothy Pearson <kb9vqf@pearsoncomputing.net>2014-07-08 09:18:14 -0500
commit5997a6378cdae679e018b1c29014d9e52c5e8631 (patch)
tree5c4ab1a41e143b39f0b7dc668c220d95e9f6d58e /src
parentdcd19cee1d789ddb3a6d83487b4b53268e0aaa34 (diff)
downloadkpowersave-5997a6378cdae679e018b1c29014d9e52c5e8631.tar.gz
kpowersave-5997a6378cdae679e018b1c29014d9e52c5e8631.zip
Fix abort on startup due to oversized tray icon creation when icon widget has not yet been shown
Diffstat (limited to 'src')
-rw-r--r--src/kpowersave.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/kpowersave.cpp b/src/kpowersave.cpp
index d6d98c2..b372245 100644
--- a/src/kpowersave.cpp
+++ b/src/kpowersave.cpp
@@ -361,10 +361,11 @@ void kpowersave::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);
@@ -435,7 +436,9 @@ void kpowersave::drawIcon(){
}
}
quit:
- image = image.smoothScale(width(), height());
+ if (isShown()) {
+ image = image.smoothScale(width(), height());
+ }
fullIcon.convertFromImage(image);
setPixmap(fullIcon);