-rw-r--r-- | microkde/kdatepickernew.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/microkde/kdatepickernew.cpp b/microkde/kdatepickernew.cpp index f60a422..8f8001e 100644 --- a/microkde/kdatepickernew.cpp +++ b/microkde/kdatepickernew.cpp | |||
@@ -284,65 +284,65 @@ KDatePicker::yearBackwardClicked() | |||
284 | 284 | ||
285 | void KDatePicker::selectWeekClicked() {} // ### in 3.2 obsolete; kept for binary compatibility | 285 | void KDatePicker::selectWeekClicked() {} // ### in 3.2 obsolete; kept for binary compatibility |
286 | 286 | ||
287 | void | 287 | void |
288 | KDatePicker::weekSelected(int week) | 288 | KDatePicker::weekSelected(int week) |
289 | { | 289 | { |
290 | week++; // week number starts with 1 | 290 | week++; // week number starts with 1 |
291 | 291 | ||
292 | const KCalendarSystem * calendar = KGlobal::locale()->calendar(); | 292 | const KCalendarSystem * calendar = KGlobal::locale()->calendar(); |
293 | 293 | ||
294 | QDate date = table->getDate(); | 294 | QDate date = table->getDate(); |
295 | int year = calendar->year(date); | 295 | int year = calendar->year(date); |
296 | 296 | ||
297 | calendar->setYMD(date, year, 1, 1); | 297 | calendar->setYMD(date, year, 1, 1); |
298 | date = calendar->addDays(date, -7); | 298 | date = calendar->addDays(date, -7); |
299 | while (calendar->weekNumber(date) != 1) | 299 | while (calendar->weekNumber(date) != 1) |
300 | date = calendar->addDays(date, 1); | 300 | date = calendar->addDays(date, 1); |
301 | 301 | ||
302 | // date is now first day in week 1 some day in week 1 | 302 | // date is now first day in week 1 some day in week 1 |
303 | date = calendar->addDays(date, (week - calendar->weekNumber(date)) * 7); | 303 | date = calendar->addDays(date, (week - calendar->weekNumber(date)) * 7); |
304 | 304 | ||
305 | setDate(date); | 305 | setDate(date); |
306 | } | 306 | } |
307 | 307 | ||
308 | void | 308 | void |
309 | KDatePicker::selectMonthClicked() | 309 | KDatePicker::selectMonthClicked() |
310 | { | 310 | { |
311 | // every year can have different month names (in some calendar systems) | 311 | // every year can have different month names (in some calendar systems) |
312 | const KCalendarSystem * calendar = KGlobal::locale()->calendar(); | 312 | const KCalendarSystem * calendar = KGlobal::locale()->calendar(); |
313 | QDate date = table->getDate(); | 313 | QDate date = table->getDate(); |
314 | int i, month, months = calendar->monthsInYear(date); | 314 | int i, month, months = calendar->monthsInYear(date); |
315 | 315 | ||
316 | QPopupMenu popup(selectMonth); | 316 | Q3PopupMenu popup(selectMonth); |
317 | 317 | ||
318 | for (i = 1; i <= months; i++) | 318 | for (i = 1; i <= months; i++) |
319 | popup.insertItem(calendar->monthName(i, calendar->year(date)), i); | 319 | popup.insertItem(calendar->monthName(i, calendar->year(date)), i); |
320 | 320 | ||
321 | popup.setActiveItem(calendar->month(date) - 1); | 321 | popup.setActiveItem(calendar->month(date) - 1); |
322 | 322 | ||
323 | if ( (month = popup.exec(selectMonth->mapToGlobal(QPoint(0, 0)), calendar->month(date) - 1)) == -1 ) return; // canceled | 323 | if ( (month = popup.exec(selectMonth->mapToGlobal(QPoint(0, 0)), calendar->month(date) - 1)) == -1 ) return; // canceled |
324 | 324 | ||
325 | int day = calendar->day(date); | 325 | int day = calendar->day(date); |
326 | // ----- construct a valid date in this month: | 326 | // ----- construct a valid date in this month: |
327 | //date.setYMD(date.year(), month, 1); | 327 | //date.setYMD(date.year(), month, 1); |
328 | //date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); | 328 | //date.setYMD(date.year(), month, QMIN(day, date.daysInMonth())); |
329 | calendar->setYMD(date, calendar->year(date), month, | 329 | calendar->setYMD(date, calendar->year(date), month, |
330 | QMIN(day, calendar->daysInMonth(date))); | 330 | QMIN(day, calendar->daysInMonth(date))); |
331 | // ----- set this month | 331 | // ----- set this month |
332 | setDate(date); | 332 | setDate(date); |
333 | } | 333 | } |
334 | 334 | ||
335 | void | 335 | void |
336 | KDatePicker::selectYearClicked() | 336 | KDatePicker::selectYearClicked() |
337 | { | 337 | { |
338 | const KCalendarSystem * calendar = KGlobal::locale()->calendar(); | 338 | const KCalendarSystem * calendar = KGlobal::locale()->calendar(); |
339 | 339 | ||
340 | int year; | 340 | int year; |
341 | KPopupFrame* popup = new KPopupFrame(this); | 341 | KPopupFrame* popup = new KPopupFrame(this); |
342 | KDateInternalYearSelector* picker = new KDateInternalYearSelector(popup); | 342 | KDateInternalYearSelector* picker = new KDateInternalYearSelector(popup); |
343 | // ----- | 343 | // ----- |
344 | picker->resize(picker->sizeHint()); | 344 | picker->resize(picker->sizeHint()); |
345 | popup->setMainWidget(picker); | 345 | popup->setMainWidget(picker); |
346 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); | 346 | connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int))); |
347 | picker->setFocus(); | 347 | picker->setFocus(); |
348 | if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height())))) | 348 | if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height())))) |