Diffstat (limited to 'libopie2/opiepim/backend/odatebookaccessbackend.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiepim/backend/odatebookaccessbackend.cpp | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/libopie2/opiepim/backend/odatebookaccessbackend.cpp b/libopie2/opiepim/backend/odatebookaccessbackend.cpp index 8fa1a68..f0c5d65 100644 --- a/libopie2/opiepim/backend/odatebookaccessbackend.cpp +++ b/libopie2/opiepim/backend/odatebookaccessbackend.cpp | |||
@@ -106,51 +106,77 @@ namespace { | |||
106 | tmpEff.setEffectiveDates( startDate, endDate ); | 106 | tmpEff.setEffectiveDates( startDate, endDate ); |
107 | tmpList.append( tmpEff ); | 107 | tmpList.append( tmpEff ); |
108 | 108 | ||
109 | sub_it = sub_it.addDays( 1 ); | 109 | sub_it = sub_it.addDays( 1 ); |
110 | } | 110 | } |
111 | itDate = endDate; | 111 | itDate = endDate; |
112 | }else { | 112 | }else { |
113 | eff.setEvent( (*it) ); | 113 | eff.setEvent( (*it) ); |
114 | tmpList.append( eff ); | 114 | tmpList.append( eff ); |
115 | itDate = repeat.addDays( 1 ); | 115 | itDate = repeat.addDays( 1 ); |
116 | } | 116 | } |
117 | } | 117 | } |
118 | } | 118 | } |
119 | } | 119 | } |
120 | } | 120 | } |
121 | 121 | ||
122 | ODateBookAccessBackend::ODateBookAccessBackend() | 122 | ODateBookAccessBackend::ODateBookAccessBackend() |
123 | : OPimAccessBackend<OEvent>() | 123 | : OPimAccessBackend<OEvent>() |
124 | { | 124 | { |
125 | 125 | ||
126 | } | 126 | } |
127 | ODateBookAccessBackend::~ODateBookAccessBackend() { | 127 | ODateBookAccessBackend::~ODateBookAccessBackend() { |
128 | 128 | ||
129 | } | 129 | } |
130 | OEffectiveEvent::ValueList ODateBookAccessBackend::effecticeEvents( const QDate& from, | 130 | OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveEvents( const QDate& from, |
131 | const QDate& to ) { | 131 | const QDate& to ) { |
132 | OEffectiveEvent::ValueList tmpList; | 132 | OEffectiveEvent::ValueList tmpList; |
133 | OEvent::ValueList list = directNonRepeats(); | 133 | OEvent::ValueList list = directNonRepeats(); |
134 | 134 | ||
135 | events( tmpList, list, from, to ); | 135 | events( tmpList, list, from, to ); |
136 | repeat( tmpList, directRawRepeats(),from,to ); | 136 | repeat( tmpList, directRawRepeats(),from,to ); |
137 | 137 | ||
138 | list = directRawRepeats(); | 138 | list = directRawRepeats(); // Useless, isn't it ? (eilers) |
139 | 139 | ||
140 | qHeapSort( tmpList ); | 140 | qHeapSort( tmpList ); |
141 | return tmpList; | 141 | return tmpList; |
142 | } | 142 | } |
143 | OEffectiveEvent::ValueList ODateBookAccessBackend::effecticeEvents( const QDateTime& dt ) { | 143 | OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveEvents( const QDateTime& dt ) { |
144 | OEffectiveEvent::ValueList day = effecticeEvents( dt.date(), dt.date() ); | 144 | OEffectiveEvent::ValueList day = effectiveEvents( dt.date(), dt.date() ); |
145 | OEffectiveEvent::ValueList::Iterator it; | ||
146 | |||
147 | OEffectiveEvent::ValueList tmpList; | ||
148 | QDateTime dtTmp; | ||
149 | for ( it = day.begin(); it != day.end(); ++it ) { | ||
150 | dtTmp = QDateTime( (*it).date(), (*it).startTime() ); | ||
151 | if ( QABS(dt.secsTo(dtTmp) ) < 60 ) | ||
152 | tmpList.append( (*it) ); | ||
153 | } | ||
154 | |||
155 | return tmpList; | ||
156 | } | ||
157 | |||
158 | OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveNonRepeatingEvents( const QDate& from, | ||
159 | const QDate& to ) { | ||
160 | OEffectiveEvent::ValueList tmpList; | ||
161 | OEvent::ValueList list = directNonRepeats(); | ||
162 | |||
163 | events( tmpList, list, from, to ); | ||
164 | |||
165 | qHeapSort( tmpList ); | ||
166 | return tmpList; | ||
167 | } | ||
168 | |||
169 | OEffectiveEvent::ValueList ODateBookAccessBackend::effectiveNonRepeatingEvents( const QDateTime& dt ) { | ||
170 | OEffectiveEvent::ValueList day = effectiveNonRepeatingEvents( dt.date(), dt.date() ); | ||
145 | OEffectiveEvent::ValueList::Iterator it; | 171 | OEffectiveEvent::ValueList::Iterator it; |
146 | 172 | ||
147 | OEffectiveEvent::ValueList tmpList; | 173 | OEffectiveEvent::ValueList tmpList; |
148 | QDateTime dtTmp; | 174 | QDateTime dtTmp; |
149 | for ( it = day.begin(); it != day.end(); ++it ) { | 175 | for ( it = day.begin(); it != day.end(); ++it ) { |
150 | dtTmp = QDateTime( (*it).date(), (*it).startTime() ); | 176 | dtTmp = QDateTime( (*it).date(), (*it).startTime() ); |
151 | if ( QABS(dt.secsTo(dtTmp) ) < 60 ) | 177 | if ( QABS(dt.secsTo(dtTmp) ) < 60 ) |
152 | tmpList.append( (*it) ); | 178 | tmpList.append( (*it) ); |
153 | } | 179 | } |
154 | 180 | ||
155 | return tmpList; | 181 | return tmpList; |
156 | } | 182 | } |