diff --git a/agents/newmailnotifier/newmailnotifieragent.cpp b/agents/newmailnotifier/newmailnotifieragent.cpp --- a/agents/newmailnotifier/newmailnotifieragent.cpp +++ b/agents/newmailnotifier/newmailnotifieragent.cpp @@ -466,7 +466,6 @@ if (hasUniqMessage) { SpecialNotifierJob *job = new SpecialNotifierJob(mListEmails, currentPath, item, this); job->setDefaultPixmap(mDefaultPixmap); - connect(job, &SpecialNotifierJob::displayNotification, this, &NewMailNotifierAgent::slotDisplayNotification); #ifdef HAVE_TEXTTOSPEECH connect(job, &SpecialNotifierJob::say, this, &NewMailNotifierAgent::slotSay); #endif diff --git a/agents/newmailnotifier/specialnotifierjob.h b/agents/newmailnotifier/specialnotifierjob.h --- a/agents/newmailnotifier/specialnotifierjob.h +++ b/agents/newmailnotifier/specialnotifierjob.h @@ -36,7 +36,6 @@ void setDefaultPixmap(const QPixmap &pixmap); Q_SIGNALS: - void displayNotification(const QPixmap &pixmap, const QString &message); void say(const QString &message); private: diff --git a/agents/newmailnotifier/specialnotifierjob.cpp b/agents/newmailnotifier/specialnotifierjob.cpp --- a/agents/newmailnotifier/specialnotifierjob.cpp +++ b/agents/newmailnotifier/specialnotifierjob.cpp @@ -151,22 +151,19 @@ } } + KNotification *notification = new KNotification(QStringLiteral("new-email"), nullptr, + NewMailNotifierAgentSettings::keepPersistentNotification() ? KNotification::Persistent + | KNotification::SkipGrouping : KNotification::CloseOnTimeout); + notification->setText(result.join(QLatin1Char('\n'))); + notification->setPixmap(pixmap); if (NewMailNotifierAgentSettings::showButtonToDisplayMail()) { - KNotification *notification = new KNotification(QStringLiteral("new-email"), nullptr, - NewMailNotifierAgentSettings::keepPersistentNotification() ? KNotification::Persistent - | KNotification::SkipGrouping : KNotification::CloseOnTimeout); - notification->setText(result.join(QLatin1Char('\n'))); - notification->setPixmap(pixmap); - notification->setActions(QStringList() << i18n("Show mail...")); - - connect(notification, QOverload::of(&KNotification::activated), this, &SpecialNotifierJob::slotOpenMail); - connect(notification, &KNotification::closed, this, &SpecialNotifierJob::deleteLater); - - notification->sendEvent(); - } else { - Q_EMIT displayNotification(pixmap, result.join(QLatin1Char('\n'))); - deleteLater(); + notification->setActions(QStringList{i18nc("Open email button", "Open")}); } + notification->setDefaultAction(i18nc("Open email button", "Open")); + + connect(notification, QOverload::of(&KNotification::activated), this, &SpecialNotifierJob::slotOpenMail); + connect(notification, &KNotification::closed, this, &SpecialNotifierJob::deleteLater); + notification->sendEvent(); } void SpecialNotifierJob::slotOpenMail()