KNSCore::Engine

Search for usage in LXR

#include <engine.h>

Inheritance diagram for KNSCore::Engine:

Public Types

enum  BusyOperation { Initializing, LoadingData, LoadingPreview, InstallingEntry }
 
typedef QFlags< BusyOperation > BusyState
 

Properties

QString busyMessage
 
BusyState busyState
 
QStringList providerIDs
 
bool uploadEnabled
 
QString useLabel
 
- Properties inherited from QObject
 objectName
 

Signals

void jobStarted (KJob *, const QString &)
 
void signalBusy (const QString &)
 
void signalCategoriesMetadataLoded (const QList< Provider::CategoryMetadata > &categories)
 
void signalDownloadDialogDone (KNSCore::EntryInternal::List)
 
void signalEntriesLoaded (const KNSCore::EntryInternal::List &entries)
 
void signalEntryChanged (const KNSCore::EntryInternal &entry)
 
void signalEntryDetailsLoaded (const KNSCore::EntryInternal &entry)
 
void signalEntryEvent (const EntryInternal &entry, EntryInternal::EntryEvent event)
 
void signalEntryPreviewLoaded (const KNSCore::EntryInternal &, KNSCore::EntryInternal::PreviewType)
 
void signalEntryUploadFailed ()
 
void signalEntryUploadFinished ()
 
void signalError (const QString &)
 
void signalErrorCode (const KNSCore::ErrorCode &errorCode, const QString &message, const QVariant &metadata)
 
void signalIdle (const QString &)
 
void signalMessage (const QString &message)
 
void signalPreviewFailed ()
 
void signalProvidersLoaded ()
 
void signalResetView ()
 
void signalSearchPresetsLoaded (const QList< Provider::SearchPreset > &presets)
 
void signalUpdateableEntriesLoaded (const KNSCore::EntryInternal::List &entries)
 

Public Member Functions

 Engine (QObject *parent=nullptr)
 
 ~Engine () override
 
void addDownloadTagFilter (const QString &filter)
 
void addTagFilter (const QString &filter)
 
Q_INVOKABLE void adoptEntry (const KNSCore::EntryInternal &entry)
 
QString adoptionCommand (const KNSCore::EntryInternal &entry) const
 
void becomeFan (const EntryInternal &entry)
 
QString busyMessage () const
 
Q_SIGNAL void busyMessageChanged ()
 
BusyState busyState () const
 
Q_SIGNAL void busyStateChanged ()
 
QSharedPointer< Cache > cache () const
 
QStringList categories () const
 
QStringList categoriesFilter () const
 
QList< Provider::CategoryMetadatacategoriesMetadata ()
 
void checkForInstalled ()
 
void checkForUpdates ()
 
CommentsModelcommentsForEntry (const KNSCore::EntryInternal &entry)
 
void contactAuthor (const EntryInternal &entry)
 
QSharedPointer< ProviderdefaultProvider () const
 
QStringList downloadTagFilter () const
 
Q_INVOKABLE void fetchEntryById (const QString &id)
 
Provider::Filter filter () const
 
bool hasAdoptionCommand () const
 
bool init (const QString &configfile)
 
void install (KNSCore::EntryInternal entry, int linkId=1)
 
void loadDetails (const KNSCore::EntryInternal &entry)
 
void loadPreview (const KNSCore::EntryInternal &entry, EntryInternal::PreviewType type)
 
QString name () const
 
QSharedPointer< Providerprovider (const QString &providerId) const
 
QStringList providerIDs () const
 
Q_SIGNAL void providersChanged ()
 
void reloadEntries ()
 
void requestData (int page, int pageSize)
 
void requestMoreData ()
 
Q_INVOKABLE void restoreSearch ()
 
Q_INVOKABLE void revalidateCacheEntries ()
 
QList< Provider::SearchPresetsearchPresets ()
 
QString searchTerm () const
 
void setBusy (BusyState state, const QString &busyMessage)
 
void setBusyMessage (const QString &busyMessage)
 
void setBusyState (BusyState state)
 
void setCategoriesFilter (const QStringList &categories)
 
void setConfigLocationFallback (bool enableFallback)
 
void setDownloadTagFilter (const QStringList &filter)
 
void setFilter (Provider::Filter filter)
 
