Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/scripting/KReportScriptSection.cpp
Show All 33 Lines | |||||
34 | 34 | | |||
35 | 35 | | |||
36 | Section::~Section() | 36 | Section::~Section() | ||
37 | { | 37 | { | ||
38 | } | 38 | } | ||
39 | 39 | | |||
40 | QColor Section::backgroundColor() const | 40 | QColor Section::backgroundColor() const | ||
41 | { | 41 | { | ||
42 | return m_section->m_backgroundColor->value().value<QColor>(); | 42 | return m_section->backgroundColor(); | ||
43 | } | 43 | } | ||
44 | 44 | | |||
45 | void Section::setBackgroundColor(const QColor &c) | 45 | void Section::setBackgroundColor(const QColor &c) | ||
46 | { | 46 | { | ||
47 | //kreportDebug() << c.name(); | 47 | m_section->setBackgroundColor(c); | ||
48 | m_section->m_backgroundColor->setValue(c); | | |||
49 | } | 48 | } | ||
50 | 49 | | |||
51 | qreal Section::height() const | 50 | qreal Section::height() const | ||
52 | { | 51 | { | ||
53 | return m_section->height(); | 52 | return m_section->height(); | ||
54 | } | 53 | } | ||
55 | 54 | | |||
56 | void Section::setHeight(qreal h) | 55 | void Section::setHeight(qreal h) | ||
57 | { | 56 | { | ||
58 | m_section->setHeight(h); | 57 | m_section->setHeight(h); | ||
59 | } | 58 | } | ||
60 | 59 | | |||
61 | QString Section::name() const | 60 | QString Section::name() const | ||
62 | { | 61 | { | ||
63 | return m_section->objectName(); | 62 | return m_section->objectName(); | ||
64 | } | 63 | } | ||
65 | 64 | | |||
66 | QObject* Section::objectByNumber(int i) | 65 | QObject* Section::objectByNumber(int i) | ||
67 | { | 66 | { | ||
68 | if (m_section->m_objects[i]->typeName() == QLatin1String("line")) { | 67 | if (m_section->object(i)->typeName() == QLatin1String("line")) { | ||
69 | return new Scripting::Line(dynamic_cast<KReportItemLine*>(m_section->m_objects[i])); | 68 | return new Scripting::Line(dynamic_cast<KReportItemLine*>(m_section->object(i))); | ||
70 | } | 69 | } | ||
71 | else { | 70 | else { | ||
72 | KReportPluginManager* manager = KReportPluginManager::self(); | 71 | KReportPluginManager* manager = KReportPluginManager::self(); | ||
73 | KReportPluginInterface *plugin = manager->plugin(m_section->m_objects[i]->typeName()); | 72 | KReportPluginInterface *plugin = manager->plugin(m_section->object(i)->typeName()); | ||
74 | if (plugin) { | 73 | if (plugin) { | ||
75 | QObject *obj = plugin->createScriptInstance(m_section->m_objects[i]); | 74 | QObject *obj = plugin->createScriptInstance(m_section->object(i)); | ||
76 | if (obj) { | 75 | if (obj) { | ||
77 | return obj; | 76 | return obj; | ||
78 | } | 77 | } | ||
79 | } | 78 | } | ||
80 | else { | 79 | else { | ||
81 | kreportWarning() << "Encountered unknown node while parsing section: " << m_section->m_objects[i]->typeName(); | 80 | kreportWarning() << "Encountered unknown node while parsing section: " << m_section->object(i)->typeName(); | ||
82 | } | 81 | } | ||
83 | } | 82 | } | ||
84 | 83 | | |||
85 | return new QObject(); | 84 | return new QObject(); | ||
86 | } | 85 | } | ||
87 | 86 | | |||
88 | QObject* Section::objectByName(const QString& n) | 87 | QObject* Section::objectByName(const QString& n) | ||
89 | { | 88 | { | ||
90 | for (int i = 0; i < m_section->objects().count(); ++i) { | 89 | for (int i = 0; i < m_section->objects().count(); ++i) { | ||
91 | if (m_section->m_objects[i]->entityName() == n) { | 90 | if (m_section->object(i)->entityName() == n) { | ||
92 | return objectByNumber(i); | 91 | return objectByNumber(i); | ||
93 | } | 92 | } | ||
94 | } | 93 | } | ||
95 | return nullptr; | 94 | return nullptr; | ||
96 | } | 95 | } | ||
97 | 96 | | |||
98 | void Section::initialize(const QJSValue &s) | 97 | void Section::initialize(const QJSValue &s) | ||
99 | { | 98 | { | ||
Show All 9 Lines |