Commit ecca7fa3 authored by Marco Rebhan's avatar Marco Rebhan Committed by Laurent Montel
Browse files

Add support for storing Face header

parent 321702d3
Pipeline #83195 canceled with stage
cmake_minimum_required(VERSION 3.16 FATAL_ERROR)
set(PIM_VERSION "5.18.42")
set(PIM_VERSION "5.18.43")
project(KIdentityManagement VERSION ${PIM_VERSION})
......
......@@ -61,6 +61,8 @@ bool IdentityTester::compareIdentities(const Identity &actual, const Identity &e
QCOMPARE(actual.dictionary(), expected.dictionary());
QCOMPARE(actual.isXFaceEnabled(), expected.isXFaceEnabled());
QCOMPARE(actual.xface(), expected.xface());
QCOMPARE(actual.isFaceEnabled(), expected.isFaceEnabled());
QCOMPARE(actual.face(), expected.face());
ok = true;
}();
......@@ -146,6 +148,10 @@ void IdentityTester::test_Identity()
QCOMPARE(identity.isXFaceEnabled(), true);
identity.setXFace(QStringLiteral(":-P"));
QCOMPARE(identity.xface(), QStringLiteral(":-P"));
identity.setFaceEnabled(true);
QCOMPARE(identity.isFaceEnabled(), true);
identity.setFace(QStringLiteral(";-)"));
QCOMPARE(identity.face(), QStringLiteral(";-)"));
// Test copy
{
......@@ -156,6 +162,9 @@ void IdentityTester::test_Identity()
identity.setXFace(QStringLiteral(":-("));
QVERIFY(!(copy == identity));
identity.setFace(QStringLiteral(">:("));
QVERIFY(!(copy == identity));
}
// Test serialization
......
......@@ -164,7 +164,8 @@ QDataStream &KIdentityManagement::operator<<(QDataStream &stream, const KIdentit
<< i.mPropertiesMap[QLatin1String(s_prefcrypt)] << i.mPropertiesMap[QLatin1String(s_cc)] << i.mPropertiesMap[QLatin1String(s_attachVcard)]
<< i.mPropertiesMap[QLatin1String(s_autocorrectionLanguage)] << i.mPropertiesMap[QLatin1String(s_disabledFcc)]
<< i.mPropertiesMap[QLatin1String(s_pgpautosign)] << i.mPropertiesMap[QLatin1String(s_pgpautoencrypt)]
<< i.mPropertiesMap[QLatin1String(s_autocryptEnabled)] << i.mPropertiesMap[QLatin1String(s_defaultDomainName)];
<< i.mPropertiesMap[QLatin1String(s_autocryptEnabled)] << i.mPropertiesMap[QLatin1String(s_defaultDomainName)]
<< i.mPropertiesMap[QLatin1String(s_face)] << i.mPropertiesMap[QLatin1String(s_faceenabled)];
}
QDataStream &KIdentityManagement::operator>>(QDataStream &stream, KIdentityManagement::Identity &i)
......@@ -179,7 +180,8 @@ QDataStream &KIdentityManagement::operator>>(QDataStream &stream, KIdentityManag
>> i.mPropertiesMap[QLatin1String(s_xfaceenabled)] >> i.mPropertiesMap[QLatin1String(s_prefcrypt)] >> i.mPropertiesMap[QLatin1String(s_cc)]
>> i.mPropertiesMap[QLatin1String(s_attachVcard)] >> i.mPropertiesMap[QLatin1String(s_autocorrectionLanguage)]
>> i.mPropertiesMap[QLatin1String(s_disabledFcc)] >> i.mPropertiesMap[QLatin1String(s_pgpautosign)] >> i.mPropertiesMap[QLatin1String(s_pgpautoencrypt)]
>> i.mPropertiesMap[QLatin1String(s_autocryptEnabled)] >> i.mPropertiesMap[QLatin1String(s_defaultDomainName)];
>> i.mPropertiesMap[QLatin1String(s_autocryptEnabled)] >> i.mPropertiesMap[QLatin1String(s_defaultDomainName)]
>> i.mPropertiesMap[QLatin1String(s_face)] >> i.mPropertiesMap[QLatin1String(s_faceenabled)];
i.setProperty(QLatin1String(s_uoid), uoid);
return stream;
......@@ -408,6 +410,16 @@ QString Identity::xface() const
return property(QLatin1String(s_xface)).toString();
}
bool Identity::isFaceEnabled() const
{
return property(QLatin1String(s_faceenabled)).toBool();
}
QString Identity::face() const
{
return property(QLatin1String(s_face)).toString();
}
QString Identity::dictionary() const
{
return property(QLatin1String(s_dict)).toString();
......@@ -615,11 +627,25 @@ void Identity::setXFace(const QString &str)
setProperty(QLatin1String(s_xface), strNew);
}
void Identity::setXFaceEnabled(const bool on)
void Identity::setXFaceEnabled(bool on)
{
setProperty(QLatin1String(s_xfaceenabled), on);
}
void Identity::setFace(const QString &str)
{
QString strNew = str;
strNew.remove(QLatin1Char(' '));
strNew.remove(QLatin1Char('\n'));
strNew.remove(QLatin1Char('\r'));
setProperty(QLatin1String(s_face), strNew);
}
void Identity::setFaceEnabled(bool on)
{
setProperty(QLatin1String(s_faceenabled), on);
}
void Identity::setSignature(const Signature &sig)
{
mSignature = sig;
......
......@@ -48,6 +48,8 @@ static const char s_templates[] = "Templates";
static const char s_dict[] = "Dictionary";
static const char s_xface[] = "X-Face";
static const char s_xfaceenabled[] = "X-FaceEnabled";
static const char s_face[] = "Face";
static const char s_faceenabled[] = "FaceEnabled";
static const char s_signature[] = "Signature";
static const char s_emailAliases[] = "Email Aliases";
static const char s_attachVcard[] = "Attach Vcard";
......@@ -286,7 +288,13 @@ public:
Q_REQUIRED_RESULT QString xface() const;
void setXFace(const QString &);
Q_REQUIRED_RESULT bool isXFaceEnabled() const;
void setXFaceEnabled(const bool);
void setXFaceEnabled(bool);
/** a Face header for this identity */
Q_REQUIRED_RESULT QString face() const;
void setFace(const QString &);
Q_REQUIRED_RESULT bool isFaceEnabled() const;
void setFaceEnabled(bool);
/** Get random properties
* @param key the key of the property to get
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment