summaryrefslogtreecommitdiffabout
path: root/korganizer/navigatorbar.cpp
Unidiff
Diffstat (limited to 'korganizer/navigatorbar.cpp') (more/less context) (show whitespace changes)
-rw-r--r--korganizer/navigatorbar.cpp22
1 files changed, 22 insertions, 0 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp
index b591232..934e153 100644
--- a/korganizer/navigatorbar.cpp
+++ b/korganizer/navigatorbar.cpp
@@ -80,40 +80,54 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
80 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) ); 80 mPrevYear->setPixmap( SmallIcon( isDesktop ? "2leftarrowB" : "2leftarrow" ) );
81 QToolTip::add( mPrevYear, i18n("Previous Year") ); 81 QToolTip::add( mPrevYear, i18n("Previous Year") );
82 82
83 mPrevMonth = new QPushButton( mCtrlFrame ); 83 mPrevMonth = new QPushButton( mCtrlFrame );
84 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") ); 84 mPrevMonth->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
85 QToolTip::add( mPrevMonth, i18n("Previous Month") ); 85 QToolTip::add( mPrevMonth, i18n("Previous Month") );
86 86
87 // Create forward navigation buttons 87 // Create forward navigation buttons
88 mNextMonth = new QPushButton( mCtrlFrame ); 88 mNextMonth = new QPushButton( mCtrlFrame );
89 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") ); 89 mNextMonth->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
90 QToolTip::add( mNextMonth, i18n("Next Month") ); 90 QToolTip::add( mNextMonth, i18n("Next Month") );
91 91
92 mPrevWeek = new QPushButton( mCtrlFrame );
93 mPrevWeek->setPixmap( SmallIcon( isDesktop ? "1leftarrowB" : "1leftarrow") );
94 QToolTip::add( mPrevWeek, i18n("Previous Week") );
95
96 // Create forward navigation buttons
97 mNextWeek = new QPushButton( mCtrlFrame );
98 mNextWeek->setPixmap( SmallIcon( isDesktop ? "1rightarrowB" : "1rightarrow") );
99 QToolTip::add( mNextWeek, i18n("Next Week") );
100
92 mNextYear = new QPushButton( mCtrlFrame ); 101 mNextYear = new QPushButton( mCtrlFrame );
93 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") ); 102 mNextYear->setPixmap( SmallIcon( isDesktop ? "2rightarrowB": "2rightarrow") );
94 QToolTip::add( mNextYear, i18n("Next Year") ); 103 QToolTip::add( mNextYear, i18n("Next Year") );
95 mSelectMonth = new QPushButton( mCtrlFrame ); 104 mSelectMonth = new QPushButton( mCtrlFrame );
96 // Create month name label 105 // Create month name label
97 //selectMonth->setFont( tfont ); 106 //selectMonth->setFont( tfont );
98 // selectMonth->setAlignment( AlignCenter ); 107 // selectMonth->setAlignment( AlignCenter );
99 //mDateLabel = new QLabel( selectMonth ); 108 //mDateLabel = new QLabel( selectMonth );
100 //mDateLabel->setFont( tfont ); 109 //mDateLabel->setFont( tfont );
101 //mDateLabel->setAlignment( AlignCenter ); 110 //mDateLabel->setAlignment( AlignCenter );
102 if ( QString ( name ) == QString("useBigPixmaps") ) { 111 if ( QString ( name ) == QString("useBigPixmaps") ) {
103 mNextMonth->setFlat( true); 112 mNextMonth->setFlat( true);
113 mNextWeek->setFlat( true);
104 mNextYear->setFlat( true); 114 mNextYear->setFlat( true);
105 mSelectMonth->setFlat( true); 115 mSelectMonth->setFlat( true);
106 mPrevYear->setFlat( true); 116 mPrevYear->setFlat( true);
107 mPrevMonth->setFlat( true); 117 mPrevMonth->setFlat( true);
118 mPrevWeek->setFlat( true);
119 } else {
120 mPrevWeek->hide();
121 mNextWeek->hide();
108 } 122 }
109 mSelectMonth->setFont( tfont ); 123 mSelectMonth->setFont( tfont );
110 // Set minimum width to width of widest month name label 124 // Set minimum width to width of widest month name label
111 int i; 125 int i;
112 int maxwidth = 0; 126 int maxwidth = 0;
113 QFontMetrics fm ( mSelectMonth->font() ); 127 QFontMetrics fm ( mSelectMonth->font() );
114 int width = fm.width("September '00" ); 128 int width = fm.width("September '00" );
115// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); 129// for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date);
116// ++i ) { 130// ++i ) {
117// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, 131// //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i,
118// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); 132// // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" );
119// int width = fm.width("September 2000" ); 133// int width = fm.width("September 2000" );
@@ -121,47 +135,55 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam
121// } 135// }
122 maxwidth = width+2; 136 maxwidth = width+2;
123 int size = fm.height()+2; 137 int size = fm.height()+2;
124 if ( QApplication::desktop()->width() >= 480 ) { 138 if ( QApplication::desktop()->width() >= 480 ) {
125 size += 6; 139 size += 6;
126 maxwidth+= 6; 140 maxwidth+= 6;
127 } 141 }
128 142
129 mSelectMonth->setFixedWidth( maxwidth ); 143 mSelectMonth->setFixedWidth( maxwidth );
130 mSelectMonth->setFixedHeight( size ); 144 mSelectMonth->setFixedHeight( size );
131 mPrevYear->setFixedHeight( size ); 145 mPrevYear->setFixedHeight( size );
132 mPrevMonth->setFixedHeight( size ); 146 mPrevMonth->setFixedHeight( size );
147 mPrevWeek->setFixedHeight( size );
133 mNextMonth->setFixedHeight( size ); 148 mNextMonth->setFixedHeight( size );
149 mNextWeek->setFixedHeight( size );
134 mNextYear->setFixedHeight ( size ); 150 mNextYear->setFixedHeight ( size );
135 // set up control frame layout 151 // set up control frame layout
136 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); 152 QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 );
137 ctrlLayout->addWidget( mPrevYear, 3 ); 153 ctrlLayout->addWidget( mPrevYear, 3 );
138 ctrlLayout->addWidget( mPrevMonth, 3 ); 154 ctrlLayout->addWidget( mPrevMonth, 3 );
155 ctrlLayout->addWidget( mPrevWeek, 3 );
139 //ctrlLayout->addStretch( 1 ); 156 //ctrlLayout->addStretch( 1 );
140 // ctrlLayout->addSpacing( 1 ); 157 // ctrlLayout->addSpacing( 1 );
141 // ctrlLayout->addWidget( mDateLabel ); 158 // ctrlLayout->addWidget( mDateLabel );
142 ctrlLayout->addWidget( mSelectMonth ); 159 ctrlLayout->addWidget( mSelectMonth );
143 // ctrlLayout->addSpacing( 1 ); 160 // ctrlLayout->addSpacing( 1 );
144 // ctrlLayout->addStretch( 1 ); 161 // ctrlLayout->addStretch( 1 );
162 ctrlLayout->addWidget( mNextWeek, 3 );
145 ctrlLayout->addWidget( mNextMonth, 3 ); 163 ctrlLayout->addWidget( mNextMonth, 3 );
146 ctrlLayout->addWidget( mNextYear, 3 ); 164 ctrlLayout->addWidget( mNextYear, 3 );
147 165
148 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); 166 connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) );
149 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); 167 connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) );
150 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); 168 connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) );
169 connect( mPrevWeek, SIGNAL( clicked() ), SIGNAL( goPrevWeek() ) );
170 connect( mNextWeek, SIGNAL( clicked() ), SIGNAL( goNextWeek() ) );
151 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); 171 connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) );
152 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); 172 connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) );
153 mPrevYear->setFocusPolicy(NoFocus); 173 mPrevYear->setFocusPolicy(NoFocus);
154 mPrevMonth->setFocusPolicy(NoFocus); 174 mPrevMonth->setFocusPolicy(NoFocus);
155 mNextMonth->setFocusPolicy(NoFocus); 175 mNextMonth->setFocusPolicy(NoFocus);
176 mPrevWeek->setFocusPolicy(NoFocus);
177 mNextWeek->setFocusPolicy(NoFocus);
156 mNextYear->setFocusPolicy(NoFocus); 178 mNextYear->setFocusPolicy(NoFocus);
157 mSelectMonth->setFocusPolicy(NoFocus); 179 mSelectMonth->setFocusPolicy(NoFocus);
158 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); 180 setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) );
159 181
160} 182}
161 183
162NavigatorBar::~NavigatorBar() 184NavigatorBar::~NavigatorBar()
163{ 185{
164} 186}
165 187
166void NavigatorBar::selectMonth() 188void NavigatorBar::selectMonth()
167{ 189{