-rw-r--r-- | library/alarmserver.cpp | 23 | ||||
-rw-r--r-- | library/global.cpp | 6 |
2 files changed, 17 insertions, 12 deletions
diff --git a/library/alarmserver.cpp b/library/alarmserver.cpp index 2ea4025..a75fc7e 100644 --- a/library/alarmserver.cpp +++ b/library/alarmserver.cpp | |||
@@ -295,49 +295,49 @@ void TimerReceiverObject::timerEvent( QTimerEvent * ) | |||
295 | setNearestTimerEvent(); | 295 | setNearestTimerEvent(); |
296 | } | 296 | } |
297 | else { | 297 | else { |
298 | resetTimer(); | 298 | resetTimer(); |
299 | } | 299 | } |
300 | if ( needSave ) | 300 | if ( needSave ) |
301 | saveState(); | 301 | saveState(); |
302 | } | 302 | } |
303 | 303 | ||
304 | /*! | 304 | /*! |
305 | \class AlarmServer alarmserver.h | 305 | \class AlarmServer alarmserver.h |
306 | \brief The AlarmServer class allows alarms to be scheduled and unscheduled. | 306 | \brief The AlarmServer class allows alarms to be scheduled and unscheduled. |
307 | 307 | ||
308 | Applications can schedule alarms with addAlarm() and can | 308 | Applications can schedule alarms with addAlarm() and can |
309 | unschedule alarms with deleteAlarm(). When the time for an alarm | 309 | unschedule alarms with deleteAlarm(). When the time for an alarm |
310 | to go off is reached the specified \link qcop.html QCop\endlink | 310 | to go off is reached the specified \link qcop.html QCop\endlink |
311 | message is sent on the specified channel (optionally with | 311 | message is sent on the specified channel (optionally with |
312 | additional data). | 312 | additional data). |
313 | 313 | ||
314 | Scheduling an alarm using this class is important (rather just using | 314 | Scheduling an alarm using this class is important (rather just using |
315 | a QTimer) since the machine may be asleep and needs to get woken up using | 315 | a QTimer) since the machine may be asleep and needs to get woken up using |
316 | the Linux kernel which implements this at the kernel level to minimize | 316 | the Linux kernel which implements this at the kernel level to minimize |
317 | battery usage while asleep. | 317 | battery usage while asleep. |
318 | 318 | ||
319 | \ingroup qtopiaemb | 319 | \ingroup qtopiaemb |
320 | \sa QCopEnvelope | 320 | \sa QCopEnvelope |
321 | */ | 321 | */ |
322 | 322 | ||
323 | /*! | 323 | /*! |
324 | Schedules an alarm to go off at (or soon after) time \a when. When | 324 | Schedules an alarm to go off at (or soon after) time \a when. When |
325 | the alarm goes off, the \link qcop.html QCop\endlink \a message will | 325 | the alarm goes off, the \link qcop.html QCop\endlink \a message will |
326 | be sent to \a channel, with \a data as a parameter. | 326 | be sent to \a channel, with \a data as a parameter. |
327 | 327 | ||
328 | If this function is called with exactly the same data as a previous | 328 | If this function is called with exactly the same data as a previous |
329 | call the subsequent call is ignored, so there is only ever one alarm | 329 | call the subsequent call is ignored, so there is only ever one alarm |
330 | with a given set of parameters. | 330 | with a given set of parameters. |
331 | 331 | ||
332 | \sa deleteAlarm() | 332 | \sa deleteAlarm() |
333 | */ | 333 | */ |
334 | void AlarmServer::addAlarm ( QDateTime when, const QCString& channel, | 334 | void AlarmServer::addAlarm ( QDateTime when, const QCString& channel, |
335 | const QCString& message, int data) | 335 | const QCString& message, int data) |
336 | { | 336 | { |
337 | if ( qApp->type() == QApplication::GuiServer ) { | 337 | if ( qApp->type() == QApplication::GuiServer ) { |
338 | bool needSave = FALSE; | 338 | bool needSave = FALSE; |
339 | // Here we are the server so either it has been directly called from | 339 | // Here we are the server so either it has been directly called from |
340 | // within the server or it has been sent to us from a client via QCop | 340 | // within the server or it has been sent to us from a client via QCop |
341 | if (!timerEventReceiver) | 341 | if (!timerEventReceiver) |
342 | timerEventReceiver = new TimerReceiverObject; | 342 | timerEventReceiver = new TimerReceiverObject; |
343 | 343 | ||
@@ -372,33 +372,33 @@ void AlarmServer::addAlarm ( QDateTime when, const QCString& channel, | |||
372 | else { | 372 | else { |
373 | #ifndef QT_NO_COP | 373 | #ifndef QT_NO_COP |
374 | QCopEnvelope e( "QPE/System", "addAlarm(QDateTime,QCString,QCString,int)" ); | 374 | QCopEnvelope e( "QPE/System", "addAlarm(QDateTime,QCString,QCString,int)" ); |
375 | e << when << channel << message << data; | 375 | e << when << channel << message << data; |
376 | #endif | 376 | #endif |
377 | 377 | ||
378 | } | 378 | } |
379 | } | 379 | } |
380 | 380 | ||
381 | /*! | 381 | /*! |
382 | Deletes previously scheduled alarms which match \a when, \a channel, | 382 | Deletes previously scheduled alarms which match \a when, \a channel, |
383 | \a message, and \a data. | 383 | \a message, and \a data. |
384 | 384 | ||
385 | Passing null values for \a when, \a channel, or for the \link | 385 | Passing null values for \a when, \a channel, or for the \link |
386 | qcop.html QCop\endlink \a message, acts as a wildcard meaning "any". | 386 | qcop.html QCop\endlink \a message, acts as a wildcard meaning "any". |
387 | Similarly, passing -1 for \a data indicates "any". | 387 | Similarly, passing -1 for \a data indicates "any". |
388 | 388 | ||
389 | If there is no matching alarm, nothing happens. | 389 | If there is no matching alarm, nothing happens. |
390 | 390 | ||
391 | \sa addAlarm() | 391 | \sa addAlarm() |
392 | 392 | ||
393 | */ | 393 | */ |
394 | void AlarmServer::deleteAlarm (QDateTime when, const QCString& channel, const QCString& message, int data) | 394 | void AlarmServer::deleteAlarm (QDateTime when, const QCString& channel, const QCString& message, int data) |
395 | { | 395 | { |
396 | if ( qApp->type() == QApplication::GuiServer) { | 396 | if ( qApp->type() == QApplication::GuiServer) { |
397 | bool needSave = FALSE; | 397 | bool needSave = FALSE; |
398 | if ( timerEventReceiver != NULL ) { | 398 | if ( timerEventReceiver != NULL ) { |
399 | timerEventReceiver->killTimers(); | 399 | timerEventReceiver->killTimers(); |
400 | 400 | ||
401 | // iterate over the list of events | 401 | // iterate over the list of events |
402 | QListIterator<timerEventItem> it( timerEventList ); | 402 | QListIterator<timerEventItem> it( timerEventList ); |
403 | time_t deleteTime = TimeConversion::toUTC( when ); | 403 | time_t deleteTime = TimeConversion::toUTC( when ); |
404 | for ( ; *it; ++it ) { | 404 | for ( ; *it; ++it ) { |
@@ -425,25 +425,28 @@ void AlarmServer::deleteAlarm (QDateTime when, const QCString& channel, const QC | |||
425 | saveState(); | 425 | saveState(); |
426 | } | 426 | } |
427 | else { | 427 | else { |
428 | #ifndef QT_NO_COP | 428 | #ifndef QT_NO_COP |
429 | QCopEnvelope e( "QPE/System", "deleteAlarm(QDateTime,QCString,QCString,int)" ); | 429 | QCopEnvelope e( "QPE/System", "deleteAlarm(QDateTime,QCString,QCString,int)" ); |
430 | e << when << channel << message << data; | 430 | e << when << channel << message << data; |
431 | #endif | 431 | #endif |
432 | 432 | ||
433 | } | 433 | } |
434 | } | 434 | } |
435 | 435 | ||
436 | /*! | 436 | /*! |
437 | Writes the system clock to the hardware clock. | 437 | The implementation depends on the mode of AlarmServer. If the AlarmServer |
438 | uses atd the current system time will be written to the hardware clock. | ||
439 | If the AlarmServer relies on opie-alarm the time will be written once the | ||
440 | device gets suspended. opie-alarm is used by the Zaurus, iPAQs and SIMpad | ||
438 | */ | 441 | */ |
439 | void Global::writeHWClock() | 442 | void Global::writeHWClock() |
440 | { | 443 | { |
441 | #ifdef USE_ATD | 444 | #ifdef USE_ATD |
442 | if ( !triggerAtd( TRUE ) ) { | 445 | if ( !triggerAtd( TRUE ) ) { |
443 | // atd not running? set it ourselves | 446 | // atd not running? set it ourselves |
444 | system("/sbin/hwclock --systohc"); // ##### UTC? | 447 | system("/sbin/hwclock --systohc"); // ##### UTC? |
445 | } | 448 | } |
446 | #else | 449 | #else |
447 | // hwclock is written on suspend | 450 | // hwclock is written on suspend |
448 | #endif | 451 | #endif |
449 | } | 452 | } |
diff --git a/library/global.cpp b/library/global.cpp index 5c89430..90954fe 100644 --- a/library/global.cpp +++ b/library/global.cpp | |||
@@ -204,26 +204,28 @@ static QString dictDir() | |||
204 | which are returned by dawg(). Use addWords() to add words to the | 204 | which are returned by dawg(). Use addWords() to add words to the |
205 | updateable copy of the global QDawg or to named application | 205 | updateable copy of the global QDawg or to named application |
206 | \l{QDawg}s. | 206 | \l{QDawg}s. |
207 | 207 | ||
208 | \section1 Quoting | 208 | \section1 Quoting |
209 | 209 | ||
210 | The shellQuote() function quotes a string suitable for passing to a | 210 | The shellQuote() function quotes a string suitable for passing to a |
211 | shell. The stringQuote() function backslash escapes '\' and '"' | 211 | shell. The stringQuote() function backslash escapes '\' and '"' |
212 | characters. | 212 | characters. |
213 | 213 | ||
214 | \section1 Hardware | 214 | \section1 Hardware |
215 | 215 | ||
216 | The writeHWClock() function sets the hardware clock to the system | 216 | The implementation of the writeHWClock() function depends on the AlarmServer |
217 | clock's date and time. | 217 | implementation. If the AlarmServer is using atd the clock will be synced to |
218 | hardware. If opie-alarm is used the hardware clock will be synced before | ||
219 | suspending the device. opie-alarm is used by iPAQ and Zaurii implementation | ||
218 | 220 | ||
219 | \ingroup qtopiaemb | 221 | \ingroup qtopiaemb |
220 | */ | 222 | */ |
221 | 223 | ||
222 | /*! | 224 | /*! |
223 | \internal | 225 | \internal |
224 | */ | 226 | */ |
225 | Global::Global() | 227 | Global::Global() |
226 | { | 228 | { |
227 | } | 229 | } |
228 | 230 | ||
229 | /*! | 231 | /*! |