Changeset View
Changeset View
Standalone View
Standalone View
src/common/KReportDetailSectionData.cpp
Show All 13 Lines | |||||
14 | * | 14 | * | ||
15 | * You should have received a copy of the GNU Lesser General Public | 15 | * You should have received a copy of the GNU Lesser General Public | ||
16 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | 16 | * License along with this library. If not, see <http://www.gnu.org/licenses/>. | ||
17 | */ | 17 | */ | ||
18 | 18 | | |||
19 | #include "KReportDetailSectionData.h" | 19 | #include "KReportDetailSectionData.h" | ||
20 | #include "KReportSectionData.h" | 20 | #include "KReportSectionData.h" | ||
21 | #include "KReportDocument.h" | 21 | #include "KReportDocument.h" | ||
22 | #include "KReportUtils.h" | ||||
22 | 23 | | |||
23 | #include "kreport_debug.h" | 24 | #include "kreport_debug.h" | ||
24 | #include <QDomElement> | 25 | #include <QDomElement> | ||
25 | 26 | | |||
26 | KReportDetailSectionData::KReportDetailSectionData(QObject *parent) | 27 | KReportDetailSectionData::KReportDetailSectionData(QObject *parent) | ||
27 | : QObject(parent) | 28 | : QObject(parent) | ||
28 | { | 29 | { | ||
29 | pageBreak = PageBreak::None; | 30 | pageBreak = PageBreak::None; | ||
Show All 37 Lines | 51 | if (elemThis.tagName() == QLatin1String("report:group")) { | |||
67 | 68 | | |||
68 | if (elemThis.attribute(QLatin1String("report:group-sort"), QLatin1String("ascending")) == QLatin1String("ascending")) { | 69 | if (elemThis.attribute(QLatin1String("report:group-sort"), QLatin1String("ascending")) == QLatin1String("ascending")) { | ||
69 | dgsd->m_sort = Qt::AscendingOrder; | 70 | dgsd->m_sort = Qt::AscendingOrder; | ||
70 | } else { | 71 | } else { | ||
71 | dgsd->m_sort = Qt::DescendingOrder; | 72 | dgsd->m_sort = Qt::DescendingOrder; | ||
72 | } | 73 | } | ||
73 | 74 | | |||
74 | for ( QDomElement e = elemThis.firstChildElement( QLatin1String("report:section") ); ! e.isNull(); e = e.nextSiblingElement( QLatin1String("report:section") ) ) { | 75 | for ( QDomElement e = elemThis.firstChildElement( QLatin1String("report:section") ); ! e.isNull(); e = e.nextSiblingElement( QLatin1String("report:section") ) ) { | ||
75 | QString s = e.attribute( QLatin1String("report:section-type") ); | 76 | const QString s = KReportUtils::readSectionTypeNameAttribute(e); | ||
76 | if ( s == QLatin1String("group-header") ) { | 77 | if ( s == QLatin1String("group-header") ) { | ||
77 | KReportSectionData * sd = new KReportSectionData(e, report); | 78 | KReportSectionData * sd = new KReportSectionData(e, report); | ||
78 | if (sd->isValid()) { | 79 | if (sd->isValid()) { | ||
79 | dgsd->groupHeader = sd; | 80 | dgsd->groupHeader = sd; | ||
80 | } else { | 81 | } else { | ||
81 | delete sd; | 82 | delete sd; | ||
82 | } | 83 | } | ||
83 | } else if ( s == QLatin1String("group-footer") ) { | 84 | } else if ( s == QLatin1String("group-footer") ) { | ||
84 | KReportSectionData * sd = new KReportSectionData(e, report); | 85 | KReportSectionData * sd = new KReportSectionData(e, report); | ||
85 | if (sd->isValid()) { | 86 | if (sd->isValid()) { | ||
86 | dgsd->groupFooter = sd; | 87 | dgsd->groupFooter = sd; | ||
87 | } else { | 88 | } else { | ||
88 | delete sd; | 89 | delete sd; | ||
89 | } | 90 | } | ||
90 | } | 91 | } | ||
91 | } | 92 | } | ||
92 | groupList.append(dgsd); | 93 | groupList.append(dgsd); | ||
93 | KReportDataSource::SortedField s; | 94 | KReportDataSource::SortedField s; | ||
94 | s.setField(dgsd->column); | 95 | s.setField(dgsd->column); | ||
95 | s.setOrder(dgsd->m_sort); | 96 | s.setOrder(dgsd->m_sort); | ||
96 | sortedFields.append(s); | | |||
97 | 97 | | |||
98 | } else if (elemThis.tagName() == QLatin1String("report:section") && elemThis.attribute(QLatin1String("report:section-type")) == QLatin1String("detail")) { | 98 | sortedFields.append(s); | ||
99 | } else if (elemThis.tagName() == QLatin1String("report:section") | ||||
100 | && KReportUtils::readSectionTypeNameAttribute(elemThis) | ||||
101 | == QLatin1String("detail")) | ||||
102 | { | ||||
99 | KReportSectionData * sd = new KReportSectionData(elemThis, report); | 103 | KReportSectionData *sd = new KReportSectionData(elemThis, report); | ||
100 | if (sd->isValid()) { | 104 | if (sd->isValid()) { | ||
101 | detailSection = sd; | 105 | detailSection = sd; | ||
102 | } else | 106 | } else | ||
103 | delete sd; | 107 | delete sd; | ||
104 | } else { | 108 | } else { | ||
105 | kreportWarning() << "While parsing detail section encountered an unknown element: " << elemThis.tagName(); | 109 | kreportWarning() << "While parsing detail section encountered an unknown element: " << elemThis.tagName(); | ||
106 | } | 110 | } | ||
107 | } | 111 | } | ||
Show All 16 Lines |