Commit 7c8ec740 authored by Laurent Montel's avatar Laurent Montel 😁

Bug 368346 - Add configuration option to set notification expiration timeout

Allow to define permanent notification or not
FIXED-IN: 5.7.0
BUG: 368346
parent 2ece0d5f
......@@ -493,7 +493,7 @@ void NewMailNotifierAgent::slotDisplayNotification(const QPixmap &pixmap, const
message,
pixmap,
nullptr,
KNotification::CloseOnTimeout,
NewMailNotifierAgentSettings::keepPersistentNotification() ? KNotification::Persistent | KNotification::SkipGrouping : KNotification::CloseOnTimeout,
QStringLiteral("akonadi_newmailnotifier_agent"));
}
......
......@@ -36,5 +36,8 @@
<entry name="showButtonToDisplayMail" key="showButtonToDisplayMail" type="Bool">
<default>false</default>
</entry>
<entry name="keepPersistentNotification" key="keepPersistentNotification" type="Bool">
<default>false</default>
</entry>
</group>
</kcfg>
......@@ -109,6 +109,10 @@ NewMailNotifierSettingsDialog::NewMailNotifierSettingsDialog(QWidget *parent)
mAllowToShowMail->setChecked(NewMailNotifierAgentSettings::showButtonToDisplayMail());
vbox->addWidget(mAllowToShowMail);
mKeepPersistentNotification = new QCheckBox(i18n("Keep Persistent Notification"), this);
mKeepPersistentNotification->setChecked(NewMailNotifierAgentSettings::keepPersistentNotification());
vbox->addWidget(mKeepPersistentNotification);
vbox->addStretch();
tab->addTab(settings, i18n("Display"));
......@@ -217,6 +221,7 @@ void NewMailNotifierSettingsDialog::slotOkClicked()
NewMailNotifierAgentSettings::setShowSubject(mShowSubject->isChecked());
NewMailNotifierAgentSettings::setShowFolder(mShowFolders->isChecked());
NewMailNotifierAgentSettings::setExcludeEmailsFromMe(mExcludeMySelf->isChecked());
NewMailNotifierAgentSettings::setKeepPersistentNotification(mKeepPersistentNotification->isChecked());
#ifdef HAVE_TEXTTOSPEECH
NewMailNotifierAgentSettings::setTextToSpeakEnabled(mTextToSpeak->isChecked());
NewMailNotifierAgentSettings::setTextToSpeak(mTextToSpeakSetting->text());
......
......@@ -45,6 +45,7 @@ private:
QCheckBox *mShowFolders;
QCheckBox *mExcludeMySelf;
QCheckBox *mAllowToShowMail;
QCheckBox *mKeepPersistentNotification;
KNotifyConfigWidget *mNotify;
QCheckBox *mTextToSpeak;
QLineEdit *mTextToSpeakSetting;
......
......@@ -155,7 +155,7 @@ void SpecialNotifierJob::emitNotification(const QPixmap &pixmap)
}
if (NewMailNotifierAgentSettings::showButtonToDisplayMail()) {
KNotification *notification = new KNotification(QStringLiteral("new-email"), nullptr, KNotification::CloseOnTimeout);
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..."));
......
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