Changeset View
Changeset View
Standalone View
Standalone View
src/plugins/maps/KReportItemMaps.cpp
Show All 10 Lines | |||||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
13 | * Lesser General Public License for more details. | 13 | * Lesser General Public License for more details. | ||
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 | #include "KReportItemMaps.h" | 18 | #include "KReportItemMaps.h" | ||
19 | #include "KReportUtils.h" | ||||
20 | #include "KReportRenderObjects.h" | ||||
19 | 21 | | |||
20 | #include <KPropertyListData> | 22 | #include <KPropertyListData> | ||
21 | #include <KPropertySet> | 23 | #include <KPropertySet> | ||
22 | 24 | | |||
23 | #include <QStringList> | 25 | #include <QStringList> | ||
24 | 26 | | |||
25 | #include <KReportRenderObjects.h> | | |||
26 | | ||||
27 | #include <sys/socket.h> | 27 | #include <sys/socket.h> | ||
28 | 28 | | |||
29 | #define myDebug() if (0) kDebug(44021) | 29 | #define myDebug() if (0) kDebug(44021) | ||
30 | 30 | | |||
31 | //! @todo replace with ReportItemMaps(const QDomNode &element = QDomNode()) | 31 | //! @todo replace with ReportItemMaps(const QDomNode &element = QDomNode()) | ||
32 | KReportItemMaps::KReportItemMaps() | 32 | KReportItemMaps::KReportItemMaps() | ||
33 | { | 33 | { | ||
34 | createProperties(); | 34 | createProperties(); | ||
35 | } | 35 | } | ||
36 | 36 | | |||
37 | KReportItemMaps::KReportItemMaps(const QDomNode &element) | 37 | KReportItemMaps::KReportItemMaps(const QDomNode &element) | ||
38 | : KReportItemMaps() | 38 | : KReportItemMaps() | ||
39 | { | 39 | { | ||
40 | nameProperty()->setValue(element.toElement().attribute(QLatin1String("report:name"))); | 40 | nameProperty()->setValue(KReportUtils::readNameAttribute(element.toElement())); | ||
41 | m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source"))); | 41 | m_controlSource->setValue(element.toElement().attribute(QLatin1String("report:item-data-source"))); | ||
42 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | 42 | setZ(element.toElement().attribute(QLatin1String("report:z-index")).toDouble()); | ||
43 | m_latitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:latitude")).toDouble()); | 43 | m_latitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:latitude")).toDouble()); | ||
44 | m_longitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:longitude")).toDouble()); | 44 | m_longitudeProperty->setValue(element.toElement().attribute(QLatin1String("report:longitude")).toDouble()); | ||
45 | m_zoomProperty->setValue(element.toElement().attribute(QLatin1String("report:zoom")).toInt()); | 45 | m_zoomProperty->setValue(element.toElement().attribute(QLatin1String("report:zoom")).toInt()); | ||
46 | QString themeId(element.toElement().attribute(QLatin1String("report:theme"))); | 46 | QString themeId(element.toElement().attribute(QLatin1String("report:theme"))); | ||
47 | themeId = themeId.isEmpty() ? m_themeManager.mapThemeIds()[0] : themeId; | 47 | themeId = themeId.isEmpty() ? m_themeManager.mapThemeIds()[0] : themeId; | ||
48 | m_themeProperty->setValue(themeId); | 48 | m_themeProperty->setValue(themeId); | ||
49 | 49 | | |||
50 | parseReportRect(element.toElement()); | 50 | parseReportRect(element.toElement()); | ||
51 | } | 51 | } | ||
52 | 52 | | |||
53 | KReportItemMaps::~KReportItemMaps() | 53 | KReportItemMaps::~KReportItemMaps() | ||
54 | { | 54 | { | ||
55 | } | 55 | } | ||
56 | 56 | | |||
57 | void KReportItemMaps::createProperties() | 57 | void KReportItemMaps::createProperties() | ||
58 | { | 58 | { | ||
59 | m_controlSource = new KProperty("item-data-source", new KPropertyListData, QVariant(), tr("Data Source")); | 59 | m_controlSource = new KProperty("item-data-source", new KPropertyListData, QVariant(), tr("Data Source")); | ||
60 | 60 | | |||
61 | m_latitudeProperty = new KProperty("latitude", 0.0, tr("Latitude"), QString(), KProperty::Double); | 61 | m_latitudeProperty = new KProperty("latitude", 0.0, tr("Latitude"), QString(), KProperty::Double); | ||
62 | m_latitudeProperty->setOption("min", -90); | 62 | m_latitudeProperty->setOption("min", -90); | ||
63 | m_latitudeProperty->setOption("max", 90); | 63 | m_latitudeProperty->setOption("max", 90); | ||
64 | m_latitudeProperty->setOption("unit", QString::fromUtf8("°")); | 64 | m_latitudeProperty->setOption("suffix", QString::fromUtf8("°")); | ||
65 | m_latitudeProperty->setOption("precision", 7); | 65 | m_latitudeProperty->setOption("precision", 7); | ||
66 | 66 | | |||
67 | m_longitudeProperty = new KProperty("longitude", 0.0, tr("Longitude"), QString(), KProperty::Double); | 67 | m_longitudeProperty = new KProperty("longitude", 0.0, tr("Longitude"), QString(), KProperty::Double); | ||
68 | m_longitudeProperty->setOption("min", -180); | 68 | m_longitudeProperty->setOption("min", -180); | ||
69 | m_longitudeProperty->setOption("max", 180); | 69 | m_longitudeProperty->setOption("max", 180); | ||
70 | m_longitudeProperty->setOption("unit", QString::fromUtf8("°")); | 70 | m_longitudeProperty->setOption("suffix", QString::fromUtf8("°")); | ||
71 | m_longitudeProperty->setOption("precision", 7); | 71 | m_longitudeProperty->setOption("precision", 7); | ||
72 | 72 | | |||
73 | m_zoomProperty = new KProperty("zoom", 1000, tr("Zoom") ); | 73 | m_zoomProperty = new KProperty("zoom", 1000, tr("Zoom") ); | ||
74 | m_zoomProperty->setOption("min", 0); | 74 | m_zoomProperty->setOption("min", 0); | ||
75 | m_zoomProperty->setOption("max", 4000); | 75 | m_zoomProperty->setOption("max", 4000); | ||
76 | m_zoomProperty->setOption("step", 100); | 76 | m_zoomProperty->setOption("step", 100); | ||
77 | m_zoomProperty->setOption("slider", true); | 77 | m_zoomProperty->setOption("slider", true); | ||
78 | 78 | | |||
▲ Show 20 Lines • Show All 140 Lines • Show Last 20 Lines |