summaryrefslogtreecommitdiff
path: root/core/launcher
authorharlekin <harlekin>2002-04-15 20:30:41 (UTC)
committer harlekin <harlekin>2002-04-15 20:30:41 (UTC)
commit15244683bb97d303d0d3b6104b46a9b429aaed85 (patch) (unidiff)
treece57768177baec8b90146245a8cfad669addf647 /core/launcher
parent551eb586e6a19db69348b0bb38f06171201d89a0 (diff)
downloadopie-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
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
@@ -32,12 +32,13 @@
32 32
33#include <qpe/applnk.h> 33#include <qpe/applnk.h>
34#include <qpe/mimetype.h> 34#include <qpe/mimetype.h>
35#include <qpe/password.h> 35#include <qpe/password.h>
36#include <qpe/config.h> 36#include <qpe/config.h>
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>
39#include <qpe/global.h> 40#include <qpe/global.h>
40#ifdef QT_QWS_CUSTOM 41#ifdef QT_QWS_CUSTOM
41#include "qpe/custom.h" 42#include "qpe/custom.h"
42#endif 43#endif
43 44
@@ -544,20 +545,27 @@ void Desktop::raiseEmail()
544 QCopEnvelope e("QPE/System","execute(QString)"); 545 QCopEnvelope e("QPE/System","execute(QString)");
545 e << tempItem; 546 e << tempItem;
546 } 547 }
547} 548}
548 549
549// autoStarts apps on resume and start 550// autoStarts apps on resume and start
550void Desktop::execAutoStart() 551void 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" );
554 cfg.setGroup( "AutoStart" ); 556 cfg.setGroup( "AutoStart" );
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}
559 567
560#if defined(QPE_HAVE_TOGGLELIGHT) 568#if defined(QPE_HAVE_TOGGLELIGHT)
561#include <qpe/config.h> 569#include <qpe/config.h>
562 570
563#include <sys/ioctl.h> 571#include <sys/ioctl.h>
@@ -590,12 +598,13 @@ static void darkScreen()
590 598
591 599
592void Desktop::togglePower() 600void Desktop::togglePower()
593{ 601{
594 bool wasloggedin = loggedin; 602 bool wasloggedin = loggedin;
595 loggedin=0; 603 loggedin=0;
604 suspendTime = QDateTime::currentDateTime();
596 darkScreen(); 605 darkScreen();
597 if ( wasloggedin ) 606 if ( wasloggedin )
598 blankScreen(); 607 blankScreen();
599 608
600 system("apm --suspend"); 609 system("apm --suspend");
601 610
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
@@ -24,12 +24,13 @@
24 24
25#include "shutdownimpl.h" 25#include "shutdownimpl.h"
26 26
27#include <qpe/qpeapplication.h> 27#include <qpe/qpeapplication.h>
28 28
29#include <qwidget.h> 29#include <qwidget.h>
30#include <qdatetime.h>
30 31
31class Background; 32class Background;
32class Launcher; 33class Launcher;
33class TaskBar; 34class TaskBar;
34class PowerStatus; 35class PowerStatus;
35class QCopBridge; 36class QCopBridge;
@@ -123,12 +124,13 @@ private:
123 bool recoverMemory(); 124 bool recoverMemory();
124 125
125 QCopBridge *qcopBridge; 126 QCopBridge *qcopBridge;
126 TransferServer *transferServer; 127 TransferServer *transferServer;
127 PackageSlave *packageSlave; 128 PackageSlave *packageSlave;
128 129
130 QDateTime suspendTime;
129 bool keyclick,touchclick; 131 bool keyclick,touchclick;
130}; 132};
131 133
132 134
133#endif // __DESKTOP_H__ 135#endif // __DESKTOP_H__
134 136
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
@@ -751,13 +751,13 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
751 } else if ( msg == "autoStart(QString,QString)" ) { 751 } else if ( msg == "autoStart(QString,QString)" ) {
752 QString modifier, appName; 752 QString modifier, appName;
753 stream >> modifier >> appName; 753 stream >> modifier >> appName;
754 Config cfg( "autostart" ); 754 Config cfg( "autostart" );
755 cfg.setGroup( "AutoStart" ); 755 cfg.setGroup( "AutoStart" );
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()) {
759 cfg.writeEntry("Apps", appName); 759 cfg.writeEntry("Apps", appName);
760 } 760 }
761 } else if (modifier.compare("remove") == 0 ) { 761 } else if (modifier.compare("remove") == 0 ) {
762 // need to change for multiple entries 762 // need to change for multiple entries
763 // actually remove is right now simular to clear, but in future there 763 // actually remove is right now simular to clear, but in future there
@@ -765,12 +765,26 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
765 QString checkName; 765 QString checkName;
766 checkName = cfg.readEntry("Apps", ""); 766 checkName = cfg.readEntry("Apps", "");
767 if (checkName == appName) { 767 if (checkName == appName) {
768 cfg.writeEntry("Apps", ""); 768 cfg.writeEntry("Apps", "");
769 } 769 }
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()" ) {
772 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); 786 QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
773 const QList<FileSystem> &fs = storage->fileSystems(); 787 const QList<FileSystem> &fs = storage->fileSystems();
774 QListIterator<FileSystem> it ( fs ); 788 QListIterator<FileSystem> it ( fs );
775 QString s; 789 QString s;
776 QString homeDir = getenv("HOME"); 790 QString homeDir = getenv("HOME");