File indexing completed on 2025-01-05 04:55:48

0001 /*  -*- c++ -*-
0002     keyapprovaldialog.h
0003 
0004     This file is part of libkleopatra, the KDE keymanagement library
0005     SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB
0006 
0007     Based on kpgpui.h
0008     SPDX-FileCopyrightText: 2001, 2002 the KPGP authors
0009     See file libkdenetwork/AUTHORS.kpgp for details
0010 
0011     SPDX-License-Identifier: GPL-2.0-or-later
0012 */
0013 
0014 #pragma once
0015 
0016 #include "kleo_export.h"
0017 
0018 #include <Libkleo/Enum>
0019 
0020 #include <QDialog>
0021 
0022 #include <gpgme++/key.h>
0023 
0024 #include <vector>
0025 
0026 namespace GpgME
0027 {
0028 class Key;
0029 }
0030 
0031 namespace Kleo
0032 {
0033 
0034 class KLEO_EXPORT KeyApprovalDialog : public QDialog
0035 {
0036     Q_OBJECT
0037 public:
0038     struct Item {
0039         Item()
0040             : pref(UnknownPreference)
0041         {
0042         }
0043         Item(const QString &a, const std::vector<GpgME::Key> &k, EncryptionPreference p = UnknownPreference)
0044             : address(a)
0045             , keys(k)
0046             , pref(p)
0047         {
0048         }
0049         QString address;
0050         std::vector<GpgME::Key> keys;
0051         EncryptionPreference pref;
0052     };
0053 
0054     KeyApprovalDialog(const std::vector<Item> &recipients, const std::vector<GpgME::Key> &sender, QWidget *parent = nullptr);
0055     ~KeyApprovalDialog() override;
0056 
0057     std::vector<Item> items() const;
0058     std::vector<GpgME::Key> senderKeys() const;
0059 
0060     bool preferencesChanged() const;
0061 
0062 private Q_SLOTS:
0063     void slotPrefsChanged();
0064 
0065 private:
0066     class KeyApprovalDialogPrivate;
0067     std::unique_ptr<KeyApprovalDialogPrivate> const d;
0068 };
0069 
0070 } // namespace Kleo