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

Added new setting to disable spellchecker.

This commit is contained in:
23rd
2019-10-05 19:38:25 +03:00
committed by John Preston
parent d535f5b3bc
commit 1056021059
4 changed files with 55 additions and 0 deletions

View File

@@ -243,6 +243,30 @@ void SetupUpdate(not_null<Ui::VerticalLayout*> container) {
});
}
bool HasSystemSpellchecker() {
return (Platform::IsWindows() && Platform::IsWindows8OrGreater())
|| Platform::IsMac();
}
void SetupSpellchecker(
not_null<Window::SessionController*> controller,
not_null<Ui::VerticalLayout*> container) {
const auto session = &controller->session();
AddButton(
container,
tr::lng_settings_system_spellchecker(),
st::settingsButton
)->toggleOn(
rpl::single(session->settings().spellcheckerEnabled())
)->toggledValue(
) | rpl::filter([=](bool enabled) {
return (enabled != session->settings().spellcheckerEnabled());
}) | rpl::start_with_next([=](bool enabled) {
session->settings().setSpellcheckerEnabled(enabled);
session->saveSettingsDelayed();
}, container->lifetime());
}
bool HasTray() {
return cSupportTray() || Platform::IsWindows();
}
@@ -515,6 +539,14 @@ void Advanced::setupContent(not_null<Window::SessionController*> controller) {
SetupPerformance(controller, content);
AddSkip(content);
if (HasSystemSpellchecker()) {
AddSkip(content);
AddDivider(content);
AddSubsectionTitle(content, tr::lng_settings_spellchecker());
SetupSpellchecker(controller, content);
AddSkip(content);
}
if (cAutoUpdate()) {
addUpdate();
}