summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-10 03:07:11 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2010-05-10 03:07:11 +0000
commit8893f3b50b23d0010343ab7b846a00721e689480 (patch)
tree0d5a0c00a45e95f3cfa4701247c79316c8cacaac
parentfe254d5058973b6a4e321d4a2a208176a70b595e (diff)
downloadtdepowersave-8893f3b50b23d0010343ab7b846a00721e689480.tar.gz
tdepowersave-8893f3b50b23d0010343ab7b846a00721e689480.zip
Part of batch commit to enable true tasktray resize support for Trinity applications
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/kpowersave@1124761 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
-rw-r--r--src/kpowersave.cpp12
-rw-r--r--src/kpowersave.h3
2 files changed, 13 insertions, 2 deletions
diff --git a/src/kpowersave.cpp b/src/kpowersave.cpp
index 18b50f2..9449663 100644
--- a/src/kpowersave.cpp
+++ b/src/kpowersave.cpp
@@ -236,6 +236,13 @@ void kpowersave::initMenu() {
kdDebugFuncOut(trace);
}
+void kpowersave::resizeEvent ( QResizeEvent * )
+{
+ // Honor Free Desktop specifications that allow for arbitrary system tray icon sizes
+ loadIcon();
+ drawIcon();
+}
+
/*!
* This funtion load and manipulate the icons for the kickerapplet-section.
* The redraw interval depends on \ref icon_set_colored and \ref BAT_icon_BG_intervall.
@@ -354,10 +361,10 @@ void kpowersave::loadIcon(){
if(pixmap_name_tmp != pixmap_name) {
pixmap_name = pixmap_name_tmp;
if (pixmap_name.startsWith("ERROR")) {
- pixmap = SmallIcon("laptoppower", 22, KIcon::DisabledState);
+ pixmap = SmallIcon("laptoppower", width(), KIcon::DisabledState);
}
else
- pixmap = SmallIcon(pixmap_name, 22);
+ pixmap = SmallIcon(pixmap_name, width());
}
kdDebugFuncOut(trace);
@@ -427,6 +434,7 @@ void kpowersave::drawIcon(){
}
}
quit:
+ image = image.smoothScale(width(), height());
fullIcon.convertFromImage(image);
setPixmap(fullIcon);
diff --git a/src/kpowersave.h b/src/kpowersave.h
index bd588cd..e739344 100644
--- a/src/kpowersave.h
+++ b/src/kpowersave.h
@@ -481,6 +481,9 @@ k_dcop:
QStringList listSchemes();
//! dcop function to return the supported CPU
QStringList listCPUFreqPolicies();
+
+protected:
+ void resizeEvent ( QResizeEvent * );
};
#endif // _KPOWERSAVE_H_