author | harlekin <harlekin> | 2002-04-15 20:30:41 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-15 20:30:41 (UTC) |
commit | 15244683bb97d303d0d3b6104b46a9b429aaed85 (patch) (side-by-side diff) | |
tree | ce57768177baec8b90146245a8cfad669addf647 /core/launcher/desktop.cpp | |
parent | 551eb586e6a19db69348b0bb38f06171201d89a0 (diff) | |
download | opie-15244683bb97d303d0d3b6104b46a9b429aaed85.zip opie-15244683bb97d303d0d3b6104b46a9b429aaed85.tar.gz opie-15244683bb97d303d0d3b6104b46a9b429aaed85.tar.bz2 |
added a configurable delay, so for example if 5 min are set, and the suspend time is shorter, no app is autostarted
-rw-r--r-- | core/launcher/desktop.cpp | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp index cf33011..43006f1 100644 --- a/core/launcher/desktop.cpp +++ b/core/launcher/desktop.cpp @@ -32,12 +32,13 @@ #include <qpe/applnk.h> #include <qpe/mimetype.h> #include <qpe/password.h> #include <qpe/config.h> #include <qpe/power.h> +#include <qpe/timeconversion.h> #include <qpe/qcopenvelope_qws.h> #include <qpe/global.h> #ifdef QT_QWS_CUSTOM #include "qpe/custom.h" #endif @@ -53,13 +54,13 @@ #include <unistd.h> class QCopKeyRegister { public: QCopKeyRegister() : keyCode(0) { } - QCopKeyRegister(int k, const QString &c, const QString &m) + QCopKeyRegister(int k, const QString &c, const QString &m) : keyCode(k), channel(c), message(m) { } int getKeyCode() const { return keyCode; } QString getChannel() const { return channel; } QString getMessage() const { return message; } @@ -165,20 +166,20 @@ void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) int k; QString c, m; stream >> k; stream >> c; stream >> m; - + qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); keyRegisterList.append(QCopKeyRegister(k,c,m)); - } + } else if (msg == "suspend()"){ emit power(); } - + } enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; #ifdef Q_WS_QWS bool DesktopApplication::qwsEventFilter( QWSEvent *e ) @@ -274,13 +275,13 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) } } else { up = TRUE; } } } - + return QPEApplication::qwsEventFilter( e ); } #endif void DesktopApplication::psTimeout() { @@ -544,20 +545,27 @@ void Desktop::raiseEmail() QCopEnvelope e("QPE/System","execute(QString)"); e << tempItem; } } // autoStarts apps on resume and start -void Desktop::execAutoStart() -{ - QString appName; - Config cfg( "autostart" ); - cfg.setGroup( "AutoStart" ); - appName = cfg.readEntry("Apps", ""); - QCopEnvelope e("QPE/System", "execute(QString)"); - e << QString(appName); +void Desktop::execAutoStart() { + QString appName; + int delay; + QDateTime now = QDateTime::currentDateTime(); + Config cfg( "autostart" ); + cfg.setGroup( "AutoStart" ); + appName = cfg.readEntry("Apps", ""); + delay = (cfg.readEntry("Delay", "0" )).toInt(); + // If the time between suspend and resume was longer then the + // value saved as delay, start the app + if ( suspendTime.secsTo(now) >= (delay*60) ) { + QCopEnvelope e("QPE/System", "execute(QString)"); + e << QString(appName); + } else { + } } #if defined(QPE_HAVE_TOGGLELIGHT) #include <qpe/config.h> #include <sys/ioctl.h> @@ -590,19 +598,20 @@ static void darkScreen() void Desktop::togglePower() { bool wasloggedin = loggedin; loggedin=0; + suspendTime = QDateTime::currentDateTime(); darkScreen(); if ( wasloggedin ) blankScreen(); - + system("apm --suspend"); - - + + QWSServer::screenSaverActivate( FALSE ); { QCopEnvelope("QPE/Card", "mtabChanged()" ); // might have changed while asleep QCopEnvelope e("QPE/System", "setBacklight(int)"); e << -3; // Force on |