File indexing completed on 2025-01-12 04:19:47
0001 /* 0002 * Copyright (C) 2003-2008 Justin Karneges <justin@affinix.com> 0003 * 0004 * This library is free software; you can redistribute it and/or 0005 * modify it under the terms of the GNU Lesser General Public 0006 * License as published by the Free Software Foundation; either 0007 * version 2.1 of the License, or (at your option) any later version. 0008 * 0009 * This library 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 * Lesser General Public License for more details. 0013 * 0014 * You should have received a copy of the GNU Lesser General Public 0015 * License along with this library; if not, write to the Free Software 0016 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA 0017 */ 0018 0019 #include "mykeystorelist.h" 0020 #include "myopenpgpcontext.h" 0021 #include "mypgpkeycontext.h" 0022 #include "qcaprovider.h" 0023 #include <QtPlugin> 0024 0025 using namespace gpgQCAPlugin; 0026 0027 class gnupgProvider : public QCA::Provider 0028 { 0029 public: 0030 void init() override 0031 { 0032 } 0033 0034 int qcaVersion() const override 0035 { 0036 return QCA_VERSION; 0037 } 0038 0039 QString name() const override 0040 { 0041 return QStringLiteral("qca-gnupg"); 0042 } 0043 0044 QStringList features() const override 0045 { 0046 QStringList list; 0047 list += QStringLiteral("pgpkey"); 0048 list += QStringLiteral("openpgp"); 0049 list += QStringLiteral("keystorelist"); 0050 return list; 0051 } 0052 0053 Context *createContext(const QString &type) override 0054 { 0055 if (type == QLatin1String("pgpkey")) 0056 return new MyPGPKeyContext(this); 0057 else if (type == QLatin1String("openpgp")) 0058 return new MyOpenPGPContext(this); 0059 else if (type == QLatin1String("keystorelist")) 0060 return new MyKeyStoreList(this); 0061 else 0062 return nullptr; 0063 } 0064 }; 0065 0066 class gnupgPlugin : public QObject, public QCAPlugin 0067 { 0068 Q_OBJECT 0069 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0") 0070 Q_INTERFACES(QCAPlugin) 0071 public: 0072 QCA::Provider *createProvider() override 0073 { 0074 return new gnupgProvider; 0075 } 0076 }; 0077 0078 #include "qca-gnupg.moc"