1/*
2 * Copyright (C) 2003-2008 Justin Karneges <justin@affinix.com>
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include "mykeystorelist.h"
20#include "myopenpgpcontext.h"
21#include "mypgpkeycontext.h"
22#include "qcaprovider.h"
23#include <QtPlugin>
24
25using namespace gpgQCAPlugin;
26
27class gnupgProvider : public QCA::Provider
28{
29public:
30 void init() override
31 {
32 }
33
34 int qcaVersion() const override
35 {
36 return QCA_VERSION;
37 }
38
39 QString name() const override
40 {
41 return QStringLiteral("qca-gnupg");
42 }
43
44 QStringList features() const override
45 {
46 QStringList list;
47 list += QStringLiteral("pgpkey");
48 list += QStringLiteral("openpgp");
49 list += QStringLiteral("keystorelist");
50 return list;
51 }
52
53 Context *createContext(const QString &type) override
54 {
55 if (type == QLatin1String("pgpkey"))
56 return new MyPGPKeyContext(this);
57 else if (type == QLatin1String("openpgp"))
58 return new MyOpenPGPContext(this);
59 else if (type == QLatin1String("keystorelist"))
60 return new MyKeyStoreList(this);
61 else
62 return nullptr;
63 }
64};
65
66class gnupgPlugin : public QObject, public QCAPlugin
67{
68 Q_OBJECT
69 Q_PLUGIN_METADATA(IID "com.affinix.qca.Plugin/1.0")
70 Q_INTERFACES(QCAPlugin)
71public:
72 QCA::Provider *createProvider() override
73 {
74 return new gnupgProvider;
75 }
76};
77
78#include "qca-gnupg.moc"
79

source code of qca/plugins/qca-gnupg/qca-gnupg.cpp