-rw-r--r-- | korganizer/kowhatsnextview.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 8371523..3801ed4 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -144,142 +144,144 @@ void KOWhatsNextView::restartTimer() | |||
144 | //mTimer->start( 5000 ); | 144 | //mTimer->start( 5000 ); |
145 | } | 145 | } |
146 | void KOWhatsNextView::updateView() | 146 | void KOWhatsNextView::updateView() |
147 | { | 147 | { |
148 | if ( mTimer->isActive() ) | 148 | if ( mTimer->isActive() ) |
149 | restartTimer(); | 149 | restartTimer(); |
150 | //qDebug("KOWhatsNextView::updateView() "); | 150 | //qDebug("KOWhatsNextView::updateView() "); |
151 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); | 151 | // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); |
152 | KIconLoader kil("korganizer"); | 152 | KIconLoader kil("korganizer"); |
153 | QString ipath;// = new QString(); | 153 | QString ipath;// = new QString(); |
154 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); | 154 | // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); |
155 | //<big><big><strong>" + date + "</strong></big></big>\n"; | 155 | //<big><big><strong>" + date + "</strong></big></big>\n"; |
156 | mText = "<table width=\"100%\">\n"; | 156 | mText = "<table width=\"100%\">\n"; |
157 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; | 157 | //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; |
158 | #ifdef DESKTOP_VERSION | 158 | #ifdef DESKTOP_VERSION |
159 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; | 159 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; |
160 | #else | 160 | #else |
161 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; | 161 | mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; |
162 | #endif | 162 | #endif |
163 | // mText += "<img src=\""; | 163 | // mText += "<img src=\""; |
164 | // mText += ipath; | 164 | // mText += ipath; |
165 | // mText += "\">"; | 165 | // mText += "\">"; |
166 | mEventDate = QDate::currentDate(); | 166 | mEventDate = QDate::currentDate(); |
167 | #ifdef DESKTOP_VERSION | 167 | #ifdef DESKTOP_VERSION |
168 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; | 168 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h1>"; |
169 | #else | 169 | #else |
170 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; | 170 | mText += "<font color=\"#FFFFFF\"> <em>" + KGlobal::locale()->formatDate( mEventDate , false )+"</em></font></h2>"; |
171 | #endif | 171 | #endif |
172 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; | 172 | mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; |
173 | int iii; | 173 | int iii; |
174 | mTodos.clear(); | 174 | mTodos.clear(); |
175 | QPtrList<Event> events; | 175 | QPtrList<Event> events; |
176 | QPtrList<Todo> todos = calendar()->todos(); | 176 | QPtrList<Todo> todos = calendar()->todos(); |
177 | Todo * todo; | 177 | Todo * todo; |
178 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; | 178 | //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; |
179 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; | 179 | int daysToShow = KOPrefs::instance()->mWhatsNextDays ; |
180 | bool itemAdded = false; | 180 | bool itemAdded = false; |
181 | for ( iii = 0; iii < daysToShow; ++iii ) { | 181 | for ( iii = 0; iii < daysToShow; ++iii ) { |
182 | QString date; | 182 | QString date; |
183 | itemAdded = false; | 183 | itemAdded = false; |
184 | events = calendar()->events( mEventDate, true ); | 184 | events = calendar()->events( mEventDate, true ); |
185 | 185 | ||
186 | if ( iii == 0 ) { // today !!! | 186 | if ( iii == 0 ) { // today !!! |
187 | todo = todos.first(); | 187 | todo = todos.first(); |
188 | while(todo) { | 188 | while(todo) { |
189 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { | 189 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { |
190 | if ( ! itemAdded ) { | 190 | if ( ! itemAdded ) { |
191 | appendDay ( iii, mEventDate ); | 191 | appendDay ( iii, mEventDate ); |
192 | itemAdded = true; | 192 | //itemAdded = true; |
193 | 193 | ||
194 | } | 194 | } //bool reply=false, bool notRed = true, bool appendTable = false); |
195 | appendEvent(todo); | 195 | appendEvent(todo, false, false, !itemAdded ); |
196 | itemAdded = true; | ||
196 | } | 197 | } |
197 | todo = todos.next(); | 198 | todo = todos.next(); |
198 | } | 199 | } |
199 | } | 200 | } |
200 | 201 | ||
201 | 202 | ||
202 | if (events.count() > 0) { | 203 | if (events.count() > 0) { |
203 | // mText += "<p></p>"; | 204 | // mText += "<p></p>"; |
204 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 205 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
205 | // mText += "<h2>"; | 206 | // mText += "<h2>"; |
206 | //mText += " <img src=\""; | 207 | //mText += " <img src=\""; |
207 | //mText += ipath; | 208 | //mText += ipath; |
208 | //mText += "\">"; | 209 | //mText += "\">"; |
209 | if ( ! itemAdded ) { | 210 | if ( ! itemAdded ) { |
210 | appendDay ( iii, mEventDate ); | 211 | appendDay ( iii, mEventDate ); |
211 | 212 | ||
212 | } | 213 | } |
213 | // for first day (iii == 0) | 214 | // for first day (iii == 0) |
214 | // we may have syncevents, or events in the past, which maybe should not be diaplayed | 215 | // we may have syncevents, or events in the past, which maybe should not be diaplayed |
215 | // for that reason we cannot append <table> in appendDay () for iii == 0 | 216 | // for that reason we cannot append <table> in appendDay () for iii == 0 |
216 | // we must append it in the first successful call of appendEvent() | 217 | // we must append it in the first successful call of appendEvent() |
217 | Event *ev = events.first(); | 218 | Event *ev = events.first(); |
218 | while(ev) { | 219 | while(ev) { |
219 | //qDebug("+++++event append %s", ev->summary().latin1()); | 220 | //qDebug("+++++event append %s", ev->summary().latin1()); |
220 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 221 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
221 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) | 222 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) |
222 | itemAdded = true; | 223 | itemAdded = true; |
223 | } | 224 | } |
224 | ev = events.next(); | 225 | ev = events.next(); |
225 | } | 226 | } |
226 | 227 | ||
227 | //mText += "</table>\n"; | 228 | //mText += "</table>\n"; |
228 | } | 229 | } |
229 | 230 | ||
230 | todo = todos.first(); | 231 | todo = todos.first(); |
231 | while(todo) { | 232 | while(todo) { |
232 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 233 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
233 | if ( ! itemAdded ) { | 234 | if ( ! itemAdded ) { |
234 | appendDay ( iii, mEventDate ); | 235 | appendDay ( iii, mEventDate ); |
235 | itemAdded = true; | 236 | //itemAdded = true; |
236 | } | 237 | } |
237 | appendEvent(todo); | 238 | appendEvent(todo, false , iii!= 0,!itemAdded); |
239 | itemAdded = true; | ||
238 | } | 240 | } |
239 | todo = todos.next(); | 241 | todo = todos.next(); |
240 | } | 242 | } |
241 | if ( !itemAdded && iii == 0 ) { | 243 | if ( !itemAdded && iii == 0 ) { |
242 | // appendDay ( iii, mEventDate ); | 244 | // appendDay ( iii, mEventDate ); |
243 | //mText += "<table>"; | 245 | //mText += "<table>"; |
244 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; | 246 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; |
245 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; | 247 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; |
246 | //mText +="</table>"; | 248 | //mText +="</table>"; |
247 | } | 249 | } |
248 | if ( itemAdded ) | 250 | if ( itemAdded ) |
249 | mText += "</table>\n"; | 251 | mText += "</table>\n"; |
250 | mEventDate = mEventDate.addDays( 1 ); | 252 | mEventDate = mEventDate.addDays( 1 ); |
251 | } | 253 | } |
252 | 254 | ||
253 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 255 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
254 | if (todos.count() > 0 && topmostPrios > 0 ) { | 256 | if (todos.count() > 0 && topmostPrios > 0 ) { |
255 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 257 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
256 | // mText += "<h2>"; | 258 | // mText += "<h2>"; |
257 | //<img src=\""; | 259 | //<img src=\""; |
258 | // mText += ipath; | 260 | // mText += ipath; |
259 | // mText += "\">"; | 261 | // mText += "\">"; |
260 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 262 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
261 | 263 | ||
262 | //mText += "<ul>\n"; | 264 | //mText += "<ul>\n"; |
263 | bool gotone = false; | 265 | bool gotone = false; |
264 | int priority = 1; | 266 | int priority = 1; |
265 | int priosFound = 0; | 267 | int priosFound = 0; |
266 | #ifdef DESKTOP_VERSION | 268 | #ifdef DESKTOP_VERSION |
267 | mText +="<p></p>"; | 269 | mText +="<p></p>"; |
268 | #endif | 270 | #endif |
269 | 271 | ||
270 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; | 272 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; |
271 | mText += "<ul>\n"; | 273 | mText += "<ul>\n"; |
272 | while (!gotone && priority<6) { | 274 | while (!gotone && priority<6) { |
273 | todo = todos.first(); | 275 | todo = todos.first(); |
274 | while(todo) { | 276 | while(todo) { |
275 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 277 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
276 | if ( appendTodo(todo) ) | 278 | if ( appendTodo(todo) ) |
277 | gotone = true; | 279 | gotone = true; |
278 | } | 280 | } |
279 | todo = todos.next(); | 281 | todo = todos.next(); |
280 | } | 282 | } |
281 | if ( gotone ) { | 283 | if ( gotone ) { |
282 | gotone = false; | 284 | gotone = false; |
283 | ++priosFound; | 285 | ++priosFound; |
284 | if ( priosFound == topmostPrios ) | 286 | if ( priosFound == topmostPrios ) |
285 | break; | 287 | break; |