From kde-commits Fri Feb 02 12:28:36 2007 From: Florian Piquemal Date: Fri, 02 Feb 2007 12:28:36 +0000 To: kde-commits Subject: koffice/kplato Message-Id: <1170419316.058514.29412.nullmailer () svn ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=117041935911545 SVN commit 629341 by flotueur: add drawing of the project's tasks in the pert editor M +46 -25 kptperteditor.cc M +31 -4 kptperteditor.h M +4 -4 kptperteditor.ui --- trunk/koffice/kplato/kptperteditor.cc #629340:629341 @@ -19,45 +19,66 @@ */ #include "kptperteditor.h" -//#include "kptcommand.h" -//#include "kptitemmodelbase.h" -//#include "kptcalendar.h" -//#include "kptduration.h" -//#include "kptfactory.h" -//#include "kptresourceappointmentsview.h" -#include "kptview.h" -//#include "kptnode.h" -//#include "kptproject.h" -//#include "kpttask.h" -//#include "kptschedule.h" -//#include "kptdatetime.h" -//#include "kptcontext.h" +namespace KPlato +{ -//#include -//#include -//#include -//#include -//#include -//#include +void PertEditor::draw( Project &project) +{ + m_tasktree->clear(); + + foreach(Node * currentNode, project.projectNode()->childNodeIterator()){ + if (currentNode->type()!=4){ + QTreeWidgetItem * item = new QTreeWidgetItem( m_tasktree ); + item->setText( 0, currentNode->name()); + drawSubTasksName(item,currentNode); + } + //kDebug() << "[void KPlato::PertEditor::draw( Project &project )] TASK FOUNDED" << endl; + } -#include +} -namespace KPlato +void PertEditor::drawSubTasksName( QTreeWidgetItem *parent, Node * currentNode) { + if (currentNode->numChildren() > 0){ + foreach(Node * currentChild, currentNode->childNodeIterator()){ + if (currentChild->type()!=4){ + QTreeWidgetItem * item = new QTreeWidgetItem( parent ); + item->setText( 0, currentChild->name()); + drawSubTasksName( item, currentChild); + } + //kDebug() << "[void KPlato::PertEditor::draw( Project &project )] SUBTASK FOUNDED" << endl; + } + } +} + //----------------------------------- -PertEditor::PertEditor( Part *part, QWidget *parent ) - : ViewBase( part, parent ) +PertEditor::PertEditor( Part *part, QWidget *parent ) : ViewBase( part, parent ) { kDebug() << " ---------------- KPlato: Creating PertEditor ----------------" << endl; widget.setupUi(this); widget.assignList->setSelectedLabel(i18n("Required")); widget.assignList->setShowUpDownButtons(false); widget.assignList->layout()->setMargin(0); + + m_tasktree = widget.tableTaskWidget; + m_assignList = widget.assignList; + + draw( part->getProject() ); + + connect( m_tasktree, SIGNAL( itemSelectionChanged() ), SLOT( dispAvailableTasks() ) ); } -void PertEditor::setupGui() -{ +void dispAvailableTasks(){/* + QListBox * availableTasksList = new QListBox(); + + foreach(QTreeWidgetItem * currentItem, m_tasktree->selectedItems()){ + availableTasksList->insertItem(currentItem->text(0)); + }*/ + + + + } --- trunk/koffice/kplato/kptperteditor.h #629340:629341 @@ -53,9 +53,34 @@ #include +#include "kptpart.h" +#include "kpttask.h" #include "kptcontext.h" +#include "kpttaskeditor.h" #include +//#include "kptcommand.h" +//#include "kptitemmodelbase.h" +//#include "kptcalendar.h" +//#include "kptduration.h" +//#include "kptfactory.h" +//#include "kptresourceappointmentsview.h" +#include "kptview.h" +#include "kptnode.h" +//#include "kptproject.h" +//#include "kpttask.h" +//#include "kptschedule.h" +//#include "kptdatetime.h" +//#include "kptcontext.h" + +#include +#include +#include +#include +#include +#include + +#include class QPoint; class QTreeWidgetItem; class QSplitter; @@ -75,12 +100,14 @@ public: PertEditor( Part *part, QWidget *parent ); + void draw( Project &project); + void drawSubTasksName( QTreeWidgetItem *parent,Node * currentNode); + void dispAvailableTasks(); - void setupGui(); - - private: - + QTreeWidget * m_tasktree; + KActionSelector * m_assignList; + Ui::PertEditor widget; }; --- trunk/koffice/kplato/kptperteditor.ui #629340:629341 @@ -27,7 +27,7 @@ 6 - + 0 @@ -43,10 +43,10 @@ - + - Task Name + Tasks @@ -58,7 +58,7 @@ - + 0