30 #include <QtXml/qdom.h>
31 #include <QtCore/QMutableStringListIterator>
36 :
QObject(parent), m_provider(provider)
38 m_soap =
new Soap(
this);
39 connect(m_soap, SIGNAL(signalResult(QDomNode,
int)), SLOT(slotResult(QDomNode,
int)));
40 connect(m_soap, SIGNAL(
signalError()), SLOT(slotError()));
54 m_endpoint = endpoint;
60 QDomElement info = doc.createElement(
"ns:GHNSInfo");
63 m_soap->
call(info, m_endpoint.
url());
69 QDomElement info = doc.createElement(
"ns:GHNSCategories");
70 m_soap->
call(info, m_endpoint.
url());
77 QDomElement entries = doc.createElement(
"ns:GHNSList");
78 QDomElement ecategory = doc.createElement(
"category");
79 QDomText t = doc.createTextNode(category);
80 ecategory.appendChild(t);
81 entries.appendChild(ecategory);
82 if (!feed.isEmpty()) {
83 QDomElement efeed = doc.createElement(
"feed");
84 QDomText t2 = doc.createTextNode(feed);
85 efeed.appendChild(t2);
86 entries.appendChild(efeed);
88 int jobid = m_soap->
call(entries, m_endpoint.
url());
96 QDomElement comments = doc.createElement(
"ns:GHNSComments");
97 QDomElement eid = doc.createElement(
"id");
98 QDomText t = doc.createTextNode(QString::number(
id));
100 comments.appendChild(eid);
101 m_soap->
call(comments, m_endpoint.
url());
107 QDomElement changes = doc.createElement(
"ns:GHNSChanges");
108 QDomElement eid = doc.createElement(
"id");
109 QDomText t = doc.createTextNode(QString::number(
id));
111 changes.appendChild(eid);
112 m_soap->
call(changes, m_endpoint.
url());
118 QDomElement history = doc.createElement(
"ns:GHNSHistory");
119 QDomElement eid = doc.createElement(
"id");
120 QDomText t = doc.createTextNode(QString::number(
id));
122 history.appendChild(eid);
123 m_soap->
call(history, m_endpoint.
url());
129 QDomElement removal = doc.createElement(
"ns:GHNSRemoval");
130 QDomElement eid = doc.createElement(
"id");
131 QDomText t = doc.createTextNode(QString::number(
id));
133 removal.appendChild(eid);
134 m_soap->
call(removal, m_endpoint.
url());
140 QDomElement subscription = doc.createElement(
"ns:GHNSSubscription");
141 QDomElement eid = doc.createElement(
"id");
142 QDomText t = doc.createTextNode(QString::number(
id));
144 subscription.appendChild(eid);
145 QDomElement esubscribe = doc.createElement(
"subscribe");
146 QDomText t2 = doc.createTextNode((subscribe ?
"true" :
"false"));
147 esubscribe.appendChild(t2);
148 subscription.appendChild(esubscribe);
149 m_soap->
call(subscription, m_endpoint.
url());
156 QDomElement ecomment = doc.createElement(
"ns:GHNSComment");
157 QDomElement eid = doc.createElement(
"id");
158 QDomText tid = doc.createTextNode(QString::number(
id));
159 eid.appendChild(tid);
160 ecomment.appendChild(eid);
161 QDomElement ecommenttext = doc.createElement(
"comment");
162 QDomText tcomment = doc.createTextNode(comment);
163 ecommenttext.appendChild(tcomment);
164 ecomment.appendChild(ecommenttext);
165 m_soap->
call(ecomment, m_endpoint.
url());
171 QDomElement erating = doc.createElement(
"ns:GHNSRating");
172 QDomElement eid = doc.createElement(
"id");
173 QDomText tid = doc.createTextNode(QString::number(
id));
174 eid.appendChild(tid);
175 erating.appendChild(eid);
176 QDomElement eratingtext = doc.createElement(
"rating");
177 QDomText trating = doc.createTextNode(QString::number(rating));
178 eratingtext.appendChild(trating);
179 erating.appendChild(eratingtext);
180 m_soap->
call(erating, m_endpoint.
url());
183 void Dxs::slotError()
188 void Dxs::slotResult(QDomNode node,
int jobid)
193 if (m_soap->
localname(node) ==
"Fault") {
199 if (m_soap->
localname(node) ==
"GHNSInfoResponse") {
201 QString server = m_soap->
xpath(node,
"/server");
202 QString version = m_soap->
xpath(node,
"/version");
205 }
else if (m_soap->
localname(node) ==
"GHNSCategoriesResponse") {
209 for (
int i = 0; i < catlist.count(); i++) {
212 QDomNode node = catlist.at(i).toElement();
213 QString categoryname = m_soap->
xpath(node,
"/category");
214 QString icon = m_soap->
xpath(node,
"/icon");
215 QString
name = m_soap->
xpath(node,
"/name");
216 QString description = m_soap->
xpath(node,
"/description");
218 category->
setId(categoryname);
223 categories << category;
227 }
else if (m_soap->
localname(node) ==
"GHNSListResponse") {
230 Feed * thisFeed = m_jobfeeds.value(jobid);
231 QDomNode entriesNode = node.firstChild();
236 for (
int i = 0; i < entrylist.count(); i++) {
237 QDomElement element = entrylist.at(i).toElement();
238 element.setTagName(
"stuff");
248 }
else if (m_soap->
localname(node) ==
"GHNSCommentsResponse") {
249 QStringList comments;
252 for (
int i = 0; i < comlist.count(); i++) {
253 comments << comlist.at(i).toElement().text();
257 }
else if (m_soap->
localname(node) ==
"GHNSChangesResponse") {
261 for (
int i = 0; i < changelist.count(); i++) {
262 QDomNode node = changelist.at(i);
264 QString version = m_soap->
xpath(node,
"/version");
265 QString changelog = m_soap->
xpath(node,
"/changelog");
268 changes << changelog;
273 }
else if (m_soap->
localname(node) ==
"GHNSHistoryResponse") {
277 for (
int i = 0; i < entrylist.count(); i++) {
278 entries << entrylist.at(i).toElement().text();
282 }
else if (m_soap->
localname(node) ==
"GHNSRemovalResponse") {
284 }
else if (m_soap->
localname(node) ==
"GHNSSubscriptionResponse") {
286 }
else if (m_soap->
localname(node) ==
"GHNSCommentResponse") {
288 }
else if (m_soap->
localname(node) ==
"GHNSRatingResponse") {