/****************************************************************************** * Called every minute to update the alarm time data entry fields. * If the maximum date/time has been reached, a 'pastMax()' signal is emitted. */ void AlarmTimeWidget::updateTimes() { KDateTime now; if (mMinDateTimeIsNow) { // Make sure that the minimum date is updated when the day changes now = KDateTime::currentDateTime(mTimeSpec); mDateEdit->setMinDate(now.date()); } if (mMaxDateTime.isValid()) { if (!now.isValid()) now = KDateTime::currentDateTime(mTimeSpec); if (!mPastMax) { // Check whether the maximum date/time has now been reached if (now.date() >= mMaxDateTime.date()) { // The current date has reached or has passed the maximum date if (now.date() > mMaxDateTime.date() || (!mAnyTime && now.time() > mTimeEdit->maxTime())) { mPastMax = true; emit pastMax(); } else if (mMinDateTimeIsNow && !mMinMaxTimeSet) { // The minimum date/time tracks the clock, so set the minimum // and maximum times setMaxMinTimeIf(now); } } } setMaxDelayTime(now); } if (mAtTimeRadio->isChecked()) dateTimeChanged(); else delayTimeChanged(mDelayTimeEdit->value()); }
DeferAlarmDlg::DeferAlarmDlg(const QString &caption, const DateTime &initialDT, bool cancelButton, QWidget *parent, const char *name) : KDialogBase(parent, name, true, caption, Ok | Cancel | User1, Ok, false, i18n("Cancel &Deferral")) { if(!cancelButton) showButton(User1, false); QWidget *page = new QWidget(this); setMainWidget(page); QVBoxLayout *layout = new QVBoxLayout(page, 0, spacingHint()); mTimeWidget = new AlarmTimeWidget(AlarmTimeWidget::DEFER_TIME, page, "timeGroup"); mTimeWidget->setDateTime(initialDT); mTimeWidget->setMinDateTimeIsCurrent(); connect(mTimeWidget, SIGNAL(pastMax()), SLOT(slotPastLimit())); layout->addWidget(mTimeWidget); layout->addSpacing(spacingHint()); setButtonWhatsThis(Ok, i18n("Defer the alarm until the specified time.")); setButtonWhatsThis(User1, i18n("Cancel the deferred alarm. This does not affect future recurrences.")); }