summaryrefslogtreecommitdiff
path: root/core/launcher/suspendmonitor.cpp
Side-by-side diff
Diffstat (limited to 'core/launcher/suspendmonitor.cpp') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/suspendmonitor.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/launcher/suspendmonitor.cpp b/core/launcher/suspendmonitor.cpp
index f555e84..50bc56f 100644
--- a/core/launcher/suspendmonitor.cpp
+++ b/core/launcher/suspendmonitor.cpp
@@ -5,97 +5,97 @@
**
** This file may be distributed and/or modified under the terms of the
** GNU General Public License version 2 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** See http://www.trolltech.com/gpl/ for GPL licensing information.
**
** Contact info@trolltech.com if any conditions of this licensing are
** not clear to you.
**
**********************************************************************/
#include <qtopia/qcopenvelope_qws.h>
#include <qtopia/qpeapplication.h>
#include "suspendmonitor.h"
#ifdef QTOPIA_MAX_SCREEN_DISABLE_TIME
#define QTOPIA_MIN_SCREEN_DISABLE_TIME ((int) 300) // min 5 minutes before forced suspend kicks in
#endif
TempScreenSaverMonitor::TempScreenSaverMonitor(QObject *parent, const char *name)
: QObject(parent, name)
{
currentMode = QPEApplication::Enable;
timerId = 0;
}
void TempScreenSaverMonitor::setTempMode(int mode, int pid)
{
removeOld(pid);
switch(mode) {
case QPEApplication::Disable:
sStatus[0].append(pid);
break;
case QPEApplication::DisableLightOff:
sStatus[1].append(pid);
break;
case QPEApplication::DisableSuspend:
sStatus[2].append(pid);
break;
case QPEApplication::Enable:
break;
default:
- qWarning("Unrecognized temp power setting. Ignored");
+ owarn << "Unrecognized temp power setting. Ignored" << oendl;
return;
}
updateAll();
}
// Returns true if app had set a temp Mode earlier
bool TempScreenSaverMonitor::removeOld(int pid)
{
QValueList<int>::Iterator it;
for (int i = 0; i < 3; i++) {
it = sStatus[i].find(pid);
if ( it != sStatus[i].end() ) {
sStatus[i].remove( it );
return TRUE;
}
}
return FALSE;
}
void TempScreenSaverMonitor::updateAll()
{
int mode = QPEApplication::Enable;
if ( sStatus[0].count() ) {
mode = QPEApplication::Disable;
} else if ( sStatus[1].count() ) {
mode = QPEApplication::DisableLightOff;
} else if ( sStatus[2].count() ) {
mode = QPEApplication::DisableSuspend;
}
if ( mode != currentMode ) {
#ifdef QTOPIA_MAX_SCREEN_DISABLE_TIME
if ( currentMode == QPEApplication::Enable) {
int tid = timerValue();
if ( tid )
timerId = startTimer( tid * 1000 );
} else if ( mode == QPEApplication::Enable ) {
if ( timerId ) {
killTimer(timerId);
timerId = 0;
}
}
#endif
currentMode = mode;
QCopEnvelope("QPE/System", "setScreenSaverMode(int)") << mode;
}
}