[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    koffice/kplato
From:       Florian Piquemal <flotueur () yahoo ! fr>
Date:       2007-02-02 12:28:36
Message-ID: 1170419316.058514.29412.nullmailer () svn ! kde ! org
[Download RAW message or body]

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 <kicon.h>
-//#include <kglobal.h>
-//#include <klocale.h>
-//#include <kprinter.h>
-//#include <kxmlguifactory.h>
-//#include <kactioncollection.h>
+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 <kdebug.h>
+}
 
-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 <kactionselector.h>
 
+#include "kptpart.h"
+#include "kpttask.h"
 #include "kptcontext.h"
+#include "kpttaskeditor.h"
 #include <ui_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"
+
+#include <kicon.h>
+#include <kglobal.h>
+#include <klocale.h>
+#include <kprinter.h>
+#include <kxmlguifactory.h>
+#include <kactioncollection.h>
+
+#include <kdebug.h>
 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 @@
      <property name="handleWidth" >
       <number>6</number>
      </property>
-     <widget class="QWidget" name="" >
+     <widget class="QWidget" name="layoutWidget" >
       <layout class="QVBoxLayout" >
        <property name="margin" >
         <number>0</number>
@@ -43,10 +43,10 @@
         </widget>
        </item>
        <item>
-        <widget class="QTableWidget" name="tableTaskWidget" >
+        <widget class="QTreeWidget" name="tableTaskWidget" >
          <column>
           <property name="text" >
-           <string>Task Name</string>
+           <string>Tasks</string>
           </property>
          </column>
          <column>
@@ -58,7 +58,7 @@
        </item>
       </layout>
      </widget>
-     <widget class="QWidget" name="" >
+     <widget class="QWidget" name="layoutWidget" >
       <layout class="QVBoxLayout" >
        <property name="margin" >
         <number>0</number>
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic