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 
462  readNextSkipComments(xml);
463  Q_ASSERT(xml->tokenType() == QXmlStreamReader::EndElement);
464  return ret;
465 }
466 
467 static int readInt(QXmlStreamReader *xml)
468 {
469  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
470  int ret = readText(xml).toInt();
471 
472  xml->readNext();
473  Q_ASSERT(xml->tokenType() == QXmlStreamReader::EndElement);
474  return ret;
475 }
476 
478 {
479  if (reader.name() != QLatin1String("stuff")) {
480  qCWarning(KNEWSTUFFCORE) << "Parsing Entry from invalid XML. Reader tag name was expected to be \"stuff\", but was found as:" << reader.name();
481  return false;
482  }
483 
484  d->mCategory = reader.attributes().value(QStringLiteral("category")).toString();
485 
486  while (!reader.atEnd()) {
487  const auto token = readNextSkipComments(&reader);
488  if (token == QXmlStreamReader::EndElement)
489  break;
490  else if (token != QXmlStreamReader::StartElement)
491  continue;
492 
493  if (reader.name() == QLatin1String("name")) {
494  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
496  } else if (reader.name() == QLatin1String("author")) {
497  const auto email = reader.attributes().value(QStringLiteral("email"));
498  const auto jabber = reader.attributes().value(QStringLiteral("im"));
499  const auto homepage = reader.attributes().value(QStringLiteral("homepage"));
500  d->mAuthor.setName(readStringTrimmed(&reader));
501  d->mAuthor.setEmail(email.toString());
502  d->mAuthor.setJabber(jabber.toString());
503  d->mAuthor.setHomepage(homepage.toString());
504  } else if (reader.name() == QLatin1String("providerid")) {
505  d->mProviderId = reader.readElementText(QXmlStreamReader::SkipChildElements);
506  } else if (reader.name() == QLatin1String("homepage")) {
508  } else if (reader.name() == QLatin1String("licence")) { // krazy:exclude=spelling
509  d->mLicense = readStringTrimmed(&reader);
510  } else if (reader.name() == QLatin1String("summary")) {
512  } else if (reader.name() == QLatin1String("changelog")) {
514  } else if (reader.name() == QLatin1String("version")) {
515  d->mVersion = readStringTrimmed(&reader);
516  } else if (reader.name() == QLatin1String("releasedate")) {
517  d->mReleaseDate = QDate::fromString(readStringTrimmed(&reader), Qt::ISODate);
518  } else if (reader.name() == QLatin1String("preview")) {
519  // TODO support for all 6 image links
520  d->mPreviewUrl[PreviewSmall1] = readStringTrimmed(&reader);
521  } else if (reader.name() == QLatin1String("previewBig")) {
522  d->mPreviewUrl[PreviewBig1] = readStringTrimmed(&reader);
523  } else if (reader.name() == QLatin1String("payload")) {
524  d->mPayload = readStringTrimmed(&reader);
525  } else if (reader.name() == QLatin1String("rating")) {
526  d->mRating = readInt(&reader);
527  } else if (reader.name() == QLatin1String("downloads")) {
528  d->mDownloadCount = readInt(&reader);
529  } else if (reader.name() == QLatin1String("category")) {
531  } else if (reader.name() == QLatin1String("signature")) {
533  } else if (reader.name() == QLatin1String("checksum")) {
535  } else if (reader.name() == QLatin1String("installedfile")) {
536  d->mInstalledFiles.append(reader.readElementText(QXmlStreamReader::SkipChildElements));
537  } else if (reader.name() == QLatin1String("id")) {
539  } else if (reader.name() == QLatin1String("tags")) {
541  } else if (reader.name() == QLatin1String("status")) {
542  const auto statusText = readText(&reader);
543  if (statusText == QLatin1String("installed")) {
544  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
545  d->mStatus = KNS3::Entry::Installed;
546  } else if (statusText == QLatin1String("updateable")) {
547  d->mStatus = KNS3::Entry::Updateable;
548  }
549  if (reader.tokenType() == QXmlStreamReader::Characters)
550  readNextSkipComments(&reader);
551  }
552  Q_ASSERT_X(reader.tokenType() == QXmlStreamReader::EndElement,
553  Q_FUNC_INFO,
554  QStringLiteral("token name was %1 and the type was %2").arg(reader.name().toString(), reader.tokenString()).toLocal8Bit().data());
555  }
556 
557  // Validation
558  if (d->mName.isEmpty()) {
559  qWarning() << "Entry: no name given";
560  return false;
561  }
562 
563  if (d->mUniqueId.isEmpty()) {
564  if (!d->mPayload.isEmpty()) {
565  d->mUniqueId = d->mPayload;
566  } else {
567  d->mUniqueId = d->mName;
568  }
569  }
570 
571  if (d->mPayload.isEmpty()) {
572  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
573  return false;
574  }
575  return true;
576 }
577 
579 {
580  if (xmldata.tagName() != QLatin1String("stuff")) {
581  qWarning() << "Parsing Entry from invalid XML";
582  return false;
583  }
584 
585  d->mCategory = xmldata.attribute(QStringLiteral("category"));
586 
587  QDomNode n;
588  for (n = xmldata.firstChild(); !n.isNull(); n = n.nextSibling()) {
589  QDomElement e = n.toElement();
590  if (e.tagName() == QLatin1String("name")) {
591  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
592  d->mName = e.text().trimmed();
593  } else if (e.tagName() == QLatin1String("author")) {
594  QString email = e.attribute(QStringLiteral("email"));
595  QString jabber = e.attribute(QStringLiteral("im"));
596  QString homepage = e.attribute(QStringLiteral("homepage"));
597  d->mAuthor.setName(e.text().trimmed());
598  d->mAuthor.setEmail(email);
599  d->mAuthor.setJabber(jabber);
600  d->mAuthor.setHomepage(homepage);
601  } else if (e.tagName() == QLatin1String("providerid")) {
602  d->mProviderId = e.text();
603  } else if (e.tagName() == QLatin1String("homepage")) {
604  d->mHomepage = QUrl(e.text());
605  } else if (e.tagName() == QLatin1String("licence")) { // krazy:exclude=spelling
606  d->mLicense = e.text().trimmed();
607  } else if (e.tagName() == QLatin1String("summary")) {
608  d->mSummary = e.text();
609  } else if (e.tagName() == QLatin1String("changelog")) {
610  d->mChangelog = e.text();
611  } else if (e.tagName() == QLatin1String("version")) {
612  d->mVersion = e.text().trimmed();
613  } else if (e.tagName() == QLatin1String("releasedate")) {
614  d->mReleaseDate = QDate::fromString(e.text().trimmed(), Qt::ISODate);
615  } else if (e.tagName() == QLatin1String("preview")) {
616  // TODO support for all 6 image links
617  d->mPreviewUrl[PreviewSmall1] = e.text().trimmed();
618  } else if (e.tagName() == QLatin1String("previewBig")) {
619  d->mPreviewUrl[PreviewBig1] = e.text().trimmed();
620  } else if (e.tagName() == QLatin1String("payload")) {
621  d->mPayload = e.text().trimmed();
622  } else if (e.tagName() == QLatin1String("rating")) {
623  d->mRating = e.text().toInt();
624  } else if (e.tagName() == QLatin1String("downloads")) {
625  d->mDownloadCount = e.text().toInt();
626  } else if (e.tagName() == QLatin1String("category")) {
627  d->mCategory = e.text();
628  } else if (e.tagName() == QLatin1String("signature")) {
629  d->mSignature = e.text();
630  } else if (e.tagName() == QLatin1String("checksum")) {
631  d->mChecksum = e.text();
632  } else if (e.tagName() == QLatin1String("installedfile")) {
633  // TODO KF6 Add a "installeddirectory" entry to avoid
634  // all the issues with the "/*" notation which is currently used as a workaround
635  d->mInstalledFiles.append(e.text());
636  } else if (e.tagName() == QLatin1String("id")) {
637  d->mUniqueId = e.text();
638  } else if (e.tagName() == QLatin1String("tags")) {
639  d->mTags = e.text().split(QLatin1Char(','));
640  } else if (e.tagName() == QLatin1String("status")) {
641  QString statusText = e.text();
642  if (statusText == QLatin1String("installed")) {
643  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
644  d->mStatus = KNS3::Entry::Installed;
645  } else if (statusText == QLatin1String("updateable")) {
646  d->mStatus = KNS3::Entry::Updateable;
647  }
648  }
649  }
650 
651  // Validation
652  if (d->mName.isEmpty()) {
653  qWarning() << "Entry: no name given";
654  return false;
655  }
656 
657  if (d->mUniqueId.isEmpty()) {
658  if (!d->mPayload.isEmpty()) {
659  d->mUniqueId = d->mPayload;
660  } else {
661  d->mUniqueId = d->mName;
662  }
663  }
664 
665  if (d->mPayload.isEmpty()) {
666  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
667  return false;
668  }
669  return true;
670 }
671 
672 /**
673  * get the xml string for the entry
674  */
676 {
677  Q_ASSERT(!d->mUniqueId.isEmpty());
678  Q_ASSERT(!d->mProviderId.isEmpty());
679 
680  QDomDocument doc;
681 
682  QDomElement el = doc.createElement(QStringLiteral("stuff"));
683  el.setAttribute(QStringLiteral("category"), d->mCategory);
684 
685  QString name = d->mName;
686 
687  QDomElement e;
688  e = addElement(doc, el, QStringLiteral("name"), name);
689  // todo: add language attribute
690  (void)addElement(doc, el, QStringLiteral("providerid"), d->mProviderId);
691 
692  QDomElement author = addElement(doc, el, QStringLiteral("author"), d->mAuthor.name());
693  if (!d->mAuthor.email().isEmpty()) {
694  author.setAttribute(QStringLiteral("email"), d->mAuthor.email());
695  }
696  if (!d->mAuthor.homepage().isEmpty()) {
697  author.setAttribute(QStringLiteral("homepage"), d->mAuthor.homepage());
698  }
699  if (!d->mAuthor.jabber().isEmpty()) {
700  author.setAttribute(QStringLiteral("im"), d->mAuthor.jabber());
701  }
702  // FIXME: 'jabber' or 'im'? consult with kopete guys...
703  addElement(doc, el, QStringLiteral("homepage"), d->mHomepage.url());
704  (void)addElement(doc, el, QStringLiteral("licence"), d->mLicense); // krazy:exclude=spelling
705  (void)addElement(doc, el, QStringLiteral("version"), d->mVersion);
706  if ((d->mRating > 0) || (d->mDownloadCount > 0)) {
707  (void)addElement(doc, el, QStringLiteral("rating"), QString::number(d->mRating));
708  (void)addElement(doc, el, QStringLiteral("downloads"), QString::number(d->mDownloadCount));
709  }
710  if (!d->mSignature.isEmpty()) {
711  (void)addElement(doc, el, QStringLiteral("signature"), d->mSignature);
712  }
713  if (!d->mChecksum.isEmpty()) {
714  (void)addElement(doc, el, QStringLiteral("checksum"), d->mChecksum);
715  }
716  for (const QString &file : qAsConst(d->mInstalledFiles)) {
717  (void)addElement(doc, el, QStringLiteral("installedfile"), file);
718  }
719  if (!d->mUniqueId.isEmpty()) {
720  addElement(doc, el, QStringLiteral("id"), d->mUniqueId);
721  }
722 
723  (void)addElement(doc, el, QStringLiteral("releasedate"), d->mReleaseDate.toString(Qt::ISODate));
724 
725  e = addElement(doc, el, QStringLiteral("summary"), d->mSummary);
726  e = addElement(doc, el, QStringLiteral("changelog"), d->mChangelog);
727  e = addElement(doc, el, QStringLiteral("preview"), d->mPreviewUrl[PreviewSmall1]);
728  e = addElement(doc, el, QStringLiteral("previewBig"), d->mPreviewUrl[PreviewBig1]);
729  e = addElement(doc, el, QStringLiteral("payload"), d->mPayload);
730  e = addElement(doc, el, QStringLiteral("tags"), d->mTags.join(QLatin1Char(',')));
731 
732  if (d->mStatus == KNS3::Entry::Installed) {
733  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("installed"));
734  }
735  if (d->mStatus == KNS3::Entry::Updateable) {
736  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("updateable"));
737  }
738 
739  return el;
740 }
741 
742 KNSCore::EntryInternal EntryInternal::fromEntry(const KNS3::Entry &entry)
743 {
744  return entry.d->e;
745 }
746 
747 QString KNSCore::replaceBBCode(const QString &unformattedText)
748 {
749  QString text(unformattedText);
750  text.replace(QLatin1String("[b]"), QLatin1String("<b>"));
751  text.replace(QLatin1String("[/b]"), QLatin1String("</b>"));
752  text.replace(QLatin1String("[i]"), QLatin1String("<i>"));
753  text.replace(QLatin1String("[/i]"), QLatin1String("</i>"));
754  text.replace(QLatin1String("[u]"), QLatin1String("<i>"));
755  text.replace(QLatin1String("[/u]"), QLatin1String("</i>"));
756  text.replace(QLatin1String("\\\""), QLatin1String("\""));
757  text.replace(QLatin1String("\\\'"), QLatin1String("\'"));
758  text.replace(QLatin1String("[li]"), QLatin1String("* ")); // TODO: better replacement for list elements?
759  text.remove(QStringLiteral("[/li]"));
760  text.remove(QStringLiteral("[url]"));
761  text.remove(QStringLiteral("[/url]"));
762  return text;
763 }
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 Thu Jun 17 2021 22:41:55 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.