void setPageSize (int pageSize)
 
void setSearchTerm (const QString &searchString)
 
void setSortMode (Provider::SortMode mode)
 
void setTagFilter (const QStringList &filter)
 
Provider::SortMode sortMode () const
 
Q_INVOKABLE void storeSearch ()
 
QStringList tagFilter () const
 
void uninstall (KNSCore::EntryInternal entry)
 
bool uploadEnabled () const
 
Q_SIGNAL void uploadEnabledChanged ()
 
QString useLabel () const
 
Q_SIGNAL void useLabelChanged ()
 
bool userCanBecomeFan (const EntryInternal &entry)
 
bool userCanVote (const EntryInternal &entry)
 
void vote (const EntryInternal &entry, uint rating)
 
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
 
bool blockSignals (bool block)
 
const QObjectListchildren () const const
 
QMetaObject::Connection connect (const QObject *sender, const char *signal, const char *method, Qt::ConnectionType type) const const
 
void deleteLater ()
 
void destroyed (QObject *obj)
 
bool disconnect (const char *signal, const QObject *receiver, const char *method) const const
 
bool disconnect (const QObject *receiver, const char *method) const const
 
void dumpObjectInfo ()
 
void dumpObjectInfo () const const
 
void dumpObjectTree ()
 
void dumpObjectTree () const const
 
QList< QByteArraydynamicPropertyNames () const const
 
virtual bool event (QEvent *e)
 
virtual bool eventFilter (QObject *watched, QEvent *event)
 
findChild (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QString &name, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegExp &regExp, Qt::FindChildOptions options) const const
 
QList< T > findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const
 
bool inherits (const char *className) const const
 
void installEventFilter (QObject *filterObj)
 
bool isWidgetType () const const
 
bool isWindowType () const const
 
void killTimer (int id)
 
virtual const QMetaObjectmetaObject () const const
 
void moveToThread (QThread *targetThread)
 
QString objectName () const const
 
void objectNameChanged (const QString &objectName)
 
QObjectparent () const const
 
QVariant property (const char *name) const const
 
 Q_CLASSINFO (Name, Value)
 
 Q_DISABLE_COPY (Class)
 
 Q_DISABLE_COPY_MOVE (Class)
 
 Q_DISABLE_MOVE (Class)
 
 Q_EMIT Q_EMIT
 
 Q_ENUM (...)
 
 Q_ENUM_NS (...)
 
 Q_ENUMS (...)
 
 Q_FLAG (...)
 
 Q_FLAG_NS (...)
 
 Q_FLAGS (...)
 
 Q_GADGET Q_GADGET
 
 Q_INTERFACES (...)
 
 Q_INVOKABLE Q_INVOKABLE
 
 Q_NAMESPACE Q_NAMESPACE
 
 Q_NAMESPACE_EXPORT (EXPORT_MACRO)
 
 Q_OBJECT Q_OBJECT
 
 Q_PROPERTY (...)
 
 Q_REVISION Q_REVISION
 
 Q_SET_OBJECT_NAME (Object)
 
 Q_SIGNAL Q_SIGNAL
 
 Q_SIGNALS Q_SIGNALS
 
 Q_SLOT Q_SLOT
 
 Q_SLOTS Q_SLOTS
 
qFindChild (const QObject *obj, const QString &name)
 
QList< T > qFindChildren (const QObject *obj, const QRegExp &regExp)
 
QList< T > qFindChildren (const QObject *obj, const QString &name)
 
qobject_cast (QObject *object)
 
qobject_cast (const QObject *object)
 
 QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT
 
void removeEventFilter (QObject *obj)
 
void setObjectName (const QString &name)
 
void setParent (QObject *parent)
 
bool setProperty (const char *name, const QVariant &value)
 
bool signalsBlocked () const const
 
int startTimer (int interval, Qt::TimerType timerType)
 
int startTimer (std::chrono::milliseconds time, Qt::TimerType timerType)
 
QThreadthread () const const
 

Static Public Member Functions

static QStringList availableConfigFiles ()
 
static QStringList configSearchLocations (bool includeFallbackLocations=false)
 
- Static Public Member Functions inherited from QObject
QMetaObject::Connection connect (const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method, Qt::ConnectionType type)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, Functor functor)
 
