Changeset View
Changeset View
Standalone View
Standalone View
smsapp/conversationmodel.h
Show All 16 Lines | |||||
17 | * License along with this library; if not, write to the Free Software | 17 | * License along with this library; if not, write to the Free Software | ||
18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | 18 | * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA | ||
19 | */ | 19 | */ | ||
20 | 20 | | |||
21 | #ifndef CONVERSATIONMODEL_H | 21 | #ifndef CONVERSATIONMODEL_H | ||
22 | #define CONVERSATIONMODEL_H | 22 | #define CONVERSATIONMODEL_H | ||
23 | 23 | | |||
24 | #include <QStandardItemModel> | 24 | #include <QStandardItemModel> | ||
25 | #include <QLoggingCategory> | ||||
25 | 26 | | |||
26 | class ConversationModel : public QStandardItemModel | 27 | #include "interfaces/dbusinterfaces.h" | ||
28 | | ||||
29 | #include "interfaces/kdeconnectinterfaces_export.h" | ||||
30 | | ||||
31 | Q_DECLARE_LOGGING_CATEGORY(KDECONNECT_SMS_CONVERSATION_MODEL) | ||||
32 | | ||||
33 | class KDECONNECTINTERFACES_EXPORT ConversationModel | ||||
34 | : public QStandardItemModel | ||||
27 | { | 35 | { | ||
28 | Q_OBJECT | 36 | Q_OBJECT | ||
29 | Q_PROPERTY(QString threadId READ threadId WRITE setThreadId) | 37 | Q_PROPERTY(QString threadId READ threadId WRITE setThreadId) | ||
30 | Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId) | 38 | Q_PROPERTY(QString deviceId READ deviceId WRITE setDeviceId) | ||
31 | 39 | | |||
32 | public: | 40 | public: | ||
33 | ConversationModel(QObject* parent = nullptr); | 41 | ConversationModel(QObject* parent = nullptr); | ||
42 | ~ConversationModel(); | ||||
34 | 43 | | |||
35 | enum Roles { FromMeRole = Qt::UserRole }; | 44 | enum Roles { | ||
45 | FromMeRole = Qt::UserRole, | ||||
46 | DateRole, | ||||
47 | }; | ||||
36 | 48 | | |||
37 | QString threadId() const; | 49 | QString threadId() const; | ||
38 | void setThreadId(const QString &threadId); | 50 | void setThreadId(const QString &threadId); | ||
39 | 51 | | |||
40 | QString deviceId() const { return {}; } | 52 | QString deviceId() const { return m_deviceId; } | ||
41 | void setDeviceId(const QString &/*deviceId*/) {} | 53 | void setDeviceId(const QString &/*deviceId*/); | ||
54 | | ||||
55 | Q_INVOKABLE void sendReplyToConversation(const QString& message); | ||||
56 | | ||||
57 | private Q_SLOTS: | ||||
58 | void createRowFromMessage(const QVariantMap &msg, int pos); | ||||
59 | | ||||
60 | private: | ||||
61 | DeviceConversationsDbusInterface* m_conversationsInterface; | ||||
62 | QString m_deviceId; | ||||
63 | QString m_threadId; | ||||
42 | }; | 64 | }; | ||
43 | 65 | | |||
44 | #endif // CONVERSATIONMODEL_H | 66 | #endif // CONVERSATIONMODEL_H |