From e7e9cf2849d0000acf47ecde86e4853687a03409 Mon Sep 17 00:00:00 2001 From: Jan Darmochwal Date: Thu, 7 Oct 2010 16:56:12 +0200 Subject: Tidy up the code * fixed compiler warnings, added -Werror to CMakeLists.txt * removed LibXml2 and boost stuff from CMakeLists.txt * fixed some things cpplint.py complains about: * make single-argument constructors explicit * add space before if/for/while/... * don't put { on a line of its own * remove space after ! operator * add space between // and comment * remove extra space before ( in function call * remove extra space before ) * shorten lines to <= 80 characters * remove blank lines at the start of a code block * maybe others --- src/vsession.cpp | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'src/vsession.cpp') diff --git a/src/vsession.cpp b/src/vsession.cpp index f3d2604..bcd13b0 100644 --- a/src/vsession.cpp +++ b/src/vsession.cpp @@ -47,7 +47,8 @@ QString VSession::getAttribute(const QString &nodeName, // TODO } - return this->doc_.namedItem("eintrag").namedItem(nodeName).toElement().attribute(attribute); + return this->doc_.namedItem("eintrag").namedItem(nodeName).toElement() + .attribute(attribute); } QString VSession::getNodeText(const QString& nodeName) const { @@ -124,21 +125,22 @@ void VSession::addPrinters(const QString& script, const QString& type) { QProcess addPrintersScript; addPrintersScript.start(script, QIODevice::ReadOnly); - while (! addPrintersScript.atEnd()) { + while (!addPrintersScript.atEnd()) { QString line(addPrintersScript.readLine()); QStringList tokens(line.split("\t")); if (tokens.size() < 2 or tokens.size() > 3) { // TODO error message // invalid output of printerScript - //printserver\tprinter\tprinter description + // printserver\tprinter\tprinter description continue; } // TODO: check return values, exceptions, ... QDomElement printerNode(doc_.createElement(type)); printerNode.setAttribute("name", tokens.at(1)); - printerNode.setAttribute("path", "\\\\" + tokens.at(0) + "\\" + tokens.at(1)); + printerNode.setAttribute("path", + "\\\\" + tokens.at(0) + "\\" + tokens.at(1)); if (tokens.size() == 3) { QDomText printerDescriptionNode(doc_.createTextNode(tokens.at(3))); printerNode.appendChild(printerDescriptionNode); @@ -160,7 +162,7 @@ void VSession::addUserAndHostname() { this->addNodeWithAttribute("username", username); // Qt >= 4.7 has - //QString hostname(QHostInfo::localHostName()); + // QString hostname(QHostInfo::localHostName()); char hname[HOST_NAME_MAX + 1]; gethostname(hname, HOST_NAME_MAX); QString hostname(hname); @@ -181,7 +183,7 @@ void VSession::addUserAndHostname() { bool VSession::run() const { QString command = getAttribute("command"); - if (! command.isEmpty()) { + if (!command.isEmpty()) { if (QProcess::startDetached(command)) { // TODO: save session return true; @@ -199,7 +201,7 @@ bool VSession::run() const { session.addUserAndHostname(); // TODO: read the group configuration XML - //session.readGroupXml(&dat, env); + // session.readGroupXml(&dat, env); // write xml to temporary file QTemporaryFile tmpfile(QDir::tempPath() + "/vmchooser-XXXXXX.xml"); @@ -267,7 +269,7 @@ QList VSession::readXmlDir(const QString& path) { QProcess myFilterScript; myFilterScript.start(appDir.filePath(filterscript), QStringList(path), QIODevice::ReadOnly); - while (! myFilterScript.atEnd()) { + while (!myFilterScript.atEnd()) { QString filename(myFilterScript.readLine()); if (QDir::isRelativePath(filename)) { filename.prepend(path + "/"); @@ -282,7 +284,7 @@ QList VSession::readXmlDir(const QString& path) { QDirIterator di(path, QDirIterator::Subdirectories | QDirIterator::FollowSymlinks); - while(di.hasNext()) { + while (di.hasNext()) { if (!di.next().endsWith(".xml")) continue; retval.append(readXmlFile(di.fileInfo().absoluteFilePath())); } -- cgit v1.2.3-55-g7522