1 /* 2 kleo/keygroup.h 3 4 This file is part of libkleopatra, the KDE keymanagement library 5 SPDX-FileCopyrightText: 2021 g10 Code GmbH 6 SPDX-FileContributor: Ingo Klöcker <dev@ingo-kloecker.de> 7 8 SPDX-License-Identifier: GPL-2.0-or-later 9 */ 10 11 #pragma once 12 13 #include "kleo_export.h" 14 15 #include <Libkleo/Predicates> 16 17 #include <memory> 18 #include <set> 19 #include <vector> 20 21 class QString; 22 23 namespace GpgME 24 { 25 class Key; 26 } 27 28 namespace Kleo 29 { 30 31 class KLEO_EXPORT KeyGroup 32 { 33 public: 34 typedef QString Id; 35 typedef std::set<GpgME::Key, _detail::ByFingerprint<std::less>> Keys; 36 37 enum Source { 38 UnknownSource, 39 ApplicationConfig, 40 GnuPGConfig, 41 Tags 42 }; 43 44 KeyGroup(); 45 ~KeyGroup(); 46 47 explicit KeyGroup(const Id &id, const QString &name, const std::vector<GpgME::Key> &keys, Source source); 48 49 KeyGroup(const KeyGroup &other); 50 KeyGroup &operator=(const KeyGroup &other); 51 52 KeyGroup(KeyGroup &&other); 53 KeyGroup &operator=(KeyGroup &&other); 54 55 bool isNull() const; 56 57 Id id() const; 58 Source source() const; 59 60 void setName(const QString &name); 61 QString name() const; 62 63 void setKeys(const Keys &keys); 64 void setKeys(const std::vector<GpgME::Key> &keys); 65 const Keys &keys() const; 66 67 void setIsImmutable(bool isImmutable); 68 bool isImmutable() const; 69 70 bool insert(const GpgME::Key &key); 71 bool erase(const GpgME::Key &key); 72 73 private: 74 class Private; 75 std::unique_ptr<Private> d; 76 }; 77 78 } 79 80