1 /* view/pgpcardwiget.h 2 3 This file is part of Kleopatra, the KDE keymanager 4 SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik 5 SPDX-FileContributor: Intevation GmbH 6 SPDX-FileCopyrightText: 2020 g10 Code GmbH 7 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de> 8 9 SPDX-License-Identifier: GPL-2.0-or-later 10 */ 11 #pragma once 12 13 #include "commands/changepincommand.h" 14 15 #include <QMap> 16 #include <QWidget> 17 18 #include <gpgme++/error.h> 19 20 #include <string> 21 22 class QLabel; 23 class QPushButton; 24 25 namespace Kleo 26 { 27 class GenCardKeyDialog; 28 class OpenPGPKeyCardWidget; 29 30 namespace SmartCard 31 { 32 struct KeyPairInfo; 33 class OpenPGPCard; 34 } // namespace SmartCard 35 36 class PGPCardWidget: public QWidget 37 { 38 Q_OBJECT 39 public: 40 explicit PGPCardWidget(QWidget *parent = nullptr); 41 42 void setCard(const SmartCard::OpenPGPCard* card); 43 void doGenKey(GenCardKeyDialog *dlg); 44 void genKeyDone(const GpgME::Error &err, const std::string &backup); 45 46 public Q_SLOTS: 47 void genkeyRequested(); 48 void changeNameRequested(); 49 void changeNameResult(const GpgME::Error &err); 50 void changeUrlRequested(); 51 void changeUrlResult(const GpgME::Error &err); 52 void createKeyFromCardKeys(); 53 void createCSR(const std::string &keyref); 54 55 private: 56 void doChangePin(const std::string &keyRef, Commands::ChangePinCommand::ChangePinMode mode = Commands::ChangePinCommand::NormalMode); 57 58 private: 59 QLabel *mSerialNumber = nullptr, 60 *mCardHolderLabel = nullptr, 61 *mVersionLabel = nullptr, 62 *mUrlLabel = nullptr; 63 QPushButton *mKeyForCardKeysButton = nullptr; 64 OpenPGPKeyCardWidget *mKeysWidget = nullptr; 65 QString mUrl; 66 bool mCardIsEmpty = false; 67 bool mIs21 = false; 68 std::string mRealSerial; 69 }; 70 } // namespace Kleo 71 72