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 static const char s_emailAliases[] = "Email Aliases";
00070
00071 KPIMIDENTITIES_EXPORT QDataStream &operator<<
00072 ( QDataStream &stream, const KPIMIdentities::Identity &ident );
00073 KPIMIDENTITIES_EXPORT QDataStream &operator>>
00074 ( QDataStream &stream, KPIMIdentities::Identity &ident );
00075
00077 class KPIMIDENTITIES_EXPORT Identity
00078 {
00079
00080
00081
00082 friend class IdentityManager;
00083
00084 friend KPIMIDENTITIES_EXPORT QDataStream &operator<<
00085 ( QDataStream &stream, const KPIMIdentities::Identity &ident );
00086 friend KPIMIDENTITIES_EXPORT QDataStream &operator>>
00087 ( QDataStream &stream, KPIMIdentities::Identity &ident );
00088
00089 public:
00090 typedef QList<Identity> List;
00091
00093 explicit Identity( const QString &id=QString(),
00094 const QString &realName=QString(),
00095 const QString &emailAddr=QString(),
00096 const QString &organization=QString(),
00097 const QString &replyToAddress=QString() );
00098
00100 ~Identity();
00101
00103 bool operator== ( const Identity &other ) const;
00104
00106 bool operator!= ( const Identity &other ) const;
00107
00109 bool operator< ( const Identity &other ) const;
00110
00112 bool operator> ( const Identity &other ) const;
00113
00115 bool operator<= ( const Identity &other ) const;
00116
00118 bool operator>= ( const Identity &other ) const;
00119
00121 bool mailingAllowed() const;
00122
00124 QString identityName() const;
00125
00127 void setIdentityName( const QString &name );
00128
00130 bool isDefault() const;
00131
00133 uint uoid() const;
00134
00136 QString fullName() const;
00137 void setFullName( const QString& );
00138
00140 QString organization() const;
00141 void setOrganization( const QString& );
00142
00144 QByteArray pgpEncryptionKey() const;
00145 void setPGPEncryptionKey( const QByteArray &key );
00146
00148 QByteArray pgpSigningKey() const;
00149 void setPGPSigningKey( const QByteArray &key );
00150
00152 QByteArray smimeEncryptionKey() const;
00153 void setSMIMEEncryptionKey( const QByteArray &key );
00154
00156 QByteArray smimeSigningKey() const;
00157 void setSMIMESigningKey( const QByteArray &key );
00158
00159 QString preferredCryptoMessageFormat() const;
00160 void setPreferredCryptoMessageFormat( const QString& );
00161
00168 KDE_DEPRECATED QString emailAddr() const;
00169 KDE_DEPRECATED void setEmailAddr( const QString& );
00170
00177 QString primaryEmailAddress() const;
00178 void setPrimaryEmailAddress( const QString & email );
00179
00185 const QStringList emailAliases() const;
00186 void setEmailAliases( const QStringList & aliases );
00187
00194 bool matchesEmailAddress( const QString & addr ) const;
00195
00197 QString vCardFile() const;
00198 void setVCardFile( const QString& );
00199
00202 QString fullEmailAddr() const;
00203
00205 QString replyToAddr() const;
00206 void setReplyToAddr( const QString& );
00207
00209 QString bcc() const;
00210 void setBcc( const QString& );
00211
00212 void setSignature( const Signature &sig );
00213 Signature &signature();
00214
00221 QString signatureText( bool *ok = 0 ) const;
00222
00227 bool signatureIsInlinedHtml() const;
00228
00231 QString transport() const;
00232 void setTransport( const QString& );
00233
00236 QString fcc() const;
00237 void setFcc( const QString& );
00238
00241 QString drafts() const;
00242 void setDrafts( const QString& );
00243
00246 QString templates() const;
00247 void setTemplates( const QString& );
00248
00255 QString dictionary() const;
00256 void setDictionary( const QString& );
00257
00259 QString xface() const;
00260 void setXFace( const QString& );
00261 bool isXFaceEnabled() const;
00262 void setXFaceEnabled( const bool );
00263
00265 QVariant property( const QString &key ) const;
00268 void setProperty( const QString &key, const QVariant &value );
00269
00270 static const Identity &null();
00273 bool isNull() const;
00274
00275 static QString mimeDataType();
00276 static bool canDecode( const QMimeData* );
00277 void populateMimeData( QMimeData* );
00278 static Identity fromMimeData( const QMimeData* );
00279
00282 void readConfig( const KConfigGroup & );
00283
00286 void writeConfig( KConfigGroup & ) const;
00287
00296 void setIsDefault( bool flag );
00297
00299 void setUoid( uint aUoid );
00300
00301 protected:
00303 bool signatureIsCommand() const;
00304
00306 bool signatureIsPlainFile() const;
00307
00309 bool signatureIsInline() const;
00310
00312 QString signatureFile() const;
00313 void setSignatureFile( const QString& );
00314
00316 QString signatureInlineText() const;
00317 void setSignatureInlineText( const QString& );
00318
00320 bool useSignatureFile() const;
00321
00322 Signature mSignature;
00323 bool mIsDefault;
00324 QHash<QString,QVariant> mPropertiesMap;
00325 };
00326
00327 }
00328
00329 #endif