summaryrefslogtreecommitdiff
authorsandman <sandman>2002-10-29 15:44:30 (UTC)
committer sandman <sandman>2002-10-29 15:44:30 (UTC)
commit6224d462ef211b3b4cffa42d4a7f261caa92834b (patch) (side-by-side diff)
tree7cb1ccbd7a3cf7c0340cc2283cd7b5040636fd4d
parentf47abe11e3e0281fab06e2b4b9d23a2e35960a2c (diff)
downloadopie-6224d462ef211b3b4cffa42d4a7f261caa92834b.zip
opie-6224d462ef211b3b4cffa42d4a7f261caa92834b.tar.gz
opie-6224d462ef211b3b4cffa42d4a7f261caa92834b.tar.bz2
- use sane default values for screensaver timeouts
- fixed the "Battery low warning" when plugging the device into AC
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp20
-rw-r--r--core/launcher/screensaver.cpp14
2 files changed, 17 insertions, 17 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index bc43475..f2e00d8 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -217,28 +217,28 @@ void DesktopApplication::apmTimeout()
qpedesktop->checkMemory(); // in case no events are being generated
*m_ps_last = *m_ps;
*m_ps = PowerStatusManager::readStatus();
if ( m_ps-> acStatus ( ) != m_ps_last-> acStatus ( ))
m_screensaver-> powerStatusChanged ( *m_ps );
- int bat = m_ps-> batteryPercentRemaining ( );
-
- if ( m_ps_last-> batteryPercentRemaining ( ) != bat ) {
- 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 ( m_ps-> acStatus ( ) != PowerStatus::Online ) {
+ 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 ( m_ps-> backupBatteryStatus ( ) == PowerStatus::VeryLow )
pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 );
- }
+ }
}
void DesktopApplication::desktopMessage( const QCString &msg, const QByteArray &data )
{
QDataStream stream( data, IO_ReadOnly );
if ( msg == "keyRegister(int key, QString channel, QString message)" ) {
int k;
QString c, m;
diff --git a/core/launcher/screensaver.cpp b/core/launcher/screensaver.cpp
index 741591e..45da9ed 100644
--- a/core/launcher/screensaver.cpp
+++ b/core/launcher/screensaver.cpp
@@ -110,33 +110,33 @@ bool OpieScreenSaver::save( int level )
void OpieScreenSaver::setIntervals ( int i1, int i2, int i3 )
{
Config config ( "apm" );
config. setGroup ( m_on_ac ? "AC" : "Battery" );
int v[ 4 ];
if ( i1 < 0 )
- i1 = config. readNumEntry ( "Dim", 30 );
+ i1 = config. readNumEntry ( "Dim", m_on_ac ? 60 : 30 );
if ( i2 < 0 )
- i2 = config. readNumEntry ( "LightOff", 20 );
+ i2 = config. readNumEntry ( "LightOff", m_on_ac ? 120 : 20 );
if ( i3 < 0 )
- i3 = config. readNumEntry ( "Suspend", 60 );
+ i3 = config. readNumEntry ( "Suspend", m_on_ac ? 0 : 60 );
if ( m_on_ac ) {
m_enable_dim_ac = ( i1 > 0 );
m_enable_lightoff_ac = ( i2 > 0 );
m_enable_suspend_ac = ( i3 > 0 );
- m_onlylcdoff_ac = config.readNumEntry ( "LcdOffOnly", 0 );
+ m_onlylcdoff_ac = config.readBoolEntry ( "LcdOffOnly", false );
}
else {
m_enable_dim = ( i1 > 0 );
m_enable_lightoff = ( i2 > 0 );
m_enable_suspend = ( i3 > 0 );
- m_onlylcdoff = config.readNumEntry ( "LcdOffOnly", 0 );
+ m_onlylcdoff = config.readBoolEntry ( "LcdOffOnly", false );
}
qDebug("screen saver intervals: %d %d %d", i1, i2, i3);
v [ 0 ] = QMAX( 1000 * i1, 100 );
v [ 1 ] = QMAX( 1000 * i2, 100 );
v [ 2 ] = QMAX( 1000 * i3, 100 );
v [ 3 ] = 0;
@@ -162,21 +162,21 @@ void OpieScreenSaver::setMode ( int mode )
}
void OpieScreenSaver::setBacklight ( int bright )
{
// Read from config
Config config ( "apm" );
config. setGroup ( m_on_ac ? "AC" : "Battery" );
- m_backlight_normal = config. readNumEntry ( "Brightness", 255 );
+ m_backlight_normal = config. readNumEntry ( "Brightness", m_on_ac ? 255 : 127 );
m_use_light_sensor = config. readBoolEntry ( "LightSensor", false );
- qDebug ( "setBacklight: %d (ls: %d)", m_backlight_normal, m_use_light_sensor ? 1 : 0 );
+// qDebug ( "setBacklight: %d (ls: %d)", m_backlight_normal, m_use_light_sensor ? 1 : 0 );
killTimers ( );
if ( m_use_light_sensor ) {
QStringList sl = config. readListEntry ( "LightSensorData", ';' );
m_sensordata [LS_SensorMin] = 40;
m_sensordata [LS_SensorMax] = 215;
m_sensordata [LS_LightMin] = 1;