summaryrefslogtreecommitdiff
path: root/core/launcher/desktop.cpp
Unidiff
Diffstat (limited to 'core/launcher/desktop.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp41
1 files changed, 25 insertions, 16 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 @@
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
@@ -56,7 +57,7 @@ class QCopKeyRegister
56{ 57{
57public: 58public:
58 QCopKeyRegister() : keyCode(0) { } 59 QCopKeyRegister() : keyCode(0) { }
59 QCopKeyRegister(int k, const QString &c, const QString &m) 60 QCopKeyRegister(int k, const QString &c, const QString &m)
60 : keyCode(k), channel(c), message(m) { } 61 : keyCode(k), channel(c), message(m) { }
61 62
62 int getKeyCode() const { return keyCode; } 63 int getKeyCode() const { return keyCode; }
@@ -168,14 +169,14 @@ void DesktopApplication::receive( const QCString &msg, const QByteArray &data )
168 stream >> k; 169 stream >> k;
169 stream >> c; 170 stream >> c;
170 stream >> m; 171 stream >> m;
171 172
172 qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); 173 qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m);
173 keyRegisterList.append(QCopKeyRegister(k,c,m)); 174 keyRegisterList.append(QCopKeyRegister(k,c,m));
174 } 175 }
175 else if (msg == "suspend()"){ 176 else if (msg == "suspend()"){
176 emit power(); 177 emit power();
177 } 178 }
178 179
179} 180}
180 181
181enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown; 182enum MemState { Unknown, VeryLow, Low, Normal } memstate=Unknown;
@@ -277,7 +278,7 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e )
277 } 278 }
278 } 279 }
279 } 280 }
280 281
281 return QPEApplication::qwsEventFilter( e ); 282 return QPEApplication::qwsEventFilter( e );
282} 283}
283#endif 284#endif
@@ -547,14 +548,21 @@ void Desktop::raiseEmail()
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;
553 Config cfg( "autostart" ); 554 QDateTime now = QDateTime::currentDateTime();
554 cfg.setGroup( "AutoStart" ); 555 Config cfg( "autostart" );
555 appName = cfg.readEntry("Apps", ""); 556 cfg.setGroup( "AutoStart" );
556 QCopEnvelope e("QPE/System", "execute(QString)"); 557 appName = cfg.readEntry("Apps", "");
557 e << QString(appName); 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) ) {
562 QCopEnvelope e("QPE/System", "execute(QString)");
563 e << QString(appName);
564 } else {
565 }
558} 566}
559 567
560#if defined(QPE_HAVE_TOGGLELIGHT) 568#if defined(QPE_HAVE_TOGGLELIGHT)
@@ -593,13 +601,14 @@ void 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
602 611
603 612
604 QWSServer::screenSaverActivate( FALSE ); 613 QWSServer::screenSaverActivate( FALSE );
605 { 614 {