Diffstat (limited to 'libopie2/opiepim/ui/opimmainwindow.cpp') (more/less context) (ignore 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,9 +1,11 @@ | |||
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> |
5 | 7 | ||
6 | #include "opimresolver.h" | 8 | #include "opimresolver.h" |
7 | #include "opimmainwindow.h" | 9 | #include "opimmainwindow.h" |
8 | 10 | ||
9 | OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, | 11 | OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, |
@@ -14,12 +16,14 @@ OPimMainWindow::OPimMainWindow( const QString& service, QWidget* parent, | |||
14 | * let's generate our QCopChannel | 16 | * let's generate our QCopChannel |
15 | */ | 17 | */ |
16 | m_str = QString("QPE/"+m_service).local8Bit(); | 18 | m_str = QString("QPE/"+m_service).local8Bit(); |
17 | m_channel= new QCopChannel(m_str, this ); | 19 | m_channel= new QCopChannel(m_str, this ); |
18 | connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), | 20 | connect(m_channel, SIGNAL(received(const QCString&, const QByteArray& ) ), |
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 | ||
21 | /* connect flush and reload */ | 25 | /* connect flush and reload */ |
22 | connect(qApp, SIGNAL(flush() ), | 26 | connect(qApp, SIGNAL(flush() ), |
23 | this, SLOT(flush() ) ); | 27 | this, SLOT(flush() ) ); |
24 | connect(qApp, SIGNAL(reload() ), | 28 | connect(qApp, SIGNAL(reload() ), |
25 | this, SLOT(reload() ) ); | 29 | this, SLOT(reload() ) ); |
@@ -47,13 +51,13 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) | |||
47 | int uid; | 51 | int uid; |
48 | stream >> uid; | 52 | stream >> uid; |
49 | bool rem = remove( uid ); | 53 | bool rem = remove( uid ); |
50 | QCopEnvelope e(m_str, "removed(bool)" ); | 54 | QCopEnvelope e(m_str, "removed(bool)" ); |
51 | e << rem; | 55 | e << rem; |
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; |
55 | beam( uid); | 59 | beam( uid); |
56 | }else if ( cmd == "show(int)" ) { | 60 | }else if ( cmd == "show(int)" ) { |
57 | int uid; | 61 | int uid; |
58 | stream >> uid; | 62 | stream >> uid; |
59 | show( uid ); | 63 | show( uid ); |
@@ -67,12 +71,22 @@ void OPimMainWindow::appMessage( const QCString& cmd, const QByteArray& array ) | |||
67 | stream >> rtti; | 71 | stream >> rtti; |
68 | stream >> array; | 72 | stream >> array; |
69 | m_fallBack = record(rtti, array ); | 73 | m_fallBack = record(rtti, array ); |
70 | if (!m_fallBack) return; | 74 | if (!m_fallBack) return; |
71 | add( *m_fallBack ); | 75 | add( *m_fallBack ); |
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 | } |
74 | } | 88 | } |
75 | /* implement the url scripting here */ | 89 | /* implement the url scripting here */ |
76 | void OPimMainWindow::setDocument( const QString& str) { | 90 | void OPimMainWindow::setDocument( const QString& str) { |
77 | doSetDocument( str ); | 91 | doSetDocument( str ); |
78 | } | 92 | } |
@@ -99,6 +113,26 @@ OPimRecord* OPimMainWindow::record( int rtti, const QByteArray& array ) { | |||
99 | int OPimMainWindow::service() { | 113 | int OPimMainWindow::service() { |
100 | if ( m_rtti == -1 ) | 114 | if ( m_rtti == -1 ) |
101 | m_rtti = OPimResolver::self()->serviceId( m_service ); | 115 | m_rtti = OPimResolver::self()->serviceId( m_service ); |
102 | 116 | ||
103 | return m_rtti; | 117 | return m_rtti; |
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 | } | ||