author | harlekin <harlekin> | 2002-04-15 20:30:41 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-04-15 20:30:41 (UTC) |
commit | 15244683bb97d303d0d3b6104b46a9b429aaed85 (patch) (unidiff) | |
tree | ce57768177baec8b90146245a8cfad669addf647 | |
parent | 551eb586e6a19db69348b0bb38f06171201d89a0 (diff) | |
download | opie-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
-rw-r--r-- | core/launcher/desktop.cpp | 41 | ||||
-rw-r--r-- | core/launcher/desktop.h | 2 | ||||
-rw-r--r-- | core/launcher/launcher.cpp | 82 | ||||
-rw-r--r-- | core/pim/today/today.cpp | 27 | ||||
-rw-r--r-- | core/pim/today/todayconfig.cpp | 57 | ||||
-rw-r--r-- | core/pim/today/todayconfig.h | 39 |
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 | |||
@@ -37,2 +37,3 @@ | |||
37 | #include <qpe/power.h> | 37 | #include <qpe/power.h> |
38 | #include <qpe/timeconversion.h> | ||
38 | #include <qpe/qcopenvelope_qws.h> | 39 | #include <qpe/qcopenvelope_qws.h> |
@@ -58,3 +59,3 @@ public: | |||
58 | QCopKeyRegister() : keyCode(0) { } | 59 | QCopKeyRegister() : keyCode(0) { } |
59 | QCopKeyRegister(int k, const QString &c, const QString &m) | 60 | QCopKeyRegister(int k, const QString &c, const QString &m) |
60 | : keyCode(k), channel(c), message(m) { } | 61 | : keyCode(k), channel(c), message(m) { } |
@@ -170,6 +171,6 @@ void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | |||
170 | stream >> m; | 171 | stream >> m; |
171 | 172 | ||
172 | qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); | 173 | qWarning("KeyRegisterRecieved: %i, %s, %s", k, (const char*)c, (const char *)m); |
173 | keyRegisterList.append(QCopKeyRegister(k,c,m)); | 174 | keyRegisterList.append(QCopKeyRegister(k,c,m)); |
174 | } | 175 | } |
175 | else if (msg == "suspend()"){ | 176 | else if (msg == "suspend()"){ |
@@ -177,3 +178,3 @@ void DesktopApplication::receive( const QCString &msg, const QByteArray &data ) | |||
177 | } | 178 | } |
178 | 179 | ||
179 | } | 180 | } |
@@ -279,3 +280,3 @@ bool DesktopApplication::qwsEventFilter( QWSEvent *e ) | |||
279 | } | 280 | } |
280 | 281 | ||
281 | return QPEApplication::qwsEventFilter( e ); | 282 | return QPEApplication::qwsEventFilter( e ); |
@@ -549,10 +550,17 @@ void Desktop::raiseEmail() | |||
549 | // autoStarts apps on resume and start | 550 | // autoStarts apps on resume and start |
550 | void Desktop::execAutoStart() | 551 | void Desktop::execAutoStart() { |
551 | { | 552 | QString appName; |
552 | QString appName; | 553 | int delay; |
553 | Config cfg( "autostart" ); | 554 | QDateTime now = QDateTime::currentDateTime(); |
554 | cfg.setGroup( "AutoStart" ); | 555 | Config cfg( "autostart" ); |
555 | appName = cfg.readEntry("Apps", ""); | 556 | cfg.setGroup( "AutoStart" ); |
556 | QCopEnvelope e("QPE/System", "execute(QString)"); | 557 | appName = cfg.readEntry("Apps", ""); |
557 | e << QString(appName); | 558 | delay = (cfg.readEntry("Delay", "0" )).toInt(); |
559 | // If the time between suspend and resume was longer then the | ||
560 | // value saved as delay, start the app | ||
561 | if ( suspendTime.secsTo(now) >= (delay*60) ) { | ||
562 | QCopEnvelope e("QPE/System", "execute(QString)"); | ||
563 | e << QString(appName); | ||
564 | } else { | ||
565 | } | ||
558 | } | 566 | } |
@@ -595,2 +603,3 @@ void Desktop::togglePower() | |||
595 | loggedin=0; | 603 | loggedin=0; |
604 | suspendTime = QDateTime::currentDateTime(); | ||
596 | darkScreen(); | 605 | darkScreen(); |
@@ -598,6 +607,6 @@ void Desktop::togglePower() | |||
598 | blankScreen(); | 607 | blankScreen(); |
599 | 608 | ||
600 | system("apm --suspend"); | 609 | system("apm --suspend"); |
601 | 610 | ||
602 | 611 | ||
603 | 612 | ||
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 @@ | |||
29 | #include <qwidget.h> | 29 | #include <qwidget.h> |
30 | #include <qdatetime.h> | ||
30 | 31 | ||
@@ -128,2 +129,3 @@ private: | |||
128 | 129 | ||
130 | QDateTime suspendTime; | ||
129 | bool keyclick,touchclick; | 131 | 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 | |||
@@ -99,3 +99,3 @@ namespace { | |||
99 | mimes.append("text//*"); | 99 | mimes.append("text//*"); |
100 | 100 | ||
101 | tmpMime = cfg->readBoolEntry("video", true ); | 101 | tmpMime = cfg->readBoolEntry("video", true ); |
@@ -551,6 +551,6 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
551 | // We will do this by having a timestamp inside each mountpoint | 551 | // We will do this by having a timestamp inside each mountpoint |
552 | // if the current timestamp doesn't match this is a new file system and | 552 | // if the current timestamp doesn't match this is a new file system and |
553 | // come up with our MediumMountGui :) let the hacking begin | 553 | // come up with our MediumMountGui :) let the hacking begin |
554 | int stamp = uidgen.generate(); | 554 | int stamp = uidgen.generate(); |
555 | 555 | ||
556 | QString newStamp = QString::number( stamp ); // generates newtime Stamp | 556 | QString newStamp = QString::number( stamp ); // generates newtime Stamp |
@@ -593,3 +593,3 @@ void Launcher::loadDocs() // ok here comes a hack belonging to Global:: | |||
593 | } | 593 | } |
594 | } | 594 | } |
595 | } | 595 | } |
@@ -689,3 +689,3 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
689 | QString link; | 689 | QString link; |
690 | stream >> link; | 690 | stream >> link; |
691 | if ( in_lnk_props ) { | 691 | if ( in_lnk_props ) { |
@@ -743,30 +743,44 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
743 | } else if ( msg == "autoStart(QString)" ) { | 743 | } else if ( msg == "autoStart(QString)" ) { |
744 | QString appName; | 744 | QString appName; |
745 | stream >> appName; | 745 | stream >> appName; |
746 | Config cfg( "autostart" ); | 746 | Config cfg( "autostart" ); |
747 | cfg.setGroup( "AutoStart" ); | 747 | cfg.setGroup( "AutoStart" ); |
748 | if ( appName.compare("clear") == 0){ | 748 | if ( appName.compare("clear") == 0){ |
749 | cfg.writeEntry("Apps", ""); | 749 | cfg.writeEntry("Apps", ""); |
750 | } | 750 | } |
751 | } else if ( msg == "autoStart(QString,QString)" ) { | 751 | } else if ( msg == "autoStart(QString,QString)" ) { |
752 | QString modifier, appName; | 752 | QString modifier, appName; |
753 | stream >> modifier >> appName; | 753 | stream >> modifier >> appName; |
754 | Config cfg( "autostart" ); | 754 | Config cfg( "autostart" ); |
755 | cfg.setGroup( "AutoStart" ); | 755 | cfg.setGroup( "AutoStart" ); |
756 | if ( modifier.compare("add") == 0 ){ | 756 | if ( modifier.compare("add") == 0 ){ |
757 | // only add it appname is entered | 757 | // only add if appname is entered |
758 | if (!appName.isEmpty()) { | 758 | if (!appName.isEmpty()) { |
759 | cfg.writeEntry("Apps", appName); | 759 | cfg.writeEntry("Apps", appName); |
760 | } | 760 | } |
761 | } else if (modifier.compare("remove") == 0 ) { | 761 | } else if (modifier.compare("remove") == 0 ) { |
762 | // need to change for multiple entries | 762 | // need to change for multiple entries |
763 | // actually remove is right now simular to clear, but in future there | 763 | // actually remove is right now simular to clear, but in future there |
764 | // should be multiple apps in autostart possible. | 764 | // should be multiple apps in autostart possible. |
765 | QString checkName; | 765 | QString checkName; |
766 | checkName = cfg.readEntry("Apps", ""); | 766 | checkName = cfg.readEntry("Apps", ""); |
767 | if (checkName == appName) { | 767 | if (checkName == appName) { |
768 | cfg.writeEntry("Apps", ""); | 768 | cfg.writeEntry("Apps", ""); |
769 | } | 769 | } |
770 | } | 770 | } |
771 | } else if ( msg == "sendCardInfo()" ) { | 771 | // case the autostart feature should be delayed |
772 | } else if ( msg == "autoStart(QString, QString, QString)") { | ||
773 | QString modifier, appName, delay; | ||
774 | stream >> modifier >> appName >> delay; | ||
775 | Config cfg( "autostart" ); | ||
776 | cfg.setGroup( "AutoStart" ); | ||
777 | if ( modifier.compare("add") == 0 ){ | ||
778 | // only add it appname is entered | ||
779 | if (!appName.isEmpty()) { | ||
780 | cfg.writeEntry("Apps", appName); | ||
781 | cfg.writeEntry("Delay", delay); | ||
782 | } | ||
783 | } else { | ||
784 | } | ||
785 | } else if ( msg == "sendCardInfo()" ) { | ||
772 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); | 786 | QCopEnvelope e( "QPE/Desktop", "cardInfo(QString)" ); |
@@ -825,3 +839,3 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
825 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), | 839 | connect( syncDialog->buttonCancel, SIGNAL( clicked() ), |
826 | SLOT( cancelSync() ) ); | 840 | SLOT( cancelSync() ) ); |
827 | } | 841 | } |
@@ -864,3 +878,3 @@ void Launcher::systemMessage( const QCString &msg, const QByteArray &data) | |||
864 | e << contents; | 878 | e << contents; |
865 | 879 | ||
866 | qDebug( "================ \n\n%s\n\n===============", | 880 | qDebug( "================ \n\n%s\n\n===============", |
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 @@ | |||
24 | #include <qpe/qcopenvelope_qws.h> | 24 | #include <qpe/qcopenvelope_qws.h> |
25 | #include <qpe/qprocess.h> | 25 | //#include <qpe/qprocess.h> |
26 | #include <qpe/resource.h> | 26 | #include <qpe/resource.h> |
@@ -40,3 +40,3 @@ | |||
40 | #include <qpixmap.h> | 40 | #include <qpixmap.h> |
41 | #include <qfileinfo.h> | 41 | //#include <qfileinfo.h> |
42 | #include <qlayout.h> | 42 | #include <qlayout.h> |
@@ -57,2 +57,3 @@ int AUTOSTART; | |||
57 | int NEW_START=1; | 57 | int NEW_START=1; |
58 | QString AUTOSTART_TIMER; | ||
58 | 59 | ||
@@ -128,11 +129,13 @@ void Today::setOwnerField(QString &message) { | |||
128 | void Today::autoStart() { | 129 | void Today::autoStart() { |
129 | Config cfg("today"); | 130 | // Config cfg("today"); |
130 | cfg.setGroup("Autostart"); | 131 | //cfg.setGroup("Autostart"); |
131 | AUTOSTART = cfg.readNumEntry("autostart",1); | 132 | //AUTOSTART = cfg.readNumEntry("autostart",1); |
133 | |||
132 | if (AUTOSTART) { | 134 | if (AUTOSTART) { |
133 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); | 135 | QCopEnvelope e("QPE/System", "autoStart(QString, QString, QString)"); |
134 | e << QString("add"); | 136 | e << QString("add"); |
135 | e << QString("today"); | 137 | e << QString("today"); |
138 | e << AUTOSTART_TIMER; | ||
136 | } else { | 139 | } else { |
137 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); | 140 | QCopEnvelope e("QPE/System", "autoStart(QString, QString)"); |
138 | e << QString("remove"); | 141 | e << QString("remove"); |
@@ -214,2 +217,6 @@ void Today::init() { | |||
214 | 217 | ||
218 | cfg.setGroup("Autostart"); | ||
219 | AUTOSTART = cfg.readNumEntry("autostart",1); | ||
220 | AUTOSTART_TIMER = cfg.readEntry("autostartdelay", "0"); | ||
221 | |||
215 | //db = new DateBookDB; | 222 | //db = new DateBookDB; |
@@ -242,2 +249,4 @@ void Today::startConfig() { | |||
242 | conf->CheckBoxAuto->setChecked(AUTOSTART); | 249 | conf->CheckBoxAuto->setChecked(AUTOSTART); |
250 | // autostart only if device has been suspended for X minutes | ||
251 | conf->SpinBoxTime->setValue( AUTOSTART_TIMER.toInt() ); | ||
243 | 252 | ||
@@ -251,3 +260,4 @@ void Today::startConfig() { | |||
251 | int onlylater = conf->CheckBox3->isChecked(); | 260 | int onlylater = conf->CheckBox3->isChecked(); |
252 | int autostart =conf->CheckBoxAuto->isChecked(); | 261 | int autostart = conf->CheckBoxAuto->isChecked(); |
262 | int autostartdelay = conf->SpinBoxTime->value(); | ||
253 | 263 | ||
@@ -261,2 +271,3 @@ void Today::startConfig() { | |||
261 | cfg.writeEntry("autostart", autostart); | 271 | cfg.writeEntry("autostart", autostart); |
272 | cfg.writeEntry("autostartdelay", autostartdelay); | ||
262 | 273 | ||
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 @@ | |||
1 | /**************************************************************************** | 1 | /* |
2 | ** Form implementation generated from reading ui file 'todayconfig.ui' | 2 | * todayconfig.cpp |
3 | ** | 3 | * |
4 | ** Created: Thu Feb 14 15:04:33 2002 | 4 | * --------------------- |
5 | ** by: The User Interface Compiler (uic) | 5 | * |
6 | ** | 6 | * begin : Sun 10 17:20:00 CEST 2002 |
7 | ** WARNING! All changes made in this file will be lost! | 7 | * copyright : (c) 2002 by Maximilian Reiß |
8 | ****************************************************************************/ | 8 | * email : max.reiss@gmx.de |
9 | * | ||
10 | */ | ||
11 | /*************************************************************************** | ||
12 | * * | ||
13 | * This program is free software; you can redistribute it and/or modify * | ||
14 | * it under the terms of the GNU General Public License as published by * | ||
15 | * the Free Software Foundation; either version 2 of the License, or * | ||
16 | * (at your option) any later version. * | ||
17 | * * | ||
18 | ***************************************************************************/ | ||
19 | |||
9 | #include "todayconfig.h" | 20 | #include "todayconfig.h" |
@@ -18,16 +29,8 @@ | |||
18 | #include <qvariant.h> | 29 | #include <qvariant.h> |
19 | #include <qwhatsthis.h> | 30 | //#include <qwhatsthis.h> |
20 | 31 | ||
21 | /* | ||
22 | * Constructs a todayconfig which is a child of 'parent', with the | ||
23 | * name 'name' and widget flags set to 'f' | ||
24 | * | ||
25 | * The dialog will by default be modeless, unless you set 'modal' to | ||
26 | * TRUE to construct a modal dialog. | ||
27 | */ | ||
28 | todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags fl ) | 32 | todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags fl ) |
29 | : QDialog( parent, name, modal, fl ) | 33 | : QDialog( parent, name, modal, fl ) { |
30 | { | ||
31 | if ( !name ) | 34 | if ( !name ) |
32 | setName( "todayconfig" ); | 35 | setName( "todayconfig" ); |
33 | resize( 175, 232 ); | 36 | resize( 175, 232 ); |
@@ -122,3 +125,2 @@ todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags | |||
122 | SpinBox7->setMaxValue( 80 ); | 125 | SpinBox7->setMaxValue( 80 ); |
123 | SpinBox7->setValue( 30 ); | ||
124 | 126 | ||
@@ -134,2 +136,10 @@ todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags | |||
134 | 136 | ||
137 | TimeLabel = new QLabel( Frame14, "TimeLabel" ); | ||
138 | TimeLabel->setGeometry( QRect ( 20, 120, 120, 45 ) ); | ||
139 | TimeLabel->setText( tr( "Activate the \n" | ||
140 | "autostart after how\n" | ||
141 | "many minutes?" ) ); | ||
142 | SpinBoxTime = new QSpinBox( Frame14, "TimeSpinner"); | ||
143 | SpinBoxTime->setGeometry( QRect( 115, 120, 58, 25 ) ); | ||
144 | |||
135 | TabWidget3->insertTab( tab_3, tr( "Misc" ) ); | 145 | TabWidget3->insertTab( tab_3, tr( "Misc" ) ); |
@@ -138,8 +148,3 @@ todayconfig::todayconfig( QWidget* parent, const char* name, bool modal, WFlags | |||
138 | 148 | ||
139 | /* | 149 | todayconfig::~todayconfig() { |
140 | * Destroys the object and frees any allocated resources | ||
141 | */ | ||
142 | todayconfig::~todayconfig() | ||
143 | { | ||
144 | // no need to delete child widgets, Qt does it all for us | ||
145 | } | 150 | } |
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 @@ | |||
1 | /**************************************************************************** | 1 | /* |
2 | ** Form interface generated from reading ui file 'todayconfig.ui' | 2 | * todayconfig.h |
3 | ** | 3 | * |
4 | ** Created: Thu Feb 14 15:04:33 2002 | 4 | * --------------------- |
5 | ** by: The User Interface Compiler (uic) | 5 | * |
6 | ** | 6 | * begin : Sun 10 17:20:00 CEST 2002 |
7 | ** WARNING! All changes made in this file will be lost! | 7 | * copyright : (c) 2002 by Maximilian Reiß |
8 | ****************************************************************************/ | 8 | * email : max.reiss@gmx.de |
9 | * | ||
10 | */ | ||
11 | /*************************************************************************** | ||
12 | * * | ||
13 | * This program is free software; you can redistribute it and/or modify * | ||
14 | * it under the terms of the GNU General Public License as published by * | ||
15 | * the Free Software Foundation; either version 2 of the License, or * | ||
16 | * (at your option) any later version. * | ||
17 | * * | ||
18 | ***************************************************************************/ | ||
9 | #ifndef TODAYCONFIG_H | 19 | #ifndef TODAYCONFIG_H |
@@ -13,5 +23,5 @@ | |||
13 | #include <qdialog.h> | 23 | #include <qdialog.h> |
14 | //class QVBoxLayout; | 24 | //class QVBoxLayout; |
15 | class QHBoxLayout; | 25 | class QHBoxLayout; |
16 | class QGridLayout; | 26 | class QGridLayout; |
17 | class QCheckBox; | 27 | class QCheckBox; |
@@ -23,4 +33,3 @@ class QWidget; | |||
23 | 33 | ||
24 | class todayconfig : public QDialog | 34 | class todayconfig : public QDialog { |
25 | { | ||
26 | Q_OBJECT | 35 | Q_OBJECT |
@@ -51,2 +60,4 @@ public: | |||
51 | QSpinBox* SpinBox7; | 60 | QSpinBox* SpinBox7; |
61 | QLabel* TimeLabel; | ||
62 | QSpinBox* SpinBoxTime; | ||
52 | 63 | ||
@@ -54,2 +65,2 @@ public: | |||
54 | 65 | ||
55 | #endif // TODAYCONFIG_H | 66 | #endif |