mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-06 15:13:57 +02:00
Added ability to skip dictionaries manager in context menu.
This commit is contained in:
parent
f721f5edcf
commit
87bdfaf731
2 changed files with 12 additions and 6 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue