-rw-r--r-- | korganizer/koagendaview.cpp | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index aa36553..8c27c43 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp | |||
@@ -624,8 +624,23 @@ void KOAgendaView::slotDaylabelClicked() | |||
624 | } | 624 | } |
625 | else | 625 | else |
626 | showDateView( 10, firstDate.addDays(1 ) ); | 626 | showDateView( 10, firstDate.addDays(1 ) ); |
627 | } | 627 | } |
628 | |||
629 | QPushButton* KOAgendaView::getNewDaylabel() | ||
630 | { | ||
631 | |||
632 | QPushButton * dayLabel = new QPushButton(mDayLabels); | ||
633 | dayLabel->setFlat( true ); | ||
634 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
635 | dayLabel->setFocusPolicy(NoFocus); | ||
636 | dayLabel->setSizePolicy(QSizePolicy( QSizePolicy::Expanding ,QSizePolicy::Expanding )); | ||
637 | mDayLabelsList.append( dayLabel ); | ||
638 | mLayoutDayLabels->addWidget(dayLabel); | ||
639 | //mLayoutDayLabels->setStretchFactor(dayLabel, 100); | ||
640 | return dayLabel ; | ||
641 | } | ||
642 | |||
628 | void KOAgendaView::createDayLabels() | 643 | void KOAgendaView::createDayLabels() |
629 | { | 644 | { |
630 | 645 | ||
631 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { | 646 | if ( mBlockUpdating || globalFlagBlockLabel == 1) { |
@@ -648,9 +663,10 @@ void KOAgendaView::createDayLabels() | |||
648 | QFontMetrics fm ( dlf ); | 663 | QFontMetrics fm ( dlf ); |
649 | int selCount = mSelectedDates.count(); | 664 | int selCount = mSelectedDates.count(); |
650 | QString dayTest = "Mon 20"; | 665 | QString dayTest = "Mon 20"; |
651 | int wid = fm.width( dayTest ); | 666 | int wid = fm.width( dayTest ); |
652 | maxWid -= ( selCount * 3 ); | 667 | //maxWid -= ( selCount * 3 ); //working for QLabels |
668 | maxWid -= ( selCount * 5 ); //working for QPushButton | ||
653 | if ( maxWid < 0 ) | 669 | if ( maxWid < 0 ) |
654 | maxWid = 20; | 670 | maxWid = 20; |
655 | int needWid = wid * selCount; | 671 | int needWid = wid * selCount; |
656 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); | 672 | //qDebug("++++++++Needed : %d MaxWidth: %d", needWid, maxWid ); |
@@ -668,9 +684,9 @@ void KOAgendaView::createDayLabels() | |||
668 | while ( fontPoint > 4 ) { | 684 | while ( fontPoint > 4 ) { |
669 | --fontPoint; | 685 | --fontPoint; |
670 | dlf.setPointSize( fontPoint ); | 686 | dlf.setPointSize( fontPoint ); |
671 | QFontMetrics f( dlf ); | 687 | QFontMetrics f( dlf ); |
672 | wid = f.width( "20" ); | 688 | wid = f.width( "20" )+2; |
673 | needWid = wid * selCount; | 689 | needWid = wid * selCount; |
674 | if ( needWid < maxWid ) | 690 | if ( needWid < maxWid ) |
675 | break; | 691 | break; |
676 | } | 692 | } |
@@ -689,14 +705,9 @@ void KOAgendaView::createDayLabels() | |||
689 | QPushButton *dayLabel; | 705 | QPushButton *dayLabel; |
690 | dayLabel = mDayLabelsList.first(); | 706 | dayLabel = mDayLabelsList.first(); |
691 | if ( !dayLabel ) { | 707 | if ( !dayLabel ) { |
692 | appendLabels = true; | 708 | appendLabels = true; |
693 | dayLabel = new QPushButton(mDayLabels); | 709 | dayLabel = getNewDaylabel(); |
694 | dayLabel->setFlat( true ); | ||
695 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
696 | dayLabel->setFocusPolicy(NoFocus); | ||
697 | mDayLabelsList.append( dayLabel ); | ||
698 | mLayoutDayLabels->addWidget(dayLabel); | ||
699 | } | 710 | } |
700 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); | 711 | dayLabel->setFixedWidth( mTimeLabels->width()+2 ); |
701 | dayLabel->setFont( dlf ); | 712 | dayLabel->setFont( dlf ); |
702 | dayLabel->setCaption("0"); | 713 | dayLabel->setCaption("0"); |
@@ -715,14 +726,9 @@ void KOAgendaView::createDayLabels() | |||
715 | if ( !dayLabel ) | 726 | if ( !dayLabel ) |
716 | appendLabels = true; | 727 | appendLabels = true; |
717 | } | 728 | } |
718 | if ( appendLabels ) { | 729 | if ( appendLabels ) { |
719 | dayLabel = new QPushButton(mDayLabels); | 730 | dayLabel = getNewDaylabel(); |
720 | dayLabel->setFlat( true ); | ||
721 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
722 | dayLabel->setFocusPolicy(NoFocus); | ||
723 | mDayLabelsList.append( dayLabel ); | ||
724 | mLayoutDayLabels->addWidget(dayLabel); | ||
725 | } | 731 | } |
726 | dayLabel->setMinimumWidth( 1 ); | 732 | dayLabel->setMinimumWidth( 1 ); |
727 | dayLabel->setMaximumWidth( 2048 ); | 733 | dayLabel->setMaximumWidth( 2048 ); |
728 | dayLabel->setFont( dlf ); | 734 | dayLabel->setFont( dlf ); |
@@ -806,14 +812,9 @@ void KOAgendaView::createDayLabels() | |||
806 | if ( !dayLabel ) | 812 | if ( !dayLabel ) |
807 | appendLabels = true; | 813 | appendLabels = true; |
808 | } | 814 | } |
809 | if ( appendLabels ) { | 815 | if ( appendLabels ) { |
810 | dayLabel = new QPushButton(mDayLabels); | 816 | dayLabel = getNewDaylabel(); |
811 | dayLabel->setFlat( true ); | ||
812 | connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); | ||
813 | dayLabel->setFocusPolicy(NoFocus); | ||
814 | mDayLabelsList.append( dayLabel ); | ||
815 | mLayoutDayLabels->addWidget(dayLabel); | ||
816 | } | 817 | } |
817 | //dayLabel->hide();//test only | 818 | //dayLabel->hide();//test only |
818 | 819 | ||
819 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; | 820 | int offset = (mAgenda->width() - mAgenda->verticalScrollBar()->width()-3 ) % mSelectedDates.count() ; |