summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/serverapp.cpp34
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
@@ -324,110 +324,128 @@ ServerApplication::ServerApplication( int& argc, char **argv, Type t )
kf = new KeyFilter(this);
connect( kf, SIGNAL(launch()), this, SIGNAL(launch()) );
connect( kf, SIGNAL(power()), this, SIGNAL(power()) );
connect( kf, SIGNAL(backlight()), this, SIGNAL(backlight()) );
connect( kf, SIGNAL(symbol()), this, SIGNAL(symbol()));
connect( kf, SIGNAL(numLockStateToggle()), this,SIGNAL(numLockStateToggle()));
connect( kf, SIGNAL(capsLockStateToggle()), this,SIGNAL(capsLockStateToggle()));
connect( kf, SIGNAL(activate(const Opie::ODeviceButton*,bool)),
this,SIGNAL(activate(const Opie::ODeviceButton*,bool)));
connect( kf, SIGNAL(backlight()), this, SLOT(toggleLight()) );
connect( this, SIGNAL(power() ),
SLOT(togglePower() ) );
rereadVolumes();
serverApp = this;
apmTimeout();
grabKeyboard();
/* make sure the event filter is installed */
const Opie::ODeviceButton* but = Opie::ODevice::inst()->buttonForKeycode( -1 );
}
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 );
}
else if ( msg == "setBacklight(int)" ) {
int bright;
stream >> bright;
m_screensaver-> setBacklight( bright );
}
else if ( msg == "setScreenSaverMode(int)" ) {
int mode;
stream >> mode;
m_screensaver-> setMode ( mode );
}
else if ( msg == "reloadPowerWarnSettings()" ) {
reloadPowerWarnSettings();
}
else if ( msg == "setDisplayState(int)" ) {
int state;
stream >> state;
m_screensaver-> setDisplayState ( state != 0 );
}
else if ( msg == "suspend()" ) {
emit power();
}
else if ( msg == "sendBusinessCard()" ) {
QString card = ::getenv ( "HOME" );
card += "/Applications/addressbook/businesscard.vcf";
if ( QFile::exists( card ) ) {
QCopEnvelope e ( "QPE/Obex", "send(QString,QString,QString)" );
QString mimetype = "text/x-vCard";
e << tr( "business card" ) << card << mimetype;
}
}
}