File indexing completed on 2024-05-05 04:58:50

0001 /**
0002  * SPDX-FileCopyrightText: 2013 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 <QStandardItemModel>
0011 #include <kconfigwidgets_version.h>
0012 
0013 #include "ui_kcm.h"
0014 #include <core/pairstate.h>
0015 
0016 class QModelIndex;
0017 class DeviceDbusInterface;
0018 class DaemonDbusInterface;
0019 class DevicesModel;
0020 class DevicesSortProxyModel;
0021 
0022 class KdeConnectKcm : public KCModule
0023 {
0024     Q_OBJECT
0025 public:
0026     KdeConnectKcm(QObject *parent, const QVariantList &);
0027     ~KdeConnectKcm() override;
0028 
0029 private:
0030     void save() override;
0031 
0032 private Q_SLOTS:
0033     void deviceSelected(const QModelIndex &current);
0034     void requestPairing();
0035     void pluginsConfigChanged(bool changed);
0036     void sendPing();
0037     void resetSelection();
0038     void pairingFailed(const QString &error);
0039     void refresh();
0040     void renameShow();
0041     void renameDone();
0042     void setRenameMode(bool b);
0043     void resetCurrentDevice();
0044     void setCurrentDevicePairState(int pairStateAsInt);
0045     void acceptPairing();
0046     void cancelPairing();
0047 
0048 private:
0049     void resetDeviceView();
0050 
0051     Ui::KdeConnectKcmUi kcmUi;
0052     DaemonDbusInterface *daemon;
0053     DevicesModel *devicesModel;
0054     DevicesSortProxyModel *sortProxyModel;
0055     DeviceDbusInterface *currentDevice;
0056     QModelIndex currentIndex;
0057     QStringList m_oldSupportedPluginNames;
0058 
0059 public Q_SLOTS:
0060     void unpair();
0061 };