KCMUtils

pluginpage.h
1 /*
2  This file is part of the KDE project
3  SPDX-FileCopyrightText: 2003 Matthias Kretz <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-only
6 */
7 
8 #ifndef KSETTINGS_PLUGINPAGE_H
9 #define KSETTINGS_PLUGINPAGE_H
10 
11 #include <KCModule>
12 #include <kcmutils_export.h>
13 
14 class KPluginSelector;
15 
16 namespace KSettings
17 {
18 class PluginPagePrivate;
19 
20 #if KCMUTILS_ENABLE_DEPRECATED_SINCE(5, 76)
21 
22 /**
23  * @short Convenience KCModule for creating a plugins config page.
24  *
25  * This class makes it very easy to create a plugins configuration page to your
26  * program. All you need to do is create a class that is derived from
27  * PluginPage and add the appropriate plugin information to the KPluginSelector.
28  * This is done using the pluginSelector() method:
29  * \code
30  * K_PLUGIN_FACTORY(MyAppPluginConfigFactory,
31  * registerPlugin<MyAppPluginConfig>();
32  * )
33  *
34  * MyAppPluginConfig(QWidget * parent, const QVariantList & args)
35  * : PluginPage(MyAppPluginConfigFactory::componentData(), parent, args)
36  * {
37  * pluginSelector()->addPlugins( QCoreApplication::instance()->applicationName(), i18n( "General Plugins" ), "General" );
38  * pluginSelector()->addPlugins( QCoreApplication::instance()->applicationName(), i18n( "Effects" ), "Effects" );
39  * }
40  * \endcode
41  *
42  * All that remains to be done is to create the appropriate .desktop file
43  * \verbatim
44  [Desktop Entry]
45  Icon=plugin
46  Type=Service
47  X-KDE-ServiceTypes=KCModule
48 
49  X-KDE-Library=myapppluginconfig
50  X-KDE-FactoryName=MyAppPluginConfigFactory
51  X-KDE-ParentApp=myapp
52  X-KDE-ParentComponents=myapp
53 
54  Name=Plugins
55  Comment=Select and configure your plugins:
56  \endverbatim
57  *
58  * @author Matthias Kretz <[email protected]>
59  * @deprecated since 5.76, use KPluginWidget instead.
60  */
61 class KCMUTILS_EXPORT PluginPage : public KCModule
62 {
63  Q_OBJECT
64  Q_DECLARE_PRIVATE(PluginPage)
65 public:
66  /**
67  * Standard KCModule constructor.
68  * Automatically creates the KPluginSelector widget.
69  */
70  KCMUTILS_DEPRECATED_VERSION(5, 76, "Use KPluginWidget instead")
71  explicit PluginPage(const KAboutData *aboutData, QWidget *parent = nullptr, const QVariantList &args = QVariantList());
72 
73  ~PluginPage() override;
74 
75  /**
76  * @return a reference to the KPluginSelector.
77  */
78  KPluginSelector *pluginSelector();
79 
80  /**
81  * Load the state of the plugins (selected or not) from the KPluginInfo
82  * objects. For KParts plugins everything should work automatically. For
83  * your own type of plugins you might need to reimplement the
84  * KPluginInfo::pluginLoaded() method. If that doesn't fit your needs
85  * you can also reimplement this method.
86  */
87  void load() override;
88 
89  /**
90  * Save the state of the plugins to KConfig objects
91  */
92  void save() override;
93  void defaults() override;
94 
95 protected:
96  PluginPagePrivate *const d_ptr;
97 
98 private:
99  Q_PRIVATE_SLOT(d_func(), void _k_reparseConfiguration(const QByteArray &a))
100 };
101 
102 #endif
103 
104 }
105 
106 #endif // KSETTINGS_PLUGINPAGE_H
A widget to select what plugins to load and configure the plugins.
A collection of classes to create configuration dialogs that work over component boundaries.
Definition: dialog.cpp:35
Convenience KCModule for creating a plugins config page.
Definition: pluginpage.h:61
This file is part of the KDE documentation.
Documentation copyright © 1996-2022 The KDE developers.
Generated on Fri May 27 2022 03:51:38 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.