summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMontel Laurent <montel@kde.org>2016-08-22 20:53:28 (GMT)
committerMontel Laurent <montel@kde.org>2016-08-22 20:53:28 (GMT)
commit7321cecac0a2372c140f58f4327fe2068dbc6da6 (patch)
tree203fdcf555bad5e33c2134e571046ac0dec10d05
parentcd78f62ad3344b10dfcf549ba09186502ba7e1f7 (diff)
Verify that we have engines
-rw-r--r--agents/newmailnotifier/specialnotifierjob.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/agents/newmailnotifier/specialnotifierjob.cpp b/agents/newmailnotifier/specialnotifierjob.cpp
index 9b0a114..f93dbbd 100644
--- a/agents/newmailnotifier/specialnotifierjob.cpp
+++ b/agents/newmailnotifier/specialnotifierjob.cpp
@@ -152,10 +152,15 @@ void SpecialNotifierJob::emitNotification(const QPixmap &pixmap)
if (!NewMailNotifierAgentSettings::textToSpeak().isEmpty()) {
#ifdef HAVE_TEXTTOSPEECH
QTextToSpeech *speech = new QTextToSpeech(this);
- QString message = NewMailNotifierAgentSettings::textToSpeak();
- message.replace(QStringLiteral("%s"), mSubject.toHtmlEscaped());
- message.replace(QStringLiteral("%f"), mFrom.toHtmlEscaped());
- speech->say(message);
+ if (!speech->availableEngines().isEmpty()) {
+ QString message = NewMailNotifierAgentSettings::textToSpeak();
+ message.replace(QStringLiteral("%s"), mSubject.toHtmlEscaped());
+ message.replace(QStringLiteral("%f"), mFrom.toHtmlEscaped());
+ speech->say(message);
+ } else {
+ qCWarning(NEWMAILNOTIFIER_LOG) << "No texttospeech engine available";
+ delete speech;
+ }
#endif
}
}