File indexing completed on 2024-05-12 16:39:56
0001 /* This file is part of the KDE project 0002 Copyright (C) 2003 Lucijan Busch <lucijan@kde.org> 0003 Copyright (C) 2003-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 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 "KexiPluginMetaData.h" 0022 #include "KexiJsonTrader.h" 0023 0024 #include <QStringList> 0025 #include <QDebug> 0026 #include <QJsonArray> 0027 0028 class Q_DECL_HIDDEN KexiPluginMetaData::Private 0029 { 0030 public: 0031 Private(KexiPluginMetaData *info) 0032 { 0033 QStringList v(info->version().split('.')); 0034 bool ok = v.count() >= 2; 0035 if (ok) { 0036 majorVersion = v[0].toInt(&ok); 0037 } 0038 if (ok) { 0039 minorVersion = v[1].toInt(&ok); 0040 } 0041 if (!ok) { 0042 majorVersion = 0; 0043 minorVersion = 0; 0044 } 0045 } 0046 0047 QString errorMessage; 0048 int majorVersion; 0049 int minorVersion; 0050 }; 0051 0052 //------------------------------ 0053 0054 KexiPluginMetaData::KexiPluginMetaData(const QPluginLoader &loader) 0055 : KPluginMetaData(loader), d(new Private(this)) 0056 { 0057 } 0058 0059 KexiPluginMetaData::~KexiPluginMetaData() 0060 { 0061 delete d; 0062 } 0063 0064 QString KexiPluginMetaData::id() const 0065 { 0066 return pluginId(); 0067 } 0068 0069 void KexiPluginMetaData::setErrorMessage(const QString& errorMessage) 0070 { 0071 d->errorMessage = errorMessage; 0072 } 0073 0074 QString KexiPluginMetaData::errorMessage() const 0075 { 0076 return d->errorMessage; 0077 } 0078 0079 int KexiPluginMetaData::majorVersion() const 0080 { 0081 return d->majorVersion; 0082 } 0083 0084 int KexiPluginMetaData::minorVersion() const 0085 { 0086 return d->minorVersion; 0087 }