summaryrefslogtreecommitdiff
path: root/core/launcher
authorharlekin <harlekin>2002-03-07 11:05:40 (UTC)
committer harlekin <harlekin>2002-03-07 11:05:40 (UTC)
commita2f42b6df21b2e5d52b49376542d0f4c7443a897 (patch) (side-by-side diff)
treebfbacf25dd213cdb2b7a86a007e4598a1634bb18 /core/launcher
parent09444065297662fca1396abf8c0c9dd00380699f (diff)
downloadopie-a2f42b6df21b2e5d52b49376542d0f4c7443a897.zip
opie-a2f42b6df21b2e5d52b49376542d0f4c7443a897.tar.gz
opie-a2f42b6df21b2e5d52b49376542d0f4c7443a897.tar.bz2
beginning support for autostart
Diffstat (limited to 'core/launcher') (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 @@
-
class QCopKeyRegister
@@ -499,2 +498,13 @@ void Desktop::raiseEmail()
+// autoStarts apps on resume and start
+void Desktop::execAutoStart()
+{
+ QString appName;
+ Config cfg( "autostart" );
+ cfg.setGroup( "AutoStart" );
+ appName = cfg.readEntry("Apps", "");
+ QCopEnvelope e("QPE/System", "execute(QString)");
+ e << QString(appName);
+}
+
#if defined(QPE_HAVE_TOGGLELIGHT)
@@ -538,3 +548,5 @@ void Desktop::togglePower()
blankScreen();
+
system("apm --suspend");
+ execAutoStart();
QWSServer::screenSaverActivate( FALSE );
@@ -545,4 +557,6 @@ void Desktop::togglePower()
}
- if ( wasloggedin )
+ if ( wasloggedin ) {
login(TRUE);
+ }
+
//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:
void raiseEmail();
+ void execAutoStart();
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 @@
+// WARNING: Do *NOT* define this yourself. The SL5xxx from SHARP does NOT
+// have this class.
+#define QTOPIA_INTERNAL_FSLP
+
#include <qpe/qcopenvelope_qws.h>
@@ -633,2 +637,32 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
e << locked;
+ // register an app for autostart
+ // if clear is send the list is cleared.
+ } else if ( msg == "autoStart(QString)" ) {
+ QString appName;
+ stream >> appName;
+ Config cfg( "autostart" );
+ cfg.setGroup( "AutoStart" );
+ if ( appName.compare("clear") == 0){
+ cfg.writeEntry("Apps", "");
+ }
+ } else if ( msg == "autoStart(QString,QString)" ) {
+ QString modifier, appName;
+ stream >> modifier >> appName;
+ Config cfg( "autostart" );
+ cfg.setGroup( "AutoStart" );
+ if ( modifier.compare("add") == 0 ){
+ // only add it appname is entered
+ if (!appName.isEmpty()) {
+ cfg.writeEntry("Apps", appName);
+ }
+ } else if (modifier.compare("remove") == 0 ) {
+ // need to change for multiple entries
+ // actually remove is right now simular to clear, but in future there
+ // should be multiple apps in autostart possible.
+ QString checkName;
+ checkName = cfg.readEntry("Apps", "");
+ if (checkName == appName) {
+ cfg.writeEntry("Apps", "");
+ }
+ }
} else if ( msg == "sendCardInfo()" ) {
@@ -699,3 +733,2 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
DocLnk *doc = it.current();
- QString lfn = doc->linkFile();
QFileInfo fi( doc->file() );
@@ -704,5 +737,5 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
-
-
- QFile f( lfn );
+ bool fake = !doc->linkFileKnown();
+ if ( !fake ) {
+ QFile f( doc->linkFile() );
if ( f.open( IO_ReadOnly ) ) {
@@ -712,3 +745,6 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
f.close();
- } else {
+ } else
+ fake = TRUE;
+ }
+ if (fake) {
contents += "[Desktop Entry]\n";