mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Moved out ability to mark as read all chats from hidden shortcut.
This commit is contained in:
parent
80a1e6ecf3
commit
183a9139f9
3 changed files with 35 additions and 15 deletions
|
@ -3656,6 +3656,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_context_mark_read_sure" = "Are you sure you want to mark all chats from this folder as read?";
|
"lng_context_mark_read_sure" = "Are you sure you want to mark all chats from this folder as read?";
|
||||||
"lng_context_mark_read_all" = "Mark all chats as read";
|
"lng_context_mark_read_all" = "Mark all chats as read";
|
||||||
"lng_context_mark_read_all_sure" = "Are you sure you want to mark all chats as read?";
|
"lng_context_mark_read_all_sure" = "Are you sure you want to mark all chats as read?";
|
||||||
|
"lng_context_mark_read_all_sure_2" = "**This action cannot be undone.**";
|
||||||
"lng_context_mark_read_mentions_all" = "Mark all mentions as read";
|
"lng_context_mark_read_mentions_all" = "Mark all mentions as read";
|
||||||
"lng_context_mark_read_reactions_all" = "Read all reactions";
|
"lng_context_mark_read_reactions_all" = "Read all reactions";
|
||||||
"lng_context_archive_expand" = "Expand";
|
"lng_context_archive_expand" = "Expand";
|
||||||
|
|
|
@ -746,17 +746,6 @@ void SetupAccountsWrap(
|
||||||
} else if (which != Qt::RightButton) {
|
} else if (which != Qt::RightButton) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!state->menu && IsAltShift(raw->clickModifiers()) && !locked) {
|
|
||||||
state->menu = base::make_unique_q<Ui::PopupMenu>(
|
|
||||||
raw,
|
|
||||||
st::popupMenuWithIcons);
|
|
||||||
Window::MenuAddMarkAsReadAllChatsAction(
|
|
||||||
session,
|
|
||||||
window->uiShow(),
|
|
||||||
Ui::Menu::CreateAddActionCallback(state->menu));
|
|
||||||
state->menu->popup(QCursor::pos());
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (session == &window->session() || state->menu) {
|
if (session == &window->session() || state->menu) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -781,6 +770,10 @@ void SetupAccountsWrap(
|
||||||
addAction(tr::lng_menu_activate(tr::now), [=] {
|
addAction(tr::lng_menu_activate(tr::now), [=] {
|
||||||
callback({});
|
callback({});
|
||||||
}, &st::menuIconProfile);
|
}, &st::menuIconProfile);
|
||||||
|
Window::MenuAddMarkAsReadAllChatsAction(
|
||||||
|
session,
|
||||||
|
window->uiShow(),
|
||||||
|
addAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto logoutCallback = [=] {
|
auto logoutCallback = [=] {
|
||||||
|
|
|
@ -2770,7 +2770,6 @@ void MenuAddMarkAsReadAllChatsAction(
|
||||||
not_null<Main::Session*> session,
|
not_null<Main::Session*> session,
|
||||||
std::shared_ptr<Ui::Show> show,
|
std::shared_ptr<Ui::Show> show,
|
||||||
const PeerMenuCallback &addAction) {
|
const PeerMenuCallback &addAction) {
|
||||||
// There is no async to make weak from controller.
|
|
||||||
auto callback = [=, owner = &session->data()] {
|
auto callback = [=, owner = &session->data()] {
|
||||||
auto boxCallback = [=](Fn<void()> &&close) {
|
auto boxCallback = [=](Fn<void()> &&close) {
|
||||||
close();
|
close();
|
||||||
|
@ -2781,9 +2780,36 @@ void MenuAddMarkAsReadAllChatsAction(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
show->show(
|
show->show(
|
||||||
Ui::MakeConfirmBox({
|
Box([=](not_null<Ui::GenericBox*> box) {
|
||||||
tr::lng_context_mark_read_all_sure(),
|
Ui::AddSkip(box->verticalLayout());
|
||||||
std::move(boxCallback)
|
Ui::AddSkip(box->verticalLayout());
|
||||||
|
const auto userpic = Ui::CreateChild<Ui::UserpicButton>(
|
||||||
|
box->verticalLayout(),
|
||||||
|
session->user(),
|
||||||
|
st::mainMenuUserpic);
|
||||||
|
Ui::IconWithTitle(
|
||||||
|
box->verticalLayout(),
|
||||||
|
userpic,
|
||||||
|
Ui::CreateChild<Ui::FlatLabel>(
|
||||||
|
box->verticalLayout(),
|
||||||
|
Info::Profile::NameValue(session->user()),
|
||||||
|
box->getDelegate()->style().title));
|
||||||
|
auto text = rpl::combine(
|
||||||
|
tr::lng_context_mark_read_all_sure(),
|
||||||
|
tr::lng_context_mark_read_all_sure_2(
|
||||||
|
Ui::Text::RichLangValue)
|
||||||
|
) | rpl::map([](QString t1, TextWithEntities t2) {
|
||||||
|
return TextWithEntities()
|
||||||
|
.append(std::move(t1))
|
||||||
|
.append('\n')
|
||||||
|
.append('\n')
|
||||||
|
.append(std::move(t2));
|
||||||
|
});
|
||||||
|
Ui::ConfirmBox(box, {
|
||||||
|
.text = std::move(text),
|
||||||
|
.confirmed = std::move(boxCallback),
|
||||||
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
});
|
||||||
}),
|
}),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue