File indexing completed on 2024-05-05 16:05:44

0001 /*
0002     This file is part of the KDE project
0003     SPDX-FileCopyrightText: 2007 Matthias Kretz <kretz@kde.org>
0004 
0005     SPDX-License-Identifier: LGPL-2.0-only
0006 */
0007 
0008 #ifndef KSETTINGS_DIALOG_P_H
0009 #define KSETTINGS_DIALOG_P_H
0010 
0011 #include "../kcmoduleinfo.h"
0012 #include "../kcmultidialog_p.h"
0013 #include "dialog.h"
0014 
0015 #include <QHash>
0016 #include <QSet>
0017 #include <QString>
0018 
0019 #include <KPageWidgetModel>
0020 #include <KPluginInfo>
0021 #include <KService>
0022 
0023 class QCheckBox;
0024 
0025 namespace KSettings
0026 {
0027 class DialogPrivate : public KCMultiDialogPrivate
0028 {
0029     friend class PageNode;
0030     Q_DECLARE_PUBLIC(Dialog)
0031 protected:
0032     DialogPrivate(Dialog *parent);
0033 
0034     QHash<QString, KPageWidgetItem *> pageItemForGroupId;
0035     QHash<KPageWidgetItem *, KPluginInfo> pluginForItem;
0036     QHash<KPageWidgetItem *, QCheckBox *> checkBoxForItem;
0037     KPluginInfo::List plugininfos;
0038 
0039     QStringList registeredComponents;
0040     QSet<KCModuleInfo> kcmInfos;
0041     QStringList componentBlacklist;
0042     QStringList arguments;
0043     QStringList components;
0044 
0045     bool staticlistview : 1;
0046     bool firstshow : 1;
0047     quint32 pluginStateDirty : 30;
0048 
0049     // void _k_configureTree();
0050     void _k_updateEnabledState(bool);
0051     void updateConfiguration();
0052     void _k_clientChanged() override;
0053 
0054     KPageWidgetItem *createPageItem(KPageWidgetItem *parentItem, const QString &name, const QString &comment, const QString &iconName, int weight);
0055 
0056     void connectItemCheckBox(KPageWidgetItem *item, const KPluginInfo &pinfo, bool isEnabled);
0057 
0058 private:
0059     /**
0060      * @internal
0061      * Check whether the plugin associated with this KCM is enabled.
0062      */
0063     bool isPluginForKCMEnabled(const KCModuleInfo *moduleinfo, KPluginInfo &pinfo) const;
0064     bool isPluginImmutable(const KPluginInfo &pinfo) const;
0065 
0066     QSet<KCModuleInfo> instanceServices();
0067     QSet<KCModuleInfo> parentComponentsServices(const QStringList &);
0068 
0069     /**
0070      * @internal
0071      * Read the .setdlg file and add it to the groupmap
0072      */
0073     void parseGroupFile(const QString &);
0074 
0075     /**
0076      * @internal
0077      * If this module is put into a TreeList hierarchy this will return a
0078      * list of the names of the parent modules.
0079      */
0080     // QStringList parentModuleNames(KCModuleInfo *);
0081 
0082     /**
0083      * @internal
0084      * This method is called only once. The KCMultiDialog is not created
0085      * until it's really needed. So if some method needs to access d->dlg it
0086      * checks for 0 and if it's not created this method will do it.
0087      */
0088     void createDialogFromServices();
0089 };
0090 
0091 } // namespace KSettings
0092 #endif // KSETTINGS_DIALOG_P_H