QMetaObject::Connection connect (const QObject *sender, PointerToMemberFunction signal, const QObject *context, Functor functor, Qt::ConnectionType type)
 
bool disconnect (const QMetaObject::Connection &connection)
 
bool disconnect (const QObject *sender, const char *signal, const QObject *receiver, const char *method)
 
bool disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method)
 
bool disconnect (const QObject *sender, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method)
 
QString tr (const char *sourceText, const char *disambiguation, int n)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 

Additional Inherited Members

- Public Attributes inherited from QObject
typedef QObjectList
 
- Protected Member Functions inherited from QObject
virtual void childEvent (QChildEvent *event)
 
virtual void connectNotify (const QMetaMethod &signal)
 
virtual void customEvent (QEvent *event)
 
virtual void disconnectNotify (const QMetaMethod &signal)
 
bool isSignalConnected (const QMetaMethod &signal) const const
 
int receivers (const char *signal) const const
 
QObjectsender () const const
 
int senderSignalIndex () const const
 
virtual void timerEvent (QTimerEvent *event)
 

Detailed Description

KNewStuff engine.

An engine keeps track of data which is available locally and remote and offers high-level synchronization calls as well as upload and download primitives using an underlying GHNS protocol.

Definition at line 58 of file engine.h.

Property Documentation

QString Engine::busyMessage
readwrite

String representation of the engines busy state, in the case of idle this string is empty.

Since
5.74

Definition at line 73 of file engine.h.

Engine::BusyState Engine::busyState
readwrite

Current state of the engine, the state con contain multiple operations an empty BusyState represents the idle status.

Since
5.74

Definition at line 67 of file engine.h.

QStringList Engine::providerIDs
read
Since
5.85

Definition at line 92 of file engine.h.

bool Engine::uploadEnabled
read

Whether or not the configuration says that the providers are expected to support uploading.

As it stands, this is used to determine whether or not to show the Upload... action where that is displayed (primarily NewStuff.Page).

Since
5.85

Definition at line 87 of file engine.h.

QString Engine::useLabel
read

Text that should be displayed for the adoption button, this defaults to "Use".

Since
5.77

Definition at line 79 of file engine.h.

Constructor & Destructor Documentation

Engine::Engine ( QObject parent = nullptr)
explicit

Constructor.

Definition at line 150 of file engine.cpp.

Engine::~Engine ( )
override

Destructor.

Frees up all the memory again which might be taken by cached entries and providers.

Definition at line 189 of file engine.cpp.

Member Function Documentation

void Engine::addDownloadTagFilter ( const QString filter)

Add a single filter entry to the download tag filter.

The filter should be in the same form as the filter lines in the list used by setDownloadsTagFilter(QStringList)

Parameters
filterThe filter in the form of a string
See also
setTagFilter(QStringList)
setDownloadTagFilter(QStringList)
Since
5.51

Definition at line 694 of file engine.cpp.

void Engine::addTagFilter ( const QString filter)

Add a single filter entry to the entry tag filter.

The filter should be in the same form as the filter lines in the list used by setTagFilter(QStringList)

Parameters
filterThe filter in the form of a string
See also
setTagFilter(QStringList)
Since
5.51

Definition at line 673 of file engine.cpp.

void Engine::adoptEntry ( const KNSCore::EntryInternal entry)

Adopt an entry using the adoption command.

This will also take care of displaying error messages

Parameters
entryEntry that should be adopted
See also
signalErrorCode
signalEntryEvent
Since
5.77

Definition at line 1186 of file engine.cpp.

QString Engine::adoptionCommand ( const KNSCore::EntryInternal entry) const

The adoption command can be used to allow a user to make use of an entry's installed data.

For example, this command might be used to ask the system to switch to a wallpaper or icon theme which was installed with KNS.

The following is how this might look in a knsrc file. The example shows how an external tool is called on the directory containing the installed file represented by d. If you wish to directly point to the installed file, the substitution variable is f.

AdoptionCommand=/usr/lib64/libexec/plasma-changeicons d
Parameters
entryThe entry to return an adoption command for
Returns
The command to run to adopt this entry's installed data
Deprecated:
Since 5.77, use Engine::adoptEntry(const KNSCore::EntryInternal &entry) instead

Definition at line 1041 of file engine.cpp.

