summaryrefslogtreecommitdiffstats
path: root/src/common/global/xml_data_file.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/common/global/xml_data_file.cpp')
-rw-r--r--src/common/global/xml_data_file.cpp108
1 files changed, 54 insertions, 54 deletions
diff --git a/src/common/global/xml_data_file.cpp b/src/common/global/xml_data_file.cpp
index 2464b34..30d42cd 100644
--- a/src/common/global/xml_data_file.cpp
+++ b/src/common/global/xml_data_file.cpp
@@ -8,25 +8,25 @@
***************************************************************************/
#include "xml_data_file.h"
-#include <qfile.h>
-#include <qstringlist.h>
+#include <tqfile.h>
+#include <tqstringlist.h>
#include <ksimpleconfig.h>
#include <klocale.h>
#include "common/global/pfile.h"
-XmlDataFile::XmlDataFile(const PURL::Url &url, const QString &name)
+XmlDataFile::XmlDataFile(const PURL::Url &url, const TQString &name)
: _url(url), _name(name), _document(name)
{
- QDomElement root = _document.createElement(name);
+ TQDomElement root = _document.createElement(name);
_document.appendChild(root);
}
-bool XmlDataFile::load(QString &error)
+bool XmlDataFile::load(TQString &error)
{
Log::StringView sview;
PURL::File file(_url, sview);
if ( !file.openForRead() ) {
- error = i18n("Error opening file: %1").arg(sview.string());
+ error = i18n("Error opening file: %1").tqarg(sview.string());
return false;
}
if ( !_document.setContent(file.qfile(), false, &error) ) return false;
@@ -38,122 +38,122 @@ bool XmlDataFile::load(QString &error)
return true;
}
-bool XmlDataFile::save(QString &error) const
+bool XmlDataFile::save(TQString &error) const
{
Log::StringView sview;
PURL::File file(_url, sview);
bool ok = file.openForWrite();
if (ok) {
- QString s = _document.toString(2);
+ TQString s = _document.toString(2);
file.appendText(s);
ok = file.close();
}
- if ( !ok ) error = i18n("Error saving file: %1").arg(sview.string());
+ if ( !ok ) error = i18n("Error saving file: %1").tqarg(sview.string());
return ok;
}
-QDomElement XmlDataFile::findChildElement(QDomElement parent, const QString &name) const
+TQDomElement XmlDataFile::findChildElement(TQDomElement tqparent, const TQString &name) const
{
- QDomNodeList list = parent.elementsByTagName(name);
+ TQDomNodeList list = tqparent.elementsByTagName(name);
return list.item(0).toElement();
}
-QDomElement XmlDataFile::createChildElement(QDomElement parent, const QString &name)
+TQDomElement XmlDataFile::createChildElement(TQDomElement tqparent, const TQString &name)
{
- QDomNodeList list = parent.elementsByTagName(name);
+ TQDomNodeList list = tqparent.elementsByTagName(name);
if ( list.count()==0 ) {
- QDomElement element = _document.createElement(name);
- parent.appendChild(element);
+ TQDomElement element = _document.createElement(name);
+ tqparent.appendChild(element);
return element;
}
return list.item(0).toElement();
}
-void XmlDataFile::removeChilds(QDomNode parent) const
+void XmlDataFile::removeChilds(TQDomNode tqparent) const
{
- QDomNodeList list = parent.childNodes();
+ TQDomNodeList list = tqparent.childNodes();
for (uint i=0; i<list.count(); i++)
- parent.removeChild(list.item(i));
+ tqparent.removeChild(list.item(i));
}
-QString XmlDataFile::value(const QString &group, const QString &key, const QString &defValue) const
+TQString XmlDataFile::value(const TQString &group, const TQString &key, const TQString &defValue) const
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = findChildElement(root, group);
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = findChildElement(root, group);
if ( groupElement.isNull() ) return defValue;
- QDomElement element = findChildElement(groupElement, key);
+ TQDomElement element = findChildElement(groupElement, key);
if ( element.isNull() ) return defValue;
- QDomText text = element.firstChild().toText();
+ TQDomText text = element.firstChild().toText();
if ( text.isNull() ) return defValue;
return text.data();
}
-void XmlDataFile::setValue(const QString &group, const QString &key, const QString &value)
+void XmlDataFile::setValue(const TQString &group, const TQString &key, const TQString &value)
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = createChildElement(root, group);
- QDomElement element = createChildElement(groupElement, key);
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = createChildElement(root, group);
+ TQDomElement element = createChildElement(groupElement, key);
removeChilds(element);
- QDomText text = _document.createTextNode(value);
+ TQDomText text = _document.createTextNode(value);
element.appendChild(text);
}
-QStringList XmlDataFile::listValues(const QString &group, const QString &key, const QStringList &defaultValues) const
+TQStringList XmlDataFile::listValues(const TQString &group, const TQString &key, const TQStringList &defaultValues) const
{
- QStringList list;
- QDomElement root = _document.documentElement();
- QDomElement groupElement = findChildElement(root, group);
+ TQStringList list;
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = findChildElement(root, group);
if ( groupElement.isNull() ) return defaultValues;
- QDomElement element = findChildElement(groupElement, key);
+ TQDomElement element = findChildElement(groupElement, key);
if ( element.isNull() ) return defaultValues;
- QDomNodeList childs = element.childNodes();
+ TQDomNodeList childs = element.childNodes();
if ( childs.count()==1 ) { // legacy compatibility
- QDomText text = element.firstChild().toText();
+ TQDomText text = element.firstChild().toText();
if ( !text.isNull() ) return text.data();
}
for (uint i=0; i<childs.count(); i++) {
- QDomText text = childs.item(i).toElement().firstChild().toText();
+ TQDomText text = childs.item(i).toElement().firstChild().toText();
if ( text.isNull() ) continue;
list.append(text.data());
}
return list;
}
-void XmlDataFile::appendListValue(const QString &group, const QString &key, const QString &value)
+void XmlDataFile::appendListValue(const TQString &group, const TQString &key, const TQString &value)
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = createChildElement(root, group);
- QDomElement element = createChildElement(groupElement, key);
- QDomElement item = _document.createElement("item");
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = createChildElement(root, group);
+ TQDomElement element = createChildElement(groupElement, key);
+ TQDomElement item = _document.createElement("item");
element.appendChild(item);
- QDomText text = _document.createTextNode(value);
+ TQDomText text = _document.createTextNode(value);
item.appendChild(text);
}
-void XmlDataFile::removeListValue(const QString &group, const QString &key, const QString &value)
+void XmlDataFile::removeListValue(const TQString &group, const TQString &key, const TQString &value)
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = createChildElement(root, group);
- QDomElement element = createChildElement(groupElement, key);
- QDomNodeList list = element.childNodes();
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = createChildElement(root, group);
+ TQDomElement element = createChildElement(groupElement, key);
+ TQDomNodeList list = element.childNodes();
for (uint i=0; i<list.count(); i++) {
- QDomElement item = list.item(i).toElement();
- QDomText text = item.firstChild().toText();
+ TQDomElement item = list.item(i).toElement();
+ TQDomText text = item.firstChild().toText();
if ( text.isNull() || text.data()!=value ) continue;
element.removeChild(item);
break;
}
}
-void XmlDataFile::clearList(const QString &group, const QString &key)
+void XmlDataFile::clearList(const TQString &group, const TQString &key)
{
- QDomElement root = _document.documentElement();
- QDomElement groupElement = createChildElement(root, group);
- QDomElement element = createChildElement(groupElement, key);
+ TQDomElement root = _document.documentElement();
+ TQDomElement groupElement = createChildElement(root, group);
+ TQDomElement element = createChildElement(groupElement, key);
groupElement.removeChild(element);
}
-void XmlDataFile::setListValues(const QString &group, const QString &key, const QStringList &values)
+void XmlDataFile::setListValues(const TQString &group, const TQString &key, const TQStringList &values)
{
clearList(group, key);
for (uint i=0; i<values.count(); i++) appendListValue(group, key, values[i]);