summaryrefslogtreecommitdiffabout
path: root/korganizer/navigatorbar.cpp
Side-by-side diff
Diffstat (limited to 'korganizer/navigatorbar.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--korganizer/navigatorbar.cpp34
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
@@ -27,8 +27,9 @@
#include <qpushbutton.h>
#include <qlayout.h>
#include <qframe.h>
#include <qlabel.h>
+#include <qpopupmenu.h>
#include <qapplication.h>
#include <kdebug.h>
#include <klocale.h>
@@ -70,9 +71,10 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
bool isDesktop = false;
#else
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
mPrevYear = new QPushButton( mCtrlFrame );
mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) );
@@ -86,8 +88,15 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
mNextMonth = new QPushButton( mCtrlFrame );
mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
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") );
QToolTip::add( mNextYear, i18n("Next Year") );
mSelectMonth = new QPushButton( mCtrlFrame );
@@ -101,9 +110,11 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
mNextMonth->setFlat( true);
mNextYear->setFlat( true);
mSelectMonth->setFlat( true);
mPrevYear->setFlat( true);
- mPrevMonth->setFlat( true);
+ mPrevMonth->setFlat( true);
+ if ( insertWeek )
+ selWeek->setFlat( true);
}
mSelectMonth->setFont( tfont );
// Set minimum width to width of widest month name label
int i;
@@ -122,8 +133,24 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
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 ) {
+ 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 );
mPrevYear->setFixedHeight( size );
mPrevMonth->setFixedHeight( size );
@@ -140,8 +167,10 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
// ctrlLayout->addSpacing( 1 );
// ctrlLayout->addStretch( 1 );
ctrlLayout->addWidget( mNextMonth, 3 );
ctrlLayout->addWidget( mNextYear, 3 );
+ if ( insertWeek )
+ ctrlLayout->addWidget( selWeek );
connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
@@ -151,8 +180,9 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
mPrevMonth->setFocusPolicy(NoFocus);
mNextMonth->setFocusPolicy(NoFocus);
mNextYear->setFocusPolicy(NoFocus);
mSelectMonth->setFocusPolicy(NoFocus);
+
}
NavigatorBar::~NavigatorBar()
{