Page MenuHome GnuPG

No OneTemporary

diff --git a/src/view/netkeywidget.cpp b/src/view/netkeywidget.cpp
index 0614d05e6..6e6bb5e00 100644
--- a/src/view/netkeywidget.cpp
+++ b/src/view/netkeywidget.cpp
@@ -1,61 +1,60 @@
/* view/netkeywidget.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2017 Intevation GmbH
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "netkeywidget.h"
#include "cardkeysview.h"
#include "smartcardactions.h"
#include "kleopatra_debug.h"
#include "smartcard/netkeycard.h"
#include <KLocalizedString>
#include <KMessageWidget>
#include <QIcon>
using namespace Kleo;
using namespace Kleo::SmartCard;
using namespace Qt::Literals::StringLiterals;
NetKeyWidget::NetKeyWidget(QWidget *parent)
: SmartCardWidget(AppType::NetKeyApp, parent)
{
- addCardKeysView();
}
NetKeyWidget::~NetKeyWidget() = default;
void NetKeyWidget::setCard(const NetKeyCard *card)
{
SmartCardWidget::setCard(card);
/* Only check for the standard NKS NullPIN.
* According to users of NetKey cards it is fairly uncommon to use SigG certificates at all.
* So it should be optional to set the SigG pins. */
auto nullPinWidget = nullPinMessageWidget();
if (card->hasNKSNullPin()) {
nullPinWidget->setMessageType(KMessageWidget::Information);
nullPinWidget->setIcon(QIcon::fromTheme(u"data-information"_s));
const auto nullTitle = i18nc(
"NullPIN is a word that is used all over in the netkey "
"documentation and should be understandable by Netkey cardholders",
"The NullPIN is still active on this card.");
const auto nullDescription = i18n("You need to set a PIN before you can use the certificates.");
nullPinWidget->setText(QStringLiteral("<b>%1</b><br/>%2").arg(nullTitle, nullDescription));
nullPinWidget->setCloseButtonVisible(false);
if (nullPinWidget->actions().isEmpty()) {
nullPinWidget->addAction(SmartCardActions::createProxyAction(SmartCardActions::instance()->action(u"card_netkey_set_nks_pin"_s), nullPinWidget));
}
nullPinWidget->setVisible(true);
} else {
nullPinWidget->setVisible(false);
}
}
#include "moc_netkeywidget.cpp"
diff --git a/src/view/p15cardwidget.cpp b/src/view/p15cardwidget.cpp
index 8ee25b9a9..c24a824ff 100644
--- a/src/view/p15cardwidget.cpp
+++ b/src/view/p15cardwidget.cpp
@@ -1,105 +1,104 @@
/* view/p15cardwiget.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2021 g10 Code GmbH
SPDX-FileContributor: Andre Heinecke <aheinecke@g10code.com>
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "p15cardwidget.h"
#include "cardkeysview.h"
#include "settings.h"
#include "smartcard/openpgpcard.h"
#include "smartcard/p15card.h"
#include "smartcard/readerstatus.h"
#include <QLabel>
#include <QPushButton>
#include <QStringList>
#include <QVBoxLayout>
#include <KLocalizedString>
#include <KSeparator>
#include <Libkleo/Compat>
#include <Libkleo/Formatting>
#include <Libkleo/GnuPG>
#include <Libkleo/KeyCache>
#include <QGpgME/CryptoConfig>
#include <QGpgME/ImportFromKeyserverJob>
#include <QGpgME/KeyListJob>
#include <QGpgME/Protocol>
#include <gpgme++/importresult.h>
#include <gpgme++/keylistresult.h>
#include "kleopatra_debug.h"
using namespace Kleo;
using namespace Kleo::SmartCard;
P15CardWidget::P15CardWidget(QWidget *parent)
: SmartCardWidget{AppType::P15App, parent}
{
- addCardKeysView();
}
P15CardWidget::~P15CardWidget() = default;
void P15CardWidget::searchPGPFpr(const std::string &fpr)
{
/* Only do auto import from LDAP */
if (!Settings().alwaysSearchCardOnKeyserver() && !Kleo::keyserver().startsWith(QLatin1StringView{"ldap"})) {
return;
}
statusLabel()->setText(i18n("Searching in directory service..."));
statusLabel()->setVisible(true);
qCDebug(KLEOPATRA_LOG) << "Looking for:" << fpr.c_str() << "on ldap server";
QGpgME::KeyListJob *job = QGpgME::openpgp()->keyListJob(true);
connect(job, &QGpgME::KeyListJob::result, job, [this](GpgME::KeyListResult, std::vector<GpgME::Key> keys, QString, GpgME::Error) {
if (keys.size() == 1) {
auto importJob = QGpgME::openpgp()->importFromKeyserverJob();
qCDebug(KLEOPATRA_LOG) << "Importing: " << keys[0].primaryFingerprint();
connect(importJob, &QGpgME::ImportFromKeyserverJob::result, importJob, [this](GpgME::ImportResult, QString, GpgME::Error) {
qCDebug(KLEOPATRA_LOG) << "import job done";
statusLabel()->setText(i18n("Automatic import finished."));
});
importJob->start(keys);
} else if (keys.size() > 1) {
qCDebug(KLEOPATRA_LOG) << "Multiple keys found on server";
statusLabel()->setText(i18n("Error multiple keys found on server."));
} else {
qCDebug(KLEOPATRA_LOG) << "No key found";
statusLabel()->setText(i18n("Key not found in directory service."));
}
});
job->start(QStringList() << QString::fromStdString(fpr));
}
void P15CardWidget::setCard(const P15Card *card)
{
SmartCardWidget::setCard(card);
const auto sigInfo = card->keyInfo(card->signingKeyRef());
if (!sigInfo.grip.empty()) {
const auto key = KeyCache::instance()->findSubkeyByKeyGrip(sigInfo.grip, GpgME::OpenPGP).parent();
if (key.isNull()) {
qCDebug(KLEOPATRA_LOG) << "Failed to find key for grip:" << sigInfo.grip.c_str();
const auto pgpSigFpr = card->keyFingerprint(OpenPGPCard::pgpSigKeyRef());
if (!pgpSigFpr.empty()) {
qCDebug(KLEOPATRA_LOG) << "Should be pgp key:" << pgpSigFpr.c_str();
searchPGPFpr(pgpSigFpr);
}
} else {
statusLabel()->setVisible(false);
}
}
}
#include "moc_p15cardwidget.cpp"
diff --git a/src/view/pgpcardwidget.cpp b/src/view/pgpcardwidget.cpp
index ecfd50eeb..1e627def6 100644
--- a/src/view/pgpcardwidget.cpp
+++ b/src/view/pgpcardwidget.cpp
@@ -1,30 +1,24 @@
/* view/pgpcardwiget.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik
SPDX-FileContributor: Intevation GmbH
SPDX-FileCopyrightText: 2020, 2022 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "pgpcardwidget.h"
-#include "smartcard/openpgpcard.h"
+#include <smartcard/card.h>
using namespace Kleo;
using namespace Kleo::SmartCard;
PGPCardWidget::PGPCardWidget(QWidget *parent)
: SmartCardWidget(AppType::OpenPGPApp, parent)
{
- addCardKeysView();
-}
-
-void PGPCardWidget::setCard(const OpenPGPCard *card)
-{
- SmartCardWidget::setCard(card);
}
#include "moc_pgpcardwidget.cpp"
diff --git a/src/view/pgpcardwidget.h b/src/view/pgpcardwidget.h
index 6da4449d3..8ba1bdcfe 100644
--- a/src/view/pgpcardwidget.h
+++ b/src/view/pgpcardwidget.h
@@ -1,30 +1,23 @@
/* view/pgpcardwiget.h
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2017 Bundesamt für Sicherheit in der Informationstechnik
SPDX-FileContributor: Intevation GmbH
SPDX-FileCopyrightText: 2020, 2022 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include "smartcardwidget.h"
namespace Kleo
{
-namespace SmartCard
-{
-class OpenPGPCard;
-} // namespace SmartCard
-
class PGPCardWidget : public SmartCardWidget
{
Q_OBJECT
public:
explicit PGPCardWidget(QWidget *parent = nullptr);
-
- void setCard(const SmartCard::OpenPGPCard *card);
};
} // namespace Kleo
diff --git a/src/view/pivcardwidget.cpp b/src/view/pivcardwidget.cpp
index f33b74689..5e38f9bc7 100644
--- a/src/view/pivcardwidget.cpp
+++ b/src/view/pivcardwidget.cpp
@@ -1,29 +1,24 @@
/* view/pivcardwiget.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2020 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "pivcardwidget.h"
-#include "cardkeysview.h"
-
#include <smartcard/card.h>
-#include <QVBoxLayout>
-
using namespace Kleo;
using namespace Kleo::SmartCard;
PIVCardWidget::PIVCardWidget(QWidget *parent)
: SmartCardWidget(AppType::PIVApp, parent)
{
- addCardKeysView();
}
PIVCardWidget::~PIVCardWidget() = default;
#include "moc_pivcardwidget.cpp"
diff --git a/src/view/smartcardwidget.cpp b/src/view/smartcardwidget.cpp
index 2ee10aa47..c332b026c 100644
--- a/src/view/smartcardwidget.cpp
+++ b/src/view/smartcardwidget.cpp
@@ -1,383 +1,375 @@
/* view/smartcardwidget.cpp
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2024 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#include "smartcardwidget.h"
#include "infofield.h"
#include "smartcardactions.h"
#include <smartcard/card.h>
#include <smartcard/netkeycard.h>
#include <smartcard/pivcard.h>
#include <utils/accessibility.h>
#include <view/cardkeysview.h>
#include <Libkleo/Compliance>
#include <KLocalizedString>
#include <KMessageWidget>
#include <QGridLayout>
#include <QLabel>
#include <QMenu>
#include <QScrollArea>
#include <QToolButton>
#include <QVBoxLayout>
using namespace Kleo;
using namespace Kleo::SmartCard;
using namespace Qt::Literals::StringLiterals;
static QString cardTypeForDisplay(const Card *card)
{
switch (card->appType()) {
case AppType::NetKeyApp:
return i18nc("1 is a Version number", "NetKey v%1 Card", card->appVersion());
case AppType::OpenPGPApp: {
const std::string manufacturer = card->manufacturer();
const bool manufacturerIsUnknown = manufacturer.empty() || manufacturer == "unknown";
return (manufacturerIsUnknown //
? i18nc("Placeholder is a version number", "Unknown OpenPGP v%1 card", card->displayAppVersion())
: i18nc("First placeholder is manufacturer, second placeholder is a version number",
"%1 OpenPGP v%2 card",
QString::fromStdString(manufacturer),
card->displayAppVersion()));
}
case AppType::P15App:
return i18nc("%1 is a smartcard manufacturer", "%1 PKCS#15 card", QString::fromStdString(card->manufacturer()));
case AppType::PIVApp:
return i18nc("%1 version number", "PIV v%1 card", card->displayAppVersion());
default:
return {};
};
}
static std::vector<QAction *> actionsForCard(SmartCard::AppType appType)
{
std::vector<QString> actions;
switch (appType) {
case AppType::NetKeyApp:
actions = {
u"card_all_create_openpgp_certificate"_s,
u"card_netkey_set_nks_pin"_s,
u"card_netkey_set_sigg_pin"_s,
};
break;
case AppType::OpenPGPApp:
actions = {
u"card_pgp_generate_keys_and_certificate"_s,
u"card_pgp_change_pin"_s,
u"card_pgp_unblock_card"_s,
u"card_pgp_change_admin_pin"_s,
u"card_pgp_change_puk"_s,
u"card_pgp_change_cardholder"_s,
u"card_pgp_change_publickeyurl"_s,
};
break;
case AppType::P15App:
// there are no card actions for generic PKCS#15 cards
break;
case AppType::PIVApp:
actions = {
u"card_all_create_openpgp_certificate"_s,
u"card_piv_change_pin"_s,
u"card_piv_change_puk"_s,
u"card_piv_change_admin_key"_s,
};
break;
case AppType::NoApp:
break;
};
return SmartCardActions::instance()->actions(actions);
}
static void updateCardAction(QAction *action, const Card *card)
{
switch (card->appType()) {
case AppType::NetKeyApp: {
if (card->pinStates().empty()) {
action->setEnabled(false);
return;
}
auto netKeyCard = static_cast<const NetKeyCard *>(card);
if (action->objectName() == "card_all_create_openpgp_certificate"_L1) {
action->setEnabled(!netKeyCard->hasNKSNullPin() && card->hasSigningKey() && card->hasEncryptionKey()
&& DeVSCompliance::algorithmIsCompliant(card->keyInfo(card->signingKeyRef()).algorithm)
&& DeVSCompliance::algorithmIsCompliant(card->keyInfo(card->encryptionKeyRef()).algorithm));
} else if (action->objectName() == "card_netkey_set_nks_pin"_L1) {
if (!netKeyCard->hasNKSNullPin()) {
action->setText(i18nc("@action NKS is an identifier for a type of keys on a NetKey card", "Change NKS PIN"));
}
} else if (action->objectName() == "card_netkey_set_sigg_pin"_L1) {
if (!netKeyCard->hasSigGNullPin()) {
action->setText(i18nc("@action SigG is an identifier for a type of keys on a NetKey card", "Change SigG PIN"));
}
}
break;
}
case AppType::OpenPGPApp:
if (action->objectName() == "card_pgp_change_puk"_L1) {
const auto pinCounters = card->pinCounters();
const bool pukIsAvailable = (pinCounters.size() == 3) && (pinCounters[1] > 0);
action->setText(pukIsAvailable ? i18nc("@action", "Change PUK") : i18nc("@action", "Set PUK"));
}
break;
case AppType::P15App:
break;
case AppType::PIVApp: {
if (action->objectName() == "card_all_create_openpgp_certificate"_L1) {
action->setEnabled(card->hasSigningKey() && card->hasEncryptionKey()
&& DeVSCompliance::algorithmIsCompliant(card->keyInfo(card->signingKeyRef()).algorithm)
&& DeVSCompliance::algorithmIsCompliant(card->keyInfo(card->encryptionKeyRef()).algorithm));
}
break;
}
case AppType::NoApp:
break;
};
}
static void updateCardActions(QToolButton *actionsButton, const Card *card)
{
if (!actionsButton->menu()) {
const auto actions = actionsForCard(card->appType());
if (actions.empty()) {
// there are no card actions for this card app
return;
} else {
actionsButton->setVisible(true);
}
auto menu = new QMenu{actionsButton};
for (auto action : actions) {
menu->addAction(SmartCardActions::createProxyAction(action, menu));
}
actionsButton->setMenu(menu);
}
for (auto action : actionsButton->menu()->actions()) {
updateCardAction(action, card);
}
}
SmartCardWidget::SmartCardWidget(Kleo::SmartCard::AppType appType, QWidget *parent)
: QWidget{parent}
, mAppType{appType}
{
auto mainLayout = new QVBoxLayout{this};
mainLayout->setContentsMargins({});
auto area = new QScrollArea{this};
area->setFocusPolicy(Qt::NoFocus);
area->setFrameShape(QFrame::NoFrame);
area->setWidgetResizable(true);
mainLayout->addWidget(area);
auto areaWidget = new QWidget{this};
area->setWidget(areaWidget);
- mContentLayout = new QVBoxLayout{areaWidget};
- auto contentLayout = mContentLayout;
+ auto contentLayout = new QVBoxLayout{areaWidget};
auto upperLayout = new QHBoxLayout;
{
- // auto gridLayout = new QGridLayout;
- mInfoGridLayout = new QGridLayout;
- auto gridLayout = mInfoGridLayout;
- // gridLayout->setColumnStretch(1, 1);
+ auto gridLayout = new QGridLayout;
+ gridLayout->setColumnStretch(1, 1);
int row = -1;
row++;
mCardTypeField = std::make_unique<InfoField>(i18nc("@label", "Card type:"), parent);
gridLayout->addWidget(mCardTypeField->label(), row, 0);
gridLayout->addLayout(mCardTypeField->layout(), row, 1);
row++;
mSerialNumberField = std::make_unique<InfoField>(i18nc("@label", "Serial number:"), parent);
gridLayout->addWidget(mSerialNumberField->label(), row, 0);
gridLayout->addLayout(mSerialNumberField->layout(), row, 1);
if (mAppType == AppType::OpenPGPApp) {
row++;
mCardholderField =
std::make_unique<InfoField>(i18nc("@label The owner of a smartcard. GnuPG refers to this as cardholder.", "Cardholder:"), parent);
const auto action = SmartCardActions::createProxyAction(SmartCardActions::instance()->action(u"card_pgp_change_cardholder"_s), parent);
action->setIcon(QIcon::fromTheme(u"document-edit"_s));
Kleo::setAccessibleName(action, action->text());
action->setText({});
mCardholderField->setAction(action);
gridLayout->addWidget(mCardholderField->label(), row, 0);
gridLayout->addLayout(mCardholderField->layout(), row, 1);
}
if (mAppType == AppType::OpenPGPApp) {
row++;
mPublicKeyUrlField = std::make_unique<InfoField>(i18nc("@label", "Public key URL:"), parent);
// make the public key URL clickable
mPublicKeyUrlField->valueLabel()->setTextInteractionFlags(Qt::TextBrowserInteraction);
mPublicKeyUrlField->valueLabel()->setOpenExternalLinks(true);
const auto action = SmartCardActions::createProxyAction(SmartCardActions::instance()->action(u"card_pgp_change_publickeyurl"_s), parent);
action->setIcon(QIcon::fromTheme(u"document-edit"_s));
Kleo::setAccessibleName(action, action->text());
action->setText({});
mPublicKeyUrlField->setAction(action);
gridLayout->addWidget(mPublicKeyUrlField->label(), row, 0);
gridLayout->addLayout(mPublicKeyUrlField->layout(), row, 1);
}
if (mAppType == AppType::OpenPGPApp) {
row++;
mPinCountersField = std::make_unique<InfoField>(i18nc("@label The number of remaining attempts to enter a PIN or PUK, as in "
"Remaining attempts: PIN: 2, PUK: 3, Admin PIN: 3",
"Remaining attempts:"),
parent);
mPinCountersField->setToolTip(xi18nc("@info:tooltip", "Shows the number of remaining attempts for entering the correct PIN or PUK."));
gridLayout->addWidget(mPinCountersField->label(), row, 0);
gridLayout->addLayout(mPinCountersField->layout(), row, 1);
}
- gridLayout->setColumnStretch(gridLayout->columnCount(), 1);
-
upperLayout->addLayout(gridLayout, 1);
}
{
auto layout = new QVBoxLayout;
mCardActionsButton = new QToolButton{this};
mCardActionsButton->setPopupMode(QToolButton::InstantPopup);
mCardActionsButton->setText(i18nc("@action:button", "Card Actions"));
mCardActionsButton->setToolTip(i18nc("@info", "Show actions available for this smart card"));
mCardActionsButton->setVisible(false);
layout->addWidget(mCardActionsButton);
layout->addStretch(1);
upperLayout->addLayout(layout);
}
contentLayout->addLayout(upperLayout);
-}
-void SmartCardWidget::addCardKeysView()
-{
if (mAppType == AppType::NetKeyApp) {
mNullPinWidget = new KMessageWidget{this};
mNullPinWidget->setVisible(false);
- mContentLayout->addWidget(mNullPinWidget);
+ contentLayout->addWidget(mNullPinWidget);
} else if (mAppType == AppType::P15App) {
mStatusLabel = new QLabel{this};
mStatusLabel->setVisible(false);
- mContentLayout->addWidget(mStatusLabel);
+ contentLayout->addWidget(mStatusLabel);
}
mErrorWidget = new KMessageWidget{this};
mErrorWidget->setVisible(false);
- mContentLayout->addWidget(mErrorWidget);
+ contentLayout->addWidget(mErrorWidget);
Q_ASSERT(!mCardKeysView);
switch (mAppType) {
case AppType::NetKeyApp:
// do not show Created column by default; creation time is not reported by scdaemon for NetKey cards
mCardKeysView = new CardKeysView{this, CardKeysView::NoOptions};
break;
case AppType::OpenPGPApp:
case AppType::P15App:
mCardKeysView = new CardKeysView{this, CardKeysView::ShowCreated};
break;
case AppType::PIVApp:
// do not show Created column by default; creation time is not reported by scdaemon for PIV cards
mCardKeysView = new CardKeysView{this, CardKeysView::NoOptions};
break;
case AppType::NoApp:
return;
};
- mContentLayout->addWidget(mCardKeysView, 1);
+ contentLayout->addWidget(mCardKeysView, 1);
}
SmartCardWidget::~SmartCardWidget() = default;
void SmartCardWidget::setCard(const Card *card)
{
Q_ASSERT(mAppType == card->appType());
mCard.reset(card->clone());
mCardTypeField->setValue(cardTypeForDisplay(card));
mSerialNumberField->setValue(card->displaySerialNumber());
if (mAppType == AppType::OpenPGPApp) {
const auto holder = card->cardHolder();
mCardholderField->setValue(holder.isEmpty() ? ("<em>"_L1 + i18n("not set") + "</em>"_L1) : holder);
const auto url = card->publicKeyUrl();
mPublicKeyUrlField->setValue(url.isEmpty() //
? ("<em>"_L1 + i18n("not set") + "</em>"_L1)
: u"<a href=\"%1\">%1</a>"_s.arg(url.toHtmlEscaped()));
const auto pinLabels = card->pinLabels();
const auto pinCounters = card->pinCounters();
QStringList countersWithLabels;
countersWithLabels.reserve(pinCounters.size());
for (const auto &pinCounter : pinCounters) {
// sanity check
if (countersWithLabels.size() == pinLabels.size()) {
break;
}
countersWithLabels.push_back(i18nc("label: value", "%1: %2", pinLabels[countersWithLabels.size()], pinCounter));
}
mPinCountersField->setValue(countersWithLabels.join(", "_L1));
}
updateCardActions(mCardActionsButton, card);
const auto errMsg = card->errorMsg();
if (!errMsg.isEmpty()) {
mErrorWidget->setMessageType(KMessageWidget::Error);
mErrorWidget->setCloseButtonVisible(false);
mErrorWidget->setText(i18nc("@info", "Error: %1", errMsg));
mErrorWidget->setVisible(true);
} else {
mErrorWidget->setVisible(false);
}
mCardKeysView->setCard(mCard);
}
const Kleo::SmartCard::Card *SmartCardWidget::card() const
{
return mCard.get();
}
Kleo::SmartCard::AppType SmartCardWidget::cardType() const
{
return mCard ? mCard->appType() : AppType::NoApp;
}
std::string SmartCardWidget::serialNumber() const
{
return mCard ? mCard->serialNumber() : std::string{};
}
std::string SmartCardWidget::currentCardSlot() const
{
if (mCardKeysView) {
return mCardKeysView->currentCardSlot();
}
return {};
}
GpgME::Key SmartCardWidget::currentCertificate() const
{
if (mCardKeysView) {
return mCardKeysView->currentCertificate();
}
return {};
}
KMessageWidget *SmartCardWidget::nullPinMessageWidget() const
{
return mNullPinWidget;
}
QLabel *SmartCardWidget::statusLabel() const
{
return mStatusLabel;
}
diff --git a/src/view/smartcardwidget.h b/src/view/smartcardwidget.h
index 8f1498933..8c420f24c 100644
--- a/src/view/smartcardwidget.h
+++ b/src/view/smartcardwidget.h
@@ -1,78 +1,73 @@
/* view/smartcardwidget.h
This file is part of Kleopatra, the KDE keymanager
SPDX-FileCopyrightText: 2024 g10 Code GmbH
SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#include <QWidget>
#include <memory>
#include <string>
class KMessageWidget;
class QGridLayout;
class QLabel;
class QToolButton;
class QVBoxLayout;
namespace GpgME
{
class Key;
}
namespace Kleo
{
class CardKeysView;
class InfoField;
}
namespace Kleo::SmartCard
{
enum class AppType;
class Card;
}
class SmartCardWidget : public QWidget
{
Q_OBJECT
protected:
SmartCardWidget(Kleo::SmartCard::AppType appType, QWidget *parent = nullptr);
- void addCardKeysView();
public:
~SmartCardWidget() override;
void setCard(const Kleo::SmartCard::Card *card);
const Kleo::SmartCard::Card *card() const;
Kleo::SmartCard::AppType cardType() const;
std::string serialNumber() const;
std::string currentCardSlot() const;
GpgME::Key currentCertificate() const;
protected:
KMessageWidget *nullPinMessageWidget() const;
QLabel *statusLabel() const;
-protected:
- QVBoxLayout *mContentLayout = nullptr;
- QGridLayout *mInfoGridLayout = nullptr;
-
private:
Kleo::SmartCard::AppType mAppType;
std::shared_ptr<const Kleo::SmartCard::Card> mCard;
std::unique_ptr<Kleo::InfoField> mCardTypeField;
std::unique_ptr<Kleo::InfoField> mSerialNumberField;
std::unique_ptr<Kleo::InfoField> mCardholderField;
std::unique_ptr<Kleo::InfoField> mPublicKeyUrlField;
std::unique_ptr<Kleo::InfoField> mPinCountersField;
QToolButton *mCardActionsButton = nullptr;
KMessageWidget *mNullPinWidget = nullptr;
QLabel *mStatusLabel = nullptr;
KMessageWidget *mErrorWidget = nullptr;
Kleo::CardKeysView *mCardKeysView = nullptr;
};

File Metadata

Mime Type
text/x-diff
Expires
Tue, Jul 8, 12:31 PM (21 h, 38 m)
Storage Engine
local-disk
Storage Format
Raw Data
Storage Handle
a1/8b/e18d922e82afc23d705517c59167

Event Timeline