21 #include <tdeapplication.h>
29 : mTextData( text ), mIsBinary( false ), mType( type )
31 mId = TDEApplication::randomString(8);
38 bool Key::operator==(
const Key &k )
const
40 if ( mIsBinary != k.mIsBinary )
return false;
42 if ( mBinaryData != k.mBinaryData )
return false;
44 if ( mTextData != k.mTextData )
return false;
45 if ( mType != k.mType )
return false;
46 if ( mCustomTypeString != k.mCustomTypeString )
return false;
51 bool Key::operator!=(
const Key &k )
const
53 return !( k == *this );
100 mCustomTypeString = custom;
110 return mCustomTypeString;
127 return i18n(
"X509" );
130 return i18n(
"PGP" );
133 return i18n(
"Custom" );
136 return i18n(
"Unknown type" );
141 TQDataStream &TDEABC::operator<<( TQDataStream &s,
const Key &key )
143 return s << key.mId << key.mIsBinary << key.mTextData << key.mBinaryData <<
144 key.mCustomTypeString << key.mType;
147 TQDataStream &TDEABC::operator>>( TQDataStream &s,
Key &key )
149 s >> key.mId >> key.mIsBinary >> key.mTextData >> key.mBinaryData >>
150 key.mCustomTypeString >> key.mType;
A class to store an encryption key.
TQString customTypeString() const
Returns the custom type string.
static TQString typeLabel(int type)
Returns a translated label for a given key type.
TQString id() const
Returns the unique identifier.
static data, shared by ALL addressee objects
void setType(int type)
Sets the type, see Type.
void setId(const TQString &id)
Sets the unique identifier.
void setBinaryData(const TQByteArray &binary)
Sets binary data.
TQByteArray binaryData() const
Returns the binary data.
TQString textData() const
Returns the text data.
void setCustomTypeString(const TQString &custom)
Sets custom type string.
void setTextData(const TQString &text)
Sets text data.
Key(const TQString &text=TQString::null, int type=PGP)
Constructor.
bool isBinary() const
Returns whether the key contains binary or text data.
static TypeList typeList()
Returns a list of all available key types.
int type() const
Returns the type, see Type.