-rw-r--r-- | korganizer/koagendaview.cpp | 44 |
1 files changed, 37 insertions, 7 deletions
diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 8e9add3..d43712f 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -611,2 +611,18 @@ void KOAgendaView::resizeEvent( QResizeEvent* e ) } +void KOAgendaView::slotDaylabelClicked() +{ + QString cap = ((QPushButton*) sender() )->caption(); + + QDate firstDate = mSelectedDates.first(); + if ( cap == "0" ) + emit showDateView( 6, firstDate ); + else if ( cap != "last" ) { + if ( mSelectedDates.count() == 1) + emit showDateView( 9, firstDate.addDays( cap.toInt()-1 ) ); + else + emit showDateView( 3, firstDate.addDays( cap.toInt()-1 ) ); + } + else + showDateView( 10, firstDate.addDays(1 ) ); +} void KOAgendaView::createDayLabels() @@ -672,3 +688,3 @@ void KOAgendaView::createDayLabels() bool appendLabels = false; - QLabel *dayLabel; + QPushButton *dayLabel; dayLabel = mDayLabelsList.first(); @@ -676,3 +692,6 @@ void KOAgendaView::createDayLabels() appendLabels = true; - dayLabel = new QLabel(mDayLabels); + dayLabel = new QPushButton(mDayLabels); + dayLabel->setFlat( true ); + connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); + dayLabel->setFocusPolicy(NoFocus); mDayLabelsList.append( dayLabel ); @@ -682,3 +701,4 @@ void KOAgendaView::createDayLabels() dayLabel->setFont( dlf ); - dayLabel->setAlignment(QLabel::AlignHCenter); + dayLabel->setCaption("0"); + //dayLabel->setAlignment(QLabel::AlignHCenter); dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) ); @@ -687,3 +707,5 @@ void KOAgendaView::createDayLabels() bool oneday = (mSelectedDates.first() == mSelectedDates.last() ); + int counter = 0; for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) { + ++counter; QDate date = *dit; @@ -696,3 +718,6 @@ void KOAgendaView::createDayLabels() if ( appendLabels ) { - dayLabel = new QLabel(mDayLabels); + dayLabel = new QPushButton(mDayLabels); + dayLabel->setFlat( true ); + connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); + dayLabel->setFocusPolicy(NoFocus); mDayLabelsList.append( dayLabel ); @@ -704,2 +729,3 @@ void KOAgendaView::createDayLabels() dayLabel->show(); + dayLabel->setCaption(QString::number( counter )); QString str; @@ -748,3 +774,3 @@ void KOAgendaView::createDayLabels() dayLabel->setText(str); - dayLabel->setAlignment(QLabel::AlignHCenter); + //dayLabel->setAlignment(QLabel::AlignHCenter); if (date == QDate::currentDate()) { @@ -783,3 +809,6 @@ void KOAgendaView::createDayLabels() if ( appendLabels ) { - dayLabel = new QLabel(mDayLabels); + dayLabel = new QPushButton(mDayLabels); + dayLabel->setFlat( true ); + connect( dayLabel, SIGNAL( clicked() ), this, SLOT ( slotDaylabelClicked() ) ); + dayLabel->setFocusPolicy(NoFocus); mDayLabelsList.append( dayLabel ); @@ -792,4 +821,5 @@ void KOAgendaView::createDayLabels() //qDebug("mLayoutDayLabels->addSpacing %d ", mAgenda->verticalScrollBar()->width()+offset+2 ); - dayLabel->setText("");//QString::number ( mSelectedDates.first().month() ) ); + dayLabel->setText(">");//QString::number ( mSelectedDates.first().month() ) ); dayLabel->show(); + dayLabel->setCaption("last"); dayLabel->setFixedWidth( mAgenda->verticalScrollBar()->width()+ offset ); |