-rw-r--r-- | library/datebookdb.cpp | 5 |
1 files changed, 0 insertions, 5 deletions
diff --git a/library/datebookdb.cpp b/library/datebookdb.cpp index 188d8e1..e4ec2bf 100644 --- a/library/datebookdb.cpp +++ b/library/datebookdb.cpp | |||
@@ -1,81 +1,76 @@ | |||
1 | /********************************************************************** | 1 | /********************************************************************** |
2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. | 2 | ** Copyright (C) 2000 Trolltech AS. All rights reserved. |
3 | ** | 3 | ** |
4 | ** This file is part of Qtopia Environment. | 4 | ** This file is part of 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 <qasciidict.h> | 21 | #include <qasciidict.h> |
22 | #include <qfile.h> | ||
23 | #include <qmessagebox.h> | 22 | #include <qmessagebox.h> |
24 | #include <qstring.h> | ||
25 | #include <qtextcodec.h> | ||
26 | #include <qtextstream.h> | ||
27 | #include <qtl.h> | 23 | #include <qtl.h> |
28 | 24 | ||
29 | #include <qpe/alarmserver.h> | 25 | #include <qpe/alarmserver.h> |
30 | #include <qpe/global.h> | 26 | #include <qpe/global.h> |
31 | #include "datebookdb.h" | 27 | #include "datebookdb.h" |
32 | #include <qpe/stringutil.h> | 28 | #include <qpe/stringutil.h> |
33 | #include <qpe/timeconversion.h> | ||
34 | 29 | ||
35 | #include <errno.h> | 30 | #include <errno.h> |
36 | #include <stdlib.h> | 31 | #include <stdlib.h> |
37 | 32 | ||
38 | 33 | ||
39 | class DateBookDBPrivate | 34 | class DateBookDBPrivate |
40 | { | 35 | { |
41 | public: | 36 | public: |
42 | bool clean; // indcate whether we need to write to disk... | 37 | bool clean; // indcate whether we need to write to disk... |
43 | }; | 38 | }; |
44 | 39 | ||
45 | 40 | ||
46 | // Helper functions | 41 | // Helper functions |
47 | 42 | ||
48 | static QString dateBookJournalFile() | 43 | static QString dateBookJournalFile() |
49 | { | 44 | { |
50 | QString str = getenv("HOME"); | 45 | QString str = getenv("HOME"); |
51 | return QString( str +"/.caljournal" ); | 46 | return QString( str +"/.caljournal" ); |
52 | } | 47 | } |
53 | 48 | ||
54 | static QString dateBookFilename() | 49 | static QString dateBookFilename() |
55 | { | 50 | { |
56 | return Global::applicationFileName("datebook","datebook.xml"); | 51 | return Global::applicationFileName("datebook","datebook.xml"); |
57 | } | 52 | } |
58 | 53 | ||
59 | /* Calculating the next event of a recuring event is actually | 54 | /* Calculating the next event of a recuring event is actually |
60 | computationally inexpensive, esp. compared to checking each day | 55 | computationally inexpensive, esp. compared to checking each day |
61 | individually. There are bad worse cases for say the 29th of | 56 | individually. There are bad worse cases for say the 29th of |
62 | february or the 31st of some other months. However | 57 | february or the 31st of some other months. However |
63 | these are still bounded */ | 58 | these are still bounded */ |
64 | bool nextOccurance(const Event &e, const QDate &from, QDateTime &next) | 59 | bool nextOccurance(const Event &e, const QDate &from, QDateTime &next) |
65 | { | 60 | { |
66 | // easy checks, first are we too far in the future or too far in the past? | 61 | // easy checks, first are we too far in the future or too far in the past? |
67 | QDate tmpDate; | 62 | QDate tmpDate; |
68 | int freq = e.repeatPattern().frequency; | 63 | int freq = e.repeatPattern().frequency; |
69 | int diff, diff2, a; | 64 | int diff, diff2, a; |
70 | int iday, imonth, iyear; | 65 | int iday, imonth, iyear; |
71 | int dayOfWeek = 0; | 66 | int dayOfWeek = 0; |
72 | int firstOfWeek = 0; | 67 | int firstOfWeek = 0; |
73 | int weekOfMonth; | 68 | int weekOfMonth; |
74 | 69 | ||
75 | 70 | ||
76 | if (e.repeatPattern().hasEndDate && e.repeatPattern().endDate() < from) | 71 | if (e.repeatPattern().hasEndDate && e.repeatPattern().endDate() < from) |
77 | return FALSE; | 72 | return FALSE; |
78 | 73 | ||
79 | if (e.start() >= from) { | 74 | if (e.start() >= from) { |
80 | next = e.start(); | 75 | next = e.start(); |
81 | return TRUE; | 76 | return TRUE; |