summaryrefslogtreecommitdiffabout
path: root/korganizer
Unidiff
Diffstat (limited to 'korganizer') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/komonthview.cpp32
-rw-r--r--korganizer/komonthview.h5
2 files changed, 33 insertions, 4 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp
index f983ff9..4bf9dea 100644
--- a/korganizer/komonthview.cpp
+++ b/korganizer/komonthview.cpp
@@ -184,192 +184,208 @@ void KNoScrollListBox::keyReleaseEvent(QKeyEvent *e)
184 184
185void KNoScrollListBox::mousePressEvent(QMouseEvent *e) 185void KNoScrollListBox::mousePressEvent(QMouseEvent *e)
186{ 186{
187 QListBox::mousePressEvent(e); 187 QListBox::mousePressEvent(e);
188 188
189 if(e->button() == RightButton) { 189 if(e->button() == RightButton) {
190 emit rightClick(); 190 emit rightClick();
191 } 191 }
192} 192}
193 193
194MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s) 194MonthViewItem::MonthViewItem( Incidence *incidence, QDate qd, const QString & s)
195 : QListBoxItem() 195 : QListBoxItem()
196{ 196{
197 setText( s ); 197 setText( s );
198 mMultiday = 0; 198 mMultiday = 0;
199 mIncidence = incidence; 199 mIncidence = incidence;
200 mDate = qd; 200 mDate = qd;
201 mRecur = false; 201 mRecur = false;
202 mAlarm = false; 202 mAlarm = false;
203 mReply = false; 203 mReply = false;
204 mInfo = false; 204 mInfo = false;
205} 205}
206 206
207void MonthViewItem::paint(QPainter *p) 207void MonthViewItem::paint(QPainter *p)
208{ 208{
209#if QT_VERSION >= 0x030000 209#if QT_VERSION >= 0x030000
210 bool sel = isSelected(); 210 bool sel = isSelected();
211#else 211#else
212 bool sel = selected(); 212 bool sel = selected();
213#endif 213#endif
214 214
215 215
216 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) 216 if (KOPrefs::instance()->mMonthViewUsesCategoryColor)
217 { 217 {
218 p->setBackgroundColor( palette().color( QPalette::Normal, \ 218 p->setBackgroundColor( palette().color( QPalette::Normal, \
219 sel ? QColorGroup::Highlight : QColorGroup::Background ) ); 219 sel ? QColorGroup::Highlight : QColorGroup::Background ) );
220 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) ); 220 p->eraseRect( 0, 0, listBox()->maxItemWidth(), height( listBox() ) );
221 } 221 }
222 int x = 1; 222 int x = 1;
223 //int y = 3;//(height() - mRecurPixmap.height()) /2; 223 //int y = 3;//(height() - mRecurPixmap.height()) /2;
224 int size = PIXMAP_SIZE; 224 int size = PIXMAP_SIZE;
225 if ( QApplication::desktop()->width() < 300 ) 225 if ( QApplication::desktop()->width() < 300 )
226 size = 3; 226 size = 3;
227 int heihei = height( listBox () ); 227 int heihei = height( listBox () );
228 int y = (heihei - size -1 ) /2; 228 int y = (heihei - size -1 ) /2;
229 229
230 if ( KOPrefs::instance()->mMonthShowIcons ) { 230 if ( KOPrefs::instance()->mMonthShowIcons ) {
231 if ( mInfo ) { 231 if ( mInfo ) {
232 p->fillRect ( x, y,size,size, Qt::darkGreen ); 232 p->fillRect ( x, y,size,size, Qt::darkGreen );
233 x += size + 1; 233 x += size + 1;
234 } 234 }
235 if ( mRecur ) { 235 if ( mRecur ) {
236 p->fillRect ( x, y,size,size, Qt::blue ); 236 p->fillRect ( x, y,size,size, Qt::blue );
237 x += size + 1; 237 x += size + 1;
238 } 238 }
239 if ( mAlarm ) { 239 if ( mAlarm ) {
240 p->fillRect ( x, y,size,size, Qt::red ); 240 p->fillRect ( x, y,size,size, Qt::red );
241 x += size + 1; 241 x += size + 1;
242 } 242 }
243 if ( mReply ) { 243 if ( mReply ) {
244 p->fillRect ( x, y,size,size, Qt::yellow ); 244 p->fillRect ( x, y,size,size, Qt::yellow );
245 x += size + 1; 245 x += size + 1;
246 } 246 }
247 } 247 }
248 if ( mMultiday ) { 248 if ( mMultiday ) {
249 int yyy = y+(size/2); 249 int yyy = y+(size/2);
250 int sizeM = size+2; 250 int sizeM = size+2;
251 p->setBrush( QBrush::SolidPattern ); 251 p->setBrush( QBrush::SolidPattern );
252 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ; 252 p->drawLine ( x+1, yyy, x +sizeM +sizeM/2-1, yyy ) ;
253 if ( mMultiday == 2 || mMultiday == 3 ) { 253 if ( mMultiday == 2 || mMultiday == 3 ) {
254 QPointArray pa ( 3 ); 254 QPointArray pa ( 3 );
255 pa.setPoint (0, x, yyy ); 255 pa.setPoint (0, x, yyy );
256 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 ); 256 pa.setPoint (1, x+sizeM/2, yyy+sizeM/2 );
257 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 ); 257 pa.setPoint (2, x+sizeM/2, yyy-sizeM/2 );
258 p->drawPolygon( pa ); 258 p->drawPolygon( pa );
259 } 259 }
260 if ( mMultiday == 2 || mMultiday == 1 ) { 260 if ( mMultiday == 2 || mMultiday == 1 ) {
261 QPointArray pa ( 3 ); 261 QPointArray pa ( 3 );
262 pa.setPoint (0, x+sizeM +sizeM/2, yyy ); 262 pa.setPoint (0, x+sizeM +sizeM/2, yyy );
263 pa.setPoint (1, x+sizeM, yyy+sizeM/2 ); 263 pa.setPoint (1, x+sizeM, yyy+sizeM/2 );
264 pa.setPoint (2, x+sizeM, yyy-sizeM/2 ); 264 pa.setPoint (2, x+sizeM, yyy-sizeM/2 );
265 p->drawPolygon( pa ); 265 p->drawPolygon( pa );
266 } 266 }
267 if ( mMultiday == 1 ) { 267 if ( mMultiday == 1 ) {
268 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 268 // p->fillRect ( x, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
269 269
270 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 ); 270 p->drawLine ( x+1, yyy-sizeM/2, x+1, yyy+sizeM/2 );
271 } 271 }
272 if ( mMultiday == 3 ) { 272 if ( mMultiday == 3 ) {
273 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) ); 273 // p->fillRect ( x+sizeM, yyy-sizeM/2+1, sizeM/2, size, QBrush ( QBrush::SolidPattern ) );
274 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 ); 274 p->drawLine ( x+sizeM +sizeM/2-1, yyy-sizeM/2, x+sizeM +sizeM/2-1, yyy+sizeM/2 );
275 275
276 } 276 }
277 x += sizeM/2 + 1; 277 x += sizeM/2 + 1;
278 x += sizeM + 1; 278 x += sizeM + 1;
279 } 279 }
280
281 if ( mIncidence->type() == "Todo" ){
282 Todo* td = ( Todo* ) mIncidence;
283 if ( td->isCompleted() ) {
284 int half = size/2;
285 p->drawLine ( x, heihei/2, x +half , heihei/2 +half ) ;
286 p->drawLine ( x +half , heihei/2 +half , x +half+half +2 , heihei/2 -2 ) ;
287 x += half+half + 4;
288
289 } else {
290 int val = td->percentComplete()/20;
291 p->fillRect ( x+1, y-1, val ,size+2,Qt::black );
292 p->drawRect ( x, y-1,7,size+2);
293 x += size + 3;
294 }
295 }
280 QFontMetrics fm = p->fontMetrics(); 296 QFontMetrics fm = p->fontMetrics();
281 int yPos; 297 int yPos;
282 int pmheight = size; 298 int pmheight = size;
283 if( pmheight < fm.height() ) 299 if( pmheight < fm.height() )
284 yPos = fm.ascent() + fm.leading()/2; 300 yPos = fm.ascent() + fm.leading()/2;
285 else 301 else
286 yPos = pmheight/2 - fm.height()/2 + fm.ascent(); 302 yPos = pmheight/2 - fm.height()/2 + fm.ascent();
287 p->setPen( palette().color( QPalette::Normal, sel ? \ 303 p->setPen( palette().color( QPalette::Normal, sel ? \
288 QColorGroup::HighlightedText : QColorGroup::Foreground ) ); 304 QColorGroup::HighlightedText : QColorGroup::Foreground ) );
289 p->drawText( x, yPos, text() ); 305 p->drawText( x, yPos, text() );
290 if ( mIncidence->cancelled() ) { 306 if ( mIncidence->cancelled() ) {
291 int wid = fm.width( text() ); 307 int wid = fm.width( text() );
292 p->drawLine( x, heihei/2 ,x+wid, heihei/2 ); 308 p->drawLine( x, heihei/2 ,x+wid, heihei/2 );
293 } 309 }
294 310
295} 311}
296 312
297int MonthViewItem::height(const QListBox *lb) const 313int MonthViewItem::height(const QListBox *lb) const
298{ 314{
299 if ( lb ) 315 if ( lb )
300 return lb->fontMetrics().lineSpacing()+1; 316 return lb->fontMetrics().lineSpacing()+1;
301 return 10; 317 return 10;
302} 318}
303 319
304int MonthViewItem::width(const QListBox *lb) const 320int MonthViewItem::width(const QListBox *lb) const
305{ 321{
306 int size = PIXMAP_SIZE; 322 int size = PIXMAP_SIZE;
307 if ( QApplication::desktop()->width() < 300 ) 323 if ( QApplication::desktop()->width() < 300 )
308 size = 3; 324 size = 3;
309 int x = 1; 325 int x = 1;
310 if ( KOPrefs::instance()->mMonthShowIcons ) { 326 if ( KOPrefs::instance()->mMonthShowIcons ) {
311 if ( mInfo ) { 327 if ( mInfo ) {
312 x += size + 1; 328 x += size + 1;
313 } 329 }
314 if( mRecur ) { 330 if( mRecur ) {
315 x += size+1; 331 x += size+1;
316 } 332 }
317 if( mAlarm ) { 333 if( mAlarm ) {
318 x += size+1; 334 x += size+1;
319 } 335 }
320 if( mReply ) { 336 if( mReply ) {
321 x += size+1; 337 x += size+1;
322 } 338 }
323 } 339 }
324 if( mMultiday ) { 340 if( mMultiday ) {
325 x += size+1+2+size/2; 341 x += size+1+2+size/2;
326 } 342 }
327 343
328 return( x + lb->fontMetrics().width( text() ) + 1 ); 344 return( x + lb->fontMetrics().width( text() ) + 1 );
329} 345}
330 346
331 347
332MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par ) 348MonthViewCell::MonthViewCell( KOMonthView *parent,QWidget* par )
333 : QWidget( par ), 349 : QWidget( par ),
334 mMonthView( parent ) 350 mMonthView( parent )
335{ 351{
336 352
337 QVBoxLayout *topLayout = new QVBoxLayout( this ); 353 QVBoxLayout *topLayout = new QVBoxLayout( this );
338 354
339 // mLabel = new QLabel( this );QPushButton 355 // mLabel = new QLabel( this );QPushButton
340 mLabel = new QPushButton( this ); 356 mLabel = new QPushButton( this );
341 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain ); 357 //mLabel->setFrameStyle( QFrame::Panel | QFrame::Plain );
342 //mLabel->setLineWidth( 1 ); 358 //mLabel->setLineWidth( 1 );
343 //mLabel->setAlignment( AlignCenter ); 359 //mLabel->setAlignment( AlignCenter );
344 mLabel->setFlat( true ); 360 mLabel->setFlat( true );
345 mLabel->setFocusPolicy(NoFocus); 361 mLabel->setFocusPolicy(NoFocus);
346 mItemList = new KNoScrollListBox( this ); 362 mItemList = new KNoScrollListBox( this );
347 mItemList->setMinimumSize( 10, 10 ); 363 mItemList->setMinimumSize( 10, 10 );
348 mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain ); 364 mItemList->setFrameStyle( QFrame::Panel | QFrame::Plain );
349 mItemList->setLineWidth( 1 ); 365 mItemList->setLineWidth( 1 );
350 topLayout->addWidget( mItemList ); 366 topLayout->addWidget( mItemList );
351 mLabel->raise(); 367 mLabel->raise();
352 // QColor( 0,0,255 ) QColor( 160,1600,255 ) 368 // QColor( 0,0,255 ) QColor( 160,1600,255 )
353 mStandardPalette = palette(); 369 mStandardPalette = palette();
354 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) ); 370 mStandardPalette.setColor(QColorGroup::Base, mStandardPalette.color( QPalette::Normal, QColorGroup::Background ) );
355 371
356 enableScrollBars( false ); 372 enableScrollBars( false );
357 updateConfig(); 373 updateConfig();
358 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() )); 374 //connect( mLabel, SIGNAL( clicked( )), SLOT( newEvent() ));
359 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() )); 375 connect( mLabel, SIGNAL( clicked( )), SLOT( showDay() ));
360 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ), 376 connect( mItemList, SIGNAL( doubleClicked( QListBoxItem *) ),
361 SLOT( defaultAction( QListBoxItem * ) ) ); 377 SLOT( defaultAction( QListBoxItem * ) ) );
362 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *, 378 connect( mItemList, SIGNAL( rightButtonPressed( QListBoxItem *,
363 const QPoint &) ), 379 const QPoint &) ),
364 SLOT( contextMenu( QListBoxItem * ) ) ); 380 SLOT( contextMenu( QListBoxItem * ) ) );
365 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ), 381 connect( mItemList, SIGNAL( highlighted( QListBoxItem *) ),
366 SLOT( selection( QListBoxItem * ) ) ); 382 SLOT( selection( QListBoxItem * ) ) );
367 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 383 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
368 SLOT( cellClicked( QListBoxItem * ) ) ); 384 SLOT( cellClicked( QListBoxItem * ) ) );
369 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ), 385 connect( mItemList, SIGNAL( clicked( QListBoxItem * ) ),
370 SLOT( selection( QListBoxItem * ) ) ); 386 SLOT( selection( QListBoxItem * ) ) );
371} 387}
372#ifdef DESKTOP_VERSION 388#ifdef DESKTOP_VERSION
373QToolTipGroup *MonthViewCell::toolTipGroup() 389QToolTipGroup *MonthViewCell::toolTipGroup()
374{ 390{
375 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0); 391 if (!mToolTipGroup) mToolTipGroup = new QToolTipGroup(0);
@@ -509,252 +525,252 @@ void MonthViewCell::insertEvent(Event *event)
509 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day 525 int multiday = 0;// 1 = start, 2 = midddle, 3 = end day
510 if (event->isMultiDay()) { 526 if (event->isMultiDay()) {
511 QString prefix = "<->";multiday = 2; 527 QString prefix = "<->";multiday = 2;
512 QString time; 528 QString time;
513 if ( event->doesRecur() ) { 529 if ( event->doesRecur() ) {
514 if ( event->recursOn( mDate) ) { 530 if ( event->recursOn( mDate) ) {
515 prefix ="->" ;multiday = 1; 531 prefix ="->" ;multiday = 1;
516 } 532 }
517 else { 533 else {
518 int days = event->dtStart().date().daysTo ( event->dtEnd().date() ); 534 int days = event->dtStart().date().daysTo ( event->dtEnd().date() );
519 if ( event->recursOn( mDate.addDays( -days)) ) { 535 if ( event->recursOn( mDate.addDays( -days)) ) {
520 prefix ="<-" ;multiday = 3; 536 prefix ="<-" ;multiday = 3;
521 } 537 }
522 } 538 }
523 539
524 } else { 540 } else {
525 if (mDate == event->dtStart().date()) { 541 if (mDate == event->dtStart().date()) {
526 prefix ="->" ;multiday = 1; 542 prefix ="->" ;multiday = 1;
527 } else if (mDate == event->dtEnd().date()) { 543 } else if (mDate == event->dtEnd().date()) {
528 prefix ="<-" ;multiday = 3; 544 prefix ="<-" ;multiday = 3;
529 } 545 }
530 } 546 }
531 if ( !event->doesFloat() ) { 547 if ( !event->doesFloat() ) {
532 if ( mDate == event->dtStart().date () ) 548 if ( mDate == event->dtStart().date () )
533 time = KGlobal::locale()->formatTime(event->dtStart().time())+" "; 549 time = KGlobal::locale()->formatTime(event->dtStart().time())+" ";
534 else if ( mDate == event->dtEnd().date () ) 550 else if ( mDate == event->dtEnd().date () )
535 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" "; 551 time = KGlobal::locale()->formatTime(event->dtEnd().time())+" ";
536 552
537 } 553 }
538 text = time + event->summary(); 554 text = time + event->summary();
539 mToolTip += prefix + text; 555 mToolTip += prefix + text;
540 } else { 556 } else {
541 if (event->doesFloat()) { 557 if (event->doesFloat()) {
542 text = event->summary(); 558 text = event->summary();
543 mToolTip += text; 559 mToolTip += text;
544 } 560 }
545 else { 561 else {
546 text = KGlobal::locale()->formatTime(event->dtStart().time()); 562 text = KGlobal::locale()->formatTime(event->dtStart().time());
547 text += " " + event->summary(); 563 text += " " + event->summary();
548 mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary(); 564 mToolTip += KGlobal::locale()->formatTime(event->dtStart().time()) +"-"+KGlobal::locale()->formatTime(event->dtEnd().time())+" " + event->summary();
549 } 565 }
550 } 566 }
551 567
552 MonthViewItem *item = new MonthViewItem( event, mDate, text ); 568 MonthViewItem *item = new MonthViewItem( event, mDate, text );
553 QPalette pal; 569 QPalette pal;
554 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 570 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
555 QStringList categories = event->categories(); 571 QStringList categories = event->categories();
556 QString cat = categories.first(); 572 QString cat = categories.first();
557 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 573 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
558 pal = getPalette(); 574 pal = getPalette();
559 if (cat.isEmpty()) { 575 if (cat.isEmpty()) {
560 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 576 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
561 } else { 577 } else {
562 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 578 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
563 } 579 }
564 580
565 } else { 581 } else {
566 if (cat.isEmpty()) { 582 if (cat.isEmpty()) {
567 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 583 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
568 } else { 584 } else {
569 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 585 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
570 } 586 }
571 } 587 }
572 588
573 } else { 589 } else {
574 pal = mStandardPalette ; 590 pal = mStandardPalette ;
575 } 591 }
576 item->setPalette( pal ); 592 item->setPalette( pal );
577 item->setRecur( event->recurrence()->doesRecur() ); 593 item->setRecur( event->recurrence()->doesRecur() );
578 item->setAlarm( event->isAlarmEnabled() && multiday < 2 ); 594 item->setAlarm( event->isAlarmEnabled() && multiday < 2 );
579 item->setMoreInfo( event->description().length() > 0 ); 595 item->setMoreInfo( event->description().length() > 0 );
580#ifdef DESKTOP_VERSION 596#ifdef DESKTOP_VERSION
581 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails, 597 Attendee *me = event->attendeeByMails(KOPrefs::instance()->mAdditionalMails,
582 KOPrefs::instance()->email()); 598 KOPrefs::instance()->email());
583 if ( me != 0 ) { 599 if ( me != 0 ) {
584 if ( me->status() == Attendee::NeedsAction && me->RSVP()) 600 if ( me->status() == Attendee::NeedsAction && me->RSVP())
585 item->setReply(true && multiday < 2); 601 item->setReply(true && multiday < 2);
586 else 602 else
587 item->setReply(false); 603 item->setReply(false);
588 } else 604 } else
589 item->setReply(false); 605 item->setReply(false);
590#endif 606#endif
591 item->setMultiDay( multiday ); 607 item->setMultiDay( multiday );
592 mItemList->insertItem( item ); 608 mItemList->insertItem( item );
593 mToolTip += "\n"; 609 mToolTip += "\n";
594} 610}
595void MonthViewCell::insertTodo(Todo *todo) 611void MonthViewCell::insertTodo(Todo *todo)
596{ 612{
597 mItemList->setFocusPolicy(WheelFocus); 613 mItemList->setFocusPolicy(WheelFocus);
598 QString text; 614 QString text;
599 if (todo->hasDueDate()) { 615 if (todo->hasDueDate()) {
600 if (!todo->doesFloat()) { 616 if (!todo->doesFloat()) {
601 text += KGlobal::locale()->formatTime(todo->dtDue().time()); 617 text += KGlobal::locale()->formatTime(todo->dtDue().time());
602 text += " "; 618 text += " ";
603 } 619 }
604 } 620 }
605 text += i18n("T: %1").arg(todo->summary()); 621 text += todo->summary();
606 622
607 MonthViewItem *item = new MonthViewItem( todo, mDate, text ); 623 MonthViewItem *item = new MonthViewItem( todo, mDate, text );
608 //item->setPalette( mStandardPalette ); 624 //item->setPalette( mStandardPalette );
609 QPalette pal; 625 QPalette pal;
610 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) { 626 if (KOPrefs::instance()->mMonthViewUsesCategoryColor) {
611 QStringList categories = todo->categories(); 627 QStringList categories = todo->categories();
612 QString cat = categories.first(); 628 QString cat = categories.first();
613 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) { 629 if ( KOPrefs::instance()->mMonthViewUsesForegroundColor ) {
614 pal = getPalette(); 630 pal = getPalette();
615 if (cat.isEmpty()) { 631 if (cat.isEmpty()) {
616 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor); 632 pal.setColor(QColorGroup::Foreground,KOPrefs::instance()->mEventColor);
617 } else { 633 } else {
618 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat))); 634 pal.setColor(QColorGroup::Foreground, *(KOPrefs::instance()->categoryColor(cat)));
619 } 635 }
620 636
621 } else { 637 } else {
622 if (cat.isEmpty()) { 638 if (cat.isEmpty()) {
623 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor); 639 pal = QPalette(KOPrefs::instance()->mEventColor, KOPrefs::instance()->mEventColor);
624 } else { 640 } else {
625 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat))); 641 pal = QPalette(*(KOPrefs::instance()->categoryColor(cat)), *(KOPrefs::instance()->categoryColor(cat)));
626 } 642 }
627 } 643 }
628 644
629 } else { 645 } else {
630 pal = mStandardPalette ; 646 pal = mStandardPalette ;
631 } 647 }
632 item->setPalette( pal ); 648 item->setPalette( pal );
633 item->setRecur( todo->recurrence()->doesRecur() ); 649 item->setRecur( todo->recurrence()->doesRecur() );
634 item->setAlarm( todo->isAlarmEnabled() ); 650 item->setAlarm( todo->isAlarmEnabled() );
635 item->setMoreInfo( todo->description().length() > 0 ); 651 item->setMoreInfo( todo->description().length() > 0 );
636 mItemList->insertItem( item ); 652 mItemList->insertItem( item );
637 mToolTip += text+"\n"; 653 mToolTip += text+"\n";
638} 654}
639void MonthViewCell::finishUpdateCell() 655void MonthViewCell::finishUpdateCell()
640{ 656{
641#ifdef DESKTOP_VERSION 657#ifdef DESKTOP_VERSION
642 if (mToolTip != "") 658 if (mToolTip != "")
643 QToolTip::add(this,mToolTip,toolTipGroup(),""); 659 QToolTip::add(this,mToolTip,toolTipGroup(),"");
644#endif 660#endif
645 mItemList->sort(); 661 mItemList->sort();
646 //setMyPalette(); 662 //setMyPalette();
647 setMyPalette(); 663 setMyPalette();
648 QString text; 664 QString text;
649 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog; 665 bool smallDisplay = QApplication::desktop()->width() < 320 && KOPrefs::instance()->mMonthViewSatSunTog;
650 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) { 666 if ( KOPrefs::instance()->mMonthViewWeek || KOGlobals::self()->calendarSystem()->day( mDate ) == 1 || (mDate.dayOfWeek() == 7 && !smallDisplay ) || KOPrefs::instance()->mMonthShowShort) {
651 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " "; 667 text = KOGlobals::self()->calendarSystem()->monthName( mDate, true ) + " ";
652 mLabel->resize( mLabelBigSize ); 668 mLabel->resize( mLabelBigSize );
653 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 669 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
654 } else { 670 } else {
655 mLabel->resize( mLabelSize ); 671 mLabel->resize( mLabelSize );
656 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) ); 672 text += QString::number( KOGlobals::self()->calendarSystem()->day(mDate) );
657 } 673 }
658 674
659 mLabel->setText( text ); 675 mLabel->setText( text );
660 resizeEvent( 0 ); 676 resizeEvent( 0 );
661} 677}
662void MonthViewCell::updateCell() 678void MonthViewCell::updateCell()
663{ 679{
664 qDebug("MonthViewCell::updateCell() "); 680 //qDebug("MonthViewCell::updateCell() ");
665 if ( !mMonthView->isUpdatePossible() ) 681 if ( !mMonthView->isUpdatePossible() )
666 return; 682 return;
667 startUpdateCell(); 683 startUpdateCell();
668 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2); 684 //mLabel->setMaximumWidth( width() - mItemList->lineWidth()*2);
669 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true ); 685 QPtrList<Event> events = mMonthView->calendar()->events( mDate, true );
670 Event *event; 686 Event *event;
671 for( event = events.first(); event; event = events.next() ) { // for event 687 for( event = events.first(); event; event = events.next() ) { // for event
672 insertEvent(event); 688 insertEvent(event);
673 } 689 }
674 // insert due todos 690 // insert due todos
675 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate ); 691 QPtrList<Todo> todos = mMonthView->calendar()->todos( mDate );
676 Todo *todo; 692 Todo *todo;
677 for(todo = todos.first(); todo; todo = todos.next()) { 693 for(todo = todos.first(); todo; todo = todos.next()) {
678 insertTodo( todo ); 694 insertTodo( todo );
679 } 695 }
680 finishUpdateCell(); 696 finishUpdateCell();
681 // if ( isVisible()) 697 // if ( isVisible())
682 //qApp->processEvents(); 698 //qApp->processEvents();
683} 699}
684 700
685void MonthViewCell::updateConfig( bool bigFont ) // = false 701void MonthViewCell::updateConfig( bool bigFont ) // = false
686{ 702{
687 703
688 if ( bigFont ) { 704 if ( bigFont ) {
689 QFont fo = KOPrefs::instance()->mMonthViewFont; 705 QFont fo = KOPrefs::instance()->mMonthViewFont;
690 int ps = fo.pointSize() + 2; 706 int ps = fo.pointSize() + 2;
691 if ( ps < 18 ) 707 if ( ps < 18 )
692 ps += 2; 708 ps += 2;
693 fo.setPointSize( ps ); 709 fo.setPointSize( ps );
694 setFont( fo ); 710 setFont( fo );
695 } else 711 } else
696 setFont( KOPrefs::instance()->mMonthViewFont ); 712 setFont( KOPrefs::instance()->mMonthViewFont );
697 713
698 QFontMetrics fm( font() ); 714 QFontMetrics fm( font() );
699 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 ); 715 mLabelSize = fm.size( 0, "30" ) + QSize( 4, 2 );
700 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 ); 716 mLabelBigSize = fm.size( 0, "Mag 30" ) + QSize( 2, 2 );
701 mHolidayPalette = mStandardPalette; 717 mHolidayPalette = mStandardPalette;
702 mPrimaryPalette = mStandardPalette; 718 mPrimaryPalette = mStandardPalette;
703 mNonPrimaryPalette = mStandardPalette; 719 mNonPrimaryPalette = mStandardPalette;
704 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) { 720 if ( KOPrefs::instance()->mMonthViewUsesDayColors ) {
705 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor ); 721 mHolidayPalette.setColor(QColorGroup::Base, KOPrefs::instance()->mMonthViewHolidayColor );
706 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor ); 722 mHolidayPalette.setColor(QColorGroup::Background, KOPrefs::instance()->mMonthViewHolidayColor );
707 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark()); 723 mHolidayPalette.setColor(QColorGroup::Foreground, KOPrefs::instance()->mMonthViewHolidayColor.dark());
708 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark()); 724 mPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewOddColor.dark());
709 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor); 725 mPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewOddColor);
710 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor); 726 mPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewOddColor);
711 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark()); 727 mNonPrimaryPalette.setColor(QColorGroup::Foreground,KOPrefs::instance()->mMonthViewEvenColor.dark());
712 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor); 728 mNonPrimaryPalette.setColor(QColorGroup::Base,KOPrefs::instance()->mMonthViewEvenColor);
713 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor); 729 mNonPrimaryPalette.setColor(QColorGroup::Background,KOPrefs::instance()->mMonthViewEvenColor);
714 } 730 }
715 //updateCell(); 731 //updateCell();
716} 732}
717 733
718void MonthViewCell::enableScrollBars( bool enabled ) 734void MonthViewCell::enableScrollBars( bool enabled )
719{ 735{
720 if ( enabled ) { 736 if ( enabled ) {
721 mItemList->setVScrollBarMode(QScrollView::Auto); 737 mItemList->setVScrollBarMode(QScrollView::Auto);
722 mItemList->setHScrollBarMode(QScrollView::Auto); 738 mItemList->setHScrollBarMode(QScrollView::Auto);
723 } else { 739 } else {
724 mItemList->setVScrollBarMode(QScrollView::AlwaysOff); 740 mItemList->setVScrollBarMode(QScrollView::AlwaysOff);
725 mItemList->setHScrollBarMode(QScrollView::AlwaysOff); 741 mItemList->setHScrollBarMode(QScrollView::AlwaysOff);
726 } 742 }
727} 743}
728 744
729Incidence *MonthViewCell::selectedIncidence() 745Incidence *MonthViewCell::selectedIncidence()
730{ 746{
731 int index = mItemList->currentItem(); 747 int index = mItemList->currentItem();
732 if ( index < 0 ) return 0; 748 if ( index < 0 ) return 0;
733 749
734 MonthViewItem *item = 750 MonthViewItem *item =
735 static_cast<MonthViewItem *>( mItemList->item( index ) ); 751 static_cast<MonthViewItem *>( mItemList->item( index ) );
736 752
737 if ( !item ) return 0; 753 if ( !item ) return 0;
738 754
739 return item->incidence(); 755 return item->incidence();
740} 756}
741 757
742QDate MonthViewCell::selectedIncidenceDate() 758QDate MonthViewCell::selectedIncidenceDate()
743{ 759{
744 QDate qd; 760 QDate qd;
745 int index = mItemList->currentItem(); 761 int index = mItemList->currentItem();
746 if ( index < 0 ) return qd; 762 if ( index < 0 ) return qd;
747 763
748 MonthViewItem *item = 764 MonthViewItem *item =
749 static_cast<MonthViewItem *>( mItemList->item( index ) ); 765 static_cast<MonthViewItem *>( mItemList->item( index ) );
750 766
751 if ( !item ) return qd; 767 if ( !item ) return qd;
752 768
753 return item->incidenceDate(); 769 return item->incidenceDate();
754} 770}
755 771
756void MonthViewCell::deselect() 772void MonthViewCell::deselect()
757{ 773{
758 mItemList->clearSelection(); 774 mItemList->clearSelection();
759 enableScrollBars( false ); 775 enableScrollBars( false );
760 // updateCell(); 776 // updateCell();
@@ -1125,192 +1141,193 @@ void KOMonthView::updateDayLabels()
1125 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW)); 1141 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsW));
1126 1142
1127 } 1143 }
1128 } 1144 }
1129 mDayLabelsT = &mDayLabels; 1145 mDayLabelsT = &mDayLabels;
1130 for (int i = 0; i < 7; i++) { 1146 for (int i = 0; i < 7; i++) {
1131 if (mWeekStartsMonday) { 1147 if (mWeekStartsMonday) {
1132 bool show = mShortDayLabelsM; 1148 bool show = mShortDayLabelsM;
1133 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() ) 1149 if ( i > 4 && mShowSatSunComp && mWidthLongDayLabel > (*mDayLabelsT)[i]->width() )
1134 show = true; 1150 show = true;
1135 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show)); 1151 (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i+1,show));
1136 } else { 1152 } else {
1137 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM)); 1153 if (i==0) (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(7,mShortDayLabelsM));
1138 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM)); 1154 else (*mDayLabelsT)[i]->setText(KOGlobals::self()->calendarSystem()->weekDayName(i,mShortDayLabelsM));
1139 1155
1140 } 1156 }
1141 } 1157 }
1142 1158
1143} 1159}
1144 1160
1145void KOMonthView::showDates(const QDate &start, const QDate &) 1161void KOMonthView::showDates(const QDate &start, const QDate &)
1146{ 1162{
1147 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl; 1163 // kdDebug() << "KOMonthView::showDates(): " << start.toString() << endl;
1148 1164
1149 QPtrVector<MonthViewCell> *cells; 1165 QPtrVector<MonthViewCell> *cells;
1150 QPtrVector<QLabel> *dayLabels; 1166 QPtrVector<QLabel> *dayLabels;
1151 QPtrVector<KOWeekButton> *weekLabels; 1167 QPtrVector<KOWeekButton> *weekLabels;
1152 int weekNum = 6; 1168 int weekNum = 6;
1153 if ( mShowWeekView ) { 1169 if ( mShowWeekView ) {
1154 weekNum = 1; 1170 weekNum = 1;
1155 cells = &mCellsW; 1171 cells = &mCellsW;
1156 dayLabels = &mDayLabelsW; 1172 dayLabels = &mDayLabelsW;
1157 weekLabels = &mWeekLabelsW; 1173 weekLabels = &mWeekLabelsW;
1158 } else { 1174 } else {
1159 cells = &mCells; 1175 cells = &mCells;
1160 dayLabels = &mDayLabels; 1176 dayLabels = &mDayLabels;
1161 weekLabels = &mWeekLabels; 1177 weekLabels = &mWeekLabels;
1162 } 1178 }
1163 1179
1164 mStartDate = start; 1180 mStartDate = start;
1165 1181
1166 int startWeekDay = mWeekStartsMonday ? 1 : 7; 1182 int startWeekDay = mWeekStartsMonday ? 1 : 7;
1167 1183
1168 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) { 1184 while( KOGlobals::self()->calendarSystem()->dayOfWeek(mStartDate) != startWeekDay ) {
1169 mStartDate = mStartDate.addDays( -1 ); 1185 mStartDate = mStartDate.addDays( -1 );
1170 } 1186 }
1171 1187
1172 bool primary = false; 1188 bool primary = false;
1173 uint i; 1189 uint i;
1174 for( i = 0; i < (*cells).size(); ++i ) { 1190 for( i = 0; i < (*cells).size(); ++i ) {
1175 QDate date = mStartDate.addDays( i ); 1191 QDate date = mStartDate.addDays( i );
1176 (*cells)[i]->setDate( date ); 1192 (*cells)[i]->setDate( date );
1177 1193
1178#ifndef KORG_NOPLUGINS 1194#ifndef KORG_NOPLUGINS
1179 // add holiday, if present 1195 // add holiday, if present
1180 QString hstring(KOCore::self()->holiday(date)); 1196 QString hstring(KOCore::self()->holiday(date));
1181 (*cells)[i]->setHoliday( hstring ); 1197 (*cells)[i]->setHoliday( hstring );
1182#endif 1198#endif
1183 1199
1184 } 1200 }
1185 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 ); 1201 QDate date = mStartDate.addDays( mWeekStartsMonday ? 3 : 4 );
1186 for( i = 0; i < weekNum; ++i ) { 1202 for( i = 0; i < weekNum; ++i ) {
1187 int wno; 1203 int wno;
1188 // remember, according to ISO 8601, the first week of the year is the 1204 // remember, according to ISO 8601, the first week of the year is the
1189 // first week that contains a thursday. Thus we must subtract off 4, 1205 // first week that contains a thursday. Thus we must subtract off 4,
1190 // not just 1. 1206 // not just 1.
1191 int dayOfYear = date.dayOfYear(); 1207 int dayOfYear = date.dayOfYear();
1192 if (dayOfYear % 7 != 0) 1208 if (dayOfYear % 7 != 0)
1193 wno = dayOfYear / 7 + 1; 1209 wno = dayOfYear / 7 + 1;
1194 else 1210 else
1195 wno =dayOfYear / 7; 1211 wno =dayOfYear / 7;
1196 (*weekLabels)[i]->setWeekNum( wno ); 1212 (*weekLabels)[i]->setWeekNum( wno );
1197 date = date.addDays( 7 ); 1213 date = date.addDays( 7 );
1198 } 1214 }
1199 updateView(); 1215 updateView();
1200} 1216}
1201 1217
1202void KOMonthView::showEvents(QPtrList<Event>) 1218void KOMonthView::showEvents(QPtrList<Event>)
1203{ 1219{
1204 qDebug("KOMonthView::selectEvents is not implemented yet. "); 1220 qDebug("KOMonthView::selectEvents is not implemented yet. ");
1205} 1221}
1206 1222
1207void KOMonthView::changeEventDisplay(Event *, int) 1223void KOMonthView::changeEventDisplay(Event *, int)
1208{ 1224{
1209 // this should be re-written to be much more efficient, but this 1225 // this should be re-written to be much more efficient, but this
1210 // quick-and-dirty-hack gets the job done for right now. 1226 // quick-and-dirty-hack gets the job done for right now.
1211 updateView(); 1227 updateView();
1212} 1228}
1213 1229
1214void KOMonthView::updateView() 1230void KOMonthView::updateView()
1215{ 1231{
1216 1232
1217 if ( !updatePossible ) 1233 if ( !updatePossible )
1218 return; 1234 return;
1219 //QTime ti; 1235 //QTime ti;
1220 //ti.start(); 1236 //ti.start();
1237 clearSelection();
1221 QPtrVector<MonthViewCell> *cells; 1238 QPtrVector<MonthViewCell> *cells;
1222 if ( mShowWeekView ) { 1239 if ( mShowWeekView ) {
1223 cells = &mCellsW; 1240 cells = &mCellsW;
1224 } else { 1241 } else {
1225 cells = &mCells; 1242 cells = &mCells;
1226 } 1243 }
1227#if 1 1244#if 1
1228 int i; 1245 int i;
1229 int timeSpan = (*cells).size()-1; 1246 int timeSpan = (*cells).size()-1;
1230 if ( KOPrefs::instance()->mMonthViewWeek ) 1247 if ( KOPrefs::instance()->mMonthViewWeek )
1231 timeSpan = 6; 1248 timeSpan = 6;
1232 for( i = 0; i < timeSpan + 1; ++i ) { 1249 for( i = 0; i < timeSpan + 1; ++i ) {
1233 (*cells)[i]->startUpdateCell(); 1250 (*cells)[i]->startUpdateCell();
1234 } 1251 }
1235 1252
1236 QPtrList<Event> events = calendar()->events(); 1253 QPtrList<Event> events = calendar()->events();
1237 Event *event; 1254 Event *event;
1238 QDateTime dt; 1255 QDateTime dt;
1239 bool ok; 1256 bool ok;
1240 QDate endDate = mStartDate.addDays( timeSpan ); 1257 QDate endDate = mStartDate.addDays( timeSpan );
1241 for( event = events.first(); event; event = events.next() ) { // for event 1258 for( event = events.first(); event; event = events.next() ) { // for event
1242 if ( event->doesRecur() ) { 1259 if ( event->doesRecur() ) {
1243 bool last; 1260 bool last;
1244 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last ); 1261 QDateTime incidenceStart = event->recurrence()->getPreviousDateTime( QDateTime( mStartDate ) , &last );
1245 QDateTime incidenceEnd; 1262 QDateTime incidenceEnd;
1246 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() ); 1263 int eventlen = event->dtStart().date().daysTo ( event->dtEnd().date() );
1247 bool invalid = false; 1264 bool invalid = false;
1248 while( true ) { 1265 while( true ) {
1249 if ( incidenceStart.isValid() ) { 1266 if ( incidenceStart.isValid() ) {
1250 incidenceEnd = incidenceStart.addDays( eventlen ); 1267 incidenceEnd = incidenceStart.addDays( eventlen );
1251 int st = incidenceStart.date().daysTo( endDate ); 1268 int st = incidenceStart.date().daysTo( endDate );
1252 if ( st >= 0 ) { // start before timeend 1269 if ( st >= 0 ) { // start before timeend
1253 int end = mStartDate.daysTo( incidenceEnd.date() ); 1270 int end = mStartDate.daysTo( incidenceEnd.date() );
1254 if ( end >= 0 ) { // end after timestart --- got one! 1271 if ( end >= 0 ) { // end after timestart --- got one!
1255 //normalize 1272 //normalize
1256 st = timeSpan - st; 1273 st = timeSpan - st;
1257 if ( st < 0 ) st = 0; 1274 if ( st < 0 ) st = 0;
1258 if ( end > timeSpan ) end = timeSpan; 1275 if ( end > timeSpan ) end = timeSpan;
1259 int iii; 1276 int iii;
1260 //qDebug("found %s %d %d ",event->summary().latin1(), st, end ); 1277 //qDebug("found %s %d %d ",event->summary().latin1(), st, end );
1261 for ( iii = st;iii<= end;++iii) 1278 for ( iii = st;iii<= end;++iii)
1262 (*cells)[iii]->insertEvent( event ); 1279 (*cells)[iii]->insertEvent( event );
1263 } 1280 }
1264 } 1281 }
1265 } else { 1282 } else {
1266 if ( invalid ) 1283 if ( invalid )
1267 break; 1284 break;
1268 invalid = true; 1285 invalid = true;
1269 //qDebug("invalid %s", event->summary().latin1()); 1286 //qDebug("invalid %s", event->summary().latin1());
1270 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );; 1287 incidenceStart = QDateTime( mStartDate ).addSecs( -2 );;
1271 } 1288 }
1272 if ( last ) 1289 if ( last )
1273 break; 1290 break;
1274 bool ok; 1291 bool ok;
1275 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok ); 1292 incidenceStart = event->getNextOccurence( incidenceStart.addSecs( 1 ) ,&ok );
1276 if ( ! ok ) 1293 if ( ! ok )
1277 break; 1294 break;
1278 if ( incidenceStart.date() > endDate ) 1295 if ( incidenceStart.date() > endDate )
1279 break; 1296 break;
1280 } 1297 }
1281 } else { // no recur 1298 } else { // no recur
1282 int st = event->dtStart().date().daysTo( endDate ); 1299 int st = event->dtStart().date().daysTo( endDate );
1283 if ( st >= 0 ) { // start before timeend 1300 if ( st >= 0 ) { // start before timeend
1284 int end = mStartDate.daysTo( event->dtEnd().date() ); 1301 int end = mStartDate.daysTo( event->dtEnd().date() );
1285 if ( end >= 0 ) { // end after timestart --- got one! 1302 if ( end >= 0 ) { // end after timestart --- got one!
1286 //normalize 1303 //normalize
1287 st = timeSpan - st; 1304 st = timeSpan - st;
1288 if ( st < 0 ) st = 0; 1305 if ( st < 0 ) st = 0;
1289 if ( end > timeSpan ) end = timeSpan; 1306 if ( end > timeSpan ) end = timeSpan;
1290 int iii; 1307 int iii;
1291 for ( iii = st;iii<= end;++iii) 1308 for ( iii = st;iii<= end;++iii)
1292 (*cells)[iii]->insertEvent( event ); 1309 (*cells)[iii]->insertEvent( event );
1293 } 1310 }
1294 } 1311 }
1295 } 1312 }
1296 } 1313 }
1297 // insert due todos 1314 // insert due todos
1298 QPtrList<Todo> todos = calendar()->todos( ); 1315 QPtrList<Todo> todos = calendar()->todos( );
1299 Todo *todo; 1316 Todo *todo;
1300 for(todo = todos.first(); todo; todo = todos.next()) { 1317 for(todo = todos.first(); todo; todo = todos.next()) {
1301 //insertTodo( todo ); 1318 //insertTodo( todo );
1302 if ( todo->hasDueDate() ) { 1319 if ( todo->hasDueDate() ) {
1303 int day = mStartDate.daysTo( todo->dtDue().date() ); 1320 int day = mStartDate.daysTo( todo->dtDue().date() );
1304 if ( day >= 0 && day < timeSpan + 1) { 1321 if ( day >= 0 && day < timeSpan + 1) {
1305 (*cells)[day]->insertTodo( todo ); 1322 (*cells)[day]->insertTodo( todo );
1306 } 1323 }
1307 } 1324 }
1308 } 1325 }
1309 1326
1310 for( i = 0; i < timeSpan+1; ++i ) { 1327 for( i = 0; i < timeSpan+1; ++i ) {
1311 (*cells)[i]->finishUpdateCell(); 1328 (*cells)[i]->finishUpdateCell();
1312 } 1329 }
1313 processSelectionChange(); 1330 processSelectionChange();
1314 (*cells)[0]->setFocus(); 1331 (*cells)[0]->setFocus();
1315 1332
1316 1333
@@ -1500,171 +1517,180 @@ void KOMonthView::computeLayout()
1500 int colWid = wid / daysToShow; 1517 int colWid = wid / daysToShow;
1501 int lastCol = wid - ( colWid*6 ); 1518 int lastCol = wid - ( colWid*6 );
1502 int dayLabelHei = mDayLabels[0]->sizeHint().height(); 1519 int dayLabelHei = mDayLabels[0]->sizeHint().height();
1503 int cellHei = (hei - dayLabelHei) /6; 1520 int cellHei = (hei - dayLabelHei) /6;
1504 int colModulo = wid % daysToShow; 1521 int colModulo = wid % daysToShow;
1505 int rowModulo = (hei- dayLabelHei) % 6; 1522 int rowModulo = (hei- dayLabelHei) % 6;
1506 //qDebug("rowmod %d ", rowModulo); 1523 //qDebug("rowmod %d ", rowModulo);
1507 int i; 1524 int i;
1508 int x,y,w,h; 1525 int x,y,w,h;
1509 x= 0; 1526 x= 0;
1510 y= 0; 1527 y= 0;
1511 w = colWid; 1528 w = colWid;
1512 h = dayLabelHei ; 1529 h = dayLabelHei ;
1513 for ( i = 0; i < 7; i++) { 1530 for ( i = 0; i < 7; i++) {
1514 if ( i == daysToShow-colModulo ) 1531 if ( i == daysToShow-colModulo )
1515 ++w; 1532 ++w;
1516 if ( combinedSatSun ) { 1533 if ( combinedSatSun ) {
1517 if ( i >= daysToShow-1 ) { 1534 if ( i >= daysToShow-1 ) {
1518 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h); 1535 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w/2,h);
1519 x -= w/2 ; 1536 x -= w/2 ;
1520 } 1537 }
1521 else 1538 else
1522 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1539 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1523 } else 1540 } else
1524 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h); 1541 mDayLabels[i]->setGeometry( x+weeklabelwid,y,w,h);
1525 x += w; 1542 x += w;
1526 } 1543 }
1527 x= 0; 1544 x= 0;
1528 y= dayLabelHei; 1545 y= dayLabelHei;
1529 w = colWid; 1546 w = colWid;
1530 h = cellHei ; 1547 h = cellHei ;
1531 for ( i = 0; i < mCells.count(); ++i) { 1548 for ( i = 0; i < mCells.count(); ++i) {
1532 //qDebug("iii %d ", i); 1549 //qDebug("iii %d ", i);
1533 w = colWid; 1550 w = colWid;
1534 if ( ((i) % 7) >= 7-colModulo ) { 1551 if ( ((i) % 7) >= 7-colModulo ) {
1535 ++w; 1552 ++w;
1536 } 1553 }
1537 if ( i == (6-rowModulo)*7) 1554 if ( i == (6-rowModulo)*7)
1538 ++h; 1555 ++h;
1539 if ( combinedSatSun ) { 1556 if ( combinedSatSun ) {
1540 if ( (i)%7 >= daysToShow-1 ) { 1557 if ( (i)%7 >= daysToShow-1 ) {
1541 if ( (i)%7 == daysToShow-1 ) { 1558 if ( (i)%7 == daysToShow-1 ) {
1542 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 ); 1559 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h/2 );
1543 x -= w ;y += h/2; 1560 x -= w ;y += h/2;
1544 } else { 1561 } else {
1545 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 ); 1562 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h-h/2 );
1546 y -= h/2; 1563 y -= h/2;
1547 } 1564 }
1548 } else 1565 } else
1549 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1566 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1550 1567
1551 } 1568 }
1552 else 1569 else
1553 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h ); 1570 mCells[i]->setGeometry ( x+weeklabelwid,y,w,h );
1554 x += w; 1571 x += w;
1555 if ( x + w/2 > wid ) { 1572 if ( x + w/2 > wid ) {
1556 x = 0; 1573 x = 0;
1557 y += h; 1574 y += h;
1558 } 1575 }
1559 } 1576 }
1560 y= dayLabelHei; 1577 y= dayLabelHei;
1561 h = cellHei ; 1578 h = cellHei ;
1562 for ( i = 0; i < 6; i++) { 1579 for ( i = 0; i < 6; i++) {
1563 if ( i == (6-rowModulo)) 1580 if ( i == (6-rowModulo))
1564 ++h; 1581 ++h;
1565 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); 1582 mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h);
1566 y += h; 1583 y += h;
1567 } 1584 }
1568 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); 1585 mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei);
1569 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); 1586 // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height());
1570 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); 1587 //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height());
1571 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ; 1588 mShortDayLabelsM = mDayLabels[0]->width()-2 < mWidthLongDayLabel ;
1572 updateDayLabels(); 1589 updateDayLabels();
1573 //bool forceUpdate = !updatePossible; 1590 //bool forceUpdate = !updatePossible;
1574 updatePossible = true; 1591 updatePossible = true;
1575 //mWeekLabels[mNumWeeks]->setText( i18n("W")); 1592 //mWeekLabels[mNumWeeks]->setText( i18n("W"));
1576} 1593}
1577 1594
1578void KOMonthView::showContextMenu( Incidence *incidence ) 1595void KOMonthView::showContextMenu( Incidence *incidence )
1579{ 1596{
1580 mContextMenu->showIncidencePopup(incidence); 1597 mContextMenu->showIncidencePopup(incidence);
1581 /* 1598 /*
1582 if( incidence && incidence->type() == "Event" ) { 1599 if( incidence && incidence->type() == "Event" ) {
1583 Event *event = static_cast<Event *>(incidence); 1600 Event *event = static_cast<Event *>(incidence);
1584 mContextMenu->showEventPopup(event); 1601 mContextMenu->showEventPopup(event);
1585 } else { 1602 } else {
1586 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; 1603 kdDebug() << "MonthView::showContextMenu(): cast failed." << endl;
1587 } 1604 }
1588 */ 1605 */
1589} 1606}
1590MonthViewCell * KOMonthView::selectedCell( ) 1607MonthViewCell * KOMonthView::selectedCell( )
1591{ 1608{
1592 return mSelectedCell; 1609 return mSelectedCell;
1593} 1610}
1594void KOMonthView::setSelectedCell( MonthViewCell *cell ) 1611void KOMonthView::setSelectedCell( MonthViewCell *cell )
1595{ 1612{
1596 // qDebug("KOMonthView::setSelectedCell "); 1613 //qDebug("KOMonthView::setSelectedCell ");
1597 if ( mSelectedCell && mSelectedCell != cell ) { 1614 if ( mSelectedCell && mSelectedCell != cell ) {
1598 MonthViewCell * mvc = mSelectedCell; 1615 MonthViewCell * mvc = mSelectedCell;
1599 mSelectedCell = cell; 1616 mSelectedCell = cell;
1600 mvc->deselect(); 1617 mvc->deselect();
1601 } else 1618 } else
1602 mSelectedCell = cell; 1619 mSelectedCell = cell;
1603 // if ( mSelectedCell ) 1620 // if ( mSelectedCell )
1604 // mSelectedCell->select(); 1621 // mSelectedCell->select();
1605 if ( !mSelectedCell ) 1622 if ( !mSelectedCell )
1606 emit incidenceSelected( 0 ); 1623 emit incidenceSelected( 0 );
1607 else 1624 else
1608 emit incidenceSelected( mSelectedCell->selectedIncidence() ); 1625 emit incidenceSelected( mSelectedCell->selectedIncidence() );
1609} 1626}
1610 1627
1611void KOMonthView::processSelectionChange() 1628void KOMonthView::processSelectionChange()
1612{ 1629{
1613 QPtrList<Incidence> incidences = selectedIncidences(); 1630 QPtrList<Incidence> incidences = selectedIncidences();
1614 if (incidences.count() > 0) { 1631 if (incidences.count() > 0) {
1615 emit incidenceSelected( incidences.first() ); 1632 emit incidenceSelected( incidences.first() );
1616 } else { 1633 } else {
1617 emit incidenceSelected( 0 ); 1634 emit incidenceSelected( 0 );
1635 clearSelection();
1618 } 1636 }
1619} 1637}
1620 1638
1621void KOMonthView::clearSelection() 1639void KOMonthView::clearSelection()
1622{ 1640{
1623 if ( mSelectedCell ) { 1641 if ( mSelectedCell ) {
1624 mSelectedCell->deselect(); 1642 mSelectedCell->deselect();
1625 mSelectedCell = 0; 1643 mSelectedCell = 0;
1626 } 1644 }
1627} 1645}
1628void KOMonthView::keyPressEvent ( QKeyEvent * e ) 1646void KOMonthView::keyPressEvent ( QKeyEvent * e )
1629{ 1647{
1630 //qDebug("KOMonthView::keyPressEvent "); 1648 //qDebug("KOMonthView::keyPressEvent ");
1631 switch(e->key()) { 1649 switch(e->key()) {
1632 case Key_Up: 1650 case Key_Up:
1633 { 1651 {
1634 if ( mShowWeekView ) { 1652 if ( mShowWeekView ) {
1635 mCellsW[0]->setFocus(); 1653 mCellsW[0]->setFocus();
1636 emit selectWeekNum ( currentWeek() - 1 ); 1654 emit selectWeekNum ( currentWeek() - 1 );
1637 } 1655 }
1638 else { 1656 else {
1639 mCells[0]->setFocus(); 1657 mCells[0]->setFocus();
1640 emit prevMonth(); 1658 emit prevMonth();
1641 } 1659 }
1642 } 1660 }
1643 e->accept(); 1661 e->accept();
1644 break; 1662 break;
1645 case Key_Down: 1663 case Key_Down:
1646 { 1664 {
1647 if ( mShowWeekView ) { 1665 if ( mShowWeekView ) {
1648 mCellsW[0]->setFocus(); 1666 mCellsW[0]->setFocus();
1649 emit selectWeekNum ( currentWeek() +1); 1667 emit selectWeekNum ( currentWeek() +1);
1650 } 1668 }
1651 else { 1669 else {
1652 mCells[0]->setFocus(); 1670 mCells[0]->setFocus();
1653 emit nextMonth(); 1671 emit nextMonth();
1654 } 1672 }
1655 1673
1656 } 1674 }
1657 e->accept(); 1675 e->accept();
1658 break; 1676 break;
1659 case Key_Return: 1677 case Key_Return:
1660 case Key_Enter: 1678 case Key_Enter:
1661 { 1679 {
1662 selectInternalWeekNum ( currentWeek() ); 1680 selectInternalWeekNum ( currentWeek() );
1663 } 1681 }
1664 e->accept(); 1682 e->accept();
1665 break; 1683 break;
1684 case Key_D:
1685 if ( mSelectedCell ) {
1686 mSelectedCell->showDay();
1687 e->accept();
1688 } else {
1689 e->ignore();
1690 }
1691 break;
1666 default: 1692 default:
1667 e->ignore(); 1693 e->ignore();
1668 break; 1694 break;
1669 } 1695 }
1670} 1696}
diff --git a/korganizer/komonthview.h b/korganizer/komonthview.h
index f92a69a..fd8cbf2 100644
--- a/korganizer/komonthview.h
+++ b/korganizer/komonthview.h
@@ -77,199 +77,202 @@ class KNoScrollListBox: public QListBox
77 void shiftUp(); 77 void shiftUp();
78 void rightClick(); 78 void rightClick();
79 79
80 protected slots: 80 protected slots:
81 void oneDown(); 81 void oneDown();
82 void keyPressEvent(QKeyEvent *); 82 void keyPressEvent(QKeyEvent *);
83 void keyReleaseEvent(QKeyEvent *); 83 void keyReleaseEvent(QKeyEvent *);
84 void mousePressEvent(QMouseEvent *); 84 void mousePressEvent(QMouseEvent *);
85 85
86 private: 86 private:
87 KNOWhatsThis * mWT; 87 KNOWhatsThis * mWT;
88}; 88};
89 89
90 90
91class MonthViewItem: public QListBoxItem 91class MonthViewItem: public QListBoxItem
92{ 92{
93 public: 93 public:
94 MonthViewItem( Incidence *, QDate qd, const QString & title ); 94 MonthViewItem( Incidence *, QDate qd, const QString & title );
95 95
96 void setRecur(bool on) { mRecur = on; } 96 void setRecur(bool on) { mRecur = on; }
97 void setAlarm(bool on) { mAlarm = on; } 97 void setAlarm(bool on) { mAlarm = on; }
98 void setReply(bool on) { mReply = on; } 98 void setReply(bool on) { mReply = on; }
99 void setMoreInfo(bool on) { mInfo = on; } 99 void setMoreInfo(bool on) { mInfo = on; }
100 void setMultiDay(int type) { mMultiday = type; } 100 void setMultiDay(int type) { mMultiday = type; }
101 101
102 102
103 void setPalette(const QPalette &p) { mPalette = p; } 103 void setPalette(const QPalette &p) { mPalette = p; }
104 QPalette palette() const { return mPalette; } 104 QPalette palette() const { return mPalette; }
105 105
106 Incidence *incidence() const { return mIncidence; } 106 Incidence *incidence() const { return mIncidence; }
107 QDate incidenceDate() { return mDate; } 107 QDate incidenceDate() { return mDate; }
108 108
109 protected: 109 protected:
110 virtual void paint(QPainter *); 110 virtual void paint(QPainter *);
111 virtual int height(const QListBox *) const; 111 virtual int height(const QListBox *) const;
112 virtual int width(const QListBox *) const; 112 virtual int width(const QListBox *) const;
113 113
114 private: 114 private:
115 int mMultiday; 115 int mMultiday;
116 bool mRecur; 116 bool mRecur;
117 bool mAlarm; 117 bool mAlarm;
118 bool mReply; 118 bool mReply;
119 bool mInfo; 119 bool mInfo;
120 120
121 QPalette mPalette; 121 QPalette mPalette;
122 QDate mDate; 122 QDate mDate;
123 123
124 Incidence *mIncidence; 124 Incidence *mIncidence;
125}; 125};
126 126
127 127
128class KOMonthView; 128class KOMonthView;
129 129
130class MonthViewCell : public QWidget 130class MonthViewCell : public QWidget
131{ 131{
132 Q_OBJECT 132 Q_OBJECT
133 public: 133 public:
134 MonthViewCell(KOMonthView *,QWidget* ); 134 MonthViewCell(KOMonthView *,QWidget* );
135 135
136 void setDate( const QDate & ); 136 void setDate( const QDate & );
137 QDate date() const; 137 QDate date() const;
138 138
139 void setPrimary( bool ); 139 void setPrimary( bool );
140 bool isPrimary() const; 140 bool isPrimary() const;
141 141
142 void setHoliday( bool ); 142 void setHoliday( bool );
143 void setHoliday( const QString & ); 143 void setHoliday( const QString & );
144 144
145 void updateCell(); 145 void updateCell();
146 void startUpdateCell(); 146 void startUpdateCell();
147 void finishUpdateCell(); 147 void finishUpdateCell();
148 void insertEvent(Event *); 148 void insertEvent(Event *);
149 void insertTodo(Todo *); 149 void insertTodo(Todo *);
150 150
151 void updateConfig( bool bigFont = false ); 151 void updateConfig( bool bigFont = false );
152 152
153 void enableScrollBars( bool ); 153 void enableScrollBars( bool );
154 154
155 Incidence *selectedIncidence(); 155 Incidence *selectedIncidence();
156 QDate selectedIncidenceDate(); 156 QDate selectedIncidenceDate();
157 157
158 void deselect(); 158 void deselect();
159 void select(); 159 void select();
160 160
161#ifdef DESKTOP_VERSION 161#ifdef DESKTOP_VERSION
162 static QToolTipGroup *toolTipGroup(); 162 static QToolTipGroup *toolTipGroup();
163#endif 163#endif
164 signals: 164 signals:
165 void defaultAction( Incidence * ); 165 void defaultAction( Incidence * );
166 void newEventSignal( QDateTime ); 166 void newEventSignal( QDateTime );
167 void showDaySignal( QDate ); 167 void showDaySignal( QDate );
168 168
169 protected: 169 protected:
170 QString mToolTip; 170 QString mToolTip;
171 void resizeEvent( QResizeEvent * ); 171 void resizeEvent( QResizeEvent * );
172 172
173
174public slots:
175 void showDay();
176
173 protected slots: 177 protected slots:
174 void defaultAction( QListBoxItem * ); 178 void defaultAction( QListBoxItem * );
175 void contextMenu( QListBoxItem * ); 179 void contextMenu( QListBoxItem * );
176 void selection( QListBoxItem * ); 180 void selection( QListBoxItem * );
177 void cellClicked( QListBoxItem * ); 181 void cellClicked( QListBoxItem * );
178 void newEvent(); 182 void newEvent();
179 void showDay();
180 183
181 private: 184 private:
182 KOMonthView *mMonthView; 185 KOMonthView *mMonthView;
183 186
184 QDate mDate; 187 QDate mDate;
185 bool mPrimary; 188 bool mPrimary;
186 bool mHoliday; 189 bool mHoliday;
187 QString mHolidayString; 190 QString mHolidayString;
188 191
189 //QLabel *mLabel; 192 //QLabel *mLabel;
190 QPushButton *mLabel; 193 QPushButton *mLabel;
191 QListBox *mItemList; 194 QListBox *mItemList;
192#ifdef DESKTOP_VERSION 195#ifdef DESKTOP_VERSION
193 static QToolTipGroup *mToolTipGroup; 196 static QToolTipGroup *mToolTipGroup;
194#endif 197#endif
195 QSize mLabelSize; 198 QSize mLabelSize;
196 QSize mLabelBigSize; 199 QSize mLabelBigSize;
197 QPalette mHolidayPalette; 200 QPalette mHolidayPalette;
198 QPalette mStandardPalette; 201 QPalette mStandardPalette;
199 QPalette mPrimaryPalette; 202 QPalette mPrimaryPalette;
200 QPalette mNonPrimaryPalette; 203 QPalette mNonPrimaryPalette;
201 void setMyPalette(); 204 void setMyPalette();
202 QPalette getPalette (); 205 QPalette getPalette ();
203 void keyPressEvent ( QKeyEvent * ) ; 206 void keyPressEvent ( QKeyEvent * ) ;
204 207
205}; 208};
206 209
207 210
208class KOMonthView: public KOEventView 211class KOMonthView: public KOEventView
209{ 212{
210 Q_OBJECT 213 Q_OBJECT
211 public: 214 public:
212 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 ); 215 KOMonthView(Calendar *cal, QWidget *parent = 0, const char *name = 0 );
213 ~KOMonthView(); 216 ~KOMonthView();
214 217
215 /** Returns maximum number of days supported by the komonthview */ 218 /** Returns maximum number of days supported by the komonthview */
216 virtual int maxDatesHint(); 219 virtual int maxDatesHint();
217 220
218 /** Returns number of currently shown dates. */ 221 /** Returns number of currently shown dates. */
219 virtual int currentDateCount(); 222 virtual int currentDateCount();
220 223
221 /** returns the currently selected events */ 224 /** returns the currently selected events */
222 virtual QPtrList<Incidence> selectedIncidences(); 225 virtual QPtrList<Incidence> selectedIncidences();
223 226
224 /** returns dates of the currently selected events */ 227 /** returns dates of the currently selected events */
225 virtual DateList selectedDates(); 228 virtual DateList selectedDates();
226 229
227 virtual void printPreview(CalPrinter *calPrinter, 230 virtual void printPreview(CalPrinter *calPrinter,
228 const QDate &, const QDate &); 231 const QDate &, const QDate &);
229 bool isMonthView() { return !mShowWeekView; } 232 bool isMonthView() { return !mShowWeekView; }
230 bool isUpdatePossible() { return updatePossible; } 233 bool isUpdatePossible() { return updatePossible; }
231 234
232 MonthViewCell * selectedCell(); 235 MonthViewCell * selectedCell();
233 bool skipResize; 236 bool skipResize;
234 NavigatorBar* navigatorBar() { return mNavigatorBar ;} 237 NavigatorBar* navigatorBar() { return mNavigatorBar ;}
235 public slots: 238 public slots:
236 virtual void updateView(); 239 virtual void updateView();
237 virtual void updateConfig(); 240 virtual void updateConfig();
238 virtual void showDates(const QDate &start, const QDate &end); 241 virtual void showDates(const QDate &start, const QDate &end);
239 virtual void showEvents(QPtrList<Event> eventList); 242 virtual void showEvents(QPtrList<Event> eventList);
240 243
241 void changeEventDisplay(Event *, int); 244 void changeEventDisplay(Event *, int);
242 245
243 void clearSelection(); 246 void clearSelection();
244 247
245 void showContextMenu( Incidence * ); 248 void showContextMenu( Incidence * );
246 249
247 void setSelectedCell( MonthViewCell * ); 250 void setSelectedCell( MonthViewCell * );
248 void switchView(); 251 void switchView();
249 252
250 protected slots: 253 protected slots:
251 void selectInternalWeekNum ( int ); 254 void selectInternalWeekNum ( int );
252 void processSelectionChange(); 255 void processSelectionChange();
253 signals: 256 signals:
254 void nextMonth(); 257 void nextMonth();
255 void prevMonth(); 258 void prevMonth();
256 void selectWeekNum ( int ); 259 void selectWeekNum ( int );
257 void selectMonth (); 260 void selectMonth ();
258 void showDaySignal( QDate ); 261 void showDaySignal( QDate );
259 protected: 262 protected:
260 void resizeEvent(QResizeEvent *); 263 void resizeEvent(QResizeEvent *);
261 void viewChanged(); 264 void viewChanged();
262 void updateDayLabels(); 265 void updateDayLabels();
263 266
264 private: 267 private:
265 NavigatorBar* mNavigatorBar; 268 NavigatorBar* mNavigatorBar;
266 int currentWeek(); 269 int currentWeek();
267 bool clPending; 270 bool clPending;
268 QWidgetStack * mWidStack; 271 QWidgetStack * mWidStack;
269 QWidget* mMonthView; 272 QWidget* mMonthView;
270 QWidget* mWeekView; 273 QWidget* mWeekView;
271 bool mShowWeekView; 274 bool mShowWeekView;
272 bool updatePossible; 275 bool updatePossible;
273 int mDaysPerWeek; 276 int mDaysPerWeek;
274 int mNumWeeks; 277 int mNumWeeks;
275 int mNumCells; 278 int mNumCells;