From 118f5aab05c9ace5612d5c4fd69e7c5a59bed67b Mon Sep 17 00:00:00 2001 From: zautrix Date: Sun, 06 Feb 2005 01:23:43 +0000 Subject: better week choose --- (limited to 'korganizer/koagendaview.cpp') diff --git a/korganizer/koagendaview.cpp b/korganizer/koagendaview.cpp index 36c66ea..0d36946 100644 --- a/korganizer/koagendaview.cpp +++ b/korganizer/koagendaview.cpp @@ -425,36 +425,7 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : mExpandButton->setFocusPolicy(NoFocus); mAllDayAgenda = new KOAgenda(1,mAllDayFrame); mAllDayAgenda->setFocusPolicy(NoFocus); - QVBox *dummyAllDayRight = new QVBox(mAllDayFrame); - - mDummyAllDayRightL = new QLabel ( dummyAllDayRight ); - QPushButton *dummyAllDayRightB = new QPushButton(dummyAllDayRight); - new QLabel ( dummyAllDayRight ); - mDummyAllDayRightL->setSizePolicy( QSizePolicy( QSizePolicy::Minimum,QSizePolicy::Fixed ) ); - dummyAllDayRightB->setFlat( true ); - dummyAllDayRightB->setFocusPolicy(NoFocus); - dummyAllDayRightB->setFixedHeight( (dummyAllDayRightB->sizeHint().height()/4)*3 ); - - QPopupMenu * wpo = new QPopupMenu (this); - QPopupMenu * all = new QPopupMenu (this); - //wpo->insertItem( i18n("W#"), 0 ); - int first = 1; - int i; - for ( i = 1; i < 50; ++i ) { - if ( !(i%10) ) { - all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); - connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); - first = i; - wpo = new QPopupMenu (this); - } - wpo->insertItem( QString::number(i), i ); - } - for ( i = 50; i < 53; ++i ) { - wpo->insertItem( QString::number(i), i); - } - all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); - dummyAllDayRightB->setPopup( all ); - connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeekNum ( int ) ) ); + QLabel *dummyAllDayRight = new QLabel (mAllDayFrame); // Create event context menu for all day agenda mAllDayAgendaPopup = eventPopup(); @@ -587,20 +558,7 @@ KOAgendaView::KOAgendaView(Calendar *cal,QWidget *parent,const char *name) : // connect( mAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); //connect( mAllDayAgenda, SIGNAL( cloneIncidenceSignal(Incidence *) ), SIGNAL( cloneIncidenceSignal(Incidence *) ) ); - QFont dlf = KOPrefs::instance()->mTimeLabelsFont; - QFontMetrics fm ( dlf ); - QString dayTest = "30"; - int wid = fm.width( dayTest ); - int maxWid = dummyAllDayRight->width()-2; - int fontPoint = dlf.pointSize(); - while ( wid > maxWid ) { - --fontPoint; - dlf.setPointSize( fontPoint ); - QFontMetrics f( dlf ); - wid = f.width( dayTest ); - } - mDummyAllDayRightL->setFont( dlf ); - mDummyAllDayRightL->setAlignment( AlignHCenter ); + } void KOAgendaView::toggleAllDay() @@ -1108,32 +1066,6 @@ void KOAgendaView::fillAgenda() //qDebug("fillAgenda()++++ "); globalFlagBlockAgendaItemPaint = 1; - int weekNum = 0; - QDate seda = mSelectedDates.first(); - QDate d = QDate ( seda.year(), 1,1); - seda = seda.addDays( 1-seda.dayOfWeek() );//we are on monday - if ( seda.addDays(6).year() != seda.year() ) { - if ( seda.year() != d.year() ) { - if ( d.dayOfWeek() > 4 ) - d = QDate ( seda.year(), 1,1); - else - weekNum = 1; - } else { - QDate dd( seda.year()+1, 1,1); - if ( dd.dayOfWeek() <= 4 ) - weekNum = 1; - } - } - if ( weekNum == 0 ){ - int dow = d.dayOfWeek(); - if ( dow <= 4 ) - d = d.addDays( 1-dow ); - else // 5,6,7 - d = d.addDays( 8-dow ); - // we have the first week of the year.we are on monday - weekNum = d.daysTo( seda ) / 7 +1; - } - mDummyAllDayRightL->setText( QString::number( weekNum) ); mAllDayAgenda->changeColumns(mSelectedDates.count()); mAgenda->changeColumns(mSelectedDates.count()); qApp->processEvents(); -- cgit v0.9.0.2