aboutsummaryrefslogtreecommitdiff
path: root/smartpen.cc
diff options
context:
space:
mode:
Diffstat (limited to 'smartpen.cc')
-rw-r--r--smartpen.cc33
1 files changed, 26 insertions, 7 deletions
diff --git a/smartpen.cc b/smartpen.cc
index c89cf2d..79e9a01 100644
--- a/smartpen.cc
+++ b/smartpen.cc
@@ -157,12 +157,14 @@ QVariantMap Smartpen::getPenInfo()
return result;
}
-QList<Smartpen::ChangeReport> Smartpen::getChangeList(const QDateTime &from)
+QList<Smartpen::ChangeReport> Smartpen::getChangeList(PenTime from)
{
QList<ChangeReport> result;
- QByteArray data = getObject(QString("changelist?start_time=%1").arg(toPenTime(from)));
+ QByteArray data = getObject(QString("changelist?start_time=%1").arg(from));
QXmlStreamReader r(data);
+ qDebug() << QString::fromAscii(data);
+
advanceToFirstChildElement(r, "xml");
advanceToFirstChildElement(r, "changelist");
@@ -176,13 +178,30 @@ QList<Smartpen::ChangeReport> Smartpen::getChangeList(const QDateTime &from)
if (attrs.hasAttribute("guid")) {
report.guid = attrs.value("guid").toString();
report.title = attrs.value("title").toString();
+
+ // Figure out the change record endtime to enumerating the
+ // endtime of all the record's changed pages
+ report.endTime = 0;
+ while (r.readNextStartElement()) {
+ if (r.name() == "page") {
+ QXmlStreamAttributes attrs = r.attributes();
+ PenTime endTime = attrs.value("end_time").toString().toLongLong();
+ if (endTime > report.endTime) report.endTime = endTime;
+ }
+ r.skipCurrentElement();
+ }
+
result.append(report);
} else if (attrs.hasAttribute("classname")) {
report.className = attrs.value("classname").toString();
report.title = attrs.value("title").toString();
+ report.endTime = attrs.value("end_time").toString().toLongLong();
result.append(report);
+ r.skipCurrentElement();
+ } else {
+ qWarning() << "Unknown change report format";
+ r.skipCurrentElement();
}
- r.skipCurrentElement();
} else {
r.skipCurrentElement();
}
@@ -195,14 +214,14 @@ QList<Smartpen::ChangeReport> Smartpen::getChangeList(const QDateTime &from)
return result;
}
-QByteArray Smartpen::getLspData(const QString &name, const QDateTime &from)
+QByteArray Smartpen::getLspData(const QString &name, PenTime from)
{
- return getObject(QString("lspdata?name=%1&start_time=%2").arg(name).arg(toPenTime(from)));
+ return getObject(QString("lspdata?name=%1&start_time=%2").arg(name).arg(from));
}
-QByteArray Smartpen::getPaperReplay(const QDateTime &from)
+QByteArray Smartpen::getPaperReplay(PenTime from)
{
- return getObject(QString("lspdata?name=com.livescribe.paperreplay.PaperReplay&start_time=%1&returnVersion=0.3&remoteCaller=WIN_LD_200").arg(toPenTime(from)));
+ return getObject(QString("lspdata?name=com.livescribe.paperreplay.PaperReplay&start_time=%1&returnVersion=0.3&remoteCaller=WIN_LD_200").arg(from));
}
qint64 Smartpen::toPenTime(const QDateTime &dt)