-rw-r--r-- | korganizer/komonthview.cpp | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/korganizer/komonthview.cpp b/korganizer/komonthview.cpp index 00b1e92..f2cfb75 100644 --- a/korganizer/komonthview.cpp +++ b/korganizer/komonthview.cpp @@ -785,77 +785,92 @@ KOMonthView::KOMonthView(Calendar *calendar, QWidget *parent, const char *name) int i; for( i = 0; i < mDaysPerWeek; i++ ) { QLabel *label = new QLabel( this ); label->setFont(bfont); label->setFrameStyle(QFrame::Panel|QFrame::Raised); label->setLineWidth(1); label->setAlignment(AlignCenter); mDayLabels.insert( i, label ); } bfont.setBold( false ); mWeekLabels.resize( mNumWeeks+1 ); for( i = 0; i < mNumWeeks+1; i++ ) { KOWeekButton *label = new KOWeekButton( this ); label->setFont(bfont); - connect( label, SIGNAL( selectWeekNum ( int )),this, SIGNAL( selectWeekNum ( int )) ); + connect( label, SIGNAL( selectWeekNum ( int )),this, SLOT( selectInternalWeekNum ( int )) ); label->setFlat(true); - QWhatsThis::add(label,i18n("Click on the week number to\nshow week in agenda view")); + QWhatsThis::add(label,i18n("Click on the week number to\nshow week zoomed")); //label->setFrameStyle(QFrame::Panel|QFrame::Raised); //label->setLineWidth(1); //label->setAlignment(AlignCenter); mWeekLabels.insert( i, label ); } - mWeekLabels[mNumWeeks]->setText( i18n("W")); - QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nswitch to week mode view")); + mWeekLabels[mNumWeeks]->setText( i18n("")); + QWhatsThis::add(mWeekLabels[mNumWeeks],i18n("Click on this to\nselect week number")); int row, col; + QPopupMenu * wpo = new QPopupMenu (this); + wpo->insertItem( i18n("W#"), 0 ); + for ( i = 1; i < 54; i++ ) + wpo->insertItem( i18n("%1").arg(i), i ); + mWeekLabels[mNumWeeks]->setPopup( wpo ); mCells.resize( mNumCells ); for( row = 0; row < mNumWeeks; ++row ) { for( col = 0; col < mDaysPerWeek; ++col ) { MonthViewCell *cell = new MonthViewCell( this ); mCells.insert( row * mDaysPerWeek + col, cell ); connect( cell, SIGNAL( defaultAction( Incidence * ) ), SLOT( defaultAction( Incidence * ) ) ); connect( cell, SIGNAL( newEventSignal( QDateTime ) ), SIGNAL( newEventSignal( QDateTime ) ) ); connect( cell, SIGNAL( showDaySignal( QDate ) ), SIGNAL( showDaySignal( QDate ) ) ); } } - connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), - SLOT( switchView() ) ); + //connect( mWeekLabels[mNumWeeks], SIGNAL( clicked() ), SLOT( switchView() ) ); + connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); mContextMenu = eventPopup(); // updateConfig(); //useless here emit incidenceSelected( 0 ); } KOMonthView::~KOMonthView() { delete mContextMenu; } +void KOMonthView::selectDateWeekNum ( int ) +{ + +} +void KOMonthView::selectInternalWeekNum ( int n ) +{ + emit selectWeekNum ( n ); + switchView(); +} + void KOMonthView::switchView() { if ( selectedCell( ) ) selectedCell()->deselect(); mShowWeekView = !mShowWeekView; KOPrefs::instance()->mMonthViewWeek = mShowWeekView; - emit showNavigator( !mShowWeekView ); + //emit showNavigator( !mShowWeekView ); computeLayout(); updateConfig(); } int KOMonthView::maxDatesHint() { return mNumCells; } int KOMonthView::currentDateCount() { return mNumCells; } QPtrList<Incidence> KOMonthView::selectedIncidences() { @@ -1209,33 +1224,33 @@ void KOMonthView::computeLayoutWeek() y += h+dayLabelHei ; } } y= dayLabelHei; h = cellHei ; mWeekLabels[0]->setGeometry( 0,y,weeklabelwid,hei-dayLabelHei); for ( i = 1; i < 6; i++) { mWeekLabels[i]->hide(); } mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; updateDayLabels(); bool forceUpdate = !updatePossible; updatePossible = true; - mWeekLabels[mNumWeeks]->setText( i18n("M")); + //mWeekLabels[mNumWeeks]->setText( i18n("M")); if ( forceUpdate ) updateView(); } void KOMonthView::computeLayout() { // select the appropriate heading string size. E.g. "Wednesday" or "Wed". // note this only changes the text if the requested size crosses the // threshold between big enough to support the full name and not big // enough. if ( mShowWeekView ){ computeLayoutWeek(); return; } int daysToShow = 7; bool combinedSatSun = false; if (mShowSatSunComp = KOPrefs::instance()->mMonthViewSatSunTog ) { @@ -1318,33 +1333,33 @@ void KOMonthView::computeLayout() y= dayLabelHei; h = cellHei ; for ( i = 0; i < 6; i++) { mWeekLabels[i]->show(); if ( i == (6-rowModulo)) ++h; mWeekLabels[i]->setGeometry( 0,y,weeklabelwid,h); y += h; } mWeekLabels[6]->setGeometry( 0,0,weeklabelwid,dayLabelHei); // qDebug("RRRRRRRRRRRRR %d %d old %d %d", e->size().width(),e->size().height() , e->oldSize().width(),e->oldSize().height()); //qDebug("parent %d %d ", topLevelWidget()->size().width(), topLevelWidget()->size().height()); mShortDayLabels = mDayLabels[0]->width() < mWidthLongDayLabel ; updateDayLabels(); bool forceUpdate = !updatePossible; updatePossible = true; - mWeekLabels[mNumWeeks]->setText( i18n("W")); + //mWeekLabels[mNumWeeks]->setText( i18n("W")); if ( forceUpdate ) updateView(); } void KOMonthView::showContextMenu( Incidence *incidence ) { mContextMenu->showIncidencePopup(incidence); /* if( incidence && incidence->type() == "Event" ) { Event *event = static_cast<Event *>(incidence); mContextMenu->showEventPopup(event); } else { kdDebug() << "MonthView::showContextMenu(): cast failed." << endl; } */ } |