-rw-r--r-- | korganizer/navigatorbar.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index f339c67..2406bb5 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp @@ -29,4 +29,5 @@ #include <qframe.h> #include <qlabel.h> +#include <qpopupmenu.h> #include <qapplication.h> @@ -72,5 +73,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam bool isDesktop = true; #endif - if ( QString ( name ) == QString("useBigPixmaps") && QApplication::desktop()->width() > 320 ) + bool insertWeek = (QString ( name ) == QString("useBigPixmaps")) ; + if ( insertWeek && QApplication::desktop()->width() > 320 ) isDesktop = true; // Create backward navigation buttons @@ -88,4 +90,11 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam QToolTip::add( mNextMonth, i18n("Next Month") ); + QPushButton * selWeek = 0; + if ( insertWeek ) { + selWeek = new QPushButton( mCtrlFrame ); + QToolTip::add( selWeek, i18n("Select Week") ); + selWeek->setFocusPolicy(NoFocus); + } + mNextYear = new QPushButton( mCtrlFrame ); mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); @@ -103,5 +112,7 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mSelectMonth->setFlat( true); mPrevYear->setFlat( true); - mPrevMonth->setFlat( true); + mPrevMonth->setFlat( true); + if ( insertWeek ) + selWeek->setFlat( true); } mSelectMonth->setFont( tfont ); @@ -124,4 +135,20 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam 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 ) { + wpo->insertItem( QString::number(i), i ); + } + for ( i = 53; i < 54; ++i ) { + wpo->insertItem( "", 52 ); + } + selWeek->setPopup( wpo ); + selWeek->setFixedWidth( (size/4)*3 ); + selWeek->setFixedHeight( size ); + connect( wpo, SIGNAL( activated(int) ), SIGNAL( selectWeek ( int ) ) ); + } mSelectMonth->setFixedWidth( maxwidth ); mSelectMonth->setFixedHeight( size ); @@ -142,4 +169,6 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam ctrlLayout->addWidget( mNextMonth, 3 ); ctrlLayout->addWidget( mNextYear, 3 ); + if ( insertWeek ) + ctrlLayout->addWidget( selWeek ); connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); @@ -153,4 +182,5 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam mNextYear->setFocusPolicy(NoFocus); mSelectMonth->setFocusPolicy(NoFocus); + } |