Example #1
0
bool MyMoneyStorageXML::readFileInformation(const QDomElement& fileInfo)
{
  signalProgress(0, 3, i18n("Loading file information..."));
  bool rc = true;
  QDomElement temp = findChildElement("CREATION_DATE", fileInfo);
  if (temp == QDomElement()) {
    rc = false;
  }
  QString strDate = QStringEmpty(temp.attribute("date"));
  m_storage->setCreationDate(stringToDate(strDate));
  signalProgress(1, 0);

  temp = findChildElement("LAST_MODIFIED_DATE", fileInfo);
  if (temp == QDomElement()) {
    rc = false;
  }
  strDate = QStringEmpty(temp.attribute("date"));
  m_storage->setLastModificationDate(stringToDate(strDate));
  signalProgress(2, 0);

  temp = findChildElement("VERSION", fileInfo);
  if (temp == QDomElement()) {
    rc = false;
  }
  QString strVersion = QStringEmpty(temp.attribute("id"));
  fileVersionRead = strVersion.toUInt(0, 16);

  temp = findChildElement("FIXVERSION", fileInfo);
  if (temp != QDomElement()) {
    QString strFixVersion = QStringEmpty(temp.attribute("id"));
    m_storage->setFileFixVersion(strFixVersion.toUInt());
    // skip KMyMoneyView::fixFile_2()
    if (m_storage->fileFixVersion() == 2) {
      m_storage->setFileFixVersion(3);
    }
  }
  // FIXME The old version stuff used this rather odd number
  //       We now use increments
  if (fileVersionRead == VERSION_0_60_XML)
    fileVersionRead = 1;
  signalProgress(3, 0);

  return rc;
}
Example #2
0
void NodeEnum::fromXML(QDomElement & parent)
{
	//check if element already exists
	QDomElement child = findChildElement(parent);
	//if child is not found, throw an error
	if (child.isNull())
	{
		throw std::runtime_error("Child not found in parent element!");
	}
	//child is there, read content
	setValue(child.attribute("value", "").toInt());
}
Example #3
0
void NodeEnum::toXML(QDomElement & parent) const
{
	//check if element already exists
	QDomElement child = findChildElement(parent);
	//if child does not exist, create it
	if (child.isNull())
	{
		child = parent.ownerDocument().createElement(typeName());
		child.setAttribute("name", m_name);
		parent.appendChild(child);
	}
	child.setAttribute("value", (qlonglong)m_value);
}
Example #4
0
bool MyMoneyStorageXML::readUserInformation(const QDomElement& userElement)
{
  bool rc = true;
  signalProgress(0, 1, i18n("Loading user information..."));

  MyMoneyPayee user;
  user.setName(QStringEmpty(userElement.attribute("name")));
  user.setEmail(QStringEmpty(userElement.attribute("email")));

  QDomElement addressNode = findChildElement("ADDRESS", userElement);
  if (!addressNode.isNull()) {
    user.setAddress(QStringEmpty(addressNode.attribute("street")));
    user.setCity(QStringEmpty(addressNode.attribute("city")));
    user.setState(QStringEmpty(addressNode.attribute("county")));
    user.setPostcode(QStringEmpty(addressNode.attribute("zipcode")));
    user.setTelephone(QStringEmpty(addressNode.attribute("telephone")));
  }

  m_storage->setUser(user);
  signalProgress(1, 0);

  return rc;
}