-rw-r--r-- | library/alarmserver.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/library/alarmserver.cpp b/library/alarmserver.cpp index 1ee05c6..177a0cb 100644 --- a/library/alarmserver.cpp +++ b/library/alarmserver.cpp | |||
@@ -1,96 +1,96 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000-2002 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of the Qtopia Environment. | 4 | ** This file is part of the Qtopia Environment. |
5 | ** | 5 | ** |
6 | ** This file may be distributed and/or modified under the terms of the | 6 | ** This file may be distributed and/or modified under the terms of the |
7 | ** GNU General Public License version 2 as published by the Free Software | 7 | ** GNU General Public License version 2 as published by the Free Software |
8 | ** Foundation and appearing in the file LICENSE.GPL included in the | 8 | ** Foundation and appearing in the file LICENSE.GPL included in the |
9 | ** packaging of this file. | 9 | ** packaging of this file. |
10 | ** | 10 | ** |
11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE | 11 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE |
12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. | 12 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. |
13 | ** | 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 | 20 | ||
21 | #include <qdir.h> | 21 | #include <qdir.h> |
22 | #include <qfile.h> | 22 | #include <qfile.h> |
23 | #include <qmessagebox.h> | 23 | #include <qmessagebox.h> |
24 | #include <qtextstream.h> | 24 | #include <qtextstream.h> |
25 | 25 | ||
26 | 26 | ||
27 | #include "qpeapplication.h" | 27 | #include <qpe/qpeapplication.h> |
28 | #include "global.h" | 28 | #include "global.h" |
29 | #include "resource.h" | 29 | #include "resource.h" |
30 | 30 | ||
31 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) | 31 | #if defined(Q_WS_QWS) && !defined(QT_NO_COP) |
32 | #include "qcopenvelope_qws.h" | 32 | #include <qpe/qcopenvelope_qws.h> |
33 | #endif | 33 | #endif |
34 | #include "alarmserver.h" | 34 | #include "alarmserver.h" |
35 | #include <qpe/timeconversion.h> | 35 | #include <qpe/timeconversion.h> |
36 | 36 | ||
37 | #include <sys/types.h> | 37 | #include <sys/types.h> |
38 | #include <sys/stat.h> | 38 | #include <sys/stat.h> |
39 | 39 | ||
40 | #include <stdlib.h> | 40 | #include <stdlib.h> |
41 | #include <unistd.h> | 41 | #include <unistd.h> |
42 | 42 | ||
43 | struct timerEventItem { | 43 | struct timerEventItem { |
44 | time_t UTCtime; | 44 | time_t UTCtime; |
45 | QCString channel, message; | 45 | QCString channel, message; |
46 | int data; | 46 | int data; |
47 | bool operator==( const timerEventItem &right ) const | 47 | bool operator==( const timerEventItem &right ) const |
48 | { | 48 | { |
49 | return ( UTCtime == right.UTCtime | 49 | return ( UTCtime == right.UTCtime |
50 | && channel == right.channel | 50 | && channel == right.channel |
51 | && message == right.message | 51 | && message == right.message |
52 | && data == right.data ); | 52 | && data == right.data ); |
53 | } | 53 | } |
54 | }; | 54 | }; |
55 | 55 | ||
56 | class TimerReceiverObject : public QObject | 56 | class TimerReceiverObject : public QObject |
57 | { | 57 | { |
58 | public: | 58 | public: |
59 | TimerReceiverObject() { } | 59 | TimerReceiverObject() { } |
60 | ~TimerReceiverObject() { } | 60 | ~TimerReceiverObject() { } |
61 | void resetTimer(); | 61 | void resetTimer(); |
62 | void setTimerEventItem(); | 62 | void setTimerEventItem(); |
63 | void deleteTimer(); | 63 | void deleteTimer(); |
64 | protected: | 64 | protected: |
65 | void timerEvent( QTimerEvent *te ); | 65 | void timerEvent( QTimerEvent *te ); |
66 | private: | 66 | private: |
67 | QString atfilename; | 67 | QString atfilename; |
68 | }; | 68 | }; |
69 | 69 | ||
70 | TimerReceiverObject *timerEventReceiver = NULL; | 70 | TimerReceiverObject *timerEventReceiver = NULL; |
71 | QList<timerEventItem> timerEventList; | 71 | QList<timerEventItem> timerEventList; |
72 | timerEventItem *nearestTimerEvent = NULL; | 72 | timerEventItem *nearestTimerEvent = NULL; |
73 | 73 | ||
74 | 74 | ||
75 | // set the timer to go off on the next event in the list | 75 | // set the timer to go off on the next event in the list |
76 | void setNearestTimerEvent() | 76 | void setNearestTimerEvent() |
77 | { | 77 | { |
78 | nearestTimerEvent = NULL; | 78 | nearestTimerEvent = NULL; |
79 | QListIterator<timerEventItem> it( timerEventList ); | 79 | QListIterator<timerEventItem> it( timerEventList ); |
80 | if ( *it ) | 80 | if ( *it ) |
81 | nearestTimerEvent = *it; | 81 | nearestTimerEvent = *it; |
82 | for ( ; *it; ++it ) | 82 | for ( ; *it; ++it ) |
83 | if ( (*it)->UTCtime < nearestTimerEvent->UTCtime ) | 83 | if ( (*it)->UTCtime < nearestTimerEvent->UTCtime ) |
84 | nearestTimerEvent = *it; | 84 | nearestTimerEvent = *it; |
85 | if (nearestTimerEvent) | 85 | if (nearestTimerEvent) |
86 | timerEventReceiver->resetTimer(); | 86 | timerEventReceiver->resetTimer(); |
87 | else | 87 | else |
88 | timerEventReceiver->deleteTimer(); | 88 | timerEventReceiver->deleteTimer(); |
89 | } | 89 | } |
90 | 90 | ||
91 | 91 | ||
92 | //store current state to file | 92 | //store current state to file |
93 | //Simple implementation. Should run on a timer. | 93 | //Simple implementation. Should run on a timer. |
94 | 94 | ||
95 | static void saveState() | 95 | static void saveState() |
96 | { | 96 | { |