KNewStuff

entryinternal.cpp
1 /*
2  This file is part of KNewStuff2.
3  SPDX-FileCopyrightText: 2002 Cornelius Schumacher <[email protected]>
4  SPDX-FileCopyrightText: 2003-2007 Josef Spillner <[email protected]>
5  SPDX-FileCopyrightText: 2009 Frederik Gladhorn <[email protected]>
6 
7  SPDX-License-Identifier: LGPL-2.1-or-later
8 */
9 
10 #include "entryinternal.h"
11 
12 #include <QStringList>
13 #include <QXmlStreamReader>
14 #include <knewstuffcore_debug.h>
15 
16 #include "xmlloader.h"
17 #include "../entry_p.h" // For Entry::Status ONLY!
18 
19 
20 using namespace KNSCore;
21 
22 class EntryInternal::Private : public QSharedData
23 {
24 public:
25  Private()
26  : mReleaseDate(QDate::currentDate())
27  , mRating(0)
28  , mNumberOfComments(0)
29  , mDownloadCount(0)
30  , mNumberFans(0)
31  , mNumberKnowledgebaseEntries(0)
32  , mStatus(KNS3::Entry::Invalid)
33  , mSource(EntryInternal::Online)
34  {
35  qRegisterMetaType<KNSCore::EntryInternal::List>();
36  }
37 
38  bool operator==(const Private &other) const
39  {
40  return mUniqueId == other.mUniqueId && mProviderId == other.mProviderId;
41  }
42 
43  QString mUniqueId;
44  QString mName;
45  QUrl mHomepage;
46  QString mCategory;
47  QString mLicense;
48  QString mVersion;
49  QDate mReleaseDate;
50 
51  // Version and date if a newer version is found (updateable)
52  QString mUpdateVersion;
53  QDate mUpdateReleaseDate;
54 
55  Author mAuthor;
56  int mRating;
57  int mNumberOfComments;
58  int mDownloadCount;
59  int mNumberFans;
60  int mNumberKnowledgebaseEntries;
61  QString mKnowledgebaseLink;
62  QString mSummary;
63  QString mShortSummary;
64  QString mChangelog;
65  QString mPayload;
66  QStringList mInstalledFiles;
67  QString mProviderId;
68  QStringList mUnInstalledFiles;
69  QString mDonationLink;
70  QStringList mTags;
71 
72  QString mChecksum;
73  QString mSignature;
74  KNS3::Entry::Status mStatus;
75  EntryInternal::Source mSource;
76 
77  QString mPreviewUrl[6];
78  QImage mPreviewImage[6];
79 
80  QList<EntryInternal::DownloadLinkInformation> mDownloadLinkInformationList;
81 };
82 
84  : d(new Private)
85 {
86 }
87 
89  : d(other.d)
90 {
91 }
92 
93 EntryInternal &EntryInternal::operator=(const EntryInternal &other)
94 {
95  d = other.d;
96  return *this;
97 }
98 
99 bool EntryInternal::operator<(const KNSCore::EntryInternal &other) const
100 {
101  return d->mUniqueId < other.d->mUniqueId;
102 }
103 
104 bool EntryInternal::operator==(const KNSCore::EntryInternal &other) const
105 {
106  return d->mUniqueId == other.d->mUniqueId && d->mProviderId == other.d->mProviderId;
107 }
108 
110 {
111 }
112 
113 bool EntryInternal::isValid() const
114 {
115  return !d->mUniqueId.isEmpty();
116 }
117 
119 {
120  return d->mName;
121 }
122 
124 {
125  d->mName = name;
126 }
127 
129 {
130  return d->mUniqueId;
131 }
132 
134 {
135  d->mUniqueId = id;
136 }
137 
139 {
140  return d->mProviderId;
141 }
142 
143 void EntryInternal::setProviderId(const QString &id)
144 {
145  d->mProviderId = id;
146 }
147 
149 {
150  return d->mTags;
151 }
152 
154 {
155  d->mTags = tags;
156 }
157 
159 {
160  return d->mCategory;
161 }
162 
164 {
165  d->mCategory = category;
166 }
167 
169 {
170  return d->mHomepage;
171 }
172 
174 {
175  d->mHomepage = page;
176 }
177 
179 {
180  return d->mAuthor;
181 }
182 
184 {
185  d->mAuthor = author;
186 }
187 
189 {
190  return d->mLicense;
191 }
192 
194 {
195  d->mLicense = license;
196 }
197 
199 {
200  return d->mSummary;
201 }
202 
204 {
205  d->mSummary = summary;
206 }
207 
209 {
210  return d->mShortSummary;
211 }
212 
214 {
215  d->mShortSummary = summary;
216 }
217 
218 void EntryInternal::setChangelog(const QString &changelog)
219 {
220  d->mChangelog = changelog;
221 }
222 
223 QString EntryInternal::changelog() const
224 {
225  return d->mChangelog;
226 }
227 
229 {
230  return d->mVersion;
231 }
232 
234 {
235  d->mVersion = version;
236 }
237 
239 {
240  return d->mReleaseDate;
241 }
242 
243 void EntryInternal::setReleaseDate(const QDate &releasedate)
244 {
245  d->mReleaseDate = releasedate;
246 }
247 
249 {
250  return d->mPayload;
251 }
252 
254 {
255  d->mPayload = url;
256 }
257 
259 {
260  return d->mUpdateReleaseDate;
261 }
262 
264 {
265  d->mUpdateReleaseDate = releasedate;
266 }
267 
269 {
270  return d->mUpdateVersion;
271 }
272 
274 {
275  d->mUpdateVersion = version;
276 }
277 
278 QString EntryInternal::previewUrl(PreviewType type) const
279 {
280  return d->mPreviewUrl[type];
281 }
282 
283 void EntryInternal::setPreviewUrl(const QString &url, PreviewType type)
284 {
285  d->mPreviewUrl[type] = url;
286 }
287 
288 QImage EntryInternal::previewImage(PreviewType type) const
289 {
290  return d->mPreviewImage[type];
291 }
292 
293 void EntryInternal::setPreviewImage(const QImage &image, PreviewType type)
294 {
295  d->mPreviewImage[type] = image;
296 }
297 
299 {
300  return d->mRating;
301 }
302 
304 {
305  d->mRating = rating;
306 }
307 
309 {
310  return d->mNumberOfComments;
311 }
312 
314 {
315  d->mNumberOfComments = comments;
316 }
317 
319 {
320  return d->mDownloadCount;
321 }
322 
324 {
325  d->mDownloadCount = downloads;
326 }
327 
329 {
330  return d->mNumberFans;
331 }
332 
334 {
335  d->mNumberFans = fans;
336 }
337 
339 {
340  return d->mDonationLink;
341 }
342 
344 {
345  d->mDonationLink = link;
346 }
347 
349 {
350  return d->mNumberKnowledgebaseEntries;
351 }
353 {
354  d->mNumberKnowledgebaseEntries = num;
355 }
356 
358 {
359  return d->mKnowledgebaseLink;
360 }
362 {
363  d->mKnowledgebaseLink = link;
364 }
365 
366 EntryInternal::Source EntryInternal::source() const
367 {
368  return d->mSource;
369 }
370 
372 {
373  d->mSource = source;
374 }
375 
377 {
378  return d->mStatus;
379 }
380 
382 {
383  d->mStatus = status;
384 }
385 
387 {
388  d->mInstalledFiles = files;
389 }
390 
392 {
393  return d->mInstalledFiles;
394 }
395 
397 {
398  d->mUnInstalledFiles = files;
399 }
400 
402 {
403  return d->mUnInstalledFiles;
404 }
405 
407 {
408  return d->mDownloadLinkInformationList.size();
409 }
410 
412 {
413  return d->mDownloadLinkInformationList;
414 }
415 
416 void KNSCore::EntryInternal::appendDownloadLinkInformation(const KNSCore::EntryInternal::DownloadLinkInformation &info)
417 {
418  d->mDownloadLinkInformationList.append(info);
419 }
420 
422 {
423  d->mDownloadLinkInformationList.clear();
424 }
425 
426 static QXmlStreamReader::TokenType readNextSkipComments(QXmlStreamReader* xml)
427 {
428  do {
429  xml->readNext();
430  } while(xml->tokenType() == QXmlStreamReader::Comment || (xml->tokenType() == QXmlStreamReader::Characters && xml->text().trimmed().isEmpty()));
431  return xml->tokenType();
432 }
433 
434 static QStringRef readText(QXmlStreamReader* xml)
435 {
436  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
437  QStringRef ret;
438  const auto token = readNextSkipComments(xml);
439  if (token == QXmlStreamReader::Characters) {
440  ret = xml->text();
441  }
442  return ret;
443 }
444 
445 static QString readStringTrimmed(QXmlStreamReader* xml)
446 {
447  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
448  QString ret = readText(xml).trimmed().toString();
449 
451  readNextSkipComments(xml);
452  Q_ASSERT(xml->tokenType() == QXmlStreamReader::EndElement);
453  return ret;
454 }
455 
456 static int readInt(QXmlStreamReader* xml)
457 {
458  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
459  int ret = readText(xml).toInt();
460 
461  xml->readNext();
462  Q_ASSERT(xml->tokenType() == QXmlStreamReader::EndElement);
463  return ret;
464 }
465 
467 {
468  if (reader.name() != QLatin1String("stuff")) {
469  qCWarning(KNEWSTUFFCORE) << "Parsing Entry from invalid XML. Reader tag name was expected to be \"stuff\", but was found as:" << reader.name();
470  return false;
471  }
472 
473  d->mCategory = reader.attributes().value(QStringLiteral("category")).toString();
474 
475  while (!reader.atEnd()) {
476  const auto token = readNextSkipComments(&reader);
477  if (token == QXmlStreamReader::EndElement)
478  break;
479  else if (token != QXmlStreamReader::StartElement)
480  continue;
481 
482  if (reader.name() == QLatin1String("name")) {
483  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
485  } else if (reader.name() == QLatin1String("author")) {
486  const auto email = reader.attributes().value(QStringLiteral("email"));
487  const auto jabber = reader.attributes().value(QStringLiteral("im"));
488  const auto homepage = reader.attributes().value(QStringLiteral("homepage"));
489  d->mAuthor.setName(readStringTrimmed(&reader));
490  d->mAuthor.setEmail(email.toString());
491  d->mAuthor.setJabber(jabber.toString());
492  d->mAuthor.setHomepage(homepage.toString());
493  } else if (reader.name() == QLatin1String("providerid")) {
494  d->mProviderId = reader.readElementText(QXmlStreamReader::SkipChildElements);
495  } else if (reader.name() == QLatin1String("homepage")) {
497  } else if (reader.name() == QLatin1String("licence")) { // krazy:exclude=spelling
498  d->mLicense = readStringTrimmed(&reader);
499  } else if (reader.name() == QLatin1String("summary")) {
501  } else if (reader.name() == QLatin1String("changelog")) {
503  } else if (reader.name() == QLatin1String("version")) {
504  d->mVersion = readStringTrimmed(&reader);
505  } else if (reader.name() == QLatin1String("releasedate")) {
506  d->mReleaseDate = QDate::fromString(readStringTrimmed(&reader), Qt::ISODate);
507  } else if (reader.name() == QLatin1String("preview")) {
508  // TODO support for all 6 image links
509  d->mPreviewUrl[PreviewSmall1] = readStringTrimmed(&reader);
510  } else if (reader.name() == QLatin1String("previewBig")) {
511  d->mPreviewUrl[PreviewBig1] = readStringTrimmed(&reader);
512  } else if (reader.name() == QLatin1String("payload")) {
513  d->mPayload = readStringTrimmed(&reader);
514  } else if (reader.name() == QLatin1String("rating")) {
515  d->mRating = readInt(&reader);
516  } else if (reader.name() == QLatin1String("downloads")) {
517  d->mDownloadCount = readInt(&reader);
518  } else if (reader.name() == QLatin1String("category")) {
520  } else if (reader.name() == QLatin1String("signature")) {
522  } else if (reader.name() == QLatin1String("checksum")) {
524  } else if (reader.name() == QLatin1String("installedfile")) {
525  d->mInstalledFiles.append(reader.readElementText(QXmlStreamReader::SkipChildElements));
526  } else if (reader.name() == QLatin1String("id")) {
528  } else if (reader.name() == QLatin1String("tags")) {
530  } else if (reader.name() == QLatin1String("status")) {
531  const auto statusText = readText(&reader);
532  if (statusText == QLatin1String("installed")) {
533  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
534  d->mStatus = KNS3::Entry::Installed;
535  } else if (statusText == QLatin1String("updateable")) {
536  d->mStatus = KNS3::Entry::Updateable;
537  }
538  if (reader.tokenType() == QXmlStreamReader::Characters)
539  readNextSkipComments(&reader);
540  }
541  Q_ASSERT_X(reader.tokenType() == QXmlStreamReader::EndElement, Q_FUNC_INFO, QStringLiteral("token name was %1 and the type was %2").arg(reader.name().toString(), reader.tokenString()).toLocal8Bit().data());
542  }
543 
544  // Validation
545  if (d->mName.isEmpty()) {
546  qWarning() << "Entry: no name given";
547  return false;
548  }
549 
550  if (d->mUniqueId.isEmpty()) {
551  if (!d->mPayload.isEmpty()) {
552  d->mUniqueId = d->mPayload;
553  } else {
554  d->mUniqueId = d->mName;
555  }
556  }
557 
558  if (d->mPayload.isEmpty()) {
559  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
560  return false;
561  }
562  return true;
563 }
564 
566 {
567  if (xmldata.tagName() != QLatin1String("stuff")) {
568  qWarning() << "Parsing Entry from invalid XML";
569  return false;
570  }
571 
572  d->mCategory = xmldata.attribute(QStringLiteral("category"));
573 
574  QDomNode n;
575  for (n = xmldata.firstChild(); !n.isNull(); n = n.nextSibling()) {
576  QDomElement e = n.toElement();
577  if (e.tagName() == QLatin1String("name")) {
578  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
579  d->mName = e.text().trimmed();
580  } else if (e.tagName() == QLatin1String("author")) {
581  QString email = e.attribute(QStringLiteral("email"));
582  QString jabber = e.attribute(QStringLiteral("im"));
583  QString homepage = e.attribute(QStringLiteral("homepage"));
584  d->mAuthor.setName(e.text().trimmed());
585  d->mAuthor.setEmail(email);
586  d->mAuthor.setJabber(jabber);
587  d->mAuthor.setHomepage(homepage);
588  } else if (e.tagName() == QLatin1String("providerid")) {
589  d->mProviderId = e.text();
590  } else if (e.tagName() == QLatin1String("homepage")) {
591  d->mHomepage = QUrl(e.text());
592  } else if (e.tagName() == QLatin1String("licence")) { // krazy:exclude=spelling
593  d->mLicense = e.text().trimmed();
594  } else if (e.tagName() == QLatin1String("summary")) {
595  d->mSummary = e.text();
596  } else if (e.tagName() == QLatin1String("changelog")) {
597  d->mChangelog = e.text();
598  } else if (e.tagName() == QLatin1String("version")) {
599  d->mVersion = e.text().trimmed();
600  } else if (e.tagName() == QLatin1String("releasedate")) {
601  d->mReleaseDate = QDate::fromString(e.text().trimmed(), Qt::ISODate);
602  } else if (e.tagName() == QLatin1String("preview")) {
603  // TODO support for all 6 image links
604  d->mPreviewUrl[PreviewSmall1] = e.text().trimmed();
605  } else if (e.tagName() == QLatin1String("previewBig")) {
606  d->mPreviewUrl[PreviewBig1] = e.text().trimmed();
607  } else if (e.tagName() == QLatin1String("payload")) {
608  d->mPayload = e.text().trimmed();
609  } else if (e.tagName() == QLatin1String("rating")) {
610  d->mRating = e.text().toInt();
611  } else if (e.tagName() == QLatin1String("downloads")) {
612  d->mDownloadCount = e.text().toInt();
613  } else if (e.tagName() == QLatin1String("category")) {
614  d->mCategory = e.text();
615  } else if (e.tagName() == QLatin1String("signature")) {
616  d->mSignature = e.text();
617  } else if (e.tagName() == QLatin1String("checksum")) {
618  d->mChecksum = e.text();
619  } else if (e.tagName() == QLatin1String("installedfile")) {
620  // TODO KF6 Add a "installeddirectory" entry to avoid
621  // all the issues with the "/*" notation which is currently used as a workaround
622  d->mInstalledFiles.append(e.text());
623  } else if (e.tagName() == QLatin1String("id")) {
624  d->mUniqueId = e.text();
625  } else if (e.tagName() == QLatin1String("tags")) {
626  d->mTags = e.text().split(QLatin1Char(','));
627  } else if (e.tagName() == QLatin1String("status")) {
628  QString statusText = e.text();
629  if (statusText == QLatin1String("installed")) {
630  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
631  d->mStatus = KNS3::Entry::Installed;
632  } else if (statusText == QLatin1String("updateable")) {
633  d->mStatus = KNS3::Entry::Updateable;
634  }
635  }
636  }
637 
638  // Validation
639  if (d->mName.isEmpty()) {
640  qWarning() << "Entry: no name given";
641  return false;
642  }
643 
644  if (d->mUniqueId.isEmpty()) {
645  if (!d->mPayload.isEmpty()) {
646  d->mUniqueId = d->mPayload;
647  } else {
648  d->mUniqueId = d->mName;
649  }
650  }
651 
652  if (d->mPayload.isEmpty()) {
653  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
654  return false;
655  }
656  return true;
657 }
658 
663 {
664  Q_ASSERT(!d->mUniqueId.isEmpty());
665  Q_ASSERT(!d->mProviderId.isEmpty());
666 
667  QDomDocument doc;
668 
669  QDomElement el = doc.createElement(QStringLiteral("stuff"));
670  el.setAttribute(QStringLiteral("category"), d->mCategory);
671 
672  QString name = d->mName;
673 
674  QDomElement e;
675  e = addElement(doc, el, QStringLiteral("name"), name);
676  // todo: add language attribute
677  (void)addElement(doc, el, QStringLiteral("providerid"), d->mProviderId);
678 
679  QDomElement author = addElement(doc, el, QStringLiteral("author"), d->mAuthor.name());
680  if (!d->mAuthor.email().isEmpty()) {
681  author.setAttribute(QStringLiteral("email"), d->mAuthor.email());
682  }
683  if (!d->mAuthor.homepage().isEmpty()) {
684  author.setAttribute(QStringLiteral("homepage"), d->mAuthor.homepage());
685  }
686  if (!d->mAuthor.jabber().isEmpty()) {
687  author.setAttribute(QStringLiteral("im"), d->mAuthor.jabber());
688  }
689  // FIXME: 'jabber' or 'im'? consult with kopete guys...
690  addElement(doc, el, QStringLiteral("homepage"), d->mHomepage.url());
691  (void)addElement(doc, el, QStringLiteral("licence"), d->mLicense); // krazy:exclude=spelling
692  (void)addElement(doc, el, QStringLiteral("version"), d->mVersion);
693  if ((d->mRating > 0) || (d->mDownloadCount > 0)) {
694  (void)addElement(doc, el, QStringLiteral("rating"), QString::number(d->mRating));
695  (void)addElement(doc, el, QStringLiteral("downloads"), QString::number(d->mDownloadCount));
696  }
697  if (!d->mSignature.isEmpty()) {
698  (void)addElement(doc, el, QStringLiteral("signature"), d->mSignature);
699  }
700  if (!d->mChecksum.isEmpty()) {
701  (void)addElement(doc, el, QStringLiteral("checksum"), d->mChecksum);
702  }
703  for (const QString &file : qAsConst(d->mInstalledFiles)) {
704  (void)addElement(doc, el, QStringLiteral("installedfile"), file);
705  }
706  if (!d->mUniqueId.isEmpty()) {
707  addElement(doc, el, QStringLiteral("id"), d->mUniqueId);
708  }
709 
710  (void)addElement(doc, el, QStringLiteral("releasedate"),
711  d->mReleaseDate.toString(Qt::ISODate));
712 
713  e = addElement(doc, el, QStringLiteral("summary"), d->mSummary);
714  e = addElement(doc, el, QStringLiteral("changelog"), d->mChangelog);
715  e = addElement(doc, el, QStringLiteral("preview"), d->mPreviewUrl[PreviewSmall1]);
716  e = addElement(doc, el, QStringLiteral("previewBig"), d->mPreviewUrl[PreviewBig1]);
717  e = addElement(doc, el, QStringLiteral("payload"), d->mPayload);
718  e = addElement(doc, el, QStringLiteral("tags"), d->mTags.join(QLatin1Char(',')));
719 
720  if (d->mStatus == KNS3::Entry::Installed) {
721  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("installed"));
722  }
723  if (d->mStatus == KNS3::Entry::Updateable) {
724  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("updateable"));
725  }
726 
727  return el;
728 }
729 
730 KNSCore::EntryInternal EntryInternal::fromEntry(const KNS3::Entry &entry)
731 {
732  return entry.d->e;
733 }
734 
735 QString KNSCore::replaceBBCode(const QString &unformattedText)
736 {
737  QString text(unformattedText);
738  text.replace(QLatin1String("[b]"), QLatin1String("<b>"));
739  text.replace(QLatin1String("[/b]"), QLatin1String("</b>"));
740  text.replace(QLatin1String("[i]"), QLatin1String("<i>"));
741  text.replace(QLatin1String("[/i]"), QLatin1String("</i>"));
742  text.replace(QLatin1String("[u]"), QLatin1String("<i>"));
743  text.replace(QLatin1String("[/u]"), QLatin1String("</i>"));
744  text.replace(QLatin1String("\\\""), QLatin1String("\""));
745  text.replace(QLatin1String("\\\'"), QLatin1String("\'"));
746  text.replace(QLatin1String("[li]"), QLatin1String("* ")); // TODO: better replacement for list elements?
747  text.remove(QStringLiteral("[/li]"));
748  text.remove(QStringLiteral("[url]"));
749  text.remove(QStringLiteral("[/url]"));
750  return text;
751 }
QString donationLink() const
A string representing the URL for a website where the user can donate to the author of this entry...
bool atEnd() const const
void setRating(int rating)
Sets the rating between 0 (worst) and 100 (best).
int toInt(bool *ok, int base) const const
QStringList tags() const
The set of tags assigned specifically to this content item.
void setUniqueId(const QString &id)
Set the object&#39;s unique ID.
int numberFans() const
How many people have marked themselves as fans of this entry.
QString summary() const
Retrieve a (potentially very long) description of the object.
QString uniqueId() const
Get the object&#39;s unique ID.
~EntryInternal()
Destructor.
Author author() const
Retrieve the author of the object.
QString attribute(const QString &name, const QString &defValue) const const
void setCategory(const QString &category)
Sets the data category, e.g.
QString toString() const const
KNEWSTUFFCORE_EXPORT QString replaceBBCode(const QString &unformattedText)
function to remove bb code formatting that opendesktop sends
int downloadCount() const
Retrieve the download count for the object, which has been determined by its hosting sites and thus m...
QString shortSummary() const
Retrieve a short description of what the object is all about (should be very short) ...
Contains the core functionality for handling interaction with NewStuff providers. ...
void setUnInstalledFiles(const QStringList &files)
Set the files that have been uninstalled by the uninstall command.
void setKnowledgebaseLink(const QString &link)
Set the link for the knowledgebase.
QDate releaseDate() const
Retrieve the date of the object&#39;s publication.
Source
Source of the entry, A entry&#39;s data is coming from either cache, or an online provider this helps the...
Definition: entryinternal.h:59
QStringRef value(const QString &namespaceUri, const QString &name) const const
QString & remove(int position, int n)
KNewStuff author information.
Definition: core/author.h:30
QImage previewImage(PreviewType type=PreviewSmall1) const
This will not be loaded automatically, instead use Engine to load the actual images.
QString toString(QUrl::FormattingOptions options) const const
void setShortSummary(const QString &summary)
Sets a short description of what the object is all about (should be very short)
QStringRef trimmed() const const
QDomNode nextSibling() const const
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
QDomElement toElement() const const
QString tokenString() const const
void setPayload(const QString &url)
Sets the object&#39;s file.
QDomElement entryXML() const
get the xml string for the entry
void setInstalledFiles(const QStringList &files)
Set the files that have been installed by the install command.
QDate fromString(const QString &string, Qt::DateFormat format)
void setSummary(const QString &summary)
Sets a description (which can potentially be very long)
QString payload() const
Retrieve the file name of the object.
QString number(int n, int base)
QString version() const
Retrieve the version string of the object.
QString text() const const
QUrl homepage() const
A link to a website containing information about this entry.
QString readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour)
KNewStuff information about changed entries.
Definition: entry.h:32
void setUpdateVersion(const QString &version)
Sets the version number that is available as update.
QList< DownloadLinkInformation > downloadLinkInformationList() const
A list of downloadable data for this entry.
void setAttribute(const QString &name, const QString &value)
int toInt(bool *ok, int base) const const
QStringList installedFiles() const
Retrieve the locally installed files.
int downloadLinkCount() const
The number of available download options for this entry.
void setLicense(const QString &license)
Sets the license (abbreviation) applicable to the object.
QString trimmed() const const
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
void setAuthor(const Author &author)
Sets the author of the object.
bool setEntryXML(QXmlStreamReader &reader)
set the xml for the entry parses the xml and sets the private members accordingly used to deserialize...
void setSource(Source source)
The source of this entry can be Cache, Registry or Online -.
QString category() const
Retrieve the category of the data object.
void setPreviewUrl(const QString &url, PreviewType type=PreviewSmall1)
Sets the object&#39;s preview file, if available.
void setNumberOfComments(int comments)
Sets the number of comments in the asset.
QDate updateReleaseDate() const
Retrieve the date of the newer version that is available as update.
QXmlStreamReader::TokenType readNext()
void setStatus(KNS3::Entry::Status status)
Sets the entry&#39;s status.
QXmlStreamReader::TokenType tokenType() const const
QString previewUrl(PreviewType type=PreviewSmall1) const
Retrieve the file name of an image containing a preview of the object.
void setNumberFans(int fans)
Sets how many people are fans.
void setDownloadCount(int downloads)
Sets the number of downloads.
Status
Status of the entry.
Definition: entry.h:46
bool isNull() const const
void setVersion(const QString &version)
Sets the version number.
QString & replace(int position, int n, QChar after)
void setDonationLink(const QString &link)
Set a string representation of the URL for the donation website for this entry.
void setUpdateReleaseDate(const QDate &releasedate)
Sets the release date that is available as update.
int numberKnowledgebaseEntries() const
The number of entries in the knowledgebase for this entry.
QDomNode firstChild() const const
KNewStuff data entry container.
Definition: entryinternal.h:49
void setTags(const QStringList &tags)
Set the tags for the content item.
int rating() const
Retrieve the rating for the object, which has been determined by its users and thus might change over...
int numberOfComments() const
QStringRef text() const const
bool isEmpty() const const
QStringList uninstalledFiles() const
Retrieve the locally uninstalled files.
QXmlStreamAttributes attributes() const const
QString updateVersion() const
Retrieve the version string of the object that is available as update.
void setNumberKnowledgebaseEntries(int num)
Set the number of knowledgebase entries for this entry.
void setName(const QString &name)
Sets the name for this data object.
QString tagName() const const
QString knowledgebaseLink() const
The link for the knowledgebase for this entry.
void setHomepage(const QUrl &page)
Set a link to a website containing information about this entry.
KNS3::Entry::Status status() const
Retrieves the entry&#39;s status.
The namespace for the KNewStuff classes.
Definition: button.cpp:19
void setChangelog(const QString &changelog)
The user written changelog.
QString name() const
Retrieve the name of the data object.
QString license() const
Retrieve the license name of the object.
QString providerId() const
The id of the provider this entry belongs to.
QStringRef name() const const
void clearDownloadLinkInformation()
Remove all download options from this entry.
EntryInternal()
Constructor.
void setReleaseDate(const QDate &releasedate)
Sets the release date.
void appendDownloadLinkInformation(const DownloadLinkInformation &info)
Add a new download option to this entry.
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Mon Jan 18 2021 22:43:49 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.