24 #include <tqwhatsthis.h>
26 #include <tdeglobal.h>
27 #include <tdelocale.h>
31 #include "preferences.h"
33 #include "timeselector.h"
34 #include "reminder.moc"
39 TQString Reminder::i18n_first_recurrence_only() {
return i18n(
"Reminder for first recurrence only"); }
40 TQString Reminder::i18n_u_first_recurrence_only() {
return i18n(
"Reminder for first rec&urrence only"); }
43 Reminder::Reminder(
const TQString& caption,
const TQString& reminderWhatsThis,
const TQString& valueWhatsThis,
44 bool allowHourMinute,
bool showOnceOnly, TQWidget* parent,
const char* name)
45 : TQFrame(parent, name),
47 mOnceOnlyEnabled(showOnceOnly)
49 setFrameStyle(TQFrame::NoFrame);
50 TQVBoxLayout* topLayout =
new TQVBoxLayout(
this, 0, KDialog::spacingHint());
52 mTime =
new TimeSelector(caption, i18n(
"in advance"), reminderWhatsThis,
53 valueWhatsThis, allowHourMinute,
this,
"timeOption");
54 mTime->setFixedSize(mTime->sizeHint());
55 connect(mTime, TQ_SIGNAL(toggled(
bool)), TQ_SLOT(slotReminderToggled(
bool)));
56 topLayout->addWidget(mTime);
60 TQBoxLayout* layout =
new TQHBoxLayout(topLayout, KDialog::spacingHint());
61 layout->addSpacing(3*KDialog::spacingHint());
62 mOnceOnly =
new CheckBox(i18n_u_first_recurrence_only(),
this);
63 mOnceOnly->setFixedSize(mOnceOnly->sizeHint());
64 TQWhatsThis::add(mOnceOnly, i18n(
"Display the reminder only before the first time the alarm is scheduled"));
65 layout->addWidget(mOnceOnly);
75 void Reminder::setReadOnly(
bool ro)
77 if ((
int)ro != (
int)mReadOnly)
80 mTime->setReadOnly(mReadOnly);
82 mOnceOnly->setReadOnly(mReadOnly);
86 bool Reminder::isReminder()
const
88 return mTime->isChecked();
91 bool Reminder::isOnceOnly()
const
93 return mOnceOnly && mOnceOnly->isEnabled() && mOnceOnly->isChecked();
96 void Reminder::setOnceOnly(
bool onceOnly)
99 mOnceOnly->setChecked(onceOnly);
105 void Reminder::enableOnceOnly(
bool enable)
109 mOnceOnlyEnabled = enable;
110 mOnceOnly->setEnabled(enable && mTime->isChecked());
114 void Reminder::setMaximum(
int hourmin,
int days)
116 mTime->setMaximum(hourmin, days);
123 int Reminder::minutes()
const
125 return mTime->minutes();
131 void Reminder::setMinutes(
int minutes,
bool dateOnly)
133 mTime->setMinutes(minutes, dateOnly, Preferences::defaultReminderUnits());
139 void Reminder::setDateOnly(
bool dateOnly)
141 mTime->setDateOnly(dateOnly);
147 void Reminder::setFocusOnCount()
149 mTime->setFocusOnCount();
155 void Reminder::slotReminderToggled(
bool on)
158 mOnceOnly->setEnabled(on && mOnceOnlyEnabled);