File indexing completed on 2024-06-23 05:13:36

0001 /*  commands/cardcommand.cpp
0002 
0003     This file is part of Kleopatra, the KDE keymanager
0004     SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB
0005     SPDX-FileCopyrightText: 2020 g10 Code GmbH
0006     SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
0007 
0008     SPDX-License-Identifier: GPL-2.0-or-later
0009 */
0010 
0011 #include "cardcommand.h"
0012 #include "cardcommand_p.h"
0013 
0014 #include <smartcard/readerstatus.h>
0015 
0016 #include <QWidget>
0017 
0018 using namespace Kleo;
0019 
0020 CardCommand::Private *CardCommand::d_func()
0021 {
0022     return static_cast<Private *>(d.get());
0023 }
0024 const CardCommand::Private *CardCommand::d_func() const
0025 {
0026     return static_cast<const Private *>(d.get());
0027 }
0028 
0029 #define d d_func()
0030 #define q q_func()
0031 
0032 CardCommand::Private::Private(CardCommand *qq, const std::string &serialNumber, QWidget *parent)
0033     : Command::Private(qq, parent)
0034     , serialNumber_(serialNumber)
0035 {
0036 }
0037 
0038 CardCommand::Private::~Private()
0039 {
0040 }
0041 
0042 void CardCommand::Private::doFinish()
0043 {
0044     if (autoResetCardToOpenPGP) {
0045         SmartCard::ReaderStatus::switchCardBackToOpenPGPApp(serialNumber());
0046     }
0047 }
0048 
0049 CardCommand::CardCommand(const std::string &serialNumber, QWidget *parent)
0050     : Command(new Private(this, serialNumber, parent))
0051 {
0052 }
0053 
0054 CardCommand::CardCommand(Private *pp)
0055     : Command(pp)
0056 {
0057 }
0058 
0059 CardCommand::~CardCommand()
0060 {
0061 }
0062 
0063 void CardCommand::setAutoResetCardToOpenPGP(bool autoReset)
0064 {
0065     d->autoResetCardToOpenPGP = autoReset;
0066 }
0067 
0068 bool CardCommand::autoResetCardToOpenPGP() const
0069 {
0070     return d->autoResetCardToOpenPGP;
0071 }
0072 
0073 #undef q_func
0074 #undef d_func
0075 
0076 #include "moc_cardcommand.cpp"