File indexing completed on 2024-06-16 05:08:59

0001 /*
0002     SPDX-FileCopyrightText: 2014 Vishesh Handa <me@vhanda.in>
0003     SPDX-FileCopyrightText: 2020 Alexander Lohnau <alexander.lohnau@gmx.de>
0004     SPDX-FileCopyrightText: 2020 Cyril Rossi <cyril.rossi@enioka.com>
0005     SPDX-FileCopyrightText: 2022 Fushan Wen <qydwhotmail@gmail.com>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 
0010 #pragma once
0011 
0012 #include <KConfigGroup>
0013 #include <KQuickManagedConfigModule>
0014 
0015 class KRunnerSettingsBase;
0016 class KRunnerSettingsData;
0017 
0018 class KRunnerSettings : public KQuickManagedConfigModule
0019 {
0020     Q_OBJECT
0021     Q_PROPERTY(KRunnerSettingsBase *krunnerSettings READ krunnerSettings CONSTANT)
0022     /**
0023      * @return @c true if the KCM is not launched from the plugin settings, @c false
0024      * otherwise.
0025      */
0026     Q_PROPERTY(bool doesShowPluginButton MEMBER m_doesShowPluginButton CONSTANT)
0027     Q_PROPERTY(QStringList historyKeys READ historyKeys NOTIFY historyKeysChanged)
0028 
0029 public:
0030     KRunnerSettings(QObject *parent, const KPluginMetaData &metaData, const QVariantList &args);
0031 
0032     KRunnerSettingsBase *krunnerSettings() const;
0033 
0034     QStringList historyKeys() const;
0035 
0036     Q_INVOKABLE void deleteAllHistory();
0037     Q_INVOKABLE void deleteHistoryGroup(const QString &key);
0038 
0039 Q_SIGNALS:
0040     void historyKeysChanged();
0041 
0042 public Q_SLOTS:
0043     void save() override;
0044 
0045 private:
0046     void configureClearHistoryButton();
0047 
0048     KRunnerSettingsData *m_data;
0049     KConfigGroup m_historyConfigGroup;
0050     QStringList m_historyKeys;
0051 
0052     bool m_doesShowPluginButton;
0053 
0054     const QString nullUuid = QStringLiteral("00000000-0000-0000-0000-000000000000");
0055 };