summaryrefslogtreecommitdiffabout
path: root/korganizer/koagendaview.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/koagendaview.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/koagendaview.cpp44
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
@@ -610,4 +610,20 @@ 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()
{
@@ -671,9 +687,12 @@ void KOAgendaView::createDayLabels()
// QFont lFont = dlf;
bool appendLabels = false;
- QLabel *dayLabel;
+ QPushButton *dayLabel;
dayLabel = mDayLabelsList.first();
if ( !dayLabel ) {
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 );
mLayoutDayLabels->addWidget(dayLabel);
@@ -681,10 +700,13 @@ void KOAgendaView::createDayLabels()
dayLabel->setFixedWidth( mTimeLabels->width()+2 );
dayLabel->setFont( dlf );
- dayLabel->setAlignment(QLabel::AlignHCenter);
+ dayLabel->setCaption("0");
+ //dayLabel->setAlignment(QLabel::AlignHCenter);
dayLabel->setText( KOGlobals::self()->calendarSystem()->monthName( mSelectedDates.first(), true ) );
dayLabel->show();
DateList::ConstIterator dit;
bool oneday = (mSelectedDates.first() == mSelectedDates.last() );
+ int counter = 0;
for( dit = mSelectedDates.begin(); dit != mSelectedDates.end(); ++dit ) {
+ ++counter;
QDate date = *dit;
// QBoxLayout *dayLayout = new QVBoxLayout(mLayoutDayLabels);
@@ -695,5 +717,8 @@ 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 );
mLayoutDayLabels->addWidget(dayLabel);
@@ -703,4 +728,5 @@ void KOAgendaView::createDayLabels()
dayLabel->setFont( dlf );
dayLabel->show();
+ dayLabel->setCaption(QString::number( counter ));
QString str;
int dW = KOGlobals::self()->calendarSystem()->dayOfWeek(date);
@@ -747,5 +773,5 @@ void KOAgendaView::createDayLabels()
}
dayLabel->setText(str);
- dayLabel->setAlignment(QLabel::AlignHCenter);
+ //dayLabel->setAlignment(QLabel::AlignHCenter);
if (date == QDate::currentDate()) {
QFont bFont = dlf;
@@ -782,5 +808,8 @@ 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 );
mLayoutDayLabels->addWidget(dayLabel);
@@ -791,6 +820,7 @@ void KOAgendaView::createDayLabels()
if ( offset < 0 ) offset = 0;
//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 );
//qDebug("setToFixed %d ", mAgenda->verticalScrollBar()->width()+ offset+2);