summaryrefslogtreecommitdiffabout
path: root/korganizer/navigatorbar.cpp
authorzautrix <zautrix>2005-02-02 21:31:25 (UTC)
committer zautrix <zautrix>2005-02-02 21:31:25 (UTC)
commit279354f19275e5e654636acb87c465edf652eeae (patch) (side-by-side diff)
tree1721c6201fa28392cb02a80510c47a12ae4e0d4c /korganizer/navigatorbar.cpp
parentf79d089ec5c44a27f9005da76e452b4574eae27f (diff)
downloadkdepimpi-279354f19275e5e654636acb87c465edf652eeae.zip
kdepimpi-279354f19275e5e654636acb87c465edf652eeae.tar.gz
kdepimpi-279354f19275e5e654636acb87c465edf652eeae.tar.bz2
fifix
Diffstat (limited to 'korganizer/navigatorbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/navigatorbar.cpp22
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
@@ -115,59 +115,67 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
if ( insertWeek )
selWeek->setFlat( true);
}
mSelectMonth->setFont( tfont );
// Set minimum width to width of widest month name label
int i;
int maxwidth = 0;
QFontMetrics fm ( mSelectMonth->font() );
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 );
ctrlLayout->addWidget( mSelectMonth );
// ctrlLayout->addSpacing( 1 );
// ctrlLayout->addStretch( 1 );
ctrlLayout->addWidget( mNextMonth, 3 );
ctrlLayout->addWidget( mNextYear, 3 );
if ( insertWeek )
ctrlLayout->addWidget( selWeek );