Changeset View
Changeset View
Standalone View
Standalone View
src/kdeeduglossary.cpp
Show First 20 Lines • Show All 226 Lines • ▼ Show 20 Line(s) | 226 | { | |||
---|---|---|---|---|---|
227 | QList<GlossaryItem*> list; | 227 | QList<GlossaryItem*> list; | ||
228 | 228 | | |||
229 | QDomNodeList itemList; | 229 | QDomNodeList itemList; | ||
230 | QDomNodeList refNodeList; | 230 | QDomNodeList refNodeList; | ||
231 | QDomElement itemElement; | 231 | QDomElement itemElement; | ||
232 | QStringList reflist; | 232 | QStringList reflist; | ||
233 | 233 | | |||
234 | itemList = itemDocument.elementsByTagName("item"); | 234 | itemList = itemDocument.elementsByTagName("item"); | ||
235 | const int num = itemList.count(); | ||||
235 | 236 | | |||
236 | const uint num = itemList.count(); | 237 | for (int i = 0; i < num; ++i) { | ||
pino: or, simpler, turn both `num` and `i` to int, since the only usage of `i` is with `QDomNodeList… | |||||
237 | for (uint i = 0; i < num; ++i) { | | |||
238 | reflist.clear(); | 238 | reflist.clear(); | ||
239 | GlossaryItem *item = new GlossaryItem(); | 239 | GlossaryItem *item = new GlossaryItem(); | ||
240 | 240 | | |||
241 | itemElement = (const QDomElement&) itemList.item(i).toElement(); | 241 | itemElement = itemList.item(i).toElement(); | ||
QDomNode::toElement() already returns a QDomElement, so this cast can go away altogether pino: `QDomNode::toElement()` already returns a QDomElement, so this cast can go away altogether | |||||
242 | 242 | | |||
243 | QDomNode nameNode = itemElement.namedItem("name"); | 243 | QDomNode nameNode = itemElement.namedItem("name"); | ||
244 | QDomNode descNode = itemElement.namedItem("desc"); | 244 | QDomNode descNode = itemElement.namedItem("desc"); | ||
245 | 245 | | |||
246 | QString picName = itemElement.namedItem("picture").toElement().text(); | 246 | QString picName = itemElement.namedItem("picture").toElement().text(); | ||
247 | QDomElement refNode = (const QDomElement&) itemElement.namedItem("references").toElement(); | 247 | QDomElement refNode = itemElement.namedItem("references").toElement(); | ||
pino: ditto | |||||
248 | 248 | | |||
249 | QString desc = i18n(descNode.toElement().text().toUtf8()); | 249 | QString desc = i18n(descNode.toElement().text().toUtf8()); | ||
250 | if (!picName.isEmpty()) { | 250 | if (!picName.isEmpty()) { | ||
251 | desc.prepend("[img]" + picName + "[/img][brclear][br]"); | 251 | desc.prepend("[img]" + picName + "[/img][brclear][br]"); | ||
252 | } | 252 | } | ||
253 | 253 | | |||
254 | item->setName(i18n(nameNode.toElement().text().toUtf8())); | 254 | item->setName(i18n(nameNode.toElement().text().toUtf8())); | ||
255 | 255 | | |||
▲ Show 20 Lines • Show All 293 Lines • Show Last 20 Lines |
or, simpler, turn both num and i to int, since the only usage of i is with QDomNodeList::item(int)