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 KNSCore::EntryInternalPrivate : public QSharedData
22 {
23 public:
24  EntryInternalPrivate()
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 EntryInternalPrivate &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 EntryInternalPrivate())
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 
164 void EntryInternal::setCategory(const QString &category)
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 
194 void EntryInternal::setLicense(const QString &license)
195 {
196  d->mLicense = license;
197 }
198 
200 {
201  return d->mSummary;
202 }
203 
204 void EntryInternal::setSummary(const QString &summary)
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 
234 void EntryInternal::setVersion(const QString &version)
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 
304 void EntryInternal::setRating(int rating)
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  // ### careful, the following variables are string views that become invalid when we
500  // proceed with reading from reader, such as the readStringTrimmed call below does!
501  const auto email = reader.attributes().value(QStringLiteral("email"));
502  const auto jabber = reader.attributes().value(QStringLiteral("im"));
503  const auto homepage = reader.attributes().value(QStringLiteral("homepage"));
504  d->mAuthor.setEmail(email.toString());
505  d->mAuthor.setJabber(jabber.toString());
506  d->mAuthor.setHomepage(homepage.toString());
507  d->mAuthor.setName(readStringTrimmed(&reader));
508  } else if (reader.name() == QLatin1String("providerid")) {
509  d->mProviderId = reader.readElementText(QXmlStreamReader::SkipChildElements);
510  } else if (reader.name() == QLatin1String("homepage")) {
512  } else if (reader.name() == QLatin1String("licence")) { // krazy:exclude=spelling
513  d->mLicense = readStringTrimmed(&reader);
514  } else if (reader.name() == QLatin1String("summary")) {
516  } else if (reader.name() == QLatin1String("changelog")) {
518  } else if (reader.name() == QLatin1String("version")) {
519  d->mVersion = readStringTrimmed(&reader);
520  } else if (reader.name() == QLatin1String("releasedate")) {
521  d->mReleaseDate = QDate::fromString(readStringTrimmed(&reader), Qt::ISODate);
522  } else if (reader.name() == QLatin1String("preview")) {
523  // TODO support for all 6 image links
524  d->mPreviewUrl[PreviewSmall1] = readStringTrimmed(&reader);
525  } else if (reader.name() == QLatin1String("previewBig")) {
526  d->mPreviewUrl[PreviewBig1] = readStringTrimmed(&reader);
527  } else if (reader.name() == QLatin1String("payload")) {
528  d->mPayload = readStringTrimmed(&reader);
529  } else if (reader.name() == QLatin1String("rating")) {
530  d->mRating = readInt(&reader);
531  } else if (reader.name() == QLatin1String("downloads")) {
532  d->mDownloadCount = readInt(&reader);
533  } else if (reader.name() == QLatin1String("category")) {
535  } else if (reader.name() == QLatin1String("signature")) {
537  } else if (reader.name() == QLatin1String("checksum")) {
539  } else if (reader.name() == QLatin1String("installedfile")) {
540  d->mInstalledFiles.append(reader.readElementText(QXmlStreamReader::SkipChildElements));
541  } else if (reader.name() == QLatin1String("id")) {
543  } else if (reader.name() == QLatin1String("tags")) {
545  } else if (reader.name() == QLatin1String("status")) {
546  const auto statusText = readText(&reader);
547  if (statusText == QLatin1String("installed")) {
548  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
549  d->mStatus = KNS3::Entry::Installed;
550  } else if (statusText == QLatin1String("updateable")) {
551  d->mStatus = KNS3::Entry::Updateable;
552  }
553  if (reader.tokenType() == QXmlStreamReader::Characters) {
554  readNextSkipComments(&reader);
555  }
556  }
557  Q_ASSERT_X(reader.tokenType() == QXmlStreamReader::EndElement,
558  Q_FUNC_INFO,
559  QStringLiteral("token name was %1 and the type was %2").arg(reader.name().toString(), reader.tokenString()).toLocal8Bit().data());
560  }
561 
562  // Validation
563  if (d->mName.isEmpty()) {
564  qWarning() << "Entry: no name given";
565  return false;
566  }
567 
568  if (d->mUniqueId.isEmpty()) {
569  if (!d->mPayload.isEmpty()) {
570  d->mUniqueId = d->mPayload;
571  } else {
572  d->mUniqueId = d->mName;
573  }
574  }
575 
576  if (d->mPayload.isEmpty()) {
577  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
578  return false;
579  }
580  return true;
581 }
582 
584 {
585  if (xmldata.tagName() != QLatin1String("stuff")) {
586  qWarning() << "Parsing Entry from invalid XML";
587  return false;
588  }
589 
590  d->mCategory = xmldata.attribute(QStringLiteral("category"));
591 
592  QDomNode n;
593  for (n = xmldata.firstChild(); !n.isNull(); n = n.nextSibling()) {
594  QDomElement e = n.toElement();
595  if (e.tagName() == QLatin1String("name")) {
596  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
597  d->mName = e.text().trimmed();
598  } else if (e.tagName() == QLatin1String("author")) {
599  QString email = e.attribute(QStringLiteral("email"));
600  QString jabber = e.attribute(QStringLiteral("im"));
601  QString homepage = e.attribute(QStringLiteral("homepage"));
602  d->mAuthor.setName(e.text().trimmed());
603  d->mAuthor.setEmail(email);
604  d->mAuthor.setJabber(jabber);
605  d->mAuthor.setHomepage(homepage);
606  } else if (e.tagName() == QLatin1String("providerid")) {
607  d->mProviderId = e.text();
608  } else if (e.tagName() == QLatin1String("homepage")) {
609  d->mHomepage = QUrl(e.text());
610  } else if (e.tagName() == QLatin1String("licence")) { // krazy:exclude=spelling
611  d->mLicense = e.text().trimmed();
612  } else if (e.tagName() == QLatin1String("summary")) {
613  d->mSummary = e.text();
614  } else if (e.tagName() == QLatin1String("changelog")) {
615  d->mChangelog = e.text();
616  } else if (e.tagName() == QLatin1String("version")) {
617  d->mVersion = e.text().trimmed();
618  } else if (e.tagName() == QLatin1String("releasedate")) {
619  d->mReleaseDate = QDate::fromString(e.text().trimmed(), Qt::ISODate);
620  } else if (e.tagName() == QLatin1String("preview")) {
621  // TODO support for all 6 image links
622  d->mPreviewUrl[PreviewSmall1] = e.text().trimmed();
623  } else if (e.tagName() == QLatin1String("previewBig")) {
624  d->mPreviewUrl[PreviewBig1] = e.text().trimmed();
625  } else if (e.tagName() == QLatin1String("payload")) {
626  d->mPayload = e.text().trimmed();
627  } else if (e.tagName() == QLatin1String("rating")) {
628  d->mRating = e.text().toInt();
629  } else if (e.tagName() == QLatin1String("downloads")) {
630  d->mDownloadCount = e.text().toInt();
631  } else if (e.tagName() == QLatin1String("category")) {
632  d->mCategory = e.text();
633  } else if (e.tagName() == QLatin1String("signature")) {
634  d->mSignature = e.text();
635  } else if (e.tagName() == QLatin1String("checksum")) {
636  d->mChecksum = e.text();
637  } else if (e.tagName() == QLatin1String("installedfile")) {
638  // TODO KF6 Add a "installeddirectory" entry to avoid
639  // all the issues with the "/*" notation which is currently used as a workaround
640  d->mInstalledFiles.append(e.text());
641  } else if (e.tagName() == QLatin1String("id")) {
642  d->mUniqueId = e.text();
643  } else if (e.tagName() == QLatin1String("tags")) {
644  d->mTags = e.text().split(QLatin1Char(','));
645  } else if (e.tagName() == QLatin1String("status")) {
646  QString statusText = e.text();
647  if (statusText == QLatin1String("installed")) {
648  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
649  d->mStatus = KNS3::Entry::Installed;
650  } else if (statusText == QLatin1String("updateable")) {
651  d->mStatus = KNS3::Entry::Updateable;
652  }
653  }
654  }
655 
656  // Validation
657  if (d->mName.isEmpty()) {
658  qWarning() << "Entry: no name given";
659  return false;
660  }
661 
662  if (d->mUniqueId.isEmpty()) {
663  if (!d->mPayload.isEmpty()) {
664  d->mUniqueId = d->mPayload;
665  } else {
666  d->mUniqueId = d->mName;
667  }
668  }
669 
670  if (d->mPayload.isEmpty()) {
671  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
672  return false;
673  }
674  return true;
675 }
676 
677 /**
678  * get the xml string for the entry
679  */
681 {
682  Q_ASSERT(!d->mUniqueId.isEmpty());
683  Q_ASSERT(!d->mProviderId.isEmpty());
684 
685  QDomDocument doc;
686 
687  QDomElement el = doc.createElement(QStringLiteral("stuff"));
688  el.setAttribute(QStringLiteral("category"), d->mCategory);
689 
690  QString name = d->mName;
691 
692  QDomElement e;
693  e = addElement(doc, el, QStringLiteral("name"), name);
694  // todo: add language attribute
695  (void)addElement(doc, el, QStringLiteral("providerid"), d->mProviderId);
696 
697  QDomElement author = addElement(doc, el, QStringLiteral("author"), d->mAuthor.name());
698  if (!d->mAuthor.email().isEmpty()) {
699  author.setAttribute(QStringLiteral("email"), d->mAuthor.email());
700  }
701  if (!d->mAuthor.homepage().isEmpty()) {
702  author.setAttribute(QStringLiteral("homepage"), d->mAuthor.homepage());
703  }
704  if (!d->mAuthor.jabber().isEmpty()) {
705  author.setAttribute(QStringLiteral("im"), d->mAuthor.jabber());
706  }
707  // FIXME: 'jabber' or 'im'? consult with kopete guys...
708  addElement(doc, el, QStringLiteral("homepage"), d->mHomepage.url());
709  (void)addElement(doc, el, QStringLiteral("licence"), d->mLicense); // krazy:exclude=spelling
710  (void)addElement(doc, el, QStringLiteral("version"), d->mVersion);
711  if ((d->mRating > 0) || (d->mDownloadCount > 0)) {
712  (void)addElement(doc, el, QStringLiteral("rating"), QString::number(d->mRating));
713  (void)addElement(doc, el, QStringLiteral("downloads"), QString::number(d->mDownloadCount));
714  }
715  if (!d->mSignature.isEmpty()) {
716  (void)addElement(doc, el, QStringLiteral("signature"), d->mSignature);
717  }
718  if (!d->mChecksum.isEmpty()) {
719  (void)addElement(doc, el, QStringLiteral("checksum"), d->mChecksum);
720  }
721  for (const QString &file : std::as_const(d->mInstalledFiles)) {
722  (void)addElement(doc, el, QStringLiteral("installedfile"), file);
723  }
724  if (!d->mUniqueId.isEmpty()) {
725  addElement(doc, el, QStringLiteral("id"), d->mUniqueId);
726  }
727 
728  (void)addElement(doc, el, QStringLiteral("releasedate"), d->mReleaseDate.toString(Qt::ISODate));
729 
730  e = addElement(doc, el, QStringLiteral("summary"), d->mSummary);
731  e = addElement(doc, el, QStringLiteral("changelog"), d->mChangelog);
732  e = addElement(doc, el, QStringLiteral("preview"), d->mPreviewUrl[PreviewSmall1]);
733  e = addElement(doc, el, QStringLiteral("previewBig"), d->mPreviewUrl[PreviewBig1]);
734  e = addElement(doc, el, QStringLiteral("payload"), d->mPayload);
735  e = addElement(doc, el, QStringLiteral("tags"), d->mTags.join(QLatin1Char(',')));
736 
737  if (d->mStatus == KNS3::Entry::Installed) {
738  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("installed"));
739  }
740  if (d->mStatus == KNS3::Entry::Updateable) {
741  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("updateable"));
742  }
743 
744  return el;
745 }
746 
747 KNSCore::EntryInternal EntryInternal::fromEntry(const KNS3::Entry &entry)
748 {
749  return entry.d->e;
750 }
751 
752 QString KNSCore::replaceBBCode(const QString &unformattedText)
753 {
754  QString text(unformattedText);
755  text.replace(QLatin1String("[b]"), QLatin1String("<b>"));
756  text.replace(QLatin1String("[/b]"), QLatin1String("</b>"));
757  text.replace(QLatin1String("[i]"), QLatin1String("<i>"));
758  text.replace(QLatin1String("[/i]"), QLatin1String("</i>"));
759  text.replace(QLatin1String("[u]"), QLatin1String("<i>"));
760  text.replace(QLatin1String("[/u]"), QLatin1String("</i>"));
761  text.replace(QLatin1String("\\\""), QLatin1String("\""));
762  text.replace(QLatin1String("\\\'"), QLatin1String("\'"));
763  text.replace(QLatin1String("[li]"), QLatin1String("* ")); // TODO: better replacement for list elements?
764  text.remove(QStringLiteral("[/li]"));
765  text.remove(QStringLiteral("[url]"));
766  text.remove(QStringLiteral("[/url]"));
767  return text;
768 }
int numberKnowledgebaseEntries() const
The number of entries in the knowledgebase for this entry.
QString uniqueId() const
Get the object's unique ID.
void setInstalledFiles(const QStringList &files)
Set the files that have been installed by the install command.
void setAuthor(const Author &author)
Sets the author of the object.
QString text() const const
QDomNode firstChild() const const
QDomElement toElement() const const
int numberFans() const
How many people have marked themselves as fans of this entry.
KNewStuff data entry container.
Definition: entryinternal.h:52
QString number(int n, int base)
Source
Source of the entry, A entry's data is coming from either cache, or an online provider this helps the...
Definition: entryinternal.h:63
EntryInternal()
Constructor.
QStringRef value(const QString &namespaceUri, const QString &name) const const
KNEWSTUFFCORE_EXPORT QString replaceBBCode(const QString &unformattedText)
function to remove bb code formatting that opendesktop sends
QString shortSummary() const
Retrieve a short description of what the object is all about (should be very short)
QStringList uninstalledFiles() const
Retrieve the locally uninstalled files.
QString tagName() const const
QStringRef text() const const
QString providerId() const
The id of the provider this entry belongs to.
QDate releaseDate() const
Retrieve the date of the object's publication.
QStringList split(const QString &sep, QString::SplitBehavior behavior, Qt::CaseSensitivity cs) const const
bool isNull() const const
KNewStuff information about changed entries.
Definition: entry.h:35
QString trimmed() const const
Author author() const
Retrieve the author of the object.
QString summary() const
Retrieve a (potentially very long) description of the object.
void setUpdateVersion(const QString &version)
Sets the version number that is available as update.
QStringList installedFiles() const
Retrieve the locally installed files.
void setName(const QString &name)
Sets the name for this data object.
QDomElement createElement(const QString &tagName)
void setTags(const QStringList &tags)
Set the tags for the content item.
QStringRef trimmed() const const
void setStatus(KNS3::Entry::Status status)
Sets the entry's status.
void setReleaseDate(const QDate &releasedate)
Sets the release date.
QStringRef name() const const
QUrl homepage() const
A link to a website containing information about this entry.
void setAttribute(const QString &name, const QString &value)
void setUnInstalledFiles(const QStringList &files)
Set the files that have been uninstalled by the uninstall command.
QString updateVersion() const
Retrieve the version string of the object that is available as update.
bool operator==(const Qt3DRender::QGraphicsApiFilter &reference, const Qt3DRender::QGraphicsApiFilter &sample)
void setUniqueId(const QString &id)
Set the object's unique ID.
KNewStuff author information.
Definition: core/author.h:30
void setVersion(const QString &version)
Sets the version number.
The namespace for the KNewStuff classes.
Definition: button.cpp:21
QString payload() const
Retrieve the file name of the object.
void setKnowledgebaseLink(const QString &link)
Set the link for the knowledgebase.
void setHomepage(const QUrl &page)
Set a link to a website containing information about this entry.
QXmlStreamReader::TokenType readNext()
QString tokenString() const const
QXmlStreamReader::TokenType tokenType() const const
QStringList tags() const
The set of tags assigned specifically to this content item.
int toInt(bool *ok, int base) const const
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 readElementText(QXmlStreamReader::ReadElementTextBehaviour behaviour)
QXmlStreamAttributes attributes() const const
QString previewUrl(PreviewType type=PreviewSmall1) const
Retrieve the file name of an image containing a preview of the object.
QList< DownloadLinkInformation > downloadLinkInformationList() const
A list of downloadable data for this entry.
void setNumberKnowledgebaseEntries(int num)
Set the number of knowledgebase entries for this entry.
void setShortSummary(const QString &summary)
Sets a short description of what the object is all about (should be very short)
QString & replace(int position, int n, QChar after)
QString & remove(int position, int n)
QImage previewImage(PreviewType type=PreviewSmall1) const
This will not be loaded automatically, instead use Engine to load the actual images.
void setUpdateReleaseDate(const QDate &releasedate)
Sets the release date that is available as update.
void setDonationLink(const QString &link)
Set a string representation of the URL for the donation website for this entry.
QDate fromString(const QString &string, Qt::DateFormat format)
void setLicense(const QString &license)
Sets the license (abbreviation) applicable to the object.
int downloadCount() const
Retrieve the download count for the object, which has been determined by its hosting sites and thus m...
void setSummary(const QString &summary)
Sets a description (which can potentially be very long)
QString toString() const const
Status
Status of the entry.
Definition: entry.h:49
QString license() const
Retrieve the license name of the object.
void appendDownloadLinkInformation(const DownloadLinkInformation &info)
Add a new download option to this entry.
int rating() const
Retrieve the rating for the object, which has been determined by its users and thus might change over...
QDomElement entryXML() const
get the xml string for the entry
QString donationLink() const
A string representing the URL for a website where the user can donate to the author of this entry.
QDomNode nextSibling() const const
bool isEmpty() const const
QDate updateReleaseDate() const
Retrieve the date of the newer version that is available as update.
EntryType
Represents whether the current entry is an actual catalog entry, or an entry that represents a set of...
void setNumberFans(int fans)
Sets how many people are fans.
void setEntryType(EntryType type)
The entry type is either catalog entry, or group entry.
QString category() const
Retrieve the category of the data object.
QString version() const
Retrieve the version string of the object.
QString attribute(const QString &name, const QString &defValue) const const
Contains the core functionality for handling interaction with NewStuff providers.
bool atEnd() const const
void setChangelog(const QString &changelog)
The user written changelog.
int downloadLinkCount() const
The number of available download options for this entry.
void setPayload(const QString &url)
Sets the object's file.
void clearDownloadLinkInformation()
Remove all download options from this entry.
void setNumberOfComments(int comments)
Sets the number of comments in the asset.
QString & append(QChar ch)
void setPreviewUrl(const QString &url, PreviewType type=PreviewSmall1)
Sets the object's preview file, if available.
QString name() const
Retrieve the name of the data object.
void setDownloadCount(int downloads)
Sets the number of downloads.
KNS3::Entry::Status status() const
Retrieves the entry's status.
void setCategory(const QString &category)
Sets the data category, e.g.
QString knowledgebaseLink() const
The link for the knowledgebase for this entry.
void setRating(int rating)
Sets the rating between 0 (worst) and 100 (best).
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri Aug 19 2022 04:14:30 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.