KNSCore::Provider Class

class KNSCore::Provider

Base Provider class. More...

Header: #include <KNewStuff/Provider>
CMake: find_package(KF6 REQUIRED COMPONENTS NewStuff)
target_link_libraries(mytarget PRIVATE KF6::NewStuff)
Inherits: QObject
Status: Deprecated since 6.9

This class is deprecated since 6.9. We strongly advise against using it in new code.

Public Types

enum Filter { None, Installed, Updates, ExactEntryId }
enum SortMode { Newest, Alphabetical, Rating, Downloads }

Properties

Public Functions

Provider()
virtual void becomeFan(const KNSCore::Entry &)
QString contactEmail() const
QStringList downloadTagFilter() const
QUrl host() const
virtual QUrl icon() const
virtual QString id() const = 0
virtual bool isInitialized() const = 0
virtual void loadBasics()
virtual void loadComments(const KNSCore::Entry &, int, int)
virtual void loadEntries(const KNSCore::Provider::SearchRequest &request) = 0
virtual void loadEntryDetails(const KNSCore::Entry &)
virtual void loadPayloadLink(const KNSCore::Entry &entry, int linkId) = 0
virtual void loadPerson(const QString &)
virtual QString name() const
virtual void setCachedEntries(const KNSCore::Entry::List &cachedEntries) = 0
void setContactEmail(const QString &contactEmail)
void setDownloadTagFilter(const QStringList &downloadTagFilter)
void setHost(const QUrl &host)
virtual bool setProviderXML(const QDomElement &xmldata) = 0
void setSupportsSsl(bool supportsSsl)
void setTagFilter(const QStringList &tagFilter)
void setVersion(const QString &version)
void setWebsite(const QUrl &website)
bool supportsSsl() const
QStringList tagFilter() const
virtual bool userCanBecomeFan()
virtual bool userCanVote()
QString version() const
virtual void vote(const KNSCore::Entry &, uint)
QUrl website() const

Signals

void basicsLoaded()
void categoriesMetadataLoded(const QList<KNSCore::Provider::CategoryMetadata> &categories)
void commentsLoaded(const QList<std::shared_ptr<KNSCore::Comment>> comments)
void downloadTagFilterChanged()
void entryDetailsLoaded(const KNSCore::Entry &)
void loadingFailed(const KNSCore::Provider::SearchRequest &)
void loadingFinished(const KNSCore::Provider::SearchRequest &, const KNSCore::Entry::List &)
void payloadLinkLoaded(const KNSCore::Entry &)
void personLoaded(const std::shared_ptr<KNSCore::Author> author)
void providerInitialized(KNSCore::Provider *)
void searchPresetsLoaded(const QList<KNSCore::Provider::SearchPreset> &presets)
void signalError(const QString &)
void signalErrorCode(KNSCore::ErrorCode::ErrorCode errorCode, const QString &message, const QVariant &metadata)
void signalInformation(const QString &)
void tagFilterChanged()

Protected Functions

void setIcon(const QUrl &icon)
void setName(const QString &name)

Detailed Description

This class provides accessors for the provider object.

Note: This class should not be used directly by the application. This class is the base class and will be instantiated for static website providers.

Use ProviderBase to implement providers (only in-tree supported). Use ProviderCore to manage instances of base.

Member Type Documentation

enum Provider::Filter

KNSCore::Provider::Filter

ConstantValue
KNSCore::Provider::None0
KNSCore::Provider::Installed1
KNSCore::Provider::Updates2
KNSCore::Provider::ExactEntryId3

enum Provider::SortMode

ConstantValue
KNSCore::Provider::Newest0
KNSCore::Provider::Alphabetical1
KNSCore::Provider::Rating2
KNSCore::Provider::Downloads3

Property Documentation

contactEmail : QString

Access functions:

QString contactEmail() const
void setContactEmail(const QString &contactEmail)

Notifier signal:

void basicsLoaded()

host : QUrl

Access functions:

QUrl host() const
void setHost(const QUrl &host)

Notifier signal:

void basicsLoaded()

supportsSsl : bool

Access functions:

bool supportsSsl() const
void setSupportsSsl(bool supportsSsl)

Notifier signal:

void basicsLoaded()

version : QString

Access functions:

QString version() const
void setVersion(const QString &version)

Notifier signal:

void basicsLoaded()

website : QUrl

Access functions:

QUrl website() const
void setWebsite(const QUrl &website)

Notifier signal:

void basicsLoaded()

Member Function Documentation

Provider::Provider()

Constructor.

[signal] void Provider::basicsLoaded()

Fired when the provider's basic information has been fetched and updated

Note: Notifier signal for property contactEmail. Notifier signal for property host. Notifier signal for property supportsSsl. Notifier signal for property version. Notifier signal for property website.

[virtual] void Provider::becomeFan(const KNSCore::Entry &)

[signal] void Provider::categoriesMetadataLoded(const QList<KNSCore::Provider::CategoryMetadata> &categories)

[signal] void Provider::commentsLoaded(const QList<std::shared_ptr<KNSCore::Comment>> comments)

Fired when new comments have been loaded

comments The list of newly loaded comments, in a depth-first order

QString Provider::contactEmail() const

Returns The general contact email for this provider.

Note: Getter function for property contactEmail.

See also setContactEmail().

QStringList Provider::downloadTagFilter() const

