lomiri-connectivity-api
sims-list-model.h
Go to the documentation of this file.
1/*
2 * Copyright © 2016 Canonical Ltd.
3 *
4 * This program is free software: you can redistribute it and/or modify it
5 * under the terms of the GNU Lesser General Public License version 3,
6 * as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Lesser General Public License for more details.
12 *
13 * You should have received a copy of the GNU Lesser General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 *
16 * Authors:
17 * Antti Kaijanmäki <antti.kaijanmaki@canonical.com>
18 */
19
20#pragma once
21
22#include <QAbstractItemModel>
23#include <QDBusConnection>
24#include <QDBusObjectPath>
25#include <connectivityqt/sim.h>
26
27#include <lomiri/util/DefinesPtrs.h>
28
29#include <memory>
30
31namespace connectivityqt
32{
33namespace internal
34{
35struct SimsListModelParameters;
36}
37
38class Q_DECL_EXPORT SimsListModel : public QAbstractListModel
39{
40 Q_OBJECT
41
42 Q_ENUMS(Roles)
43
44public:
45
47
61
62 SimsListModel(const internal::SimsListModelParameters& parameters);
63
65
66 int columnCount(const QModelIndex &parent) const override;
67
68 int rowCount(const QModelIndex &parent) const override;
69
70 QVariant data(const QModelIndex &index, int role) const override;
71
72 QHash<int, QByteArray> roleNames() const override
73 {
74 QHash<int, QByteArray> roles;
75 roles[RoleIccid] = "Iccid";
76 roles[RoleImsi] = "Imsi";
77 roles[RolePrimaryPhoneNumber] = "PrimaryPhoneNumber";
78 roles[RoleLocked] = "Locked";
79 roles[RolePresent] = "Present";
80 roles[RoleMcc] = "Mcc";
81 roles[RoleMnc] = "Mnc";
82 roles[RolePreferredLanguages] = "PreferredLanguages";
83 roles[RoleDataRoamingEnabled] = "DataRoamingEnabled";
84 roles[RoleSim] = "Sim";
85 return roles;
86 }
87
88 Sim::SPtr getSimByPath(const QDBusObjectPath &path) const;
89
90Q_SIGNALS:
92
93protected:
94 class Priv;
95 std::shared_ptr<Priv> d;
96};
97
98}
Definition sims-list-model.h:39
LOMIRI_DEFINES_PTRS(SimsListModel)
std::shared_ptr< Priv > d
Definition sims-list-model.h:95
Roles
Definition sims-list-model.h:49
@ RoleImsi
Definition sims-list-model.h:51
@ RoleDataRoamingEnabled
Definition sims-list-model.h:58
@ RolePresent
Definition sims-list-model.h:54
@ RoleLocked
Definition sims-list-model.h:53
@ RoleMcc
Definition sims-list-model.h:55
@ RolePrimaryPhoneNumber
Definition sims-list-model.h:52
@ RolePreferredLanguages
Definition sims-list-model.h:57
@ RoleMnc
Definition sims-list-model.h:56
QHash< int, QByteArray > roleNames() const override
Definition sims-list-model.h:72
Definition connectivity.cpp:37