-rw-r--r-- | core/applets/batteryapplet/battery.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/core/applets/batteryapplet/battery.cpp b/core/applets/batteryapplet/battery.cpp index 18e368e..98b61b5 100644 --- a/core/applets/batteryapplet/battery.cpp +++ b/core/applets/batteryapplet/battery.cpp @@ -38,97 +38,97 @@ BatteryMeter::BatteryMeter( QWidget *parent ) : QWidget( parent ), charging(false) { ps = new PowerStatus; startTimer( 10000 ); setFixedWidth( QMAX(AppLnk::smallIconSize()*3/4, 6) ); setFixedHeight( AppLnk::smallIconSize() ); chargeTimer = new QTimer( this ); connect( chargeTimer, SIGNAL(timeout()), this, SLOT(chargeTimeout()) ); timerEvent(0); QPEApplication::setStylusOperation( this, QPEApplication::RightOnHold ); Config c( "qpe" ); c.setGroup( "Battery" ); style = c.readNumEntry( "Style", 0 ); } BatteryMeter::~BatteryMeter() { delete ps; } QSize BatteryMeter::sizeHint() const { return QSize(QMAX(AppLnk::smallIconSize()*3/4, 6), height() ); } void BatteryMeter::mousePressEvent( QMouseEvent* e ) { if ( e->button() == RightButton ) { style = 1-style; Config c( "qpe" ); c.setGroup( "Battery" ); c.writeEntry( "Style", style ); repaint( true ); } QWidget::mousePressEvent( e ); } void BatteryMeter::mouseReleaseEvent( QMouseEvent* /*e*/ ) { if ( batteryView && batteryView->isVisible() ) { delete (QWidget *) batteryView; } else { if ( !batteryView ) batteryView = new BatteryStatus( ps ); QPEApplication::showWidget( batteryView ); batteryView->raise(); - batteryView->show(); + batteryView->showMaximized(); } } void BatteryMeter::timerEvent( QTimerEvent * ) { PowerStatus prev = *ps; *ps = PowerStatusManager::readStatus(); if ( prev != *ps ) { percent = ps->batteryPercentRemaining(); if ( !charging && ps->batteryStatus() == PowerStatus::Charging ) { percent = 0; charging = true; chargeTimer->start( 500 ); } else if ( charging && ps->batteryStatus() != PowerStatus::Charging ) { charging = false; chargeTimer->stop(); if ( batteryView ) batteryView->updatePercent( percent ); } repaint( style != 0 ); if ( batteryView ) batteryView->repaint(); } } void BatteryMeter::chargeTimeout() { percent += 20; if ( percent > 100 ) percent = 0; repaint(FALSE); if ( batteryView ) batteryView->updatePercent( percent ); } void BatteryMeter::paintEvent( QPaintEvent* ) { if ( style == 1 ) { QPainter p(this); QFont f( "Fixed", AppLnk::smallIconSize()/2 ); QFontMetrics fm( f ); p.setFont( f ); p.drawText( 0, height()/2, QString::number( percent ) ); |