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

KDE's Doxygen guidelines are available online.