-rw-r--r-- | korganizer/koagendaview.cpp | 47 | ||||
-rw-r--r-- | korganizer/koagendaview.h | 1 |
2 files changed, 45 insertions, 3 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index c018dc7..f8301f8 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -303,406 +303,419 @@ void EventIndicator::drawContents(QPainter *p) | |||
303 | int i; | 303 | int i; |
304 | bool setColor = false; | 304 | bool setColor = false; |
305 | for(i=0;i<mColumns;++i) { | 305 | for(i=0;i<mColumns;++i) { |
306 | if (mEnabled[i]) { | 306 | if (mEnabled[i]) { |
307 | setColor = true; | 307 | setColor = true; |
308 | 308 | ||
309 | int cellWidth = contentsRect().right()/mColumns; | 309 | int cellWidth = contentsRect().right()/mColumns; |
310 | int xOffset = KOGlobals::self()->reverseLayout() ? | 310 | int xOffset = KOGlobals::self()->reverseLayout() ? |
311 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : | 311 | (mColumns - 1 - i)*cellWidth + cellWidth/2 -mPixmap.width()/2 : |
312 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; | 312 | i*cellWidth + cellWidth/2 -mPixmap.width()/2; |
313 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); | 313 | pa.drawPixmap(QPoint(mXOffset + xOffset,0),mPixmap); |
314 | //qDebug("222draw pix %d ",xOffset ); | 314 | //qDebug("222draw pix %d ",xOffset ); |
315 | 315 | ||
316 | } | 316 | } |
317 | 317 | ||
318 | } | 318 | } |
319 | pa.end(); | 319 | pa.end(); |
320 | 320 | ||
321 | } | 321 | } |
322 | } | 322 | } |
323 | 323 | ||
324 | void EventIndicator::setXOffset( int x ) | 324 | void EventIndicator::setXOffset( int x ) |
325 | { | 325 | { |
326 | mXOffset = x; | 326 | mXOffset = x; |
327 | } | 327 | } |
328 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) | 328 | void EventIndicator::setPaintWidget( KDGanttMinimizeSplitter * w ) |
329 | { | 329 | { |
330 | mPaintWidget = w; | 330 | mPaintWidget = w; |
331 | } | 331 | } |
332 | void EventIndicator::changeColumns(int columns) | 332 | void EventIndicator::changeColumns(int columns) |
333 | { | 333 | { |
334 | mColumns = columns; | 334 | mColumns = columns; |
335 | mEnabled.resize(mColumns); | 335 | mEnabled.resize(mColumns); |
336 | 336 | ||
337 | update(); | 337 | update(); |
338 | } | 338 | } |
339 | 339 | ||
340 | void EventIndicator::enableColumn(int column, bool enable) | 340 | void EventIndicator::enableColumn(int column, bool enable) |
341 | { | 341 | { |
342 | mEnabled[column] = enable; | 342 | mEnabled[column] = enable; |
343 | } | 343 | } |
344 | 344 | ||
345 | 345 | ||
346 | //////////////////////////////////////////////////////////////////////////// | 346 | //////////////////////////////////////////////////////////////////////////// |
347 | //////////////////////////////////////////////////////////////////////////// | 347 | //////////////////////////////////////////////////////////////////////////// |
348 | //////////////////////////////////////////////////////////////////////////// | 348 | //////////////////////////////////////////////////////////////////////////// |
349 | 349 | ||
350 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | 350 | KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : |
351 | KOEventView (cal,parent,name) | 351 | KOEventView (cal,parent,name) |
352 | { | 352 | { |
353 | mBlockUpdating = true; | 353 | mBlockUpdating = true; |
354 | mStartHour = 8; | 354 | mStartHour = 8; |
355 | mSelectedDates.append(QDate::currentDate()); | 355 | mSelectedDates.append(QDate::currentDate()); |
356 | 356 | ||
357 | mLayoutDayLabels = 0; | 357 | mLayoutDayLabels = 0; |
358 | mDayLabelsFrame = 0; | 358 | mDayLabelsFrame = 0; |
359 | mDayLabels = 0; | 359 | mDayLabels = 0; |
360 | bool isRTL = KOGlobals::self()->reverseLayout(); | 360 | bool isRTL = KOGlobals::self()->reverseLayout(); |
361 | 361 | ||
362 | if ( KOPrefs::instance()->mVerticalScreen ) { | 362 | if ( KOPrefs::instance()->mVerticalScreen ) { |
363 | mExpandedPixmap = SmallIcon( "1downarrow" ); | 363 | mExpandedPixmap = SmallIcon( "1downarrow" ); |
364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); | 364 | mNotExpandedPixmap = SmallIcon( "1uparrow" ); |
365 | } else { | 365 | } else { |
366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); | 366 | mExpandedPixmap = SmallIcon( isRTL ? "1leftarrow" : "1rightarrow" ); |
367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); | 367 | mNotExpandedPixmap = SmallIcon( isRTL ? "1rightarrow" : "1leftarrow" ); |
368 | } | 368 | } |
369 | 369 | ||
370 | QBoxLayout *topLayout = new QVBoxLayout(this); | 370 | QBoxLayout *topLayout = new QVBoxLayout(this); |
371 | 371 | ||
372 | // Create day name labels for agenda columns | 372 | // Create day name labels for agenda columns |
373 | mDayLabelsFrame = new QHBox(this); | 373 | mDayLabelsFrame = new QHBox(this); |
374 | topLayout->addWidget(mDayLabelsFrame); | 374 | topLayout->addWidget(mDayLabelsFrame); |
375 | mDayLabels = new QFrame (mDayLabelsFrame); | 375 | mDayLabels = new QFrame (mDayLabelsFrame); |
376 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 376 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
377 | // Create agenda splitter | 377 | // Create agenda splitter |
378 | #ifndef KORG_NOSPLITTER | 378 | #ifndef KORG_NOSPLITTER |
379 | mSplitterAgenda = new QSplitter(Vertical,this); | 379 | mSplitterAgenda = new QSplitter(Vertical,this); |
380 | topLayout->addWidget(mSplitterAgenda); | 380 | topLayout->addWidget(mSplitterAgenda); |
381 | mSplitterAgenda->setOpaqueResize(); | 381 | mSplitterAgenda->setOpaqueResize(); |
382 | 382 | ||
383 | mAllDayFrame = new QHBox(mSplitterAgenda); | 383 | mAllDayFrame = new QHBox(mSplitterAgenda); |
384 | 384 | ||
385 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 385 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
386 | #else | 386 | #else |
387 | #if 0 | 387 | #if 0 |
388 | QWidget *mainBox = new QWidget( this ); | 388 | QWidget *mainBox = new QWidget( this ); |
389 | topLayout->addWidget( mainBox ); | 389 | topLayout->addWidget( mainBox ); |
390 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); | 390 | QBoxLayout *mainLayout = new QVBoxLayout(mainBox); |
391 | mAllDayFrame = new QHBox(mainBox); | 391 | mAllDayFrame = new QHBox(mainBox); |
392 | mainLayout->addWidget(mAllDayFrame); | 392 | mainLayout->addWidget(mAllDayFrame); |
393 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); | 393 | mainLayout->setStretchFactor( mAllDayFrame, 0 ); |
394 | mAllDayFrame->setFocusPolicy(NoFocus); | 394 | mAllDayFrame->setFocusPolicy(NoFocus); |
395 | QWidget *agendaFrame = new QWidget(mainBox); | 395 | QWidget *agendaFrame = new QWidget(mainBox); |
396 | mainLayout->addWidget(agendaFrame); | 396 | mainLayout->addWidget(agendaFrame); |
397 | mainLayout->setStretchFactor( agendaFrame, 10 ); | 397 | mainLayout->setStretchFactor( agendaFrame, 10 ); |
398 | 398 | ||
399 | agendaFrame->setFocusPolicy(NoFocus); | 399 | agendaFrame->setFocusPolicy(NoFocus); |
400 | #endif | 400 | #endif |
401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 401 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 402 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
403 | topLayout->addWidget( mSplitterAgenda ); | 403 | topLayout->addWidget( mSplitterAgenda ); |
404 | mAllDayFrame = new QHBox(mSplitterAgenda); | 404 | mAllDayFrame = new QHBox(mSplitterAgenda); |
405 | mAllDayFrame->setFocusPolicy(NoFocus); | 405 | mAllDayFrame->setFocusPolicy(NoFocus); |
406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 406 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
407 | agendaFrame->setFocusPolicy(NoFocus); | 407 | agendaFrame->setFocusPolicy(NoFocus); |
408 | 408 | ||
409 | #endif | 409 | #endif |
410 | 410 | ||
411 | // Create all-day agenda widget | 411 | // Create all-day agenda widget |
412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 412 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
413 | 413 | ||
414 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 414 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
415 | mExpandButton->setPixmap( mNotExpandedPixmap ); | 415 | mExpandButton->setPixmap( mNotExpandedPixmap ); |
416 | int widebut = mExpandButton->sizeHint().width(); | 416 | int widebut = mExpandButton->sizeHint().width(); |
417 | if ( QApplication::desktop()->width() < 480 ) | 417 | if ( QApplication::desktop()->width() < 480 ) |
418 | widebut = widebut*2; | 418 | widebut = widebut*2; |
419 | else | 419 | else |
420 | widebut = (widebut*3) / 2; | 420 | widebut = (widebut*3) / 2; |
421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 421 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
422 | // QSizePolicy::Fixed ) ); | 422 | // QSizePolicy::Fixed ) ); |
423 | mExpandButton->setFixedSize( widebut, widebut); | 423 | mExpandButton->setFixedSize( widebut, widebut); |
424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 424 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
425 | mExpandButton->setFocusPolicy(NoFocus); | 425 | mExpandButton->setFocusPolicy(NoFocus); |
426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 426 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
427 | mAllDayAgenda->setFocusPolicy(NoFocus); | 427 | mAllDayAgenda->setFocusPolicy(NoFocus); |
428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); | 428 | QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); |
429 | 429 | ||
430 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); | 430 | QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); |
431 | QLabel * dummyAllDayRightL = new QLabel ( dummyAllDayRight ); | 431 | mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); |
432 | 432 | ||
433 | dummyAllDayRightB->setFlat( true ); | 433 | dummyAllDayRightB->setFlat( true ); |
434 | dummyAllDayRightB->setFocusPolicy(NoFocus); | 434 | dummyAllDayRightB->setFocusPolicy(NoFocus); |
435 | // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | 435 | // dummyAllDayRightB->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); |
436 | //dummyAllDayRightB->setFixedHeight( dummyAllDayRightB->sizeHint().height()/2 ); | 436 | dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); |
437 | QPopupMenu * wpo = new QPopupMenu (this); | 437 | QPopupMenu * wpo = new QPopupMenu (this); |
438 | wpo->insertItem( i18n("W#"), 0 ); | 438 | wpo->insertItem( i18n("W#"), 0 ); |
439 | int i; | 439 | int i; |
440 | for ( i = 1; i < 53; i++ ) | 440 | for ( i = 1; i < 53; i++ ) |
441 | wpo->insertItem( QString::number( i ),i ); | 441 | wpo->insertItem( QString::number( i ),i ); |
442 | //Qt bug - we must add some empty fields... | 442 | //Qt bug - we must add some empty fields... |
443 | for ( i = 53; i < 54; ++i ) { | 443 | for ( i = 53; i < 54; ++i ) { |
444 | wpo->insertItem( "", 52 ); | 444 | wpo->insertItem( "", 52 ); |
445 | } | 445 | } |
446 | dummyAllDayRightB->setPopup( wpo ); | 446 | dummyAllDayRightB->setPopup( wpo ); |
447 | 447 | ||
448 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); | 448 | connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); |
449 | 449 | ||
450 | // Create event context menu for all day agenda | 450 | // Create event context menu for all day agenda |
451 | mAllDayAgendaPopup = eventPopup(); | 451 | mAllDayAgendaPopup = eventPopup(); |
452 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 452 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
453 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 453 | mAllDayAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
454 | 454 | ||
455 | // Create agenda frame | 455 | // Create agenda frame |
456 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); | 456 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,3,3); |
457 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 457 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
458 | 458 | ||
459 | // create event indicator bars | 459 | // create event indicator bars |
460 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 460 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
461 | agendaLayout->addWidget(mEventIndicatorTop,0,1); | 461 | agendaLayout->addWidget(mEventIndicatorTop,0,1); |
462 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 462 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
463 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 463 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
464 | agendaFrame); | 464 | agendaFrame); |
465 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); | 465 | agendaLayout->addWidget(mEventIndicatorBottom,2,1); |
466 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 466 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
467 | agendaLayout->addWidget(dummyAgendaRight,0,2); | 467 | agendaLayout->addWidget(dummyAgendaRight,0,2); |
468 | 468 | ||
469 | // Create time labels | 469 | // Create time labels |
470 | mTimeLabels = new TimeLabels(24,agendaFrame); | 470 | mTimeLabels = new TimeLabels(24,agendaFrame); |
471 | agendaLayout->addWidget(mTimeLabels,1,0); | 471 | agendaLayout->addWidget(mTimeLabels,1,0); |
472 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 472 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
473 | this,SLOT(updateConfig())); | 473 | this,SLOT(updateConfig())); |
474 | 474 | ||
475 | // Create agenda | 475 | // Create agenda |
476 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 476 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
477 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); | 477 | agendaLayout->addMultiCellWidget(mAgenda,1,1,1,2); |
478 | agendaLayout->setColStretch(1,1); | 478 | agendaLayout->setColStretch(1,1); |
479 | mAgenda->setFocusPolicy(NoFocus); | 479 | mAgenda->setFocusPolicy(NoFocus); |
480 | // Create event context menu for agenda | 480 | // Create event context menu for agenda |
481 | mAgendaPopup = eventPopup(); | 481 | mAgendaPopup = eventPopup(); |
482 | 482 | ||
483 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 483 | mAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
484 | i18n("Toggle Alarm"),mAgenda, | 484 | i18n("Toggle Alarm"),mAgenda, |
485 | SLOT(popupAlarm()),true); | 485 | SLOT(popupAlarm()),true); |
486 | 486 | ||
487 | 487 | ||
488 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 488 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
489 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 489 | mAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
490 | 490 | ||
491 | // make connections between dependent widgets | 491 | // make connections between dependent widgets |
492 | mTimeLabels->setAgenda(mAgenda); | 492 | mTimeLabels->setAgenda(mAgenda); |
493 | 493 | ||
494 | // Update widgets to reflect user preferences | 494 | // Update widgets to reflect user preferences |
495 | // updateConfig(); | 495 | // updateConfig(); |
496 | 496 | ||
497 | // createDayLabels(); | 497 | // createDayLabels(); |
498 | 498 | ||
499 | // these blank widgets make the All Day Event box line up with the agenda | 499 | // these blank widgets make the All Day Event box line up with the agenda |
500 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 500 | dummyAllDayRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
501 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); | 501 | dummyAgendaRight->setFixedWidth(mAgenda->verticalScrollBar()->width()); |
502 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 502 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
503 | 503 | ||
504 | // Scrolling | 504 | // Scrolling |
505 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), | 505 | connect(mAgenda->verticalScrollBar(),SIGNAL(valueChanged(int)), |
506 | mTimeLabels, SLOT(positionChanged())); | 506 | mTimeLabels, SLOT(positionChanged())); |
507 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), | 507 | connect(mTimeLabels->verticalScrollBar(),SIGNAL(valueChanged(int)), |
508 | SLOT(setContentsPos(int))); | 508 | SLOT(setContentsPos(int))); |
509 | 509 | ||
510 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 510 | connect(mAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
511 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); | 511 | connect(mAllDayAgenda,SIGNAL(showDateView( int, QDate )),SIGNAL(showDateView( int, QDate ))); |
512 | 512 | ||
513 | // Create/Show/Edit/Delete Event | 513 | // Create/Show/Edit/Delete Event |
514 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), | 514 | connect(mAgenda,SIGNAL(newEventSignal(int,int)), |
515 | SLOT(newEvent(int,int))); | 515 | SLOT(newEvent(int,int))); |
516 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), | 516 | connect(mAgenda,SIGNAL(newTodoSignal(int,int)), |
517 | SLOT(newTodo(int,int))); | 517 | SLOT(newTodo(int,int))); |
518 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 518 | connect(mAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
519 | SLOT(newEvent(int,int,int,int))); | 519 | SLOT(newEvent(int,int,int,int))); |
520 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), | 520 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int)), |
521 | SLOT(newEventAllDay(int,int))); | 521 | SLOT(newEventAllDay(int,int))); |
522 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), | 522 | connect(mAllDayAgenda,SIGNAL(newTodoSignal(int,int)), |
523 | SLOT(newTodoAllDay(int,int))); | 523 | SLOT(newTodoAllDay(int,int))); |
524 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), | 524 | connect(mAllDayAgenda,SIGNAL(newEventSignal(int,int,int,int)), |
525 | SLOT(newEventAllDay(int,int))); | 525 | SLOT(newEventAllDay(int,int))); |
526 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 526 | connect(mAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
527 | SLOT(newTimeSpanSelected(int,int,int,int))); | 527 | SLOT(newTimeSpanSelected(int,int,int,int))); |
528 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), | 528 | connect(mAllDayAgenda,SIGNAL(newTimeSpanSignal(int,int,int,int)), |
529 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); | 529 | SLOT(newTimeSpanSelectedAllDay(int,int,int,int))); |
530 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 530 | connect(mAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
531 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); | 531 | connect(mAllDayAgenda,SIGNAL(newStartSelectSignal()),SLOT(updateView())); |
532 | 532 | ||
533 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 533 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
534 | SIGNAL(editIncidenceSignal(Incidence *))); | 534 | SIGNAL(editIncidenceSignal(Incidence *))); |
535 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 535 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
536 | SIGNAL(editIncidenceSignal(Incidence *))); | 536 | SIGNAL(editIncidenceSignal(Incidence *))); |
537 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 537 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
538 | SIGNAL(showIncidenceSignal(Incidence *))); | 538 | SIGNAL(showIncidenceSignal(Incidence *))); |
539 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 539 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
540 | SIGNAL(showIncidenceSignal(Incidence *))); | 540 | SIGNAL(showIncidenceSignal(Incidence *))); |
541 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 541 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
542 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 542 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
543 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 543 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
544 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 544 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
545 | 545 | ||
546 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 546 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
547 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 547 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
548 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 548 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
549 | SLOT(updateEventDates(KOAgendaItem *, int))); | 549 | SLOT(updateEventDates(KOAgendaItem *, int))); |
550 | 550 | ||
551 | // event indicator update | 551 | // event indicator update |
552 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 552 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
553 | SLOT(updateEventIndicatorTop(int))); | 553 | SLOT(updateEventIndicatorTop(int))); |
554 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 554 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
555 | SLOT(updateEventIndicatorBottom(int))); | 555 | SLOT(updateEventIndicatorBottom(int))); |
556 | // drag signals | 556 | // drag signals |
557 | /* | 557 | /* |
558 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 558 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
559 | SLOT(startDrag(Event *))); | 559 | SLOT(startDrag(Event *))); |
560 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 560 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
561 | SLOT(startDrag(Event *))); | 561 | SLOT(startDrag(Event *))); |
562 | */ | 562 | */ |
563 | // synchronize selections | 563 | // synchronize selections |
564 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 564 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
565 | mAllDayAgenda, SLOT( deselectItem() ) ); | 565 | mAllDayAgenda, SLOT( deselectItem() ) ); |
566 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 566 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
567 | mAgenda, SLOT( deselectItem() ) ); | 567 | mAgenda, SLOT( deselectItem() ) ); |
568 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 568 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
569 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 569 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
570 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 570 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
571 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 571 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
572 | connect( mAgenda, SIGNAL( resizedSignal() ), | 572 | connect( mAgenda, SIGNAL( resizedSignal() ), |
573 | SLOT( updateConfig( ) ) ); | 573 | SLOT( updateConfig( ) ) ); |
574 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 574 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
575 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 575 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
576 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 576 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
577 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 577 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
578 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 578 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
579 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 579 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
580 | 580 | ||
581 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | ||
582 | QFontMetrics fm ( dlf ); | ||
583 | QString dayTest = "30"; | ||
584 | int wid = fm.width( dayTest ); | ||
585 | int maxWid = dummyAllDayRight->width(); | ||
586 | int fontPoint = dlf.pointSize(); | ||
587 | while ( wid > maxWid ) { | ||
588 | --fontPoint; | ||
589 | dlf.setPointSize( fontPoint ); | ||
590 | QFontMetrics f( dlf ); | ||
591 | wid = f.width( dayTest ); | ||
592 | } | ||
593 | mDummyAllDayRightL->setFont( dlf ); | ||
581 | 594 | ||
582 | } | 595 | } |
583 | 596 | ||
584 | void KOAgendaView::toggleAllDay() | 597 | void KOAgendaView::toggleAllDay() |
585 | { | 598 | { |
586 | if ( mSplitterAgenda->firstHandle() ) | 599 | if ( mSplitterAgenda->firstHandle() ) |
587 | mSplitterAgenda->firstHandle()->toggle(); | 600 | mSplitterAgenda->firstHandle()->toggle(); |
588 | } | 601 | } |
589 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 602 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
590 | { | 603 | { |
591 | calendar()->addIncidence( inc ); | 604 | calendar()->addIncidence( inc ); |
592 | 605 | ||
593 | if ( incOld ) { | 606 | if ( incOld ) { |
594 | if ( incOld->type() == "Todo" ) | 607 | if ( incOld->type() == "Todo" ) |
595 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 608 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
596 | else | 609 | else |
597 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 610 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
598 | } | 611 | } |
599 | 612 | ||
600 | } | 613 | } |
601 | 614 | ||
602 | KOAgendaView::~KOAgendaView() | 615 | KOAgendaView::~KOAgendaView() |
603 | { | 616 | { |
604 | delete mAgendaPopup; | 617 | delete mAgendaPopup; |
605 | delete mAllDayAgendaPopup; | 618 | delete mAllDayAgendaPopup; |
606 | delete KOAgendaItem::paintPix(); | 619 | delete KOAgendaItem::paintPix(); |
607 | delete KOAgendaItem::paintPixSel(); | 620 | delete KOAgendaItem::paintPixSel(); |
608 | } | 621 | } |
609 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 622 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
610 | { | 623 | { |
611 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 624 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
612 | bool uc = false; | 625 | bool uc = false; |
613 | int ow = e->oldSize().width(); | 626 | int ow = e->oldSize().width(); |
614 | int oh = e->oldSize().height(); | 627 | int oh = e->oldSize().height(); |
615 | int w = e->size().width(); | 628 | int w = e->size().width(); |
616 | int h = e->size().height(); | 629 | int h = e->size().height(); |
617 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 630 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
618 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 631 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
619 | uc = true; | 632 | uc = true; |
620 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 633 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
621 | } | 634 | } |
622 | mUpcomingWidth = e->size().width() ; | 635 | mUpcomingWidth = e->size().width() ; |
623 | if ( mBlockUpdating || uc ) { | 636 | if ( mBlockUpdating || uc ) { |
624 | mBlockUpdating = false; | 637 | mBlockUpdating = false; |
625 | //mAgenda->setMinimumSize(800 , 600 ); | 638 | //mAgenda->setMinimumSize(800 , 600 ); |
626 | //qDebug("mAgenda->resize+++++++++++++++ "); | 639 | //qDebug("mAgenda->resize+++++++++++++++ "); |
627 | updateConfig(); | 640 | updateConfig(); |
628 | //qDebug("KOAgendaView::Updating now possible "); | 641 | //qDebug("KOAgendaView::Updating now possible "); |
629 | } else | 642 | } else |
630 | createDayLabels(); | 643 | createDayLabels(); |
631 | //qDebug("resizeEvent end "); | 644 | //qDebug("resizeEvent end "); |
632 | 645 | ||
633 | } | 646 | } |
634 | void KOAgendaView::slotDaylabelClicked( int num ) | 647 | void KOAgendaView::slotDaylabelClicked( int num ) |
635 | { | 648 | { |
636 | 649 | ||
637 | QDate firstDate = mSelectedDates.first(); | 650 | QDate firstDate = mSelectedDates.first(); |
638 | if ( num == -1 ) | 651 | if ( num == -1 ) |
639 | emit showDateView( 6, firstDate ); | 652 | emit showDateView( 6, firstDate ); |
640 | else if (num >= 0 ) { | 653 | else if (num >= 0 ) { |
641 | if ( mSelectedDates.count() == 1) | 654 | if ( mSelectedDates.count() == 1) |
642 | emit showDateView( 9, firstDate.addDays( num ) ); | 655 | emit showDateView( 9, firstDate.addDays( num ) ); |
643 | else | 656 | else |
644 | emit showDateView( 3, firstDate.addDays( num ) ); | 657 | emit showDateView( 3, firstDate.addDays( num ) ); |
645 | } | 658 | } |
646 | else | 659 | else |
647 | showDateView( 10, firstDate.addDays(1) ); | 660 | showDateView( 10, firstDate.addDays(1) ); |
648 | } | 661 | } |
649 | 662 | ||
650 | KOAgendaButton* KOAgendaView::getNewDaylabel() | 663 | KOAgendaButton* KOAgendaView::getNewDaylabel() |
651 | { | 664 | { |
652 | 665 | ||
653 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); | 666 | KOAgendaButton * dayLabel = new KOAgendaButton(mDayLabels); |
654 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); | 667 | connect( dayLabel, SIGNAL( numClicked(int) ), this, SLOT ( slotDaylabelClicked(int) ) ); |
655 | mDayLabelsList.append( dayLabel ); | 668 | mDayLabelsList.append( dayLabel ); |
656 | mLayoutDayLabels->addWidget(dayLabel); | 669 | mLayoutDayLabels->addWidget(dayLabel); |
657 | return dayLabel ; | 670 | return dayLabel ; |
658 | } | 671 | } |
659 | 672 | ||
660 | void KOAgendaView::createDayLabels() | 673 | void KOAgendaView::createDayLabels() |
661 | { | 674 | { |
662 | 675 | ||
663 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 676 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
664 | // qDebug(" KOAgendaView::createDayLabels() blocked "); | 677 | // qDebug(" KOAgendaView::createDayLabels() blocked "); |
665 | return; | 678 | return; |
666 | 679 | ||
667 | } | 680 | } |
668 | int newHight; | 681 | int newHight; |
669 | 682 | ||
670 | // ### Before deleting and recreating we could check if mSelectedDates changed... | 683 | // ### Before deleting and recreating we could check if mSelectedDates changed... |
671 | // It would remove some flickering and gain speed (since this is called by | 684 | // It would remove some flickering and gain speed (since this is called by |
672 | // each updateView() call) | 685 | // each updateView() call) |
673 | 686 | ||
674 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; | 687 | int maxWid = mUpcomingWidth - mTimeLabels->width()- mAgenda->verticalScrollBar()->width() - 2; |
675 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); | 688 | mDayLabelsFrame->setMaximumWidth( mUpcomingWidth ); |
676 | if ( maxWid < 0 ) | 689 | if ( maxWid < 0 ) |
677 | maxWid = 20; | 690 | maxWid = 20; |
678 | 691 | ||
679 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; | 692 | QFont dlf = KOPrefs::instance()->mTimeLabelsFont; |
680 | QFontMetrics fm ( dlf ); | 693 | QFontMetrics fm ( dlf ); |
681 | int selCount = mSelectedDates.count(); | 694 | int selCount = mSelectedDates.count(); |
682 | QString dayTest = "Mon 20"; | 695 | QString dayTest = "Mon 20"; |
683 | //QString dayTest = "Mon 20"; | 696 | //QString dayTest = "Mon 20"; |
684 | int wid = fm.width( dayTest ); | 697 | int wid = fm.width( dayTest ); |
685 | //maxWid -= ( selCount * 3 ); //working for QLabels | 698 | //maxWid -= ( selCount * 3 ); //working for QLabels |
686 | maxWid -= ( selCount * 3 ); //working for QPushButton | 699 | maxWid -= ( selCount * 3 ); //working for QPushButton |
687 | if ( maxWid < 0 ) | 700 | if ( maxWid < 0 ) |
688 | maxWid = 20; | 701 | maxWid = 20; |
689 | int needWid = wid * selCount; | 702 | int needWid = wid * selCount; |
690 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 703 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
691 | //if ( needWid > maxWid ) | 704 | //if ( needWid > maxWid ) |
692 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 705 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
693 | while ( needWid > maxWid ) { | 706 | while ( needWid > maxWid ) { |
694 | dayTest = dayTest.left( dayTest.length() - 1 ); | 707 | dayTest = dayTest.left( dayTest.length() - 1 ); |
695 | wid = fm.width( dayTest ); | 708 | wid = fm.width( dayTest ); |
696 | needWid = wid * selCount; | 709 | needWid = wid * selCount; |
697 | } | 710 | } |
698 | int maxLen = dayTest.length(); | 711 | int maxLen = dayTest.length(); |
699 | int fontPoint = dlf.pointSize(); | 712 | int fontPoint = dlf.pointSize(); |
700 | if ( maxLen < 2 ) { | 713 | if ( maxLen < 2 ) { |
701 | int fontPoint = dlf.pointSize(); | 714 | int fontPoint = dlf.pointSize(); |
702 | while ( fontPoint > 4 ) { | 715 | while ( fontPoint > 4 ) { |
703 | --fontPoint; | 716 | --fontPoint; |
704 | dlf.setPointSize( fontPoint ); | 717 | dlf.setPointSize( fontPoint ); |
705 | QFontMetrics f( dlf ); | 718 | QFontMetrics f( dlf ); |
706 | wid = f.width( "30" ); | 719 | wid = f.width( "30" ); |
707 | needWid = wid * selCount; | 720 | needWid = wid * selCount; |
708 | if ( needWid < maxWid ) | 721 | if ( needWid < maxWid ) |
@@ -793,422 +806,450 @@ void KOAgendaView::createDayLabels() | |||
793 | addString = i18n("Day after tomorrow"); | 806 | addString = i18n("Day after tomorrow"); |
794 | if ( !addString.isEmpty() ) { | 807 | if ( !addString.isEmpty() ) { |
795 | str = addString+", " + str; | 808 | str = addString+", " + str; |
796 | } | 809 | } |
797 | } | 810 | } |
798 | dayLabel->setText(str); | 811 | dayLabel->setText(str); |
799 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 812 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
800 | if (date == QDate::currentDate()) { | 813 | if (date == QDate::currentDate()) { |
801 | QFont bFont = dlf; | 814 | QFont bFont = dlf; |
802 | bFont.setBold( true ); | 815 | bFont.setBold( true ); |
803 | dayLabel->setFont(bFont); | 816 | dayLabel->setFont(bFont); |
804 | } | 817 | } |
805 | //dayLayout->addWidget(dayLabel); | 818 | //dayLayout->addWidget(dayLabel); |
806 | 819 | ||
807 | #ifndef KORG_NOPLUGINS | 820 | #ifndef KORG_NOPLUGINS |
808 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); | 821 | CalendarDecoration::List cds = KOCore::self()->calendarDecorations(); |
809 | CalendarDecoration *it; | 822 | CalendarDecoration *it; |
810 | for(it = cds.first(); it; it = cds.next()) { | 823 | for(it = cds.first(); it; it = cds.next()) { |
811 | QString text = it->shortText( date ); | 824 | QString text = it->shortText( date ); |
812 | if ( !text.isEmpty() ) { | 825 | if ( !text.isEmpty() ) { |
813 | QLabel *label = new QLabel(text,mDayLabels); | 826 | QLabel *label = new QLabel(text,mDayLabels); |
814 | label->setAlignment(AlignCenter); | 827 | label->setAlignment(AlignCenter); |
815 | dayLayout->addWidget(label); | 828 | dayLayout->addWidget(label); |
816 | } | 829 | } |
817 | } | 830 | } |
818 | 831 | ||
819 | for(it = cds.first(); it; it = cds.next()) { | 832 | for(it = cds.first(); it; it = cds.next()) { |
820 | QWidget *wid = it->smallWidget(mDayLabels,date); | 833 | QWidget *wid = it->smallWidget(mDayLabels,date); |
821 | if ( wid ) { | 834 | if ( wid ) { |
822 | // wid->setHeight(20); | 835 | // wid->setHeight(20); |
823 | dayLayout->addWidget(wid); | 836 | dayLayout->addWidget(wid); |
824 | } | 837 | } |
825 | } | 838 | } |
826 | #endif | 839 | #endif |
827 | } | 840 | } |
828 | if ( ! appendLabels ) { | 841 | if ( ! appendLabels ) { |
829 | dayLabel = mDayLabelsList.next(); | 842 | dayLabel = mDayLabelsList.next(); |
830 | if ( !dayLabel ) | 843 | if ( !dayLabel ) |
831 | appendLabels = true; | 844 | appendLabels = true; |
832 | } | 845 | } |
833 | if ( appendLabels ) { | 846 | if ( appendLabels ) { |
834 | dayLabel = getNewDaylabel(); | 847 | dayLabel = getNewDaylabel(); |
835 | } | 848 | } |
836 | //dayLabel->hide();//test only | 849 | //dayLabel->hide();//test only |
837 | 850 | ||
838 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 851 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; |
839 | if ( offset < 0 ) offset = 0; | 852 | if ( offset < 0 ) offset = 0; |
840 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); | 853 | //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); |
841 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); | 854 | dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); |
842 | dayLabel->setFont( dlf ); | 855 | dayLabel->setFont( dlf ); |
843 | dayLabel->show(); | 856 | dayLabel->show(); |
844 | dayLabel->setNum( -2 ); | 857 | dayLabel->setNum( -2 ); |
845 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); | 858 | dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |
846 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); | 859 | //qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2); |
847 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); | 860 | //mLayoutDayLabels->addSpacing(mAgenda->verticalScrollBar()->width()+ offset+2); |
848 | if ( !appendLabels ) { | 861 | if ( !appendLabels ) { |
849 | dayLabel = mDayLabelsList.next(); | 862 | dayLabel = mDayLabelsList.next(); |
850 | while ( dayLabel ) { | 863 | while ( dayLabel ) { |
851 | //qDebug("!dayLabel %d",dayLabel ); | 864 | //qDebug("!dayLabel %d",dayLabel ); |
852 | dayLabel->hide(); | 865 | dayLabel->hide(); |
853 | dayLabel = mDayLabelsList.next(); | 866 | dayLabel = mDayLabelsList.next(); |
854 | } | 867 | } |
855 | } | 868 | } |
856 | //mDayLabelsFrame->show(); | 869 | //mDayLabelsFrame->show(); |
857 | //mDayLabels->show(); | 870 | //mDayLabels->show(); |
858 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); | 871 | //qDebug("heigt %d %d %d ",mDayLabelsFrame->height(), mDayLabelsFrame->sizeHint().height(), newHight); |
859 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); | 872 | //mDayLabelsFrame->resize( mAgenda->visibleWidth(), newHight ); |
860 | mDayLabelsFrame->setFixedHeight( newHight ); | 873 | mDayLabelsFrame->setFixedHeight( newHight ); |
861 | } | 874 | } |
862 | 875 | ||
863 | int KOAgendaView::maxDatesHint() | 876 | int KOAgendaView::maxDatesHint() |
864 | { | 877 | { |
865 | // Not sure about the max number of events, so return 0 for now. | 878 | // Not sure about the max number of events, so return 0 for now. |
866 | return 0; | 879 | return 0; |
867 | } | 880 | } |
868 | 881 | ||
869 | int KOAgendaView::currentDateCount() | 882 | int KOAgendaView::currentDateCount() |
870 | { | 883 | { |
871 | return mSelectedDates.count(); | 884 | return mSelectedDates.count(); |
872 | } | 885 | } |
873 | 886 | ||
874 | QPtrList<Incidence> KOAgendaView::selectedIncidences() | 887 | QPtrList<Incidence> KOAgendaView::selectedIncidences() |
875 | { | 888 | { |
876 | QPtrList<Incidence> selected; | 889 | QPtrList<Incidence> selected; |
877 | Incidence *incidence; | 890 | Incidence *incidence; |
878 | 891 | ||
879 | incidence = mAgenda->selectedIncidence(); | 892 | incidence = mAgenda->selectedIncidence(); |
880 | if (incidence) selected.append(incidence); | 893 | if (incidence) selected.append(incidence); |
881 | 894 | ||
882 | incidence = mAllDayAgenda->selectedIncidence(); | 895 | incidence = mAllDayAgenda->selectedIncidence(); |
883 | if (incidence) selected.append(incidence); | 896 | if (incidence) selected.append(incidence); |
884 | 897 | ||
885 | return selected; | 898 | return selected; |
886 | } | 899 | } |
887 | 900 | ||
888 | DateList KOAgendaView::selectedDates() | 901 | DateList KOAgendaView::selectedDates() |
889 | { | 902 | { |
890 | DateList selected; | 903 | DateList selected; |
891 | QDate qd; | 904 | QDate qd; |
892 | 905 | ||
893 | qd = mAgenda->selectedIncidenceDate(); | 906 | qd = mAgenda->selectedIncidenceDate(); |
894 | if (qd.isValid()) selected.append(qd); | 907 | if (qd.isValid()) selected.append(qd); |
895 | 908 | ||
896 | qd = mAllDayAgenda->selectedIncidenceDate(); | 909 | qd = mAllDayAgenda->selectedIncidenceDate(); |
897 | if (qd.isValid()) selected.append(qd); | 910 | if (qd.isValid()) selected.append(qd); |
898 | 911 | ||
899 | return selected; | 912 | return selected; |
900 | } | 913 | } |
901 | 914 | ||
902 | 915 | ||
903 | void KOAgendaView::updateView() | 916 | void KOAgendaView::updateView() |
904 | { | 917 | { |
905 | if ( mBlockUpdating ) | 918 | if ( mBlockUpdating ) |
906 | return; | 919 | return; |
907 | // kdDebug() << "KOAgendaView::updateView()" << endl; | 920 | // kdDebug() << "KOAgendaView::updateView()" << endl; |
908 | fillAgenda(); | 921 | fillAgenda(); |
909 | 922 | ||
910 | } | 923 | } |
911 | 924 | ||
912 | 925 | ||
913 | /* | 926 | /* |
914 | Update configuration settings for the agenda view. This method is not | 927 | Update configuration settings for the agenda view. This method is not |
915 | complete. | 928 | complete. |
916 | */ | 929 | */ |
917 | void KOAgendaView::updateConfig() | 930 | void KOAgendaView::updateConfig() |
918 | { | 931 | { |
919 | if ( mBlockUpdating ) | 932 | if ( mBlockUpdating ) |
920 | return; | 933 | return; |
921 | // kdDebug() << "KOAgendaView::updateConfig()" << endl; | 934 | |
935 | |||
922 | 936 | ||
923 | // update config for children | 937 | // update config for children |
924 | mTimeLabels->updateConfig(); | 938 | mTimeLabels->updateConfig(); |
925 | mAgenda->storePosition(); | 939 | mAgenda->storePosition(); |
926 | mAgenda->updateConfig(); | 940 | mAgenda->updateConfig(); |
927 | mAllDayAgenda->updateConfig(); | 941 | mAllDayAgenda->updateConfig(); |
928 | // widget synchronization | 942 | // widget synchronization |
929 | //TODO: find a better way, maybe signal/slot | 943 | //TODO: find a better way, maybe signal/slot |
930 | mTimeLabels->positionChanged(); | 944 | mTimeLabels->positionChanged(); |
931 | 945 | ||
932 | // for some reason, this needs to be called explicitly | 946 | // for some reason, this needs to be called explicitly |
933 | mTimeLabels->repaint(); | 947 | mTimeLabels->repaint(); |
934 | 948 | ||
935 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); | 949 | mDummyAllDayLeft->setFixedWidth(mTimeLabels->width()); |
936 | 950 | ||
937 | // ToolTips displaying summary of events | 951 | // ToolTips displaying summary of events |
938 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() | 952 | KOAgendaItem::toolTipGroup()->setEnabled(KOPrefs::instance() |
939 | ->mEnableToolTips); | 953 | ->mEnableToolTips); |
940 | 954 | ||
941 | //setHolidayMasks(); | 955 | //setHolidayMasks(); |
942 | 956 | ||
943 | //createDayLabels(); called by via updateView(); | 957 | //createDayLabels(); called by via updateView(); |
944 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); | 958 | mEventIndicatorTop->setXOffset(mTimeLabels->width() + mAgenda->frameWidth()); |
945 | updateView(); | 959 | updateView(); |
946 | mAgenda->restorePosition(); | 960 | mAgenda->restorePosition(); |
947 | } | 961 | } |
948 | 962 | ||
949 | 963 | ||
950 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) | 964 | void KOAgendaView::updateEventDates(KOAgendaItem *item, int type) |
951 | { | 965 | { |
952 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; | 966 | // kdDebug() << "KOAgendaView::updateEventDates(): " << item->text() << endl; |
953 | //qDebug("KOAgendaView::updateEventDates "); | 967 | //qDebug("KOAgendaView::updateEventDates "); |
954 | QDateTime startDt,endDt; | 968 | QDateTime startDt,endDt; |
955 | QDate startDate; | 969 | QDate startDate; |
956 | int lenInSecs; | 970 | int lenInSecs; |
957 | // if ( type == KOAgenda::RESIZETOP ) | 971 | // if ( type == KOAgenda::RESIZETOP ) |
958 | // qDebug("RESIZETOP "); | 972 | // qDebug("RESIZETOP "); |
959 | // if ( type == KOAgenda::RESIZEBOTTOM ) | 973 | // if ( type == KOAgenda::RESIZEBOTTOM ) |
960 | // qDebug("RESIZEBOTTOM "); | 974 | // qDebug("RESIZEBOTTOM "); |
961 | // if ( type == KOAgenda::MOVE ) | 975 | // if ( type == KOAgenda::MOVE ) |
962 | // qDebug("MOVE "); | 976 | // qDebug("MOVE "); |
963 | if ( item->incidence()->type() == "Event" ) { | 977 | if ( item->incidence()->type() == "Event" ) { |
964 | startDt =item->incidence()->dtStart(); | 978 | startDt =item->incidence()->dtStart(); |
965 | endDt = item->incidence()->dtEnd(); | 979 | endDt = item->incidence()->dtEnd(); |
966 | lenInSecs = startDt.secsTo( endDt ); | 980 | lenInSecs = startDt.secsTo( endDt ); |
967 | } | 981 | } |
968 | 982 | ||
969 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); | 983 | // emit incidenceItemChanged( item->incidence(), KOGlobals::EVENTEDITED ); |
970 | 984 | ||
971 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { | 985 | if ( item->incidence()->type()=="Todo" && item->mLastMoveXPos > 0 ) { |
972 | startDate = mSelectedDates[item->mLastMoveXPos]; | 986 | startDate = mSelectedDates[item->mLastMoveXPos]; |
973 | } else { | 987 | } else { |
974 | if (item->cellX() < 0) { | 988 | if (item->cellX() < 0) { |
975 | startDate = (mSelectedDates.first()).addDays(item->cellX()); | 989 | startDate = (mSelectedDates.first()).addDays(item->cellX()); |
976 | } else { | 990 | } else { |
977 | startDate = mSelectedDates[item->cellX()]; | 991 | startDate = mSelectedDates[item->cellX()]; |
978 | } | 992 | } |
979 | } | 993 | } |
980 | startDt.setDate(startDate); | 994 | startDt.setDate(startDate); |
981 | 995 | ||
982 | if (item->incidence()->doesFloat()) { | 996 | if (item->incidence()->doesFloat()) { |
983 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); | 997 | endDt.setDate(startDate.addDays(item->cellWidth() - 1)); |
984 | } else { | 998 | } else { |
985 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) | 999 | if ( type == KOAgenda::RESIZETOP || type == KOAgenda::MOVE ) |
986 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); | 1000 | startDt.setTime(mAgenda->gyToTime(item->cellYTop())); |
987 | if ( item->incidence()->type() == "Event" ) { | 1001 | if ( item->incidence()->type() == "Event" ) { |
988 | if ( type == KOAgenda::MOVE ) { | 1002 | if ( type == KOAgenda::MOVE ) { |
989 | endDt = startDt.addSecs(lenInSecs); | 1003 | endDt = startDt.addSecs(lenInSecs); |
990 | 1004 | ||
991 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { | 1005 | } else if ( type == KOAgenda::RESIZEBOTTOM ) { |
992 | if (item->lastMultiItem()) { | 1006 | if (item->lastMultiItem()) { |
993 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1007 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
994 | endDt.setDate(startDate. | 1008 | endDt.setDate(startDate. |
995 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1009 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
996 | } else { | 1010 | } else { |
997 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1011 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
998 | endDt.setDate(startDate); | 1012 | endDt.setDate(startDate); |
999 | } | 1013 | } |
1000 | } | 1014 | } |
1001 | } else { | 1015 | } else { |
1002 | // todo | 1016 | // todo |
1003 | if (item->lastMultiItem()) { | 1017 | if (item->lastMultiItem()) { |
1004 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); | 1018 | endDt.setTime(mAgenda->gyToTime(item->lastMultiItem()->cellYBottom()+1)); |
1005 | endDt.setDate(startDate. | 1019 | endDt.setDate(startDate. |
1006 | addDays(item->lastMultiItem()->cellX() - item->cellX())); | 1020 | addDays(item->lastMultiItem()->cellX() - item->cellX())); |
1007 | } else { | 1021 | } else { |
1008 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); | 1022 | //qDebug("tem->cellYBottom() %d",item->cellYBottom() ); |
1009 | if ( item->cellYBottom() > 0 ) | 1023 | if ( item->cellYBottom() > 0 ) |
1010 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); | 1024 | endDt.setTime(mAgenda->gyToTime(item->cellYBottom()+1)); |
1011 | else | 1025 | else |
1012 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); | 1026 | endDt.setTime((static_cast<Todo*>(item->incidence()))->dtDue().time()); |
1013 | endDt.setDate(startDate); | 1027 | endDt.setDate(startDate); |
1014 | } | 1028 | } |
1015 | } | 1029 | } |
1016 | } | 1030 | } |
1017 | if ( item->incidence()->type() == "Event" ) { | 1031 | if ( item->incidence()->type() == "Event" ) { |
1018 | item->incidence()->setDtStart(startDt); | 1032 | item->incidence()->setDtStart(startDt); |
1019 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); | 1033 | (static_cast<Event*>(item->incidence()))->setDtEnd(endDt); |
1020 | } else if ( item->incidence()->type() == "Todo" ) { | 1034 | } else if ( item->incidence()->type() == "Todo" ) { |
1021 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); | 1035 | (static_cast<Todo*>(item->incidence()))->setDtDue(endDt); |
1022 | } | 1036 | } |
1023 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); | 1037 | //qDebug("KOAgendaView::updateEventDates stsart %s end %s ", startDt.toString().latin1(), endDt.toString().latin1() ); |
1024 | item->incidence()->setRevision(item->incidence()->revision()+1); | 1038 | item->incidence()->setRevision(item->incidence()->revision()+1); |
1025 | item->setItemDate(startDt.date()); | 1039 | item->setItemDate(startDt.date()); |
1026 | //item->updateItem(); | 1040 | //item->updateItem(); |
1027 | if ( item->incidence()->type() == "Todo" ) { | 1041 | if ( item->incidence()->type() == "Todo" ) { |
1028 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); | 1042 | emit todoMoved((Todo*)item->incidence(), KOGlobals::EVENTEDITED ); |
1029 | 1043 | ||
1030 | } | 1044 | } |
1031 | else | 1045 | else |
1032 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); | 1046 | emit incidenceChanged(item->incidence(), KOGlobals::EVENTEDITED); |
1033 | item->updateItem(); | 1047 | item->updateItem(); |
1034 | } | 1048 | } |
1035 | 1049 | ||
1036 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) | 1050 | void KOAgendaView::showDates( const QDate &start, const QDate &end ) |
1037 | { | 1051 | { |
1038 | // kdDebug() << "KOAgendaView::selectDates" << endl; | 1052 | // kdDebug() << "KOAgendaView::selectDates" << endl; |
1039 | 1053 | ||
1040 | mSelectedDates.clear(); | 1054 | mSelectedDates.clear(); |
1041 | // qDebug("KOAgendaView::showDates "); | 1055 | // qDebug("KOAgendaView::showDates "); |
1042 | QDate d = start; | 1056 | QDate d = start; |
1043 | while (d <= end) { | 1057 | while (d <= end) { |
1044 | mSelectedDates.append(d); | 1058 | mSelectedDates.append(d); |
1045 | d = d.addDays( 1 ); | 1059 | d = d.addDays( 1 ); |
1046 | } | 1060 | } |
1047 | 1061 | ||
1048 | // and update the view | 1062 | // and update the view |
1049 | fillAgenda(); | 1063 | fillAgenda(); |
1050 | } | 1064 | } |
1051 | 1065 | ||
1052 | 1066 | ||
1053 | void KOAgendaView::showEvents(QPtrList<Event>) | 1067 | void KOAgendaView::showEvents(QPtrList<Event>) |
1054 | { | 1068 | { |
1055 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; | 1069 | kdDebug() << "KOAgendaView::showEvents() is not yet implemented" << endl; |
1056 | } | 1070 | } |
1057 | 1071 | ||
1058 | void KOAgendaView::changeEventDisplay(Event *, int) | 1072 | void KOAgendaView::changeEventDisplay(Event *, int) |
1059 | { | 1073 | { |
1060 | // qDebug("KOAgendaView::changeEventDisplay "); | 1074 | // qDebug("KOAgendaView::changeEventDisplay "); |
1061 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; | 1075 | // kdDebug() << "KOAgendaView::changeEventDisplay" << endl; |
1062 | // this should be re-written to be MUCH smarter. Right now we | 1076 | // this should be re-written to be MUCH smarter. Right now we |
1063 | // are just playing dumb. | 1077 | // are just playing dumb. |
1064 | fillAgenda(); | 1078 | fillAgenda(); |
1065 | } | 1079 | } |
1066 | 1080 | ||
1067 | void KOAgendaView::fillAgenda(const QDate &) | 1081 | void KOAgendaView::fillAgenda(const QDate &) |
1068 | { | 1082 | { |
1069 | // qDebug("KOAgendaView::fillAgenda "); | 1083 | // qDebug("KOAgendaView::fillAgenda "); |
1070 | fillAgenda(); | 1084 | fillAgenda(); |
1071 | } | 1085 | } |
1072 | 1086 | ||
1073 | void KOAgendaView::fillAgenda() | 1087 | void KOAgendaView::fillAgenda() |
1074 | { | 1088 | { |
1075 | if ( globalFlagBlockStartup ) | 1089 | if ( globalFlagBlockStartup ) |
1076 | return; | 1090 | return; |
1077 | if ( globalFlagBlockAgenda == 1 ) | 1091 | if ( globalFlagBlockAgenda == 1 ) |
1078 | return; | 1092 | return; |
1079 | //if ( globalFlagBlockAgenda == 2 ) | 1093 | //if ( globalFlagBlockAgenda == 2 ) |
1080 | //globalFlagBlockAgenda = 0; | 1094 | //globalFlagBlockAgenda = 0; |
1081 | // globalFlagBlockPainting = false; | 1095 | // globalFlagBlockPainting = false; |
1082 | if ( globalFlagBlockAgenda == 0 ) | 1096 | if ( globalFlagBlockAgenda == 0 ) |
1083 | globalFlagBlockAgenda = 1; | 1097 | globalFlagBlockAgenda = 1; |
1084 | // clearView(); | 1098 | // clearView(); |
1085 | //qDebug("fillAgenda()++++ "); | 1099 | //qDebug("fillAgenda()++++ "); |
1086 | globalFlagBlockAgendaItemPaint = 1; | 1100 | globalFlagBlockAgendaItemPaint = 1; |
1101 | |||
1102 | int weekNum = 0; | ||
1103 | QDate seda = mSelectedDates.first(); | ||
1104 | QDate d = QDate ( seda.year(), 1,1); | ||
1105 | seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday | ||
1106 | if ( seda.addDays(6).year() != seda.year() ) { | ||
1107 | if ( seda.year() != d.year() ) { | ||
1108 | if ( d.dayOfWeek() > 4 ) | ||
1109 | d = QDate ( seda.year(), 1,1); | ||
1110 | else | ||
1111 | weekNum = 1; | ||
1112 | } else { | ||
1113 | QDate dd( seda.year()+1, 1,1); | ||
1114 | if ( dd.dayOfWeek() <= 4 ) | ||
1115 | weekNum = 1; | ||
1116 | } | ||
1117 | } | ||
1118 | if ( weekNum == 0 ){ | ||
1119 | int dow = d.dayOfWeek(); | ||
1120 | if ( dow <= 4 ) | ||
1121 | d = d.addDays( 1-dow ); | ||
1122 | else // 5,6,7 | ||
1123 | d = d.addDays( 8-dow ); | ||
1124 | // we have the first week of the year.we are on monday | ||
1125 | weekNum = d.daysTo( seda ) / 7 +1; | ||
1126 | } | ||
1127 | mDummyAllDayRightL->setText( QString::number( weekNum) ); | ||
1087 | mAllDayAgenda->changeColumns(mSelectedDates.count()); | 1128 | mAllDayAgenda->changeColumns(mSelectedDates.count()); |
1088 | mAgenda->changeColumns(mSelectedDates.count()); | 1129 | mAgenda->changeColumns(mSelectedDates.count()); |
1089 | qApp->processEvents(); | 1130 | qApp->processEvents(); |
1090 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); | 1131 | mEventIndicatorTop->changeColumns(mSelectedDates.count()); |
1091 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); | 1132 | mEventIndicatorBottom->changeColumns(mSelectedDates.count()); |
1092 | setHolidayMasks(); | 1133 | setHolidayMasks(); |
1093 | 1134 | ||
1094 | //mAgenda->hideUnused(); | 1135 | //mAgenda->hideUnused(); |
1095 | //mAllDayAgenda->hideUnused(); | 1136 | //mAllDayAgenda->hideUnused(); |
1096 | 1137 | ||
1097 | // mAgenda->blockNextRepaint( false ); | 1138 | // mAgenda->blockNextRepaint( false ); |
1098 | // mAgenda->viewport()->repaint(); | 1139 | // mAgenda->viewport()->repaint(); |
1099 | // mAgenda->blockNextRepaint( true ); | 1140 | // mAgenda->blockNextRepaint( true ); |
1100 | mMinY.resize(mSelectedDates.count()); | 1141 | mMinY.resize(mSelectedDates.count()); |
1101 | mMaxY.resize(mSelectedDates.count()); | 1142 | mMaxY.resize(mSelectedDates.count()); |
1102 | 1143 | ||
1103 | QPtrList<Event> dayEvents; | 1144 | QPtrList<Event> dayEvents; |
1104 | 1145 | ||
1105 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1146 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1106 | // Therefore, gtodoset all of them. | 1147 | // Therefore, gtodoset all of them. |
1107 | QPtrList<Todo> todos = calendar()->todos(); | 1148 | QPtrList<Todo> todos = calendar()->todos(); |
1108 | 1149 | ||
1109 | mAgenda->setDateList(mSelectedDates); | 1150 | mAgenda->setDateList(mSelectedDates); |
1110 | 1151 | ||
1111 | QDate today = QDate::currentDate(); | 1152 | QDate today = QDate::currentDate(); |
1112 | 1153 | ||
1113 | DateList::ConstIterator dit; | 1154 | DateList::ConstIterator dit; |
1114 | int curCol = 0; | 1155 | int curCol = 0; |
1115 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1156 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1116 | QDate currentDate = *dit; | 1157 | QDate currentDate = *dit; |
1117 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1158 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1118 | // << endl; | 1159 | // << endl; |
1119 | 1160 | ||
1120 | dayEvents = calendar()->events(currentDate,true); | 1161 | dayEvents = calendar()->events(currentDate,true); |
1121 | 1162 | ||
1122 | // Default values, which can never be reached | 1163 | // Default values, which can never be reached |
1123 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1164 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1124 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1165 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1125 | 1166 | ||
1126 | unsigned int numEvent; | 1167 | unsigned int numEvent; |
1127 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1168 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1128 | Event *event = dayEvents.at(numEvent); | 1169 | Event *event = dayEvents.at(numEvent); |
1129 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1170 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1130 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1171 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1131 | continue; | 1172 | continue; |
1132 | // kdDebug() << " Event: " << event->summary() << endl; | 1173 | // kdDebug() << " Event: " << event->summary() << endl; |
1133 | 1174 | ||
1134 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1175 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1135 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1176 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1136 | 1177 | ||
1137 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1178 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1138 | 1179 | ||
1139 | if (event->doesFloat()) { | 1180 | if (event->doesFloat()) { |
1140 | if (event->recurrence()->doesRecur()) { | 1181 | if (event->recurrence()->doesRecur()) { |
1141 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1182 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1142 | } else { | 1183 | } else { |
1143 | if (beginX <= 0 && curCol == 0) { | 1184 | if (beginX <= 0 && curCol == 0) { |
1144 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1185 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1145 | } else if (beginX == curCol) { | 1186 | } else if (beginX == curCol) { |
1146 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1187 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1147 | } | 1188 | } |
1148 | } | 1189 | } |
1149 | } else if (event->isMultiDay()) { | 1190 | } else if (event->isMultiDay()) { |
1150 | if ( event->doesRecur () ) { | 1191 | if ( event->doesRecur () ) { |
1151 | QDate dateit = currentDate; | 1192 | QDate dateit = currentDate; |
1152 | int count = 0; | 1193 | int count = 0; |
1153 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1194 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1154 | while (! event->recursOn( dateit ) && count <= max ) { | 1195 | while (! event->recursOn( dateit ) && count <= max ) { |
1155 | ++count; | 1196 | ++count; |
1156 | dateit = dateit.addDays( -1 ); | 1197 | dateit = dateit.addDays( -1 ); |
1157 | } | 1198 | } |
1158 | bool ok; | 1199 | bool ok; |
1159 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1200 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1160 | if ( ok ) | 1201 | if ( ok ) |
1161 | { | 1202 | { |
1162 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1203 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1163 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1204 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1164 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1205 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1165 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1206 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1166 | 1207 | ||
1167 | } | 1208 | } |
1168 | } | 1209 | } |
1169 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1210 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1170 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1211 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1171 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1212 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1172 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1213 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1173 | //qDebug("insert!!! "); | 1214 | //qDebug("insert!!! "); |
1174 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1215 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1175 | } | 1216 | } |
1176 | if (beginX == curCol) { | 1217 | if (beginX == curCol) { |
1177 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1218 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1178 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1219 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1179 | } else if (endX == curCol) { | 1220 | } else if (endX == curCol) { |
1180 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1221 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1181 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1222 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1182 | } else { | 1223 | } else { |
1183 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1224 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1184 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1225 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1185 | } | 1226 | } |
1186 | } else { | 1227 | } else { |
1187 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1228 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1188 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1229 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1189 | if (endY < startY) endY = startY; | 1230 | if (endY < startY) endY = startY; |
1190 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); | 1231 | mAgenda->insertItem(event,currentDate,curCol,startY,endY); |
1191 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1232 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1192 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1233 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1193 | } | 1234 | } |
1194 | } | 1235 | } |
1195 | // ---------- [display Todos -------------- | 1236 | // ---------- [display Todos -------------- |
1196 | unsigned int numTodo; | 1237 | unsigned int numTodo; |
1197 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { | 1238 | for (numTodo = 0; numTodo < todos.count(); ++numTodo) { |
1198 | Todo *todo = todos.at(numTodo); | 1239 | Todo *todo = todos.at(numTodo); |
1199 | 1240 | ||
1200 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date | 1241 | if ( ! todo->hasDueDate() && !todo->hasCompletedDate()) continue; // todo shall not be displayed if it has no date |
1201 | 1242 | ||
1202 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. | 1243 | // ToDo items shall be displayed for the day they are due, but only showed today if they are already overdue. |
1203 | // Already completed items can be displayed on their original due date | 1244 | // Already completed items can be displayed on their original due date |
1204 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda | 1245 | //if not KOPrefs::instance()->mShowTodoInAgenda, show overdue in agenda |
1205 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; | 1246 | bool overdue = (!todo->isCompleted()) && (todo->dtDue() < today) && KOPrefs::instance()->mShowTodoInAgenda; |
1206 | bool fillIn = false; | 1247 | bool fillIn = false; |
1207 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) | 1248 | if ( todo->hasCompletedDate() && todo->completed().date() == currentDate ) |
1208 | fillIn = true; | 1249 | fillIn = true; |
1209 | if ( ! fillIn && !todo->hasCompletedDate() ) | 1250 | if ( ! fillIn && !todo->hasCompletedDate() ) |
1210 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); | 1251 | fillIn = ((todo->dtDue().date() == currentDate) && !overdue) || ((currentDate == today) && overdue); |
1211 | if ( fillIn ) { | 1252 | if ( fillIn ) { |
1212 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue | 1253 | if ( (todo->doesFloat() || overdue ) && !todo->hasCompletedDate() ) { // Todo has no due-time set or is already overdue |
1213 | if ( KOPrefs::instance()->mShowTodoInAgenda ) | 1254 | if ( KOPrefs::instance()->mShowTodoInAgenda ) |
1214 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); | 1255 | mAllDayAgenda->insertAllDayItem(todo, currentDate, curCol, curCol); |
diff --git a/korganizer/koagendaview.h b/korganizer/koagendaview.h index 4a058ce..ba9bc93 100644 --- a/korganizer/koagendaview.h +++ b/korganizer/koagendaview.h | |||
@@ -91,200 +91,201 @@ class TimeLabels : public QScrollView { | |||
91 | void contentsMousePressEvent ( QMouseEvent * ) ; | 91 | void contentsMousePressEvent ( QMouseEvent * ) ; |
92 | void contentsMouseReleaseEvent ( QMouseEvent * ); | 92 | void contentsMouseReleaseEvent ( QMouseEvent * ); |
93 | void contentsMouseMoveEvent ( QMouseEvent * ); | 93 | void contentsMouseMoveEvent ( QMouseEvent * ); |
94 | 94 | ||
95 | public slots: | 95 | public slots: |
96 | /** update time label positions */ | 96 | /** update time label positions */ |
97 | void positionChanged(); | 97 | void positionChanged(); |
98 | signals: | 98 | signals: |
99 | void scaleChanged(); | 99 | void scaleChanged(); |
100 | protected: | 100 | protected: |
101 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); | 101 | void drawContents(QPainter *p,int cx, int cy, int cw, int ch); |
102 | 102 | ||
103 | private: | 103 | private: |
104 | int mMouseDownY; | 104 | int mMouseDownY; |
105 | QString mOrgCap; | 105 | QString mOrgCap; |
106 | int mRows; | 106 | int mRows; |
107 | int mCellHeight; | 107 | int mCellHeight; |
108 | 108 | ||
109 | /** */ | 109 | /** */ |
110 | KOAgenda* mAgenda; | 110 | KOAgenda* mAgenda; |
111 | }; | 111 | }; |
112 | 112 | ||
113 | class EventIndicator : public QFrame { | 113 | class EventIndicator : public QFrame { |
114 | Q_OBJECT | 114 | Q_OBJECT |
115 | public: | 115 | public: |
116 | enum Location { Top, Bottom }; | 116 | enum Location { Top, Bottom }; |
117 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); | 117 | EventIndicator(Location loc=Top,QWidget *parent=0,const char *name=0); |
118 | virtual ~EventIndicator(); | 118 | virtual ~EventIndicator(); |
119 | 119 | ||
120 | void changeColumns(int columns); | 120 | void changeColumns(int columns); |
121 | void setPaintWidget( KDGanttMinimizeSplitter* ); | 121 | void setPaintWidget( KDGanttMinimizeSplitter* ); |
122 | void setXOffset( int ); | 122 | void setXOffset( int ); |
123 | void enableColumn(int column, bool enable); | 123 | void enableColumn(int column, bool enable); |
124 | 124 | ||
125 | protected: | 125 | protected: |
126 | void drawContents(QPainter *); | 126 | void drawContents(QPainter *); |
127 | 127 | ||
128 | private: | 128 | private: |
129 | int mXOffset; | 129 | int mXOffset; |
130 | KDGanttMinimizeSplitter* mPaintWidget; | 130 | KDGanttMinimizeSplitter* mPaintWidget; |
131 | int mColumns; | 131 | int mColumns; |
132 | QHBox *mTopBox; | 132 | QHBox *mTopBox; |
133 | QBoxLayout *mTopLayout; | 133 | QBoxLayout *mTopLayout; |
134 | Location mLocation; | 134 | Location mLocation; |
135 | QPixmap mPixmap; | 135 | QPixmap mPixmap; |
136 | QMemArray<bool> mEnabled; | 136 | QMemArray<bool> mEnabled; |
137 | }; | 137 | }; |
138 | 138 | ||
139 | /** | 139 | /** |
140 | KOAgendaView is the agenda-like view used to display events in an one or | 140 | KOAgendaView is the agenda-like view used to display events in an one or |
141 | multi-day view. | 141 | multi-day view. |
142 | */ | 142 | */ |
143 | class KOAgendaView : public KOEventView { | 143 | class KOAgendaView : public KOEventView { |
144 | Q_OBJECT | 144 | Q_OBJECT |
145 | public: | 145 | public: |
146 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); | 146 | KOAgendaView(Calendar *cal,QWidget *parent = 0,const char *name = 0 ); |
147 | virtual ~KOAgendaView(); | 147 | virtual ~KOAgendaView(); |
148 | void setStartHour( int ); | 148 | void setStartHour( int ); |
149 | void toggleAllDay(); | 149 | void toggleAllDay(); |
150 | 150 | ||
151 | 151 | ||
152 | /** Returns maximum number of days supported by the koagendaview */ | 152 | /** Returns maximum number of days supported by the koagendaview */ |
153 | virtual int maxDatesHint(); | 153 | virtual int maxDatesHint(); |
154 | 154 | ||
155 | /** Returns number of currently shown dates. */ | 155 | /** Returns number of currently shown dates. */ |
156 | virtual int currentDateCount(); | 156 | virtual int currentDateCount(); |
157 | 157 | ||
158 | /** returns the currently selected events */ | 158 | /** returns the currently selected events */ |
159 | virtual QPtrList<Incidence> selectedIncidences(); | 159 | virtual QPtrList<Incidence> selectedIncidences(); |
160 | 160 | ||
161 | /** returns the currently selected events */ | 161 | /** returns the currently selected events */ |
162 | virtual DateList selectedDates(); | 162 | virtual DateList selectedDates(); |
163 | 163 | ||
164 | /** Remove all events from view */ | 164 | /** Remove all events from view */ |
165 | void clearView(); | 165 | void clearView(); |
166 | KOAgenda *agenda() { return mAgenda;} | 166 | KOAgenda *agenda() { return mAgenda;} |
167 | virtual void printPreview(CalPrinter *calPrinter, | 167 | virtual void printPreview(CalPrinter *calPrinter, |
168 | const QDate &, const QDate &); | 168 | const QDate &, const QDate &); |
169 | 169 | ||
170 | /** start-datetime of selection */ | 170 | /** start-datetime of selection */ |
171 | QDateTime selectionStart() {return mTimeSpanBegin;} | 171 | QDateTime selectionStart() {return mTimeSpanBegin;} |
172 | /** end-datetime of selection */ | 172 | /** end-datetime of selection */ |
173 | QDateTime selectionEnd() {return mTimeSpanEnd;} | 173 | QDateTime selectionEnd() {return mTimeSpanEnd;} |
174 | /** returns true if selection is for whole day */ | 174 | /** returns true if selection is for whole day */ |
175 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} | 175 | bool selectedIsAllDay() {return mTimeSpanInAllDay;} |
176 | /** make selected start/end invalid */ | 176 | /** make selected start/end invalid */ |
177 | void deleteSelectedDateTime(); | 177 | void deleteSelectedDateTime(); |
178 | void repaintAgenda(); | 178 | void repaintAgenda(); |
179 | public slots: | 179 | public slots: |
180 | virtual void updateView(); | 180 | virtual void updateView(); |
181 | virtual void updateConfig(); | 181 | virtual void updateConfig(); |
182 | virtual void showDates(const QDate &start, const QDate &end); | 182 | virtual void showDates(const QDate &start, const QDate &end); |
183 | virtual void showEvents(QPtrList<Event> eventList); | 183 | virtual void showEvents(QPtrList<Event> eventList); |
184 | 184 | ||
185 | void updateTodo( Todo *, int ); | 185 | void updateTodo( Todo *, int ); |
186 | void changeEventDisplay(Event *, int); | 186 | void changeEventDisplay(Event *, int); |
187 | 187 | ||
188 | void clearSelection(); | 188 | void clearSelection(); |
189 | 189 | ||
190 | void newTodo(int gx,int gy); | 190 | void newTodo(int gx,int gy); |
191 | void newEvent(int gx,int gy); | 191 | void newEvent(int gx,int gy); |
192 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); | 192 | void newEvent(int gxStart, int gyStart, int gxEnd, int gyEnd); |
193 | void newEventAllDay(int gx, int gy); | 193 | void newEventAllDay(int gx, int gy); |
194 | void newTodoAllDay(int gx, int gy); | 194 | void newTodoAllDay(int gx, int gy); |
195 | 195 | ||
196 | void startDrag(Event *); | 196 | void startDrag(Event *); |
197 | 197 | ||
198 | void readSettings(); | 198 | void readSettings(); |
199 | void readSettings(KConfig *); | 199 | void readSettings(KConfig *); |
200 | void writeSettings(KConfig *); | 200 | void writeSettings(KConfig *); |
201 | 201 | ||
202 | void setContentsPos(int y); | 202 | void setContentsPos(int y); |
203 | 203 | ||
204 | void setExpandedButton( bool expanded ); | 204 | void setExpandedButton( bool expanded ); |
205 | void scrollOneHourUp(); | 205 | void scrollOneHourUp(); |
206 | void scrollOneHourDown(); | 206 | void scrollOneHourDown(); |
207 | void addToCalSlot(Incidence *, Incidence *); | 207 | void addToCalSlot(Incidence *, Incidence *); |
208 | 208 | ||
209 | signals: | 209 | signals: |
210 | void showDateView( int, QDate ); | 210 | void showDateView( int, QDate ); |
211 | void newTodoSignal( QDateTime ,bool ); | 211 | void newTodoSignal( QDateTime ,bool ); |
212 | void toggleExpand(); | 212 | void toggleExpand(); |
213 | void selectWeekNum( int ); | 213 | void selectWeekNum( int ); |
214 | void todoMoved( Todo *, int ); | 214 | void todoMoved( Todo *, int ); |
215 | void incidenceChanged(Incidence * , int ); | 215 | void incidenceChanged(Incidence * , int ); |
216 | // void cloneIncidenceSignal(Incidence *); | 216 | // void cloneIncidenceSignal(Incidence *); |
217 | 217 | ||
218 | protected: | 218 | protected: |
219 | QLabel * mDummyAllDayRightL; | ||
219 | KOAgendaButton* getNewDaylabel(); | 220 | KOAgendaButton* getNewDaylabel(); |
220 | bool mBlockUpdating; | 221 | bool mBlockUpdating; |
221 | int mUpcomingWidth; | 222 | int mUpcomingWidth; |
222 | /** Fill agenda beginning with date startDate */ | 223 | /** Fill agenda beginning with date startDate */ |
223 | void fillAgenda(const QDate &startDate); | 224 | void fillAgenda(const QDate &startDate); |
224 | void resizeEvent( QResizeEvent* e ); | 225 | void resizeEvent( QResizeEvent* e ); |
225 | /** Fill agenda using the current set value for the start date */ | 226 | /** Fill agenda using the current set value for the start date */ |
226 | void fillAgenda(); | 227 | void fillAgenda(); |
227 | 228 | ||
228 | /** Create labels for the selected dates. */ | 229 | /** Create labels for the selected dates. */ |
229 | void createDayLabels(); | 230 | void createDayLabels(); |
230 | 231 | ||
231 | /** | 232 | /** |
232 | Set the masks on the agenda widgets indicating, which days are holidays. | 233 | Set the masks on the agenda widgets indicating, which days are holidays. |
233 | */ | 234 | */ |
234 | void setHolidayMasks(); | 235 | void setHolidayMasks(); |
235 | 236 | ||
236 | protected slots: | 237 | protected slots: |
237 | void slotDaylabelClicked( int ); | 238 | void slotDaylabelClicked( int ); |
238 | /** Update event belonging to agenda item */ | 239 | /** Update event belonging to agenda item */ |
239 | void updateEventDates(KOAgendaItem *item, int mode = -1); | 240 | void updateEventDates(KOAgendaItem *item, int mode = -1); |
240 | //void updateMovedTodo(); | 241 | //void updateMovedTodo(); |
241 | 242 | ||
242 | void updateEventIndicatorTop(int newY); | 243 | void updateEventIndicatorTop(int newY); |
243 | void updateEventIndicatorBottom(int newY); | 244 | void updateEventIndicatorBottom(int newY); |
244 | 245 | ||
245 | /** Updates data for selected timespan */ | 246 | /** Updates data for selected timespan */ |
246 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); | 247 | void newTimeSpanSelected(int gxStart, int gyStart, int gxEnd, int gyEnd); |
247 | /** Updates data for selected timespan for all day event*/ | 248 | /** Updates data for selected timespan for all day event*/ |
248 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); | 249 | void newTimeSpanSelectedAllDay(int gxStart, int gyStart, int gxEnd, int gyEnd); |
249 | 250 | ||
250 | private: | 251 | private: |
251 | // view widgets | 252 | // view widgets |
252 | QFrame *mDayLabels; | 253 | QFrame *mDayLabels; |
253 | QHBox *mDayLabelsFrame; | 254 | QHBox *mDayLabelsFrame; |
254 | QBoxLayout *mLayoutDayLabels; | 255 | QBoxLayout *mLayoutDayLabels; |
255 | QFrame *mAllDayFrame; | 256 | QFrame *mAllDayFrame; |
256 | KOAgenda *mAllDayAgenda; | 257 | KOAgenda *mAllDayAgenda; |
257 | KOAgenda *mAgenda; | 258 | KOAgenda *mAgenda; |
258 | TimeLabels *mTimeLabels; | 259 | TimeLabels *mTimeLabels; |
259 | QWidget *mDummyAllDayLeft; | 260 | QWidget *mDummyAllDayLeft; |
260 | 261 | ||
261 | KDGanttMinimizeSplitter* mSplitterAgenda; | 262 | KDGanttMinimizeSplitter* mSplitterAgenda; |
262 | QPushButton *mExpandButton; | 263 | QPushButton *mExpandButton; |
263 | 264 | ||
264 | DateList mSelectedDates; // List of dates to be displayed | 265 | DateList mSelectedDates; // List of dates to be displayed |
265 | int mViewType; | 266 | int mViewType; |
266 | 267 | ||
267 | bool mWeekStartsMonday; | 268 | bool mWeekStartsMonday; |
268 | int mStartHour; | 269 | int mStartHour; |
269 | 270 | ||
270 | KOEventPopupMenu *mAgendaPopup; | 271 | KOEventPopupMenu *mAgendaPopup; |
271 | KOEventPopupMenu *mAllDayAgendaPopup; | 272 | KOEventPopupMenu *mAllDayAgendaPopup; |
272 | 273 | ||
273 | EventIndicator *mEventIndicatorTop; | 274 | EventIndicator *mEventIndicatorTop; |
274 | EventIndicator *mEventIndicatorBottom; | 275 | EventIndicator *mEventIndicatorBottom; |
275 | 276 | ||
276 | QMemArray<int> mMinY; | 277 | QMemArray<int> mMinY; |
277 | QMemArray<int> mMaxY; | 278 | QMemArray<int> mMaxY; |
278 | 279 | ||
279 | QMemArray<bool> mHolidayMask; | 280 | QMemArray<bool> mHolidayMask; |
280 | 281 | ||
281 | QPixmap mExpandedPixmap; | 282 | QPixmap mExpandedPixmap; |
282 | QPixmap mNotExpandedPixmap; | 283 | QPixmap mNotExpandedPixmap; |
283 | QPtrList<KOAgendaButton> mDayLabelsList; | 284 | QPtrList<KOAgendaButton> mDayLabelsList; |
284 | QDateTime mTimeSpanBegin; | 285 | QDateTime mTimeSpanBegin; |
285 | QDateTime mTimeSpanEnd; | 286 | QDateTime mTimeSpanEnd; |
286 | bool mTimeSpanInAllDay; | 287 | bool mTimeSpanInAllDay; |
287 | void keyPressEvent ( QKeyEvent * e ); | 288 | void keyPressEvent ( QKeyEvent * e ); |
288 | }; | 289 | }; |
289 | 290 | ||
290 | #endif // KOAGENDAVIEW_H | 291 | #endif // KOAGENDAVIEW_H |