KSycoca
#include <ksycoca.h>
Public Member Functions | |
KSycoca () | |
void | addFactory (KSycocaFactory *) |
QStringList | allResourceDirs () |
Q_SIGNAL void | databaseChanged () |
void | ensureCacheValid () |
QDataStream * | findEntry (int offset, KSycocaType &type) |
QDataStream * | findFactory (KSycocaFactoryId id) |
virtual bool | isBuilding () |
Public Member Functions inherited from QObject | |
QObject (QObject *parent) | |
QBindable< QString > | bindableObjectName () |
bool | blockSignals (bool block) |
const QObjectList & | children () 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 () const const |
void | dumpObjectTree () const const |
QList< QByteArray > | dynamicPropertyNames () const const |
virtual bool | event (QEvent *e) |
virtual bool | eventFilter (QObject *watched, QEvent *event) |
T | findChild (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QRegularExpression &re, Qt::FindChildOptions options) const const |
QList< T > | findChildren (const QString &name, Qt::FindChildOptions options) const const |
QList< T > | findChildren (Qt::FindChildOptions options) const const |
bool | inherits (const char *className) const const |
void | installEventFilter (QObject *filterObj) |
bool | isQuickItemType () const const |
bool | isWidgetType () const const |
bool | isWindowType () const const |
void | killTimer (int id) |
virtual const QMetaObject * | metaObject () const const |
void | moveToThread (QThread *targetThread) |
QString | objectName () const const |
void | objectNameChanged (const QString &objectName) |
QObject * | parent () const const |
QVariant | property (const char *name) const const |
Q_CLASSINFO (Name, Value) | |
Q_EMIT Q_EMIT | |
Q_ENUM (...) | |
Q_ENUM_NS (...) | |
Q_ENUMS (...) | |
Q_FLAG (...) | |
Q_FLAG_NS (...) | |
Q_FLAGS (...) | |
Q_GADGET Q_GADGET | |
Q_GADGET_EXPORT (EXPORT_MACRO) | |
Q_INTERFACES (...) | |
Q_INVOKABLE Q_INVOKABLE | |
Q_MOC_INCLUDE Q_MOC_INCLUDE | |
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 | |
T | qobject_cast (const QObject *object) |
T | qobject_cast (QObject *object) |
QT_NO_NARROWING_CONVERSIONS_IN_CONNECT QT_NO_NARROWING_CONVERSIONS_IN_CONNECT | |
void | removeEventFilter (QObject *obj) |
void | setObjectName (const QString &name) |
void | setObjectName (QAnyStringView name) |
void | setParent (QObject *parent) |
bool | setProperty (const char *name, const QVariant &value) |
bool | setProperty (const char *name, QVariant &&value) |
bool | signalsBlocked () const const |
int | startTimer (int interval, Qt::TimerType timerType) |
int | startTimer (std::chrono::milliseconds interval, Qt::TimerType timerType) |
QThread * | thread () const const |
Static Public Member Functions | |
static QString | absoluteFilePath () |
static void | disableAutoRebuild () |
static void | flagError () |
static bool | isAvailable () |
static KSycoca * | self () |
static void | setupTestMenu () |
static int | version () |
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 *context, Functor functor, 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) |
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, const QMetaMethod &signal, const QObject *receiver, const QMetaMethod &method) |
bool | disconnect (const QObject *sender, PointerToMemberFunction signal, const QObject *receiver, PointerToMemberFunction method) |
QString | tr (const char *sourceText, const char *disambiguation, int n) |
Protected Member Functions | |
KSycoca (bool) | |
void | connectNotify (const QMetaMethod &signal) override |
KSycocaFactoryList * | factories () |
QDataStream *& | stream () |
Protected Member Functions inherited from QObject | |
virtual void | childEvent (QChildEvent *event) |
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 |
QObject * | sender () const const |
int | senderSignalIndex () const const |
virtual void | timerEvent (QTimerEvent *event) |
Additional Inherited Members | |
Public Types inherited from QObject | |
typedef | QObjectList |
Properties inherited from QObject | |
objectName | |
Detailed Description
Constructor & Destructor Documentation
◆ KSycoca() [1/2]
|
explicitprotected |
Building database
Definition at line 352 of file ksycoca.cpp.
◆ KSycoca() [2/2]
KSycoca::KSycoca | ( | ) |
Read-only database.
Definition at line 209 of file ksycoca.cpp.
◆ ~KSycoca()
|
override |
Definition at line 364 of file ksycoca.cpp.
Member Function Documentation
◆ absoluteFilePath()
|
static |
- returns absolute file path of the database
For the global database type, the database is searched under the 'share/ksycoca' install path. Otherwise, the value from the environment variable KDESYCOCA is returned if set. If not set the path is built based on QStandardPaths cache save location, typically ~/.cache on Unix.
Since 5.15, the filename includes language and a sha1 of the directories in GenericDataLocation, i.e. the directories with the desktop files. This allows to have one database per setup, when using different install prefixes or when switching languages.
Definition at line 683 of file ksycoca.cpp.
◆ addFactory()
void KSycoca::addFactory | ( | KSycocaFactory * | factory | ) |
- add a factory
Definition at line 410 of file ksycoca.cpp.
◆ allResourceDirs()
QStringList KSycoca::allResourceDirs | ( | ) |
- returns all directories with information stored inside sycoca.
Definition at line 703 of file ksycoca.cpp.
◆ connectNotify()
|
overrideprotectedvirtual |
Reimplemented from QObject.
Definition at line 741 of file ksycoca.cpp.
◆ databaseChanged()
Q_SIGNAL void KSycoca::databaseChanged | ( | ) |
Connect to this to get notified when the database changes.
Example: after creating a .desktop file in KOpenWithDialog, it must wait until kbuildsycoca6 finishes until the KService::Ptr is available. Other examples: anything that displays a list of apps or plugins to the user and which is always visible (otherwise querying sycoca before showing could be enough).
◆ disableAutoRebuild()
|
static |
Disables automatic rebuilding of the cache on service file changes.
Be extremely careful when using this. Only threads that definitely have no use for automatic reloading should use this. Specifically shared runner threads (as seen in the threadweaver framework) can avoid claiming persistent resources this way (e.g. inotify instances on Linux).
Definition at line 731 of file ksycoca.cpp.
◆ ensureCacheValid()
void KSycoca::ensureCacheValid | ( | ) |
Ensures the ksycoca database is up to date.
If the database was modified by another process, close it, so the next use reopens it. If the desktop files have been modified more recently than the database, update it.
Update the sycoca file from the files on disk (e.g. desktop files or mimeapps.list). You don't normally have to call this because the next use of KSycoca (e.g. via KMimeTypeTrader, KService etc.) will notice that the sycoca database is out of date, by looking a directory modification times. In addition, in a full KDE session, kded monitors directories to detect changes.
This is however useful for GUIs that allow to create a new desktop file and then want to ensure it is available immediately in KSycoca. This is also useful after modifying a mimeapps.list file.
KBuildSycocaProgressDialog can also be used instead of this method, in GUI apps.
- Since
- 5.15
Definition at line 763 of file ksycoca.cpp.
◆ factories()
|
protected |
Definition at line 428 of file ksycoca.cpp.
◆ findEntry()
QDataStream * KSycoca::findEntry | ( | int | offset, |
KSycocaType & | type ) |
- called by factories in read-only mode This is how factories get a stream to an entry
Definition at line 415 of file ksycoca.cpp.
◆ findFactory()
QDataStream * KSycoca::findFactory | ( | KSycocaFactoryId | id | ) |
- called by factories in read-only mode Returns stream(), but positioned for reading this factory, 0 on error.
Definition at line 485 of file ksycoca.cpp.
◆ flagError()
|
static |
A read error occurs.
Definition at line 711 of file ksycoca.cpp.
◆ isAvailable()
|
static |
- Returns
- true if the ksycoca database is available This is usually the case, except if KDE isn't installed yet, or before kded is started.
Definition at line 373 of file ksycoca.cpp.
◆ isBuilding()
|
virtual |
- Returns
- true if building (i.e. if a KBuildSycoca);
Definition at line 726 of file ksycoca.cpp.
◆ self()
|
static |
Get or create the only instance of KSycoca (read-only)
Definition at line 357 of file ksycoca.cpp.
◆ setupTestMenu()
|
static |
Sets up a minimal applications.menu file in the appropriate location.
This is useful when writing unit tests that interact with KService.
You should call QStandardPaths::setTestModeEnabled(true) before calling this.
- Since
- 6.0
Definition at line 794 of file ksycoca.cpp.
◆ stream()
|
protected |
Definition at line 736 of file ksycoca.cpp.
◆ version()
|
static |
- Returns
- the compiled-in version, i.e. the one used when writing a new ksycoca
Definition at line 151 of file ksycoca.cpp.
The documentation for this class was generated from the following files:
Documentation copyright © 1996-2024 The KDE developers.
Generated on Fri Nov 22 2024 12:08:03 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006
KDE's Doxygen guidelines are available online.