From cbd46a5b7877610bb0a402916abb4b19c190374f Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Tue, 1 Oct 2019 22:43:16 +1000 Subject: [PATCH] Telegram: add Sonnet spellchecker --- .../telegram_desktop-1.8.9-sonnet.patchset | 84 +++++++++++++++++++ .../telegram_desktop-1.8.9.recipe | 7 +- 2 files changed, 90 insertions(+), 1 deletion(-) create mode 100644 net-im/telegram-desktop/patches/telegram_desktop-1.8.9-sonnet.patchset diff --git a/net-im/telegram-desktop/patches/telegram_desktop-1.8.9-sonnet.patchset b/net-im/telegram-desktop/patches/telegram_desktop-1.8.9-sonnet.patchset new file mode 100644 index 000000000..a951c2ba5 --- /dev/null +++ b/net-im/telegram-desktop/patches/telegram_desktop-1.8.9-sonnet.patchset @@ -0,0 +1,84 @@ +From 545bfbfb7133adb77e9bcc8a7159f7a01cd15c7a Mon Sep 17 00:00:00 2001 +From: Gerasim Troeglazov <3dEyes@gmail.com> +Date: Tue, 1 Oct 2019 22:28:55 +1000 +Subject: Add Sonnet spell checking + + +diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.cpp b/Telegram/SourceFiles/ui/widgets/input_fields.cpp +index 7c05d7e..dfb253f 100644 +--- a/Telegram/SourceFiles/ui/widgets/input_fields.cpp ++++ b/Telegram/SourceFiles/ui/widgets/input_fields.cpp +@@ -1371,6 +1371,8 @@ InputField::InputField( + setTextWithTags(_lastTextWithTags, HistoryAction::Clear); + } + ++ _SpellCheckDecorator = std::make_unique(_inner.get()); ++ + startBorderAnimation(); + startPlaceholderAnimation(); + finishAnimating(); +@@ -3361,6 +3363,12 @@ bool InputField::revertFormatReplace() { + void InputField::contextMenuEventInner(QContextMenuEvent *e) { + if (const auto menu = _inner->createStandardContextMenu()) { + addMarkdownActions(menu, e); ++ if (const auto h = _SpellCheckDecorator->highlighter()) { ++ menu->addSeparator(); ++ menu->addAction(h->isActive() ? qsl("Disable spell checking") : qsl("Enable spell checking"), [=] { ++ h->setActive(!h->isActive()); ++ }); ++ } + _contextMenu = base::make_unique_q(this, menu); + _contextMenu->popup(e->globalPos()); + } +diff --git a/Telegram/SourceFiles/ui/widgets/input_fields.h b/Telegram/SourceFiles/ui/widgets/input_fields.h +index 3839304..162ecb5 100644 +--- a/Telegram/SourceFiles/ui/widgets/input_fields.h ++++ b/Telegram/SourceFiles/ui/widgets/input_fields.h +@@ -11,6 +11,9 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL + #include "ui/effects/animations.h" + #include "styles/style_widgets.h" + ++#include ++#include ++ + #include + #include + +@@ -512,6 +515,8 @@ private: + InstantReplaces _mutableInstantReplaces; + bool _instantReplacesEnabled = true; + ++ std::unique_ptr _SpellCheckDecorator; ++ + }; + + class MaskedInputField +diff --git a/Telegram/gyp/telegram_haiku.gypi b/Telegram/gyp/telegram_haiku.gypi +index 7c6f0b5..20dd34e 100644 +--- a/Telegram/gyp/telegram_haiku.gypi ++++ b/Telegram/gyp/telegram_haiku.gypi +@@ -30,6 +30,12 @@ + '<(haiku_path_include)/AL', + '<(haiku_path_include)/breakpad', + '<(haiku_path_include)/opus', ++ '<(haiku_path_include)/KF5/SonnetCore', ++ '<(haiku_path_include)/KF5/SonnetCore/Sonnet', ++ '<(haiku_path_include)/KF5/SonnetCore/sonnet', ++ '<(haiku_path_include)/KF5/SonnetUi', ++ '<(haiku_path_include)/KF5/SonnetUi/Sonnet', ++ '<(haiku_path_include)/KF5/SonnetUi/sonnet', + '../ThirdParty/range/include', + ], + 'library_dirs': [ +@@ -48,6 +54,8 @@ + 'network', + 'translation', + 'be', ++ 'KF5SonnetCore', ++ 'KF5SonnetUi', + 'lzma', + 'z', + # ' /dev/null --libs <@(pkgconfig_libs))', +-- +2.23.0 + diff --git a/net-im/telegram-desktop/telegram_desktop-1.8.9.recipe b/net-im/telegram-desktop/telegram_desktop-1.8.9.recipe index 3c2bb7aa4..96a0d33d4 100644 --- a/net-im/telegram-desktop/telegram_desktop-1.8.9.recipe +++ b/net-im/telegram-desktop/telegram_desktop-1.8.9.recipe @@ -3,7 +3,7 @@ DESCRIPTION="Unofficial build of the original Telegram client for Haiku." HOMEPAGE="https://www.telegram.org/" COPYRIGHT="2013-2019 Telegram" LICENSE="GNU GPL v3" -REVISION="1" +REVISION="2" SOURCE_URI="https://github.com/telegramdesktop/tdesktop/archive/v$portVersion.tar.gz" CHECKSUM_SHA256="2df035cc4a582660b612656c22ff10d37eb34dbece958f9c99f6a0bd4e2fb61b" SOURCE_FILENAME="tdesktop-$portVersion.tar.gz" @@ -50,6 +50,7 @@ CHECKSUM_SHA256_11="2b24fb808acee36b5a15824c4ff8bd8b8e83a326a9e4593d2b21922425c5 PATCHES=" telegram_desktop-$portVersion-systemqt.patch telegram_desktop-$portVersion.patchset + telegram_desktop-$portVersion-sonnet.patchset " PATCHES_2=" @@ -76,6 +77,8 @@ REQUIRES=" lib:libcrypto$secondaryArchSuffix lib:libglib_2.0$secondaryArchSuffix lib:libgthread_2.0$secondaryArchSuffix + lib:libKF5SonnetCore$secondaryArchSuffix + lib:libKF5SonnetUi$secondaryArchSuffix lib:liblzma$secondaryArchSuffix lib:libminizip$secondaryArchSuffix lib:libopenal$secondaryArchSuffix @@ -97,6 +100,8 @@ BUILD_REQUIRES=" devel:libcrypto$secondaryArchSuffix devel:libglib_2.0$secondaryArchSuffix devel:libgthread_2.0$secondaryArchSuffix + devel:libKF5SonnetCore$secondaryArchSuffix + devel:libKF5SonnetUi$secondaryArchSuffix devel:liblzma$secondaryArchSuffix devel:libminizip$secondaryArchSuffix devel:libopenal$secondaryArchSuffix