summaryrefslogtreecommitdiff
path: root/core/launcher
Side-by-side diff
Diffstat (limited to 'core/launcher') (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/desktop.cpp13
-rw-r--r--core/launcher/desktop.h2
-rw-r--r--core/launcher/launcher.cpp16
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
@@ -37,2 +37,3 @@
#include <qpe/power.h>
+#include <qpe/timeconversion.h>
#include <qpe/qcopenvelope_qws.h>
@@ -549,5 +550,6 @@ 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" );
@@ -555,4 +557,10 @@ void Desktop::execAutoStart()
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 {
+ }
}
@@ -595,2 +603,3 @@ void Desktop::togglePower()
loggedin=0;
+ suspendTime = QDateTime::currentDateTime();
darkScreen();
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
@@ -29,2 +29,3 @@
#include <qwidget.h>
+#include <qdatetime.h>
@@ -128,2 +129,3 @@ private:
+ 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
@@ -756,3 +756,3 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
if ( modifier.compare("add") == 0 ){
- // only add it appname is entered
+ // only add if appname is entered
if (!appName.isEmpty()) {
@@ -770,2 +770,16 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
}
+ // 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()" ) {