Libkleo

defaultkeyfilter.h
1 /*
2  defaultkeyfilter.h
3 
4  This file is part of libkleopatra, the KDE keymanagement library
5  SPDX-FileCopyrightText: 2004 Klarälvdalens Datakonsult AB
6 
7  SPDX-FileCopyrightText: 2016 Bundesamt für Sicherheit in der Informationstechnik
8  SPDX-FileContributor: Intevation GmbH
9 
10  SPDX-License-Identifier: GPL-2.0-or-later
11 */
12 
13 #pragma once
14 
15 #include "keyfilter.h"
16 #include "kleo_export.h"
17 
18 #include <QColor>
19 #include <QFont>
20 #include <QString>
21 
22 #include <gpgme++/key.h>
23 
24 #include <memory>
25 
26 namespace Kleo
27 {
28 
29 /** Default implementation of key filter class. */
30 class KLEO_EXPORT DefaultKeyFilter : public KeyFilter
31 {
32 public:
34  ~DefaultKeyFilter() override;
35 
36  /** Used for bool checks */
37  enum TriState {
38  // clang-format off
39  DoesNotMatter = 0,
40  Set = 1,
41  NotSet = 2,
42  // clang-format on
43  };
44 
45  /** Used for level checks */
46  enum LevelState {
47  // clang-format off
48  LevelDoesNotMatter = 0,
49  Is = 1,
50  IsNot = 2,
51  IsAtLeast = 3,
52  IsAtMost = 4,
53  // clang-format on
54  };
55 
56  bool matches(const GpgME::Key &key, MatchContexts ctx) const override;
57  bool matches(const GpgME::UserID &userID, MatchContexts ctx) const override;
58 
59  unsigned int specificity() const override;
60  void setSpecificity(unsigned int value);
61  QString id() const override;
62  void setId(const QString &value);
63  KeyFilter::MatchContexts availableMatchContexts() const override;
64  void setMatchContexts(KeyFilter::MatchContexts value);
65 
66  QColor fgColor() const override;
67  void setFgColor(const QColor &value);
68 
69  QColor bgColor() const override;
70  void setBgColor(const QColor &value);
71 
72  FontDescription fontDescription() const override;
73  QString name() const override;
74  void setName(const QString &value);
75  QString icon() const override;
76  void setIcon(const QString &value);
77  QFont font() const;
78  void setFont(const QFont &value);
79 
80  TriState revoked() const;
81  TriState expired() const;
82  TriState invalid() const;
83  TriState disabled() const;
84  TriState root() const;
85  TriState canEncrypt() const;
86  TriState canSign() const;
87  TriState canCertify() const;
88  TriState canAuthenticate() const;
89  TriState hasEncrypt() const;
90  TriState hasSign() const;
91  TriState hasCertify() const;
92  TriState hasAuthenticate() const;
93  TriState qualified() const;
94  TriState cardKey() const;
95  TriState hasSecret() const;
96  TriState isOpenPGP() const;
97  TriState wasValidated() const;
98  TriState isDeVS() const;
99  TriState isBad() const;
100 
101  LevelState ownerTrust() const;
102  GpgME::Key::OwnerTrust ownerTrustReferenceLevel() const;
103 
104  LevelState validity() const;
105  GpgME::UserID::Validity validityReferenceLevel() const;
106  bool italic() const;
107  bool bold() const;
108  bool strikeOut() const;
109  bool useFullFont() const;
110 
111  void setRevoked(const TriState);
112  void setExpired(const TriState);
113  void setInvalid(const TriState);
114  void setDisabled(const TriState);
115  void setRoot(const TriState);
116  void setCanEncrypt(const TriState);
117  void setCanSign(const TriState);
118  void setCanCertify(const TriState);
119  void setCanAuthenticate(const TriState);
120  void setHasEncrypt(const TriState);
121  void setHasSign(const TriState);
122  void setHasCertify(const TriState);
123  void setHasAuthenticate(const TriState);
124  void setQualified(const TriState);
125  void setCardKey(const TriState);
126  void setHasSecret(const TriState);
127  void setIsOpenPGP(const TriState);
128  void setWasValidated(const TriState);
129  void setIsDeVs(const TriState);
130  void setIsBad(const TriState);
131  /**
132  * If \p value is \c Set, then invalid S/MIME certificates do not match.
133  * If \p value is \c NotSet, then valid S/MIME certificates do not match.
134  */
135  void setValidIfSMIME(TriState value);
136  TriState validIfSMIME() const;
137 
138  void setOwnerTrust(const LevelState);
139  void setOwnerTrustReferenceLevel(const GpgME::Key::OwnerTrust);
140 
141  void setValidity(const LevelState);
142  void setValidityReferenceLevel(const GpgME::UserID::Validity);
143 
144  void setItalic(bool value);
145  void setBold(bool value);
146  void setStrikeOut(bool value);
147  void setUseFullFont(bool value);
148 
149 private:
150  class Private;
151  const std::unique_ptr<Private> d;
152 };
153 
154 } // namespace Kleo
Default implementation of key filter class.
An abstract base class key filters.
Definition: keyfilter.h:36
LevelState
Used for level checks.
TriState
Used for bool checks.
This file is part of the KDE documentation.
Documentation copyright © 1996-2024 The KDE developers.
Generated on Thu Feb 15 2024 03:56:14 by doxygen 1.8.17 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.