QStringList Engine::availableConfigFiles ( )
static

List of all available config files.

This list will contain no duplicated filenames. The returned file paths are absolute.

Since
5.83

Definition at line 1076 of file engine.cpp.

void Engine::becomeFan ( const EntryInternal entry)

This will mark the user who is currently authenticated as a fan of the entry passed to the function.

Parameters
entryThe entry the user wants to be a fan of

Definition at line 998 of file engine.cpp.

QString KNSCore::Engine::busyMessage ( ) const

String representation of the engines busy state.

Since
5.74
Q_SIGNAL void KNSCore::Engine::busyMessageChanged ( )

Signal gets emitted when the busy message changes.

Since
5.74 String representation of the engines busy state
BusyState KNSCore::Engine::busyState ( ) const

Busy state of the engine.

Since
5.74
Q_SIGNAL void KNSCore::Engine::busyStateChanged ( )

Signal gets emitted when the busy state changes.

Since
5.74
QSharedPointer< KNSCore::Cache > Engine::cache ( ) const

Get the entries cache for this engine (note that it may be null if the engine is not yet initialized).

Returns
The cache for this engine (or null if the engine is not initialized)
Since
5.74

Definition at line 1158 of file engine.cpp.

QStringList Engine::categories ( ) const

The list of the server-side names of the categories handled by this engine instance.

This corresponds directly to the list of categories in your knsrc file. This is not supposed to be used as user-facing strings -

See also
categoriesMetadata() for that.
Returns
The categories which this instance of Engine handles

Definition at line 322 of file engine.cpp.

QStringList Engine::categoriesFilter ( ) const

The list of categories searches will actually show results from.

This is a subset of the categories() list.

See also
KNSCore::Engine::setCategoriesFilter(QString)

Definition at line 327 of file engine.cpp.

QList< Provider::CategoryMetadata > Engine::categoriesMetadata ( )

The list of metadata for the categories handled by this engine instance.

If you wish to show the categories to the user, this is the data to use. The category name is the string used to set categories for the filter, and also what is returned by both categories() and categoriesFilter(). The human-readable name is displayName, and the only thing which should be shown to the user.

Returns
The metadata for all categories handled by this engine

Definition at line 332 of file engine.cpp.

void Engine::checkForInstalled ( )

Requests installed packages with an up to date state.

See also
signalEntriesLoaded()

Definition at line 1031 of file engine.cpp.

void Engine::checkForUpdates ( )

Request for packages that are installed and need update.

These will be reported through the signal

See also
signalUpdateableEntriesLoaded().

Definition at line 1023 of file engine.cpp.

KNSCore::CommentsModel * Engine::commentsForEntry ( const KNSCore::EntryInternal entry)

This function will return an instance of a model which contains comments for the entry passed to it.

