summaryrefslogtreecommitdiffabout
path: root/microkde/kdatepickernew.cpp
Side-by-side diff
Diffstat (limited to 'microkde/kdatepickernew.cpp') (more/less context) (show 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
@@ -252,129 +252,129 @@ KDatePicker::monthForwardClicked()
QDate temp;
temp = KGlobal::locale()->calendar()->addMonths( table->getDate(), 1 );
setDate( temp );
}
void
KDatePicker::monthBackwardClicked()
{
QDate temp;
temp = KGlobal::locale()->calendar()->addMonths( table->getDate(), -1 );
setDate( temp );
}
void
KDatePicker::yearForwardClicked()
{
QDate temp;
temp = KGlobal::locale()->calendar()->addYears( table->getDate(), 1 );
setDate( temp );
}
void
KDatePicker::yearBackwardClicked()
{
QDate temp;
temp = KGlobal::locale()->calendar()->addYears( table->getDate(), -1 );
setDate( temp );
}
void KDatePicker::selectWeekClicked() {} // ### in 3.2 obsolete; kept for binary compatibility
void
KDatePicker::weekSelected(int week)
{
week++; // week number starts with 1
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
QDate date = table->getDate();
int year = calendar->year(date);
calendar->setYMD(date, year, 1, 1);
date = calendar->addDays(date, -7);
while (calendar->weekNumber(date) != 1)
date = calendar->addDays(date, 1);
// date is now first day in week 1 some day in week 1
date = calendar->addDays(date, (week - calendar->weekNumber(date)) * 7);
setDate(date);
}
void
KDatePicker::selectMonthClicked()
{
// every year can have different month names (in some calendar systems)
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
QDate date = table->getDate();
int i, month, months = calendar->monthsInYear(date);
- QPopupMenu popup(selectMonth);
+ Q3PopupMenu popup(selectMonth);
for (i = 1; i <= months; i++)
popup.insertItem(calendar->monthName(i, calendar->year(date)), i);
popup.setActiveItem(calendar->month(date) - 1);
if ( (month = popup.exec(selectMonth->mapToGlobal(QPoint(0, 0)), calendar->month(date) - 1)) == -1 ) return; // canceled
int day = calendar->day(date);
// ----- construct a valid date in this month:
//date.setYMD(date.year(), month, 1);
//date.setYMD(date.year(), month, QMIN(day, date.daysInMonth()));
calendar->setYMD(date, calendar->year(date), month,
QMIN(day, calendar->daysInMonth(date)));
// ----- set this month
setDate(date);
}
void
KDatePicker::selectYearClicked()
{
const KCalendarSystem * calendar = KGlobal::locale()->calendar();
int year;
KPopupFrame* popup = new KPopupFrame(this);
KDateInternalYearSelector* picker = new KDateInternalYearSelector(popup);
// -----
picker->resize(picker->sizeHint());
popup->setMainWidget(picker);
connect(picker, SIGNAL(closeMe(int)), popup, SLOT(close(int)));
picker->setFocus();
if(popup->exec(selectYear->mapToGlobal(QPoint(0, selectMonth->height()))))
{
QDate date;
int day;
// -----
year=picker->getYear();
date=table->getDate();
day=calendar->day(date);
// ----- construct a valid date in this month:
//date.setYMD(year, date.month(), 1);
//date.setYMD(year, date.month(), QMIN(day, date.daysInMonth()));
calendar->setYMD(date, year, calendar->month(date),
QMIN(day, calendar->daysInMonth(date)));
// ----- set this month
setDate(date);
} else {
KNotifyClient::beep();
}
delete popup;
}
void
KDatePicker::setEnabled(bool enable)
{
QWidget *widgets[]= {
yearForward, yearBackward, monthForward, monthBackward,
selectMonth, selectYear,
line, table, d->selectWeek, d->todayButton };
const int Size=sizeof(widgets)/sizeof(widgets[0]);
int count;
// -----
for(count=0; count<Size; ++count)
{