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 "../entry_p.h" // For Entry::Status ONLY!
17 #include "xmlloader.h"
18 
19 using namespace KNSCore;
20 
21 class EntryInternal::Private : public QSharedData
22 {
23 public:
24  Private()
25  : mReleaseDate(QDate::currentDate())
26  , mRating(0)
27  , mNumberOfComments(0)
28  , mDownloadCount(0)
29  , mNumberFans(0)
30  , mNumberKnowledgebaseEntries(0)
31  , mStatus(KNS3::Entry::Invalid)
32  , mSource(EntryInternal::Online)
33  , mEntryType(EntryInternal::CatalogEntry)
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  EntryInternal::EntryType mEntryType;
77 
78  QString mPreviewUrl[6];
79  QImage mPreviewImage[6];
80 
81  QList<EntryInternal::DownloadLinkInformation> mDownloadLinkInformationList;
82 };
83 
85  : d(new Private)
86 {
87 }
88 
90  : d(other.d)
91 {
92 }
93 
94 EntryInternal &EntryInternal::operator=(const EntryInternal &other)
95 {
96  d = other.d;
97  return *this;
98 }
99 
100 bool EntryInternal::operator<(const KNSCore::EntryInternal &other) const
101 {
102  return d->mUniqueId < other.d->mUniqueId;
103 }
104 
105 bool EntryInternal::operator==(const KNSCore::EntryInternal &other) const
106 {
107  return d->mUniqueId == other.d->mUniqueId && d->mProviderId == other.d->mProviderId;
108 }
109 
111 {
112 }
113 
114 bool EntryInternal::isValid() const
115 {
116  return !d->mUniqueId.isEmpty();
117 }
118 
120 {
121  return d->mName;
122 }
123 
125 {
126  d->mName = name;
127 }
128 
130 {
131  return d->mUniqueId;
132 }
133 
135 {
136  d->mUniqueId = id;
137 }
138 
140 {
141  return d->mProviderId;
142 }
143 
144 void EntryInternal::setProviderId(const QString &id)
145 {
146  d->mProviderId = id;
147 }
148 
150 {
151  return d->mTags;
152 }
153 
155 {
156  d->mTags = tags;
157 }
158 
160 {
161  return d->mCategory;
162 }
163 
165 {
166  d->mCategory = category;
167 }
168 
170 {
171  return d->mHomepage;
172 }
173 
175 {
176  d->mHomepage = page;
177 }
178 
180 {
181  return d->mAuthor;
182 }
183 
185 {
186  d->mAuthor = author;
187 }
188 
190 {
191  return d->mLicense;
192 }
193 
195 {
196  d->mLicense = license;
197 }
198 
200 {
201  return d->mSummary;
202 }
203 
205 {
206  d->mSummary = summary;
207 }
208 
210 {
211  return d->mShortSummary;
212 }
213 
215 {
216  d->mShortSummary = summary;
217 }
218 
219 void EntryInternal::setChangelog(const QString &changelog)
220 {
221  d->mChangelog = changelog;
222 }
223 
224 QString EntryInternal::changelog() const
225 {
226  return d->mChangelog;
227 }
228 
230 {
231  return d->mVersion;
232 }
233 
235 {
236  d->mVersion = version;
237 }
238 
240 {
241  return d->mReleaseDate;
242 }
243 
244 void EntryInternal::setReleaseDate(const QDate &releasedate)
245 {
246  d->mReleaseDate = releasedate;
247 }
248 
250 {
251  return d->mPayload;
252 }
253 
255 {
256  d->mPayload = url;
257 }
258 
260 {
261  return d->mUpdateReleaseDate;
262 }
263 
265 {
266  d->mUpdateReleaseDate = releasedate;
267 }
268 
270 {
271  return d->mUpdateVersion;
272 }
273 
275 {
276  d->mUpdateVersion = version;
277 }
278 
279 QString EntryInternal::previewUrl(PreviewType type) const
280 {
281  return d->mPreviewUrl[type];
282 }
283 
284 void EntryInternal::setPreviewUrl(const QString &url, PreviewType type)
285 {
286  d->mPreviewUrl[type] = url;
287 }
288 
289 QImage EntryInternal::previewImage(PreviewType type) const
290 {
291  return d->mPreviewImage[type];
292 }
293 
294 void EntryInternal::setPreviewImage(const QImage &image, PreviewType type)
295 {
296  d->mPreviewImage[type] = image;
297 }
298 
300 {
301  return d->mRating;
302 }
303 
305 {
306  d->mRating = rating;
307 }
308 
310 {
311  return d->mNumberOfComments;
312 }
313 
315 {
316  d->mNumberOfComments = comments;
317 }
318 
320 {
321  return d->mDownloadCount;
322 }
323 
325 {
326  d->mDownloadCount = downloads;
327 }
328 
330 {
331  return d->mNumberFans;
332 }
333 
335 {
336  d->mNumberFans = fans;
337 }
338 
340 {
341  return d->mDonationLink;
342 }
343 
345 {
346  d->mDonationLink = link;
347 }
348 
350 {
351  return d->mNumberKnowledgebaseEntries;
352 }
354 {
355  d->mNumberKnowledgebaseEntries = num;
356 }
357 
359 {
360  return d->mKnowledgebaseLink;
361 }
363 {
364  d->mKnowledgebaseLink = link;
365 }
366 
367 EntryInternal::Source EntryInternal::source() const
368 {
369  return d->mSource;
370 }
371 
373 {
374  d->mEntryType = type;
375 }
376 
377 EntryInternal::EntryType EntryInternal::entryType() const
378 {
379  return d->mEntryType;
380 }
381 
383 {
384  d->mSource = source;
385 }
386 
388 {
389  return d->mStatus;
390 }
391 
393 {
394  d->mStatus = status;
395 }
396 
398 {
399  d->mInstalledFiles = files;
400 }
401 
403 {
404  return d->mInstalledFiles;
405 }
406 
408 {
409  d->mUnInstalledFiles = files;
410 }
411 
413 {
414  return d->mUnInstalledFiles;
415 }
416 
418 {
419  return d->mDownloadLinkInformationList.size();
420 }
421 
423 {
424  return d->mDownloadLinkInformationList;
425 }
426 
427 void KNSCore::EntryInternal::appendDownloadLinkInformation(const KNSCore::EntryInternal::DownloadLinkInformation &info)
428 {
429  d->mDownloadLinkInformationList.append(info);
430 }
431 
433 {
434  d->mDownloadLinkInformationList.clear();
435 }
436 
437 static QXmlStreamReader::TokenType readNextSkipComments(QXmlStreamReader *xml)
438 {
439  do {
440  xml->readNext();
441  } while (xml->tokenType() == QXmlStreamReader::Comment || (xml->tokenType() == QXmlStreamReader::Characters && xml->text().trimmed().isEmpty()));
442  return xml->tokenType();
443 }
444 
445 static QString readText(QXmlStreamReader *xml)
446 {
447  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
448  QString ret;
449  const auto token = readNextSkipComments(xml);
450  if (token == QXmlStreamReader::Characters) {
451  ret = xml->text().toString();
452  }
453  return ret;
454 }
455 
456 static QString readStringTrimmed(QXmlStreamReader *xml)
457 {
458  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
459  QString ret = readText(xml).trimmed();
460 
461  if (xml->tokenType() == QXmlStreamReader::Characters) {
462  readNextSkipComments(xml);
463  }
464  Q_ASSERT(xml->tokenType() == QXmlStreamReader::EndElement);
465  return ret;
466 }
467 
468 static int readInt(QXmlStreamReader *xml)
469 {
470  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
471  int ret = readText(xml).toInt();
472 
473  xml->readNext();
474  Q_ASSERT(xml->tokenType() == QXmlStreamReader::EndElement);
475  return ret;
476 }
477 
479 {
480  if (reader.name() != QLatin1String("stuff")) {
481  qCWarning(KNEWSTUFFCORE) << "Parsing Entry from invalid XML. Reader tag name was expected to be \"stuff\", but was found as:" << reader.name();
482  return false;
483  }
484 
485  d->mCategory = reader.attributes().value(QStringLiteral("category")).toString();
486 
487  while (!reader.atEnd()) {
488  const auto token = readNextSkipComments(&reader);
489  if (token == QXmlStreamReader::EndElement) {
490  break;
491  } else if (token != QXmlStreamReader::StartElement) {
492  continue;
493  }
494 
495  if (reader.name() == QLatin1String("name")) {
496  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
498  } else if (reader.name() == QLatin1String("author")) {
499  const auto email = reader.attributes().value(QStringLiteral("email"));
500  const auto jabber = reader.attributes().value(QStringLiteral("im"));
501  const auto homepage = reader.attributes().value(QStringLiteral("homepage"));
502  d->mAuthor.setName(readStringTrimmed(&reader));
503  d->mAuthor.setEmail(email.toString());
504  d->mAuthor.setJabber(jabber.toString());
505  d->mAuthor.setHomepage(homepage.toString());
506  } else if (reader.name() == QLatin1String("providerid")) {
507  d->mProviderId = reader.readElementText(QXmlStreamReader::SkipChildElements);
508  } else if (reader.name() == QLatin1String("homepage")) {
510  } else if (reader.name() == QLatin1String("licence")) { // krazy:exclude=spelling
511  d->mLicense = readStringTrimmed(&reader);
512  } else if (reader.name() == QLatin1String("summary")) {
514  } else if (reader.name() == QLatin1String("changelog")) {
516  } else if (reader.name() == QLatin1String("version")) {
517  d->mVersion = readStringTrimmed(&reader);
518  } else if (reader.name() == QLatin1String("releasedate")) {
519  d->mReleaseDate = QDate::fromString(readStringTrimmed(&reader), Qt::ISODate);
520  } else if (reader.name() == QLatin1String("preview")) {
521  // TODO support for all 6 image links
522  d->mPreviewUrl[PreviewSmall1] = readStringTrimmed(&reader);
523  } else if (reader.name() == QLatin1String("previewBig")) {
524  d->mPreviewUrl[PreviewBig1] = readStringTrimmed(&reader);
525  } else if (reader.name() == QLatin1String("payload")) {
526  d->mPayload = readStringTrimmed(&reader);
527  } else if (reader.name() == QLatin1String("rating")) {
528  d->mRating = readInt(&reader);
529  } else if (reader.name() == QLatin1String("downloads")) {
530  d->mDownloadCount = readInt(&reader);
531  } else if (reader.name() == QLatin1String("category")) {
533  } else if (reader.name() == QLatin1String("signature")) {
535  } else if (reader.name() == QLatin1String("checksum")) {
537  } else if (reader.name() == QLatin1String("installedfile")) {
538  d->mInstalledFiles.append(reader.readElementText(QXmlStreamReader::SkipChildElements));
539  } else if (reader.name() == QLatin1String("id")) {
541  } else if (reader.name() == QLatin1String("tags")) {
543  } else if (reader.name() == QLatin1String("status")) {
544  const auto statusText = readText(&reader);
545  if (statusText == QLatin1String("installed")) {
546  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
547  d->mStatus = KNS3::Entry::Installed;
548  } else if (statusText == QLatin1String("updateable")) {
549  d->mStatus = KNS3::Entry::Updateable;
550  }
551  if (reader.tokenType() == QXmlStreamReader::Characters) {
552  readNextSkipComments(&reader);
553  }
554  }
555  Q_ASSERT_X(reader.tokenType() == QXmlStreamReader::EndElement,
556  Q_FUNC_INFO,
557  QStringLiteral("token name was %1 and the type was %2").arg(reader.name().toString(), reader.tokenString()).toLocal8Bit().data());
558  }
559 
560  // Validation
561  if (d->mName.isEmpty()) {
562  qWarning() << "Entry: no name given";
563  return false;
564  }
565 
566  if (d->mUniqueId.isEmpty()) {
567  if (!d->mPayload.isEmpty()) {
568  d->mUniqueId = d->mPayload;
569  } else {
570  d->mUniqueId = d->mName;
571  }
572  }
573 
574  if (d->mPayload.isEmpty()) {
575  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
576  return false;
577  }
578  return true;
579 }
580 
582 {
583  if (xmldata.tagName() != QLatin1String("stuff")) {
584  qWarning() << "Parsing Entry from invalid XML";
585  return false;
586  }
587 
588  d->mCategory = xmldata.attribute(QStringLiteral("category"));
589 
590  QDomNode n;
591  for (n = xmldata.firstChild(); !n.isNull(); n = n.nextSibling()) {
592  QDomElement e = n.toElement();
593  if (e.tagName() == QLatin1String("name")) {
594  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
595  d->mName = e.text().trimmed();
596  } else if (e.tagName() == QLatin1String("author")) {
597  QString email = e.attribute(QStringLiteral("email"));
598  QString jabber = e.attribute(QStringLiteral("im"));
599  QString homepage = e.attribute(QStringLiteral("homepage"));
600  d->mAuthor.setName(e.text().trimmed());
601  d->mAuthor.setEmail(email);
602  d->mAuthor.setJabber(jabber);
603  d->mAuthor.setHomepage(homepage);
604  } else if (e.tagName() == QLatin1String("providerid")) {
605  d->mProviderId = e.text();
606  } else if (e.tagName() == QLatin1String("homepage")) {
607  d->mHomepage = QUrl(e.text());
608  } else if (e.tagName() == QLatin1String("licence")) { // krazy:exclude=spelling
609  d->mLicense = e.text().trimmed();
610  } else if (e.tagName() == QLatin1String("summary")) {
611  d->mSummary = e.text();
612  } else if (e.tagName() == QLatin1String("changelog")) {
613  d->mChangelog = e.text();
614  } else if (e.tagName() == QLatin1String("version")) {
615  d->mVersion = e.text().trimmed();
616  } else if (e.tagName() == QLatin1String("releasedate")) {
617  d->mReleaseDate = QDate::fromString(e.text().trimmed(), Qt::ISODate);
618  } else if (e.tagName() == QLatin1String("preview")) {
619  // TODO support for all 6 image links
620  d->mPreviewUrl[PreviewSmall1] = e.text().trimmed();
621  } else if (e.tagName() == QLatin1String("previewBig")) {
622  d->mPreviewUrl[PreviewBig1] = e.text().trimmed();
623  } else if (e.tagName() == QLatin1String("payload")) {
624  d->mPayload = e.text().trimmed();
625  } else if (e.tagName() == QLatin1String("rating")) {
626  d->mRating = e.text().toInt();
627  } else if (e.tagName() == QLatin1String("downloads")) {
628  d->mDownloadCount = e.text().toInt();
629  } else if (e.tagName() == QLatin1String("category")) {
630  d->mCategory = e.text();
631  } else if (e.tagName() == QLatin1String("signature")) {
632  d->mSignature = e.text();
633  } else if (e.tagName() == QLatin1String("checksum")) {
634  d->mChecksum = e.text();
635  } else if (e.tagName() == QLatin1String("installedfile")) {
636  // TODO KF6 Add a "installeddirectory" entry to avoid
637  // all the issues with the "/*" notation which is currently used as a workaround
638  d->mInstalledFiles.append(e.text());
639  } else if (e.tagName() == QLatin1String("id")) {
640  d->mUniqueId = e.text();
641  } else if (e.tagName() == QLatin1String("tags")) {
642  d->mTags = e.text().split(QLatin1Char(','));
643  } else if (e.tagName() == QLatin1String("status")) {
644  QString statusText = e.text();
645  if (statusText == QLatin1String("installed")) {
646  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
647  d->mStatus = KNS3::Entry::Installed;
648  } else if (statusText == QLatin1String("updateable")) {
649  d->mStatus = KNS3::Entry::Updateable;
650  }
651  }
652  }
653 
654  // Validation
655  if (d->mName.isEmpty()) {
656  qWarning() << "Entry: no name given";
657  return false;
658  }
659 
660  if (d->mUniqueId.isEmpty()) {
661  if (!d->mPayload.isEmpty()) {
662  d->mUniqueId = d->mPayload;
663  } else {
664  d->mUniqueId = d->mName;
665  }
666  }
667 
668  if (d->mPayload.isEmpty()) {
669  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
670  return false;
671  }
672  return true;
673 }
674 
675 /**
676  * get the xml string for the entry
677  */
679 {
680  Q_ASSERT(!d->mUniqueId.isEmpty());
681  Q_ASSERT(!d->mProviderId.isEmpty());
682 
683  QDomDocument doc;
684 
685  QDomElement el = doc.createElement(QStringLiteral("stuff"));
686  el.setAttribute(QStringLiteral("category"), d->mCategory);
687 
688  QString name = d->mName;
689 
690  QDomElement e;
691  e = addElement(doc, el, QStringLiteral("name"), name);
692  // todo: add language attribute
693  (void)addElement(doc, el, QStringLiteral("providerid"), d->mProviderId);
694 
695  QDomElement author = addElement(doc, el, QStringLiteral("author"), d->mAuthor.name());
696  if (!d->mAuthor.email().isEmpty()) {
697  author.setAttribute(QStringLiteral("email"), d->mAuthor.email());
698  }
699  if (!d->mAuthor.homepage().isEmpty()) {
700  author.setAttribute(QStringLiteral("homepage"), d->mAuthor.homepage());
701  }
702  if (!d->mAuthor.jabber().isEmpty()) {
703  author.setAttribute(QStringLiteral("im"), d->mAuthor.jabber());
704  }
705  // FIXME: 'jabber' or 'im'? consult with kopete guys...
706  addElement(doc, el, QStringLiteral("homepage"), d->mHomepage.url());
707  (void)addElement(doc, el, QStringLiteral("licence"), d->mLicense); // krazy:exclude=spelling
708  (void)addElement(doc, el, QStringLiteral("version"), d->mVersion);
709  if ((d->mRating > 0) || (d->mDownloadCount > 0)) {
710  (void)addElement(doc, el, QStringLiteral("rating"), QString::number(d->mRating));
711  (void)addElement(doc, el, QStringLiteral("downloads"), QString::number(d->mDownloadCount));
712  }
713  if (!d->mSignature.isEmpty()) {
714  (void)addElement(doc, el, QStringLiteral("signature"), d->mSignature);
715  }
716  if (!d->mChecksum.isEmpty()) {
717  (void)addElement(doc, el, QStringLiteral("checksum"), d->mChecksum);
718  }
719  for (const QString &file : std::as_const(d->mInstalledFiles)) {
720  (void)addElement(doc, el, QStringLiteral("installedfile"), file);
721  }
722  if (!d->mUniqueId.isEmpty()) {
723  addElement(doc, el, QStringLiteral("id"), d->mUniqueId);
724  }
725 
726  (void)addElement(doc, el, QStringLiteral("releasedate"), d->mReleaseDate.toString(Qt::ISODate));
727 
728  e = addElement(doc, el, QStringLiteral("summary"), d->mSummary);
729  e = addElement(doc, el, QStringLiteral("changelog"), d->mChangelog);
730  e = addElement(doc, el, QStringLiteral("preview"), d->mPreviewUrl[PreviewSmall1]);
731  e = addElement(doc, el, QStringLiteral("previewBig"), d->mPreviewUrl[PreviewBig1]);
732  e = addElement(doc, el, QStringLiteral("payload"), d->mPayload);
733  e = addElement(doc, el, QStringLiteral("tags"), d->mTags.join(QLatin1Char(',')));
734 
735  if (d->mStatus == KNS3::Entry::Installed) {
736  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("installed"));
737  }
738  if (d->mStatus == KNS3::Entry::Updateable) {
739  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("updateable"));
740  }
741 
742  return el;
743 }
744 
745 KNSCore::EntryInternal EntryInternal::fromEntry(const KNS3::Entry &entry)
746 {
747  return entry.d->e;
748 }
749 
750 QString KNSCore::replaceBBCode(const QString &unformattedText)
751 {
752  QString text(unformattedText);
753  text.replace(QLatin1String("[b]"), QLatin1String("<b>"));
754  text.replace(QLatin1String("[/b]"), QLatin1String("</b>"));
755  text.replace(QLatin1String("[i]"), QLatin1String("<i>"));
756  text.replace(QLatin1String("[/i]"), QLatin1String("</i>"));
757  text.replace(QLatin1String("[u]"), QLatin1String("<i>"));
758  text.replace(QLatin1String("[/u]"), QLatin1String("</i>"));
759  text.replace(QLatin1String("\\\""), QLatin1String("\""));
760  text.replace(QLatin1String("\\\'"), QLatin1String("\'"));
761  text.replace(QLatin1String("[li]"), QLatin1String("* ")); // TODO: better replacement for list elements?
762  text.remove(QStringLiteral("[/li]"));
763  text.remove(QStringLiteral("[url]"));
764  text.remove(QStringLiteral("[/url]"));
765  return text;
766 }
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).
QStringList tags() const
The set of tags assigned specifically to this content item.
void setEntryType(EntryType type)
The entry type is either catalog entry, or group entry.
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
EntryType
Represents whether the current entry is an actual catalog entry, or an entry that represents a set of...
Definition: entryinternal.h:97
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:35
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
These are the main entries that KNewStuff can get the details about and download links for...
Definition: entryinternal.h:98
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:49
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 Sat Oct 23 2021 22:43:02 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.