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

0001 /* -*- mode: c++; c-basic-offset:4 -*-
0002     crypto/gui/resolverecipientspage.h
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 #pragma once
0011 
0012 #include <crypto/gui/wizardpage.h>
0013 
0014 #include <utils/pimpl_ptr.h>
0015 
0016 #include <gpgme++/global.h>
0017 
0018 #include <memory>
0019 #include <vector>
0020 
0021 namespace GpgME
0022 {
0023 class Key;
0024 }
0025 
0026 namespace KMime
0027 {
0028 namespace Types
0029 {
0030 class Mailbox;
0031 }
0032 }
0033 
0034 namespace Kleo
0035 {
0036 namespace Crypto
0037 {
0038 
0039 class RecipientPreferences;
0040 
0041 namespace Gui
0042 {
0043 
0044 class ResolveRecipientsPage : public WizardPage
0045 {
0046     Q_OBJECT
0047 public:
0048     explicit ResolveRecipientsPage(QWidget *parent = nullptr);
0049     ~ResolveRecipientsPage() override;
0050 
0051     bool isComplete() const override;
0052 
0053     /**
0054      * The protocol selected by the user (which is chosen by
0055      * the user in case none was preset)
0056      */
0057     GpgME::Protocol selectedProtocol() const;
0058 
0059     /**
0060      * the protocol set before the dialog is shown. Defaults to
0061      * GpgME::UnknownProtocol */
0062     GpgME::Protocol presetProtocol() const;
0063     void setPresetProtocol(GpgME::Protocol protocol);
0064 
0065     bool multipleProtocolsAllowed() const;
0066     void setMultipleProtocolsAllowed(bool allowed);
0067 
0068     /** if true, the user is allowed to remove/add recipients via the UI.
0069      * Defaults to @p false.
0070      */
0071     bool recipientsUserMutable() const;
0072     void setRecipientsUserMutable(bool isMutable);
0073 
0074     void setAdditionalRecipientsInfo(const std::vector<GpgME::Key> &recipients);
0075 
0076     std::vector<GpgME::Key> resolvedCertificates() const;
0077 
0078     std::shared_ptr<RecipientPreferences> recipientPreferences() const;
0079     void setRecipientPreferences(const std::shared_ptr<RecipientPreferences> &prefs);
0080 
0081 Q_SIGNALS:
0082     void selectedProtocolChanged();
0083 
0084 private:
0085     void onNext() override;
0086 
0087 private:
0088     class Private;
0089     kdtools::pimpl_ptr<Private> d;
0090     Q_PRIVATE_SLOT(d, void selectionChanged())
0091     Q_PRIVATE_SLOT(d, void protocolSelected(int))
0092     Q_PRIVATE_SLOT(d, void addRecipient())
0093     Q_PRIVATE_SLOT(d, void removeSelectedEntries())
0094     Q_PRIVATE_SLOT(d, void completeChangedInternal())
0095     class ListWidget;
0096     class ItemWidget;
0097 };
0098 
0099 }
0100 }
0101 }