00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef KABC_KEY_H
00022 #define KABC_KEY_H
00023
00024 #include "kabc_export.h"
00025
00026 #include <QtCore/QDataStream>
00027 #include <QtCore/QSharedDataPointer>
00028
00029 namespace KABC {
00030
00034 class KABC_EXPORT Key
00035 {
00036 friend KABC_EXPORT QDataStream &operator<<( QDataStream &, const Key & );
00037 friend KABC_EXPORT QDataStream &operator>>( QDataStream &, Key & );
00038
00039 public:
00043 typedef QList<Key> List;
00044
00048 enum Type {
00049 X509,
00050 PGP,
00051 Custom
00052 };
00053
00057 typedef QList<Type> TypeList;
00058
00065 explicit Key( const QString &text = QString(), Type type = PGP );
00066
00070 Key( const Key &other );
00071
00075 ~Key();
00076
00080 bool operator==( const Key & ) const;
00081
00085 bool operator!=( const Key & ) const;
00086
00092 Key &operator=( const Key &other );
00093
00097 void setId( const QString &identifier );
00098
00102 QString id() const;
00103
00107 void setBinaryData( const QByteArray &data );
00108
00112 QByteArray binaryData() const;
00113
00117 void setTextData( const QString &data );
00118
00122 QString textData() const;
00123
00127 bool isBinary() const;
00128
00136 void setType( Type type );
00137
00141 void setCustomTypeString( const QString &type );
00142
00146 Type type() const;
00147
00151 QString customTypeString() const;
00152
00156 QString toString() const;
00157
00161 static TypeList typeList();
00162
00166 static QString typeLabel( Type type );
00167
00168 private:
00169 class Private;
00170 QSharedDataPointer<Private> d;
00171 };
00172
00176 KABC_EXPORT QDataStream &operator<<( QDataStream &stream, const Key &key );
00177
00181 KABC_EXPORT QDataStream &operator>>( QDataStream &stream, Key &key );
00182
00183 }
00184
00185 #endif