Commit df1a495b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Define if we want to reply to all or reply to author

parent 61f03551
Pipeline #67975 failed with stage
in 24 minutes and 47 seconds
......@@ -43,5 +43,8 @@
<entry name="replyMail" key="replyMail" type="Bool">
<default>false</default>
</entry>
<entry name="replyMailType" key="replyMailType" type="Int">
<default>0</default>
</entry>
</group>
</kcfg>
......@@ -92,6 +92,7 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
mReplyMailTypeComboBox = new QComboBox(parent);
mReplyMailTypeComboBox->setObjectName(QStringLiteral("mReplyMailTypeComboBox"));
mReplyMailTypeComboBox->setEnabled(false);
mReplyMailTypeComboBox->addItems({i18n("Reply to Author"), i18n("Reply to All")});
hboxLayout->addWidget(mReplyMailTypeComboBox);
hboxLayout->addStretch(1);
......@@ -182,6 +183,8 @@ void NewMailNotifierSettingsWidget::load()
mTextToSpeakSetting->setEnabled(mTextToSpeak->isChecked());
mTextToSpeakSetting->setText(settings->textToSpeak());
mReplyMail->setChecked(settings->replyMail());
mReplyMailTypeComboBox->setCurrentIndex(settings->replyMailType());
updateReplyMail(mAllowToShowMail->isChecked());
}
......@@ -199,7 +202,7 @@ bool NewMailNotifierSettingsWidget::save() const
settings->setTextToSpeakEnabled(mTextToSpeak->isChecked());
settings->setTextToSpeak(mTextToSpeakSetting->text());
settings->setReplyMail(mReplyMail->isChecked());
settings->setReplyMailType(mReplyMailTypeComboBox->currentIndex());
settings->save();
mNotify->save();
......
......@@ -151,7 +151,18 @@ void SpecialNotifierJob::emitNotification(const QPixmap &pixmap)
}
QStringList lstActions{i18n("Show mail..."), i18n("Mark As Read"), i18n("Delete")};
if (NewMailNotifierAgentSettings::replyMail()) {
lstActions << i18n("Reply mail...");
switch (NewMailNotifierAgentSettings::replyMailType()) {
case 0:
lstActions << i18n("Reply to Author");
break;
case 1:
lstActions << i18n("Reply to All");
break;
default:
qCWarning(NEWMAILNOTIFIER_LOG) << " Problem with NewMailNotifierAgentSettings::replyMailType() value: "
<< NewMailNotifierAgentSettings::replyMailType();
break;
}
}
notification->setActions(lstActions);
......@@ -188,7 +199,7 @@ void SpecialNotifierJob::slotActivateNotificationAction(unsigned int index)
void SpecialNotifierJob::slotReplyMessage()
{
auto job = new NewMailNotifierReplyMessageJob(mItem.id());
job->setReplyToAll(false); // TODO add support
job->setReplyToAll(NewMailNotifierAgentSettings::replyMailType() == 0 ? false : true);
job->start();
deleteLater();
}
......
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