author | harlekin <harlekin> | 2002-03-07 11:06:58 (UTC) |
---|---|---|
committer | harlekin <harlekin> | 2002-03-07 11:06:58 (UTC) |
commit | 69d2df15c2dbd280f6ed99d5eecf487345f1de08 (patch) (unidiff) | |
tree | 7a4f07836247e50c1cd2ed112010c172f4f9a371 /core/pim/today/today.cpp | |
parent | a2f42b6df21b2e5d52b49376542d0f4c7443a897 (diff) | |
download | opie-69d2df15c2dbd280f6ed99d5eecf487345f1de08.zip opie-69d2df15c2dbd280f6ed99d5eecf487345f1de08.tar.gz opie-69d2df15c2dbd280f6ed99d5eecf487345f1de08.tar.bz2 |
support for the launcher autostart feature
-rw-r--r-- | core/pim/today/today.cpp | 39 |
1 files changed, 31 insertions, 8 deletions
diff --git a/core/pim/today/today.cpp b/core/pim/today/today.cpp index 6a0e9fc..0fa7ad5 100644 --- a/core/pim/today/today.cpp +++ b/core/pim/today/today.cpp | |||
@@ -50,6 +50,7 @@ int SHOW_LOCATION; | |||
50 | int SHOW_NOTES; | 50 | int SHOW_NOTES; |
51 | // show only later dates | 51 | // show only later dates |
52 | int ONLY_LATER; | 52 | int ONLY_LATER; |
53 | int AUTOSTART; | ||
53 | /* | 54 | /* |
54 | * Constructs a Example which is a child of 'parent', with the | 55 | * Constructs a Example which is a child of 'parent', with the |
55 | * name 'name' and widget flags set to 'f' | 56 | * name 'name' and widget flags set to 'f' |
@@ -61,10 +62,27 @@ Today::Today( QWidget* parent, const char* name, WFlags fl ) | |||
61 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); | 62 | QObject::connect( (QObject*)DatesButton, SIGNAL( clicked() ), this, SLOT(startDatebook() ) ); |
62 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); | 63 | QObject::connect( (QObject*)MailButton, SIGNAL( clicked() ), this, SLOT(startMail() ) ); |
63 | 64 | ||
65 | |||
66 | autoStart(); | ||
64 | draw(); | 67 | draw(); |
65 | } | 68 | } |
66 | 69 | ||
67 | 70 | ||
71 | void Today::autoStart() { | ||
72 | Config cfg("today"); | ||
73 | cfg.setGroup("Autostart"); | ||
74 | AUTOSTART = cfg.readNumEntry("autostart",1); | ||
75 | if (AUTOSTART) { | ||
76 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); | ||
77 | e << QString("add"); | ||
78 | e << QString("today"); | ||
79 | } else { | ||
80 | QCopEnvelope e("QPE/System", "autoStart(QString,QString)"); | ||
81 | e << QString("remove"); | ||
82 | e << QString("today"); | ||
83 | } | ||
84 | } | ||
85 | |||
68 | void Today::draw() { | 86 | void Today::draw() { |
69 | init(); | 87 | init(); |
70 | getDates(); | 88 | getDates(); |
@@ -76,9 +94,9 @@ void Today::draw() { | |||
76 | 94 | ||
77 | void Today::init() { | 95 | void Today::init() { |
78 | QDate date = QDate::currentDate(); | 96 | QDate date = QDate::currentDate(); |
79 | QString time = (date.toString()); | 97 | QString time = (tr( date.toString() ), white); |
80 | 98 | ||
81 | TextLabel1->setText("<qt><font color=white>" +time + "<font></qt>"); | 99 | TextLabel1->setText(time); |
82 | db = new DateBookDB; | 100 | db = new DateBookDB; |
83 | 101 | ||
84 | // read config | 102 | // read config |
@@ -123,6 +141,8 @@ void Today::startConfig() { | |||
123 | // only later | 141 | // only later |
124 | conf->CheckBox3->setChecked(ONLY_LATER); | 142 | conf->CheckBox3->setChecked(ONLY_LATER); |
125 | 143 | ||
144 | conf->CheckBoxAuto->setChecked(AUTOSTART); | ||
145 | |||
126 | conf->exec(); | 146 | conf->exec(); |
127 | 147 | ||
128 | int maxlinestask = conf->SpinBox2->value(); | 148 | int maxlinestask = conf->SpinBox2->value(); |
@@ -131,6 +151,7 @@ void Today::startConfig() { | |||
131 | int notes = conf->CheckBox2->isChecked(); | 151 | int notes = conf->CheckBox2->isChecked(); |
132 | int maxcharclip = conf->SpinBox7->value(); | 152 | int maxcharclip = conf->SpinBox7->value(); |
133 | int onlylater = conf->CheckBox3->isChecked(); | 153 | int onlylater = conf->CheckBox3->isChecked(); |
154 | int autostart =conf->CheckBoxAuto->isChecked(); | ||
134 | 155 | ||
135 | cfg.writeEntry("maxlinestask",maxlinestask); | 156 | cfg.writeEntry("maxlinestask",maxlinestask); |
136 | cfg.writeEntry("maxcharclip", maxcharclip); | 157 | cfg.writeEntry("maxcharclip", maxcharclip); |
@@ -138,9 +159,11 @@ void Today::startConfig() { | |||
138 | cfg.writeEntry("showlocation",location); | 159 | cfg.writeEntry("showlocation",location); |
139 | cfg.writeEntry("shownotes", notes); | 160 | cfg.writeEntry("shownotes", notes); |
140 | cfg.writeEntry("onlylater", onlylater); | 161 | cfg.writeEntry("onlylater", onlylater); |
162 | cfg.setGroup("Autostart"); | ||
163 | cfg.writeEntry("autostart", autostart); | ||
141 | // sync it to "disk" | 164 | // sync it to "disk" |
142 | cfg.write(); | 165 | cfg.write(); |
143 | 166 | autoStart(); | |
144 | draw(); | 167 | draw(); |
145 | } | 168 | } |
146 | 169 | ||
@@ -224,7 +247,7 @@ void Today::getDates() { | |||
224 | } | 247 | } |
225 | } | 248 | } |
226 | if (msg.isEmpty()) { | 249 | if (msg.isEmpty()) { |
227 | msg = "No more appointments today"; | 250 | msg = tr("No more appointments today"); |
228 | } | 251 | } |
229 | DatesField->setText(msg); | 252 | DatesField->setText(msg); |
230 | } | 253 | } |
@@ -340,16 +363,16 @@ void Today::getTodo() { | |||
340 | 363 | ||
341 | if (count > 0) { | 364 | if (count > 0) { |
342 | if( count == 1 ) { | 365 | if( count == 1 ) { |
343 | output = QString("There is <b> 1</b> active task: <br>" ); | 366 | output = tr("There is <b> 1</b> active task: <br>" ); |
344 | } else { | 367 | } else { |
345 | output = QString("There are <b> %1</b> active tasks: <br>").arg(count); | 368 | output = tr("There are <b> %1</b> active tasks: <br>").arg(count); |
346 | } | 369 | } |
347 | output += tmpout; | 370 | output += tmpout; |
348 | } else { | 371 | } else { |
349 | output = ("No active tasks"); | 372 | output = tr("No active tasks"); |
350 | } | 373 | } |
351 | 374 | ||
352 | TodoField->setText(output); | 375 | TodoField->setText(tr(output)); |
353 | } | 376 | } |
354 | 377 | ||
355 | /* | 378 | /* |