author | mickeyl <mickeyl> | 2003-11-20 14:11:45 (UTC) |
---|---|---|
committer | mickeyl <mickeyl> | 2003-11-20 14:11:45 (UTC) |
commit | f43e28fe8f226039d96ebda4e6c4d26e4f3320ba (patch) (side-by-side diff) | |
tree | 3a312c1333e53b0c674c3b1a682226dd80917f5c | |
parent | ae9e1ed9cc9e65c1ffb28f3b75ff499e18c6b31a (diff) | |
download | opie-f43e28fe8f226039d96ebda4e6c4d26e4f3320ba.zip opie-f43e28fe8f226039d96ebda4e6c4d26e4f3320ba.tar.gz opie-f43e28fe8f226039d96ebda4e6c4d26e4f3320ba.tar.bz2 |
fix battery message box text wrapping
patch courtesy of Matthias Hentges - thanks.
-rw-r--r-- | core/launcher/serverapp.cpp | 34 |
1 files changed, 26 insertions, 8 deletions
diff --git a/core/launcher/serverapp.cpp b/core/launcher/serverapp.cpp index 23a7f95..e8d49fd 100644 --- a/core/launcher/serverapp.cpp +++ b/core/launcher/serverapp.cpp @@ -356,46 +356,64 @@ ServerApplication::~ServerApplication() ungrabKeyboard(); delete pa; delete m_ps; delete m_ps_last; } void ServerApplication::apmTimeout() { serverApp-> checkMemory( ); // in case no events are generated *m_ps_last = *m_ps; *m_ps = PowerStatusManager::readStatus(); if ( m_ps->acStatus() != m_ps_last-> acStatus() ) m_screensaver-> powerStatusChanged( *m_ps ); - if ( m_ps->acStatus() == PowerStatus::Online ) + if ( m_ps->acStatus() == PowerStatus::Online ) { return; + } int bat = m_ps-> batteryPercentRemaining(); if ( bat < m_ps_last-> batteryPercentRemaining() ) { - if ( bat <= m_powerCritical ) - pa->alert( tr( "Battery level is critical!\nKeep power off until power restored!" ), 1 ); - else if ( bat <= m_powerVeryLow ) - pa->alert( tr( "Battery is running very low. "), 2 ); + if ( bat <= m_powerCritical ) { + QMessageBox battlow( + tr("WARNING"), + tr("<p>The battery level is critical!" + "<p>Keep power off until AC is restored"), + QMessageBox::Warning, + QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, + 0, QString::null, TRUE, WStyle_StaysOnTop); + battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); + battlow.exec(); + } else if ( bat <= m_powerVeryLow ) + pa->alert( tr( "The battery is running very low. "), 2 ); + } + + if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) { + QMessageBox battlow( + tr("WARNING"), + tr("<p>The Back-up battery is very low" + "<p>Please charge the back-up battery"), + QMessageBox::Warning, + QMessageBox::Cancel, QMessageBox::NoButton, QMessageBox::NoButton, + 0, QString::null, TRUE, WStyle_StaysOnTop); + battlow.setButtonText(QMessageBox::Cancel, tr("Ok")); + battlow.exec(); } - if ( m_ps-> backupBatteryStatus() == PowerStatus::VeryLow ) - pa->alert( tr("The Back-up battery is very low.\nPlease charge the back-up battery." ), 2); - } void ServerApplication::systemMessage( const QCString& msg, const QByteArray& data ) { QDataStream stream ( data, IO_ReadOnly ); if ( msg == "setScreenSaverInterval(int)" ) { int time; stream >> time; m_screensaver-> setInterval( time ); } else if ( msg == "setScreenSaverIntervals(int,int,int)" ) { int t1, t2, t3; stream >> t1 >> t2 >> t3; m_screensaver-> setIntervals( t1, t2, t3 ); } |