X-Git-Url: http://git.maemo.org/git/?p=speedfreak;a=blobdiff_plain;f=Client%2Fxmlwriter.cpp;h=027e0bad806fe102c802c386c2638c21d9745096;hp=3abe02ac1380e1b7314a4ce1e5d97f4a5f6df5e7;hb=2cff5ca17d324f817ff283782e5a4bd242a27cbc;hpb=ac84b058f9433e99aee2f560ef4f4e634d6900f7
diff --git a/Client/xmlwriter.cpp b/Client/xmlwriter.cpp
index 3abe02a..027e0ba 100644
--- a/Client/xmlwriter.cpp
+++ b/Client/xmlwriter.cpp
@@ -27,13 +27,20 @@ XmlWriter::~XmlWriter()
}
/**
- *@brief Writes registration items into tags.
- *@param netbuf a buffer where xmlstreamwriter writes to.
- *@param usr for user name.
- *@param psswd for password.
- *@param email.
+ * @brief Writes registration items into tags.
+ * @param netbuf a buffer where xmlstreamwriter writes to.
+ * @param usr for user name.
+ * @param psswd for password.
+ * @param email.
+ * @param .
+ * @param .
+ * @param .
+ * @param .
+ * @param .
*/
-void XmlWriter::writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QString email)
+//void XmlWriter::writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QString email)
+//void XmlWriter::writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QString email, QString manufacturer, QString type, QString model, QString description, QString picture)
+void XmlWriter::writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QString email, QString description)
{
qDebug() << "_writeRegistering";
@@ -42,18 +49,26 @@ void XmlWriter::writeRegistering(QBuffer *netbuf, QString usr, QString psswd, QS
xmlwriter.writeStartDocument();
xmlwriter.writeStartElement("user");
+ //test827
xmlwriter.writeStartElement("login");
xmlwriter.writeCharacters(usr);
xmlwriter.writeEndElement();
+ //thisisaveryinsecurepassword
xmlwriter.writeStartElement("password");
xmlwriter.writeCharacters(psswd);
xmlwriter.writeEndElement();
+ //test@example.com
xmlwriter.writeStartElement("email");
xmlwriter.writeCharacters(email);
xmlwriter.writeEndElement();
+ //manufacturer;type;model;description
+ xmlwriter.writeStartElement("description");
+ xmlwriter.writeCharacters(description);
+ xmlwriter.writeEndElement();
+
xmlwriter.writeEndElement();
xmlwriter.writeEndDocument();
}
@@ -86,14 +101,15 @@ void XmlWriter::writeGpsTrack(QBuffer *netbuf, int counter, int start, int stop,
{
qDebug() << "_writeGpsTrack";
- double *ptrValue;
+ // Unused variables
+ //double *ptrValue;
//ptrValue = ptrTable;
- double tmp = 0;
+ //double tmp = 0;
+ int sTart = start;
+ int sTop = stop;
xmlwriter.setDevice(netbuf);
-
xmlwriter.writeStartDocument();
-
xmlwriter.writeStartElement("Route");
xmlwriter.writeAttribute("starttime", QDateTime::currentDateTime().toString());
xmlwriter.writeAttribute("endtime", QDateTime::currentDateTime().toString());
@@ -167,3 +183,107 @@ void XmlWriter::writeItems()
xmlwriter.writeAttribute("date", QDateTime::currentDateTime().toString());
xmlwriter.writeEndElement();
}
+
+/**
+ * Write profile xml
+ * @param QIODevice device: target of writing, here filename.
+ * @param QString user name
+ * @param QString manufacturer
+ * @param QString type
+ * @param QString model
+ * @param QString description
+ * @param QString picture: filename.
+ */
+void XmlWriter::writeProfileXmlFile(QIODevice *device, QString userName, QString manufacturer,
+ QString type, QString model, QString description, QString picture)
+{
+ QString pictureStatus;
+ if(picture != "")
+ pictureStatus = "yes";
+ else
+ pictureStatus = "no";
+
+ /*example of XML:
+
+
+ toyota
+ corolla
+ 1983
+ Fuel efficient, GPS system, only one owner
+ */
+
+ xmlwriter.setDevice(device);
+ xmlwriter.writeStartDocument();
+ xmlwriter.writeStartElement("profile");
+ xmlwriter.writeAttribute("login", userName);
+ xmlwriter.writeAttribute("picture", pictureStatus);
+ xmlwriter.writeStartElement("manufacturer");
+ xmlwriter.writeCharacters(manufacturer);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("type");
+ xmlwriter.writeCharacters(type);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("model");
+ xmlwriter.writeCharacters(model);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("description");
+ xmlwriter.writeCharacters(description);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("picture");
+ xmlwriter.writeCharacters(picture);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeEndElement();
+ xmlwriter.writeEndDocument();
+}
+
+/**
+ * Write profile xml
+ * @param QIODevice device: target of writing, here netbuf.
+ * @param QString user name
+ * @param QString manufacturer
+ * @param QString type
+ * @param QString model
+ * @param QString description
+ * @param QString picture: filename.
+ */
+void XmlWriter::writeProfileXmlFile(QBuffer *netbuf, QString userName, QString manufacturer,
+ QString type, QString model, QString description, QString picture)
+{
+ QString pictureStatus;
+ if(picture != "")
+ pictureStatus = "yes";
+ else
+ pictureStatus = "no";
+
+ /*example of XML:
+
+
+ toyota
+ corolla
+ 1983
+ Fuel efficient, GPS system, only one owner
+ */
+
+ xmlwriter.setDevice(netbuf);
+ xmlwriter.writeStartDocument();
+ xmlwriter.writeStartElement("profile");
+ xmlwriter.writeAttribute("login", userName);
+ xmlwriter.writeAttribute("picture", pictureStatus);
+ xmlwriter.writeStartElement("manufacturer");
+ xmlwriter.writeCharacters(manufacturer);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("type");
+ xmlwriter.writeCharacters(type);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("model");
+ xmlwriter.writeCharacters(model);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("description");
+ xmlwriter.writeCharacters(description);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeStartElement("picture");
+ xmlwriter.writeCharacters(picture);
+ xmlwriter.writeEndElement();
+ xmlwriter.writeEndElement();
+ xmlwriter.writeEndDocument();
+}