Search for usage in LXR

#include <ksycoca.h>

Inheritance diagram for KSycoca:

Public Member Functions

 KSycoca ()
void addFactory (KSycocaFactory *)
QStringList allResourceDirs ()
Q_SIGNAL void databaseChanged ()
void ensureCacheValid ()
QDataStreamfindEntry (int offset, KSycocaType &type)
QDataStreamfindFactory (KSycocaFactoryId id)
virtual bool isBuilding ()
- Public Member Functions inherited from QObject
 QObject (QObject *parent)
QBindable< QStringbindableObjectName ()
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 () const const
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 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 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_ENUM (...)
 Q_ENUM_NS (...)
 Q_ENUMS (...)
 Q_FLAG (...)
 Q_FLAG_NS (...)
 Q_FLAGS (...)
qobject_cast (const QObject *object)
qobject_cast (QObject *object)
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)
QThreadthread () const const

Static Public Member Functions

static QString absoluteFilePath ()
static void disableAutoRebuild ()
static void flagError ()
static bool isAvailable ()
static KSycocaself ()
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
KSycocaFactoryListfactories ()
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
QObjectsender () const const
int senderSignalIndex () const const
virtual void timerEvent (QTimerEvent *event)

Additional Inherited Members

- Properties inherited from QObject
- Public Attributes inherited from QObject
typedef QObjectList

Detailed Description

Read-only SYstem COnfiguration CAche

Definition at line 33 of file ksycoca.h.

Constructor & Destructor Documentation

◆ KSycoca() [1/2]

KSycoca::KSycoca ( bool )

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()

KSycoca::~KSycoca ( )

Definition at line 364 of file ksycoca.cpp.

Member Function Documentation

◆ absoluteFilePath()

QString KSycoca::absoluteFilePath ( )

- 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()

void KSycoca::connectNotify ( const QMetaMethod & signal)

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()

void KSycoca::disableAutoRebuild ( )

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.


Definition at line 763 of file ksycoca.cpp.

◆ factories()

KSycocaFactoryList * KSycoca::factories ( )

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()

void KSycoca::flagError ( )

A read error occurs.

Definition at line 711 of file ksycoca.cpp.

◆ isAvailable()

bool KSycoca::isAvailable ( )
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()

bool KSycoca::isBuilding ( )
true if building (i.e. if a KBuildSycoca);

Definition at line 726 of file ksycoca.cpp.

◆ self()

KSycoca * KSycoca::self ( )

Get or create the only instance of KSycoca (read-only)

Definition at line 357 of file ksycoca.cpp.

◆ setupTestMenu()

void KSycoca::setupTestMenu ( )

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.


Definition at line 794 of file ksycoca.cpp.

◆ stream()

QDataStream *& KSycoca::stream ( )

Definition at line 736 of file ksycoca.cpp.

◆ version()

int KSycoca::version ( )
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:
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Tue Mar 26 2024 11:16:40 by doxygen 1.10.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.