Commit 902287f7 authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

Remove duplicate code

parent 1a9b8a41
Pipeline #196402 passed with stage
in 4 minutes and 3 seconds
......@@ -4479,7 +4479,6 @@ void KMMainWidget::slotMessageSelected(const Akonadi::Item &item)
void KMMainWidget::slotShowMdnInfo(const QPair<QString, bool> &mdnInfo)
{
qDebug() << "mdnInfo " << mdnInfo;
if (mMsgView) {
if (!mdnInfo.first.isEmpty()) {
mMsgView->viewer()->mdnWarning()->setCanDeny(mdnInfo.second);
......@@ -4519,19 +4518,9 @@ void KMMainWidget::itemsReceived(const Akonadi::Item::List &list)
}
if (item.hasAttribute<Akonadi::MDNStateAttribute>()
&& item.attribute<Akonadi::MDNStateAttribute>()->mdnState() == Akonadi::MDNStateAttribute::MDNStateUnknown) {
auto job = new MessageComposer::MDNWarningWidgetJob(this);
job->setItem(item);
connect(job, &MessageComposer::MDNWarningWidgetJob::showMdnInfo, this, &KMMainWidget::slotShowMdnInfo);
if (!job->start()) {
qCWarning(KMAIL_LOG) << "Impossible to start MDNWarningWidgetJob";
}
sendMdnInfo(item);
} else if (!item.hasAttribute<Akonadi::MDNStateAttribute>()) {
auto job = new MessageComposer::MDNWarningWidgetJob(this);
job->setItem(item);
connect(job, &MessageComposer::MDNWarningWidgetJob::showMdnInfo, this, &KMMainWidget::slotShowMdnInfo);
if (!job->start()) {
qCWarning(KMAIL_LOG) << "Impossible to start MDNWarningWidgetJob";
}
sendMdnInfo(item);
} else {
mMsgView->viewer()->mdnWarning()->animatedHide();
}
......@@ -4548,6 +4537,16 @@ void KMMainWidget::itemsReceived(const Akonadi::Item::List &list)
mMsgActions->setCurrentMessage(copyItem);
}
void KMMainWidget::sendMdnInfo(const Akonadi::Item &item)
{
auto job = new MessageComposer::MDNWarningWidgetJob(this);
job->setItem(item);
connect(job, &MessageComposer::MDNWarningWidgetJob::showMdnInfo, this, &KMMainWidget::slotShowMdnInfo);
if (!job->start()) {
qCWarning(KMAIL_LOG) << "Impossible to start MDNWarningWidgetJob";
}
}
void KMMainWidget::itemsFetchDone(KJob *job)
{
delete mShowBusySplashTimer;
......
......@@ -536,6 +536,7 @@ private:
void undoSwitchFolder();
void updateMoveAllToTrash();
void slotShowMdnInfo(const QPair<QString, bool> &mdnInfo);
void sendMdnInfo(const Akonadi::Item &item);
// Message actions
QAction *mDeleteAction = nullptr;
......
Supports Markdown
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