Added CSV parsing and export of Symbian-format Event logs that have had their tables...
[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 "Settings.h"
23
24 #include <QDateTime>
25 #include <QDebug>
26 #include <QList>
27 #include <QString>
28
29 #include "EventTypes/iCSVSymbianEvent.h"
30 #include "RtcomEvent.h"
31
32 #include "AttachmentCollection.h"
33
34 class Settings;
35
36 namespace EventTypes
37 {
38         class PhoneCall : public RtcomEvent, public EventTypes::iCSVSymbianEvent
39         {
40         public:
41                 virtual const DBBackends::iDBBackend &DB() const;
42
43                 PhoneCall(const Settings &settings);
44                 PhoneCall(const Settings &settings, const Settings::eDirection destination, const QDateTime &timestamp, const QString &tel, const int durationInSeconds, const bool isMissedCall, const AttachmentCollection &attachments = AttachmentCollection());
45                 ~PhoneCall();
46
47                 virtual const uint HashCode() const;
48
49                 const Settings::eDirection Destination() const { return m_Destination; }
50                 void Destination(const Settings::eDirection destination) { m_Destination = destination; }
51
52                 virtual const QDateTime Timestamp() const { return m_Timestamp; }
53                 void Timestamp(const QDateTime timestamp) { m_Timestamp = timestamp; }
54
55                 const QString Tel() const { return m_Tel; }
56                 void Tel(const QString tel) { m_Tel = tel; }
57
58                 virtual const int DurationInSeconds() const { return m_DurationInSeconds; }
59                 void DurationInSeconds(const int durationInSeconds) { m_DurationInSeconds = durationInSeconds; }
60
61                 virtual const AttachmentCollection & Attachments() const { return m_Attachments; }
62                 virtual AttachmentCollection & Attachments() { return m_Attachments; }
63
64                 const bool IsMissedCall() const { return m_IsMissedCall; }
65                 void IsMissedCall(const bool isMissedCall) { m_IsMissedCall = isMissedCall; }
66
67         public:
68                 PhoneCall(const Settings &settings, const RTComElEvent& event, const QList<RTComElAttachment*> attachments = QList<RTComElAttachment*>());
69                 virtual RTComElEvent * toRTComEvent(const NumberToNameLookup &numberToNameLookup) const;
70
71         public:
72                 virtual void WriteCSVSymbian(QTextStream &stream, const ColumnIndicesByIndexHash &headerIndices, const QChar delimiter, const NumberToNameLookup &numberToNameLookup, SymbianEventLogStrings &strings) const;
73
74         protected:
75                 const Settings &CurrentSettings() const { return m_Settings; }
76
77         private:
78                 const Settings &m_Settings;
79                 Settings::eDirection m_Destination;
80                 QDateTime m_Timestamp;
81                 QString m_Tel;
82                 int m_DurationInSeconds;
83                 bool m_IsMissedCall;
84                 AttachmentCollection m_Attachments;
85         };
86 }
87
88 QDebug operator<<(QDebug dbg, EventTypes::PhoneCall & event);
89
90 #endif // EVENTTYPES_PHONECALL_H