summaryrefslogtreecommitdiff
path: root/core/launcher/desktop.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/desktop.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp34
1 files changed, 16 insertions, 18 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index fa9736f..03a23dc 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -172,26 +172,19 @@ void DesktopApplication::switchLCD ( bool on )
}
DesktopApplication::DesktopApplication( int& argc, char **argv, Type appType )
: QPEApplication( argc, argv, appType )
{
-
- Config cfg( "apm" );
- cfg.setGroup( "Warnings" );
- //cfg.readNumEntry( "checkinterval", 10000 )
- m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 );
- m_powerCritical = cfg.readNumEntry( "powercritical", 5 );
-
m_ps = new PowerStatus;
m_ps_last = new PowerStatus;
pa = new DesktopPowerAlerter( 0 );
- m_timer = new QTimer( this );
- connect( m_timer, SIGNAL( timeout() ), this, SLOT( apmTimeout() ) );
- m_timer->start( 5000 );
+ m_apm_timer = new QTimer ( this );
+ connect ( m_apm_timer, SIGNAL( timeout ( )), this, SLOT( apmTimeout ( )));
+ reloadPowerWarnSettings ( );
m_last_button = 0;
m_button_timer = new QTimer ( );
connect ( m_button_timer, SIGNAL( timeout ( )), this, SLOT( sendHeldAction ( )));
channel = new QCopChannel( "QPE/System", this );
@@ -223,13 +216,13 @@ DesktopApplication::~DesktopApplication()
delete m_ps_last;
delete pa;
}
void DesktopApplication::apmTimeout()
{
- qpedesktop->checkMemory(); // in case no events are being generated
+ 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 );
@@ -293,20 +286,25 @@ void DesktopApplication::systemMessage( const QCString & msg, const QByteArray &
QString mimetype = "text/x-vCard";
e << tr( "business card" ) << card << mimetype;
}
}
}
-void DesktopApplication::reloadPowerWarnSettings()
+void DesktopApplication::reloadPowerWarnSettings ( )
{
- Config cfg( "apm" );
- cfg.setGroup( "Warnings" );
+ Config cfg ( "apm" );
+ cfg. setGroup ( "Warnings" );
- // m_timer->changeInterval( cfg.readNumEntry( "checkinterval", 10000 ) );
- m_powerVeryLow = cfg.readNumEntry( "powerverylow", 10 );
- m_powerCritical = cfg.readNumEntry( "powervcritical", 5 );
+ int iv = cfg. readNumEntry ( "checkinterval", 10000 );
+
+ m_apm_timer-> stop ( );
+ if ( iv )
+ m_apm_timer-> start ( iv );
+
+ m_powerVeryLow = cfg. readNumEntry ( "powerverylow", 10 );
+ m_powerCritical = cfg. readNumEntry ( "powervcritical", 5 );
}
enum MemState { Unknown, VeryLow, Low, Normal } memstate = Unknown;
@@ -339,13 +337,13 @@ void DesktopApplication::sendHeldAction ( )
m_last_button = 0;
}
}
-void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int keycode, bool press, bool autoRepeat )
+void DesktopApplication::checkButtonAction ( const ODeviceButton *db, int /*keycode*/, bool press, bool autoRepeat )
{
if ( db ) {
if ( !press && !autoRepeat && m_button_timer-> isActive ( )) {
m_button_timer-> stop ( );
if ( !db-> pressedAction ( ). channel ( ). isEmpty ( )) {
db-> pressedAction ( ). send ( );