-rw-r--r-- | korganizer/kowhatsnextview.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp index 2f7409d..8371523 100644 --- a/korganizer/kowhatsnextview.cpp +++ b/korganizer/kowhatsnextview.cpp | |||
@@ -86,399 +86,399 @@ KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, | |||
86 | mTimer = new QTimer( this ); | 86 | mTimer = new QTimer( this ); |
87 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); | 87 | connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); |
88 | 88 | ||
89 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 89 | connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
90 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); | 90 | connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); |
91 | } | 91 | } |
92 | 92 | ||
93 | KOWhatsNextView::~KOWhatsNextView() | 93 | KOWhatsNextView::~KOWhatsNextView() |
94 | { | 94 | { |
95 | } | 95 | } |
96 | 96 | ||
97 | int KOWhatsNextView::maxDatesHint() | 97 | int KOWhatsNextView::maxDatesHint() |
98 | { | 98 | { |
99 | return 0; | 99 | return 0; |
100 | } | 100 | } |
101 | 101 | ||
102 | int KOWhatsNextView::currentDateCount() | 102 | int KOWhatsNextView::currentDateCount() |
103 | { | 103 | { |
104 | return 0; | 104 | return 0; |
105 | } | 105 | } |
106 | 106 | ||
107 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() | 107 | QPtrList<Incidence> KOWhatsNextView::selectedIncidences() |
108 | { | 108 | { |
109 | QPtrList<Incidence> eventList; | 109 | QPtrList<Incidence> eventList; |
110 | 110 | ||
111 | return eventList; | 111 | return eventList; |
112 | } | 112 | } |
113 | 113 | ||
114 | 114 | ||
115 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, | 115 | void KOWhatsNextView::printPreview(CalPrinter *calPrinter, const QDate &fd, |
116 | const QDate &td) | 116 | const QDate &td) |
117 | { | 117 | { |
118 | #ifndef KORG_NOPRINTER | 118 | #ifndef KORG_NOPRINTER |
119 | calPrinter->preview(CalPrinter::Day, fd, td); | 119 | calPrinter->preview(CalPrinter::Day, fd, td); |
120 | #endif | 120 | #endif |
121 | } | 121 | } |
122 | void KOWhatsNextView::updateConfig() | 122 | void KOWhatsNextView::updateConfig() |
123 | { | 123 | { |
124 | setFont( KOPrefs::instance()->mWhatsNextFont ); | 124 | setFont( KOPrefs::instance()->mWhatsNextFont ); |
125 | updateView(); | 125 | updateView(); |
126 | 126 | ||
127 | } | 127 | } |
128 | void KOWhatsNextView::showEvent ( QShowEvent * e ) | 128 | void KOWhatsNextView::showEvent ( QShowEvent * e ) |
129 | { | 129 | { |
130 | //qDebug("KOWhatsNextView::showEvent "); | 130 | //qDebug("KOWhatsNextView::showEvent "); |
131 | restartTimer(); | 131 | restartTimer(); |
132 | QWidget::showEvent ( e ); | 132 | QWidget::showEvent ( e ); |
133 | } | 133 | } |
134 | void KOWhatsNextView::hideEvent ( QHideEvent * e) | 134 | void KOWhatsNextView::hideEvent ( QHideEvent * e) |
135 | { | 135 | { |
136 | //qDebug(" KOWhatsNextView::hideEvent"); | 136 | //qDebug(" KOWhatsNextView::hideEvent"); |
137 | mTimer->stop(); | 137 | mTimer->stop(); |
138 | QWidget::hideEvent ( e ); | 138 | QWidget::hideEvent ( e ); |
139 | } | 139 | } |
140 | void KOWhatsNextView::restartTimer() | 140 | void KOWhatsNextView::restartTimer() |
141 | { | 141 | { |
142 | //qDebug("KOWhatsNextView::restartTimer() "); | 142 | //qDebug("KOWhatsNextView::restartTimer() "); |
143 | mTimer->start( 300000 ); | 143 | mTimer->start( 300000 ); |
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 | } |
195 | appendEvent(todo); | 195 | appendEvent(todo); |
196 | } | 196 | } |
197 | todo = todos.next(); | 197 | todo = todos.next(); |
198 | } | 198 | } |
199 | } | 199 | } |
200 | 200 | ||
201 | 201 | ||
202 | if (events.count() > 0) { | 202 | if (events.count() > 0) { |
203 | // mText += "<p></p>"; | 203 | // mText += "<p></p>"; |
204 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 204 | // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
205 | // mText += "<h2>"; | 205 | // mText += "<h2>"; |
206 | //mText += " <img src=\""; | 206 | //mText += " <img src=\""; |
207 | //mText += ipath; | 207 | //mText += ipath; |
208 | //mText += "\">"; | 208 | //mText += "\">"; |
209 | if ( ! itemAdded ) { | 209 | if ( ! itemAdded ) { |
210 | appendDay ( iii, mEventDate ); | 210 | appendDay ( iii, mEventDate ); |
211 | 211 | ||
212 | } | 212 | } |
213 | // for first day (iii == 0) | 213 | // for first day (iii == 0) |
214 | // we may have syncevents, or events in the past, which maybe should nor be diaplayed | 214 | // 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 | 215 | // for that reason we cannot append <table> in appendDay () for iii == 0 |
216 | // we must append it in the first successful call of appendEvent() | 216 | // we must append it in the first successful call of appendEvent() |
217 | Event *ev = events.first(); | 217 | Event *ev = events.first(); |
218 | while(ev) { | 218 | while(ev) { |
219 | //qDebug("+++++event append %s", ev->summary().latin1()); | 219 | //qDebug("+++++event append %s", ev->summary().latin1()); |
220 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { | 220 | if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { |
221 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) | 221 | if ( appendEvent(ev, false , iii!= 0,!itemAdded ) ) |
222 | itemAdded = true; | 222 | itemAdded = true; |
223 | } | 223 | } |
224 | ev = events.next(); | 224 | ev = events.next(); |
225 | } | 225 | } |
226 | 226 | ||
227 | //mText += "</table>\n"; | 227 | //mText += "</table>\n"; |
228 | } | 228 | } |
229 | 229 | ||
230 | todo = todos.first(); | 230 | todo = todos.first(); |
231 | while(todo) { | 231 | while(todo) { |
232 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { | 232 | if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { |
233 | if ( ! itemAdded ) { | 233 | if ( ! itemAdded ) { |
234 | appendDay ( iii, mEventDate ); | 234 | appendDay ( iii, mEventDate ); |
235 | itemAdded = true; | 235 | itemAdded = true; |
236 | } | 236 | } |
237 | appendEvent(todo); | 237 | appendEvent(todo); |
238 | } | 238 | } |
239 | todo = todos.next(); | 239 | todo = todos.next(); |
240 | } | 240 | } |
241 | if ( !itemAdded && iii == 0 ) { | 241 | if ( !itemAdded && iii == 0 ) { |
242 | // appendDay ( iii, mEventDate ); | 242 | // appendDay ( iii, mEventDate ); |
243 | //mText += "<table>"; | 243 | //mText += "<table>"; |
244 | // mText += "<b><font color=\"#000080\"><em>"+i18n("No event, nothing to do.") +"</em></font></b>\n"; | 244 | // 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"; | 245 | mText += "<h3 align=\"center\"><font color=\"#008000\"><em>"+i18n("No event, nothing to do. ") +"</em></font></h3>\n"; |
246 | //mText +="</table>"; | 246 | //mText +="</table>"; |
247 | } | 247 | } |
248 | if ( itemAdded ) | 248 | if ( itemAdded ) |
249 | mText += "</table>\n"; | 249 | mText += "</table>\n"; |
250 | mEventDate = mEventDate.addDays( 1 ); | 250 | mEventDate = mEventDate.addDays( 1 ); |
251 | } | 251 | } |
252 | 252 | ||
253 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; | 253 | int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; |
254 | if (todos.count() > 0 && topmostPrios > 0 ) { | 254 | if (todos.count() > 0 && topmostPrios > 0 ) { |
255 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 255 | // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
256 | // mText += "<h2>"; | 256 | // mText += "<h2>"; |
257 | //<img src=\""; | 257 | //<img src=\""; |
258 | // mText += ipath; | 258 | // mText += ipath; |
259 | // mText += "\">"; | 259 | // mText += "\">"; |
260 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; | 260 | // mText += i18n("Overdue To-Do:") + "</h2>\n"; |
261 | 261 | ||
262 | //mText += "<ul>\n"; | 262 | //mText += "<ul>\n"; |
263 | bool gotone = false; | 263 | bool gotone = false; |
264 | int priority = 1; | 264 | int priority = 1; |
265 | int priosFound = 0; | 265 | int priosFound = 0; |
266 | #ifdef DESKTOP_VERSION | 266 | #ifdef DESKTOP_VERSION |
267 | mText +="<p></p>"; | 267 | mText +="<p></p>"; |
268 | #endif | 268 | #endif |
269 | 269 | ||
270 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; | 270 | mText +="<h2><em><font color=\"#000080\">" + i18n("Incomplete Todo:") + "</font></em></h2>\n"; |
271 | mText += "<ul>\n"; | 271 | mText += "<ul>\n"; |
272 | while (!gotone && priority<6) { | 272 | while (!gotone && priority<6) { |
273 | todo = todos.first(); | 273 | todo = todos.first(); |
274 | while(todo) { | 274 | while(todo) { |
275 | if (!todo->isCompleted() && (todo->priority() == priority) ) { | 275 | if (!todo->isCompleted() && (todo->priority() == priority) ) { |
276 | if ( appendTodo(todo) ) | 276 | if ( appendTodo(todo) ) |
277 | gotone = true; | 277 | gotone = true; |
278 | } | 278 | } |
279 | todo = todos.next(); | 279 | todo = todos.next(); |
280 | } | 280 | } |
281 | if ( gotone ) { | 281 | if ( gotone ) { |
282 | gotone = false; | 282 | gotone = false; |
283 | ++priosFound; | 283 | ++priosFound; |
284 | if ( priosFound == topmostPrios ) | 284 | if ( priosFound == topmostPrios ) |
285 | break; | 285 | break; |
286 | } | 286 | } |
287 | priority++; | 287 | priority++; |
288 | // kdDebug() << "adding the todos..." << endl; | 288 | // kdDebug() << "adding the todos..." << endl; |
289 | } | 289 | } |
290 | mText += "</ul>\n"; | 290 | mText += "</ul>\n"; |
291 | } | 291 | } |
292 | 292 | ||
293 | int replys = 0; | 293 | int replys = 0; |
294 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); | 294 | events = calendar()->events(QDate::currentDate(), QDate(2975,12,6)); |
295 | if (events.count() > 0) { | 295 | if (events.count() > 0) { |
296 | Event *ev = events.first(); | 296 | Event *ev = events.first(); |
297 | while(ev) { | 297 | while(ev) { |
298 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 298 | Attendee *me = ev->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
299 | if (me!=0) { | 299 | if (me!=0) { |
300 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 300 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
301 | if (replys == 0) { | 301 | if (replys == 0) { |
302 | mText += "<p></p>"; | 302 | mText += "<p></p>"; |
303 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); | 303 | // kil.loadIcon("reply",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); |
304 | //mText += "<h2>"; | 304 | //mText += "<h2>"; |
305 | //<img src=\""; | 305 | //<img src=\""; |
306 | // mText += ipath; | 306 | // mText += ipath; |
307 | // mText += "\">"; | 307 | // mText += "\">"; |
308 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; | 308 | //mText += i18n("Events and To-Dos that need a reply:") + "</h2>\n"; |
309 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 309 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
310 | mText += "<table>\n"; | 310 | mText += "<table>\n"; |
311 | } | 311 | } |
312 | replys++; | 312 | replys++; |
313 | appendEvent(ev,true); | 313 | appendEvent(ev,true); |
314 | } | 314 | } |
315 | } | 315 | } |
316 | ev = events.next(); | 316 | ev = events.next(); |
317 | } | 317 | } |
318 | } | 318 | } |
319 | todos = calendar()->todos(); | 319 | todos = calendar()->todos(); |
320 | if (todos.count() > 0) { | 320 | if (todos.count() > 0) { |
321 | Todo *to = todos.first(); | 321 | Todo *to = todos.first(); |
322 | while(to) { | 322 | while(to) { |
323 | if ( !to->isCompleted() ){ | 323 | if ( !to->isCompleted() ){ |
324 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); | 324 | Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); |
325 | if (me!=0) { | 325 | if (me!=0) { |
326 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { | 326 | if (me->status()==Attendee::NeedsAction && me->RSVP()) { |
327 | if (replys == 0) { | 327 | if (replys == 0) { |
328 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; | 328 | mText +="<h2><em><font color=\"#000080\">" + i18n("Events and To-Dos that need a reply:") + "</font></em></h2>\n"; |
329 | mText += "<table>\n"; | 329 | mText += "<table>\n"; |
330 | } | 330 | } |
331 | replys++; | 331 | replys++; |
332 | appendEvent(to, true); | 332 | appendEvent(to, true); |
333 | } | 333 | } |
334 | } | 334 | } |
335 | } | 335 | } |
336 | to = todos.next(); | 336 | to = todos.next(); |
337 | } | 337 | } |
338 | } | 338 | } |
339 | if (replys > 0 ) mText += "</table>\n"; | 339 | if (replys > 0 ) mText += "</table>\n"; |
340 | 340 | ||
341 | 341 | ||
342 | mText += "</td></tr>\n</table>\n"; | 342 | mText += "</td></tr>\n</table>\n"; |
343 | 343 | ||
344 | mView->setText(mText); | 344 | mView->setText(mText); |
345 | mView->setFocus(); | 345 | mView->setFocus(); |
346 | 346 | ||
347 | // QPixmap bPix = SmallIcon( "back" ); | 347 | // QPixmap bPix = SmallIcon( "back" ); |
348 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); | 348 | // qDebug("xxxxxxxxxxxxxxxxxxxxx "); |
349 | // QWidget* test = new QWidget(); | 349 | // QWidget* test = new QWidget(); |
350 | // test->setBackgroundMode(FixedPixmap ); | 350 | // test->setBackgroundMode(FixedPixmap ); |
351 | // test->setBackgroundPixmap ( bPix ); | 351 | // test->setBackgroundPixmap ( bPix ); |
352 | // test->resize( 300, 400 ); | 352 | // test->resize( 300, 400 ); |
353 | // test->show(); | 353 | // test->show(); |
354 | // mView->setBackgroundMode(FixedPixmap ); | 354 | // mView->setBackgroundMode(FixedPixmap ); |
355 | // mView->setBackgroundPixmap ( bPix ); | 355 | // mView->setBackgroundPixmap ( bPix ); |
356 | qDebug("%s ",mText.latin1()); | 356 | // qDebug("%s ",mText.latin1()); |
357 | } | 357 | } |
358 | 358 | ||
359 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) | 359 | void KOWhatsNextView::appendDay( int i, QDate eventDate ) |
360 | { | 360 | { |
361 | QString date; | 361 | QString date; |
362 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); | 362 | QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); |
363 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { | 363 | if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { |
364 | if ( i == 0 ) { | 364 | if ( i == 0 ) { |
365 | //mText += "<table>\n"; | 365 | //mText += "<table>\n"; |
366 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; | 366 | return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; |
367 | } | 367 | } |
368 | else if ( i == 1 ) | 368 | else if ( i == 1 ) |
369 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; | 369 | date = "<em><font color=\"#000080\">" + day + "</font></em>" ; |
370 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; | 370 | else date = "<em><font color=\"#000080\">" + day + "</font></em>"; |
371 | mText += "<h2>" + date + "</h2>\n"; | 371 | mText += "<h2>" + date + "</h2>\n"; |
372 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 372 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
373 | mText += "<table>\n"; | 373 | mText += "<table>\n"; |
374 | 374 | ||
375 | 375 | ||
376 | 376 | ||
377 | } else { | 377 | } else { |
378 | if ( i == 0 ) { | 378 | if ( i == 0 ) { |
379 | //mText += "<table>\n"; | 379 | //mText += "<table>\n"; |
380 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; | 380 | return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; |
381 | } | 381 | } |
382 | 382 | ||
383 | #ifdef DESKTOP_VERSION | 383 | #ifdef DESKTOP_VERSION |
384 | else if ( i == 1 ) { | 384 | else if ( i == 1 ) { |
385 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; | 385 | date = "<h2><em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em></h2>" ; |
386 | } | 386 | } |
387 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; | 387 | else date = "<h2><em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em></h2>"; |
388 | #else | 388 | #else |
389 | else if ( i == 1 ) { | 389 | else if ( i == 1 ) { |
390 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; | 390 | date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; |
391 | } | 391 | } |
392 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; | 392 | else date = "<em><font color=\"#000080\">" + i18n("In %1 days: ").arg( i ) +day + "</font></em>"; |
393 | 393 | ||
394 | #endif | 394 | #endif |
395 | mText += "<h2>" + date + "</h2>\n"; | 395 | mText += "<h2>" + date + "</h2>\n"; |
396 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; | 396 | //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; |
397 | mText += "<table>\n"; | 397 | mText += "<table>\n"; |
398 | } | 398 | } |
399 | } | 399 | } |
400 | 400 | ||
401 | 401 | ||
402 | void KOWhatsNextView::showDates(const QDate &, const QDate &) | 402 | void KOWhatsNextView::showDates(const QDate &, const QDate &) |
403 | { | 403 | { |
404 | updateView(); | 404 | updateView(); |
405 | } | 405 | } |
406 | 406 | ||
407 | void KOWhatsNextView::showEvents(QPtrList<Event>) | 407 | void KOWhatsNextView::showEvents(QPtrList<Event>) |
408 | { | 408 | { |
409 | } | 409 | } |
410 | 410 | ||
411 | void KOWhatsNextView::changeEventDisplay(Event *, int action) | 411 | void KOWhatsNextView::changeEventDisplay(Event *, int action) |
412 | { | 412 | { |
413 | switch(action) { | 413 | switch(action) { |
414 | case KOGlobals::EVENTADDED: | 414 | case KOGlobals::EVENTADDED: |
415 | updateView(); | 415 | updateView(); |
416 | break; | 416 | break; |
417 | case KOGlobals::EVENTEDITED: | 417 | case KOGlobals::EVENTEDITED: |
418 | updateView(); | 418 | updateView(); |
419 | break; | 419 | break; |
420 | case KOGlobals::EVENTDELETED: | 420 | case KOGlobals::EVENTDELETED: |
421 | updateView(); | 421 | updateView(); |
422 | break; | 422 | break; |
423 | default: | 423 | default: |
424 | updateView(); | 424 | updateView(); |
425 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; | 425 | kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; |
426 | } | 426 | } |
427 | } | 427 | } |
428 | 428 | ||
429 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) | 429 | bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable ) |
430 | { | 430 | { |
431 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) | 431 | if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) |
432 | return false; | 432 | return false; |
433 | QDateTime cdt = QDateTime::currentDateTime(); | 433 | QDateTime cdt = QDateTime::currentDateTime(); |
434 | QDateTime noc; | 434 | QDateTime noc; |
435 | QString tempText; | 435 | QString tempText; |
436 | if ( appendTable && !notRed ) { | 436 | if ( appendTable && !notRed ) { |
437 | tempText = "<table>"; | 437 | tempText = "<table>"; |
438 | } | 438 | } |
439 | bool ok = true; | 439 | bool ok = true; |
440 | if ( reply ) { | 440 | if ( reply ) { |
441 | noc = ev->getNextOccurence( cdt, &ok ); | 441 | noc = ev->getNextOccurence( cdt, &ok ); |
442 | if (! ok && ev->type() == "Event") | 442 | if (! ok && ev->type() == "Event") |
443 | return false; | 443 | return false; |
444 | } | 444 | } |
445 | tempText += "<tr><td><b>"; | 445 | tempText += "<tr><td><b>"; |
446 | if (ev->type()=="Event") { | 446 | if (ev->type()=="Event") { |
447 | if (reply) { | 447 | if (reply) { |
448 | if (!ev->doesFloat()) | 448 | if (!ev->doesFloat()) |
449 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; | 449 | tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; |
450 | else | 450 | else |
451 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; | 451 | tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; |
452 | 452 | ||
453 | } else { | 453 | } else { |
454 | if (!ev->doesFloat()) { | 454 | if (!ev->doesFloat()) { |
455 | Event *event = static_cast<Event *>(ev); | 455 | Event *event = static_cast<Event *>(ev); |
456 | QDateTime st,end; | 456 | QDateTime st,end; |
457 | if ( event->recurrence()->doesRecur() ) { | 457 | if ( event->recurrence()->doesRecur() ) { |
458 | QDate recDate= mEventDate; | 458 | QDate recDate= mEventDate; |
459 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); | 459 | int days = event->dtStart().date().daysTo (event->dtEnd().date() ); |
460 | while ( ! event->recursOn( recDate ) ) { | 460 | while ( ! event->recursOn( recDate ) ) { |
461 | recDate = recDate.addDays( -1 ); | 461 | recDate = recDate.addDays( -1 ); |
462 | 462 | ||
463 | } | 463 | } |
464 | st = QDateTime ( recDate, event->dtStart().time() ); | 464 | st = QDateTime ( recDate, event->dtStart().time() ); |
465 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); | 465 | end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); |
466 | } | 466 | } |
467 | else { | 467 | else { |
468 | st = event->dtStart(); | 468 | st = event->dtStart(); |
469 | end = event->dtEnd(); | 469 | end = event->dtEnd(); |
470 | } | 470 | } |
471 | 471 | ||
472 | 472 | ||
473 | QString dateText; | 473 | QString dateText; |
474 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); | 474 | // qDebug("%s %s %s %s ", mEventDate.toString().latin1(),event->summary().latin1(), st .toString().latin1(),end.toString().latin1() ); |
475 | if ( st.date() < mEventDate ) | 475 | if ( st.date() < mEventDate ) |
476 | dateText = "++:++-"; | 476 | dateText = "++:++-"; |
477 | else | 477 | else |
478 | dateText = event->dtStartTimeStr() + "-"; | 478 | dateText = event->dtStartTimeStr() + "-"; |
479 | if ( end.date() > mEventDate ) | 479 | if ( end.date() > mEventDate ) |
480 | dateText += "++:++"; | 480 | dateText += "++:++"; |
481 | else | 481 | else |
482 | dateText += event->dtEndTimeStr(); | 482 | dateText += event->dtEndTimeStr(); |
483 | if ( notRed ) | 483 | if ( notRed ) |
484 | tempText += dateText; | 484 | tempText += dateText; |