summaryrefslogtreecommitdiff
Unidiff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/applets/batteryapplet/battery.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp
index 15eb762..4adcab4 100644
--- a/core/applets/batteryapplet/battery.cpp
+++ b/core/applets/batteryapplet/battery.cpp
@@ -81,25 +81,25 @@ void BatteryMeter::mouseReleaseEvent( QMouseEvent* e)
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 && percent < 0 ) { 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 );
104 if ( batteryView ) 104 if ( batteryView )
105 batteryView->repaint(); 105 batteryView->repaint();
@@ -110,25 +110,25 @@ void BatteryMeter::chargeTimeout()
110{ 110{
111 percent += 20; 111 percent += 20;
112 if ( percent > 100 ) 112 if ( percent > 100 )
113 percent = 0; 113 percent = 0;
114 114
115 repaint(FALSE); 115 repaint(FALSE);
116 if ( batteryView ) 116 if ( batteryView )
117 batteryView->updatePercent( percent ); 117 batteryView->updatePercent( percent );
118} 118}
119 119
120void BatteryMeter::paintEvent( QPaintEvent* ) 120void BatteryMeter::paintEvent( QPaintEvent* )
121{ 121{
122 qWarning("paint"); 122
123 if ( style == 1 ) 123 if ( style == 1 )
124 { 124 {
125 QPainter p(this); 125 QPainter p(this);
126 QFont f( "Fixed", AppLnk::smallIconSize()/2 ); 126 QFont f( "Fixed", AppLnk::smallIconSize()/2 );
127 QFontMetrics fm( f ); 127 QFontMetrics fm( f );
128 p.setFont( f ); 128 p.setFont( f );
129 p.drawText( 0, height()/2, QString::number( percent ) ); 129 p.drawText( 0, height()/2, QString::number( percent ) );
130 p.drawText( width()/4, height(), "%" ); 130 p.drawText( width()/4, height(), "%" );
131 return; 131 return;
132 } 132 }
133 133
134 QPainter p(this); 134 QPainter p(this);