Commit 2b976c87 authored by Laurent Montel's avatar Laurent Montel 😁

Set mail from cc/bcc/to

parent da6573a6
......@@ -18,7 +18,7 @@ include(KDEFrameworkCompilerSettings NO_POLICY_SCOPE)
include(ECMQtDeclareLoggingCategory)
include(ECMAddTests)
set(PIM_VERSION "5.2.83")
set(PIM_VERSION "5.2.84")
set(MESSAGELIB_LIB_VERSION ${PIM_VERSION})
set(KDEPIMLIBS_LIB_VERSION "5.2.40")
......
......@@ -40,7 +40,9 @@ void PluginEditorCheckBeforeSendParamsTest::shouldHaveDefaultValues()
QCOMPARE(params.identity(), (uint) - 1);
QCOMPARE(params.transportId(), -1);
QVERIFY(!params.isHtmlMail());
QVERIFY(params.addresses().isEmpty());
QVERIFY(params.bccAddresses().isEmpty());
QVERIFY(params.ccAddresses().isEmpty());
QVERIFY(params.toAddresses().isEmpty());
QVERIFY(params.defaultDomain().isEmpty());
QVERIFY(!params.hasAttachment());
}
......@@ -50,27 +52,35 @@ void PluginEditorCheckBeforeSendParamsTest::shouldBeEqual()
MessageComposer::PluginEditorCheckBeforeSendParams params1;
const QString subject(QStringLiteral("foo"));
const QString plainText(QStringLiteral("bla"));
const QStringList lst{ QStringLiteral("foo"), QStringLiteral("foo"), QStringLiteral("foo")};
const QString defaultDomain(QStringLiteral("bli"));
bool isHmlMail = true;
bool hasAttachment = true;
int transportId = 5;
QString to(QStringLiteral("to"));
QString cc(QStringLiteral("cc"));
QString bcc(QStringLiteral("bcc"));
params1.setSubject(subject);
params1.setHtmlMail(isHmlMail);
params1.setPlainText(plainText);
params1.setAddresses(lst);
params1.setDefaultDomain(defaultDomain);
params1.setHasAttachment(hasAttachment);
params1.setTransportId(transportId);
params1.setBccAddresses(bcc);
params1.setCcAddresses(cc);
params1.setToAddresses(to);
MessageComposer::PluginEditorCheckBeforeSendParams params2 = params1;
QVERIFY(params2 == params1);
QCOMPARE(params2.isHtmlMail(), isHmlMail);
QCOMPARE(params2.subject(), subject);
QCOMPARE(params2.plainText(), plainText);
QCOMPARE(params2.addresses(), lst);
QCOMPARE(params2.defaultDomain(), defaultDomain);
QCOMPARE(params2.hasAttachment(), hasAttachment);
QCOMPARE(params2.transportId(), transportId);
QCOMPARE(params2.bccAddresses(), bcc);
QCOMPARE(params2.ccAddresses(), cc);
QCOMPARE(params2.toAddresses(), to);
}
void PluginEditorCheckBeforeSendParamsTest::shouldAssignValue()
......@@ -83,23 +93,32 @@ void PluginEditorCheckBeforeSendParamsTest::shouldAssignValue()
bool hasAttachment = true;
uint identity = 5;
int transportId = 6;
const QStringList lst{ QStringLiteral("foo"), QStringLiteral("foo"), QStringLiteral("foo")};
QString to(QStringLiteral("to"));
QString cc(QStringLiteral("cc"));
QString bcc(QStringLiteral("bcc"));
params1.setSubject(subject);
params1.setHtmlMail(isHmlMail);
params1.setPlainText(plainText);
params1.setIdentity(identity);
params1.setAddresses(lst);
params1.setDefaultDomain(defaultDomain);
params1.setHasAttachment(hasAttachment);
params1.setTransportId(transportId);
params1.setBccAddresses(bcc);
params1.setCcAddresses(cc);
params1.setToAddresses(to);
QCOMPARE(params1.isHtmlMail(), isHmlMail);
QCOMPARE(params1.subject(), subject);
QCOMPARE(params1.identity(), identity);
QCOMPARE(params1.plainText(), plainText);
QCOMPARE(params1.addresses(), lst);
QCOMPARE(params1.defaultDomain(), defaultDomain);
QCOMPARE(params1.hasAttachment(), hasAttachment);
QCOMPARE(params1.transportId(), transportId);
QCOMPARE(params1.bccAddresses(), bcc);
QCOMPARE(params1.ccAddresses(), cc);
QCOMPARE(params1.toAddresses(), to);
}
QTEST_MAIN(PluginEditorCheckBeforeSendParamsTest)
......@@ -34,7 +34,9 @@ public:
{
}
QStringList listAddress;
QString ccAddresses;
QString bccAddresses;
QString toAddresses;
QString plainText;
QString subject;
QString defaultDomain;
......@@ -68,10 +70,12 @@ PluginEditorCheckBeforeSendParams &PluginEditorCheckBeforeSendParams::operator=(
d->identity = other.identity();
d->isHtml = other.isHtmlMail();
d->plainText = other.plainText();
d->listAddress = other.addresses();
d->defaultDomain = other.defaultDomain();
d->hasAttachment = other.hasAttachment();
d->transportId = other.transportId();
d->bccAddresses = other.bccAddresses();
d->ccAddresses = other.ccAddresses();
d->toAddresses = other.toAddresses();
}
return *this;
}
......@@ -82,10 +86,12 @@ bool PluginEditorCheckBeforeSendParams::operator ==(const PluginEditorCheckBefor
(d->identity == other.identity()) &&
(d->isHtml == other.isHtmlMail()) &&
(d->plainText == other.plainText()) &&
(d->listAddress == other.addresses()) &&
(d->defaultDomain == other.defaultDomain()) &&
(d->hasAttachment == other.hasAttachment()) &&
(d->transportId == other.transportId());
(d->transportId == other.transportId()) &&
(d->bccAddresses == other.bccAddresses()) &&
(d->ccAddresses == other.ccAddresses()) &&
(d->toAddresses == other.toAddresses());
}
void PluginEditorCheckBeforeSendParams::setSubject(const QString &subject)
......@@ -128,14 +134,34 @@ QString PluginEditorCheckBeforeSendParams::plainText() const
return d->plainText;
}
void PluginEditorCheckBeforeSendParams::setAddresses(const QStringList &lst)
void PluginEditorCheckBeforeSendParams::setBccAddresses(const QString &lst)
{
d->listAddress = lst;
d->bccAddresses = lst;
}
QStringList PluginEditorCheckBeforeSendParams::addresses() const
QString PluginEditorCheckBeforeSendParams::bccAddresses() const
{
return d->listAddress;
return d->bccAddresses;
}
void PluginEditorCheckBeforeSendParams::setToAddresses(const QString &lst)
{
d->toAddresses = lst;
}
QString PluginEditorCheckBeforeSendParams::toAddresses() const
{
return d->toAddresses;
}
void PluginEditorCheckBeforeSendParams::setCcAddresses(const QString &lst)
{
d->ccAddresses = lst;
}
QString PluginEditorCheckBeforeSendParams::ccAddresses() const
{
return d->ccAddresses;
}
void PluginEditorCheckBeforeSendParams::setDefaultDomain(const QString &domain)
......
......@@ -45,8 +45,14 @@ public:
void setPlainText(const QString &text);
QString plainText() const;
void setAddresses(const QStringList &lst);
QStringList addresses() const;
void setBccAddresses(const QString &lst);
QString bccAddresses() const;
void setToAddresses(const QString &lst);
QString toAddresses() const;
void setCcAddresses(const QString &lst);
QString ccAddresses() const;
void setDefaultDomain(const QString &domain);
QString defaultDomain() const;
......
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