F:/KPlato/koffice/kplato/kpttaskappointmentsview.ui.h

Aller à la documentation de ce fichier.
00001 /****************************************************************************
00002 ** ui.h extension file, included from the uic-generated form implementation.
00003 **
00004 ** If you wish to add, delete or rename functions or slots use
00005 ** Qt Designer which will update this file, preserving your code. Create an
00006 ** init() function in place of a constructor, and a destroy() function in
00007 ** place of a destructor.
00008 *****************************************************************************/
00009 
00010 /* This file is part of the KDE project
00011    Copyright (C) 2004 - 2005 Dag Andersen <danders@get2net.dk>
00012 
00013    This library is free software; you can redistribute it and/or
00014    modify it under the terms of the GNU Library General Public
00015    License as published by the Free Software Foundation;
00016    version 2 of the License.
00017 
00018    This library is distributed in the hope that it will be useful,
00019    but WITHOUT ANY WARRANTY; without even the implied warranty of
00020    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00021    Library General Public License for more details.
00022 
00023    You should have received a copy of the GNU Library General Public License
00024    along with this library; see the file COPYING.LIB.  If not, write to
00025    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00026  * Boston, MA 02110-1301, USA.
00027 */
00028 
00029 
00030 #include <kdebug.h>
00031 
00032 namespace KPlato
00033 {
00034 
00035 void TaskAppointmentsView::clear()
00036 {
00037     if (m_appList) m_appList->clear();
00038     if (m_taskName) m_taskName->clear();
00039     if (m_plannedCost) m_plannedCost->clear();
00040     if (m_plannedCostTotal) m_plannedCostTotal->clear();
00041     if (m_actualCost) m_actualCost->clear();
00042     if (m_plannedEffort) m_plannedEffort->clear();
00043     if (m_plannedEffortTotal) m_plannedEffortTotal->clear();
00044     if (m_epi) m_epi->clear();
00045     if (m_cpi) m_cpi->clear();
00046 }
00047 
00048 void TaskAppointmentsView::draw(Task *task)
00049 {
00050     //kDebug()<<k_funcinfo<<endl;
00051     m_task = task;
00052     clear();
00053     if (!task)
00054         return;
00055     m_taskName->setText(task->name());
00056 
00057     Q3PtrListIterator<Appointment> it(task->appointments());
00058     for (; it.current(); ++it) {
00059         Resource *r = it.current()->resource();
00060         Q3ListViewItem *item = new Q3ListViewItem(m_appList, r->name());
00061  int i = 1;
00062         item->setText(i++, r->typeToString());
00063         item->setText(i++, it.current()->startTime().date().toString(Qt::ISODate));
00064         item->setText(i++, it.current()->endTime().date().toString(Qt::ISODate));
00065         item->setText(i++, it.current()->plannedEffort().toString(Duration::Format_HourFraction));
00066         item->setText(i++, KGlobal::locale()->formatMoney(r->normalRate()));
00067         item->setText(i++, KGlobal::locale()->formatMoney(r->overtimeRate()));
00068         item->setText(i++, KGlobal::locale()->formatMoney(r->fixedCost()));
00069         Q3PtrListIterator<AppointmentInterval> ait = it.current()->intervals();
00070         for (; ait.current(); ++ait) {
00071             Q3ListViewItem *sub = new Q3ListViewItem(item, "");
00072             i = 1;
00073             sub->setText(i++, "");
00074             sub->setText(i++, ait.current()->startTime().date().toString(Qt::ISODate));
00075             sub->setText(i++, ait.current()->endTime().date().toString(Qt::ISODate));
00076             sub->setText(i++, ait.current()->effort().toString(Duration::Format_HourFraction));
00077         }
00078         
00079     }
00080     drawCostEffort();
00081 }
00082 
00083 
00084 void TaskAppointmentsView::init()
00085 {
00086     m_appList->setColumnAlignment(1, Qt::AlignHCenter);
00087     m_appList->setColumnAlignment(3, Qt::AlignRight);
00088     m_appList->setColumnAlignment(4, Qt::AlignRight);
00089     m_appList->setColumnAlignment(5, Qt::AlignRight);
00090     m_appList->setColumnAlignment(6, Qt::AlignRight);
00091     
00092     m_task = 0;
00093     m_date->setDate(QDate::currentDate());
00094      
00095 }
00096 
00097 void TaskAppointmentsView::drawCostEffort()
00098 {
00099     if (m_task == 0)
00100  return;
00101     m_actualCost->setText(KGlobal::locale()->formatMoney(m_task->actualCostTo(m_date->date())));
00102     m_plannedCost->setText(KGlobal::locale()->formatMoney(m_task->plannedCostTo(m_date->date())));
00103     m_plannedCostTotal->setText(KGlobal::locale()->formatMoney(m_task->plannedCost()));
00104     
00105     m_actualEffort->setText(m_task->actualEffortTo(m_date->date()).toString(Duration::Format_HourFraction));
00106     m_plannedEffort->setText(m_task->plannedEffortTo(m_date->date()).toString(Duration::Format_HourFraction));
00107     m_plannedEffortTotal->setText(m_task->plannedEffort().toString(Duration::Format_HourFraction));
00108     
00109     m_epi->setText(QString("%1").arg(m_task->effortPerformanceIndex(m_date->date()),3,'f',2));
00110     m_cpi->setText(QString("%1").arg(m_task->costPerformanceIndex(m_date->date()),3,'f',2));
00111 
00112 }
00113 
00114 }  // KPlato namespace

Généré le Wed Nov 22 23:40:58 2006 pour KPlato par  doxygen 1.5.1-p1