kutils: return boolean from KSpeech::removeAllJobs() and KSpeech::removeJob()

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2022-10-08 20:23:19 +03:00
parent d659ad0241
commit c7514f9157
2 changed files with 16 additions and 6 deletions

View file

@ -334,33 +334,43 @@ int KSpeech::say(const QString &text)
#endif // HAVE_SPEECHD
}
void KSpeech::removeAllJobs()
bool KSpeech::removeAllJobs()
{
#if defined(HAVE_SPEECHD)
if (Q_UNLIKELY(!d->m_speechd)) {
kDebug() << "Null speech-dispatcher pointer";
return;
return false;
}
const int speechdresult = spd_stop(d->m_speechd);
if (Q_UNLIKELY(speechdresult < 0)) {
kWarning() << "Speech-dispatcher stop failed";
return false;
}
return true;
#else
kWarning() << "KSpeech is a stub";
return false;
#endif
}
void KSpeech::removeJob(int jobNum)
bool KSpeech::removeJob(int jobNum)
{
#if defined(HAVE_SPEECHD)
if (Q_UNLIKELY(!d->m_speechd)) {
kWarning() << "Null speech-dispatcher pointer";
return;
return false;
}
const int speechdresult = spd_stop_uid(d->m_speechd, jobNum);
if (Q_UNLIKELY(speechdresult < 0)) {
kWarning() << "Speech-dispatcher stop uid failed";
return false;
}
return true;
#else
kWarning() << "KSpeech is a stub";
return false;
#endif
}

View file

@ -60,8 +60,8 @@ public:
public Q_SLOTS:
int say(const QString &text);
void removeAllJobs();
void removeJob(int jobNum);
bool removeAllJobs();
bool removeJob(int jobNum);
Q_SIGNALS:
void jobStateChanged(int jobNum, int state);