File indexing completed on 2024-04-21 04:40:31

0001 /* This file is part of the KDE project
0002    Copyright (C) 2003-2016 Jarosław Staniek <staniek@kde.org>
0003 
0004    This program is free software; you can redistribute it and/or
0005    modify it under the terms of the GNU Library General Public
0006    License as published by the Free Software Foundation; either
0007    version 2 of the License, or (at your option) any later version.
0008 
0009    This program is distributed in the hope that it will be useful,
0010    but WITHOUT ANY WARRANTY; without even the implied warranty of
0011    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012    Library General Public License for more details.
0013 
0014    You should have received a copy of the GNU Library General Public License
0015    along with this program; see the file COPYING.  If not, write to
0016    the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017  * Boston, MA 02110-1301, USA.
0018 */
0019 
0020 #include "KDbDriverMetaData.h"
0021 
0022 #include <QStringList>
0023 
0024 static bool isTrue(KPluginMetaData *metaData, const char* fieldName)
0025 {
0026     return 0 == metaData->value(QLatin1String(fieldName))
0027                 .compare(QLatin1String("true"), Qt::CaseInsensitive);
0028 }
0029 
0030 class Q_DECL_HIDDEN KDbDriverMetaData::Private
0031 {
0032 public:
0033     explicit Private(KDbDriverMetaData *metaData)
0034         : fileBased(isTrue(metaData, "X-KDb-FileBased"))
0035         , importingEnabled(isTrue(metaData, "X-KDb-ImportingEnabled"))
0036     {
0037     }
0038 
0039     QStringList mimeTypes;
0040     bool fileBased;
0041     bool importingEnabled;
0042 private:
0043     Q_DISABLE_COPY(Private)
0044 };
0045 
0046 // ---
0047 
0048 KDbDriverMetaData::KDbDriverMetaData(const QPluginLoader &loader)
0049     : KPluginMetaData(loader), d(new Private(this))
0050 {
0051 }
0052 
0053 KDbDriverMetaData::~KDbDriverMetaData()
0054 {
0055     delete d;
0056 }
0057 
0058 QString KDbDriverMetaData::id() const
0059 {
0060     return pluginId();
0061 }
0062 
0063 bool KDbDriverMetaData::isFileBased() const
0064 {
0065     return d->fileBased;
0066 }
0067 
0068 bool KDbDriverMetaData::isImportingEnabled() const
0069 {
0070     return d->importingEnabled;
0071 }