File indexing completed on 2024-05-12 03:54:09

0001 /*
0002     SPDX-FileCopyrightText: 2022 Nicolas Fella <nicolas.fella@gmx.de>
0003 
0004     SPDX-License-Identifier: LGPL-2.0-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #include <KPluginFactory>
0008 #include <KPluginMetaData>
0009 #include <kcmodule.h>
0010 
0011 #include <QLabel>
0012 
0013 class FakeKcm : public KCModule
0014 {
0015 public:
0016     FakeKcm(QObject *parent, const KPluginMetaData &data)
0017         : KCModule(parent, data)
0018     {
0019         auto label = new QLabel(widget());
0020         label->setText(QStringLiteral("Demo Text"));
0021         qWarning() << Q_FUNC_INFO;
0022     }
0023     void load() override
0024     {
0025         qWarning() << Q_FUNC_INFO;
0026         // The QObject hierarchy until we are at the KCMultiDialog
0027         auto p = parent()->parent()->parent()->parent();
0028         p->setProperty("loadcalled", p->property("loadcalled").toInt() + 1);
0029         setNeedsSave(false);
0030     }
0031 };
0032 
0033 K_PLUGIN_CLASS_WITH_JSON(FakeKcm, "fakekcm.json")
0034 
0035 #include "fakekcm.moc"