File indexing completed on 2025-01-05 04:55:50
0001 /* -*- c++ -*- 0002 newkeyapprovaldialog.h 0003 0004 This file is part of libkleopatra, the KDE keymanagement library 0005 SPDX-FileCopyrightText: 2018 Intevation GmbH 0006 SPDX-FileCopyrightText: 2021 g10 Code GmbH 0007 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de> 0008 0009 SPDX-License-Identifier: GPL-2.0-or-later 0010 */ 0011 0012 #pragma once 0013 0014 #include "kleo_export.h" 0015 0016 #include <Libkleo/KeyResolver> 0017 0018 #include <QDialog> 0019 0020 #include <memory> 0021 0022 namespace Kleo 0023 { 0024 0025 /** @brief A dialog to show for encryption / signing key approval or selection. 0026 * 0027 * This class is intended to replace the old KeyApprovalDialog with a new 0028 * and simpler interface. 0029 * 0030 * Resolved recipients in this API means a recipient could be resolved 0031 * to a single useful key. An unresolved recipient is a recipient for 0032 * whom no key could be found. Import / Search will be offered for such 0033 * a recipient. Multiple keys for signing / recipient can come e.g. from 0034 * group configuration or Addressbook / Identity configuration. 0035 * 0036 * The Dialog uses the Level System for validity display and shows an 0037 * overall outgoing level. 0038 * 0039 */ 0040 class KLEO_EXPORT NewKeyApprovalDialog : public QDialog 0041 { 0042 Q_OBJECT 0043 public: 0044 /** @brief Create a new Key Approval Dialog. 0045 * 0046 * @param sender: The address of the sender, this may be used if signing is not 0047 * specified to identify a recipient for which "Generate Key" should 0048 * be offered. 0049 * @param preferredSolution: The preferred signing and/or encryption keys for the sender 0050 * and the recipients. 0051 * @param alternativeSolution: An alternative set of signing and/or encryption keys for the sender 0052 * and the recipients. Typically, S/MIME-only, if preferred solution is OpenPGP-only, 0053 * and vice versa. Ignored, if mixed protocol selection is allowed. 0054 * @param allowMixed: Whether or not the dialog should allow mixed S/MIME / OpenPGP key selection. 0055 * @param forcedProtocol: A specific forced protocol. 0056 * @param parent: The parent widget. 0057 * @param f: The Qt window flags. 0058 */ 0059 explicit NewKeyApprovalDialog(bool encrypt, 0060 bool sign, 0061 const QString &sender, 0062 KeyResolver::Solution preferredSolution, 0063 KeyResolver::Solution alternativeSolution, 0064 bool allowMixed, 0065 GpgME::Protocol forcedProtocol, 0066 QWidget *parent = nullptr, 0067 Qt::WindowFlags f = Qt::WindowFlags()); 0068 0069 ~NewKeyApprovalDialog() override; 0070 0071 /** @brief The selected signing and/or encryption keys. Only valid after the dialog was accepted. */ 0072 KeyResolver::Solution result(); 0073 0074 private Q_SLOTS: 0075 void handleKeyGenResult(); 0076 0077 private: 0078 class Private; 0079 std::unique_ptr<Private> d; 0080 }; 0081 0082 } // namespace kleo