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_vcard.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_vcard.cpp')
-rw-r--r-- | kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_vcard.cpp | 294 |
1 files changed, 147 insertions, 147 deletions
diff --git a/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_vcard.cpp b/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_vcard.cpp index e79d9b9f..5f5214fd 100644 --- a/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_vcard.cpp +++ b/kopete/protocols/jabber/libiris/iris/xmpp-im/xmpp_vcard.cpp @@ -22,30 +22,30 @@ #include "base64.h" -#include <qdom.h> -#include <qdatetime.h> +#include <tqdom.h> +#include <tqdatetime.h> -#include <qimage.h> // needed for image format recognition -#include <qbuffer.h> +#include <tqimage.h> // needed for image format recognition +#include <tqbuffer.h> // Justin's XML helper functions -static QDomElement textTag(QDomDocument *doc, const QString &name, const QString &content) +static 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; } -static QDomElement findSubTag(const QDomElement &e, const QString &name, bool *found) +static 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().upper() == name.upper()) { // mblsha: ignore case when searching @@ -55,33 +55,33 @@ static QDomElement findSubTag(const QDomElement &e, const QString &name, bool *f } } - QDomElement tmp; + TQDomElement tmp; return tmp; } // mblsha's own functions -static QDomElement emptyTag(QDomDocument *doc, const QString &name) +static TQDomElement emptyTag(TQDomDocument *doc, const TQString &name) { - QDomElement tag = doc->createElement(name); + TQDomElement tag = doc->createElement(name); return tag; } -static bool hasSubTag(const QDomElement &e, const QString &name) +static bool hasSubTag(const TQDomElement &e, const TQString &name) { bool found; findSubTag(e, name, &found); return found; } -static QString subTagText(const QDomElement &e, const QString &name) +static 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().stripWhiteSpace(); - return QString::null; + return TQString::null; } using namespace XMPP; @@ -89,11 +89,11 @@ using namespace XMPP; //---------------------------------------------------------------------------- // VCard //---------------------------------------------------------------------------- -static QString image2type(const QByteArray &ba) +static TQString image2type(const TQByteArray &ba) { - QBuffer buf(ba); + TQBuffer buf(ba); buf.open(IO_ReadOnly); - QString format = QImageIO::imageFormat( &buf ); + TQString format = TQImageIO::imageFormat( &buf ); // TODO: add more formats if ( format == "PNG" || format == "PsiPNG" ) @@ -117,9 +117,9 @@ static QString image2type(const QByteArray &ba) } // Long lines of encoded binary data SHOULD BE folded to 75 characters using the folding method defined in [MIME-DIR]. -static QString foldString(const QString &s) +static TQString foldString(const TQString &s) { - QString ret; + TQString ret; for (int i = 0; i < (int)s.length(); i++) { if ( !(i % 75) ) @@ -136,47 +136,47 @@ public: Private(); ~Private(); - QString version; - QString fullName; - QString familyName, givenName, middleName, prefixName, suffixName; - QString nickName; + TQString version; + TQString fullName; + TQString familyName, givenName, middleName, prefixName, suffixName; + TQString nickName; - QByteArray photo; - QString photoURI; + TQByteArray photo; + TQString photoURI; - QString bday; + TQString bday; AddressList addressList; LabelList labelList; PhoneList phoneList; EmailList emailList; - QString jid; - QString mailer; - QString timezone; + TQString jid; + TQString mailer; + TQString timezone; Geo geo; - QString title; - QString role; + TQString title; + TQString role; - QByteArray logo; - QString logoURI; + TQByteArray logo; + TQString logoURI; VCard *agent; - QString agentURI; + TQString agentURI; Org org; - QStringList categories; - QString note; - QString prodId; - QString rev; - QString sortString; - - QByteArray sound; - QString soundURI, soundPhonetic; - - QString uid; - QString url; - QString desc; + TQStringList categories; + TQString note; + TQString prodId; + TQString rev; + TQString sortString; + + TQByteArray sound; + TQString soundURI, soundPhonetic; + + TQString uid; + TQString url; + TQString desc; PrivacyClass privacyClass; - QByteArray key; + TQByteArray key; bool isEmpty(); }; @@ -263,9 +263,9 @@ VCard::~VCard() delete d; } -QDomElement VCard::toXml(QDomDocument *doc) const +TQDomElement VCard::toXml(TQDomDocument *doc) const { - QDomElement v = doc->createElement("vCard"); + TQDomElement v = doc->createElement("vCard"); v.setAttribute("version", "2.0"); v.setAttribute("prodid", "-//HandGen//NONSGML vGen v1.0//EN"); v.setAttribute("xmlns", "vcard-temp"); @@ -277,7 +277,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const if ( !d->familyName.isEmpty() || !d->givenName.isEmpty() || !d->middleName.isEmpty() || !d->prefixName.isEmpty() || !d->suffixName.isEmpty() ) { - QDomElement w = doc->createElement("N"); + TQDomElement w = doc->createElement("N"); if ( !d->familyName.isEmpty() ) w.appendChild( textTag(doc, "FAMILY", d->familyName) ); @@ -297,7 +297,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const v.appendChild( textTag(doc, "NICKNAME", d->nickName) ); if ( !d->photo.isEmpty() || !d->photoURI.isEmpty() ) { - QDomElement w = doc->createElement("PHOTO"); + TQDomElement w = doc->createElement("PHOTO"); if ( !d->photo.isEmpty() ) { w.appendChild( textTag(doc, "TYPE", image2type(d->photo)) ); @@ -315,7 +315,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const if ( !d->addressList.isEmpty() ) { AddressList::Iterator it = d->addressList.begin(); for ( ; it != d->addressList.end(); ++it ) { - QDomElement w = doc->createElement("ADR"); + TQDomElement w = doc->createElement("ADR"); Address a = *it; if ( a.home ) @@ -355,7 +355,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const if ( !d->labelList.isEmpty() ) { LabelList::Iterator it = d->labelList.begin(); for ( ; it != d->labelList.end(); ++it ) { - QDomElement w = doc->createElement("LABEL"); + TQDomElement w = doc->createElement("LABEL"); Label l = *it; if ( l.home ) @@ -374,7 +374,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const w.appendChild( emptyTag(doc, "PREF") ); if ( !l.lines.isEmpty() ) { - QStringList::Iterator it = l.lines.begin(); + TQStringList::Iterator it = l.lines.begin(); for ( ; it != l.lines.end(); ++it ) w.appendChild( textTag(doc, "LINE", *it) ); } @@ -386,7 +386,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const if ( !d->phoneList.isEmpty() ) { PhoneList::Iterator it = d->phoneList.begin(); for ( ; it != d->phoneList.end(); ++it ) { - QDomElement w = doc->createElement("TEL"); + TQDomElement w = doc->createElement("TEL"); Phone p = *it; if ( p.home ) @@ -426,7 +426,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const if ( !d->emailList.isEmpty() ) { EmailList::Iterator it = d->emailList.begin(); for ( ; it != d->emailList.end(); ++it ) { - QDomElement w = doc->createElement("EMAIL"); + TQDomElement w = doc->createElement("EMAIL"); Email e = *it; if ( e.home ) @@ -453,7 +453,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const v.appendChild( textTag(doc, "TZ", d->timezone) ); if ( !d->geo.lat.isEmpty() || !d->geo.lon.isEmpty() ) { - QDomElement w = doc->createElement("GEO"); + TQDomElement w = doc->createElement("GEO"); if ( !d->geo.lat.isEmpty() ) w.appendChild( textTag(doc, "LAT", d->geo.lat) ); @@ -469,7 +469,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const v.appendChild( textTag(doc, "ROLE", d->role) ); if ( !d->logo.isEmpty() || !d->logoURI.isEmpty() ) { - QDomElement w = doc->createElement("LOGO"); + TQDomElement w = doc->createElement("LOGO"); if ( !d->logo.isEmpty() ) { w.appendChild( textTag(doc, "TYPE", image2type(d->logo)) ); @@ -482,7 +482,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const } if ( !d->agentURI.isEmpty() || (d->agent && d->agent->isEmpty()) ) { - QDomElement w = doc->createElement("AGENT"); + TQDomElement w = doc->createElement("AGENT"); if ( d->agent && !d->agent->isEmpty() ) w.appendChild( d->agent->toXml(doc) ); @@ -493,13 +493,13 @@ QDomElement VCard::toXml(QDomDocument *doc) const } if ( !d->org.name.isEmpty() || !d->org.unit.isEmpty() ) { - QDomElement w = doc->createElement("ORG"); + TQDomElement w = doc->createElement("ORG"); if ( !d->org.name.isEmpty() ) w.appendChild( textTag(doc, "ORGNAME", d->org.name) ); if ( !d->org.unit.isEmpty() ) { - QStringList::Iterator it = d->org.unit.begin(); + TQStringList::Iterator it = d->org.unit.begin(); for ( ; it != d->org.unit.end(); ++it ) w.appendChild( textTag(doc, "ORGUNIT", *it) ); } @@ -508,9 +508,9 @@ QDomElement VCard::toXml(QDomDocument *doc) const } if ( !d->categories.isEmpty() ) { - QDomElement w = doc->createElement("CATEGORIES"); + TQDomElement w = doc->createElement("CATEGORIES"); - QStringList::Iterator it = d->categories.begin(); + TQStringList::Iterator it = d->categories.begin(); for ( ; it != d->categories.end(); ++it ) w.appendChild( textTag(doc, "KEYWORD", *it) ); @@ -527,7 +527,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const v.appendChild( textTag(doc, "SORT-STRING", d->sortString) ); if ( !d->sound.isEmpty() || !d->soundURI.isEmpty() || !d->soundPhonetic.isEmpty() ) { - QDomElement w = doc->createElement("SOUND"); + TQDomElement w = doc->createElement("SOUND"); if ( !d->sound.isEmpty() ) w.appendChild( textTag(doc, "BINVAL", foldString( Base64::arrayToString(d->sound)) ) ); @@ -547,7 +547,7 @@ QDomElement VCard::toXml(QDomDocument *doc) const v.appendChild( textTag(doc, "DESC", d->desc) ); if ( d->privacyClass != pcNone ) { - QDomElement w = doc->createElement("CLASS"); + TQDomElement w = doc->createElement("CLASS"); if ( d->privacyClass == pcPublic ) w.appendChild( emptyTag(doc, "PUBLIC") ); @@ -560,11 +560,11 @@ QDomElement VCard::toXml(QDomDocument *doc) const } if ( !d->key.isEmpty() ) { - QDomElement w = doc->createElement("KEY"); + TQDomElement w = doc->createElement("KEY"); // TODO: Justin, please check out this code w.appendChild( textTag(doc, "TYPE", "text/plain")); // FIXME - w.appendChild( textTag(doc, "CRED", QString::fromUtf8(d->key)) ); // FIXME + w.appendChild( textTag(doc, "CRED", TQString::fromUtf8(d->key)) ); // FIXME v.appendChild(w); } @@ -572,21 +572,21 @@ QDomElement VCard::toXml(QDomDocument *doc) const return v; } -bool VCard::fromXml(const QDomElement &q) +bool VCard::fromXml(const TQDomElement &q) { if ( q.tagName().upper() != "VCARD" ) return false; - QDomNode n = q.firstChild(); + TQDomNode n = q.firstChild(); for ( ; !n.isNull(); n = n.nextSibling() ) { - QDomElement i = n.toElement(); + TQDomElement i = n.toElement(); if ( i.isNull() ) continue; - QString tag = i.tagName().upper(); + TQString tag = i.tagName().upper(); bool found; - QDomElement e; + TQDomElement e; if ( tag == "VERSION" ) d->version = i.text().stripWhiteSpace(); @@ -647,9 +647,9 @@ bool VCard::fromXml(const QDomElement &q) l.intl = hasSubTag(i, "INTL"); l.pref = hasSubTag(i, "PREF"); - QDomNode nn = i.firstChild(); + TQDomNode nn = i.firstChild(); for ( ; !nn.isNull(); nn = nn.nextSibling() ) { - QDomElement ii = nn.toElement(); + TQDomElement ii = nn.toElement(); if ( ii.isNull() ) continue; @@ -734,9 +734,9 @@ bool VCard::fromXml(const QDomElement &q) else if ( tag == "ORG" ) { d->org.name = subTagText(i, "ORGNAME"); - QDomNode nn = i.firstChild(); + TQDomNode nn = i.firstChild(); for ( ; !nn.isNull(); nn = nn.nextSibling() ) { - QDomElement ii = nn.toElement(); + TQDomElement ii = nn.toElement(); if ( ii.isNull() ) continue; @@ -745,9 +745,9 @@ bool VCard::fromXml(const QDomElement &q) } } else if ( tag == "CATEGORIES") { - QDomNode nn = i.firstChild(); + TQDomNode nn = i.firstChild(); for ( ; !nn.isNull(); nn = nn.nextSibling() ) { - QDomElement ee = nn.toElement(); + TQDomElement ee = nn.toElement(); if ( ee.isNull() ) continue; @@ -785,7 +785,7 @@ bool VCard::fromXml(const QDomElement &q) else if ( tag == "KEY" ) { // TODO: Justin, please check out this code e = findSubTag(i, "TYPE", &found); - QString type = "text/plain"; + TQString type = "text/plain"; if ( found ) type = e.text().stripWhiteSpace(); @@ -838,122 +838,122 @@ VCard::Org::Org() // vCard properties... -const QString &VCard::version() const +const TQString &VCard::version() const { return d->version; } -void VCard::setVersion(const QString &v) +void VCard::setVersion(const TQString &v) { d->version = v; } -const QString &VCard::fullName() const +const TQString &VCard::fullName() const { return d->fullName; } -void VCard::setFullName(const QString &n) +void VCard::setFullName(const TQString &n) { d->fullName = n; } -const QString &VCard::familyName() const +const TQString &VCard::familyName() const { return d->familyName; } -void VCard::setFamilyName(const QString &n) +void VCard::setFamilyName(const TQString &n) { d->familyName = n; } -const QString &VCard::givenName() const +const TQString &VCard::givenName() const { return d->givenName; } -void VCard::setGivenName(const QString &n) +void VCard::setGivenName(const TQString &n) { d->givenName = n; } -const QString &VCard::middleName() const +const TQString &VCard::middleName() const { return d->middleName; } -void VCard::setMiddleName(const QString &n) +void VCard::setMiddleName(const TQString &n) { d->middleName = n; } -const QString &VCard::prefixName() const +const TQString &VCard::prefixName() const { return d->prefixName; } -void VCard::setPrefixName(const QString &p) +void VCard::setPrefixName(const TQString &p) { d->prefixName = p; } -const QString &VCard::suffixName() const +const TQString &VCard::suffixName() const { return d->suffixName; } -void VCard::setSuffixName(const QString &s) +void VCard::setSuffixName(const TQString &s) { d->suffixName = s; } -const QString &VCard::nickName() const +const TQString &VCard::nickName() const { return d->nickName; } -void VCard::setNickName(const QString &n) +void VCard::setNickName(const TQString &n) { d->nickName = n; } -const QByteArray &VCard::photo() const +const TQByteArray &VCard::photo() const { return d->photo; } -void VCard::setPhoto(const QByteArray &i) +void VCard::setPhoto(const TQByteArray &i) { d->photo = i; } -const QString &VCard::photoURI() const +const TQString &VCard::photoURI() const { return d->photoURI; } -void VCard::setPhotoURI(const QString &p) +void VCard::setPhotoURI(const TQString &p) { d->photoURI = p; } -const QDate VCard::bday() const +const TQDate VCard::bday() const { - return QDate::fromString(d->bday); + return TQDate::fromString(d->bday); } -void VCard::setBday(const QDate &date) +void VCard::setBday(const TQDate &date) { d->bday = date.toString(); } -const QString &VCard::bdayStr() const +const TQString &VCard::bdayStr() const { return d->bday; } -void VCard::setBdayStr(const QString &date) +void VCard::setBdayStr(const TQString &date) { d->bday = date; } @@ -998,32 +998,32 @@ void VCard::setEmailList(const VCard::EmailList &e) d->emailList = e; } -const QString &VCard::jid() const +const TQString &VCard::jid() const { return d->jid; } -void VCard::setJid(const QString &j) +void VCard::setJid(const TQString &j) { d->jid = j; } -const QString &VCard::mailer() const +const TQString &VCard::mailer() const { return d->mailer; } -void VCard::setMailer(const QString &m) +void VCard::setMailer(const TQString &m) { d->mailer = m; } -const QString &VCard::timezone() const +const TQString &VCard::timezone() const { return d->timezone; } -void VCard::setTimezone(const QString &t) +void VCard::setTimezone(const TQString &t) { d->timezone = t; } @@ -1038,42 +1038,42 @@ void VCard::setGeo(const VCard::Geo &g) d->geo = g; } -const QString &VCard::title() const +const TQString &VCard::title() const { return d->title; } -void VCard::setTitle(const QString &t) +void VCard::setTitle(const TQString &t) { d->title = t; } -const QString &VCard::role() const +const TQString &VCard::role() const { return d->role; } -void VCard::setRole(const QString &r) +void VCard::setRole(const TQString &r) { d->role = r; } -const QByteArray &VCard::logo() const +const TQByteArray &VCard::logo() const { return d->logo; } -void VCard::setLogo(const QByteArray &i) +void VCard::setLogo(const TQByteArray &i) { d->logo = i; } -const QString &VCard::logoURI() const +const TQString &VCard::logoURI() const { return d->logoURI; } -void VCard::setLogoURI(const QString &l) +void VCard::setLogoURI(const TQString &l) { d->logoURI = l; } @@ -1090,12 +1090,12 @@ void VCard::setAgent(const VCard &v) *(d->agent) = v; } -const QString VCard::agentURI() const +const TQString VCard::agentURI() const { return d->agentURI; } -void VCard::setAgentURI(const QString &a) +void VCard::setAgentURI(const TQString &a) { d->agentURI = a; } @@ -1110,112 +1110,112 @@ void VCard::setOrg(const VCard::Org &o) d->org = o; } -const QStringList &VCard::categories() const +const TQStringList &VCard::categories() const { return d->categories; } -void VCard::setCategories(const QStringList &c) +void VCard::setCategories(const TQStringList &c) { d->categories = c; } -const QString &VCard::note() const +const TQString &VCard::note() const { return d->note; } -void VCard::setNote(const QString &n) +void VCard::setNote(const TQString &n) { d->note = n; } -const QString &VCard::prodId() const +const TQString &VCard::prodId() const { return d->prodId; } -void VCard::setProdId(const QString &p) +void VCard::setProdId(const TQString &p) { d->prodId = p; } -const QString &VCard::rev() const +const TQString &VCard::rev() const { return d->rev; } -void VCard::setRev(const QString &r) +void VCard::setRev(const TQString &r) { d->rev = r; } -const QString &VCard::sortString() const +const TQString &VCard::sortString() const { return d->sortString; } -void VCard::setSortString(const QString &s) +void VCard::setSortString(const TQString &s) { d->sortString = s; } -const QByteArray &VCard::sound() const +const TQByteArray &VCard::sound() const { return d->sound; } -void VCard::setSound(const QByteArray &s) +void VCard::setSound(const TQByteArray &s) { d->sound = s; } -const QString &VCard::soundURI() const +const TQString &VCard::soundURI() const { return d->soundURI; } -void VCard::setSoundURI(const QString &s) +void VCard::setSoundURI(const TQString &s) { d->soundURI = s; } -const QString &VCard::soundPhonetic() const +const TQString &VCard::soundPhonetic() const { return d->soundPhonetic; } -void VCard::setSoundPhonetic(const QString &s) +void VCard::setSoundPhonetic(const TQString &s) { d->soundPhonetic = s; } -const QString &VCard::uid() const +const TQString &VCard::uid() const { return d->uid; } -void VCard::setUid(const QString &u) +void VCard::setUid(const TQString &u) { d->uid = u; } -const QString &VCard::url() const +const TQString &VCard::url() const { return d->url; } -void VCard::setUrl(const QString &u) +void VCard::setUrl(const TQString &u) { d->url = u; } -const QString &VCard::desc() const +const TQString &VCard::desc() const { return d->desc; } -void VCard::setDesc(const QString &desc) +void VCard::setDesc(const TQString &desc) { d->desc = desc; } @@ -1230,12 +1230,12 @@ void VCard::setPrivacyClass(const VCard::PrivacyClass &c) d->privacyClass = c; } -const QByteArray &VCard::key() const +const TQByteArray &VCard::key() const { return d->key; } -void VCard::setKey(const QByteArray &k) +void VCard::setKey(const TQByteArray &k) { d->key = k; } |