File indexing completed on 2025-02-02 05:02:30
0001 /* 0002 SPDX-FileCopyrightText: 2017-2023 Volker Krause <vkrause@kde.org> 0003 SPDX-License-Identifier: LGPL-2.0-or-later 0004 */ 0005 0006 #ifndef KDECONNECT_H 0007 #define KDECONNECT_H 0008 0009 #include <QAbstractListModel> 0010 #include <QObject> 0011 #include <QString> 0012 0013 class KDEConnectDeviceModel : public QAbstractListModel 0014 { 0015 Q_OBJECT 0016 public: 0017 explicit KDEConnectDeviceModel(QObject *parent = nullptr); 0018 ~KDEConnectDeviceModel(); 0019 0020 Q_INVOKABLE void refresh(); 0021 0022 enum { 0023 DeviceNameRole = Qt::DisplayRole, 0024 DeviceIdRole = Qt::UserRole, 0025 }; 0026 0027 int rowCount(const QModelIndex &parent = {}) const override; 0028 QVariant data(const QModelIndex &index, int role) const override; 0029 QHash<int, QByteArray> roleNames() const override; 0030 0031 private: 0032 struct Device { 0033 QString deviceId; 0034 QString name; 0035 }; 0036 std::vector<Device> m_devices; 0037 }; 0038 0039 0040 class KDEConnect : public QObject 0041 { 0042 Q_OBJECT 0043 public: 0044 static void sendToDevice(const QString &fileName, const QString &deviceId); 0045 }; 0046 0047 #endif