File indexing completed on 2024-07-14 04:50:04

0001 /**
0002  * SPDX-FileCopyrightText: 2015 Albert Vaca <albertvaka@gmail.com>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005  */
0006 
0007 #pragma once
0008 
0009 #include <KCModule>
0010 #include <KPluginMetaData> // Not in KCModule header of older KF5 versions
0011 #include <kconfigwidgets_version.h>
0012 
0013 #include "core/kdeconnectpluginconfig.h"
0014 #include "kdeconnectpluginkcm_export.h"
0015 
0016 /**
0017  * Inheriting your plugin's KCM from this class gets you a easy way to share
0018  * configuration values between the KCM and the plugin.
0019  */
0020 class KDECONNECTPLUGINKCM_EXPORT KdeConnectPluginKcm : public KCModule
0021 {
0022     Q_OBJECT
0023 
0024 public:
0025     explicit KdeConnectPluginKcm(QObject *parent, const KPluginMetaData &data, const QVariantList &args);
0026 
0027     /**
0028      * The device this kcm is instantiated for
0029      */
0030     QString deviceId() const
0031     {
0032         return m_deviceId;
0033     }
0034 
0035     /**
0036      * The object where to save the config, so the plugin can access it
0037      */
0038     KdeConnectPluginConfig *config() const
0039     {
0040         return m_config;
0041     }
0042 
0043 private:
0044     const QString m_deviceId;
0045     const QString m_pluginName;
0046     KdeConnectPluginConfig *const m_config;
0047 };