Commit 17e22c76 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Rename variables

parent 7d368e82
......@@ -31,11 +31,11 @@ CreateReplyMessageJobTest::CreateReplyMessageJobTest(QObject *parent)
void CreateReplyMessageJobTest::shouldHaveDefaultValue()
{
CreateReplyMessageJobSettings settings;
QVERIFY(settings.mUrl.isEmpty());
QVERIFY(settings.mSelection.isEmpty());
QVERIFY(settings.mTemplate.isEmpty());
QVERIFY(!settings.mMsg);
QVERIFY(!settings.mNoQuote);
QVERIFY(!settings.mReplyAsHtml);
QCOMPARE(settings.m_replyStrategy, MessageComposer::ReplySmart);
QVERIFY(settings.url.isEmpty());
QVERIFY(settings.selection.isEmpty());
QVERIFY(settings.templateStr.isEmpty());
QVERIFY(!settings.msg);
QVERIFY(!settings.noQuote);
QVERIFY(!settings.replyAsHtml);
QCOMPARE(settings.replyStrategy, MessageComposer::ReplySmart);
}
......@@ -54,38 +54,38 @@ inline KMail::Composer::TemplateContext replyContext(const MessageComposer::Mess
void CreateReplyMessageJob::start()
{
const auto col = CommonKernel->collectionFromId(mSettings.mItem.parentCollection().id());
mMessageFactory = new MessageComposer::MessageFactoryNG(mSettings.mMsg, mSettings.mItem.id(), col);
const auto col = CommonKernel->collectionFromId(mSettings.item.parentCollection().id());
mMessageFactory = new MessageComposer::MessageFactoryNG(mSettings.msg, mSettings.item.id(), col);
mMessageFactory->setIdentityManager(KMKernel::self()->identityManager());
mMessageFactory->setFolderIdentity(MailCommon::Util::folderIdentity(mSettings.mItem));
mMessageFactory->setMailingListAddresses(KMail::Util::mailingListsFromMessage(mSettings.mItem));
mMessageFactory->putRepliesInSameFolder(KMail::Util::putRepliesInSameFolder(mSettings.mItem));
mMessageFactory->setSelection(mSettings.mSelection);
mMessageFactory->setTemplate(mSettings.mTemplate);
if (mSettings.mNoQuote) {
mMessageFactory->setFolderIdentity(MailCommon::Util::folderIdentity(mSettings.item));
mMessageFactory->setMailingListAddresses(KMail::Util::mailingListsFromMessage(mSettings.item));
mMessageFactory->putRepliesInSameFolder(KMail::Util::putRepliesInSameFolder(mSettings.item));
mMessageFactory->setSelection(mSettings.selection);
mMessageFactory->setTemplate(mSettings.templateStr);
if (mSettings.noQuote) {
mMessageFactory->setQuote(false);
}
connect(mMessageFactory, &MessageComposer::MessageFactoryNG::createReplyDone, this, &CreateReplyMessageJob::slotCreateReplyDone);
mMessageFactory->setReplyStrategy(mSettings.m_replyStrategy);
mMessageFactory->setReplyStrategy(mSettings.replyStrategy);
mMessageFactory->createReplyAsync();
}
void CreateReplyMessageJob::slotCreateReplyDone(const MessageComposer::MessageFactoryNG::MessageReply &reply)
{
KMime::Message::Ptr rmsg = reply.msg;
if (mSettings.mUrl.isValid()) {
rmsg->to()->fromUnicodeString(KEmailAddress::decodeMailtoUrl(mSettings.mUrl), "utf-8");
if (mSettings.url.isValid()) {
rmsg->to()->fromUnicodeString(KEmailAddress::decodeMailtoUrl(mSettings.url), "utf-8");
}
bool lastEncrypt = false;
bool lastSign = false;
KMail::Util::lastEncryptAndSignState(lastEncrypt, lastSign, mSettings.mMsg);
KMail::Util::lastEncryptAndSignState(lastEncrypt, lastSign, mSettings.msg);
KMail::Composer *win = KMail::makeComposer(rmsg,
lastSign,
lastEncrypt,
(mSettings.m_replyStrategy == MessageComposer::ReplyNone) ? KMail::Composer::Reply : replyContext(reply),
(mSettings.replyStrategy == MessageComposer::ReplyNone) ? KMail::Composer::Reply : replyContext(reply),
0,
mSettings.mSelection, mSettings.mTemplate);
mSettings.selection, mSettings.templateStr);
win->setFocusToEditor();
win->show();
deleteLater();
......
......@@ -33,14 +33,14 @@ struct KMAILTESTS_TESTS_EXPORT CreateReplyMessageJobSettings
{
}
QUrl mUrl;
QString mSelection;
QString mTemplate;
Akonadi::Item mItem;
KMime::Message::Ptr mMsg;
MessageComposer::ReplyStrategy m_replyStrategy = MessageComposer::ReplySmart;
bool mNoQuote = false;
bool mReplyAsHtml = false;
QUrl url;
QString selection;
QString templateStr;
Akonadi::Item item;
KMime::Message::Ptr msg;
MessageComposer::ReplyStrategy replyStrategy = MessageComposer::ReplySmart;
bool noQuote = false;
bool replyAsHtml = false;
};
class KMAILTESTS_TESTS_EXPORT CreateReplyMessageJob : public QObject
......
......@@ -446,11 +446,11 @@ KMCommand::Result KMMailtoReplyCommand::execute()
return Failed;
}
CreateReplyMessageJobSettings settings;
settings.mItem = item;
settings.mMsg = msg;
settings.mSelection = mSelection;
settings.mUrl = mUrl;
settings.m_replyStrategy = MessageComposer::ReplyNone;
settings.item = item;
settings.msg = msg;
settings.selection = mSelection;
settings.url = mUrl;
settings.replyStrategy = MessageComposer::ReplyNone;
CreateReplyMessageJob *job = new CreateReplyMessageJob;
job->setSettings(settings);
......@@ -852,12 +852,12 @@ KMCommand::Result KMReplyCommand::execute()
}
CreateReplyMessageJobSettings settings;
settings.mItem = item;
settings.mMsg = msg;
settings.mSelection = mSelection;
settings.m_replyStrategy = m_replyStrategy;
settings.mTemplate = mTemplate;
settings.mNoQuote = mNoQuote;
settings.item = item;
settings.msg = msg;
settings.selection = mSelection;
settings.replyStrategy = m_replyStrategy;
settings.templateStr = mTemplate;
settings.noQuote = mNoQuote;
CreateReplyMessageJob *job = new CreateReplyMessageJob;
job->setSettings(settings);
......
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