2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Replaced box for choosing of filter with submenu.

This commit is contained in:
23rd
2022-04-10 13:49:14 +03:00
parent d15ff46eb4
commit 8440c44def
7 changed files with 45 additions and 19 deletions

View File

@@ -420,27 +420,17 @@ void Filler::addInfo() {
void Filler::addToggleFolder() {
const auto history = _request.key.history();
if (!history) {
if (!history || history->owner().chatsFilters().list().empty()) {
return;
}
if (!_request.filterId) {
if (!ChooseFilterValidator(history).canAdd()) {
return;
}
const auto window = _controller;
_addAction(tr::lng_filters_menu_add(tr::now), [=] {
window->show(Box(ChooseFilterBox, history));
}, nullptr);
} else {
const auto id = _request.filterId;
const auto validator = ChooseFilterValidator(history);
if (!validator.canRemove(id)) {
return;
}
_addAction(tr::lng_filters_menu_remove(tr::now), [=] {
validator.remove(id);
}, nullptr);
}
_addAction(PeerMenuCallback::Args{
.text = tr::lng_filters_menu_add(tr::now),
.handler = nullptr,
.icon = &st::menuIconAddToFolder,
.fillSubmenu = [=](not_null<Ui::PopupMenu*> menu) {
FillChooseFilterMenu(menu, history);
},
});
}
void Filler::addToggleUnreadMark() {