summaryrefslogtreecommitdiff
path: root/library/alarmserver.cpp
Unidiff
Diffstat (limited to 'library/alarmserver.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--library/alarmserver.cpp5
1 files changed, 0 insertions, 5 deletions
diff --git a/library/alarmserver.cpp b/library/alarmserver.cpp
index 6f6f32d..48ab9c1 100644
--- a/library/alarmserver.cpp
+++ b/library/alarmserver.cpp
@@ -1,93 +1,88 @@
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>
23#include <qmessagebox.h>
24#include <qtextstream.h>
25 22
26 23
27#include <qpe/qpeapplication.h> 24#include <qpe/qpeapplication.h>
28#include "global.h"
29#include "resource.h"
30 25
31#include <qpe/qcopenvelope_qws.h> 26#include <qpe/qcopenvelope_qws.h>
32#include "alarmserver.h" 27#include "alarmserver.h"
33#include <qpe/timeconversion.h> 28#include <qpe/timeconversion.h>
34 29
35#include <sys/types.h> 30#include <sys/types.h>
36#include <sys/stat.h> 31#include <sys/stat.h>
37 32
38#include <stdlib.h> 33#include <stdlib.h>
39#include <unistd.h> 34#include <unistd.h>
40 35
41 36
42#undef USE_ATD // not used anymore -- we run opie-alarm on suspend/resume 37#undef USE_ATD // not used anymore -- we run opie-alarm on suspend/resume
43 38
44 39
45struct timerEventItem 40struct timerEventItem
46{ 41{
47 time_t UTCtime; 42 time_t UTCtime;
48 QCString channel, message; 43 QCString channel, message;
49 int data; 44 int data;
50 bool operator==( const timerEventItem &right ) const 45 bool operator==( const timerEventItem &right ) const
51 { 46 {
52 return ( UTCtime == right.UTCtime 47 return ( UTCtime == right.UTCtime
53 && channel == right.channel 48 && channel == right.channel
54 && message == right.message 49 && message == right.message
55 && data == right.data ); 50 && data == right.data );
56 } 51 }
57}; 52};
58 53
59class TimerReceiverObject : public QObject 54class TimerReceiverObject : public QObject
60{ 55{
61public: 56public:
62 TimerReceiverObject() 57 TimerReceiverObject()
63 { } 58 { }
64 ~TimerReceiverObject() 59 ~TimerReceiverObject()
65 { } 60 { }
66 void resetTimer(); 61 void resetTimer();
67 void setTimerEventItem(); 62 void setTimerEventItem();
68 void deleteTimer(); 63 void deleteTimer();
69protected: 64protected:
70 void timerEvent( QTimerEvent *te ); 65 void timerEvent( QTimerEvent *te );
71 66
72#ifdef USE_ATD 67#ifdef USE_ATD
73private: 68private:
74 QString atfilename; 69 QString atfilename;
75#endif 70#endif
76}; 71};
77 72
78TimerReceiverObject *timerEventReceiver = NULL; 73TimerReceiverObject *timerEventReceiver = NULL;
79QList<timerEventItem> timerEventList; 74QList<timerEventItem> timerEventList;
80timerEventItem *nearestTimerEvent = NULL; 75timerEventItem *nearestTimerEvent = NULL;
81 76
82 77
83// set the timer to go off on the next event in the list 78// set the timer to go off on the next event in the list
84void setNearestTimerEvent() 79void setNearestTimerEvent()
85{ 80{
86 nearestTimerEvent = NULL; 81 nearestTimerEvent = NULL;
87 QListIterator<timerEventItem> it( timerEventList ); 82 QListIterator<timerEventItem> it( timerEventList );
88 if ( *it ) 83 if ( *it )
89 nearestTimerEvent = *it; 84 nearestTimerEvent = *it;
90 for ( ; *it; ++it ) 85 for ( ; *it; ++it )
91 if ( (*it)->UTCtime < nearestTimerEvent->UTCtime ) 86 if ( (*it)->UTCtime < nearestTimerEvent->UTCtime )
92 nearestTimerEvent = *it; 87 nearestTimerEvent = *it;
93 if (nearestTimerEvent) 88 if (nearestTimerEvent)