author | harlekin <harlekin> | 2002-04-15 20:30:41 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-15 20:30:41 (UTC) |
commit | 15244683bb97d303d0d3b6104b46a9b429aaed85 (patch) (unidiff) | |
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 | |||
@@ -37,2 +37,3 @@ | |||
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #include <qpe/timeconversion.h> | ||
38 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
@@ -549,5 +550,6 @@ void Desktop::raiseEmail() | |||
549 | // autoStarts apps on resume and start | 550 | // autoStarts apps on resume and start |
550 | void Desktop::execAutoStart() | 551 | void Desktop::execAutoStart() { |
551 | { | ||
552 | QString appName; | 552 | QString appName; |
553 | int delay; | ||
554 | QDateTime now = QDateTime::currentDateTime(); | ||
553 | Config cfg( "autostart" ); | 555 | Config cfg( "autostart" ); |
@@ -555,4 +557,10 @@ void Desktop::execAutoStart() | |||
555 | appName = cfg.readEntry("Apps", ""); | 557 | appName = cfg.readEntry("Apps", ""); |
558 | delay = (cfg.readEntry("Delay", "0" )).toInt(); | ||
559 | // If the time between suspend and resume was longer then the | ||
560 | // value saved as delay, start the app | ||
561 | if ( suspendTime.secsTo(now) >= (delay*60) ) { | ||
556 | QCopEnvelope e("QPE/System", "execute(QString)"); | 562 | QCopEnvelope e("QPE/System", "execute(QString)"); |
557 | e << QString(appName); | 563 | e << QString(appName); |
564 | } else { | ||
565 | } | ||
558 | } | 566 | } |
@@ -595,2 +603,3 @@ void Desktop::togglePower() | |||
595 | loggedin=0; | 603 | loggedin=0; |
604 | suspendTime = QDateTime::currentDateTime(); | ||
596 | darkScreen(); | 605 | 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 @@ | |||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qdatetime.h> | ||
30 | 31 | ||
@@ -128,2 +129,3 @@ private: | |||
128 | 129 | ||
130 | QDateTime suspendTime; | ||
129 | bool keyclick,touchclick; | 131 | 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) | |||
756 | if ( modifier.compare("add") == 0 ){ | 756 | if ( modifier.compare("add") == 0 ){ |
757 | // only add it appname is entered | 757 | // only add if appname is entered |
758 | if (!appName.isEmpty()) { | 758 | if (!appName.isEmpty()) { |
@@ -770,2 +770,16 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
770 | } | 770 | } |
771 | // case the autostart feature should be delayed | ||
772 | } else if ( msg == "autoStart(QString, QString, QString)") { | ||
773 | QString modifier, appName, delay; | ||
774 | stream >> modifier >> appName >> delay; | ||
775 | Config cfg( "autostart" ); | ||
776 | cfg.setGroup( "AutoStart" ); | ||
777 | if ( modifier.compare("add") == 0 ){ | ||
778 | // only add it appname is entered | ||
779 | if (!appName.isEmpty()) { | ||
780 | cfg.writeEntry("Apps", appName); | ||
781 | cfg.writeEntry("Delay", delay); | ||
782 | } | ||
783 | } else { | ||
784 | } | ||
771 | } else if ( msg == "sendCardInfo()" ) { | 785 | } else if ( msg == "sendCardInfo()" ) { |