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 | |
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 | 13 | ||||
-rw-r--r-- | core/launcher/desktop.h | 2 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 16 |
3 files changed, 28 insertions, 3 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 @@ -35,6 +35,7 @@ #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 @@ -547,14 +548,21 @@ void Desktop::raiseEmail() } // autoStarts apps on resume and start -void Desktop::execAutoStart() -{ +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) @@ -593,6 +601,7 @@ void Desktop::togglePower() { bool wasloggedin = loggedin; loggedin=0; + suspendTime = QDateTime::currentDateTime(); darkScreen(); if ( wasloggedin ) blankScreen(); diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h index de0dbf0..e094dc0 100644 --- a/core/launcher/desktop.h +++ b/core/launcher/desktop.h @@ -27,6 +27,7 @@ #include <qpe/qpeapplication.h> #include <qwidget.h> +#include <qdatetime.h> class Background; class Launcher; @@ -126,6 +127,7 @@ private: TransferServer *transferServer; PackageSlave *packageSlave; + QDateTime suspendTime; bool keyclick,touchclick; }; diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp index 1449269..979eee6 100644 --- a/core/launcher/launcher.cpp +++ b/core/launcher/launcher.cpp @@ -754,7 +754,7 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) Config cfg( "autostart" ); cfg.setGroup( "AutoStart" ); if ( modifier.compare("add") == 0 ){ - // only add it appname is entered + // only add if appname is entered if (!appName.isEmpty()) { cfg.writeEntry("Apps", appName); } @@ -768,6 +768,20 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) cfg.writeEntry("Apps", ""); } } + // case the autostart feature should be delayed + } else if ( msg == "autoStart(QString, QString, QString)") { + QString modifier, appName, delay; + stream >> modifier >> appName >> delay; + Config cfg( "autostart" ); + cfg.setGroup( "AutoStart" ); + if ( modifier.compare("add") == 0 ){ + // only add it appname is entered + if (!appName.isEmpty()) { + cfg.writeEntry("Apps", appName); + cfg.writeEntry("Delay", delay); + } + } else { + } } else if ( msg == "sendCardInfo()" ) { QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); const QList<FileSystem> &fs = storage->fileSystems(); |