return event;
}
-void PhoneCall::Export(const QString &baseDirectory, const NumberToNameLookup &numberToNameLookup) const
+void PhoneCall::WriteCSVSymbian(QTextStream &stream, const ColumnIndicesByIndexHash &headerIndices, const QChar delimiter, const NumberToNameLookup &numberToNameLookup, SymbianEventLogStrings &strings) const
{
-// // Build the path and ensure it exists...
-// QString eventFilename(baseDirectory);
-// eventFilename += Destination() == EventTypes::PhoneCall::OUTGOING ? "/Sent/" : "/Inbox/";
-// eventFilename += QString::number(Timestamp().toUTC().date().year()) + "/";
-// QDir().mkpath(eventFilename);
-
-// // ...then build the filename and open it.
-// eventFilename += QString::number(Timestamp().toUTC().toTime_t()) + ".vmg";
-// QFile data(eventFilename);
-// if (data.open(QFile::WriteOnly | QFile::Truncate))
-// {
-// QTextStream stream(&data);
-
-// QTextCodec *oldCodec = stream.codec();
-// stream.setAutoDetectUnicode(false);
-// stream.setCodec("UTF-16LE");
-
-// EventParsers::VMGEntities::VMessage writer(NULL, 1.1);
-// writer.Write(stream, *this);
-////stream << "Test";
-// //stream.setCodec(oldCodec);
-// stream.flush();
-// data.close();
-
-// utimbuf fileTimes;
-// fileTimes.modtime = Timestamp().toUTC().toTime_t();
-// utime(eventFilename.toAscii(), &fileTimes);
-// }
+ // 0|05/09/2007 11:25:12 am|1||||||<name>|3|8|0|0|<number>|||Unrecognized||
+ for(uint columnIndex(0); columnIndex < (uint)headerIndices.count(); ++columnIndex)
+ {
+ const QString &heading(headerIndices.value(columnIndex));
+ if("etype" == heading.toLower())
+ {
+ stream << "0"; // Phone calls are type '0'
+ }
+ else if("etime" == heading.toLower())
+ {
+ stream << Timestamp().toUTC().toString("dd/MM/yyyy h:mm:ss ap");
+ }
+ else if("remote" == heading.toLower())
+ {
+ stream << numberToNameLookup.ContactDetails().value(Tel()).second;
+ }
+ else if("direction" == heading.toLower())
+ {
+ if(IsMissedCall())
+ {
+ if(!strings.contains("Missed Call"))
+ strings.insert("Missed Call", strings.count());
+ stream << strings.value("Missed Call");
+ }
+ else if(Settings::OUTGOING == Destination())
+ {
+ if(!strings.contains("Outgoing"))
+ strings.insert("Outgoing", strings.count());
+ stream << strings.value("Outgoing");
+ }
+ else if (Settings::INCOMING == Destination())
+ {
+ if(!strings.contains("Incoming"))
+ strings.insert("Incoming", strings.count());
+ stream << strings.value("Incoming");
+ }
+ }
+ else if("duration" == heading.toLower())
+ {
+ stream << DurationInSeconds();
+ }
+ else if("dtype" == heading.toLower())
+ {
+ stream << "1"; // 1 seems to be KLogDurationValid
+ }
+ else if("status" == heading.toLower())
+ {
+ stream << "0"; // Always '0' for phone calls.
+ }
+ else if("subject" == heading.toLower())
+ {
+ // Subject seems to be ignored - this makes sense, but I
+ // suspect that non-zero values are a bug that I can't duplicate...
+ stream << "0";
+ }
+ else if("number" == heading.toLower())
+ {
+ stream << Tel();
+ }
+ else if("data" == heading.toLower())
+ {
+ // Event-specfic data - but not supported by DBU-SCV tool
+ // Hex editing the DBU suggests there is SIP account info in here...
+ // ...along the lines of:
+ // "VOIP.URL=sip:<remote#>@<remote domain>.MA=sip:<my#>@<my domain>"
+ stream << "Unrecognised";
+ }
+ else
+ {
+ // Don't print anything. Makes it obvious which fields we've
+ // generated.
+ }
+
+ if(columnIndex < (uint)headerIndices.count() - 1)
+ stream << delimiter;
+ }
+
+ stream << endl;
}
QDebug operator<<(QDebug dbg, PhoneCall& event)