File indexing completed on 2024-05-12 17:07:18

0001 /*
0002     SPDX-FileCopyrightText: 2020 David Redondo <kde@david-redondo.de>
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 <QList>
0010 
0011 #include "basemodel.h"
0012 
0013 class QDBusError;
0014 
0015 class KConfigBase;
0016 class KGlobalAccelInterface;
0017 class KGlobalShortcutInfo;
0018 
0019 class FilteredShortcutsModel;
0020 
0021 class GlobalAccelModel : public BaseModel
0022 {
0023     Q_OBJECT
0024 
0025 public:
0026     GlobalAccelModel(KGlobalAccelInterface *interface, QObject *parent = nullptr);
0027 
0028     QVariant data(const QModelIndex &index, int role) const override;
0029 
0030     void addApplication(const QString &desktopFileName, const QString &displayName);
0031 
0032     void exportToConfig(const KConfigBase &config) override;
0033     void importConfig(const KConfigBase &config) override;
0034 
0035     void load() override;
0036     void save() override;
0037 
0038 Q_SIGNALS:
0039     void errorOccured(const QString &);
0040 
0041 private:
0042     Component loadComponent(const QList<KGlobalShortcutInfo> &info);
0043     void removeComponent(const Component &component);
0044     void genericErrorOccured(const QString &description, const QDBusError &error);
0045 
0046     KGlobalAccelInterface *m_globalAccelInterface;
0047 };