mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-09-01 07:05:13 +00:00
Added ability to skip dictionaries manager in context menu.
This commit is contained in:
@@ -294,15 +294,20 @@ void InitMessageField(
|
|||||||
void InitSpellchecker(
|
void InitSpellchecker(
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
not_null<Ui::InputField*> field) {
|
not_null<Ui::InputField*> field,
|
||||||
|
bool skipDictionariesManager) {
|
||||||
#ifndef TDESKTOP_DISABLE_SPELLCHECK
|
#ifndef TDESKTOP_DISABLE_SPELLCHECK
|
||||||
const auto s = Ui::CreateChild<Spellchecker::SpellingHighlighter>(
|
using namespace Spellchecker;
|
||||||
field.get(),
|
const auto menuItem = skipDictionariesManager
|
||||||
Core::App().settings().spellcheckerEnabledValue(),
|
? std::nullopt
|
||||||
Spellchecker::SpellingHighlighter::CustomContextMenuItem{
|
: std::make_optional(SpellingHighlighter::CustomContextMenuItem{
|
||||||
tr::lng_settings_manage_dictionaries(tr::now),
|
tr::lng_settings_manage_dictionaries(tr::now),
|
||||||
[=] { show->showBox(Box<Ui::ManageDictionariesBox>(session)); }
|
[=] { show->showBox(Box<Ui::ManageDictionariesBox>(session)); }
|
||||||
});
|
});
|
||||||
|
const auto s = Ui::CreateChild<SpellingHighlighter>(
|
||||||
|
field.get(),
|
||||||
|
Core::App().settings().spellcheckerEnabledValue(),
|
||||||
|
menuItem);
|
||||||
field->setExtendedContextMenu(s->contextMenuCreated());
|
field->setExtendedContextMenu(s->contextMenuCreated());
|
||||||
#endif // TDESKTOP_DISABLE_SPELLCHECK
|
#endif // TDESKTOP_DISABLE_SPELLCHECK
|
||||||
}
|
}
|
||||||
|
@@ -48,7 +48,8 @@ void InitMessageField(
|
|||||||
void InitSpellchecker(
|
void InitSpellchecker(
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
not_null<Ui::InputField*> field);
|
not_null<Ui::InputField*> field,
|
||||||
|
bool skipDictionariesManager = false);
|
||||||
void InitSpellchecker(
|
void InitSpellchecker(
|
||||||
not_null<Window::SessionController*> controller,
|
not_null<Window::SessionController*> controller,
|
||||||
not_null<Ui::InputField*> field);
|
not_null<Ui::InputField*> field);
|
||||||
|
Reference in New Issue
Block a user