summaryrefslogtreecommitdiff
path: root/core
authorharlekin <harlekin>2002-04-15 20:30:41 (UTC)
committer harlekin <harlekin>2002-04-15 20:30:41 (UTC)
commit15244683bb97d303d0d3b6104b46a9b429aaed85 (patch) (side-by-side diff)
treece57768177baec8b90146245a8cfad669addf647 /core
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') (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
-rw-r--r--core/pim/today/today.cpp23
-rw-r--r--core/pim/today/todayconfig.cpp51
-rw-r--r--core/pim/today/todayconfig.h29
6 files changed, 93 insertions, 41 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 @@
#include <qpe/power.h>
+#include <qpe/timeconversion.h>
#include <qpe/qcopenvelope_qws.h>
@@ -549,5 +550,6 @@ void Desktop::raiseEmail()
// autoStarts apps on resume and start
-void Desktop::execAutoStart()
-{
+void Desktop::execAutoStart() {
QString appName;
+ int delay;
+ QDateTime now = QDateTime::currentDateTime();
Config cfg( "autostart" );
@@ -555,4 +557,10 @@ void Desktop::execAutoStart()
appName = cfg.readEntry("Apps", "");
+ delay = (cfg.readEntry("Delay", "0" )).toInt();
+ // If the time between suspend and resume was longer then the
+ // value saved as delay, start the app
+ if ( suspendTime.secsTo(now) >= (delay*60) ) {
QCopEnvelope e("QPE/System", "execute(QString)");
e << QString(appName);
+ } else {
+ }
}
@@ -595,2 +603,3 @@ void Desktop::togglePower()
loggedin=0;
+ suspendTime = QDateTime::currentDateTime();
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 @@
#include <qwidget.h>
+#include <qdatetime.h>
@@ -128,2 +129,3 @@ private:
+ QDateTime suspendTime;
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)
if ( modifier.compare("add") == 0 ){
- // only add it appname is entered
+ // only add if appname is entered
if (!appName.isEmpty()) {
@@ -770,2 +770,16 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
}
+ // case the autostart feature should be delayed
+ } else if ( msg == "autoStart(QString, QString, QString)") {
+ QString modifier, appName, delay;
+ stream >> modifier >> appName >> delay;
+ Config cfg( "autostart" );
+ cfg.setGroup( "AutoStart" );
+ if ( modifier.compare("add") == 0 ){
+ // only add it appname is entered
+ if (!appName.isEmpty()) {
+ cfg.writeEntry("Apps", appName);
+ cfg.writeEntry("Delay", delay);
+ }
+ } else {
+ }
} else if ( msg == "sendCardInfo()" ) {
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp
index 61bd0c4..f5ed8d2 100644
--- a/core/pim/today/today.cpp
+++ b/core/pim/today/today.cpp
@@ -24,3 +24,3 @@
#include <qpe/qcopenvelope_qws.h>
-#include <qpe/qprocess.h>
+//#include <qpe/qprocess.h>
#include <qpe/resource.h>
@@ -40,3 +40,3 @@
#include <qpixmap.h>
-#include <qfileinfo.h>
+//#include <qfileinfo.h>
#include <qlayout.h>
@@ -57,2 +57,3 @@ int AUTOSTART;
int NEW_START=1;
+QString AUTOSTART_TIMER;
@@ -128,9 +129,11 @@ void Today::setOwnerField(QString &message) {
void Today::autoStart() {
- Config cfg("today");
- cfg.setGroup("Autostart");
- AUTOSTART = cfg.readNumEntry("autostart",1);
+ // Config cfg("today");
+ //cfg.setGroup("Autostart");
+ //AUTOSTART = cfg.readNumEntry("autostart",1);
+
if (AUTOSTART) {
- QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
+ QCopEnvelope e("QPE/System", "autoStart(QString, QString, QString)");
e << QString("add");
e << QString("today");
+ e << AUTOSTART_TIMER;
} else {
@@ -214,2 +217,6 @@ void Today::init() {
+ cfg.setGroup("Autostart");
+ AUTOSTART = cfg.readNumEntry("autostart",1);
+ AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0");
+
//db = new DateBookDB;
@@ -242,2 +249,4 @@ void Today::startConfig() {
conf->CheckBoxAuto->setChecked(AUTOSTART);
+ // autostart only if device has been suspended for X minutes
+ conf->SpinBoxTime->setValue( AUTOSTART_TIMER.toInt() );
@@ -252,2 +261,3 @@ void Today::startConfig() {
int autostart =conf->CheckBoxAuto->isChecked();
+ int autostartdelay = conf->SpinBoxTime->value();
@@ -261,2 +271,3 @@ void Today::startConfig() {
cfg.writeEntry("autostart", autostart);
+ cfg.writeEntry("autostartdelay", autostartdelay);
diff --git a/core/pim/today/todayconfig.cpp b/core/pim/today/todayconfig.cpp
index 500e8fb..905ec4b 100644
--- a/core/pim/today/todayconfig.cpp
+++ b/core/pim/today/todayconfig.cpp
@@ -1,9 +1,20 @@
-/****************************************************************************
-** Form implementation generated from reading ui file 'todayconfig.ui'
+/*
+ * todayconfig.cpp
+ *
+ * ---------------------
+ *
+ * begin : Sun 10 17:20:00 CEST 2002
+ * copyright : (c) 2002 by Maximilian Reiß
+ * email : max.reiss@gmx.de
+ *
+ */
+/***************************************************************************
**
-** Created: Thu Feb 14 15:04:33 2002
-** by: The User Interface Compiler (uic)
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
**
-** WARNING! All changes made in this file will be lost!
-****************************************************************************/
+ ***************************************************************************/
+
#include "todayconfig.h"
@@ -18,14 +29,6 @@
#include <qvariant.h>
-#include <qwhatsthis.h>
+//#include <qwhatsthis.h>
-/*
- * Constructs a todayconfig which is a child of 'parent', with the
- * name 'name' and widget flags set to 'f'
- *
- * The dialog will by default be modeless, unless you set 'modal' to
- * TRUE to construct a modal dialog.
- */
todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags fl )
- : QDialog( parent, name, modal, fl )
-{
+ : QDialog( parent, name, modal, fl ) {
if ( !name )
@@ -122,3 +125,2 @@ todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags
SpinBox7->setMaxValue( 80 );
- SpinBox7->setValue( 30 );
@@ -134,2 +136,10 @@ todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags
+ TimeLabel = new QLabel( Frame14, "TimeLabel" );
+ TimeLabel->setGeometry( QRect ( 20, 120, 120, 45 ) );
+ TimeLabel->setText( tr( "Activate the \n"
+ "autostart after how\n"
+ "many minutes?" ) );
+ SpinBoxTime = new QSpinBox( Frame14, "TimeSpinner");
+ SpinBoxTime->setGeometry( QRect( 115, 120, 58, 25 ) );
+
TabWidget3->insertTab( tab_3, tr( "Misc" ) );
@@ -138,8 +148,3 @@ todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags
-/*
- * Destroys the object and frees any allocated resources
- */
-todayconfig::~todayconfig()
-{
- // no need to delete child widgets, Qt does it all for us
+todayconfig::~todayconfig() {
}
diff --git a/core/pim/today/todayconfig.h b/core/pim/today/todayconfig.h
index 4739b5a..2986c4c 100644
--- a/core/pim/today/todayconfig.h
+++ b/core/pim/today/todayconfig.h
@@ -1,9 +1,19 @@
-/****************************************************************************
-** Form interface generated from reading ui file 'todayconfig.ui'
+/*
+ * todayconfig.h
+ *
+ * ---------------------
+ *
+ * begin : Sun 10 17:20:00 CEST 2002
+ * copyright : (c) 2002 by Maximilian Reiß
+ * email : max.reiss@gmx.de
+ *
+ */
+/***************************************************************************
**
-** Created: Thu Feb 14 15:04:33 2002
-** by: The User Interface Compiler (uic)
+ * This program is free software; you can redistribute it and/or modify *
+ * it under the terms of the GNU General Public License as published by *
+ * the Free Software Foundation; either version 2 of the License, or *
+ * (at your option) any later version. *
**
-** WARNING! All changes made in this file will be lost!
-****************************************************************************/
+ ***************************************************************************/
#ifndef TODAYCONFIG_H
@@ -23,4 +33,3 @@ class QWidget;
-class todayconfig : public QDialog
-{
+class todayconfig : public QDialog {
Q_OBJECT
@@ -51,2 +60,4 @@ public:
QSpinBox* SpinBox7;
+ QLabel* TimeLabel;
+ QSpinBox* SpinBoxTime;
@@ -54,2 +65,2 @@ public:
-#endif // TODAYCONFIG_H
+#endif