Changeset View
Changeset View
Standalone View
Standalone View
src/wrtembed/KReportDesigner.cpp
Show All 30 Lines | |||||
31 | #include "KReportPageSize.h" | 31 | #include "KReportPageSize.h" | ||
32 | #include "KReportUtils_p.h" | 32 | #include "KReportUtils_p.h" | ||
33 | #include "KReportUtils.h" | 33 | #include "KReportUtils.h" | ||
34 | #include "KReportPluginInterface.h" | 34 | #include "KReportPluginInterface.h" | ||
35 | #include "KReportPluginManager.h" | 35 | #include "KReportPluginManager.h" | ||
36 | #include "KReportSection.h" | 36 | #include "KReportSection.h" | ||
37 | #include "KReportPluginMetaData.h" | 37 | #include "KReportPluginMetaData.h" | ||
38 | #include "kreport_debug.h" | 38 | #include "kreport_debug.h" | ||
39 | #ifdef KREPORT_SCRIPTING | ||||
40 | #include "KReportScriptSource.h" | ||||
41 | #endif | ||||
39 | 42 | | |||
40 | #include <KStandardShortcut> | 43 | #include <KStandardShortcut> | ||
41 | #include <KStandardGuiItem> | 44 | #include <KStandardGuiItem> | ||
42 | #include <QLayout> | 45 | #include <QLayout> | ||
43 | #include <QDomDocument> | 46 | #include <QDomDocument> | ||
44 | #include <QVBoxLayout> | 47 | #include <QVBoxLayout> | ||
45 | #include <QGridLayout> | 48 | #include <QGridLayout> | ||
46 | #include <QGraphicsSceneMouseEvent> | 49 | #include <QGraphicsSceneMouseEvent> | ||
▲ Show 20 Lines • Show All 128 Lines • ▼ Show 20 Line(s) | 163 | #endif | |||
175 | qreal releaseY = -1; | 178 | qreal releaseY = -1; | ||
176 | 179 | | |||
177 | bool modified = false; // true if this document has been modified, false otherwise | 180 | bool modified = false; // true if this document has been modified, false otherwise | ||
178 | 181 | | |||
179 | QString originalInterpreter; //Value of the script interpreter at load time | 182 | QString originalInterpreter; //Value of the script interpreter at load time | ||
180 | QString originalScript; //Value of the script at load time | 183 | QString originalScript; //Value of the script at load time | ||
181 | 184 | | |||
182 | KReportDataSource *dataSource = nullptr; | 185 | KReportDataSource *dataSource = nullptr; | ||
186 | #ifdef KREPORT_SCRIPTING | ||||
187 | KReportScriptSource *scriptSource = nullptr; | ||||
188 | #endif | ||||
183 | }; | 189 | }; | ||
184 | 190 | | |||
185 | KReportDesigner::KReportDesigner(QWidget * parent) | 191 | KReportDesigner::KReportDesigner(QWidget * parent) | ||
186 | : QWidget(parent), d(new Private()) | 192 | : QWidget(parent), d(new Private()) | ||
187 | { | 193 | { | ||
188 | KReportPluginManager::self(); // this loads icons early enough | 194 | KReportPluginManager::self(); // this loads icons early enough | ||
189 | 195 | | |||
190 | createProperties(); | 196 | createProperties(); | ||
▲ Show 20 Lines • Show All 240 Lines • ▼ Show 20 Line(s) | |||||
431 | void KReportDesigner::slotSectionEditor() | 437 | void KReportDesigner::slotSectionEditor() | ||
432 | { | 438 | { | ||
433 | KReportSectionEditor se(this); | 439 | KReportSectionEditor se(this); | ||
434 | (void)se.exec(); | 440 | (void)se.exec(); | ||
435 | } | 441 | } | ||
436 | 442 | | |||
437 | void KReportDesigner::setDataSource(KReportDataSource* source) | 443 | void KReportDesigner::setDataSource(KReportDataSource* source) | ||
438 | { | 444 | { | ||
445 | qDebug() << "Data source" << source; | ||||
staniek: Not needed in the repo | |||||
439 | if (d->dataSource == source) { | 446 | if (d->dataSource == source) { | ||
440 | return; | 447 | return; | ||
441 | } | 448 | } | ||
442 | delete d->dataSource; | 449 | delete d->dataSource; | ||
443 | 450 | | |||
444 | d->dataSource = source; | 451 | d->dataSource = source; | ||
445 | slotPageButton_Pressed(); | 452 | slotPageButton_Pressed(); | ||
446 | setModified(true); | 453 | setModified(true); | ||
447 | emit reportDataChanged(); | 454 | emit reportDataChanged(); | ||
448 | } | 455 | } | ||
449 | 456 | | |||
457 | #ifdef KREPORT_SCRIPTING | ||||
458 | void KReportDesigner::setScriptSource(KReportScriptSource* source) | ||||
459 | { | ||||
460 | d->scriptSource = source; | ||||
461 | } | ||||
462 | #endif | ||||
463 | | ||||
450 | KReportDesignerSection * KReportDesigner::section(KReportSectionData::Section s) const | 464 | KReportDesignerSection * KReportDesigner::section(KReportSectionData::Section s) const | ||
451 | { | 465 | { | ||
452 | KReportDesignerSection *sec; | 466 | KReportDesignerSection *sec; | ||
453 | switch (s) { | 467 | switch (s) { | ||
454 | case KReportSectionData::PageHeaderAny: | 468 | case KReportSectionData::PageHeaderAny: | ||
455 | sec = d->pageHeaderAny; | 469 | sec = d->pageHeaderAny; | ||
456 | break; | 470 | break; | ||
457 | case KReportSectionData::PageHeaderEven: | 471 | case KReportSectionData::PageHeaderEven: | ||
▲ Show 20 Lines • Show All 326 Lines • ▼ Show 20 Line(s) | 793 | if (p.name() == "page-unit") { | |||
784 | d->set.property("margin-right").setOption("unit", newstr); | 798 | d->set.property("margin-right").setOption("unit", newstr); | ||
785 | d->set.property("margin-top").setOption("unit", newstr); | 799 | d->set.property("margin-top").setOption("unit", newstr); | ||
786 | d->set.property("margin-bottom").setOption("unit", newstr); | 800 | d->set.property("margin-bottom").setOption("unit", newstr); | ||
787 | } | 801 | } | ||
788 | } | 802 | } | ||
789 | 803 | | |||
790 | void KReportDesigner::slotPageButton_Pressed() | 804 | void KReportDesigner::slotPageButton_Pressed() | ||
791 | { | 805 | { | ||
806 | qDebug() << "Page button pressed"; | ||||
staniek: Not needed in the repo | |||||
792 | #ifdef KREPORT_SCRIPTING | 807 | #ifdef KREPORT_SCRIPTING | ||
793 | if (d->dataSource) { | 808 | if (d->scriptSource) { | ||
794 | QStringList sl = d->dataSource->scriptList(); | 809 | qDebug() << "Script source is set"; | ||
staniek: Not needed in the repo | |||||
810 | QStringList sl = d->scriptSource->scriptList(); | ||||
795 | sl.prepend(QLatin1String("")); | 811 | sl.prepend(QLatin1String("")); | ||
staniek: QString() | |||||
796 | d->script->setListData(sl, sl); | 812 | d->script->setListData(sl, sl); | ||
797 | } | 813 | } | ||
798 | changeSet(&d->set); | 814 | changeSet(&d->set); | ||
799 | #endif | 815 | #endif | ||
800 | } | 816 | } | ||
801 | 817 | | |||
802 | QSize KReportDesigner::sizeHint() const | 818 | QSize KReportDesigner::sizeHint() const | ||
803 | { | 819 | { | ||
▲ Show 20 Lines • Show All 726 Lines • Show Last 20 Lines |
Not needed in the repo