ce7955658aeb184bfe38b75131287d9bd9326ada
[qwerkisync] / EventTypes / SMS.h
1 /*
2  * Copyright (C) 2011, Jamie Thompson
3  *
4  * This program is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU General Public
6  * License as published by the Free Software Foundation; either
7  * version 3 of the License, or (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public
15  * License along with this program; If not, see
16  * <http://www.gnu.org/licenses/>.
17  */
18
19 #ifndef EVENTTYPES_SMS_H
20 #define EVENTTYPES_SMS_H
21
22 #include <QDateTime>
23 #include <QDebug>
24 #include <QList>
25 #include <QString>
26
27 #include "RtcomEvent.h"
28
29 #include "AttachmentCollection.h"
30
31 class Settings;
32
33 namespace EventTypes
34 {
35         class SMS : public RtcomEvent
36         {
37         public:
38                 enum eDestination
39                 {
40                         INBOX,
41                         SENT
42                 };
43
44         public:
45                 virtual const DBBackends::iDBBackend &DB() const;
46
47                 SMS(const Settings &settings);
48                 ~SMS();
49
50                 virtual const uint HashCode() const;
51
52                 const float Version() const { return m_Version; }
53                 void Version(const float version) { m_Version = version; }
54
55                 const bool IsRead() const { return m_Read; }
56                 void IsRead(const bool isRead) { m_Read = isRead; }
57
58                 const eDestination Destination() const { return m_Destination; }
59                 void Destination(const eDestination destination) { m_Destination = destination; }
60
61                 virtual const QDateTime Timestamp() const { return m_Timestamp; }
62                 void Timestamp(const QDateTime timestamp) { m_Timestamp = timestamp; }
63
64                 const QString Tel() const { return m_Tel; }
65                 void Tel(const QString tel) { m_Tel = tel; }
66
67                 QString Contents() const { return m_Contents; }
68                 void Contents(const QString contents) { m_Contents = contents; }
69
70                 bool Pending() const { return m_Pending; }
71                 void Pending(const bool pending) { m_Pending = pending; }
72                 virtual const AttachmentCollection & Attachments() const { return m_Attachments; }
73                 virtual AttachmentCollection & Attachments() { return m_Attachments; }
74
75         public:
76                 virtual void Export(const QString &baseDirectory) const;
77                 SMS(const Settings &settings, const RTComElEvent& event, const QList<RTComElAttachment*> attachments = QList<RTComElAttachment*>());
78                 virtual RTComElEvent * toRTComEvent(const NumberToNameLookup &numberToNameLookup) const;
79
80         protected:
81                 const Settings &CurrentSettings() const { return m_Settings; }
82
83         private:
84                 const Settings &m_Settings;
85                 float m_Version;
86                 bool m_Read;
87                 eDestination m_Destination;
88                 QDateTime m_Timestamp;
89                 QString m_Tel;
90                 QString m_Contents;
91                 AttachmentCollection m_Attachments;
92                 bool m_Pending;
93         };
94 }
95
96 QDebug operator<<(QDebug dbg, EventTypes::SMS & event);
97
98 #endif // EVENTTYPES_SMS_H