mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Replaced Ui::InformBox and Ui::ConfirmBox with GenericBox.
This commit is contained in:
@@ -219,7 +219,7 @@ bool PinnedLimitReached(Dialogs::Key key, FilterId filterId) {
|
||||
tr::now,
|
||||
lt_count,
|
||||
pinnedMax);
|
||||
Ui::show(Box<Ui::InformBox>(errorText));
|
||||
Ui::show(Ui::MakeInformBox(errorText));
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -855,10 +855,11 @@ void PeerMenuDeleteContact(not_null<UserData*> user) {
|
||||
user->session().api().applyUpdates(result);
|
||||
}).send();
|
||||
};
|
||||
Ui::show(Box<Ui::ConfirmBox>(
|
||||
text,
|
||||
tr::lng_box_delete(tr::now),
|
||||
deleteSure));
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
.text = text,
|
||||
.confirmed = deleteSure,
|
||||
.confirmText = tr::lng_box_delete(),
|
||||
}));
|
||||
}
|
||||
|
||||
void PeerMenuShareContactBox(
|
||||
@@ -867,8 +868,8 @@ void PeerMenuShareContactBox(
|
||||
const auto weak = std::make_shared<QPointer<PeerListBox>>();
|
||||
auto callback = [=](not_null<PeerData*> peer) {
|
||||
if (!peer->canWrite()) {
|
||||
Ui::show(Box<Ui::InformBox>(
|
||||
tr::lng_forward_share_cant(tr::now)),
|
||||
Ui::show(
|
||||
Ui::MakeInformBox(tr::lng_forward_share_cant()),
|
||||
Ui::LayerOption::KeepOther);
|
||||
return;
|
||||
} else if (peer->isSelf()) {
|
||||
@@ -884,19 +885,25 @@ void PeerMenuShareContactBox(
|
||||
auto recipient = peer->isUser()
|
||||
? peer->name
|
||||
: '\xAB' + peer->name + '\xBB';
|
||||
Ui::show(Box<Ui::ConfirmBox>(
|
||||
tr::lng_forward_share_contact(tr::now, lt_recipient, recipient),
|
||||
tr::lng_forward_send(tr::now),
|
||||
[peer, user, navigation] {
|
||||
const auto history = peer->owner().history(peer);
|
||||
navigation->showPeerHistory(
|
||||
history,
|
||||
Window::SectionShow::Way::ClearStack,
|
||||
ShowAtTheEndMsgId);
|
||||
auto action = Api::SendAction(history);
|
||||
action.clearDraft = false;
|
||||
user->session().api().shareContact(user, action);
|
||||
}), Ui::LayerOption::KeepOther);
|
||||
Ui::show(
|
||||
Ui::MakeConfirmBox({
|
||||
.text = tr::lng_forward_share_contact(
|
||||
tr::now,
|
||||
lt_recipient,
|
||||
recipient),
|
||||
.confirmed = [peer, user, navigation] {
|
||||
const auto history = peer->owner().history(peer);
|
||||
navigation->showPeerHistory(
|
||||
history,
|
||||
Window::SectionShow::Way::ClearStack,
|
||||
ShowAtTheEndMsgId);
|
||||
auto action = Api::SendAction(history);
|
||||
action.clearDraft = false;
|
||||
user->session().api().shareContact(user, action);
|
||||
},
|
||||
.confirmText = tr::lng_forward_send(),
|
||||
}),
|
||||
Ui::LayerOption::KeepOther);
|
||||
};
|
||||
*weak = Ui::show(Box<PeerListBox>(
|
||||
std::make_unique<ChooseRecipientBoxController>(
|
||||
@@ -1186,7 +1193,11 @@ QPointer<Ui::BoxContent> ShowSendNowMessagesBox(
|
||||
}
|
||||
};
|
||||
return Ui::show(
|
||||
Box<Ui::ConfirmBox>(text, tr::lng_send_button(tr::now), std::move(done)),
|
||||
Ui::MakeConfirmBox({
|
||||
.text = text,
|
||||
.confirmed = std::move(done),
|
||||
.confirmText = tr::lng_send_button(),
|
||||
}),
|
||||
Ui::LayerOption::KeepOther).data();
|
||||
}
|
||||
|
||||
@@ -1247,10 +1258,11 @@ void ToggleMessagePinned(
|
||||
session->api().applyUpdates(result);
|
||||
}).send();
|
||||
});
|
||||
Ui::show(Box<Ui::ConfirmBox>(
|
||||
tr::lng_pinned_unpin_sure(tr::now),
|
||||
tr::lng_pinned_unpin(tr::now),
|
||||
callback));
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
.text = tr::lng_pinned_unpin_sure(),
|
||||
.confirmed = callback,
|
||||
.confirmText = tr::lng_pinned_unpin(),
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1278,10 +1290,11 @@ void HidePinnedBar(
|
||||
session.api().requestFullPeer(peer);
|
||||
}
|
||||
});
|
||||
Ui::show(Box<Ui::ConfirmBox>(
|
||||
tr::lng_pinned_hide_all_sure(tr::now),
|
||||
tr::lng_pinned_hide_all_hide(tr::now),
|
||||
callback));
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
.text = tr::lng_pinned_hide_all_sure(),
|
||||
.confirmed = callback,
|
||||
.confirmText = tr::lng_pinned_hide_all_hide(),
|
||||
}));
|
||||
}
|
||||
|
||||
void UnpinAllMessages(
|
||||
@@ -1305,10 +1318,11 @@ void UnpinAllMessages(
|
||||
};
|
||||
sendRequest(sendRequest);
|
||||
});
|
||||
Ui::show(Box<Ui::ConfirmBox>(
|
||||
tr::lng_pinned_unpin_all_sure(tr::now),
|
||||
tr::lng_pinned_unpin(tr::now),
|
||||
callback));
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
.text = tr::lng_pinned_unpin_all_sure(),
|
||||
.confirmed = callback,
|
||||
.confirmText = tr::lng_pinned_unpin(),
|
||||
}));
|
||||
}
|
||||
|
||||
void PeerMenuAddMuteAction(
|
||||
@@ -1348,9 +1362,10 @@ void MenuAddMarkAsReadAllChatsAction(
|
||||
MarkAsReadChatList(folder->chatsList());
|
||||
}
|
||||
};
|
||||
Ui::show(Box<Ui::ConfirmBox>(
|
||||
tr::lng_context_mark_read_all_sure(tr::now),
|
||||
std::move(boxCallback)));
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
tr::lng_context_mark_read_all_sure(),
|
||||
std::move(boxCallback)
|
||||
}));
|
||||
};
|
||||
addAction(
|
||||
tr::lng_context_mark_read_all(tr::now),
|
||||
@@ -1372,9 +1387,10 @@ void MenuAddMarkAsReadChatListAction(
|
||||
MarkAsReadChatList(list());
|
||||
close();
|
||||
};
|
||||
Ui::show(Box<Ui::ConfirmBox>(
|
||||
tr::lng_context_mark_read_sure(tr::now),
|
||||
std::move(boxCallback)));
|
||||
Ui::show(Ui::MakeConfirmBox({
|
||||
tr::lng_context_mark_read_sure(),
|
||||
std::move(boxCallback)
|
||||
}));
|
||||
} else {
|
||||
MarkAsReadChatList(list());
|
||||
}
|
||||
|
Reference in New Issue
Block a user