diff options
author | Jan Darmochwal | 2010-11-04 21:20:29 +0100 |
---|---|---|
committer | Jan Darmochwal | 2010-11-04 21:20:29 +0100 |
commit | 2473bc86466fd5642efb2c4f81714c04d2943b73 (patch) | |
tree | f66340da36146954dcb0b5a3b74d27a1063528cd /src | |
parent | Removed some TODO comments (diff) | |
download | vmchooser-2473bc86466fd5642efb2c4f81714c04d2943b73.tar.gz vmchooser-2473bc86466fd5642efb2c4f81714c04d2943b73.tar.xz vmchooser-2473bc86466fd5642efb2c4f81714c04d2943b73.zip |
Fix for issue #781
This patch fixes issue #781 (http://lab.openslx.org/issues/781).
Vmchooser wrote bad .xml files.
Diffstat (limited to 'src')
-rw-r--r-- | src/vsession.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/src/vsession.cpp b/src/vsession.cpp index e2e359a..31602ed 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -47,7 +47,16 @@ QString VSession::icon() const { } QString VSession::toXml() const { - return this->doc_.toString(); + QDomDocument doc; + doc.appendChild(doc.createElement("settings")); + + doc.firstChild().appendChild(doc.importNode(doc_.documentElement(), true)); + + QDomNode xmlNode = doc.createProcessingInstruction( + "xml", "version=\"1.0\" encoding=\"UTF-8\""); + doc.insertBefore(xmlNode, doc.firstChild()); + + return doc.toString(); } QString VSession::getAttribute(const QString &nodeName, @@ -203,12 +212,9 @@ void VSession::mergePoolXml() { QFile file(poolXmlFile); if (!file.open(QIODevice::ReadOnly)) { - printf("mark a\n"); return; } if (!doc.setContent(&file)) { - printf("mark b\n"); - file.close(); return; } @@ -217,14 +223,11 @@ void VSession::mergePoolXml() { for (QDomElement envNode(doc.firstChildElement("environment")); !envNode.isNull(); envNode = envNode.nextSiblingElement()) { - printf("mark c\n"); - if (envNode.attribute("param") != pool) continue; for (QDomElement typeNode(envNode.firstChildElement()); !typeNode.isNull(); typeNode = typeNode.nextSiblingElement()) { - printf("mark d\n"); QString type = typeNode.nodeName(); if (type != "shared_folders" && type != "printers" && @@ -242,7 +245,6 @@ void VSession::mergePoolXml() { for (QDomElement el(typeNode.firstChildElement()); !el.isNull(); el = el.nextSiblingElement()) { - printf("mark e\n"); destinationNode.appendChild(this->doc_.importNode(el, true)); } } |