From 8b78a8791bc539bcffe7159f9d9714d577cb3d7d Mon Sep 17 00:00:00 2001 From: Michele Calgaro Date: Sun, 23 May 2021 20:48:35 +0900 Subject: Renaming of files in preparation for code style tools. Signed-off-by: Michele Calgaro --- kplato/kpttaskappointmentsview.cpp | 182 +++++++++++++++++++++++++++++++++++++ 1 file changed, 182 insertions(+) create mode 100644 kplato/kpttaskappointmentsview.cpp (limited to 'kplato/kpttaskappointmentsview.cpp') diff --git a/kplato/kpttaskappointmentsview.cpp b/kplato/kpttaskappointmentsview.cpp new file mode 100644 index 000000000..669bf0654 --- /dev/null +++ b/kplato/kpttaskappointmentsview.cpp @@ -0,0 +1,182 @@ +/* This file is part of the KDE project + Copyright (C) 2005 Dag Andersen + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Library General Public + License as published by the Free Software Foundation; either + version 2 of the License, or (at your option) any later version. + + This library is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + Library General Public License for more details. + + You should have received a copy of the GNU Library General Public License + along with this library; see the file COPYING.LIB. If not, write to + the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, + * Boston, MA 02110-1301, USA. +*/ + +#include "kpttaskappointmentsview.h" + +#include "kptappointment.h" +#include "kpttask.h" + +#include +#include +#include +#include + +#include + +namespace KPlato +{ + +TaskAppointmentsView::ResourceItem::ResourceItem(Resource *r, TQListView *parent, bool highlight) + : DoubleListViewBase::MasterListItem(parent, r->name(), highlight), + resource(r) { + + setFormat(0, 'f', 1); + //kdDebug()<name(), highlight), + resource(r) { + + setFormat(0, 'f', 1); + //kdDebug()< list = sizes(); + int tot = list[0] + list[1]; + list[0] = TQMIN(35, tot); + list[1] = tot-list[0]; + setSizes(list); +} + +void TaskAppointmentsView::zoom(double zoom) { + Q_UNUSED(zoom); +} + + +void TaskAppointmentsView::draw(Task *task) { + m_task = task; + draw(); +} + +void TaskAppointmentsView::draw() { + //kdDebug()< lst = m_task->appointments(); + TQPtrListIterator it(lst); + for (; it.current(); ++it) { + Resource *r = it.current()->resource()->resource(); + TaskAppointmentsView::ResourceItem *item = new TaskAppointmentsView::ResourceItem(r, masterListView()); + + item->effortMap = it.current()->plannedPrDay(m_task->startTime().date(), m_task->endTime().date()); + } + slotUpdate(); +} + +void TaskAppointmentsView::drawContents(TQPainter* painter) +{ + this->DoubleListViewBase::drawContents(painter); +} + +void TaskAppointmentsView::slotUpdate() { + //kdDebug()<calendar(); + + // Add columns for selected period/periods + TQDate start = m_task->startTime().date(); + TQDate end = m_task->endTime().date(); + //kdDebug()<addDays(dt, 1), ++c) { + TQString df = locale->formatDate(dt, true); + addSlaveColumn(df); + } + TQListViewItemIterator it(masterListView()); + for (;it.current(); ++it) { + TaskAppointmentsView::ResourceItem *item = static_cast(it.current()); + if (!item) { + continue; + } + double eff; + int col=0; + for (TQDate d=start; d <= end; d = cal->addDays(d, 1), ++col) { + eff = (double)(item->effortMap.effortOnDate(d).minutes())/60.0; + item->setSlaveItem(col, eff); + item->addToTotal(eff); + } + } + calculate(); + TQApplication::restoreOverrideCursor(); +} + + +void TaskAppointmentsView::print(KPrinter &/*printer*/) { + kdDebug()< list; +// list << context.accountsviewsize << context.periodviewsize; +// m_dlv->setSizes(list); +// m_date = context.date; +// if (!m_date.isValid()) +// m_date = TQDate::currentDate(); +// m_period = context.period; +// m_cumulative = context.cumulative; +// +// return true; +// } +// +// void TaskAppointmentsView::getContext(Context::TaskAppointmentsView &context) const { +// //kdDebug()<sizes()[0]; +// context.periodviewsize = m_dlv->sizes()[1]; +// context.date = m_date; +// context.period = m_period; +// context.cumulative = m_cumulative; +// //kdDebug()<