summaryrefslogtreecommitdiff
Side-by-side diff
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--core/launcher/desktop.cpp41
-rw-r--r--core/launcher/desktop.h2
-rw-r--r--core/launcher/launcher.cpp82
-rw-r--r--core/pim/today/today.cpp27
-rw-r--r--core/pim/today/todayconfig.cpp57
-rw-r--r--core/pim/today/todayconfig.h39
6 files changed, 150 insertions, 98 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
@@ -36,4 +36,5 @@
#include <qpe/config.h>
#include <qpe/power.h>
+#include <qpe/timeconversion.h>
#include <qpe/qcopenvelope_qws.h>
#include <qpe/global.h>
@@ -57,5 +58,5 @@ class QCopKeyRegister
public:
QCopKeyRegister() : keyCode(0) { }
- QCopKeyRegister(int k, const QString &c, const QString &m)
+ QCopKeyRegister(int k, const QString &c, const QString &m)
: keyCode(k), channel(c), message(m) { }
@@ -169,12 +170,12 @@ void DesktopApplication::receive( const QCString &msg, const QByteArray &data )
stream >> c;
stream >> m;
-
+
qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m);
keyRegisterList.append(QCopKeyRegister(k,c,m));
- }
+ }
else if (msg == "suspend()"){
emit power();
}
-
+
}
@@ -278,5 +279,5 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e )
}
}
-
+
return QPEApplication::qwsEventFilter( e );
}
@@ -548,12 +549,19 @@ 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);
+void Desktop::execAutoStart() {
+ QString appName;
+ int delay;
+ QDateTime now = QDateTime::currentDateTime();
+ Config cfg( "autostart" );
+ cfg.setGroup( "AutoStart" );
+ 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 {
+ }
}
@@ -594,11 +602,12 @@ void Desktop::togglePower()
bool wasloggedin = loggedin;
loggedin=0;
+ suspendTime = QDateTime::currentDateTime();
darkScreen();
if ( wasloggedin )
blankScreen();
-
+
system("apm --suspend");
-
-
+
+
QWSServer::screenSaverActivate( FALSE );
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
@@ -28,4 +28,5 @@
#include <qwidget.h>
+#include <qdatetime.h>
class Background;
@@ -127,4 +128,5 @@ private:
PackageSlave *packageSlave;
+ 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
@@ -98,5 +98,5 @@ namespace {
if(tmpMime )
mimes.append("text//*");
-
+
tmpMime = cfg->readBoolEntry("video", true );
if(tmpMime )
@@ -550,8 +550,8 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
// find out wich filesystems are new in this round
// We will do this by having a timestamp inside each mountpoint
- // if the current timestamp doesn't match this is a new file system and
+ // if the current timestamp doesn't match this is a new file system and
// come up with our MediumMountGui :) let the hacking begin
int stamp = uidgen.generate();
-
+
QString newStamp = QString::number( stamp ); // generates newtime Stamp
StorageInfo storage;
@@ -592,5 +592,5 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global::
}
}
- }
+ }
}
}
@@ -688,5 +688,5 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
}else if ( msg == "linkChanged(QString)" ) {
QString link;
- stream >> link;
+ stream >> link;
if ( in_lnk_props ) {
got_lnk_change = TRUE;
@@ -742,32 +742,46 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
// 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", "");
- }
+ 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()" ) {
+ QString modifier, appName;
+ stream >> modifier >> appName;
+ Config cfg( "autostart" );
+ cfg.setGroup( "AutoStart" );
+ if ( modifier.compare("add") == 0 ){
+ // only add if 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", "");
+ }
+ }
+ // 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()" ) {
QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" );
const QList<FileSystem> &fs = storage->fileSystems();
@@ -824,5 +838,5 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
syncDialog->whatLabel->setText( "<b>" + what + "</b>" );
connect( syncDialog->buttonCancel, SIGNAL( clicked() ),
- SLOT( cancelSync() ) );
+ SLOT( cancelSync() ) );
}
else if ( msg == "stopSync()") {
@@ -863,5 +877,5 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data)
QCopEnvelope e( "QPE/Desktop", "docLinks(QString)" );
e << contents;
-
+
qDebug( "================ \n\n%s\n\n===============",
contents.latin1() );
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
@@ -23,5 +23,5 @@
#include <qpe/config.h>
#include <qpe/qcopenvelope_qws.h>
-#include <qpe/qprocess.h>
+//#include <qpe/qprocess.h>
#include <qpe/resource.h>
#include <qpe/contact.h>
@@ -39,5 +39,5 @@
#include <qtimer.h>
#include <qpixmap.h>
-#include <qfileinfo.h>
+//#include <qfileinfo.h>
#include <qlayout.h>
#include <qtl.h>
@@ -56,4 +56,5 @@ int ONLY_LATER;
int AUTOSTART;
int NEW_START=1;
+QString AUTOSTART_TIMER;
/*
@@ -127,13 +128,15 @@ 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 {
- QCopEnvelope e("QPE/System", "autoStart(QString,QString)");
+ QCopEnvelope e("QPE/System", "autoStart(QString, QString)");
e << QString("remove");
e << QString("today");
@@ -213,4 +216,8 @@ void Today::init() {
ONLY_LATER = cfg.readNumEntry("onlylater",1);
+ cfg.setGroup("Autostart");
+ AUTOSTART = cfg.readNumEntry("autostart",1);
+ AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0");
+
//db = new DateBookDB;
}
@@ -241,4 +248,6 @@ void Today::startConfig() {
// if today should be autostarted
conf->CheckBoxAuto->setChecked(AUTOSTART);
+ // autostart only if device has been suspended for X minutes
+ conf->SpinBoxTime->setValue( AUTOSTART_TIMER.toInt() );
conf->exec();
@@ -250,5 +259,6 @@ void Today::startConfig() {
int maxcharclip = conf->SpinBox7->value();
int onlylater = conf->CheckBox3->isChecked();
- int autostart =conf->CheckBoxAuto->isChecked();
+ int autostart = conf->CheckBoxAuto->isChecked();
+ int autostartdelay = conf->SpinBoxTime->value();
cfg.writeEntry("maxlinestask",maxlinestask);
@@ -260,4 +270,5 @@ void Today::startConfig() {
cfg.setGroup("Autostart");
cfg.writeEntry("autostart", autostart);
+ cfg.writeEntry("autostartdelay", autostartdelay);
// sync it to "disk"
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,10 +1,21 @@
-/****************************************************************************
-** Form implementation generated from reading ui file 'todayconfig.ui'
-**
-** Created: Thu Feb 14 15:04:33 2002
-** by: The User Interface Compiler (uic)
-**
-** WARNING! All changes made in this file will be lost!
-****************************************************************************/
+/*
+ * todayconfig.cpp
+ *
+ * ---------------------
+ *
+ * begin : Sun 10 17:20:00 CEST 2002
+ * copyright : (c) 2002 by Maximilian Reiß
+ * email : max.reiss@gmx.de
+ *
+ */
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
+
#include "todayconfig.h"
@@ -17,18 +28,10 @@
#include <qlayout.h>
#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 )
- setName( "todayconfig" );
+ setName( "todayconfig" );
resize( 175, 232 );
setCaption( tr( "Today config" ) );
@@ -121,5 +124,4 @@ todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags
SpinBox7->setGeometry( QRect( 115, 20, 58, 25 ) );
SpinBox7->setMaxValue( 80 );
- SpinBox7->setValue( 30 );
TextLabel2 = new QLabel( Frame14, "AutoStart" );
@@ -133,14 +135,17 @@ todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags
CheckBoxAuto->setGeometry( QRect( 158, 60, 27, 21 ) );
+ 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" ) );
}
-/*
- * 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,10 +1,20 @@
-/****************************************************************************
-** Form interface generated from reading ui file 'todayconfig.ui'
-**
-** Created: Thu Feb 14 15:04:33 2002
-** by: The User Interface Compiler (uic)
-**
-** WARNING! All changes made in this file will be lost!
-****************************************************************************/
+/*
+ * todayconfig.h
+ *
+ * ---------------------
+ *
+ * begin : Sun 10 17:20:00 CEST 2002
+ * copyright : (c) 2002 by Maximilian Reiß
+ * email : max.reiss@gmx.de
+ *
+ */
+/***************************************************************************
+ * *
+ * 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. *
+ * *
+ ***************************************************************************/
#ifndef TODAYCONFIG_H
#define TODAYCONFIG_H
@@ -12,7 +22,7 @@
#include <qvariant.h>
#include <qdialog.h>
-//class QVBoxLayout;
-class QHBoxLayout;
-class QGridLayout;
+//class QVBoxLayout;
+class QHBoxLayout;
+class QGridLayout;
class QCheckBox;
class QFrame;
@@ -22,6 +32,5 @@ class QTabWidget;
class QWidget;
-class todayconfig : public QDialog
-{
+class todayconfig : public QDialog {
Q_OBJECT
@@ -50,6 +59,8 @@ public:
QLabel* TextLabel1;
QSpinBox* SpinBox7;
+ QLabel* TimeLabel;
+ QSpinBox* SpinBoxTime;
};
-#endif // TODAYCONFIG_H
+#endif