KNewStuff

entryinternal.cpp
1 /*
2  This file is part of KNewStuff2.
3  Copyright (c) 2002 Cornelius Schumacher <[email protected]>
4  Copyright (c) 2003 - 2007 Josef Spillner <[email protected]>
5  Copyright (C) 2009 Frederik Gladhorn <[email protected]>
6 
7  This library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public
18  License along with this library. If not, see <http://www.gnu.org/licenses/>.
19 */
20 
21 #include "entryinternal.h"
22 
23 #include <QStringList>
24 #include <QXmlStreamReader>
25 #include <QImage>
26 #include <knewstuffcore_debug.h>
27 
28 #include "xmlloader.h"
29 #include "../entry_p.h" // For Entry::Status ONLY!
30 
31 
32 using namespace KNSCore;
33 
34 class EntryInternal::Private : public QSharedData
35 {
36 public:
37  Private()
38  : mReleaseDate(QDate::currentDate())
39  , mRating(0)
40  , mNumberOfComments(0)
41  , mDownloadCount(0)
42  , mNumberFans(0)
43  , mNumberKnowledgebaseEntries(0)
44  , mStatus(KNS3::Entry::Invalid)
45  , mSource(EntryInternal::Online)
46  {
47  qRegisterMetaType<KNSCore::EntryInternal::List>();
48  }
49 
50  bool operator==(const Private &other) const
51  {
52  return mUniqueId == other.mUniqueId && mProviderId == other.mProviderId;
53  }
54 
55  QString mUniqueId;
56  QString mName;
57  QUrl mHomepage;
58  QString mCategory;
59  QString mLicense;
60  QString mVersion;
61  QDate mReleaseDate;
62 
63  // Version and date if a newer version is found (updateable)
64  QString mUpdateVersion;
65  QDate mUpdateReleaseDate;
66 
67  Author mAuthor;
68  int mRating;
69  int mNumberOfComments;
70  int mDownloadCount;
71  int mNumberFans;
72  int mNumberKnowledgebaseEntries;
73  QString mKnowledgebaseLink;
74  QString mSummary;
75  QString mShortSummary;
76  QString mChangelog;
77  QString mPayload;
78  QStringList mInstalledFiles;
79  QString mProviderId;
80  QStringList mUnInstalledFiles;
81  QString mDonationLink;
82  QStringList mTags;
83 
84  QString mChecksum;
85  QString mSignature;
86  KNS3::Entry::Status mStatus;
87  EntryInternal::Source mSource;
88 
89  QString mPreviewUrl[6];
90  QImage mPreviewImage[6];
91 
92  QList<EntryInternal::DownloadLinkInformation> mDownloadLinkInformationList;
93 };
94 
96  : d(new Private)
97 {
98 }
99 
101  : d(other.d)
102 {
103 }
104 
105 EntryInternal &EntryInternal::operator=(const EntryInternal &other)
106 {
107  d = other.d;
108  return *this;
109 }
110 
111 bool EntryInternal::operator<(const KNSCore::EntryInternal &other) const
112 {
113  return d->mUniqueId < other.d->mUniqueId;
114 }
115 
116 bool EntryInternal::operator==(const KNSCore::EntryInternal &other) const
117 {
118  return d->mUniqueId == other.d->mUniqueId && d->mProviderId == other.d->mProviderId;
119 }
120 
122 {
123 }
124 
125 bool EntryInternal::isValid() const
126 {
127  return !d->mUniqueId.isEmpty();
128 }
129 
131 {
132  return d->mName;
133 }
134 
136 {
137  d->mName = name;
138 }
139 
141 {
142  return d->mUniqueId;
143 }
144 
146 {
147  d->mUniqueId = id;
148 }
149 
151 {
152  return d->mProviderId;
153 }
154 
155 void EntryInternal::setProviderId(const QString &id)
156 {
157  d->mProviderId = id;
158 }
159 
161 {
162  return d->mTags;
163 }
164 
166 {
167  d->mTags = tags;
168 }
169 
171 {
172  return d->mCategory;
173 }
174 
176 {
177  d->mCategory = category;
178 }
179 
181 {
182  return d->mHomepage;
183 }
184 
186 {
187  d->mHomepage = page;
188 }
189 
191 {
192  return d->mAuthor;
193 }
194 
196 {
197  d->mAuthor = author;
198 }
199 
201 {
202  return d->mLicense;
203 }
204 
206 {
207  d->mLicense = license;
208 }
209 
211 {
212  return d->mSummary;
213 }
214 
216 {
217  d->mSummary = summary;
218 }
219 
221 {
222  return d->mShortSummary;
223 }
224 
226 {
227  d->mShortSummary = summary;
228 }
229 
230 void EntryInternal::setChangelog(const QString &changelog)
231 {
232  d->mChangelog = changelog;
233 }
234 
235 QString EntryInternal::changelog() const
236 {
237  return d->mChangelog;
238 }
239 
241 {
242  return d->mVersion;
243 }
244 
246 {
247  d->mVersion = version;
248 }
249 
251 {
252  return d->mReleaseDate;
253 }
254 
255 void EntryInternal::setReleaseDate(const QDate &releasedate)
256 {
257  d->mReleaseDate = releasedate;
258 }
259 
261 {
262  return d->mPayload;
263 }
264 
266 {
267  d->mPayload = url;
268 }
269 
271 {
272  return d->mUpdateReleaseDate;
273 }
274 
276 {
277  d->mUpdateReleaseDate = releasedate;
278 }
279 
281 {
282  return d->mUpdateVersion;
283 }
284 
286 {
287  d->mUpdateVersion = version;
288 }
289 
290 QString EntryInternal::previewUrl(PreviewType type) const
291 {
292  return d->mPreviewUrl[type];
293 }
294 
295 void EntryInternal::setPreviewUrl(const QString &url, PreviewType type)
296 {
297  d->mPreviewUrl[type] = url;
298 }
299 
300 QImage EntryInternal::previewImage(PreviewType type) const
301 {
302  return d->mPreviewImage[type];
303 }
304 
305 void EntryInternal::setPreviewImage(const QImage &image, PreviewType type)
306 {
307  d->mPreviewImage[type] = image;
308 }
309 
311 {
312  return d->mRating;
313 }
314 
316 {
317  d->mRating = rating;
318 }
319 
321 {
322  return d->mNumberOfComments;
323 }
324 
326 {
327  d->mNumberOfComments = comments;
328 }
329 
331 {
332  return d->mDownloadCount;
333 }
334 
336 {
337  d->mDownloadCount = downloads;
338 }
339 
341 {
342  return d->mNumberFans;
343 }
344 
346 {
347  d->mNumberFans = fans;
348 }
349 
351 {
352  return d->mDonationLink;
353 }
354 
356 {
357  d->mDonationLink = link;
358 }
359 
361 {
362  return d->mNumberKnowledgebaseEntries;
363 }
365 {
366  d->mNumberKnowledgebaseEntries = num;
367 }
368 
370 {
371  return d->mKnowledgebaseLink;
372 }
374 {
375  d->mKnowledgebaseLink = link;
376 }
377 
378 EntryInternal::Source EntryInternal::source() const
379 {
380  return d->mSource;
381 }
382 
384 {
385  d->mSource = source;
386 }
387 
389 {
390  return d->mStatus;
391 }
392 
394 {
395  d->mStatus = status;
396 }
397 
399 {
400  d->mInstalledFiles = files;
401 }
402 
404 {
405  return d->mInstalledFiles;
406 }
407 
409 {
410  d->mUnInstalledFiles = files;
411 }
412 
414 {
415  return d->mUnInstalledFiles;
416 }
417 
419 {
420  return d->mDownloadLinkInformationList.size();
421 }
422 
424 {
425  return d->mDownloadLinkInformationList;
426 }
427 
428 void KNSCore::EntryInternal::appendDownloadLinkInformation(const KNSCore::EntryInternal::DownloadLinkInformation &info)
429 {
430  d->mDownloadLinkInformationList.append(info);
431 }
432 
434 {
435  d->mDownloadLinkInformationList.clear();
436 }
437 
438 static QXmlStreamReader::TokenType readNextSkipComments(QXmlStreamReader* xml)
439 {
440  do {
441  xml->readNext();
442  } while(xml->tokenType() == QXmlStreamReader::Comment || (xml->tokenType() == QXmlStreamReader::Characters && xml->text().trimmed().isEmpty()));
443  return xml->tokenType();
444 }
445 
446 static QStringRef readText(QXmlStreamReader* xml)
447 {
448  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
449  QStringRef ret;
450  const auto token = readNextSkipComments(xml);
451  if (token == QXmlStreamReader::Characters) {
452  ret = xml->text();
453  }
454  return ret;
455 }
456 
457 static QString readStringTrimmed(QXmlStreamReader* xml)
458 {
459  Q_ASSERT(xml->tokenType() == QXmlStreamReader::StartElement);
460  QString ret = readText(xml).trimmed().toString();
461 
463  readNextSkipComments(xml);
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  if (reader.name() == QLatin1String("name")) {
495  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
497  } else if (reader.name() == QLatin1String("author")) {
498  const auto email = reader.attributes().value(QStringLiteral("email"));
499  const auto jabber = reader.attributes().value(QStringLiteral("im"));
500  const auto homepage = reader.attributes().value(QStringLiteral("homepage"));
501  d->mAuthor.setName(readStringTrimmed(&reader));
502  d->mAuthor.setEmail(email.toString());
503  d->mAuthor.setJabber(jabber.toString());
504  d->mAuthor.setHomepage(homepage.toString());
505  } else if (reader.name() == QLatin1String("providerid")) {
506  d->mProviderId = reader.readElementText(QXmlStreamReader::SkipChildElements);
507  } else if (reader.name() == QLatin1String("homepage")) {
509  } else if (reader.name() == QLatin1String("licence")) { // krazy:exclude=spelling
510  d->mLicense = readStringTrimmed(&reader);
511  } else if (reader.name() == QLatin1String("summary")) {
513  } else if (reader.name() == QLatin1String("changelog")) {
515  } else if (reader.name() == QLatin1String("version")) {
516  d->mVersion = readStringTrimmed(&reader);
517  } else if (reader.name() == QLatin1String("releasedate")) {
518  d->mReleaseDate = QDate::fromString(readStringTrimmed(&reader), Qt::ISODate);
519  } else if (reader.name() == QLatin1String("preview")) {
520  // TODO support for all 6 image links
521  d->mPreviewUrl[PreviewSmall1] = readStringTrimmed(&reader);
522  } else if (reader.name() == QLatin1String("previewBig")) {
523  d->mPreviewUrl[PreviewBig1] = readStringTrimmed(&reader);
524  } else if (reader.name() == QLatin1String("payload")) {
525  d->mPayload = readStringTrimmed(&reader);
526  } else if (reader.name() == QLatin1String("rating")) {
527  d->mRating = readInt(&reader);
528  } else if (reader.name() == QLatin1String("downloads")) {
529  d->mDownloadCount = readInt(&reader);
530  } else if (reader.name() == QLatin1String("category")) {
532  } else if (reader.name() == QLatin1String("signature")) {
534  } else if (reader.name() == QLatin1String("checksum")) {
536  } else if (reader.name() == QLatin1String("installedfile")) {
537  d->mInstalledFiles.append(reader.readElementText(QXmlStreamReader::SkipChildElements));
538  } else if (reader.name() == QLatin1String("id")) {
540  } else if (reader.name() == QLatin1String("tags")) {
542  } else if (reader.name() == QLatin1String("status")) {
543  const auto statusText = readText(&reader);
544  if (statusText == QLatin1String("installed")) {
545  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
546  d->mStatus = KNS3::Entry::Installed;
547  } else if (statusText == QLatin1String("updateable")) {
548  d->mStatus = KNS3::Entry::Updateable;
549  }
550  if (reader.tokenType() == QXmlStreamReader::Characters)
551  readNextSkipComments(&reader);
552  }
553  Q_ASSERT_X(reader.tokenType() == QXmlStreamReader::EndElement, Q_FUNC_INFO, QStringLiteral("token name was %1 and the type was %2").arg(reader.name().toString()).arg(reader.tokenString()).toLocal8Bit().data());
554  }
555 
556  // Validation
557  if (d->mName.isEmpty()) {
558  qWarning() << "Entry: no name given";
559  return false;
560  }
561 
562  if (d->mUniqueId.isEmpty()) {
563  if (!d->mPayload.isEmpty()) {
564  d->mUniqueId = d->mPayload;
565  } else {
566  d->mUniqueId = d->mName;
567  }
568  }
569 
570  if (d->mPayload.isEmpty()) {
571  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
572  return false;
573  }
574  return true;
575 }
576 
578 {
579  if (xmldata.tagName() != QLatin1String("stuff")) {
580  qWarning() << "Parsing Entry from invalid XML";
581  return false;
582  }
583 
584  d->mCategory = xmldata.attribute(QStringLiteral("category"));
585 
586  QDomNode n;
587  for (n = xmldata.firstChild(); !n.isNull(); n = n.nextSibling()) {
588  QDomElement e = n.toElement();
589  if (e.tagName() == QLatin1String("name")) {
590  // TODO maybe do something with the language attribute? QString lang = e.attribute("lang");
591  d->mName = e.text().trimmed();
592  } else if (e.tagName() == QLatin1String("author")) {
593  QString email = e.attribute(QStringLiteral("email"));
594  QString jabber = e.attribute(QStringLiteral("im"));
595  QString homepage = e.attribute(QStringLiteral("homepage"));
596  d->mAuthor.setName(e.text().trimmed());
597  d->mAuthor.setEmail(email);
598  d->mAuthor.setJabber(jabber);
599  d->mAuthor.setHomepage(homepage);
600  } else if (e.tagName() == QLatin1String("providerid")) {
601  d->mProviderId = e.text();
602  } else if (e.tagName() == QLatin1String("homepage")) {
603  d->mHomepage = QUrl(e.text());
604  } else if (e.tagName() == QLatin1String("licence")) { // krazy:exclude=spelling
605  d->mLicense = e.text().trimmed();
606  } else if (e.tagName() == QLatin1String("summary")) {
607  d->mSummary = e.text();
608  } else if (e.tagName() == QLatin1String("changelog")) {
609  d->mChangelog = e.text();
610  } else if (e.tagName() == QLatin1String("version")) {
611  d->mVersion = e.text().trimmed();
612  } else if (e.tagName() == QLatin1String("releasedate")) {
613  d->mReleaseDate = QDate::fromString(e.text().trimmed(), Qt::ISODate);
614  } else if (e.tagName() == QLatin1String("preview")) {
615  // TODO support for all 6 image links
616  d->mPreviewUrl[PreviewSmall1] = e.text().trimmed();
617  } else if (e.tagName() == QLatin1String("previewBig")) {
618  d->mPreviewUrl[PreviewBig1] = e.text().trimmed();
619  } else if (e.tagName() == QLatin1String("payload")) {
620  d->mPayload = e.text().trimmed();
621  } else if (e.tagName() == QLatin1String("rating")) {
622  d->mRating = e.text().toInt();
623  } else if (e.tagName() == QLatin1String("downloads")) {
624  d->mDownloadCount = e.text().toInt();
625  } else if (e.tagName() == QLatin1String("category")) {
626  d->mCategory = e.text();
627  } else if (e.tagName() == QLatin1String("signature")) {
628  d->mSignature = e.text();
629  } else if (e.tagName() == QLatin1String("checksum")) {
630  d->mChecksum = e.text();
631  } else if (e.tagName() == QLatin1String("installedfile")) {
632  d->mInstalledFiles.append(e.text());
633  } else if (e.tagName() == QLatin1String("id")) {
634  d->mUniqueId = e.text();
635  } else if (e.tagName() == QLatin1String("tags")) {
636  d->mTags = e.text().split(QLatin1Char(','));
637  } else if (e.tagName() == QLatin1String("status")) {
638  QString statusText = e.text();
639  if (statusText == QLatin1String("installed")) {
640  qCDebug(KNEWSTUFFCORE) << "Found an installed entry in registry";
641  d->mStatus = KNS3::Entry::Installed;
642  } else if (statusText == QLatin1String("updateable")) {
643  d->mStatus = KNS3::Entry::Updateable;
644  }
645  }
646  }
647 
648  // Validation
649  if (d->mName.isEmpty()) {
650  qWarning() << "Entry: no name given";
651  return false;
652  }
653 
654  if (d->mUniqueId.isEmpty()) {
655  if (!d->mPayload.isEmpty()) {
656  d->mUniqueId = d->mPayload;
657  } else {
658  d->mUniqueId = d->mName;
659  }
660  }
661 
662  if (d->mPayload.isEmpty()) {
663  qWarning() << "Entry: no payload URL given for: " << d->mName << " - " << d->mUniqueId;
664  return false;
665  }
666  return true;
667 }
668 
673 {
674  Q_ASSERT(!d->mUniqueId.isEmpty());
675  Q_ASSERT(!d->mProviderId.isEmpty());
676 
677  QDomDocument doc;
678 
679  QDomElement el = doc.createElement(QStringLiteral("stuff"));
680  el.setAttribute(QStringLiteral("category"), d->mCategory);
681 
682  QString name = d->mName;
683 
684  QDomElement e;
685  e = addElement(doc, el, QStringLiteral("name"), name);
686  // todo: add language attribute
687  (void)addElement(doc, el, QStringLiteral("providerid"), d->mProviderId);
688 
689  QDomElement author = addElement(doc, el, QStringLiteral("author"), d->mAuthor.name());
690  if (!d->mAuthor.email().isEmpty()) {
691  author.setAttribute(QStringLiteral("email"), d->mAuthor.email());
692  }
693  if (!d->mAuthor.homepage().isEmpty()) {
694  author.setAttribute(QStringLiteral("homepage"), d->mAuthor.homepage());
695  }
696  if (!d->mAuthor.jabber().isEmpty()) {
697  author.setAttribute(QStringLiteral("im"), d->mAuthor.jabber());
698  }
699  // FIXME: 'jabber' or 'im'? consult with kopete guys...
700  addElement(doc, el, QStringLiteral("homepage"), d->mHomepage.url());
701  (void)addElement(doc, el, QStringLiteral("licence"), d->mLicense); // krazy:exclude=spelling
702  (void)addElement(doc, el, QStringLiteral("version"), d->mVersion);
703  if ((d->mRating > 0) || (d->mDownloadCount > 0)) {
704  (void)addElement(doc, el, QStringLiteral("rating"), QString::number(d->mRating));
705  (void)addElement(doc, el, QStringLiteral("downloads"), QString::number(d->mDownloadCount));
706  }
707  if (!d->mSignature.isEmpty()) {
708  (void)addElement(doc, el, QStringLiteral("signature"), d->mSignature);
709  }
710  if (!d->mChecksum.isEmpty()) {
711  (void)addElement(doc, el, QStringLiteral("checksum"), d->mChecksum);
712  }
713  for (const QString &file : qAsConst(d->mInstalledFiles)) {
714  (void)addElement(doc, el, QStringLiteral("installedfile"), file);
715  }
716  if (!d->mUniqueId.isEmpty()) {
717  addElement(doc, el, QStringLiteral("id"), d->mUniqueId);
718  }
719 
720  (void)addElement(doc, el, QStringLiteral("releasedate"),
721  d->mReleaseDate.toString(Qt::ISODate));
722 
723  e = addElement(doc, el, QStringLiteral("summary"), d->mSummary);
724  e = addElement(doc, el, QStringLiteral("changelog"), d->mChangelog);
725  e = addElement(doc, el, QStringLiteral("preview"), d->mPreviewUrl[PreviewSmall1]);
726  e = addElement(doc, el, QStringLiteral("previewBig"), d->mPreviewUrl[PreviewBig1]);
727  e = addElement(doc, el, QStringLiteral("payload"), d->mPayload);
728  e = addElement(doc, el, QStringLiteral("tags"), d->mTags.join(QLatin1Char(',')));
729 
730  if (d->mStatus == KNS3::Entry::Installed) {
731  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("installed"));
732  }
733  if (d->mStatus == KNS3::Entry::Updateable) {
734  (void)addElement(doc, el, QStringLiteral("status"), QStringLiteral("updateable"));
735  }
736 
737  return el;
738 }
739 
740 KNSCore::EntryInternal EntryInternal::fromEntry(const KNS3::Entry &entry)
741 {
742  return entry.d->e;
743 }
744 
745 QString KNSCore::replaceBBCode(const QString &unformattedText)
746 {
747  QString text(unformattedText);
748  text.replace(QLatin1String("[b]"), QLatin1String("<b>"));
749  text.replace(QLatin1String("[/b]"), QLatin1String("</b>"));
750  text.replace(QLatin1String("[i]"), QLatin1String("<i>"));
751  text.replace(QLatin1String("[/i]"), QLatin1String("</i>"));
752  text.replace(QLatin1String("[u]"), QLatin1String("<i>"));
753  text.replace(QLatin1String("[/u]"), QLatin1String("</i>"));
754  text.replace(QLatin1String("\\\""), QLatin1String("\""));
755  text.replace(QLatin1String("\\\'"), QLatin1String("\'"));
756  text.replace(QLatin1String("[li]"), QLatin1String("* ")); // TODO: better replacement for list elements?
757  text.remove(QStringLiteral("[/li]"));
758  text.remove(QStringLiteral("[url]"));
759  text.remove(QStringLiteral("[/url]"));
760  return text;
761 }
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:70
QStringRef value(const QString &namespaceUri, const QString &name) const const
QString & remove(int position, int n)
KNewStuff author information.
Definition: core/author.h:40
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:43
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:57
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:60
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.
Definition: button.cpp:29
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-2020 The KDE developers.
Generated on Sun Aug 9 2020 22:43:40 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.