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";
74 KPIMIDENTITIES_EXPORT QDataStream &
operator<<
76 KPIMIDENTITIES_EXPORT QDataStream &
operator>>
87 friend KPIMIDENTITIES_EXPORT QDataStream &
operator<<
89 friend KPIMIDENTITIES_EXPORT QDataStream &
operator>>
93 typedef QList<Identity> List;
96 explicit Identity(
const QString &
id=QString(),
97 const QString &realName=QString(),
98 const QString &emailAddr=QString(),
99 const QString &organization=QString(),
100 const QString &replyToAddress=QString() );
106 bool operator== (
const Identity &other )
const;
109 bool operator!= (
const Identity &other )
const;
112 bool operator< (
const Identity &other )
const;
115 bool operator> (
const Identity &other )
const;
118 bool operator<= (
const Identity &other )
const;
121 bool operator>= (
const Identity &other )
const;
124 bool mailingAllowed()
const;
127 QString identityName()
const;
130 void setIdentityName(
const QString &name );
133 bool isDefault()
const;
139 QString fullName()
const;
140 void setFullName(
const QString& );
143 QString organization()
const;
144 void setOrganization(
const QString& );
147 QByteArray pgpEncryptionKey()
const;
148 void setPGPEncryptionKey(
const QByteArray &key );
151 QByteArray pgpSigningKey()
const;
152 void setPGPSigningKey(
const QByteArray &key );
155 QByteArray smimeEncryptionKey()
const;
156 void setSMIMEEncryptionKey(
const QByteArray &key );
159 QByteArray smimeSigningKey()
const;
160 void setSMIMESigningKey(
const QByteArray &key );
162 QString preferredCryptoMessageFormat()
const;
163 void setPreferredCryptoMessageFormat(
const QString& );
171 KDE_DEPRECATED QString emailAddr()
const;
172 KDE_DEPRECATED
void setEmailAddr(
const QString& );
180 QString primaryEmailAddress()
const;
181 void setPrimaryEmailAddress(
const QString & email );
188 const QStringList emailAliases()
const;
189 void setEmailAliases(
const QStringList & aliases );
197 bool matchesEmailAddress(
const QString & addr )
const;
200 QString vCardFile()
const;
201 void setVCardFile(
const QString& );
205 QString fullEmailAddr()
const;
208 QString replyToAddr()
const;
209 void setReplyToAddr(
const QString& );
213 void setBcc(
const QString& );
219 void setCc(
const QString& );
225 bool attachVcard()
const;
226 void setAttachVcard(
bool attach);
231 QString autocorrectionLanguage()
const;
232 void setAutocorrectionLanguage(
const QString& language);
234 void setSignature(
const Signature &sig );
243 QString signatureText(
bool *ok = 0 )
const;
249 bool signatureIsInlinedHtml()
const;
253 QString transport()
const;
254 void setTransport(
const QString& );
259 void setFcc(
const QString& );
265 QString drafts()
const;
266 void setDrafts(
const QString& );
272 QString templates()
const;
273 void setTemplates(
const QString& );
281 QString dictionary()
const;
282 void setDictionary(
const QString& );
285 QString xface()
const;
286 void setXFace(
const QString& );
287 bool isXFaceEnabled()
const;
288 void setXFaceEnabled(
const bool );
291 QVariant property(
const QString &key )
const;
294 void setProperty(
const QString &key,
const QVariant &value );
301 static QString mimeDataType();
302 static bool canDecode(
const QMimeData* );
303 void populateMimeData( QMimeData* );
304 static Identity fromMimeData(
const QMimeData* );
308 void readConfig(
const KConfigGroup & );
312 void writeConfig( KConfigGroup & )
const;
322 void setIsDefault(
bool flag );
325 void setUoid( uint aUoid );
330 QString verifyAkonadiId(
const QString& str)
const;
333 bool signatureIsCommand()
const;
336 bool signatureIsPlainFile()
const;
339 bool signatureIsInline()
const;
342 QString signatureFile()
const;
343 void setSignatureFile(
const QString& );
346 QString signatureInlineText()
const;
347 void setSignatureInlineText(
const QString& );
350 bool useSignatureFile()
const;
354 QHash<QString, QVariant> mPropertiesMap;