summaryrefslogtreecommitdiffabout
path: root/libkcal/recurrence.cpp
Unidiff
Diffstat (limited to 'libkcal/recurrence.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--libkcal/recurrence.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp
index e84f672..5181eaf 100644
--- a/libkcal/recurrence.cpp
+++ b/libkcal/recurrence.cpp
@@ -870,24 +870,25 @@ QDate Recurrence::getNextDate(const QDate &preDate, bool *last) const
870 switch (recurs) 870 switch (recurs)
871 { 871 {
872 case rMinutely: 872 case rMinutely:
873 case rHourly: 873 case rHourly:
874 return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date(); 874 return getNextDateTime(QDateTime(preDate, QTime(23,59,59)), last).date();
875 case rDaily: 875 case rDaily:
876 case rWeekly: 876 case rWeekly:
877 case rMonthlyPos: 877 case rMonthlyPos:
878 case rMonthlyDay: 878 case rMonthlyDay:
879 case rYearlyMonth: 879 case rYearlyMonth:
880 case rYearlyDay: 880 case rYearlyDay:
881 case rYearlyPos: 881 case rYearlyPos:
882 qDebug("Recurrence::getNextDate: MAY BE BROKEN ");
882 return getNextDateNoTime(preDate, last); 883 return getNextDateNoTime(preDate, last);
883 default: 884 default:
884 return QDate(); 885 return QDate();
885 } 886 }
886} 887}
887 888
888 889
889QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const 890QDateTime Recurrence::getPreviousDateTime(const QDateTime &afterDateTime, bool *last) const
890{ 891{
891 if (last) 892 if (last)
892 *last = false; 893 *last = false;
893 int freq; 894 int freq;
@@ -1157,24 +1158,25 @@ bool Recurrence::recursYearlyByDay(const QDate &qd) const
1157 } 1158 }
1158 } 1159 }
1159 return false; 1160 return false;
1160} 1161}
1161 1162
1162/* Get the date of the next recurrence, after the specified date. 1163/* Get the date of the next recurrence, after the specified date.
1163 * If 'last' is non-null, '*last' is set to true if the next recurrence is the 1164 * If 'last' is non-null, '*last' is set to true if the next recurrence is the
1164 * last recurrence, else false. 1165 * last recurrence, else false.
1165 * Reply = date of next recurrence, or invalid date if none. 1166 * Reply = date of next recurrence, or invalid date if none.
1166 */ 1167 */
1167QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const 1168QDate Recurrence::getNextDateNoTime(const QDate &preDate, bool *last) const
1168{ 1169{
1170
1169 if (last) 1171 if (last)
1170 *last = false; 1172 *last = false;
1171 QDate dStart = mRecurStart.date(); 1173 QDate dStart = mRecurStart.date();
1172 if (preDate < dStart) 1174 if (preDate < dStart)
1173 return dStart; 1175 return dStart;
1174 QDate earliestDate = preDate.addDays(1); 1176 QDate earliestDate = preDate.addDays(1);
1175 QDate nextDate; 1177 QDate nextDate;
1176 1178
1177 switch (recurs) { 1179 switch (recurs) {
1178 case rDaily: 1180 case rDaily:
1179 nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq); 1181 nextDate = dStart.addDays((dStart.daysTo(preDate)/rFreq + 1) * rFreq);
1180 break; 1182 break;