mirror of
https://github.com/yann64/haikuports.git
synced 2026-04-23 12:10:06 +02:00
Telegram: add Sonnet spellchecker
This commit is contained in:
@@ -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<Sonnet::SpellCheckDecorator>(_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<Ui::PopupMenu>(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 <highlighter.h>
|
||||
+#include <spellcheckdecorator.h>
|
||||
+
|
||||
#include <QtWidgets/QLineEdit>
|
||||
#include <QtWidgets/QTextEdit>
|
||||
|
||||
@@ -512,6 +515,8 @@ private:
|
||||
InstantReplaces _mutableInstantReplaces;
|
||||
bool _instantReplacesEnabled = true;
|
||||
|
||||
+ std::unique_ptr<Sonnet::SpellCheckDecorator> _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',
|
||||
# '<!(pkg-config 2> /dev/null --libs <@(pkgconfig_libs))',
|
||||
--
|
||||
2.23.0
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user