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