Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/scripting/KReportScriptReport.cpp
Show First 20 Lines • Show All 51 Lines • ▼ Show 20 Line(s) | |||||
52 | 52 | | |||
53 | QString Report::recordSource() const | 53 | QString Report::recordSource() const | ||
54 | { | 54 | { | ||
55 | return m_reportData->query(); | 55 | return m_reportData->query(); | ||
56 | } | 56 | } | ||
57 | 57 | | |||
58 | QObject* Report::objectByName(const QString &n) | 58 | QObject* Report::objectByName(const QString &n) | ||
59 | { | 59 | { | ||
60 | if (m_scriptObjMap.contains(n)) { | ||||
61 | return m_scriptObjMap[n]; | ||||
62 | } | ||||
63 | | ||||
60 | QList<KReportItemBase *>obs = m_reportData->objects(); | 64 | QList<KReportItemBase *>obs = m_reportData->objects(); | ||
61 | foreach(KReportItemBase *o, obs) { | 65 | foreach(KReportItemBase *o, obs) { | ||
62 | if (o->entityName() == n) { | 66 | if (o->entityName() == n) { | ||
63 | 67 | | |||
64 | if (o->typeName() == QLatin1String("line")) { | 68 | if (o->typeName() == QLatin1String("line")) { | ||
65 | return new Scripting::Line(dynamic_cast<KReportItemLine*>(o)); | 69 | return new Scripting::Line(dynamic_cast<KReportItemLine*>(o)); | ||
66 | } | 70 | } | ||
67 | else { | 71 | else { | ||
68 | KReportPluginManager* manager = KReportPluginManager::self(); | 72 | KReportPluginManager* manager = KReportPluginManager::self(); | ||
69 | KReportPluginInterface *plugin = manager->plugin(o->typeName()); | 73 | KReportPluginInterface *plugin = manager->plugin(o->typeName()); | ||
70 | if (plugin) { | 74 | if (plugin) { | ||
71 | QObject *obj = plugin->createScriptInstance(o); | 75 | QObject *obj = plugin->createScriptInstance(o); | ||
72 | if (obj) { | 76 | if (obj) { | ||
77 | m_scriptObjMap[n] = obj; | ||||
73 | return obj; | 78 | return obj; | ||
74 | } | 79 | } | ||
75 | } | 80 | } | ||
76 | else { | 81 | else { | ||
77 | kreportWarning() << "Encountered unknown node while parsing section: " << o->typeName(); | 82 | kreportWarning() << "Encountered unknown node while parsing section: " << o->typeName(); | ||
78 | } | 83 | } | ||
79 | } | 84 | } | ||
80 | } | 85 | } | ||
Show All 38 Lines |