22 #ifndef KPIMIDENTITES_IDENTITY_H
23 #define KPIMIDENTITES_IDENTITY_H
25 #include "kpimidentities_export.h"
26 #include "signature.h"
28 #include <kdemacros.h>
30 #include <QtCore/QString>
31 #include <QtCore/QStringList>
32 #include <QtCore/QList>
33 #include <QtCore/QHash>
34 #include <QtCore/QVariant>
36 namespace KPIMIdentities
45 namespace KPIMIdentities
48 static const char s_uoid[] =
"uoid";
49 static const char s_identity[] =
"Identity";
50 static const char s_name[] =
"Name";
51 static const char s_organization[] =
"Organization";
52 static const char s_pgps[] =
"PGP Signing Key";
53 static const char s_pgpe[] =
"PGP Encryption Key";
54 static const char s_smimes[] =
"SMIME Signing Key";
55 static const char s_smimee[] =
"SMIME Encryption Key";
56 static const char s_prefcrypt[] =
"Preferred Crypto Message Format";
57 static const char s_email[] =
"Email Address";
58 static const char s_replyto[] =
"Reply-To Address";
59 static const char s_bcc[] =
"Bcc";
60 static const char s_cc[] =
"Cc";
61 static const char s_vcard[] =
"VCardFile";
62 static const char s_transport[] =
"Transport";
63 static const char s_fcc[] =
"Fcc";
64 static const char s_drafts[] =
"Drafts";
65 static const char s_templates[] =
"Templates";
66 static const char s_dict[] =
"Dictionary";
67 static const char s_xface[] =
"X-Face";
68 static const char s_xfaceenabled[] =
"X-FaceEnabled";
69 static const char s_signature[] =
"Signature";
70 static const char s_emailAliases[] =
"Email Aliases";
71 static const char s_attachVcard[] =
"Attach Vcard";
72 static const char s_autocorrectionLanguage[] =
"Autocorrection Language";
73 static const char s_disabledFcc[] =
"Disable Fcc";
75 KPIMIDENTITIES_EXPORT QDataStream &
operator<<
77 KPIMIDENTITIES_EXPORT QDataStream &
operator>>
88 friend KPIMIDENTITIES_EXPORT QDataStream &
operator<<
90 friend KPIMIDENTITIES_EXPORT QDataStream &
operator>>
94 typedef QList<Identity> List;
97 explicit Identity(
const QString &
id=QString(),
98 const QString &realName=QString(),
99 const QString &emailAddr=QString(),
100 const QString &organization=QString(),
101 const QString &replyToAddress=QString() );
107 bool operator== (
const Identity &other )
const;
110 bool operator!= (
const Identity &other )
const;
113 bool operator< (
const Identity &other )
const;
116 bool operator> (
const Identity &other )
const;
119 bool operator<= (
const Identity &other )
const;
122 bool operator>= (
const Identity &other )
const;
125 bool mailingAllowed()
const;
128 QString identityName()
const;
131 void setIdentityName(
const QString &name );
134 bool isDefault()
const;
140 QString fullName()
const;
141 void setFullName(
const QString& );
144 QString organization()
const;
145 void setOrganization(
const QString& );
148 QByteArray pgpEncryptionKey()
const;
149 void setPGPEncryptionKey(
const QByteArray &key );
152 QByteArray pgpSigningKey()
const;
153 void setPGPSigningKey(
const QByteArray &key );
156 QByteArray smimeEncryptionKey()
const;
157 void setSMIMEEncryptionKey(
const QByteArray &key );
160 QByteArray smimeSigningKey()
const;
161 void setSMIMESigningKey(
const QByteArray &key );
163 QString preferredCryptoMessageFormat()
const;
164 void setPreferredCryptoMessageFormat(
const QString& );
172 KDE_DEPRECATED QString emailAddr()
const;
173 KDE_DEPRECATED
void setEmailAddr(
const QString& );
181 QString primaryEmailAddress()
const;
182 void setPrimaryEmailAddress(
const QString & email );
189 const QStringList emailAliases()
const;
190 void setEmailAliases(
const QStringList & aliases );
199 bool matchesEmailAddress(
const QString & addr )
const;
202 QString vCardFile()
const;
203 void setVCardFile(
const QString& );
207 QString fullEmailAddr()
const;
210 QString replyToAddr()
const;
211 void setReplyToAddr(
const QString& );
215 void setBcc(
const QString& );
221 void setCc(
const QString& );
227 bool attachVcard()
const;
228 void setAttachVcard(
bool attach);
233 QString autocorrectionLanguage()
const;
234 void setAutocorrectionLanguage(
const QString& language);
239 bool disabledFcc()
const;
240 void setDisabledFcc(
bool);
242 void setSignature(
const Signature &sig );
252 QString signatureText(
bool *ok = 0 )
const;
258 bool signatureIsInlinedHtml()
const;
262 QString transport()
const;
263 void setTransport(
const QString& );
268 void setFcc(
const QString& );
274 QString drafts()
const;
275 void setDrafts(
const QString& );
281 QString templates()
const;
282 void setTemplates(
const QString& );
290 QString dictionary()
const;
291 void setDictionary(
const QString& );
294 QString xface()
const;
295 void setXFace(
const QString& );
296 bool isXFaceEnabled()
const;
297 void setXFaceEnabled(
const bool );
302 QVariant property(
const QString &key )
const;
305 void setProperty(
const QString &key,
const QVariant &value );
312 static QString mimeDataType();
313 static bool canDecode(
const QMimeData* );
314 void populateMimeData( QMimeData* );
315 static Identity fromMimeData(
const QMimeData* );
319 void readConfig(
const KConfigGroup & );
323 void writeConfig( KConfigGroup & )
const;
333 void setIsDefault(
bool flag );
338 void setUoid( uint aUoid );
343 QString verifyAkonadiId(
const QString& str)
const;
346 bool signatureIsCommand()
const;
349 bool signatureIsPlainFile()
const;
352 bool signatureIsInline()
const;
355 QString signatureFile()
const;
356 void setSignatureFile(
const QString& );
359 QString signatureInlineText()
const;
360 void setSignatureInlineText(
const QString& );
363 bool useSignatureFile()
const;
367 QHash<QString, QVariant> mPropertiesMap;
Manages the list of identities.
Abstraction of a signature (aka "footer").
User identity information.