summaryrefslogtreecommitdiffstats
path: root/src/vsession.cpp
diff options
context:
space:
mode:
authorJan Darmochwal2010-10-06 11:01:33 +0200
committerJan Darmochwal2010-10-06 11:01:33 +0200
commit87916ccf71bd35f41a84c1e8f0fe211b5279c558 (patch)
tree1e24297ade776b151d163db7e48081a9fa63a613 /src/vsession.cpp
parenti18n support and German translation (diff)
downloadvmchooser-87916ccf71bd35f41a84c1e8f0fe211b5279c558.tar.gz
vmchooser-87916ccf71bd35f41a84c1e8f0fe211b5279c558.tar.xz
vmchooser-87916ccf71bd35f41a84c1e8f0fe211b5279c558.zip
Remove debug printfs
Diffstat (limited to 'src/vsession.cpp')
-rw-r--r--src/vsession.cpp30
1 files changed, 1 insertions, 29 deletions
diff --git a/src/vsession.cpp b/src/vsession.cpp
index 35292d2..bd86610 100644
--- a/src/vsession.cpp
+++ b/src/vsession.cpp
@@ -15,8 +15,6 @@
#include "vsession.h"
bool VSession::init(const QString& xml, const QString& baseDirPath) {
- printf("VSession::init(xml, %s)\n", baseDirPath.toAscii().data());
- //printf("xml = %s\n", xml.toAscii().data());
this->baseDirPath_ = baseDirPath;
return this->doc_.setContent(xml);
}
@@ -25,24 +23,15 @@ void VSession::addNodeWithAttribute(const QString& nodeName,
const QString& value,
const QString& attribute,
bool replace) {
-
- printf("VSession:addNodeWithAttribute(%s, %s, %s, %d)\n",
- nodeName.toUtf8().data(),
- value.toUtf8().data(),
- attribute.toUtf8().data(),
- replace);
-
QDomElement node =
this->doc_.namedItem("eintrag").namedItem(nodeName).toElement();
if (replace == false || node.isNull()) {
- printf(" creating new node\n");
// create a new node
node = this->doc_.createElement(nodeName);
this->doc_.namedItem("eintrag").appendChild(node);
}
- printf(" setting attribute\n");
node.setAttribute(attribute, value);
}
@@ -52,19 +41,12 @@ QString VSession::toXml() const {
QString VSession::getAttribute(const QString &nodeName,
const QString &attribute) const {
- printf ("VSession::getAttribute(%s, %s)\n", nodeName.toAscii().data(), attribute.toAscii().data());
QDomDocument doc = this->doc_;
- //printf (" doc xml:\n%s\n", doc.toString().toAscii().data());
QDomNode n = doc.namedItem("eintrag").namedItem(nodeName);
if (n.isNull()) {
- printf(" failed to find node\n");
+ // TODO
}
- printf(" node name: %s\n", n.nodeName().toAscii().data());
- printf(" node type: %d\n", n.nodeType());
- printf(" node value: %s\n", n.nodeValue().toAscii().data());
- printf(" attribute %s=%s\n", attribute.toUtf8().data(), this->doc_.namedItem("eintrag").namedItem(nodeName).toElement().attribute(attribute).toUtf8().data());
- //printf (" --> %s\n", this->doc_.namedItem("eintrag").namedItem(nodeName).namedItem(attribute).toAttr().value());
return this->doc_.namedItem("eintrag").namedItem(nodeName).toElement().attribute(attribute);
}
@@ -174,7 +156,6 @@ void VSession::addScanners(const QString& script) {
}
void VSession::addUserAndHostname() {
- printf("VSession::addUserAndHostname()\n");
QString username(getpwuid(geteuid())->pw_name);
this->addNodeWithAttribute("username", username);
@@ -199,8 +180,6 @@ void VSession::addUserAndHostname() {
}
bool VSession::run() const {
-
- printf("VSession::run()\n");
QString command = getAttribute("command");
if (! command.isEmpty()) {
if (QProcess::startDetached(command)) {
@@ -242,19 +221,16 @@ bool VSession::run() const {
}
QList<Session*> VSession::readXmlFile(const QString& filepath) {
- printf("VSession::readXmlFile(%s)\n", filepath.toAscii().data());
QList<Session*> retval;
QDomDocument doc;
QFile file(filepath);
if (!file.open(QIODevice::ReadOnly)) {
// TODO: error message
- printf("error: cannot open file\n");
return retval;
}
if (!doc.setContent(&file)) {
// TODO: error message
- printf("error: cannot parse file\n");
file.close();
return retval;
}
@@ -266,12 +242,10 @@ QList<Session*> VSession::readXmlFile(const QString& filepath) {
for (QDomElement el(settingsNode.firstChildElement("eintrag"));
!el.isNull();
el = el.nextSiblingElement("eintrag")) {
- printf("reading %s node\n", el.tagName().toAscii().data());
QDomDocument dummy;
dummy.appendChild(dummy.importNode(el, true));
VSession* e = new VSession;
if (e->init(dummy.toString(), dirName)) {
- printf("appending node\n");
retval.append(e);
}
}
@@ -284,7 +258,6 @@ QList<Session*> VSession::readXmlFile(const QString& filepath) {
* - reads all xml files and creates for each its own VSession-struct
*/
QList<Session*> VSession::readXmlDir(const QString& path) {
- printf("VSession::readXmlDir(%s)\n", path.toAscii().data());
QList<Session*> retval;
QDir appDir(QApplication::applicationDirPath());
@@ -310,7 +283,6 @@ QList<Session*> VSession::readXmlDir(const QString& path) {
}
}
- printf("VSession::readXmlDir(%s), read %d entries\n", path.toAscii().data(), retval.size());
return retval;
}