mirror of
https://github.com/yann64/haikuports.git
synced 2026-05-06 06:58:57 +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
|
||||
|
||||
Reference in New Issue
Block a user