File indexing completed on 2024-04-21 14:53:51
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 KCMUTILS_KCMODULEPROXY_P_H 0009 #define KCMUTILS_KCMODULEPROXY_P_H 0010 0011 #include "kcmoduleinfo.h" 0012 #include "kcmoduleproxy.h" 0013 #include <KPluginMetaData> 0014 #include <QLabel> 0015 class QVBoxLayout; 0016 0017 #include <optional> 0018 0019 class KCModuleProxyPrivate 0020 { 0021 Q_DECLARE_PUBLIC(KCModuleProxy) 0022 protected: 0023 KCModuleProxyPrivate(KCModuleProxy *_parent, 0024 #if KCMUTILS_BUILD_DEPRECATED_SINCE(5, 88) 0025 const KCModuleInfo &info, 0026 #endif 0027 const QStringList &_args) 0028 : args(_args) 0029 #if KCMUTILS_BUILD_DEPRECATED_SINCE(5, 88) 0030 , modInfo(info) 0031 #endif 0032 , parent(_parent) 0033 , q_ptr(_parent) 0034 0035 { 0036 } 0037 0038 KCModuleProxyPrivate(KCModuleProxy *_parent, const KPluginMetaData &metaData, const QStringList &_args) 0039 : args(_args) 0040 , parent(_parent) 0041 , q_ptr(_parent) 0042 , metaData(metaData) 0043 0044 { 0045 } 0046 0047 ~KCModuleProxyPrivate() 0048 { 0049 delete rootInfo; // Delete before embedWidget! 0050 delete kcm; 0051 } 0052 0053 void loadModule(); 0054 0055 /** 0056 * Makes sure the proper variables is set and signals are emitted. 0057 */ 0058 void _k_moduleChanged(bool); 0059 0060 /** 0061 * Makes sure the proper variables is set and signals are emitted. 0062 */ 0063 void _k_moduleDefaulted(bool); 0064 0065 /** 0066 * Zeroes d->kcm 0067 */ 0068 void _k_moduleDestroyed(); 0069 0070 /** 0071 * Gets called by DCOP when an application closes. 0072 * Is used to (try to) reload a KCM which previously 0073 * was loaded. 0074 */ 0075 void _k_ownerChanged(const QString &service, const QString &oldOwner, const QString &newOwner); 0076 0077 QStringList args; 0078 KCModule *kcm = nullptr; 0079 QVBoxLayout *topLayout = nullptr; /* Contains QScrollView view, and root stuff */ 0080 QLabel *rootInfo = nullptr; 0081 QString dbusService; 0082 QString dbusPath; 0083 #if KCMUTILS_BUILD_DEPRECATED_SINCE(5, 88) 0084 KCModuleInfo modInfo; 0085 #endif 0086 bool changed = false; 0087 bool defaulted = false; 0088 KCModuleProxy *parent = nullptr; 0089 KCModuleProxy *q_ptr = nullptr; 0090 std::optional<KPluginMetaData> metaData; 0091 }; 0092 0093 #endif // KCMUTILS_KCMODULEPROXY_P_H