Returns the tag filter used for downloads by this provider.

See also EngineBase::setDownloadTagFilter.

[signal] void Provider::downloadTagFilterChanged()

[signal] void Provider::entryDetailsLoaded(const KNSCore::Entry &)

QUrl Provider::host() const

Note: Getter function for property host.

See also setHost().

[virtual] QUrl Provider::icon() const

Returns the icon URL for this provider.

See also setIcon().

[pure virtual] QString Provider::id() const

A unique Id for this provider (the url in most cases)

[pure virtual] bool Provider::isInitialized() const

[virtual] void Provider::loadBasics()

Request loading of the basic information for this provider. The engine listens to the basicsLoaded() signal for the result, which is also the signal the respective properties listen to.

This is fired automatically on the first attempt to read one of the properties which contain this basic information, and you will not need to call it as a user of the class (just listen to the properties, which will update when the information has been fetched).

Note: Implementation detail: All subclasses should connect to this signal and point it at a slot which does the actual work, if they support fetching this basic information (if the information is set during construction, you will not need to worry about this).

See also version(), website(), host(), contactEmail(), and supportsSsl().

[virtual] void Provider::loadComments(const KNSCore::Entry &, int, int)

Request a loading of comments from this provider. The engine listens to the commentsLoaded() signal for the result

Note: Implementation detail: All subclasses should connect to this signal and point it at a slot which does the actual work, if they support comments.

See also commentsLoaded.

[pure virtual] void Provider::loadEntries(const KNSCore::Provider::SearchRequest &request)

Loads the given search and return given page

request defines the search parameters

Note: the engine connects to loadingFinished() signal to get the result

[virtual] void Provider::loadEntryDetails(const KNSCore::Entry &)

[virtual] void Provider::loadPerson(const QString &)

Request loading of the details for a specific person with the given username. The engine listens to the personLoaded() for the result

Note: Implementation detail: All subclasses should connect to this signal and point it at a slot which does the actual work, if they support comments.

[signal] void Provider::loadingFailed(const KNSCore::Provider::SearchRequest &)

[signal] void Provider::loadingFinished(const KNSCore::Provider::SearchRequest &, const KNSCore::Entry::List &)

[virtual] QString Provider::name() const

Returns the common name of the provider.

See also setName().

[signal] void Provider::payloadLinkLoaded(const KNSCore::Entry &)

[signal] void Provider::personLoaded(const std::shared_ptr<KNSCore::Author> author)

Fired when the details of a person have been loaded

author The person we've just loaded data for

[signal] void Provider::providerInitialized(KNSCore::Provider *)

[signal] void Provider::searchPresetsLoaded(const QList<KNSCore::Provider::SearchPreset> &presets)

Fires when the provider has loaded search presets. These represent interesting searches for the user, such as recommendations.

[pure virtual] void Provider::setCachedEntries(const KNSCore::Entry::List &cachedEntries)

void Provider::setContactEmail(const QString &contactEmail)

Sets the general contact email address for this provider.

contactEmail The general contact email for this provider

Note: Setter function for property contactEmail.

See also contactEmail().

void Provider::setDownloadTagFilter(const QStringList &downloadTagFilter)

Sets the tag filter used for download items by this provider

downloadTagFilter The new list of filters

See also downloadTagFilter() and EngineBase::setDownloadTagFilter.

void Provider::setHost(const QUrl &host)

Sets the host used for this provider to host.

Note: Setter function for property host.

See also host().

[protected] void Provider::setIcon(const QUrl &icon)

See also icon().

[protected] void Provider::setName(const QString &name)

See also name().

[pure virtual] bool Provider::setProviderXML(const QDomElement &xmldata)

Sets the provider xmldata to initialize the provider. The Provider needs to have it's ID set in this function and cannot change it from there on.

Returns true if successful, or false if the XML data is invalid

void Provider::setSupportsSsl(bool supportsSsl)

Sets whether or not the provider supports SSL connections.

supportsSsl True if the server supports SSL connections, false if not

Note: Setter function for property supportsSsl.

See also supportsSsl().

void Provider::setTagFilter(const QStringList &tagFilter)

Sets the tag filter used for entries by this provider.

tagFilter The new list of filters

See also tagFilter() and EngineBase::setTagFilter.

void Provider::setVersion(const QString &version)

Sets the version.

Note: Setter function for property version.

See also version().

void Provider::setWebsite(const QUrl &website)

Sets the website URL.

Note: Setter function for property website.

See also website().

[signal] void Provider::signalError(const QString &)

[signal] void Provider::signalErrorCode(KNSCore::ErrorCode::ErrorCode errorCode, const QString &message, const QVariant &metadata)

[signal] void Provider::signalInformation(const QString &)

bool Provider::supportsSsl() const

Returns True if the server supports SSL connections, false if not

Note: Getter function for property supportsSsl.

See also setSupportsSsl().

QStringList Provider::tagFilter() const

Returns the tag filter used for downloads by this provider.

See also EngineBase::setTagFilter.

[signal] void Provider::tagFilterChanged()

[virtual] bool Provider::userCanBecomeFan()

[virtual] bool Provider::userCanVote()

QString Provider::version() const

Note: Getter function for property version.

See also setVersion().

[virtual] void Provider::vote(const KNSCore::Entry &, uint)

QUrl Provider::website() const

Note: Getter function for property website.

See also setWebsite().