-rw-r--r-- | libkcal/recurrence.cpp | 56 |
1 files changed, 44 insertions, 12 deletions
diff --git a/libkcal/recurrence.cpp b/libkcal/recurrence.cpp index dd74e10..e84f672 100644 --- a/libkcal/recurrence.cpp +++ b/libkcal/recurrence.cpp | |||
@@ -107,4 +107,5 @@ bool Recurrence::operator==( const Recurrence& r2 ) const | |||
107 | // differ in the other settings, because one (or both) | 107 | // differ in the other settings, because one (or both) |
108 | // may be not initialized properly | 108 | // may be not initialized properly |
109 | |||
109 | if ( recurs != r2.recurs | 110 | if ( recurs != r2.recurs |
110 | || rFreq != r2.rFreq | 111 | || rFreq != r2.rFreq |
@@ -123,16 +124,47 @@ bool Recurrence::operator==( const Recurrence& r2 ) const | |||
123 | return rDays == r2.rDays | 124 | return rDays == r2.rDays |
124 | && rWeekStart == r2.rWeekStart; | 125 | && rWeekStart == r2.rWeekStart; |
125 | case rMonthlyPos: | 126 | case rMonthlyPos: { |
126 | return rMonthPositions.count() == r2.rMonthPositions.count(); | 127 | QPtrList<rMonthPos> MonthPositions = rMonthPositions; |
127 | case rMonthlyDay: | 128 | QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions; |
128 | return rMonthDays.count() == r2.rMonthDays.count(); | 129 | if ( !MonthPositions.count() ) |
129 | case rYearlyPos: | 130 | return false; |
130 | return rYearNums.count() == r2.rYearNums.count() | 131 | if ( !MonthPositions2.count() ) |
131 | && rMonthPositions.count() == r2.rMonthPositions.count(); | 132 | return false; |
132 | case rYearlyMonth: | 133 | return MonthPositions.first()->rPos == MonthPositions2.first()->rPos; |
133 | return rYearNums.count() == r2.rYearNums.count() | 134 | } |
134 | && mFeb29YearlyType == r2.mFeb29YearlyType; | 135 | case rMonthlyDay: { |
135 | case rYearlyDay: | 136 | QPtrList<int> MonthDays = rMonthDays ; |
136 | return rYearNums == r2.rYearNums; | 137 | QPtrList<int> MonthDays2 = r2.rMonthDays ; |
138 | if ( !MonthDays.count() ) | ||
139 | return false; | ||
140 | if ( !MonthDays2.count() ) | ||
141 | return false; | ||
142 | return *MonthDays.first() == *MonthDays2.first() ; | ||
143 | } | ||
144 | case rYearlyPos: { | ||
145 | |||
146 | QPtrList<int> YearNums = rYearNums; | ||
147 | QPtrList<int> YearNums2 = r2.rYearNums; | ||
148 | if ( *YearNums.first() != *YearNums2.first() ) | ||
149 | return false; | ||
150 | QPtrList<rMonthPos> MonthPositions = rMonthPositions; | ||
151 | QPtrList<rMonthPos> MonthPositions2 = r2.rMonthPositions; | ||
152 | if ( !MonthPositions.count() ) | ||
153 | return false; | ||
154 | if ( !MonthPositions2.count() ) | ||
155 | return false; | ||
156 | return MonthPositions.first()->rPos == MonthPositions2.first()->rPos; | ||
157 | |||
158 | } | ||
159 | case rYearlyMonth: { | ||
160 | QPtrList<int> YearNums = rYearNums; | ||
161 | QPtrList<int> YearNums2 = r2.rYearNums; | ||
162 | return ( *YearNums.first() == *YearNums2.first() && mFeb29YearlyType == r2.mFeb29YearlyType); | ||
163 | } | ||
164 | case rYearlyDay: { | ||
165 | QPtrList<int> YearNums = rYearNums; | ||
166 | QPtrList<int> YearNums2 = r2.rYearNums; | ||
167 | return ( *YearNums.first() == *YearNums2.first() ); | ||
168 | } | ||
137 | case rNone: | 169 | case rNone: |
138 | case rMinutely: | 170 | case rMinutely: |