diff options
Diffstat (limited to 'kalarm/lib/timespinbox.cpp')
-rw-r--r-- | kalarm/lib/timespinbox.cpp | 88 |
1 files changed, 44 insertions, 44 deletions
diff --git a/kalarm/lib/timespinbox.cpp b/kalarm/lib/timespinbox.cpp index 7a22cd230..20073d878 100644 --- a/kalarm/lib/timespinbox.cpp +++ b/kalarm/lib/timespinbox.cpp @@ -20,8 +20,8 @@ #include "kalarm.h" -#include <qvalidator.h> -#include <qlineedit.h> +#include <tqvalidator.h> +#include <tqlineedit.h> #include <klocale.h> #include "timespinbox.moc" @@ -30,10 +30,10 @@ class TimeSpinBox::TimeValidator : public QValidator { public: - TimeValidator(int minMin, int maxMin, QWidget* parent, const char* name = 0) - : QValidator(parent, name), + TimeValidator(int minMin, int maxMin, TQWidget* parent, const char* name = 0) + : TQValidator(parent, name), minMinute(minMin), maxMinute(maxMin), m12Hour(false), mPm(false) { } - virtual State validate(QString&, int&) const; + virtual State validate(TQString&, int&) const; int minMinute, maxMinute; bool m12Hour; bool mPm; @@ -54,7 +54,7 @@ class TimeSpinBox::TimeValidator : public QValidator /****************************************************************************** * Construct a wrapping 00:00 - 23:59, or 12:00 - 11:59 time spin box. */ -TimeSpinBox::TimeSpinBox(bool use24hour, QWidget* parent, const char* name) +TimeSpinBox::TimeSpinBox(bool use24hour, TQWidget* parent, const char* name) : SpinBox2(0, 1439, 1, 60, parent, name), mMinimumValue(0), m12Hour(!use24hour), @@ -70,13 +70,13 @@ TimeSpinBox::TimeSpinBox(bool use24hour, QWidget* parent, const char* name) setShiftSteps(5, 360); // shift-left button increments 5 min / 6 hours setSelectOnStep(false); setAlignment(Qt::AlignHCenter); - connect(this, SIGNAL(valueChanged(int)), SLOT(slotValueChanged(int))); + connect(this, TQT_SIGNAL(valueChanged(int)), TQT_SLOT(slotValueChanged(int))); } /****************************************************************************** * Construct a non-wrapping time spin box. */ -TimeSpinBox::TimeSpinBox(int minMinute, int maxMinute, QWidget* parent, const char* name) +TimeSpinBox::TimeSpinBox(int minMinute, int maxMinute, TQWidget* parent, const char* name) : SpinBox2(minMinute, maxMinute, 1, 60, parent, name), mMinimumValue(minMinute), m12Hour(false), @@ -88,20 +88,20 @@ TimeSpinBox::TimeSpinBox(int minMinute, int maxMinute, QWidget* parent, const ch setReverseWithLayout(false); // keep buttons the same way round even if right-to-left language setShiftSteps(5, 300); // shift-left button increments 5 min / 5 hours setSelectOnStep(false); - setAlignment(QApplication::reverseLayout() ? Qt::AlignLeft : Qt::AlignRight); + setAlignment(TQApplication::reverseLayout() ? Qt::AlignLeft : Qt::AlignRight); } -QString TimeSpinBox::shiftWhatsThis() +TQString TimeSpinBox::shiftWhatsThis() { return i18n("Press the Shift key while clicking the spin buttons to adjust the time by a larger step (6 hours / 5 minutes)."); } -QTime TimeSpinBox::time() const +TQTime TimeSpinBox::time() const { - return QTime(value() / 60, value() % 60); + return TQTime(value() / 60, value() % 60); } -QString TimeSpinBox::mapValueToText(int v) +TQString TimeSpinBox::mapValueToText(int v) { if (m12Hour) { @@ -110,7 +110,7 @@ QString TimeSpinBox::mapValueToText(int v) else if (v >= 780) v -= 720; // convert 13 - 23 hours to 1 - 11 } - QString s; + TQString s; s.sprintf((wrapping() ? "%02d:%02d" : "%d:%02d"), v/60, v%60); return s; } @@ -123,13 +123,13 @@ QString TimeSpinBox::mapValueToText(int v) */ int TimeSpinBox::mapTextToValue(bool* ok) { - QString text = cleanText(); + TQString text = cleanText(); int colon = text.find(':'); if (colon >= 0) { // [h]:m format for any time value - QString hour = text.left(colon).stripWhiteSpace(); - QString minute = text.mid(colon + 1).stripWhiteSpace(); + TQString hour = text.left(colon).stripWhiteSpace(); + TQString minute = text.mid(colon + 1).stripWhiteSpace(); if (!minute.isEmpty()) { bool okmin; @@ -204,14 +204,14 @@ void TimeSpinBox::setValid(bool valid) mInvalid = false; if (value() < mMinimumValue) SpinBox2::setValue(mMinimumValue); - setSpecialValueText(QString()); + setSpecialValueText(TQString()); SpinBox2::setMinValue(mMinimumValue); } else if (!valid && !mInvalid) { mInvalid = true; SpinBox2::setMinValue(mMinimumValue - 1); - setSpecialValueText(QString::fromLatin1("**:**")); + setSpecialValueText(TQString::fromLatin1("**:**")); SpinBox2::setValue(mMinimumValue - 1); } } @@ -241,7 +241,7 @@ void TimeSpinBox::setValue(int minutes) if (mInvalid) { mInvalid = false; - setSpecialValueText(QString()); + setSpecialValueText(TQString()); SpinBox2::setMinValue(mMinimumValue); } SpinBox2::setValue(minutes); @@ -280,18 +280,18 @@ void TimeSpinBox::slotValueChanged(int value) mPm = mValidator->mPm = (value >= 720); } -QSize TimeSpinBox::sizeHint() const +TQSize TimeSpinBox::sizeHint() const { - QSize sz = SpinBox2::sizeHint(); - QFontMetrics fm(font()); - return QSize(sz.width() + fm.width(":"), sz.height()); + TQSize sz = SpinBox2::sizeHint(); + TQFontMetrics fm(font()); + return TQSize(sz.width() + fm.width(":"), sz.height()); } -QSize TimeSpinBox::minimumSizeHint() const +TQSize TimeSpinBox::minimumSizeHint() const { - QSize sz = SpinBox2::minimumSizeHint(); - QFontMetrics fm(font()); - return QSize(sz.width() + fm.width(":"), sz.height()); + TQSize sz = SpinBox2::minimumSizeHint(); + TQFontMetrics fm(font()); + return TQSize(sz.width() + fm.width(":"), sz.height()); } /****************************************************************************** @@ -299,24 +299,24 @@ QSize TimeSpinBox::minimumSizeHint() const * The entered time must either be 4 digits, or it must contain a colon, but * hours may be blank. */ -QValidator::State TimeSpinBox::TimeValidator::validate(QString& text, int& /*cursorPos*/) const +TQValidator::State TimeSpinBox::TimeValidator::validate(TQString& text, int& /*cursorPos*/) const { - QString cleanText = text.stripWhiteSpace(); + TQString cleanText = text.stripWhiteSpace(); if (cleanText.isEmpty()) - return QValidator::Intermediate; - QValidator::State state = QValidator::Acceptable; - QString hour; + return TQValidator::Intermediate; + TQValidator::State state = TQValidator::Acceptable; + TQString hour; bool ok; int hr = 0; int mn = 0; int colon = cleanText.find(':'); if (colon >= 0) { - QString minute = cleanText.mid(colon + 1); + TQString minute = cleanText.mid(colon + 1); if (minute.isEmpty()) - state = QValidator::Intermediate; + state = TQValidator::Intermediate; else if ((mn = minute.toUInt(&ok)) >= 60 || !ok) - return QValidator::Invalid; + return TQValidator::Invalid; hour = cleanText.left(colon); } @@ -324,19 +324,19 @@ QValidator::State TimeSpinBox::TimeValidator::validate(QString& text, int& /*cur { // The hhmm form of entry is only allowed for time-of-day, i.e. <= 2359 hour = cleanText; - state = QValidator::Intermediate; + state = TQValidator::Intermediate; } else { if (cleanText.length() > 4) - return QValidator::Invalid; + return TQValidator::Invalid; if (cleanText.length() < 4) - state = QValidator::Intermediate; + state = TQValidator::Intermediate; hour = cleanText.left(2); - QString minute = cleanText.mid(2); + TQString minute = cleanText.mid(2); if (!minute.isEmpty() && ((mn = minute.toUInt(&ok)) >= 60 || !ok)) - return QValidator::Invalid; + return TQValidator::Invalid; } if (!hour.isEmpty()) @@ -352,13 +352,13 @@ QValidator::State TimeSpinBox::TimeValidator::validate(QString& text, int& /*cur hr += 12; // convert to PM } if (!ok || hr > maxMinute/60) - return QValidator::Invalid; + return TQValidator::Invalid; } - if (state == QValidator::Acceptable) + if (state == TQValidator::Acceptable) { int t = hr * 60 + mn; if (t < minMinute || t > maxMinute) - return QValidator::Invalid; + return TQValidator::Invalid; } return state; } |