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 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148
|
/** This file is part of Contacts daemon
**
** Copyright (c) 2013-2019 Jolla Ltd.
** Copyright (c) 2020 Open Mobile Platform LLC.
**
** GNU Lesser General Public License Usage
** 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 CDSIMCONTROLLER_H
#define CDSIMCONTROLLER_H
#include <QtCore>
#include <QContactManager>
#include <QContact>
#include <QContactCollection>
#include <QContactFilter>
#include <QVersitReader>
#include <qofonomodem.h>
#include <qofonophonebook.h>
#include <qofonosimmanager.h>
#include <qofonomessagewaiting.h>
#include <qofonoextsiminfo.h>
#ifdef HAS_MLITE
#include <MGConfItem>
#endif // HAS_MLITE
QTCONTACTS_USE_NAMESPACE
QTVERSIT_USE_NAMESPACE
class CDSimModemData;
class CDSimController : public QObject
{
Q_OBJECT
public:
explicit CDSimController(QObject *parent = 0, bool active = true);
~CDSimController();
QContactManager &contactManager();
QContactCollection contactCollection(const QString &modemPath) const;
int modemIndex(const QString &modemPath) const;
bool busy() const;
Q_SIGNALS:
void busyChanged(bool);
public Q_SLOTS:
void setModemPaths(const QStringList &paths);
#ifdef HAS_MLITE
void transientImportConfigurationChanged();
#endif // HAS_MLITE
void modemReadyChanged(bool ready);
private:
void updateBusy();
void timerEvent(QTimerEvent *event);
void removeObsoleteSimCollections();
private:
friend class CDSimModemData;
friend class TestSimPlugin;
QContactManager m_manager;
bool m_transientImport;
bool m_busy;
bool m_active;
#ifdef HAS_MLITE
MGConfItem m_transientImportConf;
#endif // HAS_MLITE
QBasicTimer m_readyTimer;
QMap<QString, CDSimModemData *> m_modems;
QSet<QString> m_absentModemPaths;
QStringList m_availableModems;
};
class CDSimModemData : public QObject
{
Q_OBJECT
public:
CDSimModemData(CDSimController *controller, const QString &modemPath);
~CDSimModemData();
CDSimController *controller() const;
QContactManager &manager() const;
QString modemIdentifier() const;
QString modemPath() const;
QContactCollection contactCollection() const;
QList<QContact> fetchContacts() const;
bool ready() const;
void setReady(bool ready);
void updateBusy();
static bool removeCollections(QContactManager *manager, const QList<QContactCollectionId> &collectionIds);
Q_SIGNALS:
void readyChanged(bool ready);
public Q_SLOTS:
void simStateChanged();
void vcardDataAvailable(const QString &vcardData);
void vcardReadFailed();
void readerStateChanged(QVersitReader::State state);
void voicemailConfigurationChanged();
void phonebookValidChanged(bool valid);
public:
void deactivateAllSimContacts();
void removeAllSimContacts();
void ensureSimContactsPresent();
void updateVoicemailConfiguration();
void performTransientImport();
void initCollection();
void timerEvent(QTimerEvent *event);
QString m_modemPath;
QOfonoSimManager m_simManager;
QOfonoPhonebook m_phonebook;
QOfonoMessageWaiting m_messageWaiting;
QOfonoExtSimInfo m_simInfo;
#ifdef HAS_MLITE
MGConfItem *m_voicemailConf;
#endif // HAS_MLITE
QVersitReader m_contactReader;
QList<QContact> m_simContacts;
QContactCollection m_collection;
QBasicTimer m_retryTimer;
bool m_ready;
int m_retries;
};
#endif // CDSIMCONTROLLER_H
|