[Kst] kdeextragear-2/kst/kst/datasources/planck/planckview

George Staikos staikos at kde.org
Mon Oct 27 07:09:00 CET 2003


CVS commit by staikos: 

make it support all attributes, bugfix


  A            items.h   1.1 [GPL (v2+)]
  M +1 -0      planckview.ui   1.3
  M +10 -20    planckview.ui.h   1.4


--- kdeextragear-2/kst/kst/datasources/planck/planckview/planckview.ui  #1.2:1.3
@@ -246,4 +246,5 @@
 </connections>
 <includes>
+    <include location="local" impldecl="in declaration">items.h</include>
     <include location="global" impldecl="in declaration">qfile.h</include>
     <include location="global" impldecl="in implementation">qfiledialog.h</include>

--- kdeextragear-2/kst/kst/datasources/planck/planckview/planckview.ui.h  #1.3:1.4
@@ -52,18 +52,13 @@ void PlanckView::fileSave()
 
     QDomElement db = doc.createElement("database");
-    for (QListViewItemIterator i(_view); i.current(); ++i) {
+    for (QListViewItem *i = _view->firstChild(); i; i = i->nextSibling()) {
         QDomElement grp = doc.createElement("group");
-        grp.setAttribute("name", (*i)->text(0));
-        grp.setAttribute("type", (*i)->text(1));
-        grp.setAttribute("datatype", (*i)->text(2));
+        GroupItem *gi = static_cast<GroupItem*>(i);
+        (*gi) >> grp;
 
-        // Can't use QListViewItemIterator again here
-        for (QListViewItem *o = (*i)->firstChild(); o; o = o->nextSibling()) {
+        for (QListViewItem *o = i->firstChild(); o; o = o->nextSibling()) {
             QDomElement obj = doc.createElement("object");
-            obj.setAttribute("name", o->text(0));
-            obj.setAttribute("type", o->text(1));
-            obj.setAttribute("datatype", o->text(2));
-            obj.setAttribute("begin", o->text(3));
-            obj.setAttribute("end", o->text(4));
+            ObjectItem *oi = static_cast<ObjectItem*>(o);
+            (*oi) >> obj;
             grp.appendChild(obj);
         }
@@ -124,7 +119,6 @@ void PlanckView::parse( QFile *f )
                 }
 
-                QListViewItem *i = new QListViewItem(_view);
-                i->setText(0, e.attribute("name"));
-                i->setText(1, e.attribute("type"));
+                GroupItem *i = new GroupItem(_view);
+                (*i) << e;
 
                 for (QDomNode o = e.firstChild(); !o.isNull(); o = o.nextSibling()) {
@@ -135,10 +129,6 @@ void PlanckView::parse( QFile *f )
                         }
 
-                        QListViewItem *oi = new QListViewItem(i);
-                        oi->setText(0, oe.attribute("name"));
-                        oi->setText(1, oe.attribute("type"));
-                        oi->setText(2, oe.attribute("datatype"));
-                        oi->setText(3, oe.attribute("begin"));
-                        oi->setText(4, oe.attribute("end"));
+                        ObjectItem *oi = new ObjectItem(i);
+                        (*oi) << oe;
                     }
                 }




More information about the Kst mailing list