Changeset View
Changeset View
Standalone View
Standalone View
src/renderer/scripting/KReportScriptHandler.cpp
Show All 37 Lines | |||||
38 | { | 38 | { | ||
39 | public: | 39 | public: | ||
40 | Private(); | 40 | Private(); | ||
41 | ~Private(); | 41 | ~Private(); | ||
42 | KReportScriptConstants *constants; | 42 | KReportScriptConstants *constants; | ||
43 | KReportScriptDebug *debug; | 43 | KReportScriptDebug *debug; | ||
44 | KReportScriptDraw *draw; | 44 | KReportScriptDraw *draw; | ||
45 | Scripting::Report *report; | 45 | Scripting::Report *report; | ||
46 | const KReportData *reportData; | 46 | const KReportDataSource *reportDataSource; | ||
staniek: -> reportDataSource | |||||
47 | QString source; | 47 | QString source; | ||
48 | KReportDocument *reportDocument; | 48 | KReportDocument *reportDocument; | ||
49 | QJSEngine engine; | 49 | QJSEngine engine; | ||
50 | QJSValue scriptValue; | 50 | QJSValue scriptValue; | ||
51 | QMap<QString, QVariant> groups; | 51 | QMap<QString, QVariant> groups; | ||
52 | QMap<KReportSectionData*, Scripting::Section*> sectionMap; | 52 | QMap<KReportSectionData*, Scripting::Section*> sectionMap; | ||
53 | }; | 53 | }; | ||
54 | 54 | | |||
55 | KReportScriptHandler::Private::Private() : constants(new KReportScriptConstants), debug(new KReportScriptDebug), draw(new KReportScriptDraw) | 55 | KReportScriptHandler::Private::Private() : constants(new KReportScriptConstants), debug(new KReportScriptDebug), draw(new KReportScriptDraw) | ||
56 | { | 56 | { | ||
57 | } | 57 | } | ||
58 | 58 | | |||
59 | KReportScriptHandler::Private::~Private() | 59 | KReportScriptHandler::Private::~Private() | ||
60 | { | 60 | { | ||
61 | } | 61 | } | ||
62 | 62 | | |||
63 | KReportScriptHandler::KReportScriptHandler(const KReportData* kodata, KReportDocument* doc) : d(new Private()) | 63 | KReportScriptHandler::KReportScriptHandler(const KReportDataSource* reportDataSource, KReportDocument* reportDocument) : d(new Private()) | ||
staniek: kodata -> dataSource | |||||
64 | { | 64 | { | ||
65 | d->reportDocument = doc; | 65 | d->reportDocument = reportDocument; | ||
66 | d->reportData = kodata; | 66 | d->reportDataSource = reportDataSource; | ||
67 | 67 | | |||
68 | //Add a general report object | 68 | //Add a general report object | ||
69 | d->report = new Scripting::Report(d->reportDocument); | 69 | d->report = new Scripting::Report(d->reportDocument); | ||
70 | 70 | | |||
71 | registerScriptObject(d->constants, QLatin1String("constants")); | 71 | registerScriptObject(d->constants, QLatin1String("constants")); | ||
72 | registerScriptObject(d->debug, QLatin1String("debug")); | 72 | registerScriptObject(d->debug, QLatin1String("debug")); | ||
73 | registerScriptObject(d->draw, QLatin1String("draw")); | 73 | registerScriptObject(d->draw, QLatin1String("draw")); | ||
74 | 74 | | |||
Show All 11 Lines | 79 | foreach(KReportSectionData *sec, secs) { | |||
86 | //kreportDebug() << "Added" << d->sectionMap[sec]->objectName() << "to report" << d->reportData->name(); | 86 | //kreportDebug() << "Added" << d->sectionMap[sec]->objectName() << "to report" << d->reportData->name(); | ||
87 | } | 87 | } | ||
88 | 88 | | |||
89 | //kreportDebug() << "Report name is" << d->reportData->name(); | 89 | //kreportDebug() << "Report name is" << d->reportData->name(); | ||
90 | } | 90 | } | ||
91 | 91 | | |||
92 | bool KReportScriptHandler::trigger() | 92 | bool KReportScriptHandler::trigger() | ||
93 | { | 93 | { | ||
94 | QString code = d->reportData->scriptCode(d->reportDocument->script()); | 94 | QString code = d->reportDataSource->scriptCode(d->reportDocument->script()); | ||
95 | //kreportDebug() << code; | 95 | //kreportDebug() << code; | ||
96 | 96 | | |||
97 | if (code.isEmpty()) { | 97 | if (code.isEmpty()) { | ||
98 | return true; | 98 | return true; | ||
99 | } | 99 | } | ||
100 | 100 | | |||
101 | d->scriptValue = d->engine.evaluate(code, d->reportDocument->script()); | 101 | d->scriptValue = d->engine.evaluate(code, d->reportDocument->script()); | ||
102 | 102 | | |||
▲ Show 20 Lines • Show All 100 Lines • Show Last 20 Lines |
-> reportDataSource