Changeset View
Changeset View
Standalone View
Standalone View
kexi/plugins/reports/kexireportview.cpp
1 | /* | 1 | /* | ||
---|---|---|---|---|---|
2 | * Kexi Report Plugin | 2 | * Kexi Report Plugin | ||
3 | * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) | 3 | * Copyright (C) 2007-2008 by Adam Pigg (adam@piggz.co.uk) | ||
4 | Copyright (C) 2014 Jarosław Staniek <staniek@kde.org> | 4 | Copyright (C) 2014-2016 Jarosław Staniek <staniek@kde.org> | ||
5 | * | 5 | * | ||
6 | * This library is free software; you can redistribute it and/or | 6 | * This library is free software; you can redistribute it and/or | ||
7 | * modify it under the terms of the GNU Lesser General Public | 7 | * modify it under the terms of the GNU Lesser General Public | ||
8 | * License as published by the Free Software Foundation; either | 8 | * License as published by the Free Software Foundation; either | ||
9 | * version 2.1 of the License, or (at your option) any later version. | 9 | * version 2.1 of the License, or (at your option) any later version. | ||
10 | * | 10 | * | ||
11 | * This library is distributed in the hope that it will be useful, | 11 | * This library is distributed in the hope that it will be useful, | ||
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
▲ Show 20 Lines • Show All 382 Lines • ▼ Show 20 Line(s) | 389 | if (tempData()->reportSchemaChangedInPreviousView) { | |||
395 | //kDebug() << tempData()->reportDefinition.tagName(); | 395 | //kDebug() << tempData()->reportDefinition.tagName(); | ||
396 | m_preRenderer = new KoReportPreRenderer(tempData()->reportDefinition); | 396 | m_preRenderer = new KoReportPreRenderer(tempData()->reportDefinition); | ||
397 | if (m_preRenderer->isValid()) { | 397 | if (m_preRenderer->isValid()) { | ||
398 | KoReportData *reportData = 0; | 398 | KoReportData *reportData = 0; | ||
399 | if (!tempData()->connectionDefinition.isNull()) { | 399 | if (!tempData()->connectionDefinition.isNull()) { | ||
400 | reportData = sourceData(tempData()->connectionDefinition); | 400 | reportData = sourceData(tempData()->connectionDefinition); | ||
401 | } | 401 | } | ||
402 | if (!reportData) { | 402 | if (!reportData) { | ||
403 | reportData = new KexiDBReportData(QString(), KexiMainWindowIface::global()->project()->dbConnection(), this); | 403 | reportData = new KexiDBReportData(QString(), QString(), | ||
piggz: is there a leak here? who is the owner of reportData and where is it deleted? | |||||
404 | KexiMainWindowIface::global()->project()->dbConnection(), this); | ||||
404 | } | 405 | } | ||
405 | m_preRenderer->setSourceData(reportData); | 406 | m_preRenderer->setSourceData(reportData); | ||
406 | 407 | | |||
407 | m_preRenderer->setName(tempData()->name); | | |||
408 | m_currentPage = 1; | 408 | m_currentPage = 1; | ||
409 | 409 | | |||
410 | //Add a kexi object to provide kexidb and extra functionality | 410 | //Add a kexi object to provide kexidb and extra functionality | ||
411 | if(!m_kexi) { | 411 | if(!m_kexi) { | ||
412 | m_kexi = new KexiScriptAdaptor(); | 412 | m_kexi = new KexiScriptAdaptor(); | ||
413 | } | 413 | } | ||
414 | m_preRenderer->registerScriptObject(m_kexi, "Kexi"); | 414 | m_preRenderer->registerScriptObject(m_kexi, "Kexi"); | ||
415 | 415 | | |||
Show All 21 Lines | 430 | #endif | |||
437 | m_reportView->centerOn(0,0); | 437 | m_reportView->centerOn(0,0); | ||
438 | } else { | 438 | } else { | ||
439 | KMessageBox::error(this, i18n("Report schema appears to be invalid or corrupt"), i18n("Opening failed")); | 439 | KMessageBox::error(this, i18n("Report schema appears to be invalid or corrupt"), i18n("Opening failed")); | ||
440 | } | 440 | } | ||
441 | } | 441 | } | ||
442 | return true; | 442 | return true; | ||
443 | } | 443 | } | ||
444 | 444 | | |||
445 | KoReportData* KexiReportView::sourceData(QDomElement e) | 445 | KoReportData* KexiReportView::sourceData(const QDomElement &e) | ||
446 | { | 446 | { | ||
447 | KoReportData *kodata = 0; | 447 | KoReportData *kodata = 0; | ||
448 | 448 | | |||
449 | if (e.attribute("type") == "internal") { | 449 | if (e.attribute("type") == "internal") { | ||
450 | kodata = new KexiDBReportData(e.attribute("source"), | 450 | kodata = new KexiDBReportData(e.attribute("source"), | ||
451 | e.attribute("source-class"), | ||||
451 | KexiMainWindowIface::global()->project()->dbConnection(), | 452 | KexiMainWindowIface::global()->project()->dbConnection(), | ||
452 | this); | 453 | this); | ||
453 | } | 454 | } | ||
454 | #ifndef KEXI_MOBILE | 455 | #ifndef KEXI_MOBILE | ||
455 | if (e.attribute("type") == "external") { | 456 | if (e.attribute("type") == "external") { | ||
456 | kodata = new KexiMigrateReportData(e.attribute("source")); | 457 | kodata = new KexiMigrateReportData(e.attribute("source")); | ||
457 | } | 458 | } | ||
458 | #endif | 459 | #endif | ||
▲ Show 20 Lines • Show All 71 Lines • Show Last 20 Lines |
is there a leak here? who is the owner of reportData and where is it deleted?