diff options
Diffstat (limited to 'kalarm/alarmtimewidget.cpp')
-rw-r--r-- | kalarm/alarmtimewidget.cpp | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/kalarm/alarmtimewidget.cpp b/kalarm/alarmtimewidget.cpp index 1e7e777b0..5c3316bce 100644 --- a/kalarm/alarmtimewidget.cpp +++ b/kalarm/alarmtimewidget.cpp @@ -20,11 +20,11 @@ #include "kalarm.h" -#include <qlayout.h> -#include <qgroupbox.h> -#include <qhbox.h> -#include <qpushbutton.h> -#include <qwhatsthis.h> +#include <tqlayout.h> +#include <tqgroupbox.h> +#include <tqhbox.h> +#include <tqpushbutton.h> +#include <tqwhatsthis.h> #include <kdialog.h> #include <kmessagebox.h> @@ -39,13 +39,13 @@ #include "timespinbox.h" #include "alarmtimewidget.moc" -static const QTime time_23_59(23, 59); +static const TQTime time_23_59(23, 59); const int AlarmTimeWidget::maxDelayTime = 999*60 + 59; // < 1000 hours -QString AlarmTimeWidget::i18n_w_TimeFromNow() { return i18n("Time from no&w:"); } -QString AlarmTimeWidget::i18n_TimeAfterPeriod() +TQString AlarmTimeWidget::i18n_w_TimeFromNow() { return i18n("Time from no&w:"); } +TQString AlarmTimeWidget::i18n_TimeAfterPeriod() { return i18n("Enter the length of time (in hours and minutes) after " "the current time to schedule the alarm."); @@ -55,7 +55,7 @@ QString AlarmTimeWidget::i18n_TimeAfterPeriod() /****************************************************************************** * Construct a widget with a group box and title. */ -AlarmTimeWidget::AlarmTimeWidget(const QString& groupBoxTitle, int mode, QWidget* parent, const char* name) +AlarmTimeWidget::AlarmTimeWidget(const TQString& groupBoxTitle, int mode, TQWidget* parent, const char* name) : ButtonGroup(groupBoxTitle, parent, name), mMinDateTimeIsNow(false), mPastMax(false), @@ -67,24 +67,24 @@ AlarmTimeWidget::AlarmTimeWidget(const QString& groupBoxTitle, int mode, QWidget /****************************************************************************** * Construct a widget without a group box or title. */ -AlarmTimeWidget::AlarmTimeWidget(int mode, QWidget* parent, const char* name) +AlarmTimeWidget::AlarmTimeWidget(int mode, TQWidget* parent, const char* name) : ButtonGroup(parent, name), mMinDateTimeIsNow(false), mPastMax(false), mMinMaxTimeSet(false) { - setFrameStyle(QFrame::NoFrame); + setFrameStyle(TQFrame::NoFrame); init(mode); } void AlarmTimeWidget::init(int mode) { - static const QString recurText = i18n("For a simple repetition, enter the date/time of the first occurrence.\n" + static const TQString recurText = i18n("For a simple repetition, enter the date/time of the first occurrence.\n" "If a recurrence is configured, the start date/time will be adjusted " "to the first recurrence on or after the entered date/time."); - connect(this, SIGNAL(buttonSet(int)), SLOT(slotButtonSet(int))); - QBoxLayout* topLayout = new QVBoxLayout(this, 0, KDialog::spacingHint()); + connect(this, TQT_SIGNAL(buttonSet(int)), TQT_SLOT(slotButtonSet(int))); + TQBoxLayout* topLayout = new TQVBoxLayout(this, 0, KDialog::spacingHint()); if (!title().isEmpty()) { topLayout->setMargin(KDialog::marginHint()); @@ -94,29 +94,29 @@ void AlarmTimeWidget::init(int mode) // At time radio button/label mAtTimeRadio = new RadioButton(((mode & DEFER_TIME) ? i18n("&Defer to date/time:") : i18n("At &date/time:")), this, "atTimeRadio"); mAtTimeRadio->setFixedSize(mAtTimeRadio->sizeHint()); - QWhatsThis::add(mAtTimeRadio, + TQWhatsThis::add(mAtTimeRadio, ((mode & DEFER_TIME) ? i18n("Reschedule the alarm to the specified date and time.") : i18n("Schedule the alarm at the specified date and time."))); // Date edit box mDateEdit = new DateEdit(this); mDateEdit->setFixedSize(mDateEdit->sizeHint()); - connect(mDateEdit, SIGNAL(dateEntered(const QDate&)), SLOT(dateTimeChanged())); - static const QString enterDateText = i18n("Enter the date to schedule the alarm."); - QWhatsThis::add(mDateEdit, ((mode & DEFER_TIME) ? enterDateText - : QString("%1\n%2").arg(enterDateText).arg(recurText))); + connect(mDateEdit, TQT_SIGNAL(dateEntered(const TQDate&)), TQT_SLOT(dateTimeChanged())); + static const TQString enterDateText = i18n("Enter the date to schedule the alarm."); + TQWhatsThis::add(mDateEdit, ((mode & DEFER_TIME) ? enterDateText + : TQString("%1\n%2").arg(enterDateText).arg(recurText))); mAtTimeRadio->setFocusWidget(mDateEdit); // Time edit box and Any time checkbox - QHBox* timeBox = new QHBox(this); + TQHBox* timeBox = new TQHBox(this); timeBox->setSpacing(2*KDialog::spacingHint()); mTimeEdit = new TimeEdit(timeBox); mTimeEdit->setFixedSize(mTimeEdit->sizeHint()); - connect(mTimeEdit, SIGNAL(valueChanged(int)), SLOT(dateTimeChanged())); - static const QString enterTimeText = i18n("Enter the time to schedule the alarm."); - QWhatsThis::add(mTimeEdit, - ((mode & DEFER_TIME) ? QString("%1\n\n%2").arg(enterTimeText).arg(TimeSpinBox::shiftWhatsThis()) - : QString("%1\n%2\n\n%3").arg(enterTimeText).arg(recurText).arg(TimeSpinBox::shiftWhatsThis()))); + connect(mTimeEdit, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(dateTimeChanged())); + static const TQString enterTimeText = i18n("Enter the time to schedule the alarm."); + TQWhatsThis::add(mTimeEdit, + ((mode & DEFER_TIME) ? TQString("%1\n\n%2").arg(enterTimeText).arg(TimeSpinBox::shiftWhatsThis()) + : TQString("%1\n%2\n\n%3").arg(enterTimeText).arg(recurText).arg(TimeSpinBox::shiftWhatsThis()))); mAnyTime = -1; // current status is uninitialised if (mode & DEFER_TIME) @@ -129,15 +129,15 @@ void AlarmTimeWidget::init(int mode) mAnyTimeAllowed = true; mAnyTimeCheckBox = new CheckBox(i18n("An&y time"), timeBox); mAnyTimeCheckBox->setFixedSize(mAnyTimeCheckBox->sizeHint()); - connect(mAnyTimeCheckBox, SIGNAL(toggled(bool)), SLOT(slotAnyTimeToggled(bool))); - QWhatsThis::add(mAnyTimeCheckBox, i18n("Schedule the alarm for any time during the day")); + connect(mAnyTimeCheckBox, TQT_SIGNAL(toggled(bool)), TQT_SLOT(slotAnyTimeToggled(bool))); + TQWhatsThis::add(mAnyTimeCheckBox, i18n("Schedule the alarm for any time during the day")); } // 'Time from now' radio button/label mAfterTimeRadio = new RadioButton(((mode & DEFER_TIME) ? i18n("Defer for time &interval:") : i18n_w_TimeFromNow()), this, "afterTimeRadio"); mAfterTimeRadio->setFixedSize(mAfterTimeRadio->sizeHint()); - QWhatsThis::add(mAfterTimeRadio, + TQWhatsThis::add(mAfterTimeRadio, ((mode & DEFER_TIME) ? i18n("Reschedule the alarm for the specified time interval after now.") : i18n("Schedule the alarm after the specified time interval from now."))); @@ -145,29 +145,29 @@ void AlarmTimeWidget::init(int mode) mDelayTimeEdit = new TimeSpinBox(1, maxDelayTime, this); mDelayTimeEdit->setValue(maxDelayTime); mDelayTimeEdit->setFixedSize(mDelayTimeEdit->sizeHint()); - connect(mDelayTimeEdit, SIGNAL(valueChanged(int)), SLOT(delayTimeChanged(int))); - QWhatsThis::add(mDelayTimeEdit, - ((mode & DEFER_TIME) ? QString("%1\n\n%2").arg(i18n_TimeAfterPeriod()).arg(TimeSpinBox::shiftWhatsThis()) - : QString("%1\n%2\n\n%3").arg(i18n_TimeAfterPeriod()).arg(recurText).arg(TimeSpinBox::shiftWhatsThis()))); + connect(mDelayTimeEdit, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(delayTimeChanged(int))); + TQWhatsThis::add(mDelayTimeEdit, + ((mode & DEFER_TIME) ? TQString("%1\n\n%2").arg(i18n_TimeAfterPeriod()).arg(TimeSpinBox::shiftWhatsThis()) + : TQString("%1\n%2\n\n%3").arg(i18n_TimeAfterPeriod()).arg(recurText).arg(TimeSpinBox::shiftWhatsThis()))); mAfterTimeRadio->setFocusWidget(mDelayTimeEdit); // Set up the layout, either narrow or wide if (mode & NARROW) { - QGridLayout* grid = new QGridLayout(topLayout, 2, 2, KDialog::spacingHint()); + TQGridLayout* grid = new TQGridLayout(topLayout, 2, 2, KDialog::spacingHint()); grid->addWidget(mAtTimeRadio, 0, 0); grid->addWidget(mDateEdit, 0, 1, Qt::AlignAuto); grid->addWidget(timeBox, 1, 1, Qt::AlignAuto); grid->setColStretch(2, 1); topLayout->addStretch(); - QBoxLayout* layout = new QHBoxLayout(topLayout, KDialog::spacingHint()); + TQBoxLayout* layout = new TQHBoxLayout(topLayout, KDialog::spacingHint()); layout->addWidget(mAfterTimeRadio); layout->addWidget(mDelayTimeEdit); layout->addStretch(); } else { - QGridLayout* grid = new QGridLayout(topLayout, 2, 3, KDialog::spacingHint()); + TQGridLayout* grid = new TQGridLayout(topLayout, 2, 3, KDialog::spacingHint()); grid->addWidget(mAtTimeRadio, 0, 0, Qt::AlignAuto); grid->addWidget(mDateEdit, 0, 1, Qt::AlignAuto); grid->addWidget(timeBox, 0, 2, Qt::AlignAuto); @@ -182,7 +182,7 @@ void AlarmTimeWidget::init(int mode) setButton(id(mAtTimeRadio)); // Timeout every minute to update alarm time fields. - MinuteTimer::connect(this, SLOT(slotTimer())); + MinuteTimer::connect(this, TQT_SLOT(slotTimer())); } /****************************************************************************** @@ -219,14 +219,14 @@ void AlarmTimeWidget::selectTimeFromNow(int minutes) * 'errorWidget' if non-null, is set to point to the widget containing the error. * Reply = invalid date/time if error. */ -DateTime AlarmTimeWidget::getDateTime(int* minsFromNow, bool checkExpired, bool showErrorMessage, QWidget** errorWidget) const +DateTime AlarmTimeWidget::getDateTime(int* minsFromNow, bool checkExpired, bool showErrorMessage, TQWidget** errorWidget) const { if (minsFromNow) *minsFromNow = 0; if (errorWidget) *errorWidget = 0; - QTime nowt = QTime::currentTime(); - QDateTime now(QDate::currentDate(), QTime(nowt.hour(), nowt.minute())); + TQTime nowt = TQTime::currentTime(); + TQDateTime now(TQDate::currentDate(), TQTime(nowt.hour(), nowt.minute())); if (mAtTimeRadio->isOn()) { bool anyTime = mAnyTimeAllowed && mAnyTimeCheckBox && mAnyTimeCheckBox->isChecked(); @@ -327,8 +327,8 @@ void AlarmTimeWidget::setDateTime(const DateTime& dt) void AlarmTimeWidget::setMinDateTimeIsCurrent() { mMinDateTimeIsNow = true; - mMinDateTime = QDateTime(); - QDateTime now = QDateTime::currentDateTime(); + mMinDateTime = TQDateTime(); + TQDateTime now = TQDateTime::currentDateTime(); mDateEdit->setMinDate(now.date()); setMaxMinTimeIf(now); } @@ -337,12 +337,12 @@ void AlarmTimeWidget::setMinDateTimeIsCurrent() * Set the minimum date/time, adjusting the entered date/time if necessary. * If 'dt' is invalid, any current minimum date/time is cleared. */ -void AlarmTimeWidget::setMinDateTime(const QDateTime& dt) +void AlarmTimeWidget::setMinDateTime(const TQDateTime& dt) { mMinDateTimeIsNow = false; mMinDateTime = dt; mDateEdit->setMinDate(dt.date()); - setMaxMinTimeIf(QDateTime::currentDateTime()); + setMaxMinTimeIf(TQDateTime::currentDateTime()); } /****************************************************************************** @@ -357,7 +357,7 @@ void AlarmTimeWidget::setMaxDateTime(const DateTime& dt) else mMaxDateTime = dt.dateTime(); mDateEdit->setMaxDate(mMaxDateTime.date()); - QDateTime now = QDateTime::currentDateTime(); + TQDateTime now = TQDateTime::currentDateTime(); setMaxMinTimeIf(now); setMaxDelayTime(now); } @@ -366,15 +366,15 @@ void AlarmTimeWidget::setMaxDateTime(const DateTime& dt) * If the minimum and maximum date/times fall on the same date, set the minimum * and maximum times in the time edit box. */ -void AlarmTimeWidget::setMaxMinTimeIf(const QDateTime& now) +void AlarmTimeWidget::setMaxMinTimeIf(const TQDateTime& now) { int mint = 0; - QTime maxt = time_23_59; + TQTime maxt = time_23_59; mMinMaxTimeSet = false; if (mMaxDateTime.isValid()) { bool set = true; - QDateTime minDT; + TQDateTime minDT; if (mMinDateTimeIsNow) minDT = now.addSecs(60); else if (mMinDateTime.isValid()) @@ -399,14 +399,14 @@ void AlarmTimeWidget::setMaxMinTimeIf(const QDateTime& now) * Set the maximum value for the delay time edit box, depending on the maximum * value for the date/time. */ -void AlarmTimeWidget::setMaxDelayTime(const QDateTime& now) +void AlarmTimeWidget::setMaxDelayTime(const TQDateTime& now) { int maxVal = maxDelayTime; if (mMaxDateTime.isValid()) { if (now.date().daysTo(mMaxDateTime.date()) < 100) // avoid possible 32-bit overflow on secsTo() { - QDateTime dt(now.date(), QTime(now.time().hour(), now.time().minute(), 0)); // round down to nearest minute + TQDateTime dt(now.date(), TQTime(now.time().hour(), now.time().minute(), 0)); // round down to nearest minute maxVal = dt.secsTo(mMaxDateTime) / 60; if (maxVal > maxDelayTime) maxVal = maxDelayTime; @@ -448,17 +448,17 @@ void AlarmTimeWidget::enableAnyTime(bool enable) */ void AlarmTimeWidget::slotTimer() { - QDateTime now; + TQDateTime now; if (mMinDateTimeIsNow) { // Make sure that the minimum date is updated when the day changes - now = QDateTime::currentDateTime(); + now = TQDateTime::currentDateTime(); mDateEdit->setMinDate(now.date()); } if (mMaxDateTime.isValid()) { if (!now.isValid()) - now = QDateTime::currentDateTime(); + now = TQDateTime::currentDateTime(); if (!mPastMax) { // Check whether the maximum date/time has now been reached @@ -501,8 +501,8 @@ void AlarmTimeWidget::slotButtonSet(int) if (mAnyTimeCheckBox) mAnyTimeCheckBox->setEnabled(at && mAnyTimeAllowed); // Ensure that the value of the delay edit box is > 0. - QDateTime dt(mDateEdit->date(), mTimeEdit->time()); - int minutes = (QDateTime::currentDateTime().secsTo(dt) + 59) / 60; + TQDateTime dt(mDateEdit->date(), mTimeEdit->time()); + int minutes = (TQDateTime::currentDateTime().secsTo(dt) + 59) / 60; if (minutes <= 0) mDelayTimeEdit->setValid(true); mDelayTimeEdit->setEnabled(!at); @@ -524,8 +524,8 @@ void AlarmTimeWidget::slotAnyTimeToggled(bool on) */ void AlarmTimeWidget::dateTimeChanged() { - QDateTime dt(mDateEdit->date(), mTimeEdit->time()); - int minutes = (QDateTime::currentDateTime().secsTo(dt) + 59) / 60; + TQDateTime dt(mDateEdit->date(), mTimeEdit->time()); + int minutes = (TQDateTime::currentDateTime().secsTo(dt) + 59) / 60; bool blocked = mDelayTimeEdit->signalsBlocked(); mDelayTimeEdit->blockSignals(true); // prevent infinite recursion between here and delayTimeChanged() if (minutes <= 0 || minutes > mDelayTimeEdit->maxValue()) @@ -543,7 +543,7 @@ void AlarmTimeWidget::delayTimeChanged(int minutes) { if (mDelayTimeEdit->isValid()) { - QDateTime dt = QDateTime::currentDateTime().addSecs(minutes * 60); + TQDateTime dt = TQDateTime::currentDateTime().addSecs(minutes * 60); bool blockedT = mTimeEdit->signalsBlocked(); bool blockedD = mDateEdit->signalsBlocked(); mTimeEdit->blockSignals(true); // prevent infinite recursion between here and dateTimeChanged() |