diff options
author | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
---|---|---|
committer | tpearson <tpearson@283d02a7-25f6-0310-bc7c-ecb5cbfe19da> | 2010-07-31 19:48:06 +0000 |
commit | 47c8a359c5276062c4bc17f0e82410f29081b502 (patch) | |
tree | 2d54a5f60a5b74067632f9ef6df58c2bc38155e6 /kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.cpp | |
parent | 6f82532777a35e0e60bbd2b290b2e93e646f349b (diff) | |
download | tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.tar.gz tdenetwork-47c8a359c5276062c4bc17f0e82410f29081b502.zip |
Trinity Qt initial conversion
git-svn-id: svn://anonsvn.kde.org/home/kde/branches/trinity/kdenetwork@1157648 283d02a7-25f6-0310-bc7c-ecb5cbfe19da
Diffstat (limited to 'kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.cpp')
-rw-r--r-- | kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.cpp | 176 |
1 files changed, 88 insertions, 88 deletions
diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.cpp index e22fc12d..d7b5c82d 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_xmlcommon.cpp @@ -20,17 +20,17 @@ #include"xmpp_xmlcommon.h" -#include <qstring.h> -#include <qdom.h> -#include <qdatetime.h> -#include <qsize.h> -#include <qrect.h> -#include <qstringlist.h> -#include <qcolor.h> +#include <tqstring.h> +#include <tqdom.h> +#include <tqdatetime.h> +#include <tqsize.h> +#include <tqrect.h> +#include <tqstringlist.h> +#include <tqcolor.h> #include"im.h" -bool stamp2TS(const QString &ts, QDateTime *d) +bool stamp2TS(const TQString &ts, TQDateTime *d) { if(ts.length() != 17) return false; @@ -43,12 +43,12 @@ bool stamp2TS(const QString &ts, QDateTime *d) int min = ts.mid(12,2).toInt(); int sec = ts.mid(15,2).toInt(); - QDate xd; + TQDate xd; xd.setYMD(year, month, day); if(!xd.isValid()) return false; - QTime xt; + TQTime xt; xt.setHMS(hour, min, sec); if(!xt.isValid()) return false; @@ -59,9 +59,9 @@ bool stamp2TS(const QString &ts, QDateTime *d) return true; } -QString TS2stamp(const QDateTime &d) +TQString TS2stamp(const TQDateTime &d) { - QString str; + TQString str; str.sprintf("%04d%02d%02dT%02d:%02d:%02d", d.date().year(), @@ -74,20 +74,20 @@ QString TS2stamp(const QDateTime &d) return str; } -QDomElement textTag(QDomDocument *doc, const QString &name, const QString &content) +TQDomElement textTag(TQDomDocument *doc, const TQString &name, const TQString &content) { - QDomElement tag = doc->createElement(name); - QDomText text = doc->createTextNode(content); + TQDomElement tag = doc->createElement(name); + TQDomText text = doc->createTextNode(content); tag.appendChild(text); return tag; } -QString tagContent(const QDomElement &e) +TQString tagContent(const TQDomElement &e) { // look for some tag content - for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomText i = n.toText(); + for(TQDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomText i = n.toText(); if(i.isNull()) continue; return i.data(); @@ -96,13 +96,13 @@ QString tagContent(const QDomElement &e) return ""; } -QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found) +TQDomElement findSubTag(const TQDomElement &e, const TQString &name, bool *found) { if(found) *found = false; - for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + for(TQDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; if(i.tagName() == name) { @@ -112,13 +112,13 @@ QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found) } } - QDomElement tmp; + TQDomElement tmp; return tmp; } -QDomElement createIQ(QDomDocument *doc, const QString &type, const QString &to, const QString &id) +TQDomElement createIQ(TQDomDocument *doc, const TQString &type, const TQString &to, const TQString &id) { - QDomElement iq = doc->createElement("iq"); + TQDomElement iq = doc->createElement("iq"); if(!type.isEmpty()) iq.setAttribute("type", type); if(!to.isEmpty()) @@ -129,27 +129,27 @@ QDomElement createIQ(QDomDocument *doc, const QString &type, const QString &to, return iq; } -QDomElement queryTag(const QDomElement &e) +TQDomElement queryTag(const TQDomElement &e) { bool found; - QDomElement q = findSubTag(e, "query", &found); + TQDomElement q = findSubTag(e, "query", &found); return q; } -QString queryNS(const QDomElement &e) +TQString queryNS(const TQDomElement &e) { bool found; - QDomElement q = findSubTag(e, "query", &found); + TQDomElement q = findSubTag(e, "query", &found); if(found) return q.attribute("xmlns"); return ""; } -void getErrorFromElement(const QDomElement &e, int *code, QString *str) +void getErrorFromElement(const TQDomElement &e, int *code, TQString *str) { bool found; - QDomElement tag = findSubTag(e, "error", &found); + TQDomElement tag = findSubTag(e, "error", &found); if(!found) return; @@ -165,94 +165,94 @@ void getErrorFromElement(const QDomElement &e, int *code, QString *str) namespace XMLHelper { -QDomElement emptyTag(QDomDocument *doc, const QString &name) +TQDomElement emptyTag(TQDomDocument *doc, const TQString &name) { - QDomElement tag = doc->createElement(name); + TQDomElement tag = doc->createElement(name); return tag; } -bool hasSubTag(const QDomElement &e, const QString &name) +bool hasSubTag(const TQDomElement &e, const TQString &name) { bool found; findSubTag(e, name, &found); return found; } -QString subTagText(const QDomElement &e, const QString &name) +TQString subTagText(const TQDomElement &e, const TQString &name) { bool found; - QDomElement i = findSubTag(e, name, &found); + TQDomElement i = findSubTag(e, name, &found); if ( found ) return i.text(); - return QString::null; + return TQString::null; } -QDomElement textTag(QDomDocument &doc, const QString &name, const QString &content) +TQDomElement textTag(TQDomDocument &doc, const TQString &name, const TQString &content) { - QDomElement tag = doc.createElement(name); - QDomText text = doc.createTextNode(content); + TQDomElement tag = doc.createElement(name); + TQDomText text = doc.createTextNode(content); tag.appendChild(text); return tag; } -QDomElement textTag(QDomDocument &doc, const QString &name, int content) +TQDomElement textTag(TQDomDocument &doc, const TQString &name, int content) { - QDomElement tag = doc.createElement(name); - QDomText text = doc.createTextNode(QString::number(content)); + TQDomElement tag = doc.createElement(name); + TQDomText text = doc.createTextNode(TQString::number(content)); tag.appendChild(text); return tag; } -QDomElement textTag(QDomDocument &doc, const QString &name, bool content) +TQDomElement textTag(TQDomDocument &doc, const TQString &name, bool content) { - QDomElement tag = doc.createElement(name); - QDomText text = doc.createTextNode(content ? "true" : "false"); + TQDomElement tag = doc.createElement(name); + TQDomText text = doc.createTextNode(content ? "true" : "false"); tag.appendChild(text); return tag; } -QDomElement textTag(QDomDocument &doc, const QString &name, QSize &s) +TQDomElement textTag(TQDomDocument &doc, const TQString &name, TQSize &s) { - QString str; + TQString str; str.sprintf("%d,%d", s.width(), s.height()); - QDomElement tag = doc.createElement(name); - QDomText text = doc.createTextNode(str); + TQDomElement tag = doc.createElement(name); + TQDomText text = doc.createTextNode(str); tag.appendChild(text); return tag; } -QDomElement textTag(QDomDocument &doc, const QString &name, QRect &r) +TQDomElement textTag(TQDomDocument &doc, const TQString &name, TQRect &r) { - QString str; + TQString str; str.sprintf("%d,%d,%d,%d", r.x(), r.y(), r.width(), r.height()); - QDomElement tag = doc.createElement(name); - QDomText text = doc.createTextNode(str); + TQDomElement tag = doc.createElement(name); + TQDomText text = doc.createTextNode(str); tag.appendChild(text); return tag; } -QDomElement stringListToXml(QDomDocument &doc, const QString &name, const QStringList &l) +TQDomElement stringListToXml(TQDomDocument &doc, const TQString &name, const TQStringList &l) { - QDomElement tag = doc.createElement(name); - for(QStringList::ConstIterator it = l.begin(); it != l.end(); ++it) + TQDomElement tag = doc.createElement(name); + for(TQStringList::ConstIterator it = l.begin(); it != l.end(); ++it) tag.appendChild(textTag(doc, "item", *it)); return tag; } -/*QString tagContent(const QDomElement &e) +/*TQString tagContent(const TQDomElement &e) { // look for some tag content - for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomText i = n.toText(); + for(TQDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomText i = n.toText(); if(i.isNull()) continue; return i.data(); @@ -261,13 +261,13 @@ QDomElement stringListToXml(QDomDocument &doc, const QString &name, const QStrin return ""; }*/ -/*QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found) +/*TQDomElement findSubTag(const TQDomElement &e, const TQString &name, bool *found) { if(found) *found = FALSE; - for(QDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + for(TQDomNode n = e.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; if(i.tagName() == name) { @@ -277,62 +277,62 @@ QDomElement stringListToXml(QDomDocument &doc, const QString &name, const QStrin } } - QDomElement tmp; + TQDomElement tmp; return tmp; }*/ -void readEntry(const QDomElement &e, const QString &name, QString *v) +void readEntry(const TQDomElement &e, const TQString &name, TQString *v) { bool found = FALSE; - QDomElement tag = findSubTag(e, name, &found); + TQDomElement tag = findSubTag(e, name, &found); if(!found) return; *v = tagContent(tag); } -void readNumEntry(const QDomElement &e, const QString &name, int *v) +void readNumEntry(const TQDomElement &e, const TQString &name, int *v) { bool found = FALSE; - QDomElement tag = findSubTag(e, name, &found); + TQDomElement tag = findSubTag(e, name, &found); if(!found) return; *v = tagContent(tag).toInt(); } -void readBoolEntry(const QDomElement &e, const QString &name, bool *v) +void readBoolEntry(const TQDomElement &e, const TQString &name, bool *v) { bool found = FALSE; - QDomElement tag = findSubTag(e, name, &found); + TQDomElement tag = findSubTag(e, name, &found); if(!found) return; *v = (tagContent(tag) == "true") ? TRUE: FALSE; } -void readSizeEntry(const QDomElement &e, const QString &name, QSize *v) +void readSizeEntry(const TQDomElement &e, const TQString &name, TQSize *v) { bool found = FALSE; - QDomElement tag = findSubTag(e, name, &found); + TQDomElement tag = findSubTag(e, name, &found); if(!found) return; - QStringList list = QStringList::split(',', tagContent(tag)); + TQStringList list = TQStringList::split(',', tagContent(tag)); if(list.count() != 2) return; - QSize s; + TQSize s; s.setWidth(list[0].toInt()); s.setHeight(list[1].toInt()); *v = s; } -void readRectEntry(const QDomElement &e, const QString &name, QRect *v) +void readRectEntry(const TQDomElement &e, const TQString &name, TQRect *v) { bool found = FALSE; - QDomElement tag = findSubTag(e, name, &found); + TQDomElement tag = findSubTag(e, name, &found); if(!found) return; - QStringList list = QStringList::split(',', tagContent(tag)); + TQStringList list = TQStringList::split(',', tagContent(tag)); if(list.count() != 4) return; - QRect r; + TQRect r; r.setX(list[0].toInt()); r.setY(list[1].toInt()); r.setWidth(list[2].toInt()); @@ -340,27 +340,27 @@ void readRectEntry(const QDomElement &e, const QString &name, QRect *v) *v = r; } -void readColorEntry(const QDomElement &e, const QString &name, QColor *v) +void readColorEntry(const TQDomElement &e, const TQString &name, TQColor *v) { bool found = FALSE; - QDomElement tag = findSubTag(e, name, &found); + TQDomElement tag = findSubTag(e, name, &found); if(!found) return; - QColor c; + TQColor c; c.setNamedColor(tagContent(tag)); if(c.isValid()) *v = c; } -void xmlToStringList(const QDomElement &e, const QString &name, QStringList *v) +void xmlToStringList(const TQDomElement &e, const TQString &name, TQStringList *v) { bool found = false; - QDomElement tag = findSubTag(e, name, &found); + TQDomElement tag = findSubTag(e, name, &found); if(!found) return; - QStringList list; - for(QDomNode n = tag.firstChild(); !n.isNull(); n = n.nextSibling()) { - QDomElement i = n.toElement(); + TQStringList list; + for(TQDomNode n = tag.firstChild(); !n.isNull(); n = n.nextSibling()) { + TQDomElement i = n.toElement(); if(i.isNull()) continue; if(i.tagName() == "item") @@ -369,15 +369,15 @@ void xmlToStringList(const QDomElement &e, const QString &name, QStringList *v) *v = list; } -void setBoolAttribute(QDomElement e, const QString &name, bool b) +void setBoolAttribute(TQDomElement e, const TQString &name, bool b) { e.setAttribute(name, b ? "true" : "false"); } -void readBoolAttribute(QDomElement e, const QString &name, bool *v) +void readBoolAttribute(TQDomElement e, const TQString &name, bool *v) { if(e.hasAttribute(name)) { - QString s = e.attribute(name); + TQString s = e.attribute(name); *v = (s == "true") ? TRUE: FALSE; } } |