File indexing completed on 2024-11-24 04:49:37
0001 /* 0002 kleo/keygroup.h 0003 0004 This file is part of libkleopatra, the KDE keymanagement library 0005 SPDX-FileCopyrightText: 2021 g10 Code GmbH 0006 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de> 0007 0008 SPDX-License-Identifier: GPL-2.0-or-later 0009 */ 0010 0011 #pragma once 0012 0013 #include "kleo_export.h" 0014 0015 #include <Libkleo/Predicates> 0016 0017 #include <memory> 0018 #include <set> 0019 #include <vector> 0020 0021 class QString; 0022 0023 namespace GpgME 0024 { 0025 class Key; 0026 } 0027 0028 namespace Kleo 0029 { 0030 0031 class KLEO_EXPORT KeyGroup 0032 { 0033 public: 0034 typedef QString Id; 0035 typedef std::set<GpgME::Key, _detail::ByFingerprint<std::less>> Keys; 0036 0037 enum Source { 0038 UnknownSource, 0039 ApplicationConfig, 0040 GnuPGConfig, 0041 Tags, 0042 }; 0043 0044 KeyGroup(); 0045 ~KeyGroup(); 0046 0047 explicit KeyGroup(const Id &id, const QString &name, const std::vector<GpgME::Key> &keys, Source source); 0048 0049 KeyGroup(const KeyGroup &other); 0050 KeyGroup &operator=(const KeyGroup &other); 0051 0052 KeyGroup(KeyGroup &&other); 0053 KeyGroup &operator=(KeyGroup &&other); 0054 0055 bool isNull() const; 0056 0057 Id id() const; 0058 Source source() const; 0059 0060 void setName(const QString &name); 0061 QString name() const; 0062 0063 void setKeys(const Keys &keys); 0064 void setKeys(const std::vector<GpgME::Key> &keys); 0065 const Keys &keys() const; 0066 0067 void setIsImmutable(bool isImmutable); 0068 bool isImmutable() const; 0069 0070 bool insert(const GpgME::Key &key); 0071 bool erase(const GpgME::Key &key); 0072 0073 private: 0074 class Private; 0075 std::unique_ptr<Private> d; 0076 }; 0077 0078 }