[Kst] branches/work/kst/portto4/kst/src/libkstapp
George Staikos
staikos at kde.org
Thu May 31 22:24:23 CEST 2007
SVN commit 670240 by staikos:
hook in xml stream reader, which does basically nothing. next step is to make
a factory for generating document nodes from the xml nodes.
M +27 -0 document.cpp
--- branches/work/kst/portto4/kst/src/libkstapp/document.cpp #670239:670240
@@ -12,6 +12,10 @@
#include "document.h"
#include "sessionmodel.h"
+#include <QDebug>
+#include <QFile>
+#include <QXmlStreamReader>
+
namespace Kst {
Document::Document()
@@ -31,10 +35,33 @@
bool Document::save(const QString& to) {
+ return false;
}
bool Document::open(const QString& file) {
+ QFile f(file);
+ if (!f.open(QIODevice::ReadOnly)) {
+ // QMessageBox::critical
+ return false;
+ }
+
+ QXmlStreamReader xml;
+ xml.setDevice(&f);
+
+ while (!xml.atEnd()) {
+ if (xml.isStartElement()) {
+ qDebug() << "Got a node: " << xml.name().toString();
+ }
+ xml.readNext();
+ }
+
+ if (xml.hasError()) {
+ // QMessageBox::critical
+ return false;
+ }
+
+ return true;
}
More information about the Kst
mailing list