author | zautrix <zautrix> | 2005-04-17 12:17:07 (UTC) |
---|---|---|
committer | zautrix <zautrix> | 2005-04-17 12:17:07 (UTC) |
commit | 2d81c75c4ffb8f144ae58e90e68496500d07a19e (patch) (unidiff) | |
tree | 1b27958fdc2948c1235579029188b1de78d7b820 /korganizer/koagendaview.cpp | |
parent | f64384edcc1e3b3f7511480866b0900aa1ebdda6 (diff) | |
download | kdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.zip kdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.tar.gz kdepimpi-2d81c75c4ffb8f144ae58e90e68496500d07a19e.tar.bz2 |
fixx
-rw-r--r-- | korganizer/koagendaview.cpp | 22 |
1 files changed, 5 insertions, 17 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 17f791d..b43c40e 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -389,97 +389,96 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
389 | if ( KOPrefs::instance()->mVerticalScreen ) { | 389 | if ( KOPrefs::instance()->mVerticalScreen ) { |
390 | expandPix = SmallIcon( "1updownarrow" ); | 390 | expandPix = SmallIcon( "1updownarrow" ); |
391 | } else { | 391 | } else { |
392 | expandPix = SmallIcon("1leftrightarrow" ); | 392 | expandPix = SmallIcon("1leftrightarrow" ); |
393 | } | 393 | } |
394 | 394 | ||
395 | QBoxLayout *topLayout = new QVBoxLayout(this); | 395 | QBoxLayout *topLayout = new QVBoxLayout(this); |
396 | 396 | ||
397 | // Create day name labels for agenda columns | 397 | // Create day name labels for agenda columns |
398 | // Create agenda splitter | 398 | // Create agenda splitter |
399 | 399 | ||
400 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); | 400 | mSplitterAgenda = new KDGanttMinimizeSplitter( Qt::Vertical, this); |
401 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); | 401 | mSplitterAgenda->setMinimizeDirection ( KDGanttMinimizeSplitter::Up ); |
402 | topLayout->addWidget( mSplitterAgenda ); | 402 | topLayout->addWidget( mSplitterAgenda ); |
403 | mAllDayFrame = new QHBox(mSplitterAgenda); | 403 | mAllDayFrame = new QHBox(mSplitterAgenda); |
404 | mAllDayFrame->setFocusPolicy(NoFocus); | 404 | mAllDayFrame->setFocusPolicy(NoFocus); |
405 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); | 405 | QWidget *agendaFrame = new QWidget(mSplitterAgenda); |
406 | agendaFrame->setFocusPolicy(NoFocus); | 406 | agendaFrame->setFocusPolicy(NoFocus); |
407 | 407 | ||
408 | // Create all-day agenda widget | 408 | // Create all-day agenda widget |
409 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); | 409 | mDummyAllDayLeft = new QVBox( mAllDayFrame ); |
410 | 410 | ||
411 | mExpandButton = new QPushButton(mDummyAllDayLeft); | 411 | mExpandButton = new QPushButton(mDummyAllDayLeft); |
412 | mExpandButton->setPixmap( expandPix ); | 412 | mExpandButton->setPixmap( expandPix ); |
413 | int widebut = mExpandButton->sizeHint().width()+4; | 413 | int widebut = mExpandButton->sizeHint().width()+4; |
414 | int heibut = mExpandButton->sizeHint().height()+4; | 414 | int heibut = mExpandButton->sizeHint().height()+4; |
415 | if ( heibut > widebut ) | 415 | if ( heibut > widebut ) |
416 | widebut = heibut ; | 416 | widebut = heibut ; |
417 | 417 | ||
418 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, | 418 | //mExpandButton->setSizePolicy( QSizePolicy( QSizePolicy::Fixed, |
419 | // QSizePolicy::Fixed ) ); | 419 | // QSizePolicy::Fixed ) ); |
420 | mExpandButton->setFixedSize( widebut, widebut); | 420 | mExpandButton->setFixedSize( widebut, widebut); |
421 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); | 421 | connect( mExpandButton, SIGNAL( clicked() ), SIGNAL( toggleExpand() ) ); |
422 | mExpandButton->setFocusPolicy(NoFocus); | 422 | mExpandButton->setFocusPolicy(NoFocus); |
423 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); | 423 | mAllDayAgenda = new KOAgenda(1,mAllDayFrame); |
424 | mAllDayAgenda->setFocusPolicy(NoFocus); | 424 | mAllDayAgenda->setFocusPolicy(NoFocus); |
425 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); | 425 | QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); |
426 | 426 | ||
427 | // Create event context menu for all day agenda | 427 | // Create event context menu for all day agenda |
428 | //mAllDayAgendaPopup = eventPopup(); | 428 | //mAllDayAgendaPopup = eventPopup(); |
429 | 429 | ||
430 | // Create agenda frame | 430 | // Create agenda frame |
431 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); | 431 | QGridLayout *agendaLayout = new QGridLayout(agendaFrame,4,3); |
432 | // QHBox *agendaFrame = new QHBox(splitterAgenda); | 432 | // QHBox *agendaFrame = new QHBox(splitterAgenda); |
433 | 433 | ||
434 | // create event indicator bars | 434 | // create event indicator bars |
435 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); | 435 | mEventIndicatorTop = new EventIndicator(EventIndicator::Top,agendaFrame); |
436 | #ifndef DESKTOP_VERSION | 436 | #ifndef DESKTOP_VERSION |
437 | // FIX | ||
438 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); | 437 | mEventIndicatorTop->setPaintWidget( mSplitterAgenda ); |
439 | #endif | 438 | #endif |
440 | mDayLabelsFrame = new QHBox(agendaFrame); | 439 | mDayLabelsFrame = new QHBox(agendaFrame); |
441 | //topLayout->addWidget(mDayLabelsFrame); | 440 | //topLayout->addWidget(mDayLabelsFrame); |
442 | mDayLabels = new QFrame (mDayLabelsFrame); | 441 | mDayLabels = new QFrame (mDayLabelsFrame); |
443 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); | 442 | mLayoutDayLabels = new QHBoxLayout(mDayLabels); |
444 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); | 443 | agendaLayout->addMultiCellWidget(mDayLabelsFrame ,0,0,0,2); |
445 | agendaLayout->addWidget(mEventIndicatorTop,1,1); | 444 | agendaLayout->addWidget(mEventIndicatorTop,1,1); |
446 | 445 | ||
447 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, | 446 | mEventIndicatorBottom = new EventIndicator(EventIndicator::Bottom, |
448 | agendaFrame); | 447 | agendaFrame); |
449 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); | 448 | agendaLayout->addWidget(mEventIndicatorBottom,3,1); |
450 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); | 449 | QWidget *dummyAgendaRight = new QWidget(agendaFrame); |
451 | agendaLayout->addWidget(dummyAgendaRight,1,2); | 450 | agendaLayout->addWidget(dummyAgendaRight,1,2); |
452 | 451 | ||
453 | // Create time labels | 452 | // Create time labels |
454 | mTimeLabels = new TimeLabels(24,agendaFrame); | 453 | mTimeLabels = new TimeLabels(24,agendaFrame); |
455 | agendaLayout->addWidget(mTimeLabels,2,0); | 454 | agendaLayout->addWidget(mTimeLabels,2,0); |
456 | connect(mTimeLabels,SIGNAL( scaleChanged()), | 455 | connect(mTimeLabels,SIGNAL( scaleChanged()), |
457 | this,SLOT(updateConfig())); | 456 | this,SLOT(updateConfig())); |
458 | 457 | ||
459 | // Create agenda | 458 | // Create agenda |
460 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); | 459 | mAgenda = new KOAgenda(1,96,KOPrefs::instance()->mHourSize,agendaFrame); |
461 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); | 460 | agendaLayout->addMultiCellWidget(mAgenda,2,2,1,2); |
462 | agendaLayout->setColStretch(1,1); | 461 | agendaLayout->setColStretch(1,1); |
463 | mAgenda->setFocusPolicy(NoFocus); | 462 | mAgenda->setFocusPolicy(NoFocus); |
464 | // Create event context menu for agenda | 463 | // Create event context menu for agenda |
465 | mAllAgendaPopup = eventPopup(); | 464 | mAllAgendaPopup = eventPopup(); |
466 | 465 | ||
467 | #if 0 | 466 | #if 0 |
468 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), | 467 | mAllAgendaPopup->addAdditionalItem(QIconSet(SmallIcon("bell")), |
469 | i18n("Toggle Alarm"),mAgenda, | 468 | i18n("Toggle Alarm"),mAgenda, |
470 | SLOT(popupAlarm()),true); | 469 | SLOT(popupAlarm()),true); |
471 | 470 | ||
472 | #endif | 471 | #endif |
473 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 472 | connect(mAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
474 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 473 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
475 | 474 | ||
476 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), | 475 | connect(mAllDayAgenda,SIGNAL(showIncidencePopupSignal(Incidence *)), |
477 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); | 476 | mAllAgendaPopup,SLOT(showIncidencePopup(Incidence *))); |
478 | mAgenda->setPopup( mAllAgendaPopup ); | 477 | mAgenda->setPopup( mAllAgendaPopup ); |
479 | mAllDayAgenda->setPopup( mAllAgendaPopup ); | 478 | mAllDayAgenda->setPopup( mAllAgendaPopup ); |
480 | // make connections between dependent widgets | 479 | // make connections between dependent widgets |
481 | mTimeLabels->setAgenda(mAgenda); | 480 | mTimeLabels->setAgenda(mAgenda); |
482 | 481 | ||
483 | // Update widgets to reflect user preferences | 482 | // Update widgets to reflect user preferences |
484 | // updateConfig(); | 483 | // updateConfig(); |
485 | 484 | ||
@@ -522,96 +521,98 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : | |||
522 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 521 | connect(mAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
523 | SIGNAL(editIncidenceSignal(Incidence *))); | 522 | SIGNAL(editIncidenceSignal(Incidence *))); |
524 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), | 523 | connect(mAllDayAgenda,SIGNAL(editIncidenceSignal(Incidence *)), |
525 | SIGNAL(editIncidenceSignal(Incidence *))); | 524 | SIGNAL(editIncidenceSignal(Incidence *))); |
526 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 525 | connect(mAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
527 | SIGNAL(showIncidenceSignal(Incidence *))); | 526 | SIGNAL(showIncidenceSignal(Incidence *))); |
528 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), | 527 | connect(mAllDayAgenda,SIGNAL(showIncidenceSignal(Incidence *)), |
529 | SIGNAL(showIncidenceSignal(Incidence *))); | 528 | SIGNAL(showIncidenceSignal(Incidence *))); |
530 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 529 | connect(mAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
531 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 530 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
532 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), | 531 | connect(mAllDayAgenda,SIGNAL(deleteIncidenceSignal(Incidence *)), |
533 | SIGNAL(deleteIncidenceSignal(Incidence *))); | 532 | SIGNAL(deleteIncidenceSignal(Incidence *))); |
534 | 533 | ||
535 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 534 | connect(mAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
536 | SLOT(updateEventDates(KOAgendaItem *, int ))); | 535 | SLOT(updateEventDates(KOAgendaItem *, int ))); |
537 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), | 536 | connect(mAllDayAgenda,SIGNAL(itemModified(KOAgendaItem *, int )), |
538 | SLOT(updateEventDates(KOAgendaItem *, int))); | 537 | SLOT(updateEventDates(KOAgendaItem *, int))); |
539 | 538 | ||
540 | // event indicator update | 539 | // event indicator update |
541 | connect(mAgenda,SIGNAL(lowerYChanged(int)), | 540 | connect(mAgenda,SIGNAL(lowerYChanged(int)), |
542 | SLOT(updateEventIndicatorTop(int))); | 541 | SLOT(updateEventIndicatorTop(int))); |
543 | connect(mAgenda,SIGNAL(upperYChanged(int)), | 542 | connect(mAgenda,SIGNAL(upperYChanged(int)), |
544 | SLOT(updateEventIndicatorBottom(int))); | 543 | SLOT(updateEventIndicatorBottom(int))); |
545 | // drag signals | 544 | // drag signals |
546 | /* | 545 | /* |
547 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), | 546 | connect(mAgenda,SIGNAL(startDragSignal(Event *)), |
548 | SLOT(startDrag(Event *))); | 547 | SLOT(startDrag(Event *))); |
549 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), | 548 | connect(mAllDayAgenda,SIGNAL(startDragSignal(Event *)), |
550 | SLOT(startDrag(Event *))); | 549 | SLOT(startDrag(Event *))); |
551 | */ | 550 | */ |
552 | // synchronize selections | 551 | // synchronize selections |
553 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 552 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
554 | mAllDayAgenda, SLOT( deselectItem() ) ); | 553 | mAllDayAgenda, SLOT( deselectItem() ) ); |
555 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 554 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
556 | mAgenda, SLOT( deselectItem() ) ); | 555 | mAgenda, SLOT( deselectItem() ) ); |
557 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 556 | connect( mAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
558 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 557 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
559 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), | 558 | connect( mAllDayAgenda, SIGNAL( incidenceSelected( Incidence * ) ), |
560 | SIGNAL( incidenceSelected( Incidence * ) ) ); | 559 | SIGNAL( incidenceSelected( Incidence * ) ) ); |
561 | connect( mAgenda, SIGNAL( resizedSignal() ), | 560 | connect( mAgenda, SIGNAL( resizedSignal() ), |
562 | SLOT( updateConfig( ) ) ); | 561 | SLOT( updateConfig( ) ) ); |
563 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), | 562 | connect( mAgenda, SIGNAL( addToCalSignal(Incidence *, Incidence *) ), |
564 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); | 563 | SLOT( addToCalSlot(Incidence *, Incidence * ) ) ); |
565 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), | 564 | connect( mAllDayAgenda, SIGNAL( addToCalSignal(Incidence * ,Incidence *) ), |
566 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); | 565 | SLOT( addToCalSlot(Incidence * , Incidence *) ) ); |
567 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 566 | // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
568 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); | 567 | //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); |
569 | 568 | ||
569 | connect( mAllDayAgenda, SIGNAL( signalClearSelection() ),mAgenda, SLOT( slotClearSelection()) ); | ||
570 | connect( mAgenda, SIGNAL( signalClearSelection() ),mAllDayAgenda, SLOT( slotClearSelection()) ); | ||
570 | 571 | ||
571 | } | 572 | } |
572 | 573 | ||
573 | void KOAgendaView::toggleAllDay() | 574 | void KOAgendaView::toggleAllDay() |
574 | { | 575 | { |
575 | if ( mSplitterAgenda->firstHandle() ) | 576 | if ( mSplitterAgenda->firstHandle() ) |
576 | mSplitterAgenda->firstHandle()->toggle(); | 577 | mSplitterAgenda->firstHandle()->toggle(); |
577 | } | 578 | } |
578 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) | 579 | void KOAgendaView::addToCalSlot(Incidence * inc, Incidence * incOld ) |
579 | { | 580 | { |
580 | calendar()->addIncidence( inc ); | 581 | calendar()->addIncidence( inc ); |
581 | 582 | ||
582 | if ( incOld ) { | 583 | if ( incOld ) { |
583 | if ( incOld->type() == "Todo" ) | 584 | if ( incOld->type() == "Todo" ) |
584 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); | 585 | emit todoMoved((Todo*)incOld, KOGlobals::EVENTEDITED ); |
585 | else | 586 | else |
586 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); | 587 | emit incidenceChanged(incOld, KOGlobals::EVENTEDITED); |
587 | } | 588 | } |
588 | 589 | ||
589 | } | 590 | } |
590 | 591 | ||
591 | KOAgendaView::~KOAgendaView() | 592 | KOAgendaView::~KOAgendaView() |
592 | { | 593 | { |
593 | delete mAllAgendaPopup; | 594 | delete mAllAgendaPopup; |
594 | //delete mAllDayAgendaPopup; | 595 | //delete mAllDayAgendaPopup; |
595 | delete KOAgendaItem::paintPix(); | 596 | delete KOAgendaItem::paintPix(); |
596 | delete KOAgendaItem::paintPixSel(); | 597 | delete KOAgendaItem::paintPixSel(); |
597 | } | 598 | } |
598 | void KOAgendaView::resizeEvent( QResizeEvent* e ) | 599 | void KOAgendaView::resizeEvent( QResizeEvent* e ) |
599 | { | 600 | { |
600 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); | 601 | //qDebug("KOAgendaView::resizeEvent( QResizeEvent* e ) %d ", e->size().width()); |
601 | bool uc = false; | 602 | bool uc = false; |
602 | int ow = e->oldSize().width(); | 603 | int ow = e->oldSize().width(); |
603 | int oh = e->oldSize().height(); | 604 | int oh = e->oldSize().height(); |
604 | int w = e->size().width(); | 605 | int w = e->size().width(); |
605 | int h = e->size().height(); | 606 | int h = e->size().height(); |
606 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { | 607 | if ( (ow > oh && w< h ) || (ow < oh && w > h ) ) { |
607 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) | 608 | if ( ! mBlockUpdating && !globalFlagBlockStartup && !globalFlagBlockAgenda ) |
608 | uc = true; | 609 | uc = true; |
609 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); | 610 | //qDebug("view changed %d %d %d %d ", ow, oh , w , h); |
610 | } | 611 | } |
611 | mUpcomingWidth = e->size().width() ; | 612 | mUpcomingWidth = e->size().width() ; |
612 | if ( mBlockUpdating || uc ) { | 613 | if ( mBlockUpdating || uc ) { |
613 | mBlockUpdating = false; | 614 | mBlockUpdating = false; |
614 | //mAgenda->setMinimumSize(800 , 600 ); | 615 | //mAgenda->setMinimumSize(800 , 600 ); |
615 | //qDebug("mAgenda->resize+++++++++++++++ "); | 616 | //qDebug("mAgenda->resize+++++++++++++++ "); |
616 | updateConfig(); | 617 | updateConfig(); |
617 | //qDebug("KOAgendaView::Updating now possible "); | 618 | //qDebug("KOAgendaView::Updating now possible "); |
@@ -680,102 +681,98 @@ void KOAgendaView::createDayLabels() | |||
680 | else | 681 | else |
681 | maxWid -= ( selCount * 3 ); //working for QPushButton | 682 | maxWid -= ( selCount * 3 ); //working for QPushButton |
682 | if ( maxWid < 0 ) | 683 | if ( maxWid < 0 ) |
683 | maxWid = 20; | 684 | maxWid = 20; |
684 | int needWid = wid * selCount; | 685 | int needWid = wid * selCount; |
685 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 686 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
686 | //if ( needWid > maxWid ) | 687 | //if ( needWid > maxWid ) |
687 | // qDebug("DAYLABELS TOOOOOOO BIG "); | 688 | // qDebug("DAYLABELS TOOOOOOO BIG "); |
688 | while ( needWid > maxWid ) { | 689 | while ( needWid > maxWid ) { |
689 | dayTest = dayTest.left( dayTest.length() - 1 ); | 690 | dayTest = dayTest.left( dayTest.length() - 1 ); |
690 | wid = fm.width( dayTest ); | 691 | wid = fm.width( dayTest ); |
691 | needWid = wid * selCount; | 692 | needWid = wid * selCount; |
692 | } | 693 | } |
693 | int maxLen = dayTest.length(); | 694 | int maxLen = dayTest.length(); |
694 | int fontPoint = dlf.pointSize(); | 695 | int fontPoint = dlf.pointSize(); |
695 | if ( maxLen < 2 ) { | 696 | if ( maxLen < 2 ) { |
696 | int fontPoint = dlf.pointSize(); | 697 | int fontPoint = dlf.pointSize(); |
697 | while ( fontPoint > 4 ) { | 698 | while ( fontPoint > 4 ) { |
698 | --fontPoint; | 699 | --fontPoint; |
699 | dlf.setPointSize( fontPoint ); | 700 | dlf.setPointSize( fontPoint ); |
700 | QFontMetrics f( dlf ); | 701 | QFontMetrics f( dlf ); |
701 | wid = f.width( "30" ); | 702 | wid = f.width( "30" ); |
702 | needWid = wid * selCount; | 703 | needWid = wid * selCount; |
703 | if ( needWid < maxWid ) | 704 | if ( needWid < maxWid ) |
704 | break; | 705 | break; |
705 | } | 706 | } |
706 | maxLen = 2; | 707 | maxLen = 2; |
707 | } | 708 | } |
708 | //qDebug("Max len %d ", dayTest.length() ); | 709 | //qDebug("Max len %d ", dayTest.length() ); |
709 | 710 | ||
710 | QFontMetrics tempF( dlf ); | 711 | QFontMetrics tempF( dlf ); |
711 | newHight = tempF.height(); | 712 | newHight = tempF.height(); |
712 | mDayLabels->setFont( dlf ); | 713 | mDayLabels->setFont( dlf ); |
713 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; | 714 | // mLayoutDayLabels = new QHBoxLayout(mDayLabels);; |
714 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); | 715 | // mLayoutDayLabels->addSpacing(mTimeLabels->width()); |
715 | //mLayoutDayLabels->addSpacing( 2 ); | 716 | //mLayoutDayLabels->addSpacing( 2 ); |
716 | // QFont lFont = dlf; | 717 | // QFont lFont = dlf; |
717 | bool appendLabels = false; | 718 | bool appendLabels = false; |
718 | KOAgendaButton *dayLabel; | 719 | KOAgendaButton *dayLabel; |
719 | dayLabel = mDayLabelsList.first(); | 720 | dayLabel = mDayLabelsList.first(); |
720 | if ( !dayLabel ) { | 721 | if ( !dayLabel ) { |
721 | appendLabels = true; | 722 | appendLabels = true; |
722 | dayLabel = getNewDaylabel(); | 723 | dayLabel = getNewDaylabel(); |
723 | } | 724 | } |
724 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); | 725 | dayLabel->setFixedWidth( mTimeLabels->width()+mAgenda->frameWidth() ); |
725 | dayLabel->setFont( dlf ); | 726 | dayLabel->setFont( dlf ); |
726 | dayLabel->setNum( -1 ); | 727 | dayLabel->setNum( -1 ); |
727 | //dayLabel->setAlignment(QLabel::AlignHCenter); | 728 | //dayLabel->setAlignment(QLabel::AlignHCenter); |
728 | #if 0 | 729 | |
729 | if ( QApplication::desktop()->width() <= 320 ) | 730 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); |
730 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ).left(2) ); | ||
731 | else | ||
732 | #endif | ||
733 | dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); | ||
734 | dayLabel->show(); | 731 | dayLabel->show(); |
735 | DateList::ConstIterator dit; | 732 | DateList::ConstIterator dit; |
736 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); | 733 | bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); |
737 | int counter = -1; | 734 | int counter = -1; |
738 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 735 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
739 | ++counter; | 736 | ++counter; |
740 | QDate date = *dit; | 737 | QDate date = *dit; |
741 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); | 738 | // QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels); |
742 | if ( ! appendLabels ) { | 739 | if ( ! appendLabels ) { |
743 | dayLabel = mDayLabelsList.next(); | 740 | dayLabel = mDayLabelsList.next(); |
744 | if ( !dayLabel ) | 741 | if ( !dayLabel ) |
745 | appendLabels = true; | 742 | appendLabels = true; |
746 | } | 743 | } |
747 | if ( appendLabels ) { | 744 | if ( appendLabels ) { |
748 | dayLabel = getNewDaylabel(); | 745 | dayLabel = getNewDaylabel(); |
749 | } | 746 | } |
750 | dayLabel->setMinimumWidth( 1 ); | 747 | dayLabel->setMinimumWidth( 1 ); |
751 | dayLabel->setMaximumWidth( 10240 ); | 748 | dayLabel->setMaximumWidth( 10240 ); |
752 | dayLabel->setFont( dlf ); | 749 | dayLabel->setFont( dlf ); |
753 | dayLabel->show(); | 750 | dayLabel->show(); |
754 | dayLabel->setAutoRepeat( false ); | 751 | dayLabel->setAutoRepeat( false ); |
755 | dayLabel->setNum( counter ); | 752 | dayLabel->setNum( counter ); |
756 | QString str; | 753 | QString str; |
757 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); | 754 | int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date); |
758 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); | 755 | QString dayName = KOGlobals::self()->calendarSystem()->weekDayName( dW, true ); |
759 | switch ( maxLen ) { | 756 | switch ( maxLen ) { |
760 | case 2: | 757 | case 2: |
761 | str = QString::number( date.day() ); | 758 | str = QString::number( date.day() ); |
762 | break; | 759 | break; |
763 | 760 | ||
764 | case 3: | 761 | case 3: |
765 | str = dayName.left( 1 ) +QString::number( date.day()); | 762 | str = dayName.left( 1 ) +QString::number( date.day()); |
766 | 763 | ||
767 | break; | 764 | break; |
768 | case 4: | 765 | case 4: |
769 | str = dayName.left( 1 ) + " " +QString::number( date.day()); | 766 | str = dayName.left( 1 ) + " " +QString::number( date.day()); |
770 | 767 | ||
771 | break; | 768 | break; |
772 | case 5: | 769 | case 5: |
773 | str = dayName.left( 2 ) + " " +QString::number( date.day()); | 770 | str = dayName.left( 2 ) + " " +QString::number( date.day()); |
774 | 771 | ||
775 | break; | 772 | break; |
776 | case 6: | 773 | case 6: |
777 | str = dayName.left( 3 ) + " " +QString::number( date.day()); | 774 | str = dayName.left( 3 ) + " " +QString::number( date.day()); |
778 | break; | 775 | break; |
779 | 776 | ||
780 | default: | 777 | default: |
781 | break; | 778 | break; |
@@ -1134,106 +1131,97 @@ void KOAgendaView::fillAgenda() | |||
1134 | 1131 | ||
1135 | DateList::ConstIterator dit; | 1132 | DateList::ConstIterator dit; |
1136 | int curCol = 0; | 1133 | int curCol = 0; |
1137 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { | 1134 | for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { |
1138 | QDate currentDate = *dit; | 1135 | QDate currentDate = *dit; |
1139 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() | 1136 | // kdDebug() << "KOAgendaView::fillAgenda(): " << currentDate.toString() |
1140 | // << endl; | 1137 | // << endl; |
1141 | 1138 | ||
1142 | dayEvents = calendar()->events(currentDate,true); | 1139 | dayEvents = calendar()->events(currentDate,true); |
1143 | 1140 | ||
1144 | // Default values, which can never be reached | 1141 | // Default values, which can never be reached |
1145 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; | 1142 | mMinY[curCol] = mAgenda->timeToY(QTime(23,59)) + 1; |
1146 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; | 1143 | mMaxY[curCol] = mAgenda->timeToY(QTime(0,0)) - 1; |
1147 | 1144 | ||
1148 | unsigned int numEvent; | 1145 | unsigned int numEvent; |
1149 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { | 1146 | for(numEvent=0;numEvent<dayEvents.count();++numEvent) { |
1150 | Event *event = dayEvents.at(numEvent); | 1147 | Event *event = dayEvents.at(numEvent); |
1151 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) | 1148 | if ( !KOPrefs::instance()->mShowSyncEvents && event->uid().left(2) == QString("la") ) |
1152 | if ( event->uid().left(15) == QString("last-syncEvent-") ) | 1149 | if ( event->uid().left(15) == QString("last-syncEvent-") ) |
1153 | continue; | 1150 | continue; |
1154 | // kdDebug() << " Event: " << event->summary() << endl; | 1151 | // kdDebug() << " Event: " << event->summary() << endl; |
1155 | 1152 | ||
1156 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; | 1153 | int beginX = currentDate.daysTo(event->dtStart().date()) + curCol; |
1157 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; | 1154 | int endX = currentDate.daysTo(event->dtEnd().date()) + curCol; |
1158 | 1155 | ||
1159 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; | 1156 | // kdDebug() << " beginX: " << beginX << " endX: " << endX << endl; |
1160 | 1157 | ||
1161 | if (event->doesFloat()) { | 1158 | if (event->doesFloat()) { |
1162 | if (event->recurrence()->doesRecur()) { | 1159 | if (event->recurrence()->doesRecur()) { |
1163 | if (event->isMultiDay() ) { | 1160 | if (event->isMultiDay() ) { |
1164 | endX = endX - beginX;// endX is now number of days | 1161 | endX = endX - beginX;// endX is now number of days |
1165 | if ( event->recursOn( currentDate ) ) { | 1162 | if ( event->recursOn( currentDate ) ) { |
1166 | endX += curCol; | 1163 | endX += curCol; |
1167 | beginX = curCol; | 1164 | beginX = curCol; |
1168 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1165 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1169 | } else { | 1166 | } else { |
1170 | qDebug("days %d %s",endX , currentDate.toString().latin1()); | 1167 | qDebug("days %d %s",endX , currentDate.toString().latin1()); |
1171 | QDate dateit = currentDate.addDays( -endX ); | 1168 | QDate dateit = currentDate.addDays( -endX ); |
1172 | if ( event->recursOn( dateit ) ) { | 1169 | if ( event->recursOn( dateit ) ) { |
1173 | qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); | 1170 | qDebug("found %d %d %d %s", endX,curCol, curCol-endX ,dateit.toString().latin1() ); |
1174 | if ( curCol-endX < 0 ) { | 1171 | if ( curCol-endX < 0 ) { |
1175 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); | 1172 | mAllDayAgenda->insertAllDayItem(event,currentDate,0,curCol); |
1176 | } | 1173 | } |
1177 | } | 1174 | } |
1178 | } | 1175 | } |
1179 | } else { | 1176 | } else { |
1180 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | 1177 | mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); |
1181 | } | 1178 | } |
1182 | #if 0 | 1179 | |
1183 | if (beginX <= 0 && curCol == 0) { | ||
1184 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | ||
1185 | } else if (beginX == curCol) { | ||
1186 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | ||
1187 | } else { | ||
1188 | qDebug("skipped %d %d %d ",beginX , endX, curCol); | ||
1189 | } | ||
1190 | #endif | ||
1191 | //mAllDayAgenda->insertAllDayItem(event,currentDate,curCol,curCol); | ||
1192 | } else { | 1180 | } else { |
1193 | if (beginX <= 0 && curCol == 0) { | 1181 | if (beginX <= 0 && curCol == 0) { |
1194 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1182 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1195 | } else if (beginX == curCol) { | 1183 | } else if (beginX == curCol) { |
1196 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); | 1184 | mAllDayAgenda->insertAllDayItem(event,currentDate,beginX,endX); |
1197 | } | 1185 | } |
1198 | } | 1186 | } |
1199 | } else if (event->isMultiDay()) { | 1187 | } else if (event->isMultiDay()) { |
1200 | if ( event->doesRecur () ) { | 1188 | if ( event->doesRecur () ) { |
1201 | QDate dateit = currentDate; | 1189 | QDate dateit = currentDate; |
1202 | int count = 0; | 1190 | int count = 0; |
1203 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; | 1191 | int max = event->dtStart().daysTo( event->dtEnd() ) +2; |
1204 | while (! event->recursOn( dateit ) && count <= max ) { | 1192 | while (! event->recursOn( dateit ) && count <= max ) { |
1205 | ++count; | 1193 | ++count; |
1206 | dateit = dateit.addDays( -1 ); | 1194 | dateit = dateit.addDays( -1 ); |
1207 | } | 1195 | } |
1208 | bool ok; | 1196 | bool ok; |
1209 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); | 1197 | QDateTime nextOcstart = event->getNextOccurence( QDateTime(dateit) ,&ok ); |
1210 | if ( ok ) | 1198 | if ( ok ) |
1211 | { | 1199 | { |
1212 | int secs = event->dtStart().secsTo( event->dtEnd() ); | 1200 | int secs = event->dtStart().secsTo( event->dtEnd() ); |
1213 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; | 1201 | QDateTime nextOcend =nextOcstart.addSecs( secs ); ; |
1214 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; | 1202 | beginX = currentDate.daysTo(nextOcstart.date()) + curCol; |
1215 | endX = currentDate.daysTo(nextOcend.date()) + curCol; | 1203 | endX = currentDate.daysTo(nextOcend.date()) + curCol; |
1216 | 1204 | ||
1217 | } | 1205 | } |
1218 | } | 1206 | } |
1219 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1207 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1220 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1208 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1221 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); | 1209 | //qDebug("insert %d %d %d %d %d ",beginX,endX,startY,endY , curCol ); |
1222 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { | 1210 | if ((beginX <= 0 && curCol == 0) || beginX == curCol) { |
1223 | //qDebug("insert!!! "); | 1211 | //qDebug("insert!!! "); |
1224 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); | 1212 | mAgenda->insertMultiItem(event,currentDate,beginX,endX,startY,endY); |
1225 | } | 1213 | } |
1226 | if (beginX == curCol) { | 1214 | if (beginX == curCol) { |
1227 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1215 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1228 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; | 1216 | if (startY < mMinY[curCol]) mMinY[curCol] = startY; |
1229 | } else if (endX == curCol) { | 1217 | } else if (endX == curCol) { |
1230 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1218 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1231 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; | 1219 | if (endY > mMaxY[curCol]) mMaxY[curCol] = endY; |
1232 | } else { | 1220 | } else { |
1233 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); | 1221 | mMinY[curCol] = mAgenda->timeToY(QTime(0,0)); |
1234 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); | 1222 | mMaxY[curCol] = mAgenda->timeToY(QTime(23,59)); |
1235 | } | 1223 | } |
1236 | } else { | 1224 | } else { |
1237 | int startY = mAgenda->timeToY(event->dtStart().time()); | 1225 | int startY = mAgenda->timeToY(event->dtStart().time()); |
1238 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; | 1226 | int endY = mAgenda->timeToY(event->dtEnd().time()) - 1; |
1239 | if (endY < startY) endY = startY; | 1227 | if (endY < startY) endY = startY; |