2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Added new setting for automatic dictionaries download.

This commit is contained in:
23rd
2020-02-20 22:27:21 +03:00
parent bb8aead078
commit bc6e1e7a0d
5 changed files with 54 additions and 16 deletions

View File

@@ -261,6 +261,7 @@ void SetupSpellchecker(
not_null<Ui::VerticalLayout*> container) {
#ifndef TDESKTOP_DISABLE_SPELLCHECK
const auto session = &controller->session();
const auto settings = &session->settings();
const auto isSystem = Platform::Spellchecker::IsSystemSpellchecker();
const auto button = AddButton(
container,
@@ -269,14 +270,14 @@ void SetupSpellchecker(
: tr::lng_settings_custom_spellchecker(),
st::settingsButton
)->toggleOn(
rpl::single(session->settings().spellcheckerEnabled())
rpl::single(settings->spellcheckerEnabled())
);
button->toggledValue(
) | rpl::filter([=](bool enabled) {
return (enabled != session->settings().spellcheckerEnabled());
return (enabled != settings->spellcheckerEnabled());
}) | rpl::start_with_next([=](bool enabled) {
session->settings().setSpellcheckerEnabled(enabled);
settings->setSpellcheckerEnabled(enabled);
session->saveSettingsDelayed();
}, container->lifetime());
@@ -289,6 +290,20 @@ void SetupSpellchecker(
container,
object_ptr<Ui::VerticalLayout>(container)));
AddButton(
sliding->entity(),
tr::lng_settings_auto_download_dictionaries(),
st::settingsButton
)->toggleOn(
rpl::single(settings->autoDownloadDictionaries())
)->toggledValue(
) | rpl::filter([=](bool enabled) {
return (enabled != settings->autoDownloadDictionaries());
}) | rpl::start_with_next([=](bool enabled) {
settings->setAutoDownloadDictionaries(enabled);
session->saveSettingsDelayed();
}, sliding->entity()->lifetime());
AddButtonWithLabel(
sliding->entity(),
tr::lng_settings_manage_dictionaries(),