commit:     79550ce1ea1291cfc2820ba1319f9e7a5f735b35
Author:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
AuthorDate: Thu Feb 24 15:44:05 2022 +0000
Commit:     Andreas Sturmlechner <asturm <AT> gentoo <DOT> org>
CommitDate: Thu Feb 24 17:04:23 2022 +0000
URL:        https://gitweb.gentoo.org/proj/kde.git/commit/?id=79550ce1

kde-apps/messagelib: Add IUSE speech

Bug: https://bugs.gentoo.org/832776
Bug: https://bugs.gentoo.org/832845
Package-Manager: Portage-3.0.30, Repoman-3.0.3
Signed-off-by: Andreas Sturmlechner <asturm <AT> gentoo.org>

 .../messagelib-21.12.3-speech-optional-1.patch     | 131 +++++++++++++++++++++
 .../messagelib-21.12.3-speech-optional-2.patch     |  95 +++++++++++++++
 .../messagelib-21.12.3-speech-optional-3.patch     |  56 +++++++++
 .../messagelib/messagelib-21.12.49.9999.ebuild     |   6 +-
 kde-apps/messagelib/messagelib-9999.ebuild         |   4 +-
 kde-apps/messagelib/metadata.xml                   |   3 +
 6 files changed, 291 insertions(+), 4 deletions(-)

