0d440cd47b766a3558197374c3b269448f24f988
[qwerkisync] / EventTypes / PhoneCall.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_PHONECALL_H
20 #define EVENTTYPES_PHONECALL_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 PhoneCall : public RtcomEvent
36         {
37         public:
38                 enum eDestination
39                 {
40                         INCOMING,
41                         OUTGOING
42                 };
43
44         public:
45                 virtual const DBBackends::iDBBackend &DB() const;
46
47                 PhoneCall(const Settings &settings);
48                 PhoneCall(const Settings &settings, const eDestination destination, const QDateTime &timestamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments = AttachmentCollection());
49                 ~PhoneCall();
50
51                 virtual const uint HashCode() const;
52
53                 const eDestination Destination() const { return m_Destination; }
54                 void setDestination(const eDestination destination) { m_Destination = destination; }
55
56                 virtual const QDateTime Timestamp() const { return m_Timestamp; }
57                 void setTimestamp(const QDateTime timestamp) { m_Timestamp = timestamp; }
58
59                 const QString Tel() const { return m_Tel; }
60                 void setTel(const QString tel) { m_Tel = tel; }
61
62                 virtual const int DurationInSeconds() const { return m_DurationInSeconds; }
63                 void setDurationInSeconds(const int durationInSeconds) { m_DurationInSeconds = durationInSeconds; }
64
65                 virtual const AttachmentCollection & Attachments() const { return m_Attachments; }
66                 virtual AttachmentCollection & Attachments() { return m_Attachments; }
67
68         public:
69                 virtual void Export(const QString &baseDirectory) const;
70                 PhoneCall(const Settings &settings, const RTComElEvent& event, const QList<RTComElAttachment*> attachments = QList<RTComElAttachment*>());
71                 virtual RTComElEvent * toRTComEvent(const NumberToNameLookup &numberToNameLookup) const;
72
73         protected:
74                 const Settings &CurrentSettings() const { return m_Settings; }
75
76         private:
77                 const Settings &m_Settings;
78                 eDestination m_Destination;
79                 QDateTime m_Timestamp;
80                 QString m_Tel;
81                 int m_DurationInSeconds;
82                 AttachmentCollection m_Attachments;
83         };
84 }
85
86 QDebug operator<<(QDebug dbg, EventTypes::PhoneCall & event);
87
88 #endif // EVENTTYPES_PHONECALL_H