summaryrefslogtreecommitdiff
Unidiff
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
@@ -139,6 +139,13 @@ BrightnessAppletControl::~BrightnessAppletControl()
139} 139}
140 140
141 141
142void BrightnessAppletControl::hideEvent( QHideEvent* e )
143{
144 BrightnessApplet* applet = static_cast<BrightnessApplet*>( parent() );
145 applet->writeSystemBrightness( applet->calcBrightnessValue() );
146 QFrame::hideEvent( e );
147}
148
142BrightnessApplet::BrightnessApplet( QWidget *parent, const char *name ) 149BrightnessApplet::BrightnessApplet( QWidget *parent, const char *name )
143 :OTaskbarApplet( parent, name ) 150 :OTaskbarApplet( parent, name )
144{ 151{
@@ -160,6 +167,8 @@ void BrightnessApplet::writeSystemBrightness(int brightness)
160 cfg.setGroup("Battery"); 167 cfg.setGroup("Battery");
161 } 168 }
162 cfg.writeEntry("Brightness", brightness); 169 cfg.writeEntry("Brightness", brightness);
170 odebug << "writing brightness " << brightness << oendl;
171 cfg.write();
163} 172}
164 173
165 174
@@ -173,6 +182,8 @@ int BrightnessApplet::readSystemBrightness(void)
173 } else { 182 } else {
174 cfg.setGroup("Battery"); 183 cfg.setGroup("Battery");
175 } 184 }
185
186 odebug << "reading brightness " << cfg.readNumEntry("Brightness", 128) << oendl;
176 187
177 return cfg.readNumEntry("Brightness", 128); 188 return cfg.readNumEntry("Brightness", 128);
178} 189}
@@ -223,11 +234,6 @@ void BrightnessApplet::mousePressEvent( QMouseEvent* )
223 _control->slider->setValue((_control->slider->maxValue() * v + 128) / 255); 234 _control->slider->setValue((_control->slider->maxValue() * v + 128) / 255);
224 connect(_control->slider, SIGNAL(valueChanged(int)), this, SLOT(sliderMoved(int))); 235 connect(_control->slider, SIGNAL(valueChanged(int)), this, SLOT(sliderMoved(int)));
225 } 236 }
226 else
227 {
228 _control->hide();
229 writeSystemBrightness( calcBrightnessValue() );
230 }
231} 237}
232 238
233 239
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
@@ -47,7 +47,7 @@ class BrightnessAppletControl : public QFrame
47 public: 47 public:
48 BrightnessAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 ); 48 BrightnessAppletControl( Opie::Ui::OTaskbarApplet* parent, const char* name = 0 );
49 ~BrightnessAppletControl(); 49 ~BrightnessAppletControl();
50 50 virtual void hideEvent( QHideEvent* );
51 QSlider* slider; 51 QSlider* slider;
52}; 52};
53 53
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
@@ -7,7 +7,7 @@ DESTDIR = $(OPIEDIR)/plugins/applets
7INCLUDEPATH += $(OPIEDIR)/include 7INCLUDEPATH += $(OPIEDIR)/include
8DEPENDPATH += $(OPIEDIR)/include 8DEPENDPATH += $(OPIEDIR)/include
9LIBS += -lqpe -lopiecore2 -lopieui2 9LIBS += -lqpe -lopiecore2 -lopieui2
10VERSION = 0.1.0 10VERSION = 0.1.1
11 11
12 12
13include ( $(OPIEDIR)/include.pro ) 13include ( $(OPIEDIR)/include.pro )