mirror of https://github.com/procxx/kepka.git
Added filter for removed dictionaries when dictionary box is closed.
This commit is contained in:
parent
4bd34b35ae
commit
e9e9ea2d69
|
@ -122,6 +122,7 @@ auto AddButtonWithLoader(
|
||||||
const Spellchecker::Dict &dict,
|
const Spellchecker::Dict &dict,
|
||||||
bool buttonEnabled) {
|
bool buttonEnabled) {
|
||||||
const auto id = dict.id;
|
const auto id = dict.id;
|
||||||
|
buttonEnabled &= DictExists(id);
|
||||||
|
|
||||||
const auto button = content->add(
|
const auto button = content->add(
|
||||||
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
object_ptr<Ui::SlideWrap<Ui::SettingsButton>>(
|
||||||
|
@ -272,6 +273,11 @@ void ManageDictionariesBox::prepare() {
|
||||||
this,
|
this,
|
||||||
_session->settings().dictionariesEnabled()));
|
_session->settings().dictionariesEnabled()));
|
||||||
|
|
||||||
|
// The initial list of enabled rows may differ from the list of languages
|
||||||
|
// in settings, so we should store it when box opens
|
||||||
|
// and save it when box closes (don't do it when "Save" was pressed).
|
||||||
|
const auto initialEnabledRows = inner->enabledRows();
|
||||||
|
|
||||||
setTitle(tr::lng_settings_manage_dictionaries());
|
setTitle(tr::lng_settings_manage_dictionaries());
|
||||||
|
|
||||||
addButton(tr::lng_settings_save(), [=] {
|
addButton(tr::lng_settings_save(), [=] {
|
||||||
|
@ -281,10 +287,17 @@ void ManageDictionariesBox::prepare() {
|
||||||
DictExists
|
DictExists
|
||||||
) | ranges::to_vector);
|
) | ranges::to_vector);
|
||||||
_session->saveSettingsDelayed();
|
_session->saveSettingsDelayed();
|
||||||
|
// Ignore boxClosing() when the Save button was pressed.
|
||||||
|
lifetime().destroy();
|
||||||
closeBox();
|
closeBox();
|
||||||
});
|
});
|
||||||
addButton(tr::lng_close(), [=] { closeBox(); });
|
addButton(tr::lng_close(), [=] { closeBox(); });
|
||||||
|
|
||||||
|
boxClosing() | rpl::start_with_next([=] {
|
||||||
|
_session->settings().setDictionariesEnabled(initialEnabledRows);
|
||||||
|
_session->saveSettingsDelayed();
|
||||||
|
}, lifetime());
|
||||||
|
|
||||||
setDimensionsToContent(st::boxWidth, inner);
|
setDimensionsToContent(st::boxWidth, inner);
|
||||||
|
|
||||||
inner->heightValue(
|
inner->heightValue(
|
||||||
|
|
Loading…
Reference in New Issue