20#include "kpttaskappointmentsview.h"
22#include "kptappointment.h"
25#include <tqapplication.h>
26#include <kcalendarsystem.h>
35TaskAppointmentsView::ResourceItem::ResourceItem(
Resource *r, TQListView *parent,
bool highlight)
42TaskAppointmentsView::ResourceItem::ResourceItem(Resource *r, TQListViewItem *p,
bool highlight)
43 : DoubleListViewBase::MasterListItem(p, r->name(), highlight),
50TaskAppointmentsView::ResourceItem::ResourceItem(TQString text, TQListViewItem *parent,
bool highlight)
51 : DoubleListViewBase::MasterListItem(parent, text, highlight),
59TaskAppointmentsView::TaskAppointmentsView(TQWidget *parent)
60 : DoubleListViewBase(parent),
63 setNameHeader(i18n(
"Resource"));
66 TQValueList<int> list = sizes();
67 int tot = list[0] + list[1];
68 list[0] = TQMIN(35, tot);
69 list[1] = tot-list[0];
73void TaskAppointmentsView::zoom(
double zoom) {
78void TaskAppointmentsView::draw(Task *task) {
83void TaskAppointmentsView::draw() {
89 TQPtrList<Appointment> lst = m_task->appointments();
90 TQPtrListIterator<Appointment> it(lst);
91 for (; it.current(); ++it) {
92 Resource *r = it.current()->resource()->resource();
93 TaskAppointmentsView::ResourceItem *item =
new TaskAppointmentsView::ResourceItem(r, masterListView());
95 item->effortMap = it.current()->plannedPrDay(m_task->startTime().date(), m_task->endTime().date());
100void TaskAppointmentsView::drawContents(TQPainter* painter)
102 this->DoubleListViewBase::drawContents(painter);
105void TaskAppointmentsView::slotUpdate() {
109 TQApplication::setOverrideCursor(TQt::waitCursor);
111 TDELocale *locale = TDEGlobal::locale();
112 const KCalendarSystem *cal = locale->calendar();
115 TQDate start = m_task->startTime().date();
116 TQDate end = m_task->endTime().date();
119 for (TQDate dt = start; dt <= end; dt = cal->addDays(dt, 1), ++c) {
120 TQString df = locale->formatDate(dt,
true);
123 TQListViewItemIterator it(masterListView());
124 for (;it.current(); ++it) {
125 TaskAppointmentsView::ResourceItem *item =
static_cast<TaskAppointmentsView::ResourceItem*
>(it.current());
131 for (TQDate d=start; d <= end; d = cal->addDays(d, 1), ++col) {
132 eff = (double)(item->effortMap.effortOnDate(d).minutes())/60.0;
133 item->setSlaveItem(col, eff);
134 item->addToTotal(eff);
138 TQApplication::restoreOverrideCursor();
142void TaskAppointmentsView::print(KPrinter &) {
143 kdDebug()<<k_funcinfo<<endl;
171void TaskAppointmentsView::clear() {
175void TaskAppointmentsView::createSlaveItems() {
176 DoubleListViewBase::createSlaveItems();
177 setSlaveFormat(0,
'f', 1);
182#include "kpttaskappointmentsview.moc"
The class DoubleListViewBase provides a double listview where the right listview (the slave) containe...
Any resource that is used by a task.