summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/applets/brightnessapplet/brightnessapplet.cpp16
-rw-r--r--noncore/applets/brightnessapplet/brightnessapplet.h2
-rw-r--r--noncore/applets/brightnessapplet/brightnessapplet.pro2
3 files changed, 13 insertions, 7 deletions
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.cpp b/noncore/applets/brightnessapplet/brightnessapplet.cpp
index 1ade35e..5aaa27e 100644
--- a/noncore/applets/brightnessapplet/brightnessapplet.cpp
+++ b/noncore/applets/brightnessapplet/brightnessapplet.cpp
@@ -138,8 +138,15 @@ BrightnessAppletControl::~BrightnessAppletControl()
{
}
+void BrightnessAppletControl::hideEvent( QHideEvent* e )
+{
+ BrightnessApplet* applet = static_cast<BrightnessApplet*>( parent() );
+ applet->writeSystemBrightness( applet->calcBrightnessValue() );
+ QFrame::hideEvent( e );
+}
+
BrightnessApplet::BrightnessApplet( QWidget *parent, const char *name )
:OTaskbarApplet( parent, name )
{
setFixedHeight( AppLnk::smallIconSize() );
@@ -159,8 +166,10 @@ void BrightnessApplet::writeSystemBrightness(int brightness)
} else {
cfg.setGroup("Battery");
}
cfg.writeEntry("Brightness", brightness);
+ odebug << "writing brightness " << brightness << oendl;
+ cfg.write();
}
int BrightnessApplet::readSystemBrightness(void)
@@ -172,8 +181,10 @@ int BrightnessApplet::readSystemBrightness(void)
cfg.setGroup("AC");
} else {
cfg.setGroup("Battery");
}
+
+ odebug << "reading brightness " << cfg.readNumEntry("Brightness", 128) << oendl;
return cfg.readNumEntry("Brightness", 128);
}
@@ -222,13 +233,8 @@ void BrightnessApplet::mousePressEvent( QMouseEvent* )
popup( _control );
_control->slider->setValue((_control->slider->maxValue() * v + 128) / 255);
connect(_control->slider, SIGNAL(valueChanged(int)), this, SLOT(sliderMoved(int)));
}
- else
- {
- _control->hide();
- writeSystemBrightness( calcBrightnessValue() );
- }
}
EXPORT_OPIE_APPLET_v1( BrightnessApplet )
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.h b/noncore/applets/brightnessapplet/brightnessapplet.h
index 8b88bd1..6d6d369 100644
--- a/noncore/applets/brightnessapplet/brightnessapplet.h
+++ b/noncore/applets/brightnessapplet/brightnessapplet.h
@@ -46,9 +46,9 @@ class BrightnessAppletControl : public QFrame
{
public:
BrightnessAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 );
~BrightnessAppletControl();
-
+ virtual void hideEvent( QHideEvent* );
QSlider* slider;
};
class BrightnessApplet : public Opie::Ui::OTaskbarApplet
diff --git a/noncore/applets/brightnessapplet/brightnessapplet.pro b/noncore/applets/brightnessapplet/brightnessapplet.pro
index 5044f38..8c65120 100644
--- a/noncore/applets/brightnessapplet/brightnessapplet.pro
+++ b/noncore/applets/brightnessapplet/brightnessapplet.pro
@@ -6,8 +6,8 @@ TARGET = brightnessapplet
DESTDIR = $(OPIEDIR)/plugins/applets
INCLUDEPATH += $(OPIEDIR)/include
DEPENDPATH += $(OPIEDIR)/include
LIBS += -lqpe -lopiecore2 -lopieui2
-VERSION = 0.1.0
+VERSION = 0.1.1
include ( $(OPIEDIR)/include.pro )