Changeset View
Changeset View
Standalone View
Standalone View
kmymoney/tests/testutilities.cpp
Show All 30 Lines | |||||
31 | #include "mymoneysecurity.h" | 31 | #include "mymoneysecurity.h" | ||
32 | #include "mymoneyprice.h" | 32 | #include "mymoneyprice.h" | ||
33 | #include "mymoneysplit.h" | 33 | #include "mymoneysplit.h" | ||
34 | #include "mymoneystoragedump.h" | 34 | #include "mymoneystoragedump.h" | ||
35 | #include "mymoneyreport.h" | 35 | #include "mymoneyreport.h" | ||
36 | #include "mymoneypayee.h" | 36 | #include "mymoneypayee.h" | ||
37 | #include "mymoneystatement.h" | 37 | #include "mymoneystatement.h" | ||
38 | #include "../mymoneystoragexml.cpp" | 38 | #include "../mymoneystoragexml.cpp" | ||
39 | #include "plugins/xmlhelper/xmlstoragehelper.h" | ||||
39 | 40 | | |||
40 | namespace test | 41 | namespace test | ||
41 | { | 42 | { | ||
42 | 43 | | |||
43 | const MyMoneyMoney moCheckingOpen(0.0); | 44 | const MyMoneyMoney moCheckingOpen(0.0); | ||
44 | const MyMoneyMoney moCreditOpen(-0.0); | 45 | const MyMoneyMoney moCreditOpen(-0.0); | ||
45 | const MyMoneyMoney moConverterCheckingOpen(1418.0); | 46 | const MyMoneyMoney moConverterCheckingOpen(1418.0); | ||
46 | const MyMoneyMoney moConverterCreditOpen(-418.0); | 47 | const MyMoneyMoney moConverterCreditOpen(-418.0); | ||
▲ Show 20 Lines • Show All 269 Lines • ▼ Show 20 Line(s) | 315 | { | |||
316 | doc->appendChild(instruct); | 317 | doc->appendChild(instruct); | ||
317 | 318 | | |||
318 | QDomElement root = doc->createElement("KMYMONEY-FILE"); | 319 | QDomElement root = doc->createElement("KMYMONEY-FILE"); | ||
319 | doc->appendChild(root); | 320 | doc->appendChild(root); | ||
320 | 321 | | |||
321 | QDomElement reports = doc->createElement("REPORTS"); | 322 | QDomElement reports = doc->createElement("REPORTS"); | ||
322 | root.appendChild(reports); | 323 | root.appendChild(reports); | ||
323 | 324 | | |||
324 | QDomElement report = doc->createElement("REPORT"); | 325 | MyMoneyXmlContentHandler2::writeReport(filter, *doc, reports); | ||
325 | filter.write(report, doc); | | |||
326 | reports.appendChild(report); | | |||
327 | | ||||
328 | } | 326 | } | ||
329 | 327 | | |||
330 | void writeRCFtoXML(const MyMoneyReport& filter, const QString& _filename) | 328 | void writeRCFtoXML(const MyMoneyReport& filter, const QString& _filename) | ||
331 | { | 329 | { | ||
332 | static unsigned filenum = 1; | 330 | static unsigned filenum = 1; | ||
333 | QString filename = _filename; | 331 | QString filename = _filename; | ||
334 | if (filename.isEmpty()) { | 332 | if (filename.isEmpty()) { | ||
335 | filename = QString("report-%1%2.xml").arg(QString::number(filenum).rightJustified(2, '0')); | 333 | filename = QString("report-%1%2.xml").arg(QString::number(filenum).rightJustified(2, '0')); | ||
Show All 24 Lines | 354 | { | |||
360 | if (!rootElement.isNull()) { | 358 | if (!rootElement.isNull()) { | ||
361 | QDomNode child = rootElement.firstChild(); | 359 | QDomNode child = rootElement.firstChild(); | ||
362 | while (!child.isNull() && child.isElement()) { | 360 | while (!child.isNull() && child.isElement()) { | ||
363 | QDomElement childElement = child.toElement(); | 361 | QDomElement childElement = child.toElement(); | ||
364 | if ("REPORTS" == childElement.tagName()) { | 362 | if ("REPORTS" == childElement.tagName()) { | ||
365 | result = true; | 363 | result = true; | ||
366 | QDomNode subchild = child.firstChild(); | 364 | QDomNode subchild = child.firstChild(); | ||
367 | while (!subchild.isNull() && subchild.isElement()) { | 365 | while (!subchild.isNull() && subchild.isElement()) { | ||
368 | auto filter = MyMoneyXmlContentHandler::readReport(subchild.toElement()); | 366 | auto filter = MyMoneyXmlContentHandler2::readReport(subchild.toElement()); | ||
369 | list += filter; | 367 | list += filter; | ||
370 | subchild = subchild.nextSibling(); | 368 | subchild = subchild.nextSibling(); | ||
371 | } | 369 | } | ||
372 | } | 370 | } | ||
373 | child = child.nextSibling(); | 371 | child = child.nextSibling(); | ||
374 | } | 372 | } | ||
375 | } | 373 | } | ||
376 | return result; | 374 | return result; | ||
▲ Show 20 Lines • Show All 52 Lines • Show Last 20 Lines |