KQuickAddons::ManagedConfigModule

Search for usage in LXR

KQuickAddons::ManagedConfigModule Class Reference

#include <KQuickAddons/ManagedConfigModule>

Inheritance diagram for KQuickAddons::ManagedConfigModule:

Public Slots

void defaults () override
 
void load () override
 
void save () override
 
- Public Slots inherited from KQuickAddons::ConfigModule
virtual void defaults ()
 
virtual void load ()
 
void pop ()
 
void push (const QString &fileName, const QVariantMap &propertyMap=QVariantMap())
 
void push (QQuickItem *item)
 
virtual void save ()
 
void setDefaultsIndicatorsVisible (bool visible)
 
void showPassiveNotification (const QString &message, const QVariant &timeout=QVariant(), const QString &actionText=QString(), const QJSValue &callBack=QJSValue())
 
QQuickItemtakeLast ()
 

Public Member Functions

 ManagedConfigModule (const KAboutData *aboutData, QObject *parent=nullptr, const QVariantList &args=QVariantList())
 
 ManagedConfigModule (const KPluginMetaData &metaData, QObject *parent=nullptr, const QVariantList &args=QVariantList())
 
 ManagedConfigModule (QObject *parent, const KPluginMetaData &metaData, const QVariantList &args=QVariantList())
 
 ManagedConfigModule (QObject *parent=nullptr, const QVariantList &args=QVariantList())
 
 ~ManagedConfigModule () override
 
- Public Member Functions inherited from KQuickAddons::ConfigModule
 ConfigModule (const KAboutData *aboutData, QObject *parent=nullptr, const QVariantList &args=QVariantList())
 
 ConfigModule (const KPluginMetaData &metaData, QObject *parent=nullptr, const QVariantList &args=QVariantList())
 
 ConfigModule (QObject *parent, const KPluginMetaData &metaData, const QVariantList &args=QVariantList())
 
 ConfigModule (QObject *parent=nullptr, const QVariantList &args=QVariantList())
 
 ~ConfigModule () override
 
const KAboutDataaboutData () const
 
QString authActionName () const
 
Buttons buttons () const
 
int columnWidth () const
 
int currentIndex () const
 
bool defaultsIndicatorsVisible () const
 
int depth () const
 
QString description () const
 
QQmlEngineengine () const
 
QString errorString () const
 
QQuickItemmainUi ()
 
QString name () const
 
bool needsAuthorization () const
 
bool needsSave ()
 
QString quickHelp () const
 
bool representsDefaults ()
 
QString rootOnlyMessage () const
 
void setAboutData (const KAboutData *about)
 
void setAuthActionName (const QString &action)
 
void setButtons (const Buttons btn)
 
void setColumnWidth (int width)
 
void setCurrentIndex (int index)
 
void setNeedsAuthorization (bool needsAuth)
 
void setNeedsSave (bool needs)
 
void setQuickHelp (const QString &help)
 
void setRepresentsDefaults (bool defaults)
 
void setRootOnlyMessage (const QString &message)
 
void setUseRootOnlyMessage (bool on)
 
QQmlComponent::Status status () const
 
QQuickItemsubPage (int index) const
 
bool useRootOnlyMessage () const
 
- 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 QRegExp &regExp, 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
 
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 (const QObject *object)
 
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 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
 

Protected Slots

void registerSettings (KCoreConfigSkeleton *skeleton)
 
void settingsChanged ()
 

Additional Inherited Members

- Public Types inherited from KQuickAddons::ConfigModule
enum  Button { NoAdditionalButton = 0, Help = 1, Default = 2, Apply = 4 }
 
typedef QFlags< ButtonButtons
 
- Properties inherited from KQuickAddons::ConfigModule
KQuickAddons::ConfigModule::Buttons buttons
 
int columnWidth
 
int currentIndex
 
int defaultsIndicatorsVisible
 
int depth
 
QString description
 
QQuickItem mainUi
 
