File indexing completed on 2024-04-28 16:52:42

0001 /*
0002     SPDX-FileCopyrightText: 2013-2018 Jan Grulich <jgrulich@redhat.com>
0003 
0004     SPDX-License-Identifier: LGPL-2.1-only OR LGPL-3.0-only OR LicenseRef-KDE-Accepted-LGPL
0005 */
0006 
0007 #ifndef PLASMA_NM_MODEL_NETWORK_ITEMS_LIST_H
0008 #define PLASMA_NM_MODEL_NETWORK_ITEMS_LIST_H
0009 
0010 #include <QAbstractListModel>
0011 
0012 #include <NetworkManagerQt/ConnectionSettings>
0013 
0014 class NetworkModelItem;
0015 
0016 class NetworkItemsList : public QObject
0017 {
0018     Q_OBJECT
0019 public:
0020     enum FilterType {
0021         ActiveConnection,
0022         Connection,
0023         Device,
0024         Name,
0025         Ssid,
0026         Uuid,
0027         Type,
0028     };
0029 
0030     explicit NetworkItemsList(QObject *parent = nullptr);
0031     ~NetworkItemsList() override;
0032 
0033     bool contains(const FilterType type, const QString &parameter) const;
0034     int count() const;
0035     int indexOf(NetworkModelItem *item) const;
0036     NetworkModelItem *itemAt(int index) const;
0037     QList<NetworkModelItem *> items() const;
0038     QList<NetworkModelItem *> returnItems(const FilterType type, const QString &parameter, const QString &additionalParameter = QString()) const;
0039     QList<NetworkModelItem *> returnItems(const FilterType type, NetworkManager::ConnectionSettings::ConnectionType typeParameter) const;
0040 
0041     void insertItem(NetworkModelItem *item);
0042     void removeItem(NetworkModelItem *item);
0043 
0044 private:
0045     QList<NetworkModelItem *> m_items;
0046 };
0047 
0048 #endif // PLASMA_NM_MODEL_NETWORK_ITEMS_LIST_H