mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-07-25 06:54:43 +00:00
Fixed reset of enabled dictionaries on manage box close without save.
This commit is contained in:
@@ -424,11 +424,6 @@ void ManageDictionariesBox::prepare() {
|
|||||||
multiSelect->setInnerFocus();
|
multiSelect->setInnerFocus();
|
||||||
};
|
};
|
||||||
|
|
||||||
// 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(), [=] {
|
||||||
@@ -442,8 +437,12 @@ void ManageDictionariesBox::prepare() {
|
|||||||
addButton(tr::lng_close(), [=] { closeBox(); });
|
addButton(tr::lng_close(), [=] { closeBox(); });
|
||||||
|
|
||||||
boxClosing() | rpl::on_next([=] {
|
boxClosing() | rpl::on_next([=] {
|
||||||
Core::App().settings().setDictionariesEnabled(
|
const auto ¤t = Core::App().settings().dictionariesEnabled();
|
||||||
FilterEnabledDict(initialEnabledRows));
|
const auto filtered = FilterEnabledDict(current);
|
||||||
|
if (filtered.size() == current.size()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
Core::App().settings().setDictionariesEnabled(filtered);
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user