summaryrefslogtreecommitdiffstats
path: root/kalarm/lib/datetime.h
diff options
context:
space:
mode:
Diffstat (limited to 'kalarm/lib/datetime.h')
-rw-r--r--kalarm/lib/datetime.h56
1 files changed, 28 insertions, 28 deletions
diff --git a/kalarm/lib/datetime.h b/kalarm/lib/datetime.h
index 3b0831918..eb40d6b5c 100644
--- a/kalarm/lib/datetime.h
+++ b/kalarm/lib/datetime.h
@@ -20,15 +20,15 @@
#ifndef DATETIME_H
#define DATETIME_H
-#include <qdatetime.h>
+#include <tqdatetime.h>
/**
- * @short A QDateTime with date-only option.
+ * @short A TQDateTime with date-only option.
*
* The DateTime class holds a date, with or without a time.
*
- * DateTime is very similar to the QDateTime class, with the additional option to
+ * DateTime is very similar to the TQDateTime class, with the additional option to
* hold a date-only value. This allows a single date-time representation to be used
* for both an event having a specific date and time, and an all-day event.
*
@@ -44,17 +44,17 @@ class DateTime
*/
DateTime() : mDateOnly(false), mTimeValid(false) { }
/** Constructor for a date-only value. */
- DateTime(const QDate& d) : mDateTime(d), mDateOnly(true) { }
+ DateTime(const TQDate& d) : mDateTime(d), mDateOnly(true) { }
/** Constructor for a date-time value. */
- DateTime(const QDate& d, const QTime& t)
+ DateTime(const TQDate& d, const TQTime& t)
: mDateTime(d, t), mDateOnly(false), mTimeValid(true) { }
/** Constructor for a date-time or date-only value.
* @param dt the date and time to use.
* @param dateOnly True to construct a date-only value; false to construct a date-time value.
*/
- DateTime(const QDateTime& dt, bool dateOnly = false)
+ DateTime(const TQDateTime& dt, bool dateOnly = false)
: mDateTime(dt), mDateOnly(dateOnly), mTimeValid(true)
- { if (dateOnly) mDateTime.setTime(QTime()); }
+ { if (dateOnly) mDateTime.setTime(TQTime()); }
/** Assignment operator.
* Sets the value to a specified date-time or date-only value.
*/
@@ -63,13 +63,13 @@ class DateTime
/** Assignment operator.
* Sets the value to a specified date-time.
*/
- DateTime& operator=(const QDateTime& dt)
+ DateTime& operator=(const TQDateTime& dt)
{ mDateTime = dt; mDateOnly = false; mTimeValid = true; return *this; }
/** Assignment operator.
* Sets the value to a specified date-only value.
*/
- DateTime& operator=(const QDate& d)
- { mDateTime.setDate(d); mDateTime.setTime(QTime()); mDateOnly = true; return *this; }
+ DateTime& operator=(const TQDate& d)
+ { mDateTime.setDate(d); mDateTime.setTime(TQTime()); mDateOnly = true; return *this; }
/** Returns true if the date is null and, if it is a date-time value, the time is also null. */
bool isNull() const { return mDateTime.date().isNull() && (mDateOnly || mDateTime.time().isNull()); }
/** Returns true if the date is valid and, if it is a date-time value, the time is also valid. */
@@ -79,44 +79,44 @@ class DateTime
/** Sets the value to be either date-only or date-time.
* @param d True to set the value to be date-only; false to set it to a date-time value.
*/
- void setDateOnly(bool d) { if (d) mDateTime.setTime(QTime());
+ void setDateOnly(bool d) { if (d) mDateTime.setTime(TQTime());
else if (mDateOnly) mTimeValid = false;
mDateOnly = d;
}
/** Returns the date part of the value. */
- QDate date() const { return mDateTime.date(); }
+ TQDate date() const { return mDateTime.date(); }
/** Returns the time part of the value.
* If the value is date-only, the time returned is the start-of-day time set by setStartOfDay().
*/
- QTime time() const;
+ TQTime time() const;
/** Returns the date and time of the value.
* If the value is date-only, the time part returned is equal to the start-of-day time set
* by setStartOfDay().
*/
- QDateTime dateTime() const;
+ TQDateTime dateTime() const;
/** Returns the date and time of the value.
* if the value is date-only, the time part returned is 00:00:00.
*/
- QDateTime rawDateTime() const { return mDateTime; }
+ TQDateTime rawDateTime() const { return mDateTime; }
/** Sets a date-time or date-only value.
* @param dt the date-time to use.
* @param dateOnly True to set a date-only value; false to set a date-time value.
*/
- void set(const QDateTime& dt, bool dateOnly = false)
+ void set(const TQDateTime& dt, bool dateOnly = false)
{
mDateTime = dt;
mDateOnly = dateOnly;
if (dateOnly)
- mDateTime.setTime(QTime());
+ mDateTime.setTime(TQTime());
mTimeValid = true;
}
/** Sets a date-time value. */
- void set(const QDate& d, const QTime& t)
+ void set(const TQDate& d, const TQTime& t)
{ mDateTime.setDate(d); mDateTime.setTime(t); mDateOnly = false; mTimeValid = true; }
/** Sets the time component of the value.
* The value is converted if necessary to be a date-time value.
*/
- void setTime(const QTime& t) { mDateTime.setTime(t); mDateOnly = false; mTimeValid = true; }
+ void setTime(const TQTime& t) { mDateTime.setTime(t); mDateOnly = false; mTimeValid = true; }
/** Sets the value to a specified date-time value.
* @param secs The time_t date-time value, expressed as the number of seconds elapsed
* since 1970-01-01 00:00:00 UTC.
@@ -169,46 +169,46 @@ class DateTime
* If it is a date-time, both time and date are included in the output.
* If it is date-only, only the date is included in the output.
*/
- QString toString(Qt::DateFormat f = Qt::TextDate) const
+ TQString toString(Qt::DateFormat f = Qt::TextDate) const
{
if (mDateOnly)
return mDateTime.date().toString(f);
else if (mTimeValid)
return mDateTime.toString(f);
else
- return QString::null;
+ return TQString::null;
}
/** Returns the value as a string.
* If it is a date-time, both time and date are included in the output.
* If it is date-only, only the date is included in the output.
*/
- QString toString(const QString& format) const
+ TQString toString(const TQString& format) const
{
if (mDateOnly)
return mDateTime.date().toString(format);
else if (mTimeValid)
return mDateTime.toString(format);
else
- return QString::null;
+ return TQString::null;
}
/** Returns the value as a string, formatted according to the user's locale.
* If it is a date-time, both time and date are included in the output.
* If it is date-only, only the date is included in the output.
*/
- QString formatLocale(bool shortFormat = true) const;
+ TQString formatLocale(bool shortFormat = true) const;
/** Sets the start-of-day time.
* The default value is midnight (0000 hrs).
*/
- static void setStartOfDay(const QTime& sod) { mStartOfDay = sod; }
+ static void setStartOfDay(const TQTime& sod) { mStartOfDay = sod; }
/** Returns the start-of-day time. */
- static QTime startOfDay() { return mStartOfDay; }
+ static TQTime startOfDay() { return mStartOfDay; }
friend bool operator==(const DateTime& dt1, const DateTime& dt2);
friend bool operator<(const DateTime& dt1, const DateTime& dt2);
private:
- static QTime mStartOfDay;
- QDateTime mDateTime;
+ static TQTime mStartOfDay;
+ TQDateTime mDateTime;
bool mDateOnly;
bool mTimeValid; // whether the time is potentially valid - applicable only if mDateOnly false
};