File indexing completed on 2024-06-23 05:13:53
0001 /* -*- mode: c++; c-basic-offset:4 -*- 0002 crypto/gui/signingcertificateselectiondialog.cpp 0003 0004 This file is part of Kleopatra, the KDE keymanager 0005 SPDX-FileCopyrightText: 2007 Klarälvdalens Datakonsult AB 0006 0007 SPDX-License-Identifier: GPL-2.0-or-later 0008 */ 0009 0010 #include <config-kleopatra.h> 0011 0012 #include "signingcertificateselectiondialog.h" 0013 0014 #include "signingcertificateselectionwidget.h" 0015 0016 #include "utils/certificatepair.h" 0017 0018 #include <KLocalizedString> 0019 0020 #include <QDialogButtonBox> 0021 #include <QPushButton> 0022 #include <QVBoxLayout> 0023 0024 using namespace Kleo; 0025 using namespace Kleo::Crypto::Gui; 0026 0027 SigningCertificateSelectionDialog::SigningCertificateSelectionDialog(QWidget *parent) 0028 : QDialog(parent) 0029 , widget(new SigningCertificateSelectionWidget(this)) 0030 { 0031 setWindowTitle(i18nc("@title:window", "Select Signing Certificates")); 0032 auto mainLayout = new QVBoxLayout(this); 0033 mainLayout->addWidget(widget); 0034 auto buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel, this); 0035 QPushButton *okButton = buttonBox->button(QDialogButtonBox::Ok); 0036 okButton->setDefault(true); 0037 okButton->setShortcut(Qt::CTRL | Qt::Key_Return); 0038 connect(buttonBox, &QDialogButtonBox::accepted, this, &SigningCertificateSelectionDialog::accept); 0039 connect(buttonBox, &QDialogButtonBox::rejected, this, &SigningCertificateSelectionDialog::reject); 0040 mainLayout->addWidget(buttonBox); 0041 } 0042 0043 SigningCertificateSelectionDialog::~SigningCertificateSelectionDialog() 0044 { 0045 } 0046 0047 void SigningCertificateSelectionDialog::setSelectedCertificates(const CertificatePair &certificates) 0048 { 0049 widget->setSelectedCertificates(certificates); 0050 } 0051 0052 CertificatePair SigningCertificateSelectionDialog::selectedCertificates() const 0053 { 0054 return widget->selectedCertificates(); 0055 } 0056 0057 bool SigningCertificateSelectionDialog::rememberAsDefault() const 0058 { 0059 return widget->rememberAsDefault(); 0060 } 0061 0062 void SigningCertificateSelectionDialog::setAllowedProtocols(const std::set<GpgME::Protocol> &allowedProtocols) 0063 { 0064 widget->setAllowedProtocols(allowedProtocols); 0065 } 0066 0067 #include "moc_signingcertificateselectiondialog.cpp"