void KDatePicker::dateChangedSlot(const QDate &date) { kDebug()<<k_funcinfo << "KDatePicker::dateChangedSlot: date changed (" << date.year() << "/" << date.month() << "/" << date.day() << ")." << endl; const KCalendarSystem * calendar = KGlobal::locale()->calendar(); d->line->setText(KGlobal::locale()->formatDate(date, KLocale::ShortDate)); d->selectMonth->setText(calendar->monthName(date, KCalendarSystem::ShortName)); fillWeeksCombo(date); // calculate the item num in the week combo box; normalize selected day so as if 1.1. is the first day of the week QDate firstDay; calendar->setYMD(firstDay, calendar->year(date), 1, 1); d->selectWeek->setCurrentIndex((calendar->dayOfYear(date) + calendar->dayOfWeek(firstDay) - 2) / 7/*calendar->daysInWeek()*/); d->selectYear->setText(calendar->yearString(date, KCalendarSystem::ShortFormat)); emit(dateChanged(date)); }
void ExtDatePicker::dateChangedSlot(const ExtDate &date) { kdDebug(298) << "ExtDatePicker::dateChangedSlot: date changed (" << date.year() << "/" << date.month() << "/" << date.day() << ")." << endl; //must remain commented unless ExtDate gets added to kdelibs // const ExtCalendarSystem * calendar = KGlobal::locale()->calendar(); // line->setText(KGlobal::locale()->formatDate(date, true)); line->setText( date.toString( KGlobal::locale()->dateFormatShort() ) ); selectMonth->setText(d->calendar->monthName(date, false)); fillWeeksCombo(date); // calculate the item num in the week combo box; normalize selected day so as if 1.1. is the first day of the week ExtDate firstDay(date.year(), 1, 1); d->selectWeek->setCurrentItem((d->calendar->dayOfYear(date) + d->calendar->dayOfWeek(firstDay) - 2) / 7/*calendar->daysInWeek()*/); selectYear->setText(d->calendar->yearString(date, false)); emit(dateChanged(date)); }