summaryrefslogtreecommitdiff
path: root/noncore/tools
authorllornkcor <llornkcor>2002-05-31 13:00:05 (UTC)
committer llornkcor <llornkcor>2002-05-31 13:00:05 (UTC)
commit075f2ae74f328581ec0db05d633961f3baa5ed36 (patch) (unidiff)
tree370eb2838813a9fa2aaf47e32f6e711dd2a8f36e /noncore/tools
parentdd08e7fa2ccbcc0489c17ed305b20a9a7d187161 (diff)
downloadopie-075f2ae74f328581ec0db05d633961f3baa5ed36.zip
opie-075f2ae74f328581ec0db05d633961f3baa5ed36.tar.gz
opie-075f2ae74f328581ec0db05d633961f3baa5ed36.tar.bz2
added clock to popup if closed before app gets alarm message
Diffstat (limited to 'noncore/tools') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/tools/clock/clock.cpp11
-rw-r--r--noncore/tools/clock/clock.h1
2 files changed, 9 insertions, 3 deletions
diff --git a/noncore/tools/clock/clock.cpp b/noncore/tools/clock/clock.cpp
index 0a21146..9b9e644 100644
--- a/noncore/tools/clock/clock.cpp
+++ b/noncore/tools/clock/clock.cpp
@@ -14,12 +14,13 @@
14** See http://www.trolltech.com/gpl/ for GPL licensing information. 14** See http://www.trolltech.com/gpl/ for GPL licensing information.
15** 15**
16** Contact info@trolltech.com if any conditions of this licensing are 16** Contact info@trolltech.com if any conditions of this licensing are
17** not clear to you. 17** not clear to you.
18** 18**
19**********************************************************************/ 19**********************************************************************/
20// changes added and Copyright (C) by L. J. Potter <ljp@llornkcor.com> 2002
20 21
21#include "clock.h" 22#include "clock.h"
22#include "setAlarm.h" 23#include "setAlarm.h"
23 24
24#include <qpe/qpeapplication.h> 25#include <qpe/qpeapplication.h>
25#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
@@ -63,12 +64,13 @@ Clock::Clock( QWidget * parent, const char * name, WFlags f )
63 setMargin( 1 ); 64 setMargin( 1 );
64 65
65 Config config( "qpe" ); 66 Config config( "qpe" );
66 config.setGroup("Time"); 67 config.setGroup("Time");
67 ampm = config.readBoolEntry( "AMPM", TRUE ); 68 ampm = config.readBoolEntry( "AMPM", TRUE );
68 69
70
69 snoozeBtn = new QPushButton ( this); 71 snoozeBtn = new QPushButton ( this);
70 snoozeBtn->setText( tr( "Snooze" ) ); 72 snoozeBtn->setText( tr( "Snooze" ) );
71 73
72 aclock = new AnalogClock( this ); 74 aclock = new AnalogClock( this );
73 aclock->display( QTime::currentTime() ); 75 aclock->display( QTime::currentTime() );
74 aclock->setLineWidth( 2 ); 76 aclock->setLineWidth( 2 );
@@ -377,16 +379,21 @@ void Clock::alarmOff()
377 379
378void Clock::appMessage(const QCString& msg, const QByteArray& data) 380void Clock::appMessage(const QCString& msg, const QByteArray& data)
379{ 381{
380 int stopTimer = 0; 382 int stopTimer = 0;
381 int timerStay = 5000; 383 int timerStay = 5000;
382 bSound=TRUE; 384 bSound=TRUE;
385 qDebug("Message received in clock");
383 if ( msg == "alarm(QDateTime,int)" ) { 386 if ( msg == "alarm(QDateTime,int)" ) {
384 Sound::soundAlarm(); 387 Sound::soundAlarm();
385 stopTimer = startTimer( timerStay); 388 stopTimer = startTimer( timerStay);
386 } 389 }
390 show();
391 raise();
392 QPEApplication::setKeepRunning();
393 setActiveWindow();
387} 394}
388 395
389void Clock::timerEvent( QTimerEvent *e ) 396void Clock::timerEvent( QTimerEvent *e )
390{ 397{
391 static int stop = 0; 398 static int stop = 0;
392 if ( stop < 120 && bSound) { 399 if ( stop < 120 && bSound) {
@@ -482,11 +489,11 @@ QPoint AnalogClock::rotate( QPoint c, QPoint p, int a )
482 double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) - 489 double nx = c.x() - ( p.x() - c.x() ) * cos( angle ) -
483 ( p.y() - c.y() ) * sin( angle ); 490 ( p.y() - c.y() ) * sin( angle );
484 double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) + 491 double ny = c.y() - ( p.y() - c.y() ) * cos( angle ) +
485 ( p.x() - c.x() ) * sin( angle ); 492 ( p.x() - c.x() ) * sin( angle );
486 return QPoint( nx, ny ); 493 return QPoint( nx, ny );
487} 494}
488void Clock::slotAdjustTime() 495
489{ 496void Clock::slotAdjustTime() {
490 QCopEnvelope e("QPE/System", "execute(QString)"); 497 QCopEnvelope e("QPE/System", "execute(QString)");
491 e << QString("systemtime"); 498 e << QString("systemtime");
492} 499}
diff --git a/noncore/tools/clock/clock.h b/noncore/tools/clock/clock.h
index 024dd28..be71b9d 100644
--- a/noncore/tools/clock/clock.h
+++ b/noncore/tools/clock/clock.h
@@ -74,13 +74,12 @@ private slots:
74 void slotToggleAlarm(); 74 void slotToggleAlarm();
75 void alarmOn(); 75 void alarmOn();
76 void alarmOff(); 76 void alarmOff();
77 void appMessage(const QCString& msg, const QByteArray& data); 77 void appMessage(const QCString& msg, const QByteArray& data);
78 void timerEvent( QTimerEvent *e ); 78 void timerEvent( QTimerEvent *e );
79 void slotAdjustTime(); 79 void slotAdjustTime();
80
81private: 80private:
82 void clearClock(); 81 void clearClock();
83 82
84 bool alarmBool; 83 bool alarmBool;
85 QTimer *t; 84 QTimer *t;
86 QLCDNumber *lcd; 85 QLCDNumber *lcd;