The model may be empty (if there are no comments for the entry, which also covers situations where the entry's provider does not support commenting)

Parameters
entryThe entry to fetch comments for
Returns
A model which contains the comments for the specified entry
Since
5.63

Definition at line 1104 of file engine.cpp.

QStringList Engine::configSearchLocations ( bool  includeFallbackLocations = false)
static

Get a list of all the locations which will be used when searching for knsrc files, in the order in which the search will occur.

Parameters
includeFallbackLocationsWhether or not the deprecated search locations are included
Returns
The search list for knsrc files
Since
5.57
Deprecated:
Since 5.83, use Engine::availableConfigFiles instead

Definition at line 1058 of file engine.cpp.

void Engine::contactAuthor ( const EntryInternal entry)

Try to contact the author of the entry by email or showing their homepage.

Definition at line 959 of file engine.cpp.

QSharedPointer< KNSCore::Provider > Engine::defaultProvider ( ) const

Return the first provider in the providers list (usually the default provider)

Returns
The first Provider (or null if the engine is not initialized)
Since
5.63

Definition at line 1091 of file engine.cpp.

QStringList Engine::downloadTagFilter ( ) const

Gets the current downloadlink tag filter list.

See also
setDownloadTagFilter(QStringList)
Since
5.51

Definition at line 689 of file engine.cpp.

void Engine::fetchEntryById ( const QString id)

Convenience method to launch a search for one specific entry.

Note
it will reset the engine state (use storeSearch() and restoreSearch() to handle this if needed)
Parameters
idThe ID of the entry you wish to fetch

Definition at line 608 of file engine.cpp.

Provider::Filter Engine::filter ( ) const

The result filter set on the current request.

See also
setFilter(Provider::Filter)
Since
5.63

Definition at line 603 of file engine.cpp.

bool Engine::hasAdoptionCommand ( ) const

Whether or not an adoption command exists for this engine.

See also
adoptionCommand(KNSCore::EntryInternal)
Returns
True if an adoption command exists

Definition at line 1047 of file engine.cpp.

bool Engine::init ( const QString configfile)

Initializes the engine.

This step is application-specific and relies on an external configuration file, which determines all the details about the initialization.

Parameters
configfileKNewStuff2 configuration file (*.knsrc)
Returns
true if any valid configuration was found, false otherwise
See also
KNS3::DownloadDialog

Definition at line 200 of file engine.cpp.

void Engine::install ( KNSCore::EntryInternal  entry,
int  linkId = 1 
)

Installs an entry's payload file.

This includes verification, if necessary, as well as decompression and other steps according to the application's *.knsrc file.

Parameters
entryEntry to be installed
See also
signalInstallationFinished
signalInstallationFailed

Definition at line 737 of file engine.cpp.

void Engine::loadDetails ( const KNSCore::EntryInternal entry)

Get the full details of a specific entry.

Parameters
entryThe entry to get full details for
See also
Entry::signalEntryDetailsLoaded(KNSCore::EntryInternal)

Definition at line 929 of file engine.cpp.

void Engine::loadPreview ( const KNSCore::EntryInternal entry,
EntryInternal::PreviewType  type 
)

Attempt to load a specific preview for the specified entry.

Parameters
entryThe entry to fetch a preview for
typeThe particular preview to fetch
See also
signalEntryPreviewLoaded(KNSCore::EntryInternal, KNSCore::EntryInternal::PreviewType);
signalPreviewFailed();

Definition at line 935 of file engine.cpp.

QString Engine::name ( ) const

The name as defined by the knsrc file.

Returns
The name associated with the engine's configuration file
Since
5.63

Definition at line 317 of file engine.cpp.

QSharedPointer< KNSCore::Provider > Engine::provider ( const QString providerId) const

The Provider instance with the passed ID.

Parameters
providerIdThe ID of the Provider to fetch
Returns
The Provider with the passed ID, or null if non such Provider exists
Since
5.63

Definition at line 1086 of file engine.cpp.

QStringList KNSCore::Engine::providerIDs ( ) const

The IDs of all providers known by this engine.

Use this in combination with provider(const QString&) to iterate over all providers.

Returns
The string IDs of all known providers
Since
5.85
Q_SIGNAL void KNSCore::Engine::providersChanged ( )

Fired whenever the list of providers changes.

Since
5.85
void Engine::restoreSearch ( )

Restore a previously saved search to be current Also emits the appropriate signals so any views depending on the information can be updated)

Since
5.79

Definition at line 622 of file engine.cpp.

void Engine::revalidateCacheEntries ( )

If the same engine gets reused and the user could have used the delete functionality of the KCMs the cache could be out of sync.

If the RemoveDeadEntries option is set to true this will remove deleted entries from the cache and the signalEntryChanged slot will be emitted with the updated entry

Since
5.74

Definition at line 1163 of file engine.cpp.

QString Engine::searchTerm ( ) const

The search term for the current search (empty if none is set)

Returns
The current search term
Since
5.63

Definition at line 655 of file engine.cpp.

void Engine::setBusy ( Engine::BusyState  state,
const QString busyMessage 
)

Utility method to set both the state and busyMessage.

Since
5.74

Definition at line 1152 of file engine.cpp.

void Engine::setBusyMessage ( const QString busyMessage)
Since
5.74
See also
setBusy
setBusyState

Definition at line 1123 of file engine.cpp.

void Engine::setBusyState ( Engine::BusyState  state)

Sets the busy state of the engine.

Since
5.74
See also
setBusy
setBusyMessage

Definition at line 1144 of file engine.cpp.

void Engine::setCategoriesFilter ( const QStringList categories)

Set the categories that will be included in searches.

Note: This will automatically launch a search, which means you do not need to call requestData manually.

See also
KNSCore::Engine::categories()
Parameters
categoriesA list of strings of categories

