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
@@ -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();