File indexing completed on 2024-05-19 15:21:42
0001 /* 0002 SPDX-FileCopyrightText: 2015 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 MODEMMANAGERQT_FAKE_MODEM_MODEM_MESSAGING_H 0008 #define MODEMMANAGERQT_FAKE_MODEM_MODEM_MESSAGING_H 0009 0010 #include "generictypes.h" 0011 #include "sms.h" 0012 0013 #include <QObject> 0014 0015 #include <QDBusObjectPath> 0016 0017 class ModemMessaging : public QDBusAbstractAdaptor 0018 { 0019 Q_OBJECT 0020 Q_CLASSINFO("D-Bus Interface", "org.kde.fakemodem.Modem.Messaging") 0021 public: 0022 explicit ModemMessaging(QObject *parent = nullptr); 0023 ~ModemMessaging() override; 0024 0025 Q_PROPERTY(uint DefaultStorage READ defaultStorage) 0026 Q_PROPERTY(QList<QDBusObjectPath> Messages READ messages) 0027 Q_PROPERTY(ModemManager::UIntList SupportedStorages READ supportedStorages) 0028 0029 uint defaultStorage() const; 0030 QList<QDBusObjectPath> messages() const; 0031 ModemManager::UIntList supportedStorages() const; 0032 0033 /* Not part of dbus interface */ 0034 void addMessage(Sms *sms); 0035 void setModemPath(const QString &path); 0036 void setEnableNotifications(bool enable); 0037 void setDefaultStorage(uint defaultStorage); 0038 void setSupportedStorages(const ModemManager::UIntList &supportedStorages); 0039 0040 QVariantMap toMap() const; 0041 0042 public Q_SLOTS: // METHODS 0043 Q_SCRIPTABLE QDBusObjectPath Create(const QVariantMap &properties); 0044 Q_SCRIPTABLE void Delete(const QDBusObjectPath &path); 0045 Q_SCRIPTABLE QList<QDBusObjectPath> List(); 0046 0047 Q_SIGNALS: // SIGNALS 0048 Q_SCRIPTABLE void Added(const QDBusObjectPath &path, bool received); 0049 Q_SCRIPTABLE void Deleted(const QDBusObjectPath &path); 0050 0051 private: 0052 QString m_modemPath; 0053 bool m_enabledNotifications; 0054 int m_messageCounter; 0055 uint m_defaultStorage; 0056 QMap<QDBusObjectPath, Sms *> m_messages; 0057 ModemManager::UIntList m_supportedStorages; 0058 }; 0059 0060 #endif