QString name
 
bool needsAuthorization
 
bool needsSave
 
QString quickHelp
 
bool representsDefaults
 
QString rootOnlyMessage
 
bool useRootOnlyMessage
 
- Properties inherited from QObject
 objectName
 
- Signals inherited from KQuickAddons::ConfigModule
void authActionNameChanged ()
 
void buttonsChanged ()
 
void columnWidthChanged (int width)
 
void currentIndexChanged (int index)
 
void defaultsIndicatorsVisibleChanged ()
 
void depthChanged (int index)
 
void needsAuthorizationChanged ()
 
void needsSaveChanged ()
 
void pagePushed (QQuickItem *page)
 
void pageRemoved ()
 
void passiveNotificationRequested (const QString &message, const QVariant &timeout, const QString &actionText, const QJSValue &callBack)
 
void quickHelpChanged ()
 
void representsDefaultsChanged ()
 
void rootOnlyMessageChanged ()
 
void useRootOnlyMessageChanged ()
 
- Static Public Member Functions inherited from KQuickAddons::ConfigModule
static ConfigModuleqmlAttachedProperties (QObject *object)
 
- 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)
 
QString trUtf8 (const char *sourceText, const char *disambiguation, int n)
 
- 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

The base class for configuration modules using KConfigXT settings.

Configuration modules are realized as plugins that are loaded only when needed.

The module in principle is a simple widget displaying the item to be changed. The module has a very small interface.

All the necessary glue logic and the GUI bells and whistles are provided by the control center and must not concern the module author.

To write a config module, you have to create a C++ library and an accompaning QML user interface. The library must contain a factory function like the following:

#include <KPluginFactory>
K_PLUGIN_CLASS_WITH_JSON(MyConfigModule, "myconfigmodule.json")

The constructor of the ManagedConfigModule then looks like this:

MyConfigModule::MyConfigModule(QObject* parent, const KPluginMetaData &metaData, const QVariantList &args)
: ManagedConfigModule(parent, metaData, args)
{
.
.
.
}

The QML part must be in the KPackage format, installed under share/kpackage/kcms.

See also
KPackage::Package

The package must have the same name as the C++ plugin, to be installed by CMake with the command:

kpackage_install_package(packagedir kcm_componentName kcms)

The "packagedir" is the subdirectory in the source tree where the package sources are located, and "kcm_componentName" is the name of the C++ plugin. Finally "kcms" is the literal string "kcms", so that the package is installed as a configuration module (and not some other kind of package). The main config dialog UI will be the file ui/main.qml from the package (or what X-KPackage-MainScript value is in the package metadata desktop file).

The QML part can access all the properties of ConfigModule (together with the properties defined in its subclass) by accessing to the global object "kcm", or with the import of "org.kde.kcm 1.0" the ConfigModule attached property.

import QtQuick 2.1
import QtQuick.Controls 1.0 as QtControls
import org.kde.kcm 1.0
import org.kde.plasma.core 2.0 as PlasmaCore
//implicitWidth and implicitHeight will be used as initial size
//when loaded in kcmshell5
implicitWidth: units.gridUnit * 20
implicitHeight: units.gridUnit * 20
text: kcm.needsSave
}
}

See https://develop.kde.org/docs/extend/kcm/ for more detailed documentation.

Since
5.65

Definition at line 99 of file managedconfigmodule.h.

Constructor & Destructor Documentation

◆ ManagedConfigModule() [1/4]

KQuickAddons::ManagedConfigModule::ManagedConfigModule ( const KAboutData aboutData,
QObject parent = nullptr,
const QVariantList &  args = QVariantList() 
)
explicit

Base class for all modules which manage automatically some of their state.

Parameters
aboutDatabecomes owned by the ManagedConfigModule
Deprecated:
since 5.88, use ManagedConfigModule(QObject*, KPluginMetaData, QVariantList)

Definition at line 32 of file managedconfigmodule.cpp.

