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

George Staikos staikos at kde.org
Wed Nov 12 01:41:38 CET 2003


CVS commit by staikos: 

added much more editting support, and also write the DTD out properly


  A            .cvsignore   1.1
  A            planckobjecteditor.ui   1.1
  A            planckobjecteditor.ui.h   1.1 [no copyright]
  M +2 -1      planckview.pro   1.2
  M +10 -1     planckview.ui   1.4
  M +16 -1     planckview.ui.h   1.5


--- kdeextragear-2/kst/kst/datasources/planck/planckview/planckview.pro  #1.1:1.2
@@ -5,5 +5,6 @@
   OBJECTS_DIR = .obj
 }
-FORMS   = planckview.ui
+FORMS   = planckview.ui \
+        planckobjecteditor.ui
 TEMPLATE        =app
 CONFIG  += qt warn_on release

--- kdeextragear-2/kst/kst/datasources/planck/planckview/planckview.ui  #1.3:1.4
@@ -244,16 +244,24 @@
         <slot>fileExit()</slot>
     </connection>
+    <connection>
+        <sender>_view</sender>
+        <signal>doubleClicked(QListViewItem*)</signal>
+        <receiver>PlanckView</receiver>
+        <slot>edit(QListViewItem*)</slot>
+    </connection>
 </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 declaration">qdom.h</include>
     <include location="global" impldecl="in implementation">qfiledialog.h</include>
     <include location="global" impldecl="in implementation">qmessagebox.h</include>
-    <include location="global" impldecl="in implementation">qdom.h</include>
     <include location="global" impldecl="in implementation">qprogressdialog.h</include>
+    <include location="local" impldecl="in implementation">planckobjecteditor.h</include>
     <include location="local" impldecl="in implementation">planckview.ui.h</include>
 </includes>
 <variables>
     <variable access="private">QString _filename;</variable>
+    <variable access="private">QDomDocumentType _docType;</variable>
 </variables>
 <slots>
@@ -265,4 +273,5 @@
     <slot>init()</slot>
     <slot access="private">parse( QFile * f )</slot>
+    <slot access="private">edit( QListViewItem * item )</slot>
 </slots>
 <layoutdefaults spacing="4" margin="5"/>

--- kdeextragear-2/kst/kst/datasources/planck/planckview/planckview.ui.h  #1.4:1.5
@@ -43,5 +43,5 @@ void PlanckView::fileSave()
     }
 
-    QDomDocument doc;
+    QDomDocument doc(_docType);
 
     int groups = _view->childCount() + 1;
@@ -52,4 +52,5 @@ void PlanckView::fileSave()
 
     QDomElement db = doc.createElement("database");
+    
     for (QListViewItem *i = _view->firstChild(); i; i = i->nextSibling()) {
         QDomElement grp = doc.createElement("group");
@@ -107,4 +108,6 @@ void PlanckView::parse( QFile *f )
     _view->clear();
 
+    _docType = doc.doctype();
+
     for (QDomNode d = doc.firstChild(); !d.isNull(); d = d.nextSibling()) {
         if (!d.isElement() || d.toElement().tagName().lower() != "database") {
@@ -137,4 +140,16 @@ void PlanckView::parse( QFile *f )
     }
 }
+
+void PlanckView::edit( QListViewItem *item )
+{
+    ObjectItem *oi = dynamic_cast<ObjectItem*>(item);
+    if (oi) {
+        PlanckObjectEditor *e = new PlanckObjectEditor(this);
+        e->setItem(oi);
+        e->exec();
+        delete e;
+    }
+}
+
 
 // vim: ts=8 sw=4 noet





More information about the Kst mailing list