KNewStuff
opdsprovider.cpp
27static const QLatin1String OPDS_REL_AC_OPEN_ACCESS{"http://opds-spec.org/acquisition/open-access"};
163 if (entry.status() == KNSCore::Entry::Installed || entry.status() == KNSCore::Entry::Updateable) {
181 qCWarning(KNEWSTUFFCORE) << "Opensearch link does not point at document with opensearch namespace" << openSearchDocumentURL;
187 if (openSearchTemplate.isEmpty() || el.attribute(OPENSEARCH_ATTR_TYPE).contains(OPDS_PROFILE)) {
208 Syndication::Atom::FeedDocumentPtr feedDoc = parser.parse(source).staticCast<Syndication::Atom::FeedDocument>();
210 QString fullEntryMimeType = QStringList({OPDS_ATOM_MT, OPDS_TYPE_ENTRY, OPDS_PROFILE}).join(QStringLiteral(";"));
248 // There will be a number of links toplevel, amongst which probably a lot of sortorder and navigation links.
265 [this, &osdUrlLoader, theLink](int status, QList<QNetworkReply::RawHeaderPair> rawHeaders) { // clazy:exclude=lambda-in-connect
271 // Retry-After is not a known header, so we need to do a bit of running around to make that work
272 // Also, the fromHttpDate function is in the private qnetworkrequest header, so we can't use that
273 // So, simple workaround, just pass it through a dummy request and get a formatted date out (the
282 QTimer::singleShot(retryAfter.toMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch(), q, [&osdUrlLoader, theLink]() {
287 // more than that, spit out TryAgainLaterError to let the user know what we're doing with their time
292 formatter.formatSpelloutDuration(retryAfter.toMSecsSinceEpoch() - QDateTime::currentMSecsSinceEpoch())),
301 SearchRequest request(SortMode::Downloads, Filter::None, fixRelativeUrl(link.href()).toString());
402 // Linkrelations can have multiple values, expressed as something like... rel="me nofollow alternate".
421 l.append(QStringLiteral("(") + link.rel().split(QStringLiteral("/")).last() + QStringLiteral(")"));
429 if (linkRelation.contains(OPDS_REL_AC_BORROW) || linkRelation.contains(OPDS_REL_AC_SUBSCRIBE) || linkRelation.contains(OPDS_REL_AC_BUY)) {
433 } else if (linkRelation.contains(OPDS_REL_ACQUISITION) || linkRelation.contains(OPDS_REL_AC_OPEN_ACCESS)) {
436 if (entry.status() != KNSCore::Entry::Installed && entry.status() != KNSCore::Entry::Updateable) {
442 // TODO, support preview relation, but this requires we show that an entry is otherwise paid for in the UI.
446 download.priceAmount = locale.toCurrencyString(el.text().toFloat(), el.attribute(ATTR_CURRENCY_CODE));
461 // This could be anything from a more info link, to navigation links, to links to the outside world.
482 // published is the released date of the opds catalog item, updated for the opds catalog item update.
605 QString entryMimeType = QStringList({OPDS_ATOM_MT, OPDS_TYPE_ENTRY, OPDS_PROFILE}).join(QStringLiteral(";"));
QString formatSpelloutDuration(quint64 msecs) const
QList< DownloadLinkInformation > downloadLinkInformationList() const
A list of downloadable data for this entry.
Definition entry.cpp:354
@ GroupEntry
these are entries whose payload is another feed. Currently only used by the OPDS provider.
Definition entry.h:135
@ CatalogEntry
These are the main entries that KNewStuff can get the details about and download links for.
Definition entry.h:134
@ FolderUp
preset indicating going up in the search result hierarchy.
@ Recommended
preset for recommended. This may be customized by the server per user.
@ AllEntries
preset indicating all possible entries, such as a crawlable list. Might be intense to load.
@ Subscription
preset indicating items that the user is subscribed to.
bool isEscapedHTML() const
QString asString() const
QString rights() const
QString title() const
Content content() const
QList< Person > authors() const
time_t updated() const
QString summary() const
QString id() const
QList< Category > categories() const
QList< Link > links() const
Syndication::SpecificDocumentPtr parse(const Syndication::DocumentSource &source) const override
QString name() const
QString email() const
QString uri() const
QString childNodesAsXML() const
QList< QDomElement > elementsByTagName(const QString &tagName) const
Q_SCRIPTABLE CaptureState status()
QString i18n(const char *text, const TYPE &arg...)
KSERVICE_EXPORT KService::List query(FilterFunc filterFunc)
KIOCORE_EXPORT CopyJob * link(const QList< QUrl > &src, const QUrl &destDir, JobFlags flags=DefaultFlags)
const QList< QKeySequence > & copy()
QDateTime currentDateTime()
qint64 currentMSecsSinceEpoch()
qint64 currentSecsSinceEpoch()
QDate date() const const
QDateTime fromSecsSinceEpoch(qint64 secs)
qint64 secsTo(const QDateTime &other) const const
qint64 toMSecsSinceEpoch() const const
qint64 toSecsSinceEpoch() const const
QDomElement documentElement() const const
QByteArray toByteArray(int indent) const const
QString attribute(const QString &name, const QString &defValue) const const
QString tagName() const const
QString text() const const
QDomNode firstChild() const const
QDomElement firstChildElement(const QString &tagName, const QString &namespaceURI) const const
bool isNull() const const
QDomNode nextSibling() const const
QDomElement nextSiblingElement(const QString &tagName, const QString &namespaceURI) const const
QDomElement toElement() const const
void append(QList< T > &&value)
QString toCurrencyString(double value, const QString &symbol, int precision) const const
RawHeaderPair
LastModifiedHeader
QVariant header(KnownHeaders header) const const
void setRawHeader(const QByteArray &headerName, const QByteArray &headerValue)
QMetaObject::Connection connect(const QObject *sender, PointerToMemberFunction signal, Functor functor)
void clear()
bool contains(QChar ch, Qt::CaseSensitivity cs) const const
bool isEmpty() const const
QString number(double n, char format, int precision)
bool startsWith(QChar c, Qt::CaseSensitivity cs) const const
float toFloat(bool *ok) const const
QString trimmed() const const
bool contains(QLatin1StringView str, Qt::CaseSensitivity cs) const const
QString join(QChar separator) const const
QFuture< ArgsType< Signal > > connect(Sender *sender, Signal signal)
singleShot
QUrl fromLocalFile(const QString &localFile)
bool isEmpty() const const
QUrl resolved(const QUrl &relative) const const
QString scheme() const const
void setQuery(const QString &query, ParsingMode mode)
QString toString(FormattingOptions options) const const
QDateTime toDateTime() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:20:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:20:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.