Definition at line 574 of file engine.cpp.

void Engine::setConfigLocationFallback ( bool  enableFallback)

Sets whether or not the config file location discovery fallback should be active.

If enabled (default), if the config file is not found in the knsrcfiles location, then the engine will also look in the systemwide config location (usually /etc/xdg on linux). If disabled, this fallback location will not be searched.

Parameters
enableFallbackWhether or not the fallback discovery should be enabled
Since
5.57
Deprecated:
Since 5.83, the engine includes the fallback paths by default

Definition at line 1070 of file engine.cpp.

void Engine::setDownloadTagFilter ( const QStringList filter)

Sets a filter to be applied to the downloads for an entry.

The logic is the same as used in setTagFilter(QStringList), but vitally, only one downloadlink is required to match the filter for the list to be valid. If you do not wish to show the others in your client, you must hide them yourself.

For an entry to be accepted when a download tag filter is set, it must also be accepted by the entry filter (so, for example, while a list of downloads might be accepted, if the entry has ghns_excluded set, and the default entry filter is set, the entry will still be filtered out).

In your knsrc file, set DownloadTagFilter to the filter you wish to apply, using the same logic as described for the entry tagfilter.

Parameters
filterThe filter in the form of a list of strings
See also
setTagFilter(QStringList)
Since
5.51

Definition at line 681 of file engine.cpp.

void Engine::setFilter ( Provider::Filter  filter)

Set a filter for results (defaults to none), which will allow you to show only installed entries, installed entries which have updates, or a specific item with a specified ID.

The latter further requires the search term to be the exact ID of the entry you wish to retrieve.

Note: This will automatically launch a search, which means you do not need to call requestData manually.

See also
fetchEntryById(QString)
setSearchTerm(QString)
Parameters
filterThe type of results you wish to see

Definition at line 594 of file engine.cpp.

void Engine::setPageSize ( int  pageSize)

Set the page size for requests not made explicitly with requestData(int,int)

Parameters
pageSizethe default number of entries to request from the provider
See also
requestData(int,int)

Definition at line 1052 of file engine.cpp.

void Engine::setSearchTerm ( const QString searchString)

Sets a string search term.

Note: This will automatically launch a search, which means you do not need to call requestData manually.

Parameters
searchStringThe search term you wish to search for

Definition at line 643 of file engine.cpp.

void Engine::setSortMode ( Provider::SortMode  mode)

Set the order the search results are returned in.

Search requests default to showing the newest entries first.

Note: This will automatically launch a search, which means you do not need to call requestData manually.

See also
KNSCore::Provider::SearchRequest
Parameters
modeThe order you want search results to come back in.

Definition at line 580 of file engine.cpp.

void Engine::setTagFilter ( const QStringList filter)

Set a filter for results, which filters out all entries which do not match the filter, as applied to the tags for the entry.

This filters only on the tags specified for the entry itself. To filter the downloadlinks, use setDownloadTagFilter(QStringList).

Note
The default filter if one is not set from your knsrc file will filter out entries marked as ghns_excluded=1. To retain this when setting a custom filter, add "ghns_excluded!=1" as one of the filters.
Some tags provided by OCS do not supply a value (and are simply passed as a key). These will be interpreted as having the value 1 for filtering purposes. An example of this might be ghns_excluded, which in reality will generally be passed through ocs as "ghns_excluded" rather than "ghns_excluded=1"
As tags are metadata, they are provided in the form of adjectives. They are never supplied as action verbs or instructions (as an example, a good tag to suggest that for example a wallpaper is painted would be "painted" as opposed to "paint", and another example might be that an item should be "excluded" as opposed to "exclude").

== Examples of use == Value for tag "tagname" must be exactly "tagdata": tagname==tagdata

Value for tag "tagname" must be different from "tagdata": tagname!=tagdata

== KNSRC entry == A tag filter line in a .knsrc file, which is a comma separated list of tag/value pairs, might look like:

TagFilter=ghns_excluded!=1,data##mimetype==application/cbr+zip,data##mimetype==application/cbr+rar which would honour the exclusion and filter out anything that does not include a comic book archive in either zip or rar format in one or more of the download items. Notice in particular that there are two data##mimetype entries. Use this for when a tag may have multiple values.

