diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2011-06-25 05:28:35 +0000 |
commit | f008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch) | |
tree | 8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kplato/kptcalendar.cc | |
parent | 1210f27b660efb7b37ff43ec68763e85a403471f (diff) | |
download | koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.tar.gz koffice-f008adb5a77e094eaf6abf3fc0f36958e66896a5.zip |
TQt4 port koffice
This should enable compilation under both Qt3 and Qt4; fixes for any missed components will be forthcoming
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/applications/koffice@1238284 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kplato/kptcalendar.cc')
-rw-r--r-- | kplato/kptcalendar.cc | 266 |
1 files changed, 133 insertions, 133 deletions
diff --git a/kplato/kptcalendar.cc b/kplato/kptcalendar.cc index 38c2a286..9412f30e 100644 --- a/kplato/kptcalendar.cc +++ b/kplato/kptcalendar.cc @@ -22,8 +22,8 @@ #include "kptdatetime.h" #include "kptproject.h" -#include <qdom.h> -#include <qptrlist.h> +#include <tqdom.h> +#include <tqptrlist.h> #include <klocale.h> #include <kdebug.h> @@ -50,7 +50,7 @@ CalendarDay::CalendarDay(int state) m_workingIntervals.setAutoDelete(true); } -CalendarDay::CalendarDay(QDate date, int state) +CalendarDay::CalendarDay(TQDate date, int state) : m_date(date), m_state(state), m_workingIntervals() { @@ -76,39 +76,39 @@ const CalendarDay &CalendarDay::copy(const CalendarDay &day) { m_date = day.date(); m_state = day.state(); m_workingIntervals.clear(); - QPtrListIterator<QPair<QTime, QTime> > it = day.workingIntervals(); + TQPtrListIterator<TQPair<TQTime, TQTime> > it = day.workingIntervals(); for(; it.current(); ++it) { - m_workingIntervals.append(new QPair<QTime, QTime>(it.current()->first, it.current()->second)); + m_workingIntervals.append(new TQPair<TQTime, TQTime>(it.current()->first, it.current()->second)); } return *this; } -bool CalendarDay::load(QDomElement &element) { +bool CalendarDay::load(TQDomElement &element) { //kdDebug()<<k_funcinfo<<endl; bool ok=false; - m_state = QString(element.attribute("state", "-1")).toInt(&ok); + m_state = TQString(element.attribute("state", "-1")).toInt(&ok); if (m_state < 0) return false; //kdDebug()<<k_funcinfo<<" state="<<m_state<<endl; - QString s = element.attribute("date"); + TQString s = element.attribute("date"); if (s != "") { - m_date = QDate::fromString(s, Qt::ISODate); + m_date = TQDate::fromString(s, Qt::ISODate); if (!m_date.isValid()) - m_date = QDate::fromString(s); + m_date = TQDate::fromString(s); } clearIntervals(); - QDomNodeList list = element.childNodes(); + TQDomNodeList list = element.childNodes(); for (unsigned int i=0; i<list.count(); ++i) { if (list.item(i).isElement()) { - QDomElement e = list.item(i).toElement(); + TQDomElement e = list.item(i).toElement(); if (e.tagName() == "interval") { //kdDebug()<<k_funcinfo<<"Interval start="<<e.attribute("start")<<" end="<<e.attribute("end")<<endl; - QString st = e.attribute("start"); - QString en = e.attribute("end"); + TQString st = e.attribute("start"); + TQString en = e.attribute("end"); if (st != "" && en != "") { - QTime start = QTime::fromString(st); - QTime end = QTime::fromString(en); - addInterval(new QPair<QTime, QTime>(start,end)); + TQTime start = TQTime::fromString(st); + TQTime end = TQTime::fromString(en); + addInterval(new TQPair<TQTime, TQTime>(start,end)); } } } @@ -116,7 +116,7 @@ bool CalendarDay::load(QDomElement &element) { return true; } -void CalendarDay::save(QDomElement &element) const { +void CalendarDay::save(TQDomElement &element) const { //kdDebug()<<k_funcinfo<<m_date.toString()<<endl; if (m_state == Map::None) return; @@ -127,23 +127,23 @@ void CalendarDay::save(QDomElement &element) const { if (m_workingIntervals.count() == 0) return; - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; for (; it.current(); ++it) { - QDomElement me = element.ownerDocument().createElement("interval"); + TQDomElement me = element.ownerDocument().createElement("interval"); element.appendChild(me); me.setAttribute("end", it.current()->second.toString()); me.setAttribute("start", it.current()->first.toString()); } } -void CalendarDay::addInterval(QPair<QTime, QTime> *interval) { +void CalendarDay::addInterval(TQPair<TQTime, TQTime> *interval) { m_workingIntervals.append(interval); } -QTime CalendarDay::startOfDay() const { - QTime t; +TQTime CalendarDay::startOfDay() const { + TQTime t; if (!m_workingIntervals.isEmpty()) { - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; t = it.current()->first; for (++it; it.current(); ++it) { if (t > it.current()->first) @@ -153,10 +153,10 @@ QTime CalendarDay::startOfDay() const { return t; } -QTime CalendarDay::endOfDay() const { - QTime t; +TQTime CalendarDay::endOfDay() const { + TQTime t; if (!m_workingIntervals.isEmpty()) { - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; t = it.current()->second; for (++it; it.current(); ++it) { if (t > it.current()->second) @@ -188,13 +188,13 @@ bool CalendarDay::operator==(const CalendarDay &day) const { //kdDebug()<<k_funcinfo<<m_workingIntervals.count()<<" != "<<day.workingIntervals().count()<<endl; return false; } - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; - QPtrListIterator<QPair<QTime, QTime> > dit = day.workingIntervals(); + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > dit = day.workingIntervals(); for (; it.current(); ++it) { bool res = false; - QPair<QTime, QTime> *a = it.current(); + TQPair<TQTime, TQTime> *a = it.current(); for (dit.toFirst(); dit.current(); ++dit) { - QPair<QTime, QTime> *b = dit.current(); + TQPair<TQTime, TQTime> *b = dit.current(); if (a->first == b->first && a->second == b->second) { res = true; break; @@ -214,22 +214,22 @@ bool CalendarDay::operator!=(const CalendarDay &day) const { return !operator==(day); } -Duration CalendarDay::effort(const QTime &start, const QTime &end) { +Duration CalendarDay::effort(const TQTime &start, const TQTime &end) { //kdDebug()<<k_funcinfo<<start.toString()<<" - "<<end.toString()<<endl; Duration eff; if (m_state != Map::Working) { //kdDebug()<<k_funcinfo<<"Non working day"<<endl; return eff; } - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; for (; it.current(); ++it) { //kdDebug()<<k_funcinfo<<"Interval: "<<it.current()->first.toString()<<" - "<<it.current()->second.toString()<<endl; if (end > it.current()->first && start < it.current()->second) { - DateTime dtStart(QDate::currentDate(), start); + DateTime dtStart(TQDate::tqcurrentDate(), start); if (start < it.current()->first) { dtStart.setTime(it.current()->first); } - DateTime dtEnd(QDate::currentDate(), end); + DateTime dtEnd(TQDate::tqcurrentDate(), end); if (end > it.current()->second) { dtEnd.setTime(it.current()->second); } @@ -241,34 +241,34 @@ Duration CalendarDay::effort(const QTime &start, const QTime &end) { return eff; } -QPair<QTime, QTime> CalendarDay::interval(const QTime &start, const QTime &end) const { +TQPair<TQTime, TQTime> CalendarDay::interval(const TQTime &start, const TQTime &end) const { //kdDebug()<<k_funcinfo<<endl; - QTime t1, t2; + TQTime t1, t2; if (m_state == Map::Working) { - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; for (; it.current(); ++it) { if (start < it.current()->second && end > it.current()->first) { t1 = start > it.current()->first ? start : it.current()->first; t2 = end < it.current()->second ? end : it.current()->second; //kdDebug()<<k_funcinfo<<t1.toString()<<" to "<<t2.toString()<<endl; - return QPair<QTime, QTime>(t1, t2); + return TQPair<TQTime, TQTime>(t1, t2); } } } //kdError()<<k_funcinfo<<"No interval "<<m_date<<": "<<start<<","<<end<<endl; - return QPair<QTime, QTime>(t1, t2); + return TQPair<TQTime, TQTime>(t1, t2); } bool CalendarDay::hasInterval() const { return m_state == Map::Working && m_workingIntervals.count() > 0; } -bool CalendarDay::hasInterval(const QTime &start, const QTime &end) const { +bool CalendarDay::hasInterval(const TQTime &start, const TQTime &end) const { //kdDebug()<<k_funcinfo<<(m_date.isValid()?m_date.toString(Qt::ISODate):"Weekday")<<" "<<start.toString()<<" - "<<end.toString()<<endl; if (m_state != Map::Working) { return false; } - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; for (; it.current(); ++it) { if (start < it.current()->second && end > it.current()->first) { //kdDebug()<<k_funcinfo<<"true:"<<(m_date.isValid()?m_date.toString(Qt::ISODate):"Weekday")<<" "<<it.current()->first.toString()<<" - "<<it.current()->second.toString()<<endl; @@ -280,10 +280,10 @@ bool CalendarDay::hasInterval(const QTime &start, const QTime &end) const { Duration CalendarDay::duration() const { Duration dur; - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; for (; it.current(); ++it) { - DateTime start(QDate::currentDate(), it.current()->first); - DateTime end(QDate::currentDate(), it.current()->second); + DateTime start(TQDate::tqcurrentDate(), it.current()->first); + DateTime end(TQDate::tqcurrentDate(), it.current()->second); dur += end - start; } return dur; @@ -319,17 +319,17 @@ const CalendarWeekdays &CalendarWeekdays::copy(const CalendarWeekdays &weekdays) m_weekdays.setAutoDelete(true); m_weekdays.clear(); m_weekdays.setAutoDelete(false); - QPtrListIterator<CalendarDay> it = weekdays.weekdays(); + TQPtrListIterator<CalendarDay> it = weekdays.weekdays(); for (; it.current(); ++it) { m_weekdays.append(new CalendarDay(it.current())); } return *this; } -bool CalendarWeekdays::load(QDomElement &element) { +bool CalendarWeekdays::load(TQDomElement &element) { //kdDebug()<<k_funcinfo<<endl; bool ok; - int dayNo = QString(element.attribute("day","-1")).toInt(&ok); + int dayNo = TQString(element.attribute("day","-1")).toInt(&ok); if (dayNo < 0 || dayNo > 6) { kdError()<<k_funcinfo<<"Illegal weekday: "<<dayNo<<endl; return true; // we continue anyway @@ -342,11 +342,11 @@ bool CalendarWeekdays::load(QDomElement &element) { return true; } -void CalendarWeekdays::save(QDomElement &element) const { +void CalendarWeekdays::save(TQDomElement &element) const { //kdDebug()<<k_funcinfo<<endl; - QPtrListIterator<CalendarDay> it = m_weekdays; + TQPtrListIterator<CalendarDay> it = m_weekdays; for (int i=0; it.current(); ++it) { - QDomElement me = element.ownerDocument().createElement("weekday"); + TQDomElement me = element.ownerDocument().createElement("weekday"); element.appendChild(me); me.setAttribute("day", i++); it.current()->save(me); @@ -362,7 +362,7 @@ IntMap CalendarWeekdays::map() { return days; } -int CalendarWeekdays::state(const QDate &date) const { +int CalendarWeekdays::state(const TQDate &date) const { return state(date.dayOfWeek()-1); } @@ -378,13 +378,13 @@ void CalendarWeekdays::setState(int weekday, int state) { day->setState(state); } -const QPtrList<QPair<QTime, QTime> > &CalendarWeekdays::intervals(int weekday) const { +const TQPtrList<TQPair<TQTime, TQTime> > &CalendarWeekdays::intervals(int weekday) const { CalendarDay *day = const_cast<CalendarWeekdays*>(this)->m_weekdays.at(weekday); Q_ASSERT(day); return day->workingIntervals(); } -void CalendarWeekdays::setIntervals(int weekday, QPtrList<QPair<QTime, QTime> >intervals) { +void CalendarWeekdays::setIntervals(int weekday, TQPtrList<TQPair<TQTime, TQTime> >intervals) { CalendarDay *day = m_weekdays.at(weekday); if (day) day->setIntervals(intervals); @@ -402,7 +402,7 @@ bool CalendarWeekdays::operator==(const CalendarWeekdays *wd) const { for (unsigned int i=0; i < m_weekdays.count(); ++i) { // is there a better way to get around this const stuff? CalendarDay *day1 = const_cast<CalendarWeekdays*>(this)->m_weekdays.at(i); - CalendarDay *day2 = const_cast<QPtrList<CalendarDay>&>(wd->weekdays()).at(i); + CalendarDay *day2 = const_cast<TQPtrList<CalendarDay>&>(wd->weekdays()).at(i); if (day1 != day2) return false; } @@ -414,14 +414,14 @@ bool CalendarWeekdays::operator!=(const CalendarWeekdays *wd) const { for (unsigned int i=0; i < m_weekdays.count(); ++i) { // is there a better way to get around this const stuff? CalendarDay *day1 = const_cast<CalendarWeekdays*>(this)->m_weekdays.at(i); - CalendarDay *day2 = const_cast<QPtrList<CalendarDay>&>(wd->weekdays()).at(i); + CalendarDay *day2 = const_cast<TQPtrList<CalendarDay>&>(wd->weekdays()).at(i); if (day1 != day2) return true; } return false; } -Duration CalendarWeekdays::effort(const QDate &date, const QTime &start, const QTime &end) { +Duration CalendarWeekdays::effort(const TQDate &date, const TQTime &start, const TQTime &end) { //kdDebug()<<k_funcinfo<<"Day of week="<<date.dayOfWeek()-1<<endl; CalendarDay *day = weekday(date.dayOfWeek()-1); if (day && day->state() == Map::Working) { @@ -430,7 +430,7 @@ Duration CalendarWeekdays::effort(const QDate &date, const QTime &start, const Q return Duration::zeroDuration; } -QPair<QTime, QTime> CalendarWeekdays::interval(const QDate date, const QTime &start, const QTime &end) const { +TQPair<TQTime, TQTime> CalendarWeekdays::interval(const TQDate date, const TQTime &start, const TQTime &end) const { //kdDebug()<<k_funcinfo<<endl; CalendarDay *day = weekday(date.dayOfWeek()-1); if (day && day->state() == Map::Working) { @@ -438,10 +438,10 @@ QPair<QTime, QTime> CalendarWeekdays::interval(const QDate date, const QTime &st return day->interval(start, end); } } - return QPair<QTime, QTime>(QTime(), QTime()); + return TQPair<TQTime, TQTime>(TQTime(), TQTime()); } -bool CalendarWeekdays::hasInterval(const QDate date, const QTime &start, const QTime &end) const { +bool CalendarWeekdays::hasInterval(const TQDate date, const TQTime &start, const TQTime &end) const { //kdDebug()<<k_funcinfo<<date.toString()<<": "<<start.toString()<<" - "<<end.toString()<<endl; CalendarDay *day = weekday(date.dayOfWeek()-1); return day && day->hasInterval(start, end); @@ -449,7 +449,7 @@ bool CalendarWeekdays::hasInterval(const QDate date, const QTime &start, const Q bool CalendarWeekdays::hasInterval() const { //kdDebug()<<k_funcinfo<<endl; - QPtrListIterator<CalendarDay> it = m_weekdays; + TQPtrListIterator<CalendarDay> it = m_weekdays; for (; it.current(); ++it) { if (it.current()->hasInterval()) return true; @@ -458,7 +458,7 @@ bool CalendarWeekdays::hasInterval() const { } CalendarDay *CalendarWeekdays::weekday(int day) const { - QPtrListIterator<CalendarDay> it = m_weekdays; + TQPtrListIterator<CalendarDay> it = m_weekdays; for (int i=0; it.current(); ++it, ++i) { if (i == day) return it.current(); @@ -468,7 +468,7 @@ CalendarDay *CalendarWeekdays::weekday(int day) const { Duration CalendarWeekdays::duration() const { Duration dur; - QPtrListIterator<CalendarDay> it = m_weekdays; + TQPtrListIterator<CalendarDay> it = m_weekdays; for (; it.current(); ++it) { dur += it.current()->duration(); } @@ -482,18 +482,18 @@ Duration CalendarWeekdays::duration(int _weekday) const { return Duration(); } -QTime CalendarWeekdays::startOfDay(int _weekday) const { +TQTime CalendarWeekdays::startOfDay(int _weekday) const { CalendarDay *day = weekday(_weekday); if (day) return day->startOfDay(); - return QTime(); + return TQTime(); } -QTime CalendarWeekdays::endOfDay(int _weekday) const { +TQTime CalendarWeekdays::endOfDay(int _weekday) const { CalendarDay *day = weekday(_weekday); if (day) return day->endOfDay(); - return QTime(); + return TQTime(); } @@ -507,9 +507,9 @@ Calendar::Calendar() init(); } -Calendar::Calendar(QString name, Calendar *parent) +Calendar::Calendar(TQString name, Calendar *tqparent) : m_name(name), - m_parent(parent), + m_parent(tqparent), m_project(0), m_deleted(false), m_days() { @@ -531,11 +531,11 @@ Calendar::Calendar(Calendar *calendar) const Calendar &Calendar::copy(Calendar &calendar) { m_name = calendar.name(); - m_parent = calendar.parent(); + m_parent = calendar.tqparent(); m_deleted = calendar.isDeleted(); m_id = calendar.id(); - QPtrListIterator<CalendarDay> it = calendar.days(); + TQPtrListIterator<CalendarDay> it = calendar.days(); for (; it.current(); ++it) { m_days.append(new CalendarDay(it.current())); } @@ -561,7 +561,7 @@ void Calendar::setDeleted(bool yes) { } m_deleted = yes; } -bool Calendar::setId(QString id) { +bool Calendar::setId(TQString id) { //kdDebug()<<k_funcinfo<<id<<endl; if (id.isEmpty()) { kdError()<<k_funcinfo<<"id is empty"<<endl; @@ -578,7 +578,7 @@ bool Calendar::setId(QString id) { } if (findCalendar(id)) { kdError()<<k_funcinfo<<"id '"<<id<<"' is already used for different node: "<<findCalendar(id)->name()<<endl; - m_id = QString(); // hmmm + m_id = TQString(); // hmmm return false; } m_id = id; @@ -598,21 +598,21 @@ void Calendar::generateId() { return; } } - m_id = QString(); + m_id = TQString(); } -bool Calendar::load(QDomElement &element) { +bool Calendar::load(TQDomElement &element) { //kdDebug()<<k_funcinfo<<element.text()<<endl; //bool ok; setId(element.attribute("id")); - m_parentId = element.attribute("parent"); + m_parentId = element.attribute("tqparent"); m_name = element.attribute("name",""); - //TODO parent + //TODO tqparent - QDomNodeList list = element.childNodes(); + TQDomNodeList list = element.childNodes(); for (unsigned int i=0; i<list.count(); ++i) { if (list.item(i).isElement()) { - QDomElement e = list.item(i).toElement(); + TQDomElement e = list.item(i).toElement(); if (e.tagName() == "weekday") { if (!m_weekdays->load(e)) return false; @@ -643,30 +643,30 @@ bool Calendar::load(QDomElement &element) { return true; } -void Calendar::save(QDomElement &element) const { +void Calendar::save(TQDomElement &element) const { //kdDebug()<<k_funcinfo<<m_name<<endl; if (m_deleted) return; - QDomElement me = element.ownerDocument().createElement("calendar"); + TQDomElement me = element.ownerDocument().createElement("calendar"); element.appendChild(me); if (m_parent && !m_parent->isDeleted()) - me.setAttribute("parent", m_parent->id()); + me.setAttribute("tqparent", m_parent->id()); me.setAttribute("name", m_name); me.setAttribute("id", m_id); m_weekdays->save(me); - QPtrListIterator<CalendarDay> it = m_days; + TQPtrListIterator<CalendarDay> it = m_days; for (; it.current(); ++it) { - QDomElement e = me.ownerDocument().createElement("day"); + TQDomElement e = me.ownerDocument().createElement("day"); me.appendChild(e); it.current()->save(e); } } -CalendarDay *Calendar::findDay(const QDate &date, bool skipNone) const { +CalendarDay *Calendar::findDay(const TQDate &date, bool skipNone) const { //kdDebug()<<k_funcinfo<<date.toString()<<endl; - QPtrListIterator<CalendarDay> it = m_days; + TQPtrListIterator<CalendarDay> it = m_days; for (; it.current(); ++it) { if (it.current()->date() == date) { if (skipNone && it.current()->state() == Map::None) { @@ -688,13 +688,13 @@ bool Calendar::hasParent(Calendar *cal) { return m_parent->hasParent(cal); } -Duration Calendar::effort(const QDate &date, const QTime &start, const QTime &end) const { +Duration Calendar::effort(const TQDate &date, const TQTime &start, const TQTime &end) const { //kdDebug()<<k_funcinfo<<m_name<<": "<<date.toString(Qt::ISODate)<<" "<<start.toString()<<" - "<<end.toString()<<endl; if (start == end) { return Duration::zeroDuration; } - QTime _start = start; - QTime _end = end; + TQTime _start = start; + TQTime _end = end; if (start > end) { _start = end; _end = start; @@ -733,9 +733,9 @@ Duration Calendar::effort(const DateTime &start, const DateTime &end) const { if (!start.isValid() || !end.isValid() || end <= start) { return eff; } - QDate date = start.date(); - QTime startTime = start.time(); - QTime endTime = end.time(); + TQDate date = start.date(); + TQTime startTime = start.time(); + TQTime endTime = end.time(); if (end.date() > date) { endTime.setHMS(23, 59, 59, 999); } @@ -743,9 +743,9 @@ Duration Calendar::effort(const DateTime &start, const DateTime &end) const { // Now get all the rest of the days for (date = date.addDays(1); date <= end.date(); date = date.addDays(1)) { if (date < end.date()) - eff += effort(date, QTime(), endTime); // whole days + eff += effort(date, TQTime(), endTime); // whole days else - eff += effort(date, QTime(), end.time()); // last day + eff += effort(date, TQTime(), end.time()); // last day //kdDebug()<<k_funcinfo<<": eff now="<<eff.toString(Duration::Format_Day)<<endl; } //kdDebug()<<k_funcinfo<<start.date().toString()<<"- "<<end.date().toString()<<": total="<<eff.toString(Duration::Format_Day)<<endl; @@ -753,7 +753,7 @@ Duration Calendar::effort(const DateTime &start, const DateTime &end) const { } -QPair<QTime, QTime> Calendar::firstInterval(const QDate &date, const QTime &startTime, const QTime &endTime) const { +TQPair<TQTime, TQTime> Calendar::firstInterval(const TQDate &date, const TQTime &startTime, const TQTime &endTime) const { CalendarDay *day = findDay(date, true); if (day) { return day->interval(startTime, endTime); @@ -763,7 +763,7 @@ QPair<QTime, QTime> Calendar::firstInterval(const QDate &date, const QTime &star return m_weekdays->interval(date, startTime, endTime); } if (m_weekdays->state(date) == Map::NonWorking) { - return QPair<QTime, QTime>(QTime(), QTime()); + return TQPair<TQTime, TQTime>(TQTime(), TQTime()); } } if (m_parent && !m_parent->isDeleted()) { @@ -772,41 +772,41 @@ QPair<QTime, QTime> Calendar::firstInterval(const QDate &date, const QTime &star return project()->defaultCalendar()->firstInterval(date, startTime, endTime); } -QPair<DateTime, DateTime> Calendar::firstInterval(const DateTime &start, const DateTime &end) const { +TQPair<DateTime, DateTime> Calendar::firstInterval(const DateTime &start, const DateTime &end) const { //kdDebug()<<k_funcinfo<<start.toString()<<" - "<<end.toString()<<endl; if (!start.isValid()) { kdWarning()<<k_funcinfo<<"Invalid start time"<<endl; - return QPair<DateTime, DateTime>(DateTime(), DateTime()); + return TQPair<DateTime, DateTime>(DateTime(), DateTime()); } if (!end.isValid()) { kdWarning()<<k_funcinfo<<"Invalid end time"<<endl; - return QPair<DateTime, DateTime>(DateTime(), DateTime()); + return TQPair<DateTime, DateTime>(DateTime(), DateTime()); } - QTime startTime; - QTime endTime; - QDate date = start.date(); + TQTime startTime; + TQTime endTime; + TQDate date = start.date(); int i=0; for (; date <= end.date(); date = date.addDays(1)) { if (date < end.date()) - endTime = QTime(23, 59, 59, 999); + endTime = TQTime(23, 59, 59, 999); else endTime = end.time(); if (date > start.date()) - startTime = QTime(); + startTime = TQTime(); else startTime = start.time(); - QPair<QTime, QTime> res = firstInterval(date, startTime, endTime); + TQPair<TQTime, TQTime> res = firstInterval(date, startTime, endTime); if (res.first < res.second) { - return QPair<DateTime, DateTime>(DateTime(date,res.first),DateTime(date, res.second)); + return TQPair<DateTime, DateTime>(DateTime(date,res.first),DateTime(date, res.second)); } } //kdError()<<k_funcinfo<<"Didn't find an interval ("<<start<<", "<<end<<")"<<endl; - return QPair<DateTime, DateTime>(DateTime(), DateTime()); + return TQPair<DateTime, DateTime>(DateTime(), DateTime()); } -bool Calendar::hasInterval(const QDate &date, const QTime &startTime, const QTime &endTime) const { +bool Calendar::hasInterval(const TQDate &date, const TQTime &startTime, const TQTime &endTime) const { CalendarDay *day = findDay(date, true); if (day) { //kdDebug()<<k_funcinfo<<m_name<<" "<<date<<": "<<startTime<<" to "<<endTime<<endl; @@ -832,16 +832,16 @@ bool Calendar::hasInterval(const DateTime &start, const DateTime &end) const { //kdDebug()<<kdBacktrace(8)<<endl; return false; } - QTime startTime; - QTime endTime; - QDate date = start.date(); + TQTime startTime; + TQTime endTime; + TQDate date = start.date(); for (; date <= end.date(); date = date.addDays(1)) { if (date < end.date()) - endTime = QTime(23, 59, 59, 999); + endTime = TQTime(23, 59, 59, 999); else endTime = end.time(); if (date > start.date()) - startTime = QTime(); + startTime = TQTime(); else startTime = start.time(); @@ -874,7 +874,7 @@ DateTime Calendar::firstAvailableBefore(const DateTime &time, const DateTime &li DateTime lmt = time; DateTime t = DateTime(time.date()); // start of first day if (t == lmt) - t = t.addDays(-1); // in case time == start of day + t = TQDateTime(t.addDays(-1)); // in case time == start of day if (t < limit) t = limit; // always stop at limit (lower boundary) DateTime res; @@ -895,7 +895,7 @@ DateTime Calendar::firstAvailableBefore(const DateTime &time, const DateTime &li break; } lmt = t; - t = t.addDays(-1); + t = TQDateTime(t.addDays(-1)); if (t < limit) { t = limit; } @@ -907,15 +907,15 @@ DateTime Calendar::firstAvailableBefore(const DateTime &time, const DateTime &li return res; } -Calendar *Calendar::findCalendar(const QString &id) const { +Calendar *Calendar::findCalendar(const TQString &id) const { return (m_project ? m_project->findCalendar(id) : 0); } -bool Calendar::removeId(const QString &id) { +bool Calendar::removeId(const TQString &id) { return (m_project ? m_project->removeCalendarId(id) : false); } -void Calendar::insertId(const QString &id){ +void Calendar::insertId(const TQString &id){ if (m_project) m_project->insertCalendarId(id, this); } @@ -949,7 +949,7 @@ void StandardWorktime::init() { m_day = Duration(0, 8, 0); m_calendar = new Calendar; m_calendar->setName(i18n("Base")); - QPair<QTime, QTime> t = QPair<QTime, QTime>(QTime(8,0,0), QTime(16,0,0)); + TQPair<TQTime, TQTime> t = TQPair<TQTime, TQTime>(TQTime(8,0,0), TQTime(16,0,0)); for (int i=0; i < 5; ++i) { m_calendar->weekday(i)->addInterval(t); m_calendar->weekday(i)->setState(Map::Working); @@ -958,17 +958,17 @@ void StandardWorktime::init() { m_calendar->weekday(6)->setState(Map::NonWorking); } -bool StandardWorktime::load(QDomElement &element) { +bool StandardWorktime::load(TQDomElement &element) { //kdDebug()<<k_funcinfo<<endl; m_year = Duration::fromString(element.attribute("year"), Duration::Format_Hour); m_month = Duration::fromString(element.attribute("month"), Duration::Format_Hour); m_week = Duration::fromString(element.attribute("week"), Duration::Format_Hour); m_day = Duration::fromString(element.attribute("day"), Duration::Format_Hour); - QDomNodeList list = element.childNodes(); + TQDomNodeList list = element.childNodes(); for (unsigned int i=0; i<list.count(); ++i) { if (list.item(i).isElement()) { - QDomElement e = list.item(i).toElement(); + TQDomElement e = list.item(i).toElement(); if (e.tagName() == "calendar") { delete m_calendar; m_calendar = new Calendar; @@ -979,9 +979,9 @@ bool StandardWorktime::load(QDomElement &element) { return true; } -void StandardWorktime::save(QDomElement &element) const { +void StandardWorktime::save(TQDomElement &element) const { //kdDebug()<<k_funcinfo<<endl; - QDomElement me = element.ownerDocument().createElement("standard-worktime"); + TQDomElement me = element.ownerDocument().createElement("standard-worktime"); element.appendChild(me); me.setAttribute("year", m_year.toString(Duration::Format_Hour)); me.setAttribute("month", m_month.toString(Duration::Format_Hour)); @@ -992,38 +992,38 @@ void StandardWorktime::save(QDomElement &element) const { } #ifndef NDEBUG -void CalendarDay::printDebug(QCString indent) { - QString s[] = {"None", "Non-working", "Working"}; +void CalendarDay::printDebug(TQCString indent) { + TQString s[] = {"None", "Non-working", "Working"}; kdDebug()<<indent<<" "<<m_date.toString()<<" = "<<s[m_state]<<endl; if (m_state == Map::Working) { indent += " "; - QPtrListIterator<QPair<QTime, QTime> > it = m_workingIntervals; + TQPtrListIterator<TQPair<TQTime, TQTime> > it = m_workingIntervals; for (; it.current(); ++it) { kdDebug()<<indent<<" Interval: "<<it.current()->first<<" to "<<it.current()->second<<endl; } } } -void CalendarWeekdays::printDebug(QCString indent) { +void CalendarWeekdays::printDebug(TQCString indent) { kdDebug()<<indent<<"Weekdays ------"<<endl; - QPtrListIterator<CalendarDay> it = m_weekdays; + TQPtrListIterator<CalendarDay> it = m_weekdays; for (char c='0'; it.current(); ++it) { it.current()->printDebug(indent + " Day " + c++ + ": "); } } -void Calendar::printDebug(QCString indent) { +void Calendar::printDebug(TQCString indent) { kdDebug()<<indent<<"Calendar "<<m_id<<": '"<<m_name<<"' Deleted="<<m_deleted<<endl; - kdDebug()<<indent<<" Parent: "<<(m_parent ? m_parent->name() : "No parent")<<endl; + kdDebug()<<indent<<" Parent: "<<(m_parent ? m_parent->name() : "No tqparent")<<endl; m_weekdays->printDebug(indent + " "); kdDebug()<<indent<<" Days --------"<<endl; - QPtrListIterator<CalendarDay> it = m_days; + TQPtrListIterator<CalendarDay> it = m_days; for (; it.current(); ++it) { it.current()->printDebug(indent + " "); } } -void StandardWorktime::printDebug(QCString indent) { +void StandardWorktime::printDebug(TQCString indent) { kdDebug()<<indent<<"StandardWorktime "<<endl; kdDebug()<<indent<<"Year: "<<m_year.toString()<<endl; kdDebug()<<indent<<"Month: "<<m_month.toString()<<endl; |