diff --git 
a/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-1.patch 
b/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-1.patch
new file mode 100644
index 0000000000..39f48362a4
--- /dev/null
+++ b/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-1.patch
@@ -0,0 +1,131 @@
+From a8d74999570b1dd6025548593e2d06b37afadce0 Mon Sep 17 00:00:00 2001
+From: Laurent Montel <mon...@kde.org>
+Date: Mon, 14 Feb 2022 19:07:53 +0100
+Subject: [PATCH] Fix build without texttospeech
+
+---
+ .../mailsourceviewtextbrowserwidget.cpp       | 19 ++++++++++++++++---
+ .../widgets/mailsourceviewtextbrowserwidget.h |  9 +++++++++
+ 2 files changed, 25 insertions(+), 3 deletions(-)
+
+diff --git a/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp 
b/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp
+index 5c0050002..0e5b61c1e 100644
+--- a/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp
++++ b/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp
+@@ -38,16 +38,20 @@ using namespace MessageViewer;
+ MailSourceViewTextBrowserWidget::MailSourceViewTextBrowserWidget(const 
QString &syntax, QWidget *parent)
+     : QWidget(parent)
+     , mSliderContainer(new KPIMTextEdit::SlideContainer(this))
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     , mTextToSpeechWidget(new KPIMTextEdit::TextToSpeechWidget(this))
++#endif
+ {
+     auto lay = new QVBoxLayout(this);
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     lay->setContentsMargins({});
+     mTextToSpeechWidget->setObjectName(QStringLiteral("texttospeech"));
+     lay->addWidget(mTextToSpeechWidget);
+-
+     auto textToSpeechInterface = new 
KPIMTextEdit::TextToSpeechInterface(mTextToSpeechWidget, this);
+-
+     mTextBrowser = new MailSourceViewTextBrowser(textToSpeechInterface);
++#else
++    mTextBrowser = new MailSourceViewTextBrowser(this);
++#endif
+     mTextBrowser->setObjectName(QStringLiteral("textbrowser"));
+     mTextBrowser->setLineWrapMode(QPlainTextEdit::NoWrap);
+     mTextBrowser->setTextInteractionFlags(Qt::TextSelectableByMouse | 
Qt::TextSelectableByKeyboard);
+@@ -104,12 +108,17 @@ MessageViewer::MailSourceViewTextBrowser 
*MailSourceViewTextBrowserWidget::textB
+ {
+     return mTextBrowser;
+ }
+-
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+ 
MailSourceViewTextBrowser::MailSourceViewTextBrowser(KPIMTextEdit::TextToSpeechInterface
 *textToSpeechInterface, QWidget *parent)
+     : QPlainTextEdit(parent)
+     , mTextToSpeechInterface(textToSpeechInterface)
+ {
+ }
++#endif
++MailSourceViewTextBrowser::MailSourceViewTextBrowser(QWidget *parent)
++    : QPlainTextEdit(parent)
++{
++}
+ 
+ void MailSourceViewTextBrowser::contextMenuEvent(QContextMenuEvent *event)
+ {
+@@ -117,6 +126,7 @@ void 
MailSourceViewTextBrowser::contextMenuEvent(QContextMenuEvent *event)
+     if (popup) {
+         popup->addSeparator();
+         popup->addAction(KStandardAction::find(this, 
&MailSourceViewTextBrowser::findText, this));
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+         // Code from KTextBrowser
+         if (mTextToSpeechInterface->isReady()) {
+             popup->addSeparator();
+@@ -125,6 +135,7 @@ void 
MailSourceViewTextBrowser::contextMenuEvent(QContextMenuEvent *event)
+                              this,
+                              &MailSourceViewTextBrowser::slotSpeakText);
+         }
++#endif
+         popup->addSeparator();
+         popup->addAction(KStandardAction::saveAs(this, 
&MailSourceViewTextBrowser::slotSaveAs, this));
+ 
+@@ -140,6 +151,7 @@ void MailSourceViewTextBrowser::slotSaveAs()
+ 
+ void MailSourceViewTextBrowser::slotSpeakText()
+ {
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     QString text;
+     if (textCursor().hasSelection()) {
+         text = textCursor().selectedText();
+@@ -147,4 +159,5 @@ void MailSourceViewTextBrowser::slotSpeakText()
+         text = toPlainText();
+     }
+     mTextToSpeechInterface->say(text);
++#endif
+ }
+diff --git a/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.h 
b/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.h
+index 84f0eb8ae..500402f9a 100644
+--- a/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.h
++++ b/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.h
+@@ -12,6 +12,8 @@
+ #include <KSyntaxHighlighting/Repository>
+ #include <QPlainTextEdit>
+ #include <QSyntaxHighlighter>
++#include <kpimtextedit/kpimtextedit-texttospeech.h>
++
+ namespace KPIMTextEdit
+ {
+ class SlideContainer;
+@@ -50,14 +52,19 @@ private:
+     MailSourceViewTextBrowser *mTextBrowser = nullptr;
+     FindBarSourceView *mFindBar = nullptr;
+     KPIMTextEdit::SlideContainer *const mSliderContainer;
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     KPIMTextEdit::TextToSpeechWidget *const mTextToSpeechWidget;
++#endif
+ };
+ 
+ class MailSourceViewTextBrowser : public QPlainTextEdit
+ {
+     Q_OBJECT
+ public:
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     explicit MailSourceViewTextBrowser(KPIMTextEdit::TextToSpeechInterface 
*textToSpeechInterface, QWidget *parent = nullptr);
++#endif
++    explicit MailSourceViewTextBrowser(QWidget *parent);
+ 
+ protected:
+     void contextMenuEvent(QContextMenuEvent *event) override;
+@@ -67,6 +74,8 @@ Q_SIGNALS:
+ private:
+     void slotSpeakText();
+     void slotSaveAs();
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     KPIMTextEdit::TextToSpeechInterface *mTextToSpeechInterface = nullptr;
++#endif
+ };
+ }
+-- 
+GitLab
+

diff --git 
a/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-2.patch 
b/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-2.patch
new file mode 100644
index 0000000000..a00fab7d58
--- /dev/null
+++ b/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-2.patch
@@ -0,0 +1,95 @@
+From da4ba2b7dc18ba20994dad54e754ed1d9d9c7a48 Mon Sep 17 00:00:00 2001
+From: Laurent Montel <mon...@kde.org>
+Date: Mon, 14 Feb 2022 19:16:56 +0100
+Subject: [PATCH] Compile without text to speech support
+
+---
+ messageviewer/src/viewer/viewer_p.cpp | 10 ++++++----
+ messageviewer/src/viewer/viewer_p.h   |  8 +++++---
+ 2 files changed, 11 insertions(+), 7 deletions(-)
+
+diff --git a/messageviewer/src/viewer/viewer_p.cpp 
b/messageviewer/src/viewer/viewer_p.cpp
+index 5e7af8e01..15e71482f 100644
+--- a/messageviewer/src/viewer/viewer_p.cpp
++++ b/messageviewer/src/viewer/viewer_p.cpp
+@@ -1403,11 +1403,11 @@ void ViewerPrivate::createWidgets()
+     mOpenSavedFileFolderWidget = new OpenSavedFileFolderWidget(readerBox);
+     
mOpenSavedFileFolderWidget->setObjectName(QStringLiteral("opensavefilefolderwidget"));
+     readerBoxVBoxLayout->addWidget(mOpenSavedFileFolderWidget);
+-
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     mTextToSpeechWidget = new KPIMTextEdit::TextToSpeechWidget(readerBox);
+     mTextToSpeechWidget->setObjectName(QStringLiteral("texttospeechwidget"));
+     readerBoxVBoxLayout->addWidget(mTextToSpeechWidget);
+-
++#endif
+     mViewer = new MailWebEngineView(mActionCollection, readerBox);
+     mViewer->setViewer(this);
+     readerBoxVBoxLayout->addWidget(mViewer);
+@@ -1609,12 +1609,12 @@ void ViewerPrivate::createActions()
+     ac->setDefaultShortcut(loadExternalReferenceAction, 
QKeySequence(Qt::SHIFT | Qt::CTRL | Qt::Key_R));
+     connect(loadExternalReferenceAction, &QAction::triggered, this, 
&ViewerPrivate::slotLoadExternalReference);
+     MessageViewer::Util::addHelpTextAction(loadExternalReferenceAction, 
i18n("Load external references from the Internet for this message."));
+-
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     mSpeakTextAction = new QAction(i18n("Speak Text"), this);
+     
mSpeakTextAction->setIcon(QIcon::fromTheme(QStringLiteral("preferences-desktop-text-to-speech")));
+     ac->addAction(QStringLiteral("speak_text"), mSpeakTextAction);
+     connect(mSpeakTextAction, &QAction::triggered, this, 
&ViewerPrivate::slotSpeakText);
+-
++#endif
+     auto purposeMenuWidget = new MailfilterPurposeMenuWidget(mViewer, this);
+     mShareTextAction = new QAction(i18n("Share Text..."), this);
+     mShareTextAction->setMenu(purposeMenuWidget->menu());
+@@ -2605,10 +2605,12 @@ void ViewerPrivate::replyMessage(KMime::Content 
*atmNode, bool replyToAll)
+ 
+ void ViewerPrivate::slotSpeakText()
+ {
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     const QString text = mViewer->selectedText();
+     if (!text.isEmpty()) {
+         mTextToSpeechWidget->say(text);
+     }
++#endif
+ }
+ 
+ QUrl ViewerPrivate::imageUrl() const
+diff --git a/messageviewer/src/viewer/viewer_p.h 
b/messageviewer/src/viewer/viewer_p.h
+index 88cb605e5..467163a2a 100644
+--- a/messageviewer/src/viewer/viewer_p.h
++++ b/messageviewer/src/viewer/viewer_p.h
+@@ -13,18 +13,18 @@
+ #include "messageviewer_private_export.h"
+ #include "viewer.h" //not so nice, it is actually for the enums from 
MailViewer
+ #include "widgets/opensavedfilefolderwidget.h"
+-#include <PimCommon/ShareServiceUrlManager>
+-#include <WebEngineViewer/CheckPhishingUrlUtil>
+-
+ #include <Akonadi/Item>
+ #include <Akonadi/Monitor>
+ #include <Akonadi/Session>
+ #include <KIO/Job>
+ #include <KMime/Message>
+ #include <KService>
++#include <PimCommon/ShareServiceUrlManager>
+ #include <QPointer>
+ #include <QUrl>
+ #include <QVector>
++#include <WebEngineViewer/CheckPhishingUrlUtil>
++#include <kpimtextedit/kpimtextedit-texttospeech.h>
+ 
+ #include <QObject>
+ #include <QTimer>
+@@ -695,7 +695,9 @@ public:
+     MessageViewer::OpenSavedFileFolderWidget *mOpenSavedFileFolderWidget = 
nullptr;
+     WebEngineViewer::SubmittedFormWarningWidget *mSubmittedFormWarning = 
nullptr;
+     WebEngineViewer::TrackingWarningWidget *mMailTrackingWarning = nullptr;
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+     KPIMTextEdit::TextToSpeechWidget *mTextToSpeechWidget = nullptr;
++#endif
+     Viewer::DisplayFormatMessage mDisplayFormatMessageOverwrite;
+     KPIMTextEdit::SlideContainer *mSliderContainer = nullptr;
+     PimCommon::ShareServiceUrlManager *mShareServiceManager = nullptr;
+-- 
+GitLab
+

diff --git 
a/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-3.patch 
b/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-3.patch
new file mode 100644
index 0000000000..092df18f44
--- /dev/null
+++ b/kde-apps/messagelib/files/messagelib-21.12.3-speech-optional-3.patch
@@ -0,0 +1,56 @@
+From 141b7862a292323fa41c9f863e16f49e548d8bfa Mon Sep 17 00:00:00 2001
+From: Andreas Sturmlechner <ast...@gentoo.org>
+Date: Thu, 24 Feb 2022 16:04:59 +0100
+Subject: [PATCH] Fix build without texttospeech
+
+Signed-off-by: Andreas Sturmlechner <ast...@gentoo.org>
+---
+ messageviewer/src/utils/messageviewerutil.cpp                 | 1 -
+ messageviewer/src/viewer/viewer_p.cpp                         | 2 ++
+ messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp | 2 ++
+ 3 files changed, 4 insertions(+), 1 deletion(-)
+
+diff --git a/messageviewer/src/utils/messageviewerutil.cpp 
b/messageviewer/src/utils/messageviewerutil.cpp
+index 607fa65cb..e2446c13a 100644
+--- a/messageviewer/src/utils/messageviewerutil.cpp
++++ b/messageviewer/src/utils/messageviewerutil.cpp
+@@ -41,7 +41,6 @@
+ #include "MessageCore/StringUtil"
+ #include "messageviewer_debug.h"
+ #include "messageviewerutil_p.h"
+-#include <KPIMTextEdit/TextToSpeech>
+ #include <MimeTreeParser/NodeHelper>
+ 
+ #include <PimCommon/RenameFileDialog>
+diff --git a/messageviewer/src/viewer/viewer_p.cpp 
b/messageviewer/src/viewer/viewer_p.cpp
+index b989b294a..22587635c 100644
+--- a/messageviewer/src/viewer/viewer_p.cpp
++++ b/messageviewer/src/viewer/viewer_p.cpp
+@@ -129,7 +129,9 @@
+ #include <Akonadi/CollectionFetchScope>
+ 
+ #include <KJobWidgets/KJobWidgets>
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+ #include <KPIMTextEdit/TextToSpeechWidget>
++#endif
+ #include <QApplication>
+ #include <QStandardPaths>
+ #include <QWebEngineSettings>
+diff --git a/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp 
b/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp
+index 0e5b61c1e..67ac5bf1a 100644
+--- a/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp
++++ b/messageviewer/src/widgets/mailsourceviewtextbrowserwidget.cpp
+@@ -13,8 +13,10 @@
+ #include "messageviewer/messageviewerutil.h"
+ #include "messageviewer_debug.h"
+ #include <KPIMTextEdit/SlideContainer>
++#if KPIMTEXTEDIT_TEXT_TO_SPEECH
+ #include <KPIMTextEdit/TextToSpeechInterface>
+ #include <KPIMTextEdit/TextToSpeechWidget>
++#endif
+ #include <PimCommon/PimUtil>
+ 
+ #include <KSyntaxHighlighting/Definition>
+-- 
+2.35.1
+

diff --git a/kde-apps/messagelib/messagelib-21.12.49.9999.ebuild 
b/kde-apps/messagelib/messagelib-21.12.49.9999.ebuild
index 3420ead5ad..6b800e2062 100644
--- a/kde-apps/messagelib/messagelib-21.12.49.9999.ebuild
+++ b/kde-apps/messagelib/messagelib-21.12.49.9999.ebuild
@@ -16,7 +16,7 @@ DESCRIPTION="Libraries for messaging functions"
 LICENSE="GPL-2+ LGPL-2.1+"
 SLOT="5"
 KEYWORDS=""
-IUSE=""
+IUSE="speech"
 
 # bug 579630
 RESTRICT="test"
@@ -41,7 +41,7 @@ DEPEND="
        >=kde-apps/kmailtransport-${PVCUT}:5
        >=kde-apps/kmbox-${PVCUT}:5
        >=kde-apps/kmime-${PVCUT}:5
-       >=kde-apps/kpimtextedit-${PVCUT}:5
+       >=kde-apps/kpimtextedit-${PVCUT}:5[speech=]
        >=kde-apps/libgravatar-${PVCUT}:5
        >=kde-apps/libkdepim-${PVCUT}:5
        >=kde-apps/libkleo-${PVCUT}:5
@@ -71,3 +71,5 @@ DEPEND="
        >=kde-frameworks/syntax-highlighting-${KFMIN}:5
 "
 RDEPEND="${DEPEND}"
+
+PATCHES=( "${FILESDIR}"/${PN}-21.12.3-speech-optional-{1,2,3}.patch )

diff --git a/kde-apps/messagelib/messagelib-9999.ebuild 
b/kde-apps/messagelib/messagelib-9999.ebuild
index 3420ead5ad..956279a3b2 100644
--- a/kde-apps/messagelib/messagelib-9999.ebuild
+++ b/kde-apps/messagelib/messagelib-9999.ebuild
@@ -16,7 +16,7 @@ DESCRIPTION="Libraries for messaging functions"
 LICENSE="GPL-2+ LGPL-2.1+"
 SLOT="5"
 KEYWORDS=""
-IUSE=""
+IUSE="speech"
 
 # bug 579630
 RESTRICT="test"
@@ -41,7 +41,7 @@ DEPEND="
        >=kde-apps/kmailtransport-${PVCUT}:5
        >=kde-apps/kmbox-${PVCUT}:5
        >=kde-apps/kmime-${PVCUT}:5
-       >=kde-apps/kpimtextedit-${PVCUT}:5
+       >=kde-apps/kpimtextedit-${PVCUT}:5[speech=]
        >=kde-apps/libgravatar-${PVCUT}:5
        >=kde-apps/libkdepim-${PVCUT}:5
        >=kde-apps/libkleo-${PVCUT}:5

diff --git a/kde-apps/messagelib/metadata.xml b/kde-apps/messagelib/metadata.xml
index d925f24397..fa80953797 100644
--- a/kde-apps/messagelib/metadata.xml
+++ b/kde-apps/messagelib/metadata.xml
@@ -8,4 +8,7 @@
        <upstream>
                <bugs-to>https://bugs.kde.org/</bugs-to>
        </upstream>
+       <use>
+               <flag name="speech">Enable text-to-speech support</flag>
+       </use>
 </pkgmetadata>

Reply via email to