summaryrefslogtreecommitdiffabout
path: root/microkde/kdatepickernew.cpp
authorMichael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
committer Michael Krelin <hacker@klever.net>2007-07-04 11:23:42 (UTC)
commita08aff328d4393031d5ba7d622c2b05705a89d73 (patch) (side-by-side diff)
tree8ee90d686081c52e7c69b5ce946e9b1a7d690001 /microkde/kdatepickernew.cpp
parent11edc920afe4f274c0964436633aa632c8288a40 (diff)
downloadkdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.zip
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.gz
kdepimpi-a08aff328d4393031d5ba7d622c2b05705a89d73.tar.bz2
initial public commit of qt4 portp1
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
@@ -268,97 +268,97 @@ 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();