00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022 #ifndef KPIMIDENTITES_IDENTITY_H
00023 #define KPIMIDENTITES_IDENTITY_H
00024
00025 #include "kpimidentities_export.h"
00026 #include "signature.h"
00027
00028 #include <kdemacros.h>
00029
00030 #include <QtCore/QString>
00031 #include <QtCore/QStringList>
00032 #include <QtCore/QList>
00033 #include <QtCore/QHash>
00034 #include <QtCore/QVariant>
00035
00036 namespace KPIMIdentities
00037 {
00038 class Identity;
00039 class Signature;
00040 }
00041 class KConfigGroup;
00042 class QDataStream;
00043 class QMimeData;
00044
00045 namespace KPIMIdentities
00046 {
00047
00048 static const char s_uoid[] = "uoid";
00049 static const char s_identity[] = "Identity";
00050 static const char s_name[] = "Name";
00051 static const char s_organization[] = "Organization";
00052 static const char s_pgps[] = "PGP Signing Key";
00053 static const char s_pgpe[] = "PGP Encryption Key";
00054 static const char s_smimes[] = "SMIME Signing Key";
00055 static const char s_smimee[] = "SMIME Encryption Key";
00056 static const char s_prefcrypt[] = "Preferred Crypto Message Format";
00057 static const char s_email[] = "Email Address";
00058 static const char s_replyto[] = "Reply-To Address";
00059 static const char s_bcc[] = "Bcc";
00060 static const char s_vcard[] = "VCardFile";
00061 static const char s_transport[] = "Transport";
00062 static const char s_fcc[] = "Fcc";
00063 static const char s_drafts[] = "Drafts";
00064 static const char s_templates[] = "Templates";
00065 static const char s_dict[] = "Dictionary";
00066 static const char s_xface[] = "X-Face";
00067 static const char s_xfaceenabled[] = "X-FaceEnabled";
00068 static const char s_signature[] = "Signature";
00069
00070 KPIMIDENTITIES_EXPORT QDataStream &operator<<
00071 ( QDataStream &stream, const KPIMIdentities::Identity &ident );
00072 KPIMIDENTITIES_EXPORT QDataStream &operator>>
00073 ( QDataStream &stream, KPIMIdentities::Identity &ident );
00074
00076 class KPIMIDENTITIES_EXPORT Identity
00077 {
00078
00079
00080
00081 friend class IdentityManager;
00082
00083 friend KPIMIDENTITIES_EXPORT QDataStream &operator<<
00084 ( QDataStream &stream, const KPIMIdentities::Identity &ident );
00085 friend KPIMIDENTITIES_EXPORT QDataStream &operator>>
00086 ( QDataStream &stream, KPIMIdentities::Identity &ident );
00087
00088 public:
00089 typedef QList<Identity> List;
00090
00092 explicit Identity( const QString &id=QString(),
00093 const QString &realName=QString(),
00094 const QString &emailAddr=QString(),
00095 const QString &organization=QString(),
00096 const QString &replyToAddress=QString() );
00097
00099 ~Identity();
00100
00102 bool operator== ( const Identity &other ) const;
00103
00105 bool operator!= ( const Identity &other ) const;
00106
00108 bool operator< ( const Identity &other ) const;
00109
00111 bool operator> ( const Identity &other ) const;
00112
00114 bool operator<= ( const Identity &other ) const;
00115
00117 bool operator>= ( const Identity &other ) const;
00118
00120 bool mailingAllowed() const;
00121
00123 QString identityName() const;
00124
00126 void setIdentityName( const QString &name );
00127
00129 bool isDefault() const;
00130
00132 uint uoid() const;
00133
00135 QString fullName() const;
00136 void setFullName( const QString& );
00137
00139 QString organization() const;
00140 void setOrganization( const QString& );
00141
00143 QByteArray pgpEncryptionKey() const;
00144 void setPGPEncryptionKey( const QByteArray &key );
00145
00147 QByteArray pgpSigningKey() const;
00148 void setPGPSigningKey( const QByteArray &key );
00149
00151 QByteArray smimeEncryptionKey() const;
00152 void setSMIMEEncryptionKey( const QByteArray &key );
00153
00155 QByteArray smimeSigningKey() const;
00156 void setSMIMESigningKey( const QByteArray &key );
00157
00158 QString preferredCryptoMessageFormat() const;
00159 void setPreferredCryptoMessageFormat( const QString& );
00160
00162 QString emailAddr() const;
00163 void setEmailAddr( const QString& );
00164
00166 QString vCardFile() const;
00167 void setVCardFile( const QString& );
00168
00171 QString fullEmailAddr() const;
00172
00174 QString replyToAddr() const;
00175 void setReplyToAddr( const QString& );
00176
00178 QString bcc() const;
00179 void setBcc( const QString& );
00180
00181 void setSignature( const Signature &sig );
00182 Signature &signature();
00183
00190 QString signatureText( bool *ok = 0 ) const;
00191
00196 bool signatureIsInlinedHtml() const;
00197
00200 QString transport() const;
00201 void setTransport( const QString& );
00202
00205 QString fcc() const;
00206 void setFcc( const QString& );
00207
00210 QString drafts() const;
00211 void setDrafts( const QString& );
00212
00215 QString templates() const;
00216 void setTemplates( const QString& );
00217
00224 QString dictionary() const;
00225 void setDictionary( const QString& );
00226
00228 QString xface() const;
00229 void setXFace( const QString& );
00230 bool isXFaceEnabled() const;
00231 void setXFaceEnabled( const bool );
00232
00234 QVariant property( const QString &key ) const;
00237 void setProperty( const QString &key, const QVariant &value );
00238
00239 static const Identity &null();
00242 bool isNull() const;
00243
00244 static QString mimeDataType();
00245 static bool canDecode( const QMimeData* );
00246 void populateMimeData( QMimeData* );
00247 static Identity fromMimeData( const QMimeData* );
00248
00251 void readConfig( const KConfigGroup & );
00252
00255 void writeConfig( KConfigGroup & ) const;
00256
00265 void setIsDefault( bool flag );
00266
00268 void setUoid( uint aUoid );
00269
00270 protected:
00272 bool signatureIsCommand() const;
00273
00275 bool signatureIsPlainFile() const;
00276
00278 bool signatureIsInline() const;
00279
00281 QString signatureFile() const;
00282 void setSignatureFile( const QString& );
00283
00285 QString signatureInlineText() const;
00286 void setSignatureInlineText( const QString& );
00287
00289 bool useSignatureFile() const;
00290
00291 Signature mSignature;
00292 bool mIsDefault;
00293 QHash<QString,QVariant> mPropertiesMap;
00294 };
00295
00296 }
00297
00298 #endif