File indexing completed on 2024-05-05 16:48:35
0001 /* This file is part of the KDE project 0002 Copyright (C) 2010 by Adam Pigg (adam@piggz.co.uk) 0003 Copyright (C) 2015 Jarosław Staniek <staniek@kde.org> 0004 0005 This library is free software; you can redistribute it and/or 0006 modify it under the terms of the GNU Library General Public 0007 License as published by the Free Software Foundation; either 0008 version 2.1 of the License, or (at your option) any later version. 0009 0010 This library is distributed in the hope that it will be useful, 0011 but WITHOUT ANY WARRANTY; without even the implied warranty of 0012 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 0013 Library General Public License for more details. 0014 0015 You should have received a copy of the GNU Library General Public License 0016 along with this library; see the file COPYING.LIB. If not, write to 0017 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 0018 Boston, MA 02110-1301, USA. 0019 */ 0020 0021 #include "KReportPluginMetaData.h" 0022 0023 #include <QPluginLoader> 0024 #include "kreport_debug.h" 0025 0026 class KReportPluginMetaData::Private 0027 { 0028 public: 0029 Private(KReportPluginMetaData *metaData) : isBuiltIn(false), isStatic(false) 0030 { 0031 const QString s = metaData->value(QLatin1String("X-KReport-PluginInfo-Priority")); 0032 bool ok; 0033 int i = s.toInt(&ok); 0034 priority = ok ? i : 100; // default priority is low 0035 } 0036 0037 int priority; 0038 bool isBuiltIn; 0039 bool isStatic; 0040 }; 0041 0042 // --- 0043 0044 KReportPluginMetaData::KReportPluginMetaData(const QJsonObject &metaData) 0045 : KPluginMetaData(metaData, QString()), d(new Private(this)) 0046 { 0047 //kreportDebug() << rawData(); 0048 } 0049 0050 KReportPluginMetaData::KReportPluginMetaData(const QPluginLoader &loader) 0051 : KPluginMetaData(loader), d(new Private(this)) 0052 { 0053 //kreportDebug() << rawData(); 0054 } 0055 0056 KReportPluginMetaData::~KReportPluginMetaData() 0057 { 0058 delete d; 0059 } 0060 0061 QString KReportPluginMetaData::id() const 0062 { 0063 return pluginId(); 0064 } 0065 0066 int KReportPluginMetaData::priority() const 0067 { 0068 return d->priority; 0069 } 0070 0071 bool KReportPluginMetaData::isBuiltIn() const 0072 { 0073 return d->isBuiltIn; 0074 } 0075 0076 void KReportPluginMetaData::setBuiltIn(bool set) 0077 { 0078 d->isBuiltIn = set; 0079 } 0080 0081 bool KReportPluginMetaData::isStatic() const 0082 { 0083 return d->isStatic; 0084 } 0085 0086 void KReportPluginMetaData::setStatic(bool set) 0087 { 0088 d->isStatic = set; 0089 }