Commit f7bac15b authored by Laurent Montel's avatar Laurent Montel 😁
Browse files

It seems that Qt::TextToSpeech will not be port to qt6 (or we need to

duplicate qt5 source, we will see it in qt6 time)
parent 43be06f1
Pipeline #78206 failed with stage
in 26 minutes and 36 seconds
......@@ -97,7 +97,15 @@ set_package_properties(Qca-qt5 PROPERTIES DESCRIPTION "Qt Cryptographic Architec
PURPOSE "Needed for ews resource.")
option(KDEPIM_RUN_AKONADI_TEST "Enable autotest based on Akonadi." TRUE)
# QT5 package
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED TextToSpeech Network Widgets Test XmlPatterns DBus WebEngineWidgets NetworkAuth)
find_package(Qt5TextToSpeech ${QT_REQUIRED_VERSION} CONFIG)
set_package_properties(Qt5TextToSpeech PROPERTIES DESCRIPTION
"Add support for texttospeed"
TYPE OPTIONAL
)
if(Qt5TextToSpeech_FOUND)
set(HAVE_TEXT_TO_SPEECH_SUPPORT TRUE)
endif()
find_package(Qt5 ${QT_REQUIRED_VERSION} CONFIG REQUIRED Network Widgets Test XmlPatterns DBus WebEngineWidgets NetworkAuth)
# KF5 package
......
include_directories(${kdepim-runtime_BINARY_DIR})
add_definitions(-DTRANSLATION_DOMAIN=\"akonadi_newmailnotifier_agent\")
configure_file(config-newmailnotifier.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config-newmailnotifier.h)
add_executable( akonadi_newmailnotifier_agent)
set(newmailnotifier_common_SRCS)
......@@ -45,6 +45,12 @@ target_link_libraries( akonadi_newmailnotifier_agent
Qt::TextToSpeech
)
if(Qt5TextToSpeech_FOUND)
target_link_libraries( akonadi_newmailnotifier_agent
Qt::TextToSpeech
)
endif()
if( APPLE )
set_target_properties( akonadi_newmailnotifier_agent PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/Info.plist.template)
set_target_properties( akonadi_newmailnotifier_agent PROPERTIES MACOSX_BUNDLE_GUI_IDENTIFIER "org.kde.Akonadi.newmailnotifier")
......
/*
SPDX-FileCopyrightText: 2021 Laurent Montel <montel@kde.org>
SPDX-License-Identifier: GPL-2.0-or-later
*/
#pragma once
#cmakedefine01 HAVE_TEXT_TO_SPEECH_SUPPORT
......@@ -36,7 +36,9 @@
#if KCOREADDONS_VERSION < QT_VERSION_CHECK(6, 0, 0)
#include <Kdelibs4ConfigMigrator>
#endif
#if HAVE_TEXT_TO_SPEECH_SUPPORT
#include <QTextToSpeech>
#endif
using namespace Akonadi;
......@@ -344,7 +346,9 @@ void NewMailNotifierAgent::slotShowNotifications()
auto job = new SpecialNotifierJob(mListEmails, currentPath, item, this);
job->setDefaultIconName(mDefaultIconName);
connect(job, &SpecialNotifierJob::displayNotification, this, &NewMailNotifierAgent::slotDisplayNotification);
#if HAVE_TEXT_TO_SPEECH_SUPPORT
connect(job, &SpecialNotifierJob::say, this, &NewMailNotifierAgent::slotSay);
#endif
mNewMails.clear();
return;
} else {
......@@ -463,6 +467,7 @@ bool NewMailNotifierAgent::isActive() const
void NewMailNotifierAgent::slotSay(const QString &message)
{
#if HAVE_TEXT_TO_SPEECH_SUPPORT
if (!mTextToSpeech) {
mTextToSpeech = new QTextToSpeech(this);
}
......@@ -471,6 +476,7 @@ void NewMailNotifierAgent::slotSay(const QString &message)
} else {
mTextToSpeech->say(message);
}
#endif
}
AKONADI_AGENT_MAIN(NewMailNotifierAgent)
......@@ -7,7 +7,7 @@
*/
#pragma once
#include "config-newmailnotifier.h"
#include <agentbase.h>
#include <collection.h> // make sure this is included before QHash, otherwise it won't find the correct qHash implementation for some reason
......@@ -67,6 +67,8 @@ private:
QTimer mTimer;
QStringList mInstanceNameInProgress;
KIdentityManagement::IdentityManager *mIdentityManager = nullptr;
#if HAVE_TEXT_TO_SPEECH_SUPPORT
QTextToSpeech *mTextToSpeech = nullptr;
#endif
};
......@@ -102,7 +102,7 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
vbox->addStretch();
tab->addTab(settings, i18n("Display"));
#if HAVE_TEXT_TO_SPEECH_SUPPORT
auto textSpeakWidget = new QWidget;
vbox = new QVBoxLayout;
textSpeakWidget->setLayout(vbox);
......@@ -131,7 +131,7 @@ NewMailNotifierSettingsWidget::NewMailNotifierSettingsWidget(const KSharedConfig
vbox->addStretch();
tab->addTab(textSpeakWidget, i18n("Text to Speak"));
connect(mTextToSpeak, &QCheckBox::toggled, mTextToSpeakSetting, &QLineEdit::setEnabled);
#endif
mNotify = new KNotifyConfigWidget(parent);
mNotify->setObjectName(QStringLiteral("mNotify"));
mNotify->setApplication(QStringLiteral("akonadi_newmailnotifier_agent"));
......@@ -180,8 +180,10 @@ void NewMailNotifierSettingsWidget::load()
mAllowToShowMail->setChecked(settings->showButtonToDisplayMail());
mKeepPersistentNotification->setChecked(settings->keepPersistentNotification());
mTextToSpeak->setChecked(settings->textToSpeakEnabled());
#if HAVE_TEXT_TO_SPEECH_SUPPORT
mTextToSpeakSetting->setEnabled(mTextToSpeak->isChecked());
mTextToSpeakSetting->setText(settings->textToSpeak());
#endif
mReplyMail->setChecked(settings->replyMail());
mReplyMailTypeComboBox->setCurrentIndex(settings->replyMailType());
......@@ -199,8 +201,10 @@ bool NewMailNotifierSettingsWidget::save() const
settings->setExcludeEmailsFromMe(mExcludeMySelf->isChecked());
settings->setShowButtonToDisplayMail(mAllowToShowMail->isChecked());
settings->setKeepPersistentNotification(mKeepPersistentNotification->isChecked());
#if HAVE_TEXT_TO_SPEECH_SUPPORT
settings->setTextToSpeakEnabled(mTextToSpeak->isChecked());
settings->setTextToSpeak(mTextToSpeakSetting->text());
#endif
settings->setReplyMail(mReplyMail->isChecked());
settings->setReplyMailType(mReplyMailTypeComboBox->currentIndex());
settings->save();
......
......@@ -5,7 +5,7 @@
*/
#pragma once
#include "config-newmailnotifier.h"
#include <AkonadiCore/AgentConfigurationBase>
#include <AkonadiCore/Collection>
......@@ -35,8 +35,10 @@ private:
QCheckBox *mAllowToShowMail = nullptr;
QCheckBox *mKeepPersistentNotification = nullptr;
KNotifyConfigWidget *mNotify = nullptr;
#if HAVE_TEXT_TO_SPEECH_SUPPORT
QCheckBox *mTextToSpeak = nullptr;
QLineEdit *mTextToSpeakSetting = nullptr;
#endif
QCheckBox *mReplyMail = nullptr;
QComboBox *mReplyMailTypeComboBox = nullptr;
NewMailNotifierSelectCollectionWidget *mSelectCollection = 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