summaryrefslogtreecommitdiff
authorharlekin <harlekin>2002-03-07 11:05:40 (UTC)
committer harlekin <harlekin>2002-03-07 11:05:40 (UTC)
commita2f42b6df21b2e5d52b49376542d0f4c7443a897 (patch) (unidiff)
treebfbacf25dd213cdb2b7a86a007e4598a1634bb18
parent09444065297662fca1396abf8c0c9dd00380699f (diff)
downloadopie-a2f42b6df21b2e5d52b49376542d0f4c7443a897.zip
opie-a2f42b6df21b2e5d52b49376542d0f4c7443a897.tar.gz
opie-a2f42b6df21b2e5d52b49376542d0f4c7443a897.tar.bz2
beginning support for autostart
Diffstat (more/less context) (show whitespace changes)
-rw-r--r--core/launcher/desktop.cpp18
-rw-r--r--core/launcher/desktop.h1
-rw-r--r--core/launcher/launcher.cpp46
3 files changed, 58 insertions, 7 deletions
diff --git a/core/launcher/desktop.cpp b/core/launcher/desktop.cpp
index a00fae2..4587ec6 100644
--- a/core/launcher/desktop.cpp
+++ b/core/launcher/desktop.cpp
@@ -54,3 +54,2 @@
54 54
55
56class QCopKeyRegister 55class QCopKeyRegister
@@ -499,2 +498,13 @@ void Desktop::raiseEmail()
499 498
499// autoStarts apps on resume and start
500void Desktop::execAutoStart()
501{
502 QString appName;
503 Config cfg( "autostart" );
504 cfg.setGroup( "AutoStart" );
505 appName = cfg.readEntry("Apps", "");
506 QCopEnvelope e("QPE/System", "execute(QString)");
507 e << QString(appName);
508}
509
500#if defined(QPE_HAVE_TOGGLELIGHT) 510#if defined(QPE_HAVE_TOGGLELIGHT)
@@ -538,3 +548,5 @@ void Desktop::togglePower()
538 blankScreen(); 548 blankScreen();
549
539 system("apm --suspend"); 550 system("apm --suspend");
551 execAutoStart();
540 QWSServer::screenSaverActivate( FALSE ); 552 QWSServer::screenSaverActivate( FALSE );
@@ -545,4 +557,6 @@ void Desktop::togglePower()
545 } 557 }
546 if ( wasloggedin ) 558 if ( wasloggedin ) {
547 login(TRUE); 559 login(TRUE);
560 }
561
548 //qcopBridge->closeOpenConnections(); 562 //qcopBridge->closeOpenConnections();
diff --git a/core/launcher/desktop.h b/core/launcher/desktop.h
index f0a7cba..de0dbf0 100644
--- a/core/launcher/desktop.h
+++ b/core/launcher/desktop.h
@@ -101,2 +101,3 @@ public slots:
101 void raiseEmail(); 101 void raiseEmail();
102 void execAutoStart();
102 void togglePower(); 103 void togglePower();
diff --git a/core/launcher/launcher.cpp b/core/launcher/launcher.cpp
index 66a2ce5..0573330 100644
--- a/core/launcher/launcher.cpp
+++ b/core/launcher/launcher.cpp
@@ -20,2 +20,6 @@
20 20
21// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
22// have this class.
23#define QTOPIA_INTERNAL_FSLP
24
21#include <qpe/qcopenvelope_qws.h> 25#include <qpe/qcopenvelope_qws.h>
@@ -633,2 +637,32 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
633 e << locked; 637 e << locked;
638 // register an app for autostart
639 // if clear is send the list is cleared.
640 } else if ( msg == "autoStart(QString)" ) {
641 QString appName;
642 stream >> appName;
643 Config cfg( "autostart" );
644 cfg.setGroup( "AutoStart" );
645 if ( appName.compare("clear") == 0){
646 cfg.writeEntry("Apps", "");
647 }
648 } else if ( msg == "autoStart(QString,QString)" ) {
649 QString modifier, appName;
650 stream >> modifier >> appName;
651 Config cfg( "autostart" );
652 cfg.setGroup( "AutoStart" );
653 if ( modifier.compare("add") == 0 ){
654 // only add it appname is entered
655 if (!appName.isEmpty()) {
656 cfg.writeEntry("Apps", appName);
657 }
658 } else if (modifier.compare("remove") == 0 ) {
659 // need to change for multiple entries
660 // actually remove is right now simular to clear, but in future there
661 // should be multiple apps in autostart possible.
662 QString checkName;
663 checkName = cfg.readEntry("Apps", "");
664 if (checkName == appName) {
665 cfg.writeEntry("Apps", "");
666 }
667 }
634 } else if ( msg == "sendCardInfo()" ) { 668 } else if ( msg == "sendCardInfo()" ) {
@@ -699,3 +733,2 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
699 DocLnk *doc = it.current(); 733 DocLnk *doc = it.current();
700 QString lfn = doc->linkFile();
701 QFileInfo fi( doc->file() ); 734 QFileInfo fi( doc->file() );
@@ -704,5 +737,5 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
704 737
705 738 bool fake = !doc->linkFileKnown();
706 739 if ( !fake ) {
707 QFile f( lfn ); 740 QFile f( doc->linkFile() );
708 if ( f.open( IO_ReadOnly ) ) { 741 if ( f.open( IO_ReadOnly ) ) {
@@ -712,3 +745,6 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
712 f.close(); 745 f.close();
713 } else { 746 } else
747 fake = TRUE;
748 }
749 if (fake) {
714 contents += "[Desktop Entry]\n"; 750 contents += "[Desktop Entry]\n";