File: qofonoextsimlistmodel.h

package info (click to toggle)
libqofonoext 1.0.32-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 268 kB
  • sloc: cpp: 2,683; makefile: 8
file content (80 lines) | stat: -rw-r--r-- 2,333 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
/****************************************************************************
**
** Copyright (C) 2015-2021 Jolla Ltd.
** Copyright (C) 2015-2021 Slava Monich <slava.monich@jolla.com>
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file.  Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
****************************************************************************/

#ifndef QOFONOEXTSIMLISTMODEL_H
#define QOFONOEXTSIMLISTMODEL_H

#include "qofonosimwatcher.h"
#include "qofonoextsiminfo.h"
#include "qofonoextmodemmanager.h"

class QOfonoExtSimListModel : public QAbstractListModel {
    Q_OBJECT
    Q_PROPERTY(bool valid READ valid NOTIFY validChanged)
    Q_PROPERTY(int count READ count NOTIFY countChanged)

public:
    enum Role {
        PathRole = Qt::UserRole + 1,
        SlotRole,
        ValidRole,
        SubscriberIdentityRole,
        MobileCountryCodeRole,
        MobileNetworkCodeRole,
        ServiceProviderNameRole,
        SubscriberNumbersRole,
        ServiceNumbersRole,
        PinRequiredRole,
        LockedPinsRole,
        CardIdentifierRole,
        PreferredLanguagesRole,
        PinRetriesRole,
        FixedDialingRole,
        BarredDialingRole
    };

    explicit QOfonoExtSimListModel(QObject* aParent = NULL);

    bool valid() const;
    int count() const;

protected:
    QHash<int,QByteArray> roleNames() const;
    int rowCount(const QModelIndex& aParent) const;
    QVariant data(const QModelIndex& aIndex, int aRole) const;

Q_SIGNALS:
    void validChanged();
    void countChanged();
    void simAdded(QOfonoExtSimInfo* sim);
    void simRemoved(QString path);

private Q_SLOTS:
    void onPresentSimListChanged();

private:
    void checkValid();
    bool isValid() const;

private:
    class SimData;
    friend class SimData;
    QSharedPointer<QOfonoExtModemManager> iModemManager;
    QOfonoSimWatcher* iSimWatcher;
    QList<SimData*> iSimList;
    bool iValid;
};

#endif // QOFONOEXTSIMLISTMODEL_H