From 15244683bb97d303d0d3b6104b46a9b429aaed85 Mon Sep 17 00:00:00 2001 From: harlekin Date: Mon, 15 Apr 2002 20:30:41 +0000 Subject: added a configurable delay, so for example if 5 min are set, and the suspend time is shorter, no app is autostarted --- (limited to 'core/pim/today/today.cpp') 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 @@ -22,7 +22,7 @@ #include #include #include -#include +//#include #include #include #include @@ -38,7 +38,7 @@ #include #include #include -#include +//#include #include #include @@ -55,6 +55,7 @@ int SHOW_NOTES; int ONLY_LATER; int AUTOSTART; int NEW_START=1; +QString AUTOSTART_TIMER; /* * Constructs a Example which is a child of 'parent', with the @@ -126,15 +127,17 @@ void Today::setOwnerField(QString &message) { * If registered against that today ist started on each resume. */ 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"); } @@ -212,6 +215,10 @@ void Today::init() { // should only later appointments be shown or all for the current day. ONLY_LATER = cfg.readNumEntry("onlylater",1); + cfg.setGroup("Autostart"); + AUTOSTART = cfg.readNumEntry("autostart",1); + AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0"); + //db = new DateBookDB; } @@ -240,6 +247,8 @@ void Today::startConfig() { conf->CheckBox3->setChecked(ONLY_LATER); // 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(); @@ -249,7 +258,8 @@ void Today::startConfig() { int notes = conf->CheckBox2->isChecked(); 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); cfg.writeEntry("maxcharclip", maxcharclip); @@ -259,6 +269,7 @@ void Today::startConfig() { cfg.writeEntry("onlylater", onlylater); cfg.setGroup("Autostart"); cfg.writeEntry("autostart", autostart); + cfg.writeEntry("autostartdelay", autostartdelay); // sync it to "disk" cfg.write(); -- cgit v0.9.0.2