24 #include "constants.h"
29 #include "atomtools.h"
31 #include <specificitemvisitor.h>
34 #include <QtXml/QDomElement>
35 #include <QtCore/QList>
36 #include <QtCore/QString>
38 namespace Syndication {
51 QList<QDomElement> a =
53 QLatin1String(
"author"));
56 QList<QDomElement>::ConstIterator it = a.constBegin();
57 QList<QDomElement>::ConstIterator end = a.constEnd();
60 for ( ; it != end; ++it)
70 QList<QDomElement> a =
72 QLatin1String(
"contributor"));
75 QList<QDomElement>::ConstIterator it = a.constBegin();
76 QList<QDomElement>::ConstIterator end = a.constEnd();
79 for ( ; it != end; ++it)
89 QList<QDomElement> a =
91 QLatin1String(
"category"));
94 QList<QDomElement>::ConstIterator it = a.constBegin();
95 QList<QDomElement>::ConstIterator end = a.constEnd();
98 for ( ; it != end; ++it)
109 QLatin1String(
"id"));
115 QList<QDomElement> a =
117 QLatin1String(
"link"));
120 QList<QDomElement>::ConstIterator it = a.constBegin();
121 QList<QDomElement>::ConstIterator end = a.constEnd();
124 for ( ; it != end; ++it)
126 list.append(
Link(*it));
140 QLatin1String(
"source")));
146 QLatin1String(
"published"));
147 return parseDate(pub, ISODate);
153 QLatin1String(
"updated"));
154 return parseDate(upd, ISODate);
170 QLatin1String(
"content")));
176 QList<ElementType> handled;
177 handled.append(ElementType(QLatin1String(
"author"),
atom1Namespace()));
178 handled.append(ElementType(QLatin1String(
"contributor"),
atom1Namespace()));
179 handled.append(ElementType(QLatin1String(
"category"),
atom1Namespace()));
180 handled.append(ElementType(QLatin1String(
"id"),
atom1Namespace()));
181 handled.append(ElementType(QLatin1String(
"link"),
atom1Namespace()));
182 handled.append(ElementType(QLatin1String(
"rights"),
atom1Namespace()));
183 handled.append(ElementType(QLatin1String(
"source"),
atom1Namespace()));
184 handled.append(ElementType(QLatin1String(
"published"),
atom1Namespace()));
185 handled.append(ElementType(QLatin1String(
"updated"),
atom1Namespace()));
186 handled.append(ElementType(QLatin1String(
"summary"),
atom1Namespace()));
187 handled.append(ElementType(QLatin1String(
"title"),
atom1Namespace()));
188 handled.append(ElementType(QLatin1String(
"content"),
atom1Namespace()));
190 QList<QDomElement> notHandled;
192 QDomNodeList children = element().childNodes();
193 for (
int i = 0; i < children.size(); ++i)
195 QDomElement el = children.at(i).toElement();
197 && !handled.contains(ElementType(el.localName(), el.namespaceURI())))
199 notHandled.append(el);
209 info += QLatin1String(
"### Entry: ###################\n");
210 if (!
title().isEmpty())
211 info += QLatin1String(
"title: #") +
title() + QLatin1String(
"#\n");
213 info += QLatin1String(
"summary: #") +
summary() + QLatin1String(
"#\n");
215 info += QLatin1String(
"id: #") +
id() + QLatin1String(
"#\n");
220 info += QLatin1String(
"rights: #") +
rights() + QLatin1String(
"#\n");
223 QString dupdated = dateTimeToString(
updated());
224 if (!dupdated.isNull())
225 info += QLatin1String(
"updated: #") + dupdated + QLatin1String(
"#\n");
227 QString dpublished = dateTimeToString(
published());
228 if (!dpublished.isNull())
229 info += QLatin1String(
"published: #") + dpublished + QLatin1String(
"#\n");
231 QList<Link> dlinks =
links();
232 QList<Link>::ConstIterator endlinks = dlinks.constEnd();
233 for (QList<Link>::ConstIterator it = dlinks.constBegin(); it != endlinks; ++it)
234 info += (*it).debugInfo();
237 QList<Category>::ConstIterator endcats = dcats.constEnd();
238 for (QList<Category>::ConstIterator it = dcats.constBegin(); it != endcats; ++it)
239 info += (*it).debugInfo();
241 info += QLatin1String(
"### Authors: ###################\n");
243 QList<Person> dauthors =
authors();
244 QList<Person>::ConstIterator endauthors = dauthors.constEnd();
245 for (QList<Person>::ConstIterator it = dauthors.constBegin(); it != endauthors; ++it)
246 info += (*it).debugInfo();
248 info += QLatin1String(
"### Contributors: ###################\n");
251 QList<Person>::ConstIterator endcontri = dcontri.constEnd();
252 for (QList<Person>::ConstIterator it = dcontri.constBegin(); it != endcontri; ++it)
253 info += (*it).debugInfo();
258 info += QLatin1String(
"### Entry end ################\n");
265 return visitor->visitAtomEntry(
this);