File indexing completed on 2024-06-16 04:56:16

0001 /*  view/openpgpkeycardwidget.h
0002 
0003     This file is part of Kleopatra, the KDE keymanager
0004     SPDX-FileCopyrightText: 2021, 2022 g10 Code GmbH
0005     SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
0006 
0007     SPDX-License-Identifier: GPL-2.0-or-later
0008 */
0009 #pragma once
0010 
0011 #include <QWidget>
0012 
0013 #include <memory>
0014 
0015 namespace Kleo
0016 {
0017 
0018 namespace SmartCard
0019 {
0020 class Card;
0021 }
0022 
0023 class OpenPGPKeyCardWidget : public QWidget
0024 {
0025     Q_OBJECT
0026 public:
0027     enum Action {
0028         NoAction = 0x00,
0029         CreateCSR = 0x01,
0030         GenerateKey = 0x02,
0031         AllActions = CreateCSR | GenerateKey,
0032     };
0033     Q_DECLARE_FLAGS(Actions, Action)
0034 
0035     explicit OpenPGPKeyCardWidget(QWidget *parent = nullptr);
0036     ~OpenPGPKeyCardWidget() override;
0037 
0038     void setAllowedActions(Actions actions);
0039 
0040 public Q_SLOTS:
0041     void update(const SmartCard::Card *card);
0042 
0043 Q_SIGNALS:
0044     void createCSRRequested(const std::string &keyRef);
0045     void generateKeyRequested(const std::string &keyRef);
0046 
0047 private:
0048     class Private;
0049     std::unique_ptr<Private> d;
0050 };
0051 
0052 Q_DECLARE_OPERATORS_FOR_FLAGS(OpenPGPKeyCardWidget::Actions)
0053 
0054 }