summaryrefslogtreecommitdiffabout
path: root/microkde/kdatepickernew.cpp
Unidiff
Diffstat (limited to 'microkde/kdatepickernew.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r--microkde/kdatepickernew.cpp2
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
@@ -292,49 +292,49 @@ KDatePicker::weekSelected(int week)
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
308void 308void
309KDatePicker::selectMonthClicked() 309KDatePicker::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
335void 335void
336KDatePicker::selectYearClicked() 336KDatePicker::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;