summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/kowhatsnextview.cpp42
-rw-r--r--korganizer/kowhatsnextview.h2
2 files changed, 22 insertions, 22 deletions
diff --git a/korganizer/kowhatsnextview.cpp b/korganizer/kowhatsnextview.cpp
index aa33588..2f7409d 100644
--- a/korganizer/kowhatsnextview.cpp
+++ b/korganizer/kowhatsnextview.cpp
@@ -49,64 +49,56 @@ void WhatsNextTextBrowser::setSource(const QString& n)
49 if (n.startsWith("event:")) { 49 if (n.startsWith("event:")) {
50 emit showIncidence(n); 50 emit showIncidence(n);
51 return; 51 return;
52 } else if (n.startsWith("todo:")) { 52 } else if (n.startsWith("todo:")) {
53 emit showIncidence(n); 53 emit showIncidence(n);
54 return; 54 return;
55 } else { 55 } else {
56 QTextBrowser::setSource(n); 56 QTextBrowser::setSource(n);
57 } 57 }
58} 58}
59 59
60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent, 60KOWhatsNextView::KOWhatsNextView(Calendar *calendar, QWidget *parent,
61 const char *name) 61 const char *name)
62 : KOrg::BaseView(calendar, parent, name) 62 : KOrg::BaseView(calendar, parent, name)
63{ 63{
64 // mDateLabel = 64 // mDateLabel =
65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this); 65 // new QLabel(KGlobal::locale()->formatDate(QDate::currentDate()),this);
66 // mDateLabel->setMargin(2); 66 // mDateLabel->setMargin(2);
67 // mDateLabel->setAlignment(AlignCenter); 67 // mDateLabel->setAlignment(AlignCenter);
68 setFont( KOPrefs::instance()->mWhatsNextFont ); 68 setFont( KOPrefs::instance()->mWhatsNextFont );
69 mView = new WhatsNextTextBrowser(this); 69 mView = new WhatsNextTextBrowser(this);
70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &))); 70 connect(mView,SIGNAL(showIncidence(const QString &)),SLOT(showIncidence(const QString &)));
71 QStyleSheet* stsh = mView->styleSheet(); 71 QStyleSheet* stsh = mView->styleSheet();
72 QStyleSheetItem * style ; 72 QStyleSheetItem * style ;
73 style = stsh->item ("a" );
74 if ( style ) {
75 style->setMargin(QStyleSheetItem::MarginAll,0);
76 }
77 style = stsh->item ("h2" ); 73 style = stsh->item ("h2" );
78 if ( style ) { 74 if ( style ) {
79 style->setMargin(QStyleSheetItem::MarginAll,0); 75 style->setMargin(QStyleSheetItem::MarginAll,0);
80 } 76 }
81 style = stsh->item ("h3" ); 77 style = stsh->item ("h3" );
82 if ( style ) { 78 if ( style ) {
83 style->setMargin(QStyleSheetItem::MarginAll,0); 79 style->setMargin(QStyleSheetItem::MarginAll,0);
84 } 80 }
85 style = stsh->item ("table" );
86 if ( style ) {
87 style->setMargin(QStyleSheetItem::MarginAll,0);
88 }
89 mEventViewer = 0; 81 mEventViewer = 0;
90 82
91 QBoxLayout *topLayout = new QVBoxLayout(this); 83 QBoxLayout *topLayout = new QVBoxLayout(this);
92 // topLayout->addWidget(mDateLabel); 84 // topLayout->addWidget(mDateLabel);
93 topLayout->addWidget(mView); 85 topLayout->addWidget(mView);
94 mTimer = new QTimer( this ); 86 mTimer = new QTimer( this );
95 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView())); 87 connect(mTimer,SIGNAL( timeout() ),this, SLOT(updateView()));
96 88
97 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 89 connect(mView->horizontalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
98 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer())); 90 connect(mView->verticalScrollBar (),SIGNAL( sliderReleased () ),this, SLOT(restartTimer()));
99} 91}
100 92
101KOWhatsNextView::~KOWhatsNextView() 93KOWhatsNextView::~KOWhatsNextView()
102{ 94{
103} 95}
104 96
105int KOWhatsNextView::maxDatesHint() 97int KOWhatsNextView::maxDatesHint()
106{ 98{
107 return 0; 99 return 0;
108} 100}
109 101
110int KOWhatsNextView::currentDateCount() 102int KOWhatsNextView::currentDateCount()
111{ 103{
112 return 0; 104 return 0;
@@ -140,49 +132,49 @@ void KOWhatsNextView::showEvent ( QShowEvent * e )
140 QWidget::showEvent ( e ); 132 QWidget::showEvent ( e );
141} 133}
142void KOWhatsNextView::hideEvent ( QHideEvent * e) 134void KOWhatsNextView::hideEvent ( QHideEvent * e)
143{ 135{
144 //qDebug(" KOWhatsNextView::hideEvent"); 136 //qDebug(" KOWhatsNextView::hideEvent");
145 mTimer->stop(); 137 mTimer->stop();
146 QWidget::hideEvent ( e ); 138 QWidget::hideEvent ( e );
147} 139}
148void KOWhatsNextView::restartTimer() 140void KOWhatsNextView::restartTimer()
149{ 141{
150 //qDebug("KOWhatsNextView::restartTimer() "); 142 //qDebug("KOWhatsNextView::restartTimer() ");
151 mTimer->start( 300000 ); 143 mTimer->start( 300000 );
152 //mTimer->start( 5000 ); 144 //mTimer->start( 5000 );
153} 145}
154void KOWhatsNextView::updateView() 146void KOWhatsNextView::updateView()
155{ 147{
156 if ( mTimer->isActive() ) 148 if ( mTimer->isActive() )
157 restartTimer(); 149 restartTimer();
158 //qDebug("KOWhatsNextView::updateView() "); 150 //qDebug("KOWhatsNextView::updateView() ");
159 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate())); 151 // mDateLabel->setText(KGlobal::locale()->formatDate(QDate::currentDate()));
160 KIconLoader kil("korganizer"); 152 KIconLoader kil("korganizer");
161 QString ipath;// = new QString(); 153 QString ipath;// = new QString();
162 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath); 154 // kil.loadIcon("korganizer",KIcon::NoGroup,32,KIcon::DefaultState,&ipath);
163 //<big><big><strong>" + date + "</strong></big></big>\n"; 155 //<big><big><strong>" + date + "</strong></big></big>\n";
164 mText = "<qt><table width=\"100%\">\n"; 156 mText = "<table width=\"100%\">\n";
165 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>"; 157 //mText += "<tr bgcolor=\"#3679AD\"><td><h2>";
166#ifdef DESKTOP_VERSION 158#ifdef DESKTOP_VERSION
167 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>"; 159 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h1>";
168#else 160#else
169 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>"; 161 mText += "<tr bgcolor=\"#5699CD\"><td align=\"center\"><h2>";
170#endif 162#endif
171 // mText += "<img src=\""; 163 // mText += "<img src=\"";
172 // mText += ipath; 164 // mText += ipath;
173 // mText += "\">"; 165 // mText += "\">";
174 mEventDate = QDate::currentDate(); 166 mEventDate = QDate::currentDate();
175#ifdef DESKTOP_VERSION 167#ifdef DESKTOP_VERSION
176 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>";
177#else 169#else
178 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>";
179#endif 171#endif
180 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>"; 172 mText += "</td></tr>\n<tr bgcolor=\"#EAF8FA\"><td>";
181 int iii; 173 int iii;
182 mTodos.clear(); 174 mTodos.clear();
183 QPtrList<Event> events; 175 QPtrList<Event> events;
184 QPtrList<Todo> todos = calendar()->todos(); 176 QPtrList<Todo> todos = calendar()->todos();
185 Todo * todo; 177 Todo * todo;
186 //mText += "<h2>" + i18n("Events: ") + "</h2>\n"; 178 //mText += "<h2>" + i18n("Events: ") + "</h2>\n";
187 int daysToShow = KOPrefs::instance()->mWhatsNextDays ; 179 int daysToShow = KOPrefs::instance()->mWhatsNextDays ;
188 bool itemAdded = false; 180 bool itemAdded = false;
@@ -195,82 +187,86 @@ void KOWhatsNextView::updateView()
195 todo = todos.first(); 187 todo = todos.first();
196 while(todo) { 188 while(todo) {
197 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) { 189 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() < mEventDate ) {
198 if ( ! itemAdded ) { 190 if ( ! itemAdded ) {
199 appendDay ( iii, mEventDate ); 191 appendDay ( iii, mEventDate );
200 itemAdded = true; 192 itemAdded = true;
201 193
202 } 194 }
203 appendEvent(todo); 195 appendEvent(todo);
204 } 196 }
205 todo = todos.next(); 197 todo = todos.next();
206 } 198 }
207 } 199 }
208 200
209 201
210 if (events.count() > 0) { 202 if (events.count() > 0) {
211 // mText += "<p></p>"; 203 // mText += "<p></p>";
212 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 204 // kil.loadIcon("month",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
213 // mText += "<h2>"; 205 // mText += "<h2>";
214 //mText += " <img src=\""; 206 //mText += " <img src=\"";
215 //mText += ipath; 207 //mText += ipath;
216 //mText += "\">"; 208 //mText += "\">";
217 if ( ! itemAdded ) { 209 if ( ! itemAdded ) {
218 appendDay ( iii, mEventDate ); 210 appendDay ( iii, mEventDate );
219 itemAdded = true;
220 211
221 } 212 }
213 // for first day (iii == 0)
214 // we may have syncevents, or events in the past, which maybe should nor be diaplayed
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()
222 Event *ev = events.first(); 217 Event *ev = events.first();
223 while(ev) { 218 while(ev) {
224 //qDebug("+++++event append %s", ev->summary().latin1()); 219 //qDebug("+++++event append %s", ev->summary().latin1());
225 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) { 220 if ( true /*!ev->recurrence()->doesRecur() || ev->recursOn( mEventDate)*/) {
226 appendEvent(ev, false , iii!= 0 ); 221 if ( appendEvent(ev, false , iii!= 0,!itemAdded ) )
222 itemAdded = true;
227 } 223 }
228 ev = events.next(); 224 ev = events.next();
229 } 225 }
230 226
231 //mText += "</table>\n"; 227 //mText += "</table>\n";
232 } 228 }
233 229
234 todo = todos.first(); 230 todo = todos.first();
235 while(todo) { 231 while(todo) {
236 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) { 232 if ( !todo->isCompleted() &&todo->hasDueDate() && todo->dtDue().date() == mEventDate ) {
237 if ( ! itemAdded ) { 233 if ( ! itemAdded ) {
238 appendDay ( iii, mEventDate ); 234 appendDay ( iii, mEventDate );
239 itemAdded = true; 235 itemAdded = true;
240 } 236 }
241 appendEvent(todo); 237 appendEvent(todo);
242 } 238 }
243 todo = todos.next(); 239 todo = todos.next();
244 } 240 }
245 if ( !itemAdded && iii == 0 ) { 241 if ( !itemAdded && iii == 0 ) {
246 // appendDay ( iii, mEventDate ); 242 // appendDay ( iii, mEventDate );
247 //mText += "<table>"; 243 //mText += "<table>";
248 // 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";
249 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";
250 //mText +="</table>"; 246 //mText +="</table>";
251 } 247 }
252 if ( itemAdded ) 248 if ( itemAdded )
253 mText += "</table>\n"; 249 mText += "</table>\n";
254 mEventDate = mEventDate.addDays( 1 ); 250 mEventDate = mEventDate.addDays( 1 );
255 } 251 }
256 252
257 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios; 253 int topmostPrios = KOPrefs::instance()->mWhatsNextPrios;
258 if (todos.count() > 0 && topmostPrios > 0 ) { 254 if (todos.count() > 0 && topmostPrios > 0 ) {
259 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath); 255 // kil.loadIcon("todo",KIcon::NoGroup,22,KIcon::DefaultState,&ipath);
260 // mText += "<h2>"; 256 // mText += "<h2>";
261 //<img src=\""; 257 //<img src=\"";
262 // mText += ipath; 258 // mText += ipath;
263 // mText += "\">"; 259 // mText += "\">";
264 // mText += i18n("Overdue To-Do:") + "</h2>\n"; 260 // mText += i18n("Overdue To-Do:") + "</h2>\n";
265 261
266 //mText += "<ul>\n"; 262 //mText += "<ul>\n";
267 bool gotone = false; 263 bool gotone = false;
268 int priority = 1; 264 int priority = 1;
269 int priosFound = 0; 265 int priosFound = 0;
270#ifdef DESKTOP_VERSION 266#ifdef DESKTOP_VERSION
271 mText +="<p></p>"; 267 mText +="<p></p>";
272#endif 268#endif
273 269
274 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";
275 mText += "<ul>\n"; 271 mText += "<ul>\n";
276 while (!gotone && priority<6) { 272 while (!gotone && priority<6) {
@@ -322,86 +318,86 @@ void KOWhatsNextView::updateView()
322 } 318 }
323 todos = calendar()->todos(); 319 todos = calendar()->todos();
324 if (todos.count() > 0) { 320 if (todos.count() > 0) {
325 Todo *to = todos.first(); 321 Todo *to = todos.first();
326 while(to) { 322 while(to) {
327 if ( !to->isCompleted() ){ 323 if ( !to->isCompleted() ){
328 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email()); 324 Attendee *me = to->attendeeByMails(KOPrefs::instance()->mAdditionalMails,KOPrefs::instance()->email());
329 if (me!=0) { 325 if (me!=0) {
330 if (me->status()==Attendee::NeedsAction && me->RSVP()) { 326 if (me->status()==Attendee::NeedsAction && me->RSVP()) {
331 if (replys == 0) { 327 if (replys == 0) {
332 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";
333 mText += "<table>\n"; 329 mText += "<table>\n";
334 } 330 }
335 replys++; 331 replys++;
336 appendEvent(to, true); 332 appendEvent(to, true);
337 } 333 }
338 } 334 }
339 } 335 }
340 to = todos.next(); 336 to = todos.next();
341 } 337 }
342 } 338 }
343 if (replys > 0 ) mText += "</table>\n"; 339 if (replys > 0 ) mText += "</table>\n";
344 340
345 341
346 mText += "</td></tr>\n</table></qt>\n"; 342 mText += "</td></tr>\n</table>\n";
347 343
348 mView->setText(mText); 344 mView->setText(mText);
349 mView->setFocus(); 345 mView->setFocus();
350 346
351 // QPixmap bPix = SmallIcon( "back" ); 347 // QPixmap bPix = SmallIcon( "back" );
352 // qDebug("xxxxxxxxxxxxxxxxxxxxx "); 348 // qDebug("xxxxxxxxxxxxxxxxxxxxx ");
353 // QWidget* test = new QWidget(); 349 // QWidget* test = new QWidget();
354 // test->setBackgroundMode(FixedPixmap ); 350 // test->setBackgroundMode(FixedPixmap );
355 // test->setBackgroundPixmap ( bPix ); 351 // test->setBackgroundPixmap ( bPix );
356 // test->resize( 300, 400 ); 352 // test->resize( 300, 400 );
357 // test->show(); 353 // test->show();
358 // mView->setBackgroundMode(FixedPixmap ); 354 // mView->setBackgroundMode(FixedPixmap );
359 // mView->setBackgroundPixmap ( bPix ); 355 // mView->setBackgroundPixmap ( bPix );
360 // qDebug("%s ",mText.latin1()); 356 qDebug("%s ",mText.latin1());
361} 357}
362 358
363void KOWhatsNextView::appendDay( int i, QDate eventDate ) 359void KOWhatsNextView::appendDay( int i, QDate eventDate )
364{ 360{
365 QString date; 361 QString date;
366 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer); 362 QString day = KGlobal::locale()->formatDate( eventDate , KOPrefs::instance()->mShortDateInViewer);
367 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) { 363 if ( ! KOPrefs::instance()->mShortDateInViewer && QApplication::desktop()->width() < 320 ) {
368 if ( i == 0 ) { 364 if ( i == 0 ) {
369 mText += "<table>\n"; 365 //mText += "<table>\n";
370 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>"; 366 return;//date = "<em><font color=\"#008000\"><em>" + day+"</font></em>";
371 } 367 }
372 else if ( i == 1 ) 368 else if ( i == 1 )
373 date = "<em><font color=\"#000080\">" + day + "</font></em>" ; 369 date = "<em><font color=\"#000080\">" + day + "</font></em>" ;
374 else date = "<em><font color=\"#000080\">" + day + "</font></em>"; 370 else date = "<em><font color=\"#000080\">" + day + "</font></em>";
375 mText += "<h2>" + date + "</h2>\n"; 371 mText += "<h2>" + date + "</h2>\n";
376 //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 372 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
377 mText += "<table>\n"; 373 mText += "<table>\n";
378 374
379 375
380 376
381 } else { 377 } else {
382 if ( i == 0 ) { 378 if ( i == 0 ) {
383 mText += "<table>\n"; 379 //mText += "<table>\n";
384 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>"; 380 return;// date = "<font color=\"#008000\"><em>" +i18n("Today: ") +"</em>" + day+"</font>";
385 } 381 }
386 382
387#ifdef DESKTOP_VERSION 383#ifdef DESKTOP_VERSION
388 else if ( i == 1 ) { 384 else if ( i == 1 ) {
389 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>" ;
390 } 386 }
391 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>";
392#else 388#else
393 else if ( i == 1 ) { 389 else if ( i == 1 ) {
394 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ; 390 date = "<em><font color=\"#000080\">" + i18n("Tomorrow: ") + day +"</font></em>" ;
395 } 391 }
396 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>";
397 393
398#endif 394#endif
399 mText += "<h2>" + date + "</h2>\n"; 395 mText += "<h2>" + date + "</h2>\n";
400 //mText += "<big><big><strong>" + date + "</strong></big></big>\n"; 396 //mText += "<big><big><strong>" + date + "</strong></big></big>\n";
401 mText += "<table>\n"; 397 mText += "<table>\n";
402 } 398 }
403} 399}
404 400
405 401
406void KOWhatsNextView::showDates(const QDate &, const QDate &) 402void KOWhatsNextView::showDates(const QDate &, const QDate &)
407{ 403{
@@ -409,105 +405,108 @@ void KOWhatsNextView::showDates(const QDate &, const QDate &)
409} 405}
410 406
411void KOWhatsNextView::showEvents(QPtrList<Event>) 407void KOWhatsNextView::showEvents(QPtrList<Event>)
412{ 408{
413} 409}
414 410
415void KOWhatsNextView::changeEventDisplay(Event *, int action) 411void KOWhatsNextView::changeEventDisplay(Event *, int action)
416{ 412{
417 switch(action) { 413 switch(action) {
418 case KOGlobals::EVENTADDED: 414 case KOGlobals::EVENTADDED:
419 updateView(); 415 updateView();
420 break; 416 break;
421 case KOGlobals::EVENTEDITED: 417 case KOGlobals::EVENTEDITED:
422 updateView(); 418 updateView();
423 break; 419 break;
424 case KOGlobals::EVENTDELETED: 420 case KOGlobals::EVENTDELETED:
425 updateView(); 421 updateView();
426 break; 422 break;
427 default: 423 default:
428 updateView(); 424 updateView();
429 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl; 425 kdDebug() << "KOWhatsNextView::changeEventDisplay(): Illegal action " << action << endl;
430 } 426 }
431} 427}
432 428
433void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed ) 429bool KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed, bool appendTable )
434{ 430{
435 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") ) 431 if ( !KOPrefs::instance()->mShowSyncEvents && ev->uid().left(15) == QString("last-syncEvent-") )
436 return; 432 return false;
437 QDateTime cdt = QDateTime::currentDateTime(); 433 QDateTime cdt = QDateTime::currentDateTime();
438 QDateTime noc; 434 QDateTime noc;
439 QString tempText; 435 QString tempText;
436 if ( appendTable && !notRed ) {
437 tempText = "<table>";
438 }
440 bool ok = true; 439 bool ok = true;
441 if ( reply ) { 440 if ( reply ) {
442 noc = ev->getNextOccurence( cdt, &ok ); 441 noc = ev->getNextOccurence( cdt, &ok );
443 if (! ok && ev->type() == "Event") 442 if (! ok && ev->type() == "Event")
444 return; 443 return false;
445 } 444 }
446 tempText += "<tr><td><b>"; 445 tempText += "<tr><td><b>";
447 if (ev->type()=="Event") { 446 if (ev->type()=="Event") {
448 if (reply) { 447 if (reply) {
449 if (!ev->doesFloat()) 448 if (!ev->doesFloat())
450 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": "; 449 tempText += KGlobal::locale()->formatDateTime( noc , KOPrefs::instance()->mShortDateInViewer) +": ";
451 else 450 else
452 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 451 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
453 452
454 } else { 453 } else {
455 if (!ev->doesFloat()) { 454 if (!ev->doesFloat()) {
456 Event *event = static_cast<Event *>(ev); 455 Event *event = static_cast<Event *>(ev);
457 QDateTime st,end; 456 QDateTime st,end;
458 if ( event->recurrence()->doesRecur() ) { 457 if ( event->recurrence()->doesRecur() ) {
459 QDate recDate= mEventDate; 458 QDate recDate= mEventDate;
460 int days = event->dtStart().date().daysTo (event->dtEnd().date() ); 459 int days = event->dtStart().date().daysTo (event->dtEnd().date() );
461 while ( ! event->recursOn( recDate ) ) { 460 while ( ! event->recursOn( recDate ) ) {
462 recDate = recDate.addDays( -1 ); 461 recDate = recDate.addDays( -1 );
463 462
464 } 463 }
465 st = QDateTime ( recDate, event->dtStart().time() ); 464 st = QDateTime ( recDate, event->dtStart().time() );
466 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() ); 465 end = QDateTime ( recDate.addDays( days ), event->dtEnd().time() );
467 } 466 }
468 else { 467 else {
469 st = event->dtStart(); 468 st = event->dtStart();
470 end = event->dtEnd(); 469 end = event->dtEnd();
471 } 470 }
472 471
473 472
474 QString dateText; 473 QString dateText;
475 // 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() );
476 if ( st.date() < mEventDate ) 475 if ( st.date() < mEventDate )
477 dateText = "++:++-"; 476 dateText = "++:++-";
478 else 477 else
479 dateText = event->dtStartTimeStr() + "-"; 478 dateText = event->dtStartTimeStr() + "-";
480 if ( end.date() > mEventDate ) 479 if ( end.date() > mEventDate )
481 dateText += "++:++"; 480 dateText += "++:++";
482 else 481 else
483 dateText += event->dtEndTimeStr(); 482 dateText += event->dtEndTimeStr();
484 if ( notRed ) 483 if ( notRed )
485 tempText += dateText; 484 tempText += dateText;
486 else { 485 else {
487 if ( end < cdt ) { 486 if ( end < cdt ) {
488 if ( !KOPrefs::instance()->mWNViewShowsPast ) 487 if ( !KOPrefs::instance()->mWNViewShowsPast )
489 return; 488 return false;
490 tempText += "<font color=\"#F00000\">" + dateText + "</font>"; 489 tempText += "<font color=\"#F00000\">" + dateText + "</font>";
491 } 490 }
492 else if ( st < cdt ) 491 else if ( st < cdt )
493 tempText += "<font color=\"#008000\">" + dateText + "</font>"; 492 tempText += "<font color=\"#008000\">" + dateText + "</font>";
494 else 493 else
495 tempText += dateText; 494 tempText += dateText;
496 495
497 } 496 }
498 497
499 } else { 498 } else {
500 tempText += i18n("Allday:"); 499 tempText += i18n("Allday:");
501 500
502 } 501 }
503 } 502 }
504 } else { 503 } else {
505 mTodos.append( ev ); 504 mTodos.append( ev );
506 tempText += i18n("ToDo:"); 505 tempText += i18n("ToDo:");
507 if (reply) { 506 if (reply) {
508 tempText += " "; 507 tempText += " ";
509 if ( noc != cdt ) { 508 if ( noc != cdt ) {
510 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": "; 509 tempText += KGlobal::locale()->formatDate( noc.date() , KOPrefs::instance()->mShortDateInViewer) +": ";
511 } 510 }
512 } else { 511 } else {
513 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) { 512 if ( ((Todo*)ev)->dtDue().date() < QDate::currentDate() ) {
@@ -554,48 +553,49 @@ void KOWhatsNextView::appendEvent(Incidence *ev, bool reply, bool notRed )
554 tempText += "r"; 553 tempText += "r";
555 needClose =true; 554 needClose =true;
556 } 555 }
557 if ( needClose ) { 556 if ( needClose ) {
558 tempText += "] "; 557 tempText += "] ";
559 } 558 }
560 if ( ev->cancelled() ) 559 if ( ev->cancelled() )
561 tempText += "</font>"; 560 tempText += "</font>";
562 tempText += "<a "; 561 tempText += "<a ";
563 if (ev->type()=="Event") tempText += "href=\"event:"; 562 if (ev->type()=="Event") tempText += "href=\"event:";
564 if (ev->type()=="Todo") tempText += "href=\"todo:"; 563 if (ev->type()=="Todo") tempText += "href=\"todo:";
565 tempText += ev->uid() + "\">"; 564 tempText += ev->uid() + "\">";
566 if ( ev->summary().length() > 0 ) 565 if ( ev->summary().length() > 0 )
567 tempText += ev->summary(); 566 tempText += ev->summary();
568 else 567 else
569 tempText += i18n("-no summary-"); 568 tempText += i18n("-no summary-");
570 tempText += "</a>"; 569 tempText += "</a>";
571 if ( KOPrefs::instance()->mWNViewShowLocation ) 570 if ( KOPrefs::instance()->mWNViewShowLocation )
572 if ( !ev->location().isEmpty() ) 571 if ( !ev->location().isEmpty() )
573 tempText += " ("+ev->location() +")"; 572 tempText += " ("+ev->location() +")";
574 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents) 573 if ( ev->relatedTo() && KOPrefs::instance()->mWNViewShowsParents)
575 tempText += " ["+ev->relatedTo()->summary() +"]"; 574 tempText += " ["+ev->relatedTo()->summary() +"]";
576 tempText += "</td></tr>\n"; 575 tempText += "</td></tr>\n";
577 mText += tempText; 576 mText += tempText;
577 return true;
578} 578}
579 579
580bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub ) 580bool KOWhatsNextView::appendTodo(Incidence *ev, QString ind , bool isSub )
581{ 581{
582 if ( mTodos.find( ev ) != mTodos.end() ) return false; 582 if ( mTodos.find( ev ) != mTodos.end() ) return false;
583 583
584 mTodos.append( ev ); 584 mTodos.append( ev );
585 if ( !isSub ) 585 if ( !isSub )
586 mText += "<p>"; 586 mText += "<p>";
587 else 587 else
588 mText += "<li>"; 588 mText += "<li>";
589 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] "; 589 mText += "[" +QString::number(ev->priority()) + "/" + QString::number(((Todo*)ev)->percentComplete())+"%] ";
590 590
591 591
592 mText += ind; 592 mText += ind;
593 bool needClose = false; 593 bool needClose = false;
594 if ( ev->cancelled() ) { 594 if ( ev->cancelled() ) {
595 mText += "<font color=\"#F00000\">[c"; 595 mText += "<font color=\"#F00000\">[c";
596 needClose =true; 596 needClose =true;
597 597
598 } 598 }
599 if ( ev->isAlarmEnabled() ) { 599 if ( ev->isAlarmEnabled() ) {
600 if ( !needClose) 600 if ( !needClose)
601 mText +="["; 601 mText +="[";
diff --git a/korganizer/kowhatsnextview.h b/korganizer/kowhatsnextview.h
index 1118bdd..9049268 100644
--- a/korganizer/kowhatsnextview.h
+++ b/korganizer/kowhatsnextview.h
@@ -49,48 +49,48 @@ class KOWhatsNextView : public KOrg::BaseView
49 Q_OBJECT 49 Q_OBJECT
50 public: 50 public:
51 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0, 51 KOWhatsNextView(Calendar *calendar, QWidget *parent = 0,
52 const char *name = 0); 52 const char *name = 0);
53 ~KOWhatsNextView(); 53 ~KOWhatsNextView();
54 54
55 virtual int maxDatesHint(); 55 virtual int maxDatesHint();
56 virtual int currentDateCount(); 56 virtual int currentDateCount();
57 void setEventViewer(KOEventViewerDialog* v ); 57 void setEventViewer(KOEventViewerDialog* v );
58 virtual QPtrList<Incidence> selectedIncidences(); 58 virtual QPtrList<Incidence> selectedIncidences();
59 DateList selectedDates() 59 DateList selectedDates()
60 {DateList q; 60 {DateList q;
61 return q;} 61 return q;}
62 virtual void printPreview(CalPrinter *calPrinter, 62 virtual void printPreview(CalPrinter *calPrinter,
63 const QDate &, const QDate &); 63 const QDate &, const QDate &);
64 64
65 public slots: 65 public slots:
66 virtual void updateView(); 66 virtual void updateView();
67 virtual void showDates(const QDate &start, const QDate &end); 67 virtual void showDates(const QDate &start, const QDate &end);
68 virtual void showEvents(QPtrList<Event> eventList); 68 virtual void showEvents(QPtrList<Event> eventList);
69 void updateConfig(); 69 void updateConfig();
70 void changeEventDisplay(Event *, int); 70 void changeEventDisplay(Event *, int);
71 71
72 protected: 72 protected:
73 void appendEvent(Incidence *, bool reply=false, bool notRed = true); 73 bool appendEvent(Incidence *, bool reply=false, bool notRed = true, bool appendTable = false);
74 bool appendTodo(Incidence *, QString ind = "", bool isSub = false ); 74 bool appendTodo(Incidence *, QString ind = "", bool isSub = false );
75 void appendDay( int i, QDate date ); 75 void appendDay( int i, QDate date );
76 QDate mEventDate; 76 QDate mEventDate;
77 virtual void showEvent ( QShowEvent * ); 77 virtual void showEvent ( QShowEvent * );
78 virtual void hideEvent ( QHideEvent * ); 78 virtual void hideEvent ( QHideEvent * );
79 79
80 private slots: 80 private slots:
81 void showIncidence(const QString &); 81 void showIncidence(const QString &);
82 void restartTimer(); 82 void restartTimer();
83 83
84 84
85 private: 85 private:
86 //void createEventViewer(); 86 //void createEventViewer();
87 QTimer* mTimer; 87 QTimer* mTimer;
88 QTextBrowser *mView; 88 QTextBrowser *mView;
89 QString mText; 89 QString mText;
90 // QLabel *mDateLabel; 90 // QLabel *mDateLabel;
91 KOEventViewerDialog *mEventViewer; 91 KOEventViewerDialog *mEventViewer;
92 92
93 QValueList<Incidence *> mTodos; 93 QValueList<Incidence *> mTodos;
94}; 94};
95 95
96#endif 96#endif