TagFilter=application##architecture==x86_64 which would not honour the exclusion, and would filter out all entries which do not mark themselves as having a 64bit application binary in at least one download item.

The value does not current support wildcards. The list should be considered a binary AND operation (that is, all filter entries must match for the data entry to be included in the return data)

Parameters
filterThe filter in the form of a list of strings
See also
setDownloadTagFilter(QStringList)
Since
5.51

Definition at line 660 of file engine.cpp.

void KNSCore::Engine::signalEntryEvent ( const EntryInternal entry,
EntryInternal::EntryEvent  event 
)
signal

This is fired for any event related directly to a single EntryInternal instance.

See also
EntryInternal::EntryEvent for details on which specific event is being notified
Since
5.77
void KNSCore::Engine::signalErrorCode ( const KNSCore::ErrorCode errorCode,
const QString message,
const QVariant metadata 
)
signal

Fires in the case of any critical or serious errors, such as network or API problems.

Parameters
errorCodeRepresents the specific type of error which has occurred
messageA human-readable message which can be shown to the end user
metadataAny additional data which might be hepful to further work out the details of the error (see KNSCore::EntryInternal::ErrorCode for the metadata details)
See also
KNSCore::EntryInternal::ErrorCode
Since
5.53
void KNSCore::Engine::signalMessage ( const QString message)
signal

Indicates a message to be added to the ui's log, or sent to a messagebox.

void KNSCore::Engine::signalSearchPresetsLoaded ( const QList< Provider::SearchPreset > &  presets)
signal

Fires when the engine has loaded search presets.

These represent interesting searches for the user, such as recommendations.

Since
5.83
Provider::SortMode Engine::sortMode ( ) const

The sort mode set on the current request.

See also
setSortMode(Provider::SortMode)
Since
5.63

Definition at line 589 of file engine.cpp.

void Engine::storeSearch ( )

Stores the current search parameters internally This might for example be used to allow you to restore the current view state after performing a single-entry fetch with fetchEntryById(QString).

That function does not perform this action itself, because it may well not be the desired outcome.

Since
5.79

Definition at line 638 of file engine.cpp.

QStringList Engine::tagFilter ( ) const

Gets the current tag filter list.

See also
setTagFilter(QStringList)
Since
5.51

Definition at line 668 of file engine.cpp.

void Engine::uninstall ( KNSCore::EntryInternal  entry)

Uninstalls an entry.

It reverses the steps which were performed during the installation.

Parameters
entryThe entry to deinstall

Definition at line 901 of file engine.cpp.

bool KNSCore::Engine::uploadEnabled ( ) const

Whether or not the configuration says that the providers are expected to support uploading.

Returns
True if the providers are expected to support uploading
Since
5.85
Q_SIGNAL void KNSCore::Engine::uploadEnabledChanged ( )

Fired when the uploadEnabled property changes.

Since
5.85
QString KNSCore::Engine::useLabel ( ) const

Text that should be displayed for the adoption button, this defaults to i18n("Use")

Since
5.77
Q_SIGNAL void KNSCore::Engine::useLabelChanged ( )

Signal gets emitted when the useLabel property changes.

Since
5.77
bool Engine::userCanBecomeFan ( const EntryInternal entry)

Whether or not the user is allowed to become a fan of a particular entry.

Not all providers (and consequently entries) support the fan functionality and you can use this function to determine this ability.

Parameters
entryThe entry the user might wish to be a fan of
Returns
Whether or not it is possible for the user to become a fan of that entry

Definition at line 992 of file engine.cpp.

bool Engine::userCanVote ( const EntryInternal entry)

Whether or not a user is able to vote on the passed entry.

Parameters
entryThe entry to check votability on
Returns
True if the user is able to vote on the entry

Definition at line 980 of file engine.cpp.

void Engine::vote ( const EntryInternal entry,
uint  rating 
)

Cast a vote on the passed entry.

Parameters
entryThe entry to vote on
ratingA number from 0 to 100, 50 being neutral, 0 being most negative and 100 being most positive.

Definition at line 986 of file engine.cpp.


The documentation for this class was generated from the following files:
This file is part of the KDE documentation.
Documentation copyright © 1996-2021 The KDE developers.
Generated on Sun Dec 5 2021 22:37:42 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.