diff options
-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)); } } |