{
RTComEl *el_nonconst(const_cast<RTComEl *>(&el));
- bool incoming = CurrentSettings().ShouldProcess( Settings::TYPE_RECIEVED, service);
- bool outgoing = CurrentSettings().ShouldProcess( Settings::TYPE_SENT, service);
+ bool incoming = CurrentSettings().ShouldProcess( Settings::INCOMING, service);
+ bool outgoing = CurrentSettings().ShouldProcess( Settings::OUTGOING, service);
if(incoming || outgoing)
{
qDebug() << "Parsing event from line #" << lineNumber << ". Values: " << lineValues;
QDateTime eTime(QDateTime::fromString(lineValues.at(m_HeadingIndices.value("etime")), "dd/MM/yyyy hh:mm:ss"));
- EventTypes::PhoneCall::eDestination direction(lineValues.at(m_HeadingIndices.value("direction")) == "0"
- ? EventTypes::PhoneCall::INCOMING
- : EventTypes::PhoneCall::OUTGOING);
int duration(lineValues.at(m_HeadingIndices.value("duration")).toInt(&bOK));
if(!bOK)
+ Settings::eDirection direction(lineValues.at(m_HeadingIndices.value("direction")) == "0"
+ ? Settings::INCOMING
+ : Settings::OUTGOING);
{
qDebug() << QString("Unable to parse '%1' as a duration. Skipping record.")
.arg(lineValues.at(m_HeadingIndices.value("duration")));
PhoneCall::PhoneCall(const Settings &settings, const RTComElEvent &event, const QList<RTComElAttachment*> attachments) :
m_Settings(settings)
{
- setDestination(event.fld_outgoing ? OUTGOING : INCOMING);
+ 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);
qDebug() << "Created new Phone Call from RtCom:\n" << *this;
}
-PhoneCall::PhoneCall(const Settings &settings, const eDestination destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments) :
+PhoneCall::PhoneCall(const Settings &settings, const Settings::eDirection destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments) :
m_Settings(settings), m_Destination(destination), m_Timestamp(timestamp), m_Tel(tel),
m_DurationInSeconds(durationInSeconds), m_Attachments(attachments)
{
RTCOM_EL_EVENT_SET_FIELD (event, end_time, Timestamp().addSecs(DurationInSeconds()).toUTC().toTime_t());
RTCOM_EL_EVENT_SET_FIELD (event, storage_time, Timestamp().addSecs(DurationInSeconds()).toUTC().toTime_t());
//RTCOM_EL_EVENT_SET_FIELD (event, is_read, 0);
- RTCOM_EL_EVENT_SET_FIELD (event, outgoing, Destination() == PhoneCall::OUTGOING ? 1 : 0);
+ RTCOM_EL_EVENT_SET_FIELD (event, outgoing, Destination() == Settings::OUTGOING ? 1 : 0);
//if(local_uid) // Voicemail local_uid transform needed here
RTCOM_EL_EVENT_SET_FIELD (event, local_uid, g_strdup("ring/tel/ring"));
//RTCOM_EL_EVENT_SET_FIELD (&event, local_name, g_strdup("<SelfHandle>"));
QDebug operator<<(QDebug dbg, PhoneCall& event)
{
- dbg.nospace() << "\tDirection:\t\t" << (event.Destination() == PhoneCall::OUTGOING ? "Made" : "Recieved") << "\n";
+ dbg.nospace() << "\tHash:\t\t" << event.HashCode() << "\n";
+ dbg.nospace() << "\tDirection:\t\t" << (event.Destination() == Settings::OUTGOING ? "Made" : "Recieved") << "\n";
dbg.nospace() << "\tTimestamp:\t" << event.Timestamp().toUTC() << "\n";
dbg.nospace() << "\tDuration:\t\t" << event.DurationInSeconds() << " seconds\n";
dbg.nospace() << "\tRemote-Tel:\t" << event.Tel() << "\n";
class PhoneCall : public RtcomEvent
{
public:
- enum eDestination
- {
- INCOMING,
- OUTGOING
- };
-
- public:
virtual const DBBackends::iDBBackend &DB() const;
PhoneCall(const Settings &settings);
- PhoneCall(const Settings &settings, const eDestination destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments = AttachmentCollection());
+ PhoneCall(const Settings &settings, const Settings::eDirection destination, const QDateTime ×tamp, const QString &tel, int durationInSeconds, const AttachmentCollection &attachments = AttachmentCollection());
~PhoneCall();
virtual const uint HashCode() const;
- const eDestination Destination() const { return m_Destination; }
- void setDestination(const eDestination destination) { m_Destination = destination; }
+ const Settings::eDirection Destination() const { return m_Destination; }
+ void setDestination(const Settings::eDirection destination) { m_Destination = destination; }
virtual const QDateTime Timestamp() const { return m_Timestamp; }
void setTimestamp(const QDateTime timestamp) { m_Timestamp = timestamp; }
private:
const Settings &m_Settings;
- eDestination m_Destination;
+ Settings::eDirection m_Destination;
QDateTime m_Timestamp;
QString m_Tel;
int m_DurationInSeconds;
setMode(MODE_EXPORT);
// We don't process anything by default
- setShouldProcess(TYPE_SENT, EventTypes::EVENT_TYPE_SMS, false);
- setShouldProcess(TYPE_SENT, EventTypes::EVENT_TYPE_MMS, false);
- setShouldProcess(TYPE_SENT, EventTypes::EVENT_TYPE_CHAT, false);
+ setShouldProcess(OUTGOING, EventTypes::EVENT_TYPE_SMS, false);
+ setShouldProcess(OUTGOING, EventTypes::EVENT_TYPE_MMS, false);
+ setShouldProcess(OUTGOING, EventTypes::EVENT_TYPE_CHAT, false);
// We still don't process anything by default
- setShouldProcess(TYPE_RECIEVED, EventTypes::EVENT_TYPE_SMS, false);
- setShouldProcess(TYPE_RECIEVED, EventTypes::EVENT_TYPE_MMS, false);
- setShouldProcess(TYPE_RECIEVED, EventTypes::EVENT_TYPE_CHAT, false);
+ setShouldProcess(INCOMING, EventTypes::EVENT_TYPE_SMS, false);
+ setShouldProcess(INCOMING, EventTypes::EVENT_TYPE_MMS, false);
+ setShouldProcess(INCOMING, EventTypes::EVENT_TYPE_CHAT, false);
// Default to the UK :)
setCountryCode(44);
static const int kNumModes = MODE_EXPORT + 1;
// Options for targets - sent or recieved
- enum eTargets
+ enum eDirection
{
- TYPE_SENT,
- TYPE_RECIEVED,
+ OUTGOING,
+ INCOMING,
};
- static const int kNumTargets = TYPE_RECIEVED + 1;
+ static const int kNumTargets = INCOMING + 1;
private:
// The current UI mode of the application (Console/GUI)
eMode const Mode() const { return m_Mode; }
eMode const setMode(const eMode mode) { return m_Mode = mode; }
- bool const ShouldProcess(const eTargets target, const EventTypes::eEventTypes eventType) const { return m_ShouldProcess[target][eventType]; }
- bool const setShouldProcess(const eTargets target, const EventTypes::eEventTypes eventType, const bool shouldProcess = true){ return m_ShouldProcess[target][eventType] = shouldProcess; }
+ bool const ShouldProcess(const eDirection target, const EventTypes::eEventTypes eventType) const { return m_ShouldProcess[target][eventType]; }
+ bool const setShouldProcess(const eDirection target, const EventTypes::eEventTypes eventType, const bool shouldProcess = true){ return m_ShouldProcess[target][eventType] = shouldProcess; }
bool const anyToProcess()
{
for(int targetIndex = 0; targetIndex < kNumTargets; ++targetIndex)
void TypesWindow::Continue()
{
- CurrentSettings().setShouldProcess(Settings::TYPE_SENT, EventTypes::EVENT_TYPE_CALL, cbMadeCalls->checkState() == Qt::Checked);
- CurrentSettings().setShouldProcess(Settings::TYPE_SENT, EventTypes::EVENT_TYPE_SMS, cbSentSMS->checkState() == Qt::Checked);
- CurrentSettings().setShouldProcess(Settings::TYPE_SENT, EventTypes::EVENT_TYPE_MMS, cbSentMMS->checkState() == Qt::Checked);
- CurrentSettings().setShouldProcess(Settings::TYPE_SENT, EventTypes::EVENT_TYPE_CHAT, cbSentChat->checkState() == Qt::Checked);
- CurrentSettings().setShouldProcess(Settings::TYPE_RECIEVED, EventTypes::EVENT_TYPE_CALL, cbRecvCalls->checkState() == Qt::Checked);
- CurrentSettings().setShouldProcess(Settings::TYPE_RECIEVED, EventTypes::EVENT_TYPE_SMS, cbRecvSMS->checkState() == Qt::Checked);
- CurrentSettings().setShouldProcess(Settings::TYPE_RECIEVED, EventTypes::EVENT_TYPE_MMS, cbRecvMMS->checkState() == Qt::Checked);
- CurrentSettings().setShouldProcess(Settings::TYPE_RECIEVED, EventTypes::EVENT_TYPE_CHAT, cbRecvChat->checkState() == Qt::Checked);
+ CurrentSettings().setShouldProcess(Settings::OUTGOING, EventTypes::EVENT_TYPE_CALL, cbMadeCalls->checkState() == Qt::Checked);
+ CurrentSettings().setShouldProcess(Settings::OUTGOING, EventTypes::EVENT_TYPE_SMS, cbSentSMS->checkState() == Qt::Checked);
+ CurrentSettings().setShouldProcess(Settings::OUTGOING, EventTypes::EVENT_TYPE_MMS, cbSentMMS->checkState() == Qt::Checked);
+ CurrentSettings().setShouldProcess(Settings::OUTGOING, EventTypes::EVENT_TYPE_CHAT, cbSentChat->checkState() == Qt::Checked);
+ CurrentSettings().setShouldProcess(Settings::INCOMING, EventTypes::EVENT_TYPE_CALL, cbRecvCalls->checkState() == Qt::Checked);
+ CurrentSettings().setShouldProcess(Settings::INCOMING, EventTypes::EVENT_TYPE_SMS, cbRecvSMS->checkState() == Qt::Checked);
+ CurrentSettings().setShouldProcess(Settings::INCOMING, EventTypes::EVENT_TYPE_MMS, cbRecvMMS->checkState() == Qt::Checked);
+ CurrentSettings().setShouldProcess(Settings::INCOMING, EventTypes::EVENT_TYPE_CHAT, cbRecvChat->checkState() == Qt::Checked);
if(CurrentSettings().anyToProcess())
Advance();