-rw-r--r-- | korganizer/navigatorbar.cpp | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/korganizer/navigatorbar.cpp b/korganizer/navigatorbar.cpp index 657f98d..f05e6f6 100644 --- a/korganizer/navigatorbar.cpp +++ b/korganizer/navigatorbar.cpp | |||
@@ -109,93 +109,94 @@ NavigatorBar::NavigatorBar( const QDate & date, QWidget *parent, const char *nam | |||
109 | // Set minimum width to width of widest month name label | 109 | // Set minimum width to width of widest month name label |
110 | int i; | 110 | int i; |
111 | int maxwidth = 0; | 111 | int maxwidth = 0; |
112 | QFontMetrics fm ( mSelectMonth->font() ); | 112 | QFontMetrics fm ( mSelectMonth->font() ); |
113 | int width = fm.width("September '00" ); | 113 | int width = fm.width("September '00" ); |
114 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); | 114 | // for( i = 1; i <= KOGlobals::self()->calendarSystem()->monthsInYear(date); |
115 | // ++i ) { | 115 | // ++i ) { |
116 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, | 116 | // //int width = fm.width( KOGlobals::self()->calendarSystem()->monthName(i, |
117 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); | 117 | // // KOGlobals::self()->calendarSystem()->year(date) ) + " 2000" ); |
118 | // int width = fm.width("September 2000" ); | 118 | // int width = fm.width("September 2000" ); |
119 | // if ( width > maxwidth ) maxwidth = width; | 119 | // if ( width > maxwidth ) maxwidth = width; |
120 | // } | 120 | // } |
121 | maxwidth = width+2; | 121 | maxwidth = width+2; |
122 | int size = fm.height()+2; | 122 | int size = fm.height()+2; |
123 | if ( QApplication::desktop()->width() >= 480 ) { | 123 | if ( QApplication::desktop()->width() >= 480 ) { |
124 | size += 6; | 124 | size += 6; |
125 | maxwidth+= 6; | 125 | maxwidth+= 6; |
126 | } | 126 | } |
127 | 127 | ||
128 | mSelectMonth->setFixedWidth( maxwidth ); | 128 | mSelectMonth->setFixedWidth( maxwidth ); |
129 | mSelectMonth->setFixedHeight( size ); | 129 | mSelectMonth->setFixedHeight( size ); |
130 | mPrevYear->setFixedHeight( size ); | 130 | mPrevYear->setFixedHeight( size ); |
131 | mPrevMonth->setFixedHeight( size ); | 131 | mPrevMonth->setFixedHeight( size ); |
132 | mNextMonth->setFixedHeight( size ); | 132 | mNextMonth->setFixedHeight( size ); |
133 | mNextYear->setFixedHeight ( size ); | 133 | mNextYear->setFixedHeight ( size ); |
134 | // set up control frame layout | 134 | // set up control frame layout |
135 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); | 135 | QBoxLayout *ctrlLayout = new QHBoxLayout( mCtrlFrame, 1 ); |
136 | ctrlLayout->addWidget( mPrevYear, 3 ); | 136 | ctrlLayout->addWidget( mPrevYear, 3 ); |
137 | ctrlLayout->addWidget( mPrevMonth, 3 ); | 137 | ctrlLayout->addWidget( mPrevMonth, 3 ); |
138 | //ctrlLayout->addStretch( 1 ); | 138 | //ctrlLayout->addStretch( 1 ); |
139 | // ctrlLayout->addSpacing( 1 ); | 139 | // ctrlLayout->addSpacing( 1 ); |
140 | // ctrlLayout->addWidget( mDateLabel ); | 140 | // ctrlLayout->addWidget( mDateLabel ); |
141 | ctrlLayout->addWidget( mSelectMonth ); | 141 | ctrlLayout->addWidget( mSelectMonth ); |
142 | // ctrlLayout->addSpacing( 1 ); | 142 | // ctrlLayout->addSpacing( 1 ); |
143 | // ctrlLayout->addStretch( 1 ); | 143 | // ctrlLayout->addStretch( 1 ); |
144 | ctrlLayout->addWidget( mNextMonth, 3 ); | 144 | ctrlLayout->addWidget( mNextMonth, 3 ); |
145 | ctrlLayout->addWidget( mNextYear, 3 ); | 145 | ctrlLayout->addWidget( mNextYear, 3 ); |
146 | 146 | ||
147 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); | 147 | connect( mPrevYear, SIGNAL( clicked() ), SIGNAL( goPrevYear() ) ); |
148 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); | 148 | connect( mPrevMonth, SIGNAL( clicked() ), SIGNAL( goPrevMonth() ) ); |
149 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); | 149 | connect( mNextMonth, SIGNAL( clicked() ), SIGNAL( goNextMonth() ) ); |
150 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); | 150 | connect( mNextYear, SIGNAL( clicked() ), SIGNAL( goNextYear() ) ); |
151 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); | 151 | connect( mSelectMonth, SIGNAL( clicked() ),SLOT( selectMonth() ) ); |
152 | mPrevYear->setFocusPolicy(NoFocus); | 152 | mPrevYear->setFocusPolicy(NoFocus); |
153 | mPrevMonth->setFocusPolicy(NoFocus); | 153 | mPrevMonth->setFocusPolicy(NoFocus); |
154 | mNextMonth->setFocusPolicy(NoFocus); | 154 | mNextMonth->setFocusPolicy(NoFocus); |
155 | mNextYear->setFocusPolicy(NoFocus); | 155 | mNextYear->setFocusPolicy(NoFocus); |
156 | mSelectMonth->setFocusPolicy(NoFocus); | 156 | mSelectMonth->setFocusPolicy(NoFocus); |
157 | setSizePolicy( QSizePolicy ( QSizePolicy::Expanding ,QSizePolicy::Fixed ) ); | ||
157 | 158 | ||
158 | } | 159 | } |
159 | 160 | ||
160 | NavigatorBar::~NavigatorBar() | 161 | NavigatorBar::~NavigatorBar() |
161 | { | 162 | { |
162 | } | 163 | } |
163 | 164 | ||
164 | void NavigatorBar::selectMonth() | 165 | void NavigatorBar::selectMonth() |
165 | { | 166 | { |
166 | 167 | ||
167 | int month; | 168 | int month; |
168 | KPopupFrame* popup = new KPopupFrame(this); | 169 | KPopupFrame* popup = new KPopupFrame(this); |
169 | int size = 12; | 170 | int size = 12; |
170 | if ( QApplication::desktop()->width() >= 480 ) | 171 | if ( QApplication::desktop()->width() >= 480 ) |
171 | size = 18; | 172 | size = 18; |
172 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); | 173 | KDateInternalMonthPicker* picker = new KDateInternalMonthPicker(size, popup); |
173 | // ----- | 174 | // ----- |
174 | picker->resize(picker->sizeHint()); | 175 | picker->resize(picker->sizeHint()); |
175 | popup->setMainWidget(picker); | 176 | popup->setMainWidget(picker); |
176 | picker->setFocus(); | 177 | picker->setFocus(); |
177 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 178 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
178 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) | 179 | if(popup->exec(mSelectMonth->mapToGlobal(QPoint(0, mSelectMonth->height())))) |
179 | { | 180 | { |
180 | month = picker->getResult(); | 181 | month = picker->getResult(); |
181 | emit monthSelected ( month ); | 182 | emit monthSelected ( month ); |
182 | } else { | 183 | } else { |
183 | KNotifyClient::beep(); | 184 | KNotifyClient::beep(); |
184 | } | 185 | } |
185 | delete popup; | 186 | delete popup; |
186 | } | 187 | } |
187 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) | 188 | void NavigatorBar::selectDates( const KCal::DateList &dateList ) |
188 | { | 189 | { |
189 | if (dateList.count() > 0) { | 190 | if (dateList.count() > 0) { |
190 | QDate date = dateList.first(); | 191 | QDate date = dateList.first(); |
191 | 192 | ||
192 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); | 193 | const KCalendarSystem *calSys = KOGlobals::self()->calendarSystem(); |
193 | 194 | ||
194 | // compute the label at the top of the navigator | 195 | // compute the label at the top of the navigator |
195 | QString dtstr = i18n(calSys->monthName( date )) + " '" + | 196 | QString dtstr = i18n(calSys->monthName( date )) + " '" + |
196 | QString::number( calSys->year( date ) ).right(2); | 197 | QString::number( calSys->year( date ) ).right(2); |
197 | 198 | ||
198 | mSelectMonth->setText( dtstr ); | 199 | mSelectMonth->setText( dtstr ); |
199 | } | 200 | } |
200 | } | 201 | } |
201 | 202 | ||