From b320c919e28ce961edcdc6672f418861bccc4eff Mon Sep 17 00:00:00 2001 From: Jamie Thompson Date: Sat, 1 Oct 2011 18:38:45 +0100 Subject: [PATCH] Renamed some setters for consistency. --- EventParsers/VMGEntities/VBody.cpp | 2 +- EventParsers/VMGEntities/VCard.cpp | 2 +- EventParsers/VMGEntities/VMessage.cpp | 6 +++--- EventTypes/PhoneCall.cpp | 12 ++++++------ EventTypes/PhoneCall.h | 8 ++++---- EventTypes/SMS.cpp | 21 +++++++++++++-------- EventTypes/SMS.h | 15 +++++++++------ 7 files changed, 37 insertions(+), 29 deletions(-) diff --git a/EventParsers/VMGEntities/VBody.cpp b/EventParsers/VMGEntities/VBody.cpp index 346d97b..667b5ef 100644 --- a/EventParsers/VMGEntities/VBody.cpp +++ b/EventParsers/VMGEntities/VBody.cpp @@ -217,7 +217,7 @@ bool VBody::Read(const QString &initialLine, QTextStream &stream, EventTypes::SM if(hasEnded) { - event.setContents(text); + event.Contents(text); //event.fld_storage_time } diff --git a/EventParsers/VMGEntities/VCard.cpp b/EventParsers/VMGEntities/VCard.cpp index e5e0a7d..c043eb9 100644 --- a/EventParsers/VMGEntities/VCard.cpp +++ b/EventParsers/VMGEntities/VCard.cpp @@ -150,7 +150,7 @@ bool VCard::Read(const QString &initialLine, QTextStream &stream, EventTypes::SM tel = tel.replace(QRegExp("^0"), "+44"); gchar* g_tel = g_strdup(tel.toUtf8()); - event.setTel(g_tel); + event.Tel(g_tel); // if(tel.length() < 7 || tel.indexOf(QRegExp("[:alpha:]+")) > -1) // event.fld_group_uid = g_tel; diff --git a/EventParsers/VMGEntities/VMessage.cpp b/EventParsers/VMGEntities/VMessage.cpp index 443070e..9e80739 100644 --- a/EventParsers/VMGEntities/VMessage.cpp +++ b/EventParsers/VMGEntities/VMessage.cpp @@ -83,7 +83,7 @@ bool VMessage::Read(const QString &initialLine, QTextStream &stream, EventTypes: else if(lineData.startsWith("X-IRMC-STATUS:")) { bool isRead(lineData.mid(lineData.indexOf(":") + 1) == "READ"); - event.setIsRead(isRead); + event.IsRead(isRead); } else if(lineData.startsWith("X-IRMC-BOX:")) { @@ -102,7 +102,7 @@ bool VMessage::Read(const QString &initialLine, QTextStream &stream, EventTypes: qDebug() << "Unexpected box: " << box; return false; } - event.setDestination(isOutgoing ? EventTypes::SMS::SENT : EventTypes::SMS::INBOX); + event.Destination(isOutgoing ? EventTypes::SMS::SENT : EventTypes::SMS::INBOX); } else if(lineData.startsWith("X-NOK-DT:")) { @@ -110,7 +110,7 @@ bool VMessage::Read(const QString &initialLine, QTextStream &stream, EventTypes: lineData.mid(lineData.indexOf(":") + 1), "yyyyMMddThhmmssZ")); timestamp.setTimeSpec(Qt::UTC); - event.setTimestamp(timestamp); + event.Timestamp(timestamp); } else if(lineData.startsWith("BEGIN:")) { diff --git a/EventTypes/PhoneCall.cpp b/EventTypes/PhoneCall.cpp index 7997fc2..2575247 100644 --- a/EventTypes/PhoneCall.cpp +++ b/EventTypes/PhoneCall.cpp @@ -61,12 +61,12 @@ PhoneCall::~PhoneCall() PhoneCall::PhoneCall(const Settings &settings, const RTComElEvent &event, const QList attachments) : m_Settings(settings) { - setDestination(event.fld_outgoing ? Settings::OUTGOING : Settings::INCOMING); - setTimestamp(QDateTime::fromTime_t(event.fld_start_time).toUTC()); - setDurationInSeconds(QDateTime::fromTime_t(event.fld_start_time).toUTC().secsTo(QDateTime::fromTime_t(event.fld_end_time).toUTC())); - setTel(event.fld_remote_uid); + Destination(event.fld_outgoing ? Settings::OUTGOING : Settings::INCOMING); + Timestamp(QDateTime::fromTime_t(event.fld_start_time).toUTC()); + DurationInSeconds(QDateTime::fromTime_t(event.fld_start_time).toUTC().secsTo(QDateTime::fromTime_t(event.fld_end_time).toUTC())); + Tel(event.fld_remote_uid); if(Tel().indexOf("0") == 0) - setTel(QString(Tel()).replace(QRegExp("^0"), "+44")); + Tel(QString(Tel()).replace(QRegExp("^0"), "+44")); if(attachments.count() > 0) foreach(RTComElAttachment *attachment, attachments) @@ -80,7 +80,7 @@ PhoneCall::PhoneCall(const Settings &settings, const Settings::eDirection destin m_DurationInSeconds(durationInSeconds), m_Attachments(attachments) { if(Tel().indexOf("0") == 0) - setTel(QString(Tel()).replace(QRegExp("^0"), "+44")); + Tel(QString(Tel()).replace(QRegExp("^0"), "+44")); // TODO: Copy attachments. // if(attachments.count() > 0) diff --git a/EventTypes/PhoneCall.h b/EventTypes/PhoneCall.h index c246258..223f30d 100644 --- a/EventTypes/PhoneCall.h +++ b/EventTypes/PhoneCall.h @@ -46,16 +46,16 @@ namespace EventTypes virtual const uint HashCode() const; const Settings::eDirection Destination() const { return m_Destination; } - void setDestination(const Settings::eDirection destination) { m_Destination = destination; } + void Destination(const Settings::eDirection destination) { m_Destination = destination; } virtual const QDateTime Timestamp() const { return m_Timestamp; } - void setTimestamp(const QDateTime timestamp) { m_Timestamp = timestamp; } + void Timestamp(const QDateTime timestamp) { m_Timestamp = timestamp; } const QString Tel() const { return m_Tel; } - void setTel(const QString tel) { m_Tel = tel; } + void Tel(const QString tel) { m_Tel = tel; } virtual const int DurationInSeconds() const { return m_DurationInSeconds; } - void setDurationInSeconds(const int durationInSeconds) { m_DurationInSeconds = durationInSeconds; } + void DurationInSeconds(const int durationInSeconds) { m_DurationInSeconds = durationInSeconds; } virtual const AttachmentCollection & Attachments() const { return m_Attachments; } virtual AttachmentCollection & Attachments() { return m_Attachments; } diff --git a/EventTypes/SMS.cpp b/EventTypes/SMS.cpp index 97ee9c5..d325a56 100644 --- a/EventTypes/SMS.cpp +++ b/EventTypes/SMS.cpp @@ -60,15 +60,20 @@ SMS::~SMS() SMS::SMS(const Settings &settings, const RTComElEvent &event, const QList attachments) : m_Settings(settings) { - setVersion(2.1); - setIsRead(event.fld_is_read); - setDestination(event.fld_outgoing ? SENT : INBOX); - setTimestamp(QDateTime::fromTime_t(event.fld_start_time).toUTC()); - setTel(QString::fromUtf8(event.fld_remote_uid)); + Version(2.1); + IsRead(event.fld_is_read); + Destination(event.fld_outgoing ? SENT : INBOX); + Timestamp(QDateTime::fromTime_t(event.fld_start_time).toUTC()); + Tel(QString::fromUtf8(event.fld_remote_uid)); if(Tel().indexOf("0") == 0) - setTel(QString(Tel()).replace(QRegExp("^0"), "+44")); - //setContents(QString(event.fld_free_text).replace("\n", QChar(0x2029))); - setContents(QString::fromUtf8(event.fld_free_text)); + Tel(QString(Tel()).replace(QRegExp("^0"), "+44")); + //Contents(QString(event.fld_free_text).replace("\n", QChar(0x2029))); + Contents(QString::fromUtf8(event.fld_free_text)); + if(event.fld_flags != 0) + { + qDebug() << "fld_flags: = " << event.fld_flags; + } + Pending(event.fld_flags & GetFlagValue("RTCOM_EL_FLAG_SMS_PENDING")); // We directly access the m_Attachments member variable here rather than the // accessor as the accessor is const diff --git a/EventTypes/SMS.h b/EventTypes/SMS.h index 696003a..ce79556 100644 --- a/EventTypes/SMS.h +++ b/EventTypes/SMS.h @@ -50,23 +50,25 @@ namespace EventTypes virtual const uint HashCode() const; const float Version() const { return m_Version; } - void setVersion(const float version) { m_Version = version; } + void Version(const float version) { m_Version = version; } const bool IsRead() const { return m_Read; } - void setIsRead(const bool isRead) { m_Read = isRead; } + void IsRead(const bool isRead) { m_Read = isRead; } const eDestination Destination() const { return m_Destination; } - void setDestination(const eDestination destination) { m_Destination = destination; } + void Destination(const eDestination destination) { m_Destination = destination; } virtual const QDateTime Timestamp() const { return m_Timestamp; } - void setTimestamp(const QDateTime timestamp) { m_Timestamp = timestamp; } + void Timestamp(const QDateTime timestamp) { m_Timestamp = timestamp; } const QString Tel() const { return m_Tel; } - void setTel(const QString tel) { m_Tel = tel; } + void Tel(const QString tel) { m_Tel = tel; } QString Contents() const { return m_Contents; } - void setContents(const QString contents) { m_Contents = contents; } + void Contents(const QString contents) { m_Contents = contents; } + bool Pending() const { return m_Pending; } + void Pending(const bool pending) { m_Pending = pending; } virtual const AttachmentCollection & Attachments() const { return m_Attachments; } virtual AttachmentCollection & Attachments() { return m_Attachments; } @@ -87,6 +89,7 @@ namespace EventTypes QString m_Tel; QString m_Contents; AttachmentCollection m_Attachments; + bool m_Pending; }; } -- 1.7.9.5