author | eilers <eilers> | 2004-05-04 18:48:35 (UTC) |
---|---|---|
committer | eilers <eilers> | 2004-05-04 18:48:35 (UTC) |
commit | 04a7f91591987c01d312fbcaf6554ec6d728554d (patch) (unidiff) | |
tree | 98e10bb02d2e6c663f9c632f5e67783085683954 | |
parent | aa7023b05a3355f5c3d81d6efcccd8c4e7f4348c (diff) | |
download | opie-04a7f91591987c01d312fbcaf6554ec6d728554d.zip opie-04a7f91591987c01d312fbcaf6554ec6d728554d.tar.gz opie-04a7f91591987c01d312fbcaf6554ec6d728554d.tar.bz2 |
This is the reason, why I sometimes hate C++ ..
Fixed crash in find of OPimDateBookBackend_SQL
-rw-r--r-- | libopie2/opiepim/core/opimrecurrence.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/libopie2/opiepim/core/opimrecurrence.cpp b/libopie2/opiepim/core/opimrecurrence.cpp index 98bd647..4b1d886 100644 --- a/libopie2/opiepim/core/opimrecurrence.cpp +++ b/libopie2/opiepim/core/opimrecurrence.cpp | |||
@@ -1,330 +1,330 @@ | |||
1 | /* | 1 | /* |
2 | This file is part of the Opie Project | 2 | This file is part of the Opie Project |
3 | Copyright (C) The Main Author <main-author@whereever.org> | 3 | Copyright (C) The Main Author <main-author@whereever.org> |
4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> | 4 | =. Copyright (C) The Opie Team <opie-devel@handhelds.org> |
5 | .=l. | 5 | .=l. |
6 | .>+-= | 6 | .>+-= |
7 | _;:, .> :=|. This program is free software; you can | 7 | _;:, .> :=|. This program is free software; you can |
8 | .> <`_, > . <= redistribute it and/or modify it under | 8 | .> <`_, > . <= redistribute it and/or modify it under |
9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public | 9 | :`=1 )Y*s>-.-- : the terms of the GNU Library General Public |
10 | .="- .-=="i, .._ License as published by the Free Software | 10 | .="- .-=="i, .._ License as published by the Free Software |
11 | - . .-<_> .<> Foundation; either version 2 of the License, | 11 | - . .-<_> .<> Foundation; either version 2 of the License, |
12 | ._= =} : or (at your option) any later version. | 12 | ._= =} : or (at your option) any later version. |
13 | .%`+i> _;_. | 13 | .%`+i> _;_. |
14 | .i_,=:_. -<s. This program is distributed in the hope that | 14 | .i_,=:_. -<s. This program is distributed in the hope that |
15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; | 15 | + . -:. = it will be useful, but WITHOUT ANY WARRANTY; |
16 | : .. .:, . . . without even the implied warranty of | 16 | : .. .:, . . . without even the implied warranty of |
17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A | 17 | =_ + =;=|` MERCHANTABILITY or FITNESS FOR A |
18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU | 18 | _.=:. : :=>`: PARTICULAR PURPOSE. See the GNU |
19 | ..}^=.= = ; Library General Public License for more | 19 | ..}^=.= = ; Library General Public License for more |
20 | ++= -. .` .: details. | 20 | ++= -. .` .: details. |
21 | : = ...= . :.=- | 21 | : = ...= . :.=- |
22 | -. .:....=;==+<; You should have received a copy of the GNU | 22 | -. .:....=;==+<; You should have received a copy of the GNU |
23 | -_. . . )=. = Library General Public License along with | 23 | -_. . . )=. = Library General Public License along with |
24 | -- :-=` this library; see the file COPYING.LIB. | 24 | -- :-=` this library; see the file COPYING.LIB. |
25 | If not, write to the Free Software Foundation, | 25 | If not, write to the Free Software Foundation, |
26 | Inc., 59 Temple Place - Suite 330, | 26 | Inc., 59 Temple Place - Suite 330, |
27 | Boston, MA 02111-1307, USA. | 27 | Boston, MA 02111-1307, USA. |
28 | */ | 28 | */ |
29 | 29 | ||
30 | #include "opimrecurrence.h" | 30 | #include "opimrecurrence.h" |
31 | 31 | ||
32 | /* OPIE */ | 32 | /* OPIE */ |
33 | #include <opie2/opimtimezone.h> | 33 | #include <opie2/opimtimezone.h> |
34 | #include <qpe/timeconversion.h> | 34 | #include <qpe/timeconversion.h> |
35 | 35 | ||
36 | /* QT */ | 36 | /* QT */ |
37 | #include <qshared.h> | 37 | #include <qshared.h> |
38 | 38 | ||
39 | /* STD */ | 39 | /* STD */ |
40 | #include <time.h> | 40 | #include <time.h> |
41 | 41 | ||
42 | namespace Opie { | 42 | namespace Opie { |
43 | 43 | ||
44 | struct OPimRecurrence::Data : public QShared { | 44 | struct OPimRecurrence::Data : public QShared { |
45 | Data() : QShared() { | 45 | Data() : QShared() { |
46 | type = OPimRecurrence::NoRepeat; | 46 | type = OPimRecurrence::NoRepeat; |
47 | freq = -1; | 47 | freq = -1; |
48 | days = 0; | 48 | days = 0; |
49 | pos = 0; | 49 | pos = 0; |
50 | create = QDateTime::currentDateTime(); | 50 | create = QDateTime::currentDateTime(); |
51 | hasEnd = FALSE; | 51 | hasEnd = FALSE; |
52 | end = QDate::currentDate(); | 52 | end = QDate::currentDate(); |
53 | } | 53 | } |
54 | char days; // Q_UINT8 for 8 seven days;) | 54 | char days; // Q_UINT8 for 8 seven days;) |
55 | OPimRecurrence::RepeatType type; | 55 | OPimRecurrence::RepeatType type; |
56 | int freq; | 56 | int freq; |
57 | int pos; | 57 | int pos; |
58 | bool hasEnd : 1; | 58 | bool hasEnd : 1; |
59 | QDate end; | 59 | QDate end; |
60 | QDateTime create; | 60 | QDateTime create; |
61 | int rep; | 61 | int rep; |
62 | QString app; | 62 | QString app; |
63 | ExceptionList list; | 63 | ExceptionList list; |
64 | QDate start; | 64 | QDate start; |
65 | }; | 65 | }; |
66 | 66 | ||
67 | 67 | ||
68 | OPimRecurrence::OPimRecurrence() { | 68 | OPimRecurrence::OPimRecurrence() { |
69 | data = new Data; | 69 | data = new Data; |
70 | } | 70 | } |
71 | 71 | ||
72 | OPimRecurrence::OPimRecurrence( const QMap<int, QString>& map ) | 72 | OPimRecurrence::OPimRecurrence( const QMap<int, QString>& map ) |
73 | { | 73 | { |
74 | OPimRecurrence(); | 74 | data = new Data; |
75 | fromMap( map ); | 75 | fromMap( map ); |
76 | } | 76 | } |
77 | 77 | ||
78 | 78 | ||
79 | OPimRecurrence::OPimRecurrence( const OPimRecurrence& rec) | 79 | OPimRecurrence::OPimRecurrence( const OPimRecurrence& rec) |
80 | : data( rec.data ) | 80 | : data( rec.data ) |
81 | { | 81 | { |
82 | data->ref(); | 82 | data->ref(); |
83 | } | 83 | } |
84 | 84 | ||
85 | 85 | ||
86 | OPimRecurrence::~OPimRecurrence() { | 86 | OPimRecurrence::~OPimRecurrence() { |
87 | if ( data->deref() ) { | 87 | if ( data->deref() ) { |
88 | delete data; | 88 | delete data; |
89 | data = 0l; | 89 | data = 0l; |
90 | } | 90 | } |
91 | } | 91 | } |
92 | 92 | ||
93 | 93 | ||
94 | void OPimRecurrence::deref() { | 94 | void OPimRecurrence::deref() { |
95 | if ( data->deref() ) { | 95 | if ( data->deref() ) { |
96 | delete data; | 96 | delete data; |
97 | data = 0l; | 97 | data = 0l; |
98 | } | 98 | } |
99 | } | 99 | } |
100 | 100 | ||
101 | 101 | ||
102 | bool OPimRecurrence::operator==( const OPimRecurrence& )const { | 102 | bool OPimRecurrence::operator==( const OPimRecurrence& )const { |
103 | return false; | 103 | return false; |
104 | } | 104 | } |
105 | 105 | ||
106 | 106 | ||
107 | OPimRecurrence &OPimRecurrence::operator=( const OPimRecurrence& re) { | 107 | OPimRecurrence &OPimRecurrence::operator=( const OPimRecurrence& re) { |
108 | if ( *this == re ) return *this; | 108 | if ( *this == re ) return *this; |
109 | 109 | ||
110 | re.data->ref(); | 110 | re.data->ref(); |
111 | deref(); | 111 | deref(); |
112 | data = re.data; | 112 | data = re.data; |
113 | 113 | ||
114 | return *this; | 114 | return *this; |
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | bool OPimRecurrence::doesRecur()const { | 118 | bool OPimRecurrence::doesRecur()const { |
119 | return !( type() == NoRepeat ); | 119 | return !( type() == NoRepeat ); |
120 | } | 120 | } |
121 | 121 | ||
122 | 122 | ||
123 | /* | 123 | /* |
124 | * we try to be smart here | 124 | * we try to be smart here |
125 | * | 125 | * |
126 | */ | 126 | */ |
127 | bool OPimRecurrence::doesRecur( const QDate& date ) { | 127 | bool OPimRecurrence::doesRecur( const QDate& date ) { |
128 | /* the day before the recurrance */ | 128 | /* the day before the recurrance */ |
129 | QDate da = date.addDays(-1); | 129 | QDate da = date.addDays(-1); |
130 | 130 | ||
131 | QDate recur; | 131 | QDate recur; |
132 | if (!nextOcurrence( da, recur ) ) | 132 | if (!nextOcurrence( da, recur ) ) |
133 | return false; | 133 | return false; |
134 | 134 | ||
135 | return (recur == date); | 135 | return (recur == date); |
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | // FIXME unuglify! | 139 | // FIXME unuglify! |
140 | // GPL from Datebookdb.cpp | 140 | // GPL from Datebookdb.cpp |
141 | // FIXME exception list! | 141 | // FIXME exception list! |
142 | bool OPimRecurrence::nextOcurrence( const QDate& from, QDate& next ) { | 142 | bool OPimRecurrence::nextOcurrence( const QDate& from, QDate& next ) { |
143 | bool stillLooking; | 143 | bool stillLooking; |
144 | stillLooking = p_nextOccurrence( from, next ); | 144 | stillLooking = p_nextOccurrence( from, next ); |
145 | while ( stillLooking && data->list.contains(next) ) | 145 | while ( stillLooking && data->list.contains(next) ) |
146 | stillLooking = p_nextOccurrence( next.addDays(1), next ); | 146 | stillLooking = p_nextOccurrence( next.addDays(1), next ); |
147 | 147 | ||
148 | return stillLooking; | 148 | return stillLooking; |
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | bool OPimRecurrence::p_nextOccurrence( const QDate& from, QDate& next ) { | 152 | bool OPimRecurrence::p_nextOccurrence( const QDate& from, QDate& next ) { |
153 | 153 | ||
154 | // easy checks, first are we too far in the future or too far in the past? | 154 | // easy checks, first are we too far in the future or too far in the past? |
155 | QDate tmpDate; | 155 | QDate tmpDate; |
156 | int freq = frequency(); | 156 | int freq = frequency(); |
157 | int diff, diff2, a; | 157 | int diff, diff2, a; |
158 | int iday, imonth, iyear; | 158 | int iday, imonth, iyear; |
159 | int dayOfWeek = 0; | 159 | int dayOfWeek = 0; |
160 | int firstOfWeek = 0; | 160 | int firstOfWeek = 0; |
161 | int weekOfMonth; | 161 | int weekOfMonth; |
162 | 162 | ||
163 | 163 | ||
164 | if (hasEndDate() && endDate() < from) | 164 | if (hasEndDate() && endDate() < from) |
165 | return FALSE; | 165 | return FALSE; |
166 | 166 | ||
167 | if (start() >= from ) { | 167 | if (start() >= from ) { |
168 | next = start(); | 168 | next = start(); |
169 | return TRUE; | 169 | return TRUE; |
170 | } | 170 | } |
171 | 171 | ||
172 | switch ( type() ) { | 172 | switch ( type() ) { |
173 | case Weekly: | 173 | case Weekly: |
174 | /* weekly is just daily by 7 */ | 174 | /* weekly is just daily by 7 */ |
175 | /* first convert the repeatPattern.Days() mask to the next | 175 | /* first convert the repeatPattern.Days() mask to the next |
176 | day of week valid after from */ | 176 | day of week valid after from */ |
177 | dayOfWeek = from.dayOfWeek(); | 177 | dayOfWeek = from.dayOfWeek(); |
178 | dayOfWeek--; /* we want 0-6, doco for above specs 1-7 */ | 178 | dayOfWeek--; /* we want 0-6, doco for above specs 1-7 */ |
179 | 179 | ||
180 | /* this is done in case freq > 1 and from in week not | 180 | /* this is done in case freq > 1 and from in week not |
181 | for this round */ | 181 | for this round */ |
182 | // firstOfWeek = 0; this is already done at decl. | 182 | // firstOfWeek = 0; this is already done at decl. |
183 | while(!((1 << firstOfWeek) & days() )) | 183 | while(!((1 << firstOfWeek) & days() )) |
184 | firstOfWeek++; | 184 | firstOfWeek++; |
185 | 185 | ||
186 | /* there is at least one 'day', or there would be no event */ | 186 | /* there is at least one 'day', or there would be no event */ |
187 | while(!((1 << (dayOfWeek % 7)) & days() )) | 187 | while(!((1 << (dayOfWeek % 7)) & days() )) |
188 | dayOfWeek++; | 188 | dayOfWeek++; |
189 | 189 | ||
190 | dayOfWeek = dayOfWeek % 7; /* the actual day of week */ | 190 | dayOfWeek = dayOfWeek % 7; /* the actual day of week */ |
191 | dayOfWeek -= start().dayOfWeek() -1; | 191 | dayOfWeek -= start().dayOfWeek() -1; |
192 | 192 | ||
193 | firstOfWeek = firstOfWeek % 7; /* the actual first of week */ | 193 | firstOfWeek = firstOfWeek % 7; /* the actual first of week */ |
194 | firstOfWeek -= start().dayOfWeek() -1; | 194 | firstOfWeek -= start().dayOfWeek() -1; |
195 | 195 | ||
196 | // dayOfWeek may be negitive now | 196 | // dayOfWeek may be negitive now |
197 | // day of week is number of days to add to start day | 197 | // day of week is number of days to add to start day |
198 | 198 | ||
199 | freq *= 7; | 199 | freq *= 7; |
200 | // FALL-THROUGH !!!!! | 200 | // FALL-THROUGH !!!!! |
201 | case Daily: | 201 | case Daily: |
202 | // the add is for the possible fall through from weekly */ | 202 | // the add is for the possible fall through from weekly */ |
203 | if(start().addDays(dayOfWeek) > from) { | 203 | if(start().addDays(dayOfWeek) > from) { |
204 | /* first week exception */ | 204 | /* first week exception */ |
205 | next = QDate(start().addDays(dayOfWeek) ); | 205 | next = QDate(start().addDays(dayOfWeek) ); |
206 | if ((next > endDate()) | 206 | if ((next > endDate()) |
207 | && hasEndDate() ) | 207 | && hasEndDate() ) |
208 | return FALSE; | 208 | return FALSE; |
209 | return TRUE; | 209 | return TRUE; |
210 | } | 210 | } |
211 | /* if from is middle of a non-week */ | 211 | /* if from is middle of a non-week */ |
212 | 212 | ||
213 | diff = start().addDays(dayOfWeek).daysTo(from) % freq; | 213 | diff = start().addDays(dayOfWeek).daysTo(from) % freq; |
214 | diff2 = start().addDays(firstOfWeek).daysTo(from) % freq; | 214 | diff2 = start().addDays(firstOfWeek).daysTo(from) % freq; |
215 | 215 | ||
216 | if(diff != 0) | 216 | if(diff != 0) |
217 | diff = freq - diff; | 217 | diff = freq - diff; |
218 | if(diff2 != 0) | 218 | if(diff2 != 0) |
219 | diff2 = freq - diff2; | 219 | diff2 = freq - diff2; |
220 | diff = QMIN(diff, diff2); | 220 | diff = QMIN(diff, diff2); |
221 | 221 | ||
222 | next = QDate(from.addDays(diff)); | 222 | next = QDate(from.addDays(diff)); |
223 | if ( (next > endDate()) | 223 | if ( (next > endDate()) |
224 | && hasEndDate() ) | 224 | && hasEndDate() ) |
225 | return FALSE; | 225 | return FALSE; |
226 | return TRUE; | 226 | return TRUE; |
227 | case MonthlyDay: | 227 | case MonthlyDay: |
228 | iday = from.day(); | 228 | iday = from.day(); |
229 | iyear = from.year(); | 229 | iyear = from.year(); |
230 | imonth = from.month(); | 230 | imonth = from.month(); |
231 | /* find equivelent day of month for this month */ | 231 | /* find equivelent day of month for this month */ |
232 | dayOfWeek = start().dayOfWeek(); | 232 | dayOfWeek = start().dayOfWeek(); |
233 | weekOfMonth = (start().day() - 1) / 7; | 233 | weekOfMonth = (start().day() - 1) / 7; |
234 | 234 | ||
235 | /* work out when the next valid month is */ | 235 | /* work out when the next valid month is */ |
236 | a = from.year() - start().year(); | 236 | a = from.year() - start().year(); |
237 | a *= 12; | 237 | a *= 12; |
238 | a = a + (imonth - start().month()); | 238 | a = a + (imonth - start().month()); |
239 | /* a is e.start()monthsFrom(from); */ | 239 | /* a is e.start()monthsFrom(from); */ |
240 | if(a % freq) { | 240 | if(a % freq) { |
241 | a = freq - (a % freq); | 241 | a = freq - (a % freq); |
242 | imonth = from.month() + a; | 242 | imonth = from.month() + a; |
243 | if (imonth > 12) { | 243 | if (imonth > 12) { |
244 | imonth--; | 244 | imonth--; |
245 | iyear += imonth / 12; | 245 | iyear += imonth / 12; |
246 | imonth = imonth % 12; | 246 | imonth = imonth % 12; |
247 | imonth++; | 247 | imonth++; |
248 | } | 248 | } |
249 | } | 249 | } |
250 | /* imonth is now the first month after or on | 250 | /* imonth is now the first month after or on |
251 | from that matches the frequency given */ | 251 | from that matches the frequency given */ |
252 | 252 | ||
253 | /* find for this month */ | 253 | /* find for this month */ |
254 | tmpDate = QDate( iyear, imonth, 1 ); | 254 | tmpDate = QDate( iyear, imonth, 1 ); |
255 | 255 | ||
256 | iday = 1; | 256 | iday = 1; |
257 | iday += (7 + dayOfWeek - tmpDate.dayOfWeek()) % 7; | 257 | iday += (7 + dayOfWeek - tmpDate.dayOfWeek()) % 7; |
258 | iday += 7 * weekOfMonth; | 258 | iday += 7 * weekOfMonth; |
259 | while (iday > tmpDate.daysInMonth()) { | 259 | while (iday > tmpDate.daysInMonth()) { |
260 | imonth += freq; | 260 | imonth += freq; |
261 | if (imonth > 12) { | 261 | if (imonth > 12) { |
262 | imonth--; | 262 | imonth--; |
263 | iyear += imonth / 12; | 263 | iyear += imonth / 12; |
264 | imonth = imonth % 12; | 264 | imonth = imonth % 12; |
265 | imonth++; | 265 | imonth++; |
266 | } | 266 | } |
267 | tmpDate = QDate( iyear, imonth, 1 ); | 267 | tmpDate = QDate( iyear, imonth, 1 ); |
268 | /* these loops could go for a while, check end case now */ | 268 | /* these loops could go for a while, check end case now */ |
269 | if ((tmpDate > endDate()) && hasEndDate() ) | 269 | if ((tmpDate > endDate()) && hasEndDate() ) |
270 | return FALSE; | 270 | return FALSE; |
271 | iday = 1; | 271 | iday = 1; |
272 | iday += (7 + dayOfWeek - tmpDate.dayOfWeek()) % 7; | 272 | iday += (7 + dayOfWeek - tmpDate.dayOfWeek()) % 7; |
273 | iday += 7 * weekOfMonth; | 273 | iday += 7 * weekOfMonth; |
274 | } | 274 | } |
275 | tmpDate = QDate(iyear, imonth, iday); | 275 | tmpDate = QDate(iyear, imonth, iday); |
276 | 276 | ||
277 | if (tmpDate >= from) { | 277 | if (tmpDate >= from) { |
278 | next = tmpDate; | 278 | next = tmpDate; |
279 | if ((next > endDate() ) && hasEndDate() ) | 279 | if ((next > endDate() ) && hasEndDate() ) |
280 | return FALSE; | 280 | return FALSE; |
281 | return TRUE; | 281 | return TRUE; |
282 | } | 282 | } |
283 | 283 | ||
284 | /* need to find the next iteration */ | 284 | /* need to find the next iteration */ |
285 | do { | 285 | do { |
286 | imonth += freq; | 286 | imonth += freq; |
287 | if (imonth > 12) { | 287 | if (imonth > 12) { |
288 | imonth--; | 288 | imonth--; |
289 | iyear += imonth / 12; | 289 | iyear += imonth / 12; |
290 | imonth = imonth % 12; | 290 | imonth = imonth % 12; |
291 | imonth++; | 291 | imonth++; |
292 | } | 292 | } |
293 | tmpDate = QDate( iyear, imonth, 1 ); | 293 | tmpDate = QDate( iyear, imonth, 1 ); |
294 | /* these loops could go for a while, check end case now */ | 294 | /* these loops could go for a while, check end case now */ |
295 | if ((tmpDate > endDate()) && hasEndDate() ) | 295 | if ((tmpDate > endDate()) && hasEndDate() ) |
296 | return FALSE; | 296 | return FALSE; |
297 | iday = 1; | 297 | iday = 1; |
298 | iday += (7 + dayOfWeek - tmpDate.dayOfWeek()) % 7; | 298 | iday += (7 + dayOfWeek - tmpDate.dayOfWeek()) % 7; |
299 | iday += 7 * weekOfMonth; | 299 | iday += 7 * weekOfMonth; |
300 | } while (iday > tmpDate.daysInMonth()); | 300 | } while (iday > tmpDate.daysInMonth()); |
301 | tmpDate = QDate(iyear, imonth, iday); | 301 | tmpDate = QDate(iyear, imonth, iday); |
302 | 302 | ||
303 | next = tmpDate; | 303 | next = tmpDate; |
304 | if ((next > endDate()) && hasEndDate() ) | 304 | if ((next > endDate()) && hasEndDate() ) |
305 | return FALSE; | 305 | return FALSE; |
306 | return TRUE; | 306 | return TRUE; |
307 | case MonthlyDate: | 307 | case MonthlyDate: |
308 | iday = start().day(); | 308 | iday = start().day(); |
309 | iyear = from.year(); | 309 | iyear = from.year(); |
310 | imonth = from.month(); | 310 | imonth = from.month(); |
311 | 311 | ||
312 | a = from.year() - start().year(); | 312 | a = from.year() - start().year(); |
313 | a *= 12; | 313 | a *= 12; |
314 | a = a + (imonth - start().month()); | 314 | a = a + (imonth - start().month()); |
315 | /* a is e.start()monthsFrom(from); */ | 315 | /* a is e.start()monthsFrom(from); */ |
316 | if(a % freq) { | 316 | if(a % freq) { |
317 | a = freq - (a % freq); | 317 | a = freq - (a % freq); |
318 | imonth = from.month() + a; | 318 | imonth = from.month() + a; |
319 | if (imonth > 12) { | 319 | if (imonth > 12) { |
320 | imonth--; | 320 | imonth--; |
321 | iyear += imonth / 12; | 321 | iyear += imonth / 12; |
322 | imonth = imonth % 12; | 322 | imonth = imonth % 12; |
323 | imonth++; | 323 | imonth++; |
324 | } | 324 | } |
325 | } | 325 | } |
326 | /* imonth is now the first month after or on | 326 | /* imonth is now the first month after or on |
327 | from that matches the frequencey given */ | 327 | from that matches the frequencey given */ |
328 | 328 | ||
329 | /* this could go for a while, worse case, 4*12 iterations, probably */ | 329 | /* this could go for a while, worse case, 4*12 iterations, probably */ |
330 | while(!QDate::isValid(iyear, imonth, iday) ) { | 330 | while(!QDate::isValid(iyear, imonth, iday) ) { |