-rw-r--r-- | korganizer/navigatorbar.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 2406bb5..24de01f 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -123,43 +123,51 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam int width = fm.width("September '00" ); // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); // ++i ) { // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); // int width = fm.width("September 2000" ); // if ( width > maxwidth ) maxwidth = width; // } maxwidth = width+2; int size = fm.height()+2; if ( QApplication::desktop()->width() >= 480 ) { size += 6; maxwidth+= 6; } if ( insertWeek ) { - //shit : bug in Qt. after inserting 53 item, only 51 are shown... QPopupMenu * wpo = new QPopupMenu (this); - wpo->insertItem( i18n("W#"), 0 ); - for ( i = 1; i < 53; ++i ) { + QPopupMenu * all = new QPopupMenu (this); + //wpo->insertItem( i18n("W#"), 0 ); + int first = 1; + 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( selectWeek ( int ) ) ); + first = i; + wpo = new QPopupMenu (this); + } wpo->insertItem( QString::number(i), i ); } - for ( i = 53; i < 54; ++i ) { - wpo->insertItem( "", 52 ); + for ( i = 50; i < 53; ++i ) { + wpo->insertItem( QString::number(i), i); } - selWeek->setPopup( wpo ); - selWeek->setFixedWidth( (size/4)*3 ); + all->insertItem( i18n("Select week %1-%2" ).arg(first).arg( i-1) ,wpo ); + selWeek->setPopup( all ); + selWeek->setFixedWidth( (size/5)*4 ); selWeek->setFixedHeight( size ); connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); } mSelectMonth->setFixedWidth( maxwidth ); mSelectMonth->setFixedHeight( size ); mPrevYear->setFixedHeight( size ); mPrevMonth->setFixedHeight( size ); mNextMonth->setFixedHeight( size ); mNextYear->setFixedHeight ( size ); // set up control frame layout QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); ctrlLayout->addWidget( mPrevYear, 3 ); ctrlLayout->addWidget( mPrevMonth, 3 ); //ctrlLayout->addStretch( 1 ); // ctrlLayout->addSpacing( 1 ); // ctrlLayout->addWidget( mDateLabel ); |