Changeset View
Changeset View
Standalone View
Standalone View
plugins/messageviewer/bodypartformatter/gnupgwks/plugin.cpp
- This file was added.
1 | /* | ||||
---|---|---|---|---|---|
2 | Copyright (c) 2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net> | ||||
3 | | ||||
4 | This library is free software; you can redistribute it and/or modify it | ||||
5 | under the terms of the GNU Library General Public License as published by | ||||
6 | the Free Software Foundation; either version 2 of the License, or (at your | ||||
7 | option) any later version. | ||||
8 | | ||||
9 | This library is distributed in the hope that it will be useful, but WITHOUT | ||||
10 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||||
11 | FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public | ||||
12 | License for more details. | ||||
13 | | ||||
14 | You should have received a copy of the GNU Library General Public License | ||||
15 | along with this library; see the file COPYING.LIB. If not, write to the | ||||
16 | Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA | ||||
17 | 02110-1301, USA. | ||||
18 | */ | ||||
19 | | ||||
20 | #include "plugin.h" | ||||
21 | | ||||
22 | #include "gnupgwksformatter.h" | ||||
23 | #include "gnupgwksurlhandler.h" | ||||
24 | #include "pgpkeyformatter.h" | ||||
25 | #include "pgpkeyurlhandler.h" | ||||
26 | | ||||
27 | namespace { | ||||
28 | enum Index { | ||||
29 | application_vnd_gnupg_keys, | ||||
30 | application_pgp_keys | ||||
31 | }; | ||||
32 | } | ||||
33 | | ||||
34 | const char *ApplicationGnuPGWKSPlugin::type(int idx) const | ||||
35 | { | ||||
36 | switch (idx) { | ||||
37 | case application_vnd_gnupg_keys: | ||||
38 | case application_pgp_keys: | ||||
39 | return "application"; | ||||
40 | default: | ||||
41 | return Q_NULLPTR; | ||||
42 | } | ||||
43 | } | ||||
44 | | ||||
45 | const char *ApplicationGnuPGWKSPlugin::subtype(int idx) const | ||||
46 | { | ||||
47 | switch (idx) { | ||||
48 | case application_vnd_gnupg_keys: | ||||
49 | return "vnd.gnupg.wks"; | ||||
50 | case application_pgp_keys: | ||||
51 | return "pgp-keys"; | ||||
52 | default: | ||||
53 | return Q_NULLPTR; | ||||
54 | } | ||||
55 | } | ||||
56 | | ||||
57 | | ||||
58 | const MimeTreeParser::Interface::BodyPartFormatter *ApplicationGnuPGWKSPlugin::bodyPartFormatter(int idx) const | ||||
59 | { | ||||
60 | switch (idx) { | ||||
61 | case application_vnd_gnupg_keys: | ||||
62 | return new ApplicationGnuPGWKSFormatter(); | ||||
63 | case application_pgp_keys: | ||||
64 | return new ApplicationPGPKeyFormatter(); | ||||
65 | default: | ||||
66 | return Q_NULLPTR; | ||||
67 | } | ||||
68 | } | ||||
69 | | ||||
70 | const MimeTreeParser::Interface::BodyPartURLHandler *ApplicationGnuPGWKSPlugin::urlHandler(int idx) const | ||||
71 | { | ||||
72 | switch (idx) { | ||||
73 | case application_vnd_gnupg_keys: | ||||
74 | return new ApplicationGnuPGWKSUrlHandler(); | ||||
75 | case application_pgp_keys: | ||||
76 | return new ApplicationPgpKeyUrlHandler(); | ||||
77 | default: | ||||
78 | return Q_NULLPTR; | ||||
79 | } | ||||
80 | } | ||||
81 | | ||||
82 | | ||||
83 | extern "C" | ||||
84 | Q_DECL_EXPORT MimeTreeParser::Interface::BodyPartFormatterPlugin * | ||||
85 | messageviewer_bodypartformatter_application_gnupgwks_create_bodypart_formatter_plugin() | ||||
86 | { | ||||
87 | return new ApplicationGnuPGWKSPlugin(); | ||||
88 | } |