summaryrefslogtreecommitdiff
path: root/core/launcher/desktop.cpp
Unidiff
Diffstat (limited to 'core/launcher/desktop.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index c4c6050..986ae5d 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -190,61 +190,61 @@ public:
190 setBacklightInternal ( -1 ); 190 setBacklightInternal ( -1 );
191 } 191 }
192 bool save( int level ) 192 bool save( int level )
193 { 193 {
194 bool onAC = ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online ); 194 bool onAC = ( PowerStatusManager::readStatus().acStatus() == PowerStatus::Online );
195 195
196 switch ( level ) { 196 switch ( level ) {
197 case 0: 197 case 0:
198 198
199 if ( m_disable_suspend_ac > 0 && m_enable_dim_ac && onAC ) { 199 if ( m_disable_suspend_ac > 0 && m_enable_dim_ac && onAC ) {
200 if ( m_backlight_current > 1 ) 200 if ( m_backlight_current > 1 )
201 setBacklight( 1 ); // lowest non-off 201 setBacklight( 1 ); // lowest non-off
202 } else if ( m_disable_suspend > 0 && m_enable_dim ) { 202 } else if ( !onAC && m_disable_suspend > 0 && m_enable_dim ) {
203 if ( m_backlight_current > 1 ) 203 if ( m_backlight_current > 1 )
204 setBacklightInternal( 1 ); // lowest non-off 204 setBacklightInternal( 1 ); // lowest non-off
205 } 205 }
206 return true; 206 return true;
207 break; 207 break;
208 case 1: 208 case 1:
209 209
210 if ( m_disable_suspend_ac > 1 && m_enable_lightoff_ac && onAC ) { 210 if ( m_disable_suspend_ac > 1 && m_enable_lightoff_ac && onAC ) {
211 setBacklightInternal( 0 ); // off 211 setBacklightInternal( 0 ); // off
212 } else if ( m_disable_suspend > 1 && m_enable_lightoff ) { 212 } else if ( !onAC && m_disable_suspend > 1 && m_enable_lightoff ) {
213 setBacklightInternal( 0 ); // off 213 setBacklightInternal( 0 ); // off
214 } 214 }
215 return true; 215 return true;
216 break; 216 break;
217 case 2: 217 case 2:
218 if ( m_disable_apm_ac && onAC ) { 218 if ( m_disable_apm_ac && onAC ) {
219 return true; 219 return true;
220 } 220 }
221 221
222 if ( m_enable_onlylcdoff_ac && onAC ) { 222 if ( m_enable_onlylcdoff_ac && onAC ) {
223 ODevice::inst ( ) -> setDisplayStatus ( false ); 223 ODevice::inst ( ) -> setDisplayStatus ( false );
224 m_lcd_status = false; 224 m_lcd_status = false;
225 return true; 225 return true;
226 } 226 }
227 else if ( m_enable_onlylcdoff ) { 227 else if ( !onAC && m_enable_onlylcdoff ) {
228 ODevice::inst ( ) -> setDisplayStatus ( false ); 228 ODevice::inst ( ) -> setDisplayStatus ( false );
229 m_lcd_status = false; 229 m_lcd_status = false;
230 return true; 230 return true;
231 } 231 }
232 else // We're going to suspend the whole machine 232 else // We're going to suspend the whole machine
233 { 233 {
234 if ( ( m_disable_suspend_ac > 2 && onAC ) && ( !Network::networkOnline ( ) ) ) { 234 if ( ( m_disable_suspend_ac > 2 && onAC ) && ( !Network::networkOnline ( ) ) ) {
235 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); 235 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
236 return true; 236 return true;
237 } 237 }
238 if ( ( m_disable_suspend > 2 ) && ( !Network::networkOnline ( ) ) ) { 238 if ( !onAC && ( m_disable_suspend > 2 ) && ( !Network::networkOnline ( ) ) ) {
239 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE ); 239 QWSServer::sendKeyEvent( 0xffff, Qt::Key_F34, FALSE, TRUE, FALSE );
240 return true; 240 return true;
241 } 241 }
242 } 242 }
243 break; 243 break;
244 } 244 }
245 return false; 245 return false;
246 } 246 }
247 247
248private: 248private:
249 static int ssi( int interval, Config & config, const QString & enable, const QString & value, int def ) 249 static int ssi( int interval, Config & config, const QString & enable, const QString & value, int def )
250 { 250 {
@@ -636,35 +636,35 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e )
636 636
637 return QPEApplication::qwsEventFilter( e ); 637 return QPEApplication::qwsEventFilter( e );
638} 638}
639#endif 639#endif
640 640
641void DesktopApplication::psTimeout( int batRemaining ) 641void DesktopApplication::psTimeout( int batRemaining )
642{ 642{
643 *ps = PowerStatusManager::readStatus(); 643 *ps = PowerStatusManager::readStatus();
644 644
645 // maybe now since its triggered by apm change there might be to few warnings 645 // maybe now since its triggered by apm change there might be to few warnings
646 // if ( ( ps->batteryStatus() == PowerStatus::VeryLow ) ) { 646 // if ( ( ps->batteryStatus() == PowerStatus::VeryLow ) ) {
647 if ( ( batRemaining == m_powerVeryLow ) ) { 647 if ( ( batRemaining == m_powerVeryLow ) ) {
648 pa->alert( tr( "Battery is running very low." ), 6 ); 648 pa->alert( tr( "Battery is running very low." ), 2 );
649 } 649 }
650 650
651 // if ( ps->batteryStatus() == PowerStatus::Critical ) { 651 // if ( ps->batteryStatus() == PowerStatus::Critical ) {
652 if ( batRemaining == m_powerCritical ) { 652 if ( batRemaining == m_powerCritical ) {
653 pa->alert( tr( "Battery level is critical!\n" 653 pa->alert( tr( "Battery level is critical!\n"
654 "Keep power off until power restored!" ), 1 ); 654 "Keep power off until power restored!" ), 1 );
655 } 655 }
656 656
657 if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) { 657 if ( ps->backupBatteryStatus() == PowerStatus::VeryLow ) {
658 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 3 ); 658 pa->alert( tr( "The Back-up battery is very low.\nPlease charge the back-up battery." ), 2 );
659 } 659 }
660} 660}
661 661
662void DesktopApplication::apmTimeout() 662void DesktopApplication::apmTimeout()
663{ 663{
664 qpedesktop->checkMemory(); // in case no events are being generated 664 qpedesktop->checkMemory(); // in case no events are being generated
665 665
666 *ps = PowerStatusManager::readStatus(); 666 *ps = PowerStatusManager::readStatus();
667 667
668 if ( m_currentPowerLevel != ps->batteryPercentRemaining() ) { 668 if ( m_currentPowerLevel != ps->batteryPercentRemaining() ) {
669 // not very nice, since psTimeout parses the again 669 // not very nice, since psTimeout parses the again
670 m_currentPowerLevel = ps->batteryPercentRemaining(); 670 m_currentPowerLevel = ps->batteryPercentRemaining();