Diffstat (limited to 'libopie2/opiepim/ui/opimmainwindow.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | libopie2/opiepim/ui/opimmainwindow.cpp | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/libopie2/opiepim/ui/opimmainwindow.cpp b/libopie2/opiepim/ui/opimmainwindow.cpp index d1eec19..4044bc1 100644 --- a/libopie2/opiepim/ui/opimmainwindow.cpp +++ b/libopie2/opiepim/ui/opimmainwindow.cpp | |||
@@ -1,4 +1,6 @@ | |||
1 | #include <qapplication.h> | 1 | #include <qapplication.h> |
2 | #include <qdatetime.h> | ||
2 | #include <qcopchannel_qws.h> | 3 | #include <qcopchannel_qws.h> |
3 | 4 | ||
5 | #include <qpe/sound.h> | ||
4 | #include <qpe/qcopenvelope_qws.h> | 6 | #include <qpe/qcopenvelope_qws.h> |
@@ -19,2 +21,4 @@ OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, | |||
19 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | 21 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); |
22 | connect(qApp, SIGNAL(appMessage(const QCString&, const QByteArray& ) ), | ||
23 | this, SLOT( appMessage( const QCString&, const QByteArray& ) ) ); | ||
20 | 24 | ||
@@ -52,3 +56,3 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) | |||
52 | }else if ( cmd == "beam(int)" ) { | 56 | }else if ( cmd == "beam(int)" ) { |
53 | int uid, trans; | 57 | int uid; |
54 | stream >> uid; | 58 | stream >> uid; |
@@ -72,2 +76,12 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) | |||
72 | delete m_fallBack; | 76 | delete m_fallBack; |
77 | }else if ( cmd == "alarm(QDateTime,int)" ) { | ||
78 | QDateTime dt; int uid; | ||
79 | stream >> dt; | ||
80 | stream >> uid; | ||
81 | qWarning(" Date: %s Uid: %d", dt.toString().latin1(), uid ); | ||
82 | QDateTime current = QDateTime::currentDateTime(); | ||
83 | if ( current.time().hour() != dt.time().hour() && current.time().minute() != dt.time().minute() ) | ||
84 | return; | ||
85 | doAlarm( dt, uid ); | ||
86 | |||
73 | } | 87 | } |
@@ -104 +118,21 @@ int OPimMainWindow::service() { | |||
104 | } | 118 | } |
119 | void OPimMainWindow::doAlarm( const QDateTime&, int ) { | ||
120 | |||
121 | } | ||
122 | void OPimMainWindow::startAlarm(int count ) { | ||
123 | m_alarmCount = count; | ||
124 | m_playedCount = 0; | ||
125 | Sound::soundAlarm(); | ||
126 | m_timerId = startTimer( 5000 ); | ||
127 | } | ||
128 | void OPimMainWindow::killAlarm() { | ||
129 | killTimer( m_timerId ); | ||
130 | } | ||
131 | void OPimMainWindow::timerEvent( QTimerEvent* e) { | ||
132 | if ( m_playedCount <m_alarmCount ) { | ||
133 | m_playedCount++; | ||
134 | Sound::soundAlarm(); | ||
135 | }else { | ||
136 | killTimer( e->timerId() ); | ||
137 | } | ||
138 | } | ||