KReport

KReportPluginMetaData.cpp
1/* This file is part of the KDE project
2 Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk)
3 Copyright (C) 2015 Jarosław Staniek <staniek@kde.org>
4
5 This library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
9
10 This library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
14
15 You should have received a copy of the GNU Library General Public License
16 along with this library; see the file COPYING.LIB. If not, write to
17 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 Boston, MA 02110-1301, USA.
19*/
20
21#include "KReportPluginMetaData.h"
22
23#include <QPluginLoader>
24#include "kreport_debug.h"
25
26class KReportPluginMetaData::Private
27{
28public:
29 Private(KReportPluginMetaData *metaData) : isBuiltIn(false), isStatic(false)
30 {
31 const QString s = metaData->value(QLatin1String("X-KReport-PluginInfo-Priority"));
32 bool ok;
33 int i = s.toInt(&ok);
34 priority = ok ? i : 100; // default priority is low
35 }
36
37 int priority;
38 bool isBuiltIn;
39 bool isStatic;
40};
41
42// ---
43
44KReportPluginMetaData::KReportPluginMetaData(const QJsonObject &metaData)
45 : KPluginMetaData(metaData, QString()), d(new Private(this))
46{
47 //kreportDebug() << rawData();
48}
49
50KReportPluginMetaData::KReportPluginMetaData(const QPluginLoader &loader)
51 : KPluginMetaData(loader), d(new Private(this))
52{
53 //kreportDebug() << rawData();
54}
55
56KReportPluginMetaData::~KReportPluginMetaData()
57{
58 delete d;
59}
60
62{
63 return pluginId();
64}
65
67{
68 return d->priority;
69}
70
72{
73 return d->isBuiltIn;
74}
75
76void KReportPluginMetaData::setBuiltIn(bool set)
77{
78 d->isBuiltIn = set;
79}
80
82{
83 return d->isStatic;
84}
85
86void KReportPluginMetaData::setStatic(bool set)
87{
88 d->isStatic = set;
89}
QString pluginId() const
bool value(QStringView key, bool defaultValue) const
Information about a KReport plugin.
int toInt(bool *ok, int base) const const
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Mon Nov 18 2024 12:19:58 by doxygen 1.12.0 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.