File indexing completed on 2025-01-19 04:46:50

0001 /*
0002   SPDX-FileCopyrightText: 2016 Klarälvdalens Datakonsult AB, a KDAB Group company <info@kdab.net>
0003 
0004    SPDX-License-Identifier: LGPL-2.0-or-later
0005 */
0006 
0007 #include "plugin.h"
0008 
0009 #include "gnupgwksformatter.h"
0010 #include "gnupgwksurlhandler.h"
0011 #include "pgpkeyformatter.h"
0012 #include "pgpkeyurlhandler.h"
0013 
0014 namespace
0015 {
0016 enum Index {
0017     application_pgp_keys,
0018     application_vnd_gnupg_keys,
0019     multipart_mixed,
0020 };
0021 }
0022 
0023 const MimeTreeParser::Interface::BodyPartFormatter *ApplicationGnuPGWKSPlugin::bodyPartFormatter(int idx) const
0024 {
0025     switch (idx) {
0026     case multipart_mixed:
0027     case application_vnd_gnupg_keys:
0028         return new ApplicationGnuPGWKSFormatter();
0029     case application_pgp_keys:
0030         return new ApplicationPGPKeyFormatter();
0031     default:
0032         return nullptr;
0033     }
0034 }
0035 
0036 MessageViewer::MessagePartRendererBase *ApplicationGnuPGWKSPlugin::renderer(int idx)
0037 {
0038     switch (idx) {
0039     case multipart_mixed:
0040     case application_vnd_gnupg_keys:
0041         return new ApplicationGnuPGWKSFormatter();
0042     case application_pgp_keys:
0043         return new ApplicationPGPKeyFormatter();
0044     default:
0045         return nullptr;
0046     }
0047 }
0048 
0049 const MessageViewer::Interface::BodyPartURLHandler *ApplicationGnuPGWKSPlugin::urlHandler(int idx) const
0050 {
0051     switch (idx) {
0052     case multipart_mixed:
0053     case application_vnd_gnupg_keys:
0054         return new ApplicationGnuPGWKSUrlHandler();
0055     case application_pgp_keys:
0056         return new ApplicationPgpKeyUrlHandler();
0057     default:
0058         return nullptr;
0059     }
0060 }
0061 
0062 #include "moc_plugin.cpp"