KContacts

key.h
1 /*
2  This file is part of the KContacts framework.
3  SPDX-FileCopyrightText: 2002 Tobias Koenig <[email protected]>
4 
5  SPDX-License-Identifier: LGPL-2.0-or-later
6 */
7 
8 #ifndef KCONTACTS_KEY_H
9 #define KCONTACTS_KEY_H
10 
11 #include "kcontacts_export.h"
12 
13 #include <QDataStream>
14 #include <QSharedDataPointer>
15 
16 namespace KContacts {
20 class KCONTACTS_EXPORT Key
21 {
22  friend KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &, const Key &);
23  friend KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &, Key &);
24 
25 public:
29  typedef QVector<Key> List;
30 
34  enum Type {
35  X509,
36  PGP,
37  Custom
38  };
39 
44 
51  explicit Key(const QString &text = QString(), Type type = PGP);
52 
56  Key(const Key &other);
57 
61  ~Key();
62 
66  Q_REQUIRED_RESULT bool operator==(const Key &other) const;
67 
71  Q_REQUIRED_RESULT bool operator!=(const Key &other) const;
72 
78  Key &operator=(const Key &other);
79 
83  void setId(const QString &identifier);
84 
88  Q_REQUIRED_RESULT QString id() const;
89 
93  void setBinaryData(const QByteArray &data);
94 
98  Q_REQUIRED_RESULT QByteArray binaryData() const;
99 
103  void setTextData(const QString &data);
104 
108  Q_REQUIRED_RESULT QString textData() const;
109 
113  Q_REQUIRED_RESULT bool isBinary() const;
114 
122  void setType(Type type);
123 
127  void setCustomTypeString(const QString &type);
128 
132  Q_REQUIRED_RESULT Type type() const;
133 
137  Q_REQUIRED_RESULT QString customTypeString() const;
138 
142  Q_REQUIRED_RESULT QString toString() const;
143 
147  Q_REQUIRED_RESULT static TypeList typeList();
148 
152  Q_REQUIRED_RESULT static QString typeLabel(Type type);
153 
154 private:
155  class Private;
157 };
158 
162 KCONTACTS_EXPORT QDataStream &operator<<(QDataStream &stream, const Key &key);
163 
167 KCONTACTS_EXPORT QDataStream &operator>>(QDataStream &stream, Key &key);
168 }
169 Q_DECLARE_TYPEINFO(KContacts::Key, Q_MOVABLE_TYPE);
170 #endif
QVector< Key > List
List of keys.
Definition: key.h:29
QDataStream & operator>>(QDataStream &in, KDateTime::Spec &spec)
A class to store an encryption key.
Definition: key.h:20
Type
Key types.
Definition: key.h:34
QDataStream & operator<<(QDataStream &out, const KDateTime::Spec &spec)
Pretty Good Privacy key.
Definition: key.h:36
X509 key.
Definition: key.h:35
QList< Type > TypeList
List of key types.
Definition: key.h:43
This file is part of the KDE documentation.
Documentation copyright © 1996-2020 The KDE developers.
Generated on Sat Jul 4 2020 22:55:11 by doxygen 1.8.11 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.