◆ ManagedConfigModule() [2/4]

KQuickAddons::ManagedConfigModule::ManagedConfigModule ( const KPluginMetaData metaData,
QObject parent = nullptr,
const QVariantList &  args = QVariantList() 
)
explicit
Parameters
metaDatadescription for the plugin: it will generate a KAboutData from that
Deprecated:
since 5.88, use ManagedConfigModule(QObject*, KPluginMetaData, QVariantList)

Definition at line 40 of file managedconfigmodule.cpp.

◆ ManagedConfigModule() [3/4]

KQuickAddons::ManagedConfigModule::ManagedConfigModule ( QObject parent,
const KPluginMetaData metaData,
const QVariantList &  args = QVariantList() 
)
explicit

Base class for all KControlModules.

Note
do not emit changed signals here, since they are not yet connected to any slot.
Since
5.88

Definition at line 55 of file managedconfigmodule.cpp.

◆ ManagedConfigModule() [4/4]

KQuickAddons::ManagedConfigModule::ManagedConfigModule ( QObject parent = nullptr,
const QVariantList &  args = QVariantList() 
)
explicit

Base class for all KControlModules.

Note
do not emit changed signals here, since they are not yet connected to any slot.
Deprecated:
since 5.104, use ManagedConfigModule(QObject*, KPluginMetaData, QVariantList)

Definition at line 48 of file managedconfigmodule.cpp.

◆ ~ManagedConfigModule()

KQuickAddons::ManagedConfigModule::~ManagedConfigModule ( )
override

Destroys the module.

Definition at line 61 of file managedconfigmodule.cpp.

Member Function Documentation

◆ defaults

void KQuickAddons::ManagedConfigModule::defaults ( )
overrideslot

Sets the configuration to sensible default values.

This method is called when the user clicks the "Default" button. It should set the display to useful values.

By default this will reset to defaults the child setting objects of this module.

Definition at line 84 of file managedconfigmodule.cpp.

◆ load

void KQuickAddons::ManagedConfigModule::load ( )
overrideslot

Load the configuration data into the module.

This method is invoked whenever the module should read its configuration (most of the times from a config file) and update the user interface. This happens when the user clicks the "Reset" button in the control center, to undo all of his changes and restore the currently valid settings. It is also called right after construction.

By default this will load the settings from the child setting objects of this module.

Definition at line 66 of file managedconfigmodule.cpp.

◆ registerSettings

void KQuickAddons::ManagedConfigModule::registerSettings ( KCoreConfigSkeleton skeleton)
protectedslot

Allow to register manually settings class generated from a kcfg file.

Used by derived class when automatic discovery is not possible. After skeleton is registered it will automatically call settingsChanged().

Since
5.67

Definition at line 134 of file managedconfigmodule.cpp.

◆ save

void KQuickAddons::ManagedConfigModule::save ( )
overrideslot

Save the configuration data.

The save method stores the config information as shown in the user interface in the config files. It is called when the user clicks "Apply" or "Ok".

By default this will save the child setting objects of this module.

Definition at line 75 of file managedconfigmodule.cpp.

◆ settingsChanged

void KQuickAddons::ManagedConfigModule::settingsChanged ( )
protectedslot

Forces the module to reevaluate the saveNeeded and representsDefault state.

This is required for some modules which might have some settings managed outside of KConfigXT objects.

Definition at line 111 of file managedconfigmodule.cpp.


The documentation for this class was generated from the following files:
ConfigModule(const KAboutData *aboutData, QObject *parent=nullptr, const QVariantList &args=QVariantList())
Base class for all KControlModules.
ManagedConfigModule(const KAboutData *aboutData, QObject *parent=nullptr, const QVariantList &args=QVariantList())
Base class for all modules which manage automatically some of their state.
#define K_PLUGIN_CLASS_WITH_JSON(classname, jsonFile)
Label
QObject * parent() const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Thu Nov 30 2023 04:03:15 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.