mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Added new setting for automatic dictionaries download.
This commit is contained in:
@@ -343,37 +343,39 @@ void Start(not_null<Main::Session*> session) {
|
||||
{ &ph::lng_spellchecker_remove, tr::lng_spellchecker_remove() },
|
||||
{ &ph::lng_spellchecker_ignore, tr::lng_spellchecker_ignore() },
|
||||
} });
|
||||
const auto settings = &session->settings();
|
||||
|
||||
if (!Platform::Spellchecker::IsSystemSpellchecker()) {
|
||||
Spellchecker::SetWorkingDirPath(DictionariesPath());
|
||||
|
||||
session->settings().dictionariesEnabledChanges(
|
||||
settings->dictionariesEnabledChanges(
|
||||
) | rpl::start_with_next([](auto dictionaries) {
|
||||
Platform::Spellchecker::UpdateLanguages(dictionaries);
|
||||
}, session->lifetime());
|
||||
|
||||
session->settings().spellcheckerEnabledChanges(
|
||||
settings->spellcheckerEnabledChanges(
|
||||
) | rpl::start_with_next([=](auto enabled) {
|
||||
Platform::Spellchecker::UpdateLanguages(
|
||||
enabled
|
||||
? session->settings().dictionariesEnabled()
|
||||
? settings->dictionariesEnabled()
|
||||
: std::vector<int>());
|
||||
}, session->lifetime());
|
||||
|
||||
session->data().contactsLoaded().changes(
|
||||
) | rpl::start_with_next([=](bool loaded) {
|
||||
if (!loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
DownloadDictionaryInBackground(session, 0, DefaultLanguages());
|
||||
}, session->lifetime());
|
||||
if (settings->autoDownloadDictionaries()) {
|
||||
session->data().contactsLoaded().changes(
|
||||
) | rpl::start_with_next([=](bool loaded) {
|
||||
if (!loaded) {
|
||||
return;
|
||||
}
|
||||
|
||||
DownloadDictionaryInBackground(session, 0, DefaultLanguages());
|
||||
}, session->lifetime());
|
||||
}
|
||||
|
||||
}
|
||||
if (session->settings().spellcheckerEnabled()) {
|
||||
if (settings->spellcheckerEnabled()) {
|
||||
Platform::Spellchecker::UpdateLanguages(
|
||||
session->settings().dictionariesEnabled());
|
||||
settings->dictionariesEnabled());
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user