summaryrefslogtreecommitdiffstats
path: root/akregator/src/librss/tools_p.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'akregator/src/librss/tools_p.cpp')
-rw-r--r--akregator/src/librss/tools_p.cpp116
1 files changed, 58 insertions, 58 deletions
diff --git a/akregator/src/librss/tools_p.cpp b/akregator/src/librss/tools_p.cpp
index dec831814..41996fd8f 100644
--- a/akregator/src/librss/tools_p.cpp
+++ b/akregator/src/librss/tools_p.cpp
@@ -11,13 +11,13 @@
#include "tools_p.h"
#include <krfcdate.h>
-#include <qdom.h>
+#include <tqdom.h>
#include <kcharsets.h>
-#include <qregexp.h>
+#include <tqregexp.h>
namespace RSS {
-time_t parseISO8601Date(const QString &s)
+time_t parseISO8601Date(const TQString &s)
{
// do some sanity check: 26-12-2004T00:00+00:00 is parsed to epoch+1 in the KRFCDate, which is wrong. So let's check if the date begins with YYYY -fo
if (s.stripWhiteSpace().left(4).toInt() < 1000)
@@ -30,19 +30,19 @@ time_t parseISO8601Date(const QString &s)
return KRFCDate::parseDateISO8601(s + "T12:00:00");
}
-QString childNodesAsXML(const QDomNode& parent)
+TQString childNodesAsXML(const TQDomNode& parent)
{
- QDomNodeList list = parent.childNodes();
- QString str;
- QTextStream ts( &str, IO_WriteOnly );
+ TQDomNodeList list = parent.childNodes();
+ TQString str;
+ TQTextStream ts( &str, IO_WriteOnly );
for (uint i = 0; i < list.count(); ++i)
ts << list.item(i);
return str.stripWhiteSpace();
}
-static QString plainTextToHtml(const QString& plainText)
+static TQString plainTextToHtml(const TQString& plainText)
{
- QString str(plainText);
+ TQString str(plainText);
str.replace("&", "&amp;");
str.replace("\"", "&quot;");
str.replace("<", "&lt;");
@@ -53,46 +53,46 @@ static QString plainTextToHtml(const QString& plainText)
enum ContentFormat { Text, HTML, XML, Binary };
-static ContentFormat mapTypeToFormat(const QString& modep, const QString& typep, const QString& src)
+static ContentFormat mapTypeToFormat(const TQString& modep, const TQString& typep, const TQString& src)
{
- QString mode = modep.isNull() ? "escaped" : modep;
- QString type = typep;
+ TQString mode = modep.isNull() ? "escaped" : modep;
+ TQString type = typep;
//"If neither the type attribute nor the src attribute is provided,
//Atom Processors MUST behave as though the type attribute were
//present with a value of "text""
if (type.isNull() && src.isEmpty())
- type = QString::fromUtf8("text");
+ type = TQString::fromUtf8("text");
- if (type == QString::fromUtf8("html")
- || type == QString::fromUtf8("text/html"))
+ if (type == TQString::fromUtf8("html")
+ || type == TQString::fromUtf8("text/html"))
return HTML;
- if (type == QString::fromUtf8("text")
- || (type.startsWith(QString::fromUtf8("text/"), false)
- && !type.startsWith(QString::fromUtf8("text/xml"), false))
+ if (type == TQString::fromUtf8("text")
+ || (type.startsWith(TQString::fromUtf8("text/"), false)
+ && !type.startsWith(TQString::fromUtf8("text/xml"), false))
)
return Text;
- QStringList xmltypes;
- xmltypes.append(QString::fromUtf8("xhtml"));
+ TQStringList xmltypes;
+ xmltypes.append(TQString::fromUtf8("xhtml"));
// XML media types as defined in RFC3023:
- xmltypes.append(QString::fromUtf8("text/xml"));
- xmltypes.append(QString::fromUtf8("application/xml"));
- xmltypes.append(QString::fromUtf8("text/xml-external-parsed-entity"));
- xmltypes.append(QString::fromUtf8("application/xml-external-parsed-entity"));
- xmltypes.append(QString::fromUtf8("application/xml-dtd"));
+ xmltypes.append(TQString::fromUtf8("text/xml"));
+ xmltypes.append(TQString::fromUtf8("application/xml"));
+ xmltypes.append(TQString::fromUtf8("text/xml-external-parsed-entity"));
+ xmltypes.append(TQString::fromUtf8("application/xml-external-parsed-entity"));
+ xmltypes.append(TQString::fromUtf8("application/xml-dtd"));
if (xmltypes.contains(type)
- || type.endsWith(QString::fromUtf8("+xml"), false)
- || type.endsWith(QString::fromUtf8("/xml"), false))
+ || type.endsWith(TQString::fromUtf8("+xml"), false)
+ || type.endsWith(TQString::fromUtf8("/xml"), false))
return XML;
return Binary;
}
-static QString extractAtomContent(const QDomElement& e)
+static TQString extractAtomContent(const TQDomElement& e)
{
ContentFormat format = mapTypeToFormat(e.attribute("mode"),
e.attribute("type"),
@@ -111,20 +111,20 @@ static QString extractAtomContent(const QDomElement& e)
return childNodesAsXML(e).simplifyWhiteSpace();
case Binary:
default:
- return QString();
+ return TQString();
}
- return QString();
+ return TQString();
}
-QString extractNode(const QDomNode &parent, const QString &elemName, bool isInlined)
+TQString extractNode(const TQDomNode &parent, const TQString &elemName, bool isInlined)
{
- QDomNode node = parent.namedItem(elemName);
+ TQDomNode node = parent.namedItem(elemName);
if (node.isNull())
- return QString::null;
+ return TQString::null;
- QDomElement e = node.toElement();
- QString result = e.text().stripWhiteSpace(); // let's assume plain text
+ TQDomElement e = node.toElement();
+ TQString result = e.text().stripWhiteSpace(); // let's assume plain text
if (elemName == "content") // we have Atom here
{
@@ -135,47 +135,47 @@ QString extractNode(const QDomNode &parent, const QString &elemName, bool isInli
bool hasPre = result.contains("<pre>", false) || result.contains("<pre ", false);
bool hasHtml = hasPre || result.contains("<"); // FIXME: test if we have html, should be more clever -> regexp
if(!isInlined && !hasHtml) // perform nl2br if not a inline elt and it has no html elts
- result = result = result.replace(QChar('\n'), "<br />");
+ result = result = result.replace(TQChar('\n'), "<br />");
if(!hasPre) // strip white spaces if no <pre>
result = result.simplifyWhiteSpace();
}
- return result.isEmpty() ? QString::null : result;
+ return result.isEmpty() ? TQString::null : result;
}
-QString extractTitle(const QDomNode & parent)
+TQString extractTitle(const TQDomNode & parent)
{
- QDomNode node = parent.namedItem(QString::fromLatin1("title"));
+ TQDomNode node = parent.namedItem(TQString::fromLatin1("title"));
if (node.isNull())
- return QString::null;
+ return TQString::null;
- QString result = node.toElement().text();
+ TQString result = node.toElement().text();
- result = KCharsets::resolveEntities(KCharsets::resolveEntities(result).replace(QRegExp("<[^>]*>"), "").remove("\\"));
+ result = KCharsets::resolveEntities(KCharsets::resolveEntities(result).replace(TQRegExp("<[^>]*>"), "").remove("\\"));
result = result.simplifyWhiteSpace();
if (result.isEmpty())
- return QString::null;
+ return TQString::null;
return result;
}
-static void authorFromString(const QString& strp, QString& name, QString& email)
+static void authorFromString(const TQString& strp, TQString& name, TQString& email)
{
- QString str = strp.stripWhiteSpace();
+ TQString str = strp.stripWhiteSpace();
if (str.isEmpty())
return;
// look for something looking like a mail address ( "[email protected]",
// "<[email protected]>") and extract it
- QRegExp remail("<?([^@\\s<]+@[^>\\s]+)>?"); // FIXME: user "proper" regexp,
+ TQRegExp remail("<?([^@\\s<]+@[^>\\s]+)>?"); // FIXME: user "proper" regexp,
// search kmail source for it
int pos = remail.search(str);
if (pos != -1)
{
- QString all = remail.cap(0);
+ TQString all = remail.cap(0);
email = remail.cap(1);
str.replace(all, ""); // remove mail address
}
@@ -190,7 +190,7 @@ static void authorFromString(const QString& strp, QString& name, QString& email)
// str is of the format "Foo M. Bar (President)",
// we should not cut anything.
- QRegExp rename("^\\(([^\\)]*)\\)");
+ TQRegExp rename("^\\(([^\\)]*)\\)");
pos = rename.search(name);
@@ -199,32 +199,32 @@ static void authorFromString(const QString& strp, QString& name, QString& email)
name = rename.cap(1);
}
- name = name.isEmpty() ? QString() : name;
- email = email.isEmpty() ? QString() : email;
+ name = name.isEmpty() ? TQString() : name;
+ email = email.isEmpty() ? TQString() : email;
}
-QString parseItemAuthor(const QDomElement& element, Format format, Version version)
+TQString parseItemAuthor(const TQDomElement& element, Format format, Version version)
{
- QString name;
- QString email;
+ TQString name;
+ TQString email;
- QDomElement dcCreator = element.namedItem("dc:creator").toElement();
+ TQDomElement dcCreator = element.namedItem("dc:creator").toElement();
if (!dcCreator.isNull())
authorFromString(dcCreator.text(), name, email);
else if (format == AtomFeed)
{
- QDomElement atomAuthor = element.namedItem("author").toElement();
+ TQDomElement atomAuthor = element.namedItem("author").toElement();
if (atomAuthor.isNull())
atomAuthor = element.namedItem("atom:author").toElement();
if (!atomAuthor.isNull())
{
- QDomElement atomName = atomAuthor.namedItem("name").toElement();
+ TQDomElement atomName = atomAuthor.namedItem("name").toElement();
if (atomName.isNull())
atomName = atomAuthor.namedItem("atom:name").toElement();
name = atomName.text().stripWhiteSpace();
- QDomElement atomEmail = atomAuthor.namedItem("email").toElement();
+ TQDomElement atomEmail = atomAuthor.namedItem("email").toElement();
if (atomEmail.isNull())
atomEmail = atomAuthor.namedItem("atom:email").toElement();
email = atomEmail.text().stripWhiteSpace();
@@ -239,7 +239,7 @@ QString parseItemAuthor(const QDomElement& element, Format format, Version versi
name = email;
if (!email.isNull())
- return QString("<a href=\"mailto:%1\">%2</a>").arg(email).arg(name);
+ return TQString("<a href=\"mailto:%1\">%2</a>").arg(email).arg(name);
else
return name;
}