KNewStuff

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

KDE's Doxygen guidelines are available online.