+
+/**
+ * This function is used to read profile xml.
+ * @param QIODevice device: target of reading, here filename.
+ * @param ProfileDialog *profileDialog
+ */
+void XmlReader::xmlReadProfile(QIODevice *device, ProfileDialog *profileDialog)
+{
+ qDebug() << "_xmlReadProfile";
+
+ profile = profileDialog;
+
+ xmlreader.clear();
+ QByteArray array = device->readAll();
+
+ xmlreader.addData(array);
+
+ QString login;
+ QString picture;
+
+ // Go trough the xml document
+ while(!xmlreader.atEnd())
+ {
+ // Read next node
+ xmlreader.readNext();
+
+ // Check if this element is starting element
+ if(xmlreader.isStartElement())
+ {
+ if(xmlreader.name() == "profile")
+ {
+ qDebug() << xmlreader.name();
+ attr = xmlreader.attributes();
+ login = attr.value("login").toString();
+ picture = attr.value("picture").toString();
+ }
+ if(xmlreader.name() == "manufacturer")
+ {
+ qDebug() << xmlreader.name();
+ profile->setManufacturer(xmlreader.readElementText());
+ }
+ if(xmlreader.name() == "type")
+ {
+ qDebug() << xmlreader.name();
+ profile->setType(xmlreader.readElementText());
+
+ }
+ if(xmlreader.name() == "model")
+ {
+ qDebug() << xmlreader.name();
+ profile->setModel(xmlreader.readElementText());
+
+ }
+ if(xmlreader.name() == "description")
+ {
+ qDebug() << xmlreader.name();
+ profile->setDescription(xmlreader.readElementText());
+ }
+ if(xmlreader.name() == "picture" && picture == "yes")
+ {
+ qDebug() << xmlreader.name();
+ profile->setPicture(xmlreader.readElementText());
+ }
+ }
+ }
+ profile = NULL;
+}