From 87bdfaf731680201483c9997fd1ceecd3c322ad6 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 6 Mar 2022 15:52:01 +0300 Subject: [PATCH] Added ability to skip dictionaries manager in context menu. --- .../SourceFiles/chat_helpers/message_field.cpp | 15 ++++++++++----- Telegram/SourceFiles/chat_helpers/message_field.h | 3 ++- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index b843c80aa7..955df52ef3 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -294,15 +294,20 @@ void InitMessageField( void InitSpellchecker( std::shared_ptr show, not_null session, - not_null field) { + not_null field, + bool skipDictionariesManager) { #ifndef TDESKTOP_DISABLE_SPELLCHECK - const auto s = Ui::CreateChild( - field.get(), - Core::App().settings().spellcheckerEnabledValue(), - Spellchecker::SpellingHighlighter::CustomContextMenuItem{ + using namespace Spellchecker; + const auto menuItem = skipDictionariesManager + ? std::nullopt + : std::make_optional(SpellingHighlighter::CustomContextMenuItem{ tr::lng_settings_manage_dictionaries(tr::now), [=] { show->showBox(Box(session)); } }); + const auto s = Ui::CreateChild( + field.get(), + Core::App().settings().spellcheckerEnabledValue(), + menuItem); field->setExtendedContextMenu(s->contextMenuCreated()); #endif // TDESKTOP_DISABLE_SPELLCHECK } diff --git a/Telegram/SourceFiles/chat_helpers/message_field.h b/Telegram/SourceFiles/chat_helpers/message_field.h index 4d579897d0..da0db79fbc 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.h +++ b/Telegram/SourceFiles/chat_helpers/message_field.h @@ -48,7 +48,8 @@ void InitMessageField( void InitSpellchecker( std::shared_ptr show, not_null session, - not_null field); + not_null field, + bool skipDictionariesManager = false); void InitSpellchecker( not_null controller, not_null field);