summaryrefslogtreecommitdiff
path: root/core/applets/batteryapplet/battery.cpp
Unidiff
Diffstat (limited to 'core/applets/batteryapplet/battery.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index 4adcab4..3b64fb5 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -55,49 +55,49 @@ BatteryMeter::~BatteryMeter()
55QSize BatteryMeter::sizeHint() const 55QSize BatteryMeter::sizeHint() const
56{ 56{
57 return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() ); 57 return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() );
58} 58}
59 59
60void BatteryMeter::mousePressEvent( QMouseEvent* e ) 60void BatteryMeter::mousePressEvent( QMouseEvent* e )
61{ 61{
62 if ( e->button() == RightButton ) 62 if ( e->button() == RightButton )
63 { 63 {
64 style = 1-style; 64 style = 1-style;
65 Config c( "qpe" ); 65 Config c( "qpe" );
66 c.setGroup( "Battery" ); 66 c.setGroup( "Battery" );
67 c.writeEntry( "Style", style ); 67 c.writeEntry( "Style", style );
68 repaint( true ); 68 repaint( true );
69 } 69 }
70 QWidget::mousePressEvent( e ); 70 QWidget::mousePressEvent( e );
71} 71}
72 72
73void BatteryMeter::mouseReleaseEvent( QMouseEvent* e) 73void BatteryMeter::mouseReleaseEvent( QMouseEvent* e)
74{ 74{
75 if ( batteryView && batteryView->isVisible() ) { 75 if ( batteryView && batteryView->isVisible() ) {
76 delete (QWidget *) batteryView; 76 delete (QWidget *) batteryView;
77 } else { 77 } else {
78 if ( !batteryView ) batteryView = new BatteryStatus( ps ); 78 if ( !batteryView ) batteryView = new BatteryStatus( ps );
79 batteryView->showMaximized(); 79 QPEApplication::showWidget( batteryView );
80 batteryView->raise(); 80 batteryView->raise();
81 batteryView->show(); 81 batteryView->show();
82 } 82 }
83} 83}
84 84
85void BatteryMeter::timerEvent( QTimerEvent * ) 85void BatteryMeter::timerEvent( QTimerEvent * )
86{ 86{
87 PowerStatus prev = *ps; 87 PowerStatus prev = *ps;
88 88
89 *ps = PowerStatusManager::readStatus(); 89 *ps = PowerStatusManager::readStatus();
90 90
91 if ( prev != *ps ) { 91 if ( prev != *ps ) {
92 percent = ps->batteryPercentRemaining(); 92 percent = ps->batteryPercentRemaining();
93 if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) { 93 if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) {
94 percent = 0; 94 percent = 0;
95 charging = true; 95 charging = true;
96 chargeTimer->start( 500 ); 96 chargeTimer->start( 500 );
97 } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) { 97 } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) {
98 charging = false; 98 charging = false;
99 chargeTimer->stop(); 99 chargeTimer->stop();
100 if ( batteryView ) 100 if ( batteryView )
101 batteryView->updatePercent( percent ); 101 batteryView->updatePercent( percent );
102 } 102 }
103 repaint( style != 0 ); 103 repaint( style != 0 );