summaryrefslogtreecommitdiffstats
path: root/kplato/kptschedule.cc
diff options
context:
space:
mode:
authortpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
committertpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da>2011-06-25 05:28:35 +0000
commitf008adb5a77e094eaf6abf3fc0f36958e66896a5 (patch)
tree8e9244c4d4957c36be81e15b566b4aa5ea26c982 /kplato/kptschedule.cc
parent1210f27b660efb7b37ff43ec68763e85a403471f (diff)
downloadkoffice-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/kptschedule.cc')
-rw-r--r--kplato/kptschedule.cc164
1 files changed, 82 insertions, 82 deletions
diff --git a/kplato/kptschedule.cc b/kplato/kptschedule.cc
index e3f23f07..84b2ddd3 100644
--- a/kplato/kptschedule.cc
+++ b/kplato/kptschedule.cc
@@ -24,9 +24,9 @@
#include "kptduration.h"
#include "kptnode.h"
-#include <qdom.h>
-#include <qstring.h>
-#include <qstringlist.h>
+#include <tqdom.h>
+#include <tqstring.h>
+#include <tqstringlist.h>
#include <klocale.h>
#include <kdebug.h>
@@ -41,23 +41,23 @@ Schedule::Schedule()
m_parent(0) {
}
-Schedule::Schedule(Schedule *parent)
+Schedule::Schedule(Schedule *tqparent)
: m_type(Expected),
m_id(0),
m_deleted(false),
m_appointments(),
- m_parent(parent) {
+ m_parent(tqparent) {
- if (parent) {
- m_name = parent->name();
- m_type = parent->type();
- m_id = parent->id();
+ if (tqparent) {
+ m_name = tqparent->name();
+ m_type = tqparent->type();
+ m_id = tqparent->id();
}
m_appointments.setAutoDelete(true);
//kdDebug()<<k_funcinfo<<"("<<this<<") Name: '"<<name<<"' Type="<<type<<" id="<<id<<endl;
}
-Schedule::Schedule(QString name, Type type, long id)
+Schedule::Schedule(TQString name, Type type, long id)
: m_name(name),
m_type(type),
m_id(id),
@@ -72,8 +72,8 @@ Schedule::Schedule(QString name, Type type, long id)
Schedule::~Schedule() {
}
-void Schedule::setParent(Schedule *parent) {
- m_parent = parent;
+void Schedule::setParent(Schedule *tqparent) {
+ m_parent = tqparent;
}
void Schedule::setDeleted(bool on) {
@@ -85,7 +85,7 @@ bool Schedule::isDeleted() const {
return m_parent == 0 ? m_deleted : m_parent->isDeleted();
}
-void Schedule::setType(const QString type) {
+void Schedule::setType(const TQString type) {
m_type = Expected;
if (type == "Expected")
m_type = Expected;
@@ -95,7 +95,7 @@ void Schedule::setType(const QString type) {
m_type = Pessimistic;
}
-QString Schedule::typeToString(bool translate) const {
+TQString Schedule::typeToString(bool translate) const {
if (translate) {
if (m_type == Expected)
return i18n("Expected");
@@ -126,7 +126,7 @@ void Schedule::initiateCalculation() {
void Schedule::calcResourceOverbooked() {
resourceOverbooked = false;
- QPtrListIterator<Appointment> it = m_appointments;
+ TQPtrListIterator<Appointment> it = m_appointments;
for (; it.current(); ++it) {
if (it.current()->resource()->isOverbooked(startTime, endTime)) {
resourceOverbooked = true;
@@ -135,9 +135,9 @@ void Schedule::calcResourceOverbooked() {
}
}
-QStringList Schedule::overbookedResources() const {
- QStringList rl;
- QPtrListIterator<Appointment> it = m_appointments;
+TQStringList Schedule::overbookedResources() const {
+ TQStringList rl;
+ TQPtrListIterator<Appointment> it = m_appointments;
for (; it.current(); ++it) {
if (it.current()->resource()->isOverbooked(it.current()->startTime(), it.current()->endTime())) {
rl += it.current()->resource()->resource()->name();
@@ -146,36 +146,36 @@ QStringList Schedule::overbookedResources() const {
return rl;
}
-bool Schedule::loadXML(const QDomElement &sch) {
+bool Schedule::loadXML(const TQDomElement &sch) {
m_name = sch.attribute("name");
setType(sch.attribute("type"));
m_id = sch.attribute("id").toLong();
return true;
}
-void Schedule::saveXML(QDomElement &element) const {
- QDomElement sch = element.ownerDocument().createElement("schedule");
+void Schedule::saveXML(TQDomElement &element) const {
+ TQDomElement sch = element.ownerDocument().createElement("schedule");
element.appendChild(sch);
saveCommonXML(sch);
}
-void Schedule::saveCommonXML(QDomElement &element) const {
+void Schedule::saveCommonXML(TQDomElement &element) const {
//kdDebug()<<k_funcinfo<<m_name<<" save schedule"<<endl;
element.setAttribute("name", m_name);
element.setAttribute("type", typeToString());
element.setAttribute("id", m_id);
}
-void Schedule::saveAppointments(QDomElement &element) const {
+void Schedule::saveAppointments(TQDomElement &element) const {
//kdDebug()<<k_funcinfo<<endl;
- QPtrListIterator<Appointment> it = m_appointments;
+ TQPtrListIterator<Appointment> it = m_appointments;
for (; it.current(); ++it) {
it.current()->saveXML(element);
}
}
bool Schedule::add(Appointment *appointment) {
- if (m_appointments.findRef(appointment) != -1) {
+ if (m_appointments.tqfindRef(appointment) != -1) {
kdError()<<k_funcinfo<<"Appointment allready exists"<<endl;
return false;
}
@@ -191,7 +191,7 @@ void Schedule::removeAppointment(Appointment *appointment) {
}
void Schedule::takeAppointment(Appointment *appointment) {
- int i = m_appointments.findRef(appointment);
+ int i = m_appointments.tqfindRef(appointment);
if (i != -1) {
m_appointments.take(i);
//kdDebug()<<k_funcinfo<<"Taken: "<<appointment<<endl;
@@ -203,7 +203,7 @@ void Schedule::takeAppointment(Appointment *appointment) {
}
Appointment *Schedule::findAppointment(Schedule *resource, Schedule *node) {
- QPtrListIterator<Appointment> it = m_appointments;
+ TQPtrListIterator<Appointment> it = m_appointments;
for (; it.current(); ++it) {
if (it.current()->node() == node && it.current()->resource() == resource)
return it.current();
@@ -211,10 +211,10 @@ Appointment *Schedule::findAppointment(Schedule *resource, Schedule *node) {
return 0;
}
-EffortCostMap Schedule::plannedEffortCostPrDay(const QDate &start, const QDate &end) const {
+EffortCostMap Schedule::plannedEffortCostPrDay(const TQDate &start, const TQDate &end) const {
//kdDebug()<<k_funcinfo<<m_name<<endl;
EffortCostMap ec;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
//kdDebug()<<k_funcinfo<<m_name<<endl;
ec += it.current()->plannedPrDay(start, end);
@@ -225,27 +225,27 @@ EffortCostMap Schedule::plannedEffortCostPrDay(const QDate &start, const QDate &
Duration Schedule::plannedEffort() const {
//kdDebug()<<k_funcinfo<<endl;
Duration eff;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
eff += it.current()->plannedEffort();
}
return eff;
}
-Duration Schedule::plannedEffort(const QDate &date) const {
+Duration Schedule::plannedEffort(const TQDate &date) const {
//kdDebug()<<k_funcinfo<<endl;
Duration eff;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
eff += it.current()->plannedEffort(date);
}
return eff;
}
-Duration Schedule::plannedEffortTo(const QDate &date) const {
+Duration Schedule::plannedEffortTo(const TQDate &date) const {
//kdDebug()<<k_funcinfo<<endl;
Duration eff;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
eff += it.current()->plannedEffortTo(date);
}
@@ -255,27 +255,27 @@ Duration Schedule::plannedEffortTo(const QDate &date) const {
Duration Schedule::actualEffort() const {
//kdDebug()<<k_funcinfo<<endl;
Duration eff;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
eff += it.current()->actualEffort();
}
return eff;
}
-Duration Schedule::actualEffort(const QDate &date) const {
+Duration Schedule::actualEffort(const TQDate &date) const {
//kdDebug()<<k_funcinfo<<endl;
Duration eff;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
eff += it.current()->actualEffort(date);
}
return eff;
}
-Duration Schedule::actualEffortTo(const QDate &date) const {
+Duration Schedule::actualEffortTo(const TQDate &date) const {
//kdDebug()<<k_funcinfo<<endl;
Duration eff;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
eff += it.current()->actualEffortTo(date);
}
@@ -285,27 +285,27 @@ Duration Schedule::actualEffortTo(const QDate &date) const {
double Schedule::plannedCost() const {
//kdDebug()<<k_funcinfo<<endl;
double c = 0;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
c += it.current()->plannedCost();
}
return c;
}
-double Schedule::plannedCost(const QDate &date) const {
+double Schedule::plannedCost(const TQDate &date) const {
//kdDebug()<<k_funcinfo<<endl;
double c = 0;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
c += it.current()->plannedCost(date);
}
return c;
}
-double Schedule::plannedCostTo(const QDate &date) const {
+double Schedule::plannedCostTo(const TQDate &date) const {
//kdDebug()<<k_funcinfo<<endl;
double c = 0;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
c += it.current()->plannedCostTo(date);
}
@@ -315,27 +315,27 @@ double Schedule::plannedCostTo(const QDate &date) const {
double Schedule::actualCost() const {
//kdDebug()<<k_funcinfo<<endl;
double c = 0;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
c += it.current()->actualCost();
}
return c;
}
-double Schedule::actualCost(const QDate &date) const {
+double Schedule::actualCost(const TQDate &date) const {
//kdDebug()<<k_funcinfo<<endl;
double c = 0;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
c += it.current()->actualCost(date);
}
return c;
}
-double Schedule::actualCostTo(const QDate &date) const {
+double Schedule::actualCostTo(const TQDate &date) const {
//kdDebug()<<k_funcinfo<<endl;
double c = 0;
- QPtrListIterator<Appointment> it(m_appointments);
+ TQPtrListIterator<Appointment> it(m_appointments);
for (; it.current(); ++it) {
c += it.current()->actualCostTo(date);
}
@@ -350,15 +350,15 @@ NodeSchedule::NodeSchedule()
init();
}
-NodeSchedule::NodeSchedule(Node *node, QString name, Schedule::Type type, long id)
+NodeSchedule::NodeSchedule(Node *node, TQString name, Schedule::Type type, long id)
: Schedule(name, type, id),
m_node(node) {
//kdDebug()<<k_funcinfo<<"node name: "<<node->name()<<endl;
init();
}
-NodeSchedule::NodeSchedule(Schedule *parent, Node *node)
- : Schedule(parent),
+NodeSchedule::NodeSchedule(Schedule *tqparent, Node *node)
+ : Schedule(tqparent),
m_node(node) {
//kdDebug()<<k_funcinfo<<"node name: "<<node->name()<<endl;
@@ -382,7 +382,7 @@ void NodeSchedule::setDeleted(bool on) {
//kdDebug()<<k_funcinfo<<"deleted="<<on<<endl;
m_deleted = on;
// set deleted also for possible resource schedules
- QPtrListIterator<Appointment> it = m_appointments;
+ TQPtrListIterator<Appointment> it = m_appointments;
for (; it.current(); ++it) {
if (it.current()->resource()) {
it.current()->resource()->setDeleted(on);
@@ -390,9 +390,9 @@ void NodeSchedule::setDeleted(bool on) {
}
}
-bool NodeSchedule::loadXML(const QDomElement &sch) {
+bool NodeSchedule::loadXML(const TQDomElement &sch) {
//kdDebug()<<k_funcinfo<<endl;
- QString s;
+ TQString s;
Schedule::loadXML(sch);
s = sch.attribute("earlieststart");
if (s != "")
@@ -424,9 +424,9 @@ bool NodeSchedule::loadXML(const QDomElement &sch) {
return true;
}
-void NodeSchedule::saveXML(QDomElement &element) const {
+void NodeSchedule::saveXML(TQDomElement &element) const {
//kdDebug()<<k_funcinfo<<endl;
- QDomElement sch = element.ownerDocument().createElement("schedule");
+ TQDomElement sch = element.ownerDocument().createElement("schedule");
element.appendChild(sch);
saveCommonXML(sch);
@@ -477,17 +477,17 @@ ResourceSchedule::ResourceSchedule()
//kdDebug()<<k_funcinfo<<"("<<this<<")"<<endl;
}
-ResourceSchedule::ResourceSchedule(Resource *resource, QString name, Schedule::Type type, long id)
+ResourceSchedule::ResourceSchedule(Resource *resource, TQString name, Schedule::Type type, long id)
: Schedule(name, type, id),
m_resource(resource),
m_parent(0) {
//kdDebug()<<k_funcinfo<<"resource: "<<resource->name()<<endl;
}
-ResourceSchedule::ResourceSchedule(Schedule *parent, Resource *resource)
- : Schedule(parent),
+ResourceSchedule::ResourceSchedule(Schedule *tqparent, Resource *resource)
+ : Schedule(tqparent),
m_resource(resource),
- m_parent(parent) {
+ m_parent(tqparent) {
//kdDebug()<<k_funcinfo<<"resource: "<<resource->name()<<endl;
}
@@ -521,7 +521,7 @@ bool ResourceSchedule::isOverbooked(const DateTime &start, const DateTime &end)
return false;
//kdDebug()<<k_funcinfo<<start.toString()<<" - "<<end.toString()<<endl;
Appointment a = appointmentIntervals();
- QPtrListIterator<AppointmentInterval> it = a.intervals();
+ TQPtrListIterator<AppointmentInterval> it = a.intervals();
for (; it.current(); ++it) {
if ((!end.isValid() || it.current()->startTime() < end) &&
(!start.isValid() || it.current()->endTime() > start))
@@ -540,7 +540,7 @@ bool ResourceSchedule::isOverbooked(const DateTime &start, const DateTime &end)
Appointment ResourceSchedule::appointmentIntervals() const {
Appointment a;
- QPtrListIterator<Appointment> it = m_appointments;
+ TQPtrListIterator<Appointment> it = m_appointments;
for (; it.current(); ++it) {
a += *(it.current());
}
@@ -558,7 +558,7 @@ MainSchedule::MainSchedule()
init();
}
-MainSchedule::MainSchedule(Node *node, QString name, Schedule::Type type, long id)
+MainSchedule::MainSchedule(Node *node, TQString name, Schedule::Type type, long id)
: NodeSchedule(node, name, type, id) {
//kdDebug()<<k_funcinfo<<"node name: "<<node->name()<<endl;
init();
@@ -568,9 +568,9 @@ MainSchedule::~MainSchedule() {
//kdDebug()<<k_funcinfo<<"("<<this<<")"<<endl;
}
-bool MainSchedule::loadXML(const QDomElement &sch, Project &project) {
+bool MainSchedule::loadXML(const TQDomElement &sch, Project &project) {
kdDebug()<<k_funcinfo<<endl;
- QString s;
+ TQString s;
Schedule::loadXML(sch);
s = sch.attribute("start");
@@ -580,11 +580,11 @@ bool MainSchedule::loadXML(const QDomElement &sch, Project &project) {
if (s != "")
endTime = DateTime::fromString(s);
- QDomNodeList al = sch.childNodes();
+ TQDomNodeList al = sch.childNodes();
kdDebug()<<k_funcinfo<<"No of appointments: "<<al.count()<<endl;
for (unsigned int i=0; i<al.count(); ++i) {
if (al.item(i).isElement()) {
- QDomElement app = al.item(i).toElement();
+ TQDomElement app = al.item(i).toElement();
if (app.tagName() == "appointment") {
// Load the appointments.
// Resources and tasks must allready loaded
@@ -600,7 +600,7 @@ bool MainSchedule::loadXML(const QDomElement &sch, Project &project) {
return true;
}
-void MainSchedule::saveXML(QDomElement &element) const {
+void MainSchedule::saveXML(TQDomElement &element) const {
saveCommonXML(element);
element.setAttribute("start",startTime.toString(Qt::ISODate));
@@ -608,22 +608,22 @@ void MainSchedule::saveXML(QDomElement &element) const {
}
#ifndef NDEBUG
-void Schedule::printDebug(QString indent) {
+void Schedule::printDebug(TQString indent) {
kdDebug()<<indent<<"Schedule["<<m_id<<"] '"<<m_name<<"' type: "<<typeToString()<<" ("<<m_type<<")"<<(isDeleted()?" Deleted":"")<<endl;
}
-void NodeSchedule::printDebug(QString indent) {
+void NodeSchedule::printDebug(TQString indent) {
Schedule::printDebug(indent);
indent += "! ";
if (m_parent == 0)
- kdDebug()<<indent<<"No parent schedule!"<<endl;
+ kdDebug()<<indent<<"No tqparent schedule!"<<endl;
if (!notScheduled) {
if (node()) kdDebug()<<indent<<"Node: "<<node()->name()<<endl;
- else kdDebug()<<indent<<"No parent node!"<<endl;
+ else kdDebug()<<indent<<"No tqparent node!"<<endl;
}
kdDebug()<<indent<<"Not scheduled="<<notScheduled<<endl;
kdDebug()<<indent<<"Start time: "<<startTime.toString()<<endl;
kdDebug()<<indent<<"End time: " <<endTime.toString()<<endl;
- kdDebug()<<indent<<"Duration: "<<duration.seconds()<<QCString(" secs")<<" ("<<duration.toString()<<")"<<endl;
+ kdDebug()<<indent<<"Duration: "<<duration.seconds()<<TQCString(" secs")<<" ("<<duration.toString()<<")"<<endl;
kdDebug()<<indent<<"Earliest start: "<<earliestStart.toString()<<endl;
kdDebug()<<indent<<"Latest finish: " <<latestFinish.toString()<<endl;
@@ -639,38 +639,38 @@ void NodeSchedule::printDebug(QString indent) {
kdDebug()<<indent<<"workEndTime="<<workEndTime.toString()<<endl;
kdDebug()<<indent<<endl;
kdDebug()<<indent<<"Appointments: "<<m_appointments.count()<<endl;
- QPtrListIterator<Appointment> it = m_appointments;
+ TQPtrListIterator<Appointment> it = m_appointments;
for (; it.current(); ++it) {
it.current()->printDebug(indent + " ");
}
}
-void ResourceSchedule::printDebug(QString indent) {
+void ResourceSchedule::printDebug(TQString indent) {
Schedule::printDebug(indent);
indent += "! ";
if (m_parent == 0)
- kdDebug()<<indent<<"No parent schedule!"<<endl;
+ kdDebug()<<indent<<"No tqparent schedule!"<<endl;
if (resource()) kdDebug()<<indent<<"Resource: "<<resource()->name()<<endl;
- else kdDebug()<<indent<<"No parent resource!"<<endl;
+ else kdDebug()<<indent<<"No tqparent resource!"<<endl;
kdDebug()<<indent<<endl;
kdDebug()<<indent<<"Appointments: "<<m_appointments.count()<<endl;
}
-void MainSchedule::printDebug(QString indent) {
+void MainSchedule::printDebug(TQString indent) {
Schedule::printDebug(indent);
indent += "! ";
if (node()) kdDebug()<<indent<<"Node: "<<node()->name()<<endl;
- else kdDebug()<<indent<<"No parent node!"<<endl;
+ else kdDebug()<<indent<<"No tqparent node!"<<endl;
kdDebug()<<indent<<"Not scheduled="<<notScheduled<<endl;
kdDebug()<<indent<<"Start time: "<<startTime.toString()<<endl;
kdDebug()<<indent<<"End time: " <<endTime.toString()<<endl;
- kdDebug()<<indent<<"Duration: "<<duration.seconds()<<QCString(" secs")<<" ("<<duration.toString()<<")"<<endl;
+ kdDebug()<<indent<<"Duration: "<<duration.seconds()<<TQCString(" secs")<<" ("<<duration.toString()<<")"<<endl;
kdDebug()<<indent<<"Earliest start: "<<earliestStart.toString()<<endl;
kdDebug()<<indent<<"Latest finish: " <<latestFinish.toString()<<endl;
kdDebug()<<indent<<endl;
kdDebug()<<indent<<"Appointments: "<<m_appointments.count()<<endl;
- QPtrListIterator<Appointment> it = m_appointments;
+ TQPtrListIterator<Appointment> it = m_appointments;
for (; it.current(); ++it) {
it.current()->printDebug(indent + " ");
}