mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Replaced Ui::InformBox and Ui::ConfirmBox with GenericBox.
This commit is contained in:
parent
d5a44a2ba4
commit
5718789d53
89 changed files with 796 additions and 733 deletions
|
@ -2392,7 +2392,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_group_call_rtmp_key_subtitle" = "Stream Key";
|
"lng_group_call_rtmp_key_subtitle" = "Stream Key";
|
||||||
"lng_group_call_rtmp_key_copy" = "Copy Stream Key";
|
"lng_group_call_rtmp_key_copy" = "Copy Stream Key";
|
||||||
"lng_group_call_rtmp_key_copied" = "Stream Key copied to clipboard.";
|
"lng_group_call_rtmp_key_copied" = "Stream Key copied to clipboard.";
|
||||||
"lng_group_call_rtmp_key_warn" = "Never share your Stream Key with anyone or show it on stream!";
|
"lng_group_call_rtmp_key_warning" = "**Never share your Stream Key with anyone or show it on stream!**";
|
||||||
"lng_group_call_rtmp_info" = "To stream video with another app, enter these Server URL and Stream Key in your streaming app.\n\nOnce you start broadcasting in your streaming app, tap Start Streaming below";
|
"lng_group_call_rtmp_info" = "To stream video with another app, enter these Server URL and Stream Key in your streaming app.\n\nOnce you start broadcasting in your streaming app, tap Start Streaming below";
|
||||||
"lng_group_call_rtmp_start" = "Start Streaming";
|
"lng_group_call_rtmp_start" = "Start Streaming";
|
||||||
"lng_group_call_rtmp_revoke_sure" = "Are you sure you want to revoke your Server URL and Stream Key?";
|
"lng_group_call_rtmp_revoke_sure" = "Are you sure you want to revoke your Server URL and Stream Key?";
|
||||||
|
|
|
@ -37,7 +37,7 @@ void AttachedStickers::request(
|
||||||
}
|
}
|
||||||
if (result.v.isEmpty()) {
|
if (result.v.isEmpty()) {
|
||||||
strongController->show(
|
strongController->show(
|
||||||
Box<Ui::InformBox>(tr::lng_stickers_not_found(tr::now)));
|
Ui::MakeInformBox(tr::lng_stickers_not_found()));
|
||||||
return;
|
return;
|
||||||
} else if (result.v.size() > 1) {
|
} else if (result.v.size() > 1) {
|
||||||
strongController->show(
|
strongController->show(
|
||||||
|
@ -63,7 +63,7 @@ void AttachedStickers::request(
|
||||||
_requestId = 0;
|
_requestId = 0;
|
||||||
if (const auto strongController = weak.get()) {
|
if (const auto strongController = weak.get()) {
|
||||||
strongController->show(
|
strongController->show(
|
||||||
Box<Ui::InformBox>(tr::lng_stickers_not_found(tr::now)));
|
Ui::MakeInformBox(tr::lng_stickers_not_found()));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
|
|
@ -100,7 +100,7 @@ void SendBotCallbackData(
|
||||||
|
|
||||||
if (!message.isEmpty()) {
|
if (!message.isEmpty()) {
|
||||||
if (showAlert) {
|
if (showAlert) {
|
||||||
Ui::show(Box<Ui::InformBox>(message));
|
Ui::show(Ui::MakeInformBox(message));
|
||||||
} else {
|
} else {
|
||||||
if (withPassword) {
|
if (withPassword) {
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
|
|
|
@ -86,8 +86,7 @@ void CheckChatInvite(
|
||||||
}
|
}
|
||||||
Core::App().hideMediaView();
|
Core::App().hideMediaView();
|
||||||
if (const auto strong = weak.get()) {
|
if (const auto strong = weak.get()) {
|
||||||
strong->show(
|
strong->show(Ui::MakeInformBox(tr::lng_group_invite_bad_link()));
|
||||||
Box<Ui::InformBox>(tr::lng_group_invite_bad_link(tr::now)));
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -86,7 +86,7 @@ void ConfirmPhone::resolve(
|
||||||
)).done([=] {
|
)).done([=] {
|
||||||
_checkRequestId = 0;
|
_checkRequestId = 0;
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(
|
||||||
tr::lng_confirm_phone_success(
|
tr::lng_confirm_phone_success(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_phone,
|
lt_phone,
|
||||||
|
@ -120,7 +120,7 @@ void ConfirmPhone::resolve(
|
||||||
? tr::lng_confirm_phone_link_invalid(tr::now)
|
? tr::lng_confirm_phone_link_invalid(tr::now)
|
||||||
: Lang::Hard::ServerError();
|
: Lang::Hard::ServerError();
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(errorText),
|
Ui::MakeInformBox(errorText),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
}).handleFloodErrors().send();
|
}).handleFloodErrors().send();
|
||||||
}
|
}
|
||||||
|
|
|
@ -149,8 +149,7 @@ void EditMessageWithUploadedMedia(
|
||||||
session->data().sendHistoryChangeNotifications();
|
session->data().sendHistoryChangeNotifications();
|
||||||
if (mediaInvalid) {
|
if (mediaInvalid) {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(tr::lng_edit_media_invalid_file()),
|
||||||
tr::lng_edit_media_invalid_file(tr::now)),
|
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -2021,7 +2021,7 @@ void Updates::feedUpdate(const MTPUpdate &update) {
|
||||||
} else if (d.is_popup()) {
|
} else if (d.is_popup()) {
|
||||||
const auto &windows = session().windows();
|
const auto &windows = session().windows();
|
||||||
if (!windows.empty()) {
|
if (!windows.empty()) {
|
||||||
windows.front()->window().show(Box<Ui::InformBox>(text));
|
windows.front()->window().show(Ui::MakeInformBox(text));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
session().data().serviceNotification(text, d.vmedia());
|
session().data().serviceNotification(text, d.vmedia());
|
||||||
|
|
|
@ -466,17 +466,18 @@ void ApiWrap::sendMessageFail(
|
||||||
uint64 randomId,
|
uint64 randomId,
|
||||||
FullMsgId itemId) {
|
FullMsgId itemId) {
|
||||||
if (error.type() == qstr("PEER_FLOOD")) {
|
if (error.type() == qstr("PEER_FLOOD")) {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(
|
||||||
PeerFloodErrorText(&session(), PeerFloodType::Send)));
|
PeerFloodErrorText(&session(), PeerFloodType::Send)));
|
||||||
} else if (error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
|
} else if (error.type() == qstr("USER_BANNED_IN_CHANNEL")) {
|
||||||
const auto link = Ui::Text::Link(
|
const auto link = Ui::Text::Link(
|
||||||
tr::lng_cant_more_info(tr::now),
|
tr::lng_cant_more_info(tr::now),
|
||||||
session().createInternalLinkFull(qsl("spambot")));
|
session().createInternalLinkFull(qsl("spambot")));
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_error_public_groups_denied(
|
Ui::show(Ui::MakeInformBox(
|
||||||
tr::now,
|
tr::lng_error_public_groups_denied(
|
||||||
lt_more_info,
|
tr::now,
|
||||||
link,
|
lt_more_info,
|
||||||
Ui::Text::WithEntities)));
|
link,
|
||||||
|
Ui::Text::WithEntities)));
|
||||||
} else if (error.type().startsWith(qstr("SLOWMODE_WAIT_"))) {
|
} else if (error.type().startsWith(qstr("SLOWMODE_WAIT_"))) {
|
||||||
const auto chop = qstr("SLOWMODE_WAIT_").size();
|
const auto chop = qstr("SLOWMODE_WAIT_").size();
|
||||||
const auto left = base::StringViewMid(error.type(), chop).toInt();
|
const auto left = base::StringViewMid(error.type(), chop).toInt();
|
||||||
|
@ -494,7 +495,7 @@ void ApiWrap::sendMessageFail(
|
||||||
Assert(peer->isUser());
|
Assert(peer->isUser());
|
||||||
if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) {
|
if (const auto item = scheduled.lookupItem(peer->id, itemId.msg)) {
|
||||||
scheduled.removeSending(item);
|
scheduled.removeSending(item);
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_cant_do_this(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_cant_do_this()));
|
||||||
}
|
}
|
||||||
} else if (error.type() == qstr("CHAT_FORWARDS_RESTRICTED")) {
|
} else if (error.type() == qstr("CHAT_FORWARDS_RESTRICTED")) {
|
||||||
Ui::ShowMultilineToast({ .text = { peer->isBroadcast()
|
Ui::ShowMultilineToast({ .text = { peer->isBroadcast()
|
||||||
|
@ -1275,7 +1276,7 @@ void ApiWrap::migrateDone(
|
||||||
|
|
||||||
void ApiWrap::migrateFail(not_null<PeerData*> peer, const QString &error) {
|
void ApiWrap::migrateFail(not_null<PeerData*> peer, const QString &error) {
|
||||||
if (error == u"CHANNELS_TOO_MUCH"_q) {
|
if (error == u"CHANNELS_TOO_MUCH"_q) {
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_migrate_error(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_migrate_error()));
|
||||||
}
|
}
|
||||||
if (auto handlers = _migrateCallbacks.take(peer)) {
|
if (auto handlers = _migrateCallbacks.take(peer)) {
|
||||||
for (auto &handler : *handlers) {
|
for (auto &handler : *handlers) {
|
||||||
|
|
|
@ -110,8 +110,11 @@ void AboutBox::showVersionHistory() {
|
||||||
|
|
||||||
QGuiApplication::clipboard()->setText(url);
|
QGuiApplication::clipboard()->setText(url);
|
||||||
|
|
||||||
Ui::show(Box<Ui::InformBox>("The link to the current private alpha "
|
getDelegate()->show(
|
||||||
"version of Telegram Desktop was copied to the clipboard."));
|
Ui::MakeInformBox(
|
||||||
|
"The link to the current private alpha "
|
||||||
|
"version of Telegram Desktop was copied to the clipboard."),
|
||||||
|
Ui::LayerOption::CloseOther);
|
||||||
} else {
|
} else {
|
||||||
UrlClickHandler::Open(Core::App().changelogLink());
|
UrlClickHandler::Open(Core::App().changelogLink());
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,11 +161,11 @@ void ShowAddParticipantsError(
|
||||||
*weak = Ui::show(std::move(box));
|
*weak = Ui::show(std::move(box));
|
||||||
};
|
};
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_cant_invite_offer_admin(tr::now),
|
.text = tr::lng_cant_invite_offer_admin(),
|
||||||
tr::lng_cant_invite_make_admin(tr::now),
|
.confirmed = makeAdmin,
|
||||||
tr::lng_cancel(tr::now),
|
.confirmText = tr::lng_cant_invite_make_admin(),
|
||||||
makeAdmin),
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -176,7 +176,7 @@ void ShowAddParticipantsError(
|
||||||
? PeerFloodType::InviteGroup
|
? PeerFloodType::InviteGroup
|
||||||
: PeerFloodType::InviteChannel;
|
: PeerFloodType::InviteChannel;
|
||||||
const auto text = PeerFloodErrorText(&chat->session(), type);
|
const auto text = PeerFloodErrorText(&chat->session(), type);
|
||||||
Ui::show(Box<Ui::InformBox>(text), Ui::LayerOption::KeepOther);
|
Ui::show(Ui::MakeInformBox(text), Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto text = [&] {
|
const auto text = [&] {
|
||||||
|
@ -203,7 +203,7 @@ void ShowAddParticipantsError(
|
||||||
}
|
}
|
||||||
return tr::lng_failed_add_participant(tr::now);
|
return tr::lng_failed_add_participant(tr::now);
|
||||||
}();
|
}();
|
||||||
Ui::show(Box<Ui::InformBox>(text), Ui::LayerOption::KeepOther);
|
Ui::show(Ui::MakeInformBox(text), Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
class RevokePublicLinkBox::Inner : public TWidget {
|
class RevokePublicLinkBox::Inner : public TWidget {
|
||||||
|
@ -656,18 +656,18 @@ void GroupInfoBox::createGroup(
|
||||||
}
|
}
|
||||||
} else if (type == u"USERS_TOO_FEW"_q) {
|
} else if (type == u"USERS_TOO_FEW"_q) {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_cant_invite_privacy(tr::now)),
|
Ui::MakeInformBox(tr::lng_cant_invite_privacy()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
} else if (type == u"PEER_FLOOD"_q) {
|
} else if (type == u"PEER_FLOOD"_q) {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(
|
||||||
PeerFloodErrorText(
|
PeerFloodErrorText(
|
||||||
&_navigation->session(),
|
&_navigation->session(),
|
||||||
PeerFloodType::InviteGroup)),
|
PeerFloodType::InviteGroup)),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
} else if (type == u"USER_RESTRICTED"_q) {
|
} else if (type == u"USER_RESTRICTED"_q) {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_cant_do_this(tr::now)),
|
Ui::MakeInformBox(tr::lng_cant_do_this()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -778,11 +778,11 @@ void GroupInfoBox::createChannel(
|
||||||
_title->showError();
|
_title->showError();
|
||||||
} else if (type == u"USER_RESTRICTED"_q) {
|
} else if (type == u"USER_RESTRICTED"_q) {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_cant_do_this(tr::now)),
|
Ui::MakeInformBox(tr::lng_cant_do_this()),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
} else if (type == u"CHANNELS_TOO_MUCH"_q) {
|
} else if (type == u"CHANNELS_TOO_MUCH"_q) {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_cant_do_this(tr::now)),
|
Ui::MakeInformBox(tr::lng_cant_do_this()),
|
||||||
Ui::LayerOption::CloseOther); // TODO
|
Ui::LayerOption::CloseOther); // TODO
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -1649,7 +1649,11 @@ void RevokePublicLinkBox::Inner::mouseReleaseEvent(QMouseEvent *e) {
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(text, confirmText, std::move(callback)),
|
Ui::MakeConfirmBox({
|
||||||
|
.text = text,
|
||||||
|
.confirmed = std::move(callback),
|
||||||
|
.confirmText = confirmText,
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,6 @@ class Session;
|
||||||
} // namespace Main
|
} // namespace Main
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ConfirmBox;
|
|
||||||
class FlatLabel;
|
class FlatLabel;
|
||||||
class InputField;
|
class InputField;
|
||||||
class PhoneInput;
|
class PhoneInput;
|
||||||
|
|
|
@ -176,11 +176,11 @@ void BackgroundBox::removePaper(const Data::WallPaper &paper) {
|
||||||
)).send();
|
)).send();
|
||||||
};
|
};
|
||||||
_controller->show(
|
_controller->show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_background_sure_delete(tr::now),
|
.text = tr::lng_background_sure_delete(),
|
||||||
tr::lng_selected_delete(tr::now),
|
.confirmed = remove,
|
||||||
tr::lng_cancel(tr::now),
|
.confirmText = tr::lng_selected_delete(),
|
||||||
remove),
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -779,8 +779,7 @@ bool BackgroundPreviewBox::Start(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (!IsValidWallPaperSlug(slug)) {
|
if (!IsValidWallPaperSlug(slug)) {
|
||||||
controller->show(
|
controller->show(Ui::MakeInformBox(tr::lng_background_bad_link()));
|
||||||
Box<Ui::InformBox>(tr::lng_background_bad_link(tr::now)));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
controller->session().api().requestWallPaper(slug, crl::guard(controller, [=](
|
controller->session().api().requestWallPaper(slug, crl::guard(controller, [=](
|
||||||
|
@ -789,8 +788,7 @@ bool BackgroundPreviewBox::Start(
|
||||||
controller,
|
controller,
|
||||||
result.withUrlParams(params)));
|
result.withUrlParams(params)));
|
||||||
}), crl::guard(controller, [=](const MTP::Error &error) {
|
}), crl::guard(controller, [=](const MTP::Error &error) {
|
||||||
controller->show(
|
controller->show(Ui::MakeInformBox(tr::lng_background_bad_link()));
|
||||||
Box<Ui::InformBox>(tr::lng_background_bad_link(tr::now)));
|
|
||||||
}));
|
}));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -266,12 +266,11 @@ void ChangePhoneBox::EnterPhone::sendPhoneFail(
|
||||||
Ui::ShowPhoneBannedError(&_controller->window(), phoneNumber);
|
Ui::ShowPhoneBannedError(&_controller->window(), phoneNumber);
|
||||||
} else if (error.type() == qstr("PHONE_NUMBER_OCCUPIED")) {
|
} else if (error.type() == qstr("PHONE_NUMBER_OCCUPIED")) {
|
||||||
_controller->show(
|
_controller->show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(
|
||||||
tr::lng_change_phone_occupied(
|
tr::lng_change_phone_occupied(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_phone,
|
lt_phone,
|
||||||
Ui::FormatPhone(phoneNumber)),
|
Ui::FormatPhone(phoneNumber))),
|
||||||
tr::lng_box_ok(tr::now)),
|
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
} else {
|
} else {
|
||||||
showError(Lang::Hard::ServerError());
|
showError(Lang::Hard::ServerError());
|
||||||
|
@ -443,9 +442,10 @@ void ChangePhoneBox::prepare() {
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
};
|
};
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_change_phone_warning(tr::now),
|
.text = tr::lng_change_phone_warning(),
|
||||||
std::move(callback)),
|
.confirmed = std::move(callback),
|
||||||
|
}),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
});
|
});
|
||||||
addButton(tr::lng_cancel(), [this] {
|
addButton(tr::lng_cancel(), [this] {
|
||||||
|
|
|
@ -1139,13 +1139,14 @@ void ProxiesBoxController::ShowApplyConfirmation(
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_sure_enable(tr::now),
|
.confirmed = std::move(callback),
|
||||||
std::move(callback)),
|
.confirmText = tr::lng_sure_enable(),
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
} else {
|
} else {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(
|
||||||
(proxy.status() == ProxyData::Status::Unsupported
|
(proxy.status() == ProxyData::Status::Unsupported
|
||||||
? tr::lng_proxy_unsupported(tr::now)
|
? tr::lng_proxy_unsupported(tr::now)
|
||||||
: tr::lng_proxy_invalid(tr::now))));
|
: tr::lng_proxy_invalid(tr::now))));
|
||||||
|
|
|
@ -108,7 +108,7 @@ void StartPendingReset(
|
||||||
auto finish = [=](const QString &message) mutable {
|
auto finish = [=](const QString &message) mutable {
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.data()) {
|
||||||
if (!message.isEmpty()) {
|
if (!message.isEmpty()) {
|
||||||
strong->getDelegate()->show(Box<Ui::InformBox>(message));
|
strong->getDelegate()->show(Ui::MakeInformBox(message));
|
||||||
}
|
}
|
||||||
strong->closeBox();
|
strong->closeBox();
|
||||||
}
|
}
|
||||||
|
@ -139,7 +139,7 @@ void StartPendingReset(
|
||||||
lt_count,
|
lt_count,
|
||||||
minutes);
|
minutes);
|
||||||
if (const auto strong = weak.data()) {
|
if (const auto strong = weak.data()) {
|
||||||
strong->getDelegate()->show(Box<Ui::InformBox>(
|
strong->getDelegate()->show(Ui::MakeInformBox(
|
||||||
tr::lng_cloud_password_reset_later(
|
tr::lng_cloud_password_reset_later(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_duration,
|
lt_duration,
|
||||||
|
@ -441,8 +441,8 @@ void PasscodeBox::recoverPasswordDone(
|
||||||
if (weak) {
|
if (weak) {
|
||||||
_newPasswordSet.fire_copy(newPasswordBytes);
|
_newPasswordSet.fire_copy(newPasswordBytes);
|
||||||
if (weak) {
|
if (weak) {
|
||||||
getDelegate()->show(Box<Ui::InformBox>(
|
getDelegate()->show(Ui::MakeInformBox(
|
||||||
tr::lng_cloud_password_updated(tr::now)));
|
tr::lng_cloud_password_updated()));
|
||||||
if (weak) {
|
if (weak) {
|
||||||
closeBox();
|
closeBox();
|
||||||
}
|
}
|
||||||
|
@ -458,12 +458,12 @@ void PasscodeBox::setPasswordDone(const QByteArray &newPasswordBytes) {
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = Ui::MakeWeak(this);
|
||||||
_newPasswordSet.fire_copy(newPasswordBytes);
|
_newPasswordSet.fire_copy(newPasswordBytes);
|
||||||
if (weak) {
|
if (weak) {
|
||||||
const auto text = _reenterPasscode->isHidden()
|
auto text = _reenterPasscode->isHidden()
|
||||||
? tr::lng_cloud_password_removed(tr::now)
|
? tr::lng_cloud_password_removed()
|
||||||
: _oldPasscode->isHidden()
|
: _oldPasscode->isHidden()
|
||||||
? tr::lng_cloud_password_was_set(tr::now)
|
? tr::lng_cloud_password_was_set()
|
||||||
: tr::lng_cloud_password_updated(tr::now);
|
: tr::lng_cloud_password_updated();
|
||||||
getDelegate()->show(Box<Ui::InformBox>(text));
|
getDelegate()->show(Ui::MakeInformBox(std::move(text)));
|
||||||
if (weak) {
|
if (weak) {
|
||||||
closeBox();
|
closeBox();
|
||||||
}
|
}
|
||||||
|
@ -559,8 +559,9 @@ void PasscodeBox::validateEmail(
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = Ui::MakeWeak(this);
|
||||||
_clearUnconfirmedPassword.fire({});
|
_clearUnconfirmedPassword.fire({});
|
||||||
if (weak) {
|
if (weak) {
|
||||||
auto box = Box<Ui::InformBox>(
|
auto box = Ui::MakeInformBox({
|
||||||
Lang::Hard::EmailConfirmationExpired());
|
Lang::Hard::EmailConfirmationExpired()
|
||||||
|
});
|
||||||
weak->getDelegate()->show(
|
weak->getDelegate()->show(
|
||||||
std::move(box),
|
std::move(box),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
|
@ -685,12 +686,12 @@ void PasscodeBox::save(bool force) {
|
||||||
}
|
}
|
||||||
if (!onlyCheck && !_recoverEmail->isHidden() && email.isEmpty() && !force) {
|
if (!onlyCheck && !_recoverEmail->isHidden() && email.isEmpty() && !force) {
|
||||||
_skipEmailWarning = true;
|
_skipEmailWarning = true;
|
||||||
_replacedBy = getDelegate()->show(
|
_replacedBy = getDelegate()->show(Ui::MakeConfirmBox({
|
||||||
Box<Ui::ConfirmBox>(
|
.text = { tr::lng_cloud_password_about_recover() },
|
||||||
tr::lng_cloud_password_about_recover(tr::now),
|
.confirmed = crl::guard(this, [this] { save(true); }),
|
||||||
tr::lng_cloud_password_skip_email(tr::now),
|
.confirmText = tr::lng_cloud_password_skip_email(),
|
||||||
st::attentionBoxButton,
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
crl::guard(this, [this] { save(true); })));
|
}));
|
||||||
} else if (onlyCheck) {
|
} else if (onlyCheck) {
|
||||||
submitOnlyCheckCloudPassword(old);
|
submitOnlyCheckCloudPassword(old);
|
||||||
} else if (_oldPasscode->isHidden()) {
|
} else if (_oldPasscode->isHidden()) {
|
||||||
|
@ -719,14 +720,11 @@ void PasscodeBox::submitOnlyCheckCloudPassword(const QString &oldPassword) {
|
||||||
if (_cloudFields.turningOff && _cloudFields.notEmptyPassport) {
|
if (_cloudFields.turningOff && _cloudFields.notEmptyPassport) {
|
||||||
Assert(!_cloudFields.customCheckCallback);
|
Assert(!_cloudFields.customCheckCallback);
|
||||||
|
|
||||||
const auto confirmed = [=](Fn<void()> &&close) {
|
getDelegate()->show(Ui::MakeConfirmBox({
|
||||||
send();
|
.text = tr::lng_cloud_password_passport_losing(),
|
||||||
close();
|
.confirmed = [=](Fn<void()> &&close) { send(); close(); },
|
||||||
};
|
.confirmText = tr::lng_continue(),
|
||||||
getDelegate()->show(Box<Ui::ConfirmBox>(
|
}));
|
||||||
tr::lng_cloud_password_passport_losing(tr::now),
|
|
||||||
tr::lng_continue(tr::now),
|
|
||||||
confirmed));
|
|
||||||
} else {
|
} else {
|
||||||
send();
|
send();
|
||||||
}
|
}
|
||||||
|
@ -794,7 +792,7 @@ void PasscodeBox::requestPasswordData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasscodeBox::serverError() {
|
void PasscodeBox::serverError() {
|
||||||
getDelegate()->show(Box<Ui::InformBox>(Lang::Hard::ServerError()));
|
getDelegate()->show(Ui::MakeInformBox(Lang::Hard::ServerError()));
|
||||||
closeBox();
|
closeBox();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -949,10 +947,11 @@ void PasscodeBox::suggestSecretReset(const QString &newPassword) {
|
||||||
resetSecret(check, newPassword, std::move(close));
|
resetSecret(check, newPassword, std::move(close));
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
getDelegate()->show(Box<Ui::ConfirmBox>(
|
getDelegate()->show(Ui::MakeConfirmBox({
|
||||||
Lang::Hard::PassportCorruptedChange(),
|
.text = { Lang::Hard::PassportCorruptedChange() },
|
||||||
Lang::Hard::PassportCorruptedReset(),
|
.confirmed = std::move(resetSecretAndSave),
|
||||||
std::move(resetSecretAndSave)));
|
.confirmText = Lang::Hard::PassportCorruptedReset(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasscodeBox::resetSecret(
|
void PasscodeBox::resetSecret(
|
||||||
|
@ -1074,18 +1073,14 @@ void PasscodeBox::recoverByEmail() {
|
||||||
if (!_cloudFields.hasRecovery) {
|
if (!_cloudFields.hasRecovery) {
|
||||||
Assert(_session != nullptr);
|
Assert(_session != nullptr);
|
||||||
const auto session = _session;
|
const auto session = _session;
|
||||||
const auto confirmBox = std::make_shared<QPointer<BoxContent>>();
|
const auto reset = crl::guard(this, [=](Fn<void()> &&close) {
|
||||||
const auto reset = crl::guard(this, [=] {
|
StartPendingReset(session, this, std::move(close));
|
||||||
StartPendingReset(session, this, [=] {
|
|
||||||
if (const auto box = *confirmBox) {
|
|
||||||
box->closeBox();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
*confirmBox = getDelegate()->show(Box<Ui::ConfirmBox>(
|
getDelegate()->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_cloud_password_reset_no_email(tr::now),
|
.text = tr::lng_cloud_password_reset_no_email(tr::now),
|
||||||
tr::lng_cloud_password_reset_ok(tr::now),
|
.confirmed = reset,
|
||||||
reset));
|
.confirmText = tr::lng_cloud_password_reset_ok(tr::now),
|
||||||
|
}));
|
||||||
} else if (_pattern.isEmpty()) {
|
} else if (_pattern.isEmpty()) {
|
||||||
_pattern = "-";
|
_pattern = "-";
|
||||||
_api.request(MTPauth_RequestPasswordRecovery(
|
_api.request(MTPauth_RequestPasswordRecovery(
|
||||||
|
@ -1155,22 +1150,20 @@ RecoverBox::RecoverBox(
|
||||||
_noEmailAccess.destroy();
|
_noEmailAccess.destroy();
|
||||||
} else {
|
} else {
|
||||||
_noEmailAccess->setClickedCallback([=] {
|
_noEmailAccess->setClickedCallback([=] {
|
||||||
const auto confirmBox = std::make_shared<QPointer<BoxContent>>();
|
const auto reset = crl::guard(this, [=](Fn<void()> &&close) {
|
||||||
const auto reset = crl::guard(this, [=] {
|
|
||||||
const auto closeParent = _closeParent;
|
const auto closeParent = _closeParent;
|
||||||
StartPendingReset(session, this, [=] {
|
StartPendingReset(session, this, [=, c = std::move(close)] {
|
||||||
if (closeParent) {
|
if (closeParent) {
|
||||||
closeParent();
|
closeParent();
|
||||||
}
|
}
|
||||||
if (const auto box = *confirmBox) {
|
c();
|
||||||
box->closeBox();
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
*confirmBox = getDelegate()->show(Box<Ui::ConfirmBox>(
|
getDelegate()->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_cloud_password_reset_with_email(tr::now),
|
.text = tr::lng_cloud_password_reset_with_email(),
|
||||||
tr::lng_cloud_password_reset_ok(tr::now),
|
.confirmed = reset,
|
||||||
reset));
|
.confirmText = tr::lng_cloud_password_reset_ok(),
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1265,14 +1258,11 @@ void RecoverBox::submit() {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
if (_cloudFields.notEmptyPassport) {
|
if (_cloudFields.notEmptyPassport) {
|
||||||
const auto confirmed = [=](Fn<void()> &&close) {
|
getDelegate()->show(Ui::MakeConfirmBox({
|
||||||
send();
|
.text = tr::lng_cloud_password_passport_losing(),
|
||||||
close();
|
.confirmed = [=](Fn<void()> &&close) { send(); close(); },
|
||||||
};
|
.confirmText = tr::lng_continue(),
|
||||||
getDelegate()->show(Box<Ui::ConfirmBox>(
|
}));
|
||||||
tr::lng_cloud_password_passport_losing(tr::now),
|
|
||||||
tr::lng_continue(tr::now),
|
|
||||||
confirmed));
|
|
||||||
} else {
|
} else {
|
||||||
send();
|
send();
|
||||||
}
|
}
|
||||||
|
@ -1294,7 +1284,7 @@ void RecoverBox::proceedToClear() {
|
||||||
_submitRequest = 0;
|
_submitRequest = 0;
|
||||||
_newPasswordSet.fire({});
|
_newPasswordSet.fire({});
|
||||||
getDelegate()->show(
|
getDelegate()->show(
|
||||||
Box<Ui::InformBox>(tr::lng_cloud_password_removed(tr::now)),
|
Ui::MakeInformBox(tr::lng_cloud_password_removed()),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1342,7 +1332,7 @@ void RecoverBox::checkSubmitFail(const MTP::Error &error) {
|
||||||
if (err == qstr("PASSWORD_EMPTY")) {
|
if (err == qstr("PASSWORD_EMPTY")) {
|
||||||
_newPasswordSet.fire(QByteArray());
|
_newPasswordSet.fire(QByteArray());
|
||||||
getDelegate()->show(
|
getDelegate()->show(
|
||||||
Box<Ui::InformBox>(tr::lng_cloud_password_removed(tr::now)),
|
Ui::MakeInformBox(tr::lng_cloud_password_removed()),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
} else if (err == qstr("PASSWORD_RECOVERY_NA")) {
|
} else if (err == qstr("PASSWORD_RECOVERY_NA")) {
|
||||||
closeBox();
|
closeBox();
|
||||||
|
@ -1383,8 +1373,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
|
||||||
reloads->fire({});
|
reloads->fire({});
|
||||||
if (*weak) {
|
if (*weak) {
|
||||||
(*weak)->getDelegate()->show(
|
(*weak)->getDelegate()->show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(tr::lng_cloud_password_was_set()),
|
||||||
tr::lng_cloud_password_was_set(tr::now)),
|
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
}
|
}
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
|
@ -1396,7 +1385,7 @@ RecoveryEmailValidation ConfirmRecoveryEmail(
|
||||||
} else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) {
|
} else if (error.type() == qstr("EMAIL_HASH_EXPIRED")) {
|
||||||
cancels->fire({});
|
cancels->fire({});
|
||||||
if (*weak) {
|
if (*weak) {
|
||||||
auto box = Box<Ui::InformBox>(
|
auto box = Ui::MakeInformBox(
|
||||||
Lang::Hard::EmailConfirmationExpired());
|
Lang::Hard::EmailConfirmationExpired());
|
||||||
(*weak)->getDelegate()->show(
|
(*weak)->getDelegate()->show(
|
||||||
std::move(box),
|
std::move(box),
|
||||||
|
|
|
@ -564,7 +564,10 @@ void AddBotToGroupBoxController::shareBotGame(not_null<PeerData*> chat) {
|
||||||
return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name);
|
return tr::lng_bot_sure_share_game_group(tr::now, lt_group, chat->name);
|
||||||
}();
|
}();
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(confirmText, std::move(send)),
|
Ui::MakeConfirmBox({
|
||||||
|
.text = confirmText,
|
||||||
|
.confirmed = std::move(send),
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -572,7 +575,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
|
||||||
if (const auto megagroup = chat->asMegagroup()) {
|
if (const auto megagroup = chat->asMegagroup()) {
|
||||||
if (!megagroup->canAddMembers()) {
|
if (!megagroup->canAddMembers()) {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(tr::lng_error_cant_add_member(tr::now)),
|
Ui::MakeInformBox(tr::lng_error_cant_add_member()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -582,7 +585,7 @@ void AddBotToGroupBoxController::addBotToGroup(not_null<PeerData*> chat) {
|
||||||
});
|
});
|
||||||
auto confirmText = tr::lng_bot_sure_invite(tr::now, lt_group, chat->name);
|
auto confirmText = tr::lng_bot_sure_invite(tr::now, lt_group, chat->name);
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(confirmText, send),
|
Ui::MakeConfirmBox({ confirmText, send }),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -107,8 +107,7 @@ void AddParticipantsBoxController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
} else if (count >= serverConfig.chatSizeMax
|
} else if (count >= serverConfig.chatSizeMax
|
||||||
&& count < serverConfig.megagroupSizeMax) {
|
&& count < serverConfig.megagroupSizeMax) {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(tr::lng_profile_add_more_after_create()),
|
||||||
tr::lng_profile_add_more_after_create(tr::now)),
|
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -570,21 +569,22 @@ void AddSpecialBoxController::showAdmin(
|
||||||
if (canBanMembers) {
|
if (canBanMembers) {
|
||||||
if (!sure) {
|
if (!sure) {
|
||||||
_editBox = Ui::show(
|
_editBox = Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_sure_add_admin_unremove(tr::now),
|
tr::lng_sure_add_admin_unremove(),
|
||||||
showAdminSure),
|
showAdminSure
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(
|
||||||
tr::lng_error_cant_add_admin_unban(tr::now)),
|
Ui::MakeInformBox(tr::lng_error_cant_add_admin_unban()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(
|
||||||
tr::lng_error_cant_add_admin_invite(tr::now)),
|
Ui::MakeInformBox(tr::lng_error_cant_add_admin_invite()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -593,15 +593,16 @@ void AddSpecialBoxController::showAdmin(
|
||||||
if (canBanMembers) {
|
if (canBanMembers) {
|
||||||
if (!sure) {
|
if (!sure) {
|
||||||
_editBox = Ui::show(
|
_editBox = Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_sure_add_admin_unremove(tr::now),
|
tr::lng_sure_add_admin_unremove(),
|
||||||
showAdminSure),
|
showAdminSure
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(
|
||||||
tr::lng_error_cant_add_admin_unban(tr::now)),
|
Ui::MakeInformBox(tr::lng_error_cant_add_admin_unban()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -609,20 +610,20 @@ void AddSpecialBoxController::showAdmin(
|
||||||
// The user is not in the group yet.
|
// The user is not in the group yet.
|
||||||
if (canAddMembers) {
|
if (canAddMembers) {
|
||||||
if (!sure) {
|
if (!sure) {
|
||||||
const auto text = ((_peer->isChat() || _peer->isMegagroup())
|
auto text = ((_peer->isChat() || _peer->isMegagroup())
|
||||||
? tr::lng_sure_add_admin_invite
|
? tr::lng_sure_add_admin_invite
|
||||||
: tr::lng_sure_add_admin_invite_channel)(tr::now);
|
: tr::lng_sure_add_admin_invite_channel)();
|
||||||
_editBox = Ui::show(
|
_editBox = Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
text,
|
std::move(text),
|
||||||
showAdminSure),
|
showAdminSure
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(tr::lng_error_cant_add_admin_invite()),
|
||||||
tr::lng_error_cant_add_admin_invite(tr::now)),
|
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -692,15 +693,16 @@ void AddSpecialBoxController::showRestricted(
|
||||||
if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) {
|
if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) {
|
||||||
if (!sure) {
|
if (!sure) {
|
||||||
_editBox = Ui::show(
|
_editBox = Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_sure_ban_admin(tr::now),
|
tr::lng_sure_ban_admin(),
|
||||||
showRestrictedSure),
|
showRestrictedSure
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(tr::lng_error_cant_ban_admin(tr::now)),
|
Ui::MakeInformBox(tr::lng_error_cant_ban_admin()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -763,15 +765,16 @@ void AddSpecialBoxController::kickUser(
|
||||||
if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) {
|
if (!_additional.isCreator(user) && _additional.canEditAdmin(user)) {
|
||||||
if (!sure) {
|
if (!sure) {
|
||||||
_editBox = Ui::show(
|
_editBox = Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_sure_ban_admin(tr::now),
|
tr::lng_sure_ban_admin(),
|
||||||
kickUserSure),
|
kickUserSure
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(tr::lng_error_cant_ban_admin(tr::now)),
|
Ui::MakeInformBox(tr::lng_error_cant_ban_admin()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -786,7 +789,7 @@ void AddSpecialBoxController::kickUser(
|
||||||
lt_user,
|
lt_user,
|
||||||
participant->name);
|
participant->name);
|
||||||
_editBox = Ui::show(
|
_editBox = Ui::show(
|
||||||
Box<Ui::ConfirmBox>(text, kickUserSure),
|
Ui::MakeConfirmBox({ text, kickUserSure }),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,10 +153,11 @@ void Controller::choose(not_null<ChannelData*> chat) {
|
||||||
onstack(chat);
|
onstack(chat);
|
||||||
};
|
};
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_manage_discussion_group_link(tr::now),
|
.confirmed = sure,
|
||||||
sure),
|
.confirmText = tr::lng_manage_discussion_group_link(tr::now),
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,10 +186,11 @@ void Controller::choose(not_null<ChatData*> chat) {
|
||||||
chat->session().api().migrateChat(chat, crl::guard(this, done));
|
chat->session().api().migrateChat(chat, crl::guard(this, done));
|
||||||
};
|
};
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_manage_discussion_group_link(tr::now),
|
.confirmed = sure,
|
||||||
sure),
|
.confirmText = tr::lng_manage_discussion_group_link(tr::now),
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -456,16 +456,17 @@ void EditAdminBox::transferOwnership() {
|
||||||
transferOwnershipChecked();
|
transferOwnershipChecked();
|
||||||
close();
|
close();
|
||||||
});
|
});
|
||||||
getDelegate()->show(Box<Ui::ConfirmBox>(
|
getDelegate()->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_rights_transfer_about(
|
.text = tr::lng_rights_transfer_about(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_group,
|
lt_group,
|
||||||
Ui::Text::Bold(peer()->name),
|
Ui::Text::Bold(peer()->name),
|
||||||
lt_user,
|
lt_user,
|
||||||
Ui::Text::Bold(user()->shortName()),
|
Ui::Text::Bold(user()->shortName()),
|
||||||
Ui::Text::RichLangValue),
|
Ui::Text::RichLangValue),
|
||||||
tr::lng_rights_transfer_sure(tr::now),
|
.confirmed = callback,
|
||||||
callback));
|
.confirmText = tr::lng_rights_transfer_sure(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
@ -573,7 +574,7 @@ void EditAdminBox::sendTransferRequestFrom(
|
||||||
|| (type == qstr("SESSION_TOO_FRESH_XXX"));
|
|| (type == qstr("SESSION_TOO_FRESH_XXX"));
|
||||||
}();
|
}();
|
||||||
const auto weak = Ui::MakeWeak(this);
|
const auto weak = Ui::MakeWeak(this);
|
||||||
getDelegate()->show(Box<Ui::InformBox>(problem));
|
getDelegate()->show(Ui::MakeInformBox(problem));
|
||||||
if (box) {
|
if (box) {
|
||||||
box->closeBox();
|
box->closeBox();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1718,10 +1718,13 @@ void ParticipantsBoxController::kickParticipant(not_null<PeerData*> participant)
|
||||||
lt_user,
|
lt_user,
|
||||||
user ? user->firstName : participant->name);
|
user ? user->firstName : participant->name);
|
||||||
_editBox = Ui::show(
|
_editBox = Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_box_remove(tr::now),
|
.confirmed = crl::guard(this, [=] {
|
||||||
crl::guard(this, [=] { kickParticipantSure(participant); })),
|
kickParticipantSure(participant);
|
||||||
|
}),
|
||||||
|
.confirmText = tr::lng_box_remove(),
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1760,13 +1763,14 @@ void ParticipantsBoxController::kickParticipantSure(
|
||||||
|
|
||||||
void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
|
void ParticipantsBoxController::removeAdmin(not_null<UserData*> user) {
|
||||||
_editBox = Ui::show(
|
_editBox = Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_profile_sure_remove_admin(
|
.text = tr::lng_profile_sure_remove_admin(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_user,
|
lt_user,
|
||||||
user->firstName),
|
user->firstName),
|
||||||
tr::lng_box_remove(tr::now),
|
.confirmed = crl::guard(this, [=] { removeAdminSure(user); }),
|
||||||
crl::guard(this, [=] { removeAdminSure(user); })),
|
.confirmText = tr::lng_box_remove(),
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1606,11 +1606,12 @@ void Controller::deleteWithConfirmation() {
|
||||||
deleteChannel();
|
deleteChannel();
|
||||||
});
|
});
|
||||||
_navigation->parentController()->show(
|
_navigation->parentController()->show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_box_delete(tr::now),
|
.confirmed = deleteCallback,
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_box_delete(),
|
||||||
deleteCallback),
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -943,23 +943,18 @@ void AddPermanentLinkBlock(
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
const auto revokeLink = crl::guard(weak, [=] {
|
const auto revokeLink = crl::guard(weak, [=] {
|
||||||
const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
|
const auto done = crl::guard(weak, [=](Fn<void()> &&close) {
|
||||||
const auto done = crl::guard(weak, [=] {
|
|
||||||
const auto close = [=] {
|
|
||||||
if (*box) {
|
|
||||||
(*box)->closeBox();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
peer->session().api().inviteLinks().revokePermanent(
|
peer->session().api().inviteLinks().revokePermanent(
|
||||||
peer,
|
peer,
|
||||||
admin,
|
admin,
|
||||||
value->current().link,
|
value->current().link,
|
||||||
close);
|
std::move(close));
|
||||||
});
|
});
|
||||||
*box = Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_group_invite_about_new(tr::now),
|
tr::lng_group_invite_about_new(tr::now),
|
||||||
done),
|
done
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -1143,7 +1138,7 @@ void ShareInviteLinkBox(not_null<PeerData*> peer, const QString &link) {
|
||||||
}
|
}
|
||||||
text.append(error.first);
|
text.append(error.first);
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(text),
|
Ui::MakeInformBox(text),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1252,19 +1247,17 @@ void RevokeLink(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
not_null<UserData*> admin,
|
not_null<UserData*> admin,
|
||||||
const QString &link) {
|
const QString &link) {
|
||||||
const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
|
const auto revoke = [=](Fn<void()> &&close) {
|
||||||
const auto revoke = [=] {
|
const auto done = [close = std::move(close)](const LinkData &data) {
|
||||||
const auto done = [=](const LinkData &data) {
|
close();
|
||||||
if (*box) {
|
|
||||||
(*box)->closeBox();
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
peer->session().api().inviteLinks().revoke(peer, admin, link, done);
|
peer->session().api().inviteLinks().revoke(peer, admin, link, done);
|
||||||
};
|
};
|
||||||
*box = Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_group_invite_revoke_about(tr::now),
|
tr::lng_group_invite_revoke_about(),
|
||||||
revoke),
|
revoke
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1272,21 +1265,18 @@ void DeleteLink(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
not_null<UserData*> admin,
|
not_null<UserData*> admin,
|
||||||
const QString &link) {
|
const QString &link) {
|
||||||
const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
|
const auto sure = [=](Fn<void()> &&close) {
|
||||||
const auto sure = [=] {
|
|
||||||
const auto finish = [=] {
|
|
||||||
if (*box) {
|
|
||||||
(*box)->closeBox();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
peer->session().api().inviteLinks().destroy(
|
peer->session().api().inviteLinks().destroy(
|
||||||
peer,
|
peer,
|
||||||
admin,
|
admin,
|
||||||
link,
|
link,
|
||||||
finish);
|
std::move(close));
|
||||||
};
|
};
|
||||||
*box = Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(tr::lng_group_invite_delete_sure(tr::now), sure),
|
Ui::MakeConfirmBox({
|
||||||
|
tr::lng_group_invite_delete_sure(),
|
||||||
|
sure
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -208,22 +208,17 @@ private:
|
||||||
void DeleteAllRevoked(
|
void DeleteAllRevoked(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
not_null<UserData*> admin) {
|
not_null<UserData*> admin) {
|
||||||
const auto box = std::make_shared<QPointer<Ui::ConfirmBox>>();
|
const auto sure = [=](Fn<void()> &&close) {
|
||||||
const auto sure = [=] {
|
|
||||||
const auto finish = [=] {
|
|
||||||
if (*box) {
|
|
||||||
(*box)->closeBox();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
peer->session().api().inviteLinks().destroyAllRevoked(
|
peer->session().api().inviteLinks().destroyAllRevoked(
|
||||||
peer,
|
peer,
|
||||||
admin,
|
admin,
|
||||||
finish);
|
std::move(close));
|
||||||
};
|
};
|
||||||
*box = Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_group_invite_delete_all_sure(tr::now),
|
tr::lng_group_invite_delete_all_sure(),
|
||||||
sure),
|
sure
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -56,12 +56,16 @@ void ShowPhoneBannedError(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
*box = controller->show(
|
*box = controller->show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_signin_banned_text(tr::now),
|
.text = tr::lng_signin_banned_text(),
|
||||||
tr::lng_box_ok(tr::now),
|
.cancelled = [=](Fn<void()> &&close) {
|
||||||
tr::lng_signin_banned_help(tr::now),
|
SendToBannedHelp(phone);
|
||||||
close,
|
close();
|
||||||
[=] { SendToBannedHelp(phone); close(); }),
|
},
|
||||||
|
.confirmText = tr::lng_box_ok(),
|
||||||
|
.cancelText = tr::lng_signin_banned_help(),
|
||||||
|
.strictCancel = true,
|
||||||
|
}),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -636,7 +636,7 @@ private:
|
||||||
Full _data;
|
Full _data;
|
||||||
|
|
||||||
object_ptr<Inner> _inner;
|
object_ptr<Inner> _inner;
|
||||||
QPointer<Ui::ConfirmBox> _terminateBox;
|
QPointer<Ui::BoxContent> _terminateBox;
|
||||||
|
|
||||||
base::Timer _shortPollTimer;
|
base::Timer _shortPollTimer;
|
||||||
|
|
||||||
|
@ -823,11 +823,12 @@ void SessionsContent::terminate(Fn<void()> terminateRequest, QString message) {
|
||||||
}
|
}
|
||||||
terminateRequest();
|
terminateRequest();
|
||||||
});
|
});
|
||||||
auto box = Box<Ui::ConfirmBox>(
|
auto box = Ui::MakeConfirmBox({
|
||||||
message,
|
.text = message,
|
||||||
tr::lng_settings_reset_button(tr::now),
|
.confirmed = callback,
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_settings_reset_button(),
|
||||||
callback);
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
});
|
||||||
_terminateBox = Ui::MakeWeak(box.data());
|
_terminateBox = Ui::MakeWeak(box.data());
|
||||||
_controller->show(std::move(box), Ui::LayerOption::KeepOther);
|
_controller->show(std::move(box), Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1257,7 +1257,7 @@ void ShareGameScoreByHash(
|
||||||
auto hashEncrypted = QByteArray::fromBase64(hash.toLatin1(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
auto hashEncrypted = QByteArray::fromBase64(hash.toLatin1(), QByteArray::Base64UrlEncoding | QByteArray::OmitTrailingEquals);
|
||||||
if (hashEncrypted.size() <= key128Size || (hashEncrypted.size() != key128Size + 0x20)) {
|
if (hashEncrypted.size() <= key128Size || (hashEncrypted.size() != key128Size + 0x20)) {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_confirm_phone_link_invalid(tr::now)),
|
Ui::MakeInformBox(tr::lng_confirm_phone_link_invalid()),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1285,7 +1285,7 @@ void ShareGameScoreByHash(
|
||||||
// Check 128 bits of SHA1() of data.
|
// Check 128 bits of SHA1() of data.
|
||||||
if (memcmp(dataSha1, hashEncrypted.constData(), key128Size) != 0) {
|
if (memcmp(dataSha1, hashEncrypted.constData(), key128Size) != 0) {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_share_wrong_user(tr::now)),
|
Ui::MakeInformBox(tr::lng_share_wrong_user()),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1293,7 +1293,7 @@ void ShareGameScoreByHash(
|
||||||
auto hashDataInts = reinterpret_cast<uint64*>(hashData.data());
|
auto hashDataInts = reinterpret_cast<uint64*>(hashData.data());
|
||||||
if (hashDataInts[0] != session.userId().bare) {
|
if (hashDataInts[0] != session.userId().bare) {
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_share_wrong_user(tr::now)),
|
Ui::MakeInformBox(tr::lng_share_wrong_user()),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1303,7 +1303,7 @@ void ShareGameScoreByHash(
|
||||||
if (!peerIsChannel(peerId) && channelAccessHash) {
|
if (!peerIsChannel(peerId) && channelAccessHash) {
|
||||||
// If there is no channel id, there should be no channel access_hash.
|
// If there is no channel id, there should be no channel access_hash.
|
||||||
controller->show(
|
controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_share_wrong_user(tr::now)),
|
Ui::MakeInformBox(tr::lng_share_wrong_user()),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1323,7 +1323,7 @@ void ShareGameScoreByHash(
|
||||||
FastShareMessage(item);
|
FastShareMessage(item);
|
||||||
} else {
|
} else {
|
||||||
weak->show(
|
weak->show(
|
||||||
Box<Ui::InformBox>(tr::lng_edit_deleted(tr::now)),
|
Ui::MakeInformBox(tr::lng_edit_deleted()),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -288,7 +288,7 @@ void StickerSetBox::handleError(Error error) {
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case Error::NotFound:
|
case Error::NotFound:
|
||||||
_controller->show(
|
_controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_stickers_not_found(tr::now)));
|
Ui::MakeInformBox(tr::lng_stickers_not_found(tr::now)));
|
||||||
break;
|
break;
|
||||||
default: Unexpected("Error in StickerSetBox::handleError.");
|
default: Unexpected("Error in StickerSetBox::handleError.");
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,6 @@ class SessionController;
|
||||||
} // namespace Window
|
} // namespace Window
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ConfirmBox;
|
|
||||||
class PlainShadow;
|
class PlainShadow;
|
||||||
} // namespace Ui
|
} // namespace Ui
|
||||||
|
|
||||||
|
|
|
@ -19,7 +19,6 @@ struct RippleAnimation;
|
||||||
} // namespace style
|
} // namespace style
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class ConfirmBox;
|
|
||||||
class PlainShadow;
|
class PlainShadow;
|
||||||
class RippleAnimation;
|
class RippleAnimation;
|
||||||
class SettingsSlider;
|
class SettingsSlider;
|
||||||
|
|
|
@ -1234,7 +1234,7 @@ void Call::handleRequestError(const QString &error) {
|
||||||
? Lang::Hard::CallErrorIncompatible().replace("{user}", _user->name)
|
? Lang::Hard::CallErrorIncompatible().replace("{user}", _user->name)
|
||||||
: QString();
|
: QString();
|
||||||
if (!inform.isEmpty()) {
|
if (!inform.isEmpty()) {
|
||||||
Ui::show(Box<Ui::InformBox>(inform));
|
Ui::show(Ui::MakeInformBox(inform));
|
||||||
}
|
}
|
||||||
finish(FinishType::Failed);
|
finish(FinishType::Failed);
|
||||||
}
|
}
|
||||||
|
@ -1246,7 +1246,7 @@ void Call::handleControllerError(const QString &error) {
|
||||||
? tr::lng_call_error_audio_io(tr::now)
|
? tr::lng_call_error_audio_io(tr::now)
|
||||||
: QString();
|
: QString();
|
||||||
if (!inform.isEmpty()) {
|
if (!inform.isEmpty()) {
|
||||||
Ui::show(Box<Ui::InformBox>(inform));
|
Ui::show(Ui::MakeInformBox(inform));
|
||||||
}
|
}
|
||||||
finish(FinishType::Failed);
|
finish(FinishType::Failed);
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ void Instance::startOutgoingCall(not_null<UserData*> user, bool video) {
|
||||||
if (user->callsStatus() == UserData::CallsStatus::Private) {
|
if (user->callsStatus() == UserData::CallsStatus::Private) {
|
||||||
// Request full user once more to refresh the setting in case it was changed.
|
// Request full user once more to refresh the setting in case it was changed.
|
||||||
user->session().api().requestFullPeer(user);
|
user->session().api().requestFullPeer(user);
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(
|
||||||
tr::lng_call_error_not_available(tr::now, lt_user, user->name)));
|
tr::lng_call_error_not_available(tr::now, lt_user, user->name)));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -714,13 +714,14 @@ void Instance::requestPermissionOrFail(Platform::PermissionType type, Fn<void()>
|
||||||
if (inGroupCall()) {
|
if (inGroupCall()) {
|
||||||
_currentGroupCall->hangup();
|
_currentGroupCall->hangup();
|
||||||
}
|
}
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_no_mic_permission(tr::now),
|
.text = tr::lng_no_mic_permission(),
|
||||||
tr::lng_menu_settings(tr::now),
|
.confirmed = crl::guard(this, [=] {
|
||||||
crl::guard(this, [=] {
|
|
||||||
Platform::OpenSystemSettingsForPermission(type);
|
Platform::OpenSystemSettingsForPermission(type);
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
})));
|
}),
|
||||||
|
.confirmText = tr::lng_menu_settings(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -143,15 +143,18 @@ void StartWithBox(
|
||||||
}, box->lifetime());
|
}, box->lifetime());
|
||||||
streamKeyButton->addClickHandler([=] {
|
streamKeyButton->addClickHandler([=] {
|
||||||
if (!state->warned && state->hidden.current()) {
|
if (!state->warned && state->hidden.current()) {
|
||||||
showBox(Box<Ui::ConfirmBox>(
|
showBox(Ui::MakeConfirmBox({
|
||||||
tr::lng_group_call_rtmp_key_warn(tr::now),
|
.text = tr::lng_group_call_rtmp_key_warning(
|
||||||
tr::lng_from_request_understand(tr::now),
|
Ui::Text::RichLangValue),
|
||||||
tr::lng_close(tr::now),
|
.confirmed = [=](Fn<void()> &&close) {
|
||||||
[=](Fn<void()> &&close) {
|
|
||||||
state->warned = true;
|
state->warned = true;
|
||||||
state->hidden = !state->hidden.current();
|
state->hidden = !state->hidden.current();
|
||||||
close();
|
close();
|
||||||
}));
|
},
|
||||||
|
.confirmText = tr::lng_from_request_understand(),
|
||||||
|
.cancelText = tr::lng_close(),
|
||||||
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
state->hidden = !state->hidden.current();
|
state->hidden = !state->hidden.current();
|
||||||
}
|
}
|
||||||
|
@ -269,13 +272,14 @@ void StartRtmpProcess::createBox() {
|
||||||
};
|
};
|
||||||
auto revoke = [=] {
|
auto revoke = [=] {
|
||||||
const auto guard = base::make_weak(&_request->guard);
|
const auto guard = base::make_weak(&_request->guard);
|
||||||
_request->showBox(Box<Ui::ConfirmBox>(
|
_request->showBox(Ui::MakeConfirmBox({
|
||||||
tr::lng_group_call_rtmp_revoke_sure(tr::now),
|
.text = tr::lng_group_call_rtmp_revoke_sure(),
|
||||||
tr::lng_group_invite_context_revoke(tr::now),
|
.confirmed = crl::guard(guard, [=](Fn<void()> &&close) {
|
||||||
crl::guard(guard, [=](Fn<void()> &&close) {
|
|
||||||
requestUrl(true);
|
requestUrl(true);
|
||||||
close();
|
close();
|
||||||
})));
|
}),
|
||||||
|
.confirmText = tr::lng_group_invite_context_revoke(),
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
auto object = Box(
|
auto object = Box(
|
||||||
StartWithBox,
|
StartWithBox,
|
||||||
|
|
|
@ -3512,9 +3512,9 @@ void StickersListWidget::removeMegagroupSet(bool locally) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_removingSetId = Data::Stickers::MegagroupSetId;
|
_removingSetId = Data::Stickers::MegagroupSetId;
|
||||||
controller()->show(Box<Ui::ConfirmBox>(
|
controller()->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_stickers_remove_group_set(tr::now),
|
.text = tr::lng_stickers_remove_group_set(),
|
||||||
crl::guard(this, [this, group = _megagroupSet] {
|
.confirmed = crl::guard(this, [this, group = _megagroupSet] {
|
||||||
Expects(group->mgInfo != nullptr);
|
Expects(group->mgInfo != nullptr);
|
||||||
|
|
||||||
if (group->mgInfo->stickerSet) {
|
if (group->mgInfo->stickerSet) {
|
||||||
|
@ -3523,10 +3523,12 @@ void StickersListWidget::removeMegagroupSet(bool locally) {
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
_removingSetId = 0;
|
_removingSetId = 0;
|
||||||
_checkForHide.fire({});
|
_checkForHide.fire({});
|
||||||
}), crl::guard(this, [this] {
|
}),
|
||||||
|
.cancelled = crl::guard(this, [this] {
|
||||||
_removingSetId = 0;
|
_removingSetId = 0;
|
||||||
_checkForHide.fire({});
|
_checkForHide.fire({});
|
||||||
})));
|
}),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void StickersListWidget::removeSet(uint64 setId) {
|
void StickersListWidget::removeSet(uint64 setId) {
|
||||||
|
@ -3541,67 +3543,70 @@ void StickersListWidget::removeSet(uint64 setId) {
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_sticker_pack,
|
lt_sticker_pack,
|
||||||
set->title);
|
set->title);
|
||||||
const auto confirm = tr::lng_stickers_remove_pack_confirm(tr::now);
|
controller()->show(Ui::MakeConfirmBox({
|
||||||
controller()->show(Box<Ui::ConfirmBox>(text, confirm, crl::guard(this, [=](
|
.text = text,
|
||||||
Fn<void()> &&close) {
|
.confirmed = crl::guard(this, [=](Fn<void()> &&close) {
|
||||||
close();
|
close();
|
||||||
const auto &sets = session().data().stickers().sets();
|
const auto &sets = session().data().stickers().sets();
|
||||||
const auto it = sets.find(_removingSetId);
|
const auto it = sets.find(_removingSetId);
|
||||||
if (it != sets.cend()) {
|
if (it != sets.cend()) {
|
||||||
const auto set = it->second.get();
|
const auto set = it->second.get();
|
||||||
if (set->id && set->accessHash) {
|
if (set->id && set->accessHash) {
|
||||||
_api.request(MTPmessages_UninstallStickerSet(
|
_api.request(MTPmessages_UninstallStickerSet(
|
||||||
MTP_inputStickerSetID(
|
MTP_inputStickerSetID(
|
||||||
MTP_long(set->id),
|
MTP_long(set->id),
|
||||||
MTP_long(set->accessHash)))
|
MTP_long(set->accessHash)))
|
||||||
).send();
|
).send();
|
||||||
} else if (!set->shortName.isEmpty()) {
|
} else if (!set->shortName.isEmpty()) {
|
||||||
_api.request(MTPmessages_UninstallStickerSet(
|
_api.request(MTPmessages_UninstallStickerSet(
|
||||||
MTP_inputStickerSetShortName(
|
MTP_inputStickerSetShortName(
|
||||||
MTP_string(set->shortName)))
|
MTP_string(set->shortName)))
|
||||||
).send();
|
).send();
|
||||||
}
|
|
||||||
auto writeRecent = false;
|
|
||||||
auto &recent = session().data().stickers().getRecentPack();
|
|
||||||
for (auto i = recent.begin(); i != recent.cend();) {
|
|
||||||
if (set->stickers.indexOf(i->first) >= 0) {
|
|
||||||
i = recent.erase(i);
|
|
||||||
writeRecent = true;
|
|
||||||
} else {
|
|
||||||
++i;
|
|
||||||
}
|
}
|
||||||
|
auto writeRecent = false;
|
||||||
|
auto &recent = session().data().stickers().getRecentPack();
|
||||||
|
for (auto i = recent.begin(); i != recent.cend();) {
|
||||||
|
if (set->stickers.indexOf(i->first) >= 0) {
|
||||||
|
i = recent.erase(i);
|
||||||
|
writeRecent = true;
|
||||||
|
} else {
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
set->flags &= ~SetFlag::Installed;
|
||||||
|
set->installDate = TimeId(0);
|
||||||
|
//
|
||||||
|
// Set can be in search results.
|
||||||
|
//
|
||||||
|
//if (!(set->flags & SetFlag::Featured)
|
||||||
|
// && !(set->flags & SetFlag::Special)) {
|
||||||
|
// sets.erase(it);
|
||||||
|
//}
|
||||||
|
const auto removeIndex = defaultSetsOrder().indexOf(
|
||||||
|
_removingSetId);
|
||||||
|
if (removeIndex >= 0) {
|
||||||
|
defaultSetsOrderRef().removeAt(removeIndex);
|
||||||
|
}
|
||||||
|
refreshStickers();
|
||||||
|
if (set->flags & SetFlag::Masks) {
|
||||||
|
session().local().writeInstalledMasks();
|
||||||
|
} else {
|
||||||
|
session().local().writeInstalledStickers();
|
||||||
|
}
|
||||||
|
if (writeRecent) {
|
||||||
|
session().saveSettings();
|
||||||
|
}
|
||||||
|
session().data().stickers().notifyUpdated();
|
||||||
}
|
}
|
||||||
set->flags &= ~SetFlag::Installed;
|
_removingSetId = 0;
|
||||||
set->installDate = TimeId(0);
|
_checkForHide.fire({});
|
||||||
//
|
}),
|
||||||
// Set can be in search results.
|
.cancelled = crl::guard(this, [=] {
|
||||||
//
|
_removingSetId = 0;
|
||||||
//if (!(set->flags & SetFlag::Featured)
|
_checkForHide.fire({});
|
||||||
// && !(set->flags & SetFlag::Special)) {
|
}),
|
||||||
// sets.erase(it);
|
.confirmText = tr::lng_stickers_remove_pack_confirm(),
|
||||||
//}
|
}), Ui::LayerOption::KeepOther);
|
||||||
const auto removeIndex = defaultSetsOrder().indexOf(
|
|
||||||
_removingSetId);
|
|
||||||
if (removeIndex >= 0) {
|
|
||||||
defaultSetsOrderRef().removeAt(removeIndex);
|
|
||||||
}
|
|
||||||
refreshStickers();
|
|
||||||
if (set->flags & SetFlag::Masks) {
|
|
||||||
session().local().writeInstalledMasks();
|
|
||||||
} else {
|
|
||||||
session().local().writeInstalledStickers();
|
|
||||||
}
|
|
||||||
if (writeRecent) {
|
|
||||||
session().saveSettings();
|
|
||||||
}
|
|
||||||
session().data().stickers().notifyUpdated();
|
|
||||||
}
|
|
||||||
_removingSetId = 0;
|
|
||||||
_checkForHide.fire({});
|
|
||||||
}), crl::guard(this, [=] {
|
|
||||||
_removingSetId = 0;
|
|
||||||
_checkForHide.fire({});
|
|
||||||
})), Ui::LayerOption::KeepOther);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Data::StickersSetsOrder &StickersListWidget::defaultSetsOrder() const {
|
const Data::StickersSetsOrder &StickersListWidget::defaultSetsOrder() const {
|
||||||
|
|
|
@ -352,15 +352,17 @@ void Application::showOpenGLCrashNotification() {
|
||||||
Core::App().settings().setDisableOpenGL(true);
|
Core::App().settings().setDisableOpenGL(true);
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
};
|
};
|
||||||
_primaryWindow->show(Box<Ui::ConfirmBox>(
|
_primaryWindow->show(Ui::MakeConfirmBox({
|
||||||
|
.text = ""
|
||||||
"There may be a problem with your graphics drivers and OpenGL. "
|
"There may be a problem with your graphics drivers and OpenGL. "
|
||||||
"Try updating your drivers.\n\n"
|
"Try updating your drivers.\n\n"
|
||||||
"OpenGL has been disabled. You can try to enable it again "
|
"OpenGL has been disabled. You can try to enable it again "
|
||||||
"or keep it disabled if crashes continue.",
|
"or keep it disabled if crashes continue.",
|
||||||
"Enable",
|
.confirmed = enable,
|
||||||
"Keep Disabled",
|
.cancelled = keepDisabled,
|
||||||
enable,
|
.confirmText = "Enable",
|
||||||
keepDisabled));
|
.cancelText = "Keep Disabled",
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::startDomain() {
|
void Application::startDomain() {
|
||||||
|
@ -547,9 +549,12 @@ void Application::badMtprotoConfigurationError() {
|
||||||
settings().proxy().selected(),
|
settings().proxy().selected(),
|
||||||
MTP::ProxyData::Settings::System);
|
MTP::ProxyData::Settings::System);
|
||||||
};
|
};
|
||||||
_badProxyDisableBox = Ui::show(Box<Ui::InformBox>(
|
_badProxyDisableBox = Ui::show(
|
||||||
Lang::Hard::ProxyConfigError(),
|
Ui::MakeInformBox(Lang::Hard::ProxyConfigError()));
|
||||||
disableCallback));
|
_badProxyDisableBox->boxClosing(
|
||||||
|
) | rpl::start_with_next(
|
||||||
|
disableCallback,
|
||||||
|
_badProxyDisableBox->lifetime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -664,9 +669,11 @@ void Application::logoutWithChecks(Main::Account *account) {
|
||||||
void Application::forceLogOut(
|
void Application::forceLogOut(
|
||||||
not_null<Main::Account*> account,
|
not_null<Main::Account*> account,
|
||||||
const TextWithEntities &explanation) {
|
const TextWithEntities &explanation) {
|
||||||
const auto box = Ui::show(Box<Ui::InformBox>(
|
const auto box = Ui::show(Ui::MakeConfirmBox({
|
||||||
explanation,
|
.text = explanation,
|
||||||
tr::lng_passcode_logout(tr::now)));
|
.confirmText = tr::lng_passcode_logout(tr::now),
|
||||||
|
.inform = true,
|
||||||
|
}));
|
||||||
box->setCloseByEscape(false);
|
box->setCloseByEscape(false);
|
||||||
box->setCloseByOutsideClick(false);
|
box->setCloseByOutsideClick(false);
|
||||||
const auto weak = base::make_weak(account.get());
|
const auto weak = base::make_weak(account.get());
|
||||||
|
|
|
@ -117,12 +117,13 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
|
||||||
? QString::fromUtf8(parsedUrl.toEncoded())
|
? QString::fromUtf8(parsedUrl.toEncoded())
|
||||||
: ShowEncoded(displayed);
|
: ShowEncoded(displayed);
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
(tr::lng_open_this_link(tr::now)
|
.text = (tr::lng_open_this_link(tr::now)
|
||||||
+ qsl("\n\n")
|
+ qsl("\n\n")
|
||||||
+ displayUrl),
|
+ displayUrl),
|
||||||
tr::lng_open_link(tr::now),
|
.confirmed = [=] { Ui::hideLayer(); open(); },
|
||||||
[=] { Ui::hideLayer(); open(); }),
|
.confirmText = tr::lng_open_link(),
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
} else {
|
} else {
|
||||||
open();
|
open();
|
||||||
|
@ -151,10 +152,11 @@ void BotGameUrlClickHandler::onClick(ClickContext context) const {
|
||||||
bot->session().local().markBotTrustedOpenGame(bot->id);
|
bot->session().local().markBotTrustedOpenGame(bot->id);
|
||||||
open();
|
open();
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_allow_bot_pass(tr::now, lt_bot_name, _bot->name),
|
.text = tr::lng_allow_bot_pass(tr::now, lt_bot_name, _bot->name),
|
||||||
tr::lng_allow_bot(tr::now),
|
.confirmed = callback,
|
||||||
callback));
|
.confirmText = tr::lng_allow_bot(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -412,12 +412,13 @@ bool HandleUnknown(
|
||||||
Core::UpdateApplication();
|
Core::UpdateApplication();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
controller->show(Box<Ui::ConfirmBox>(
|
controller->show(Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_menu_update(tr::now),
|
.confirmed = callback,
|
||||||
callback));
|
.confirmText = tr::lng_menu_update(),
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
controller->show(Box<Ui::InformBox>(text));
|
controller->show(Ui::MakeInformBox(text));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
controller->session().api().requestDeepLinkInfo(request, callback);
|
controller->session().api().requestDeepLinkInfo(request, callback);
|
||||||
|
|
|
@ -224,8 +224,7 @@ void CloudThemes::resolve(
|
||||||
showPreview(controller, result);
|
showPreview(controller, result);
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
if (error.type() == qstr("THEME_FORMAT_INVALID")) {
|
if (error.type() == qstr("THEME_FORMAT_INVALID")) {
|
||||||
controller->show(Box<Ui::InformBox>(
|
controller->show(Ui::MakeInformBox(tr::lng_theme_no_desktop()));
|
||||||
tr::lng_theme_no_desktop(tr::now)));
|
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
@ -249,8 +248,7 @@ void CloudThemes::showPreview(
|
||||||
controller,
|
controller,
|
||||||
cloud));
|
cloud));
|
||||||
} else {
|
} else {
|
||||||
controller->show(Box<Ui::InformBox>(
|
controller->show(Ui::MakeInformBox(tr::lng_theme_no_desktop()));
|
||||||
tr::lng_theme_no_desktop(tr::now)));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -934,9 +934,10 @@ void DocumentData::handleLoaderUpdates() {
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
save(origin, failedFileName);
|
save(origin, failedFileName);
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_download_finish_failed(tr::now),
|
tr::lng_download_finish_failed(),
|
||||||
crl::guard(&session(), retry)));
|
crl::guard(&session(), retry)
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
// Sometimes we have LOCATION_INVALID error in documents / stickers.
|
// Sometimes we have LOCATION_INVALID error in documents / stickers.
|
||||||
// Sometimes FILE_REFERENCE_EXPIRED could not be handled.
|
// Sometimes FILE_REFERENCE_EXPIRED could not be handled.
|
||||||
|
|
|
@ -402,7 +402,7 @@ void Stickers::undoInstallLocally(uint64 setId) {
|
||||||
notifyUpdated();
|
notifyUpdated();
|
||||||
|
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(tr::lng_stickers_not_found(tr::now)),
|
Ui::MakeInformBox(tr::lng_stickers_not_found()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -195,7 +195,7 @@ void Paint::handleMimeData(const QMimeData *data) {
|
||||||
}
|
}
|
||||||
if (!Ui::ValidateThumbDimensions(image.width(), image.height())) {
|
if (!Ui::ValidateThumbDimensions(image.width(), image.height())) {
|
||||||
_controllers->showBox(
|
_controllers->showBox(
|
||||||
Box<Ui::InformBox>(tr::lng_edit_media_invalid_file(tr::now)));
|
Ui::MakeInformBox(tr::lng_edit_media_invalid_file()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -87,7 +87,7 @@ void PrepareProfilePhoto(
|
||||||
if (image.isNull()
|
if (image.isNull()
|
||||||
|| (image.width() > (10 * image.height()))
|
|| (image.width() > (10 * image.height()))
|
||||||
|| (image.height() > (10 * image.width()))) {
|
|| (image.height() > (10 * image.width()))) {
|
||||||
controller->show(Box<Ui::InformBox>(tr::lng_bad_photo(tr::now)));
|
controller->show(Ui::MakeInformBox(tr::lng_bad_photo()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
image = resizeToMinSize(
|
image = resizeToMinSize(
|
||||||
|
|
|
@ -273,7 +273,7 @@ void PanelController::showCriticalError(const QString &text) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanelController::showError(const QString &text) {
|
void PanelController::showError(const QString &text) {
|
||||||
auto box = Box<Ui::InformBox>(text);
|
auto box = Ui::MakeInformBox(text);
|
||||||
const auto weak = Ui::MakeWeak(box.data());
|
const auto weak = Ui::MakeWeak(box.data());
|
||||||
const auto hidden = _panel->isHidden();
|
const auto hidden = _panel->isHidden();
|
||||||
_panel->showBox(
|
_panel->showBox(
|
||||||
|
@ -349,11 +349,12 @@ void PanelController::stopWithConfirmation(Fn<void()> callback) {
|
||||||
};
|
};
|
||||||
const auto hidden = _panel->isHidden();
|
const auto hidden = _panel->isHidden();
|
||||||
const auto old = _confirmStopBox;
|
const auto old = _confirmStopBox;
|
||||||
auto box = Box<Ui::ConfirmBox>(
|
auto box = Ui::MakeConfirmBox({
|
||||||
tr::lng_export_sure_stop(tr::now),
|
.text = tr::lng_export_sure_stop(),
|
||||||
tr::lng_export_stop(tr::now),
|
.confirmed = std::move(stop),
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_export_stop(),
|
||||||
std::move(stop));
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
});
|
||||||
_confirmStopBox = box.data();
|
_confirmStopBox = box.data();
|
||||||
_panel->showBox(
|
_panel->showBox(
|
||||||
std::move(box),
|
std::move(box),
|
||||||
|
|
|
@ -140,18 +140,16 @@ void activateBotCommand(
|
||||||
|
|
||||||
case ButtonType::RequestLocation: {
|
case ButtonType::RequestLocation: {
|
||||||
hideSingleUseKeyboard(msg);
|
hideSingleUseKeyboard(msg);
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(tr::lng_bot_share_location_unavailable()));
|
||||||
tr::lng_bot_share_location_unavailable(tr::now)));
|
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ButtonType::RequestPhone: {
|
case ButtonType::RequestPhone: {
|
||||||
hideSingleUseKeyboard(msg);
|
hideSingleUseKeyboard(msg);
|
||||||
const auto msgId = msg->id;
|
const auto msgId = msg->id;
|
||||||
const auto history = msg->history();
|
const auto history = msg->history();
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_bot_share_phone(tr::now),
|
.text = tr::lng_bot_share_phone(),
|
||||||
tr::lng_bot_share_phone_confirm(tr::now),
|
.confirmed = [=] {
|
||||||
[=] {
|
|
||||||
Ui::showPeerHistory(history, ShowAtTheEndMsgId);
|
Ui::showPeerHistory(history, ShowAtTheEndMsgId);
|
||||||
auto action = Api::SendAction(history);
|
auto action = Api::SendAction(history);
|
||||||
action.clearDraft = false;
|
action.clearDraft = false;
|
||||||
|
@ -159,7 +157,9 @@ void activateBotCommand(
|
||||||
history->session().api().shareContact(
|
history->session().api().shareContact(
|
||||||
history->session().user(),
|
history->session().user(),
|
||||||
action);
|
action);
|
||||||
}));
|
},
|
||||||
|
.confirmText = tr::lng_bot_share_phone_confirm(),
|
||||||
|
}));
|
||||||
} break;
|
} break;
|
||||||
|
|
||||||
case ButtonType::RequestPoll: {
|
case ButtonType::RequestPoll: {
|
||||||
|
|
|
@ -1431,7 +1431,7 @@ void InnerWidget::suggestRestrictParticipant(
|
||||||
(*weakBox)->closeBox();
|
(*weakBox)->closeBox();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
*weakBox = _controller->show(Box<Ui::ConfirmBox>(text, sure));
|
*weakBox = _controller->show(Ui::MakeConfirmBox({ text, sure }));
|
||||||
} else if (base::contains(_admins, user)) {
|
} else if (base::contains(_admins, user)) {
|
||||||
editRestrictions(true, ChatRestrictionsInfo());
|
editRestrictions(true, ChatRestrictionsInfo());
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -328,9 +328,9 @@ Widget::Widget(
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
|
||||||
_whatIsThis->setClickedCallback([=] {
|
_whatIsThis->setClickedCallback([=] {
|
||||||
controller->show(Box<Ui::InformBox>(channel->isMegagroup()
|
controller->show(Ui::MakeInformBox(channel->isMegagroup()
|
||||||
? tr::lng_admin_log_about_text(tr::now)
|
? tr::lng_admin_log_about_text()
|
||||||
: tr::lng_admin_log_about_text_channel(tr::now)));
|
: tr::lng_admin_log_about_text_channel()));
|
||||||
});
|
});
|
||||||
|
|
||||||
setupShortcuts();
|
setupShortcuts();
|
||||||
|
|
|
@ -278,7 +278,7 @@ void FastShareMessage(not_null<HistoryItem*> item) {
|
||||||
}
|
}
|
||||||
text.append(error.first);
|
text.append(error.first);
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(text),
|
Ui::MakeInformBox(text),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -707,7 +707,7 @@ HistoryWidget::HistoryWidget(
|
||||||
const auto unavailable = _peer->computeUnavailableReason();
|
const auto unavailable = _peer->computeUnavailableReason();
|
||||||
if (!unavailable.isEmpty()) {
|
if (!unavailable.isEmpty()) {
|
||||||
controller->showBackFromStack();
|
controller->showBackFromStack();
|
||||||
controller->show(Box<Ui::InformBox>(unavailable));
|
controller->show(Ui::MakeInformBox(unavailable));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -896,7 +896,7 @@ void HistoryWidget::initVoiceRecordBar() {
|
||||||
? Data::RestrictionError(_peer, ChatRestriction::SendMedia)
|
? Data::RestrictionError(_peer, ChatRestriction::SendMedia)
|
||||||
: std::nullopt;
|
: std::nullopt;
|
||||||
if (error) {
|
if (error) {
|
||||||
controller()->show(Box<Ui::InformBox>(*error));
|
controller()->show(Ui::MakeInformBox(*error));
|
||||||
return true;
|
return true;
|
||||||
} else if (showSlowmodeError()) {
|
} else if (showSlowmodeError()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -3528,8 +3528,7 @@ void HistoryWidget::saveEditMsg() {
|
||||||
Box<DeleteMessagesBox>(item, suggestModerateActions));
|
Box<DeleteMessagesBox>(item, suggestModerateActions));
|
||||||
return;
|
return;
|
||||||
} else if (!left.text.isEmpty()) {
|
} else if (!left.text.isEmpty()) {
|
||||||
controller()->show(Box<Ui::InformBox>(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_too_long()));
|
||||||
tr::lng_edit_too_long(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3563,16 +3562,14 @@ void HistoryWidget::saveEditMsg() {
|
||||||
}
|
}
|
||||||
const auto &err = error.type();
|
const auto &err = error.type();
|
||||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
||||||
controller()->show(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_error()));
|
||||||
Box<Ui::InformBox>(tr::lng_edit_error(tr::now)));
|
|
||||||
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
|
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
|
||||||
cancelEdit();
|
cancelEdit();
|
||||||
} else if (err == u"MESSAGE_EMPTY"_q) {
|
} else if (err == u"MESSAGE_EMPTY"_q) {
|
||||||
_field->selectAll();
|
_field->selectAll();
|
||||||
_field->setFocus();
|
_field->setFocus();
|
||||||
} else {
|
} else {
|
||||||
controller()->show(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_error()));
|
||||||
Box<Ui::InformBox>(tr::lng_edit_error(tr::now)));
|
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
})();
|
})();
|
||||||
|
@ -3964,8 +3961,7 @@ void HistoryWidget::cornerButtonsAnimationFinish() {
|
||||||
|
|
||||||
void HistoryWidget::chooseAttach() {
|
void HistoryWidget::chooseAttach() {
|
||||||
if (_editMsgId) {
|
if (_editMsgId) {
|
||||||
controller()->show(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_caption_attach()));
|
||||||
Box<Ui::InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4793,8 +4789,7 @@ bool HistoryWidget::confirmSendingFiles(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_editMsgId) {
|
if (_editMsgId) {
|
||||||
controller()->show(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_caption_attach()));
|
||||||
Box<Ui::InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6047,7 +6042,7 @@ void HistoryWidget::sendInlineResult(InlineBots::ResultSelected result) {
|
||||||
|
|
||||||
auto errorText = result.result->getErrorOnSend(_history);
|
auto errorText = result.result->getErrorOnSend(_history);
|
||||||
if (!errorText.isEmpty()) {
|
if (!errorText.isEmpty()) {
|
||||||
controller()->show(Box<Ui::InformBox>(errorText));
|
controller()->show(Ui::MakeInformBox(errorText));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6433,7 +6428,7 @@ bool HistoryWidget::sendExistingDocument(
|
||||||
: std::nullopt;
|
: std::nullopt;
|
||||||
if (error) {
|
if (error) {
|
||||||
controller()->show(
|
controller()->show(
|
||||||
Box<Ui::InformBox>(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
} else if (!_peer || !_peer->canWrite()) {
|
} else if (!_peer || !_peer->canWrite()) {
|
||||||
|
@ -6469,7 +6464,7 @@ bool HistoryWidget::sendExistingPhoto(
|
||||||
: std::nullopt;
|
: std::nullopt;
|
||||||
if (error) {
|
if (error) {
|
||||||
controller()->show(
|
controller()->show(
|
||||||
Box<Ui::InformBox>(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
} else if (!_peer || !_peer->canWrite()) {
|
} else if (!_peer || !_peer->canWrite()) {
|
||||||
|
@ -6552,19 +6547,19 @@ void HistoryWidget::replyToMessage(not_null<HistoryItem*> item) {
|
||||||
return;
|
return;
|
||||||
} else if (item->history() == _migrated) {
|
} else if (item->history() == _migrated) {
|
||||||
if (item->isService()) {
|
if (item->isService()) {
|
||||||
controller()->show(Box<Ui::InformBox>(
|
controller()->show(Ui::MakeInformBox(tr::lng_reply_cant()));
|
||||||
tr::lng_reply_cant(tr::now)));
|
|
||||||
} else {
|
} else {
|
||||||
const auto itemId = item->fullId();
|
const auto itemId = item->fullId();
|
||||||
controller()->show(
|
controller()->show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_reply_cant_forward(tr::now),
|
.text = tr::lng_reply_cant_forward(),
|
||||||
tr::lng_selected_forward(tr::now),
|
.confirmed = crl::guard(this, [=] {
|
||||||
crl::guard(this, [=] {
|
|
||||||
controller()->content()->setForwardDraft(
|
controller()->content()->setForwardDraft(
|
||||||
_peer->id,
|
_peer->id,
|
||||||
{ .ids = { 1, itemId } });
|
{ .ids = { 1, itemId } });
|
||||||
})));
|
}),
|
||||||
|
.confirmText = tr::lng_selected_forward(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -6615,7 +6610,7 @@ void HistoryWidget::editMessage(not_null<HistoryItem*> item) {
|
||||||
toggleChooseChatTheme(_peer);
|
toggleChooseChatTheme(_peer);
|
||||||
} else if (_voiceRecordBar->isActive()) {
|
} else if (_voiceRecordBar->isActive()) {
|
||||||
controller()->show(
|
controller()->show(
|
||||||
Box<Ui::InformBox>(tr::lng_edit_caption_voice(tr::now)));
|
Ui::MakeInformBox(tr::lng_edit_caption_voice()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7070,16 +7065,17 @@ void HistoryWidget::escape() {
|
||||||
} else if (_editMsgId) {
|
} else if (_editMsgId) {
|
||||||
if (_replyEditMsg
|
if (_replyEditMsg
|
||||||
&& PrepareEditText(_replyEditMsg) != _field->getTextWithTags()) {
|
&& PrepareEditText(_replyEditMsg) != _field->getTextWithTags()) {
|
||||||
controller()->show(Box<Ui::ConfirmBox>(
|
controller()->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_cancel_edit_post_sure(tr::now),
|
.text = tr::lng_cancel_edit_post_sure(),
|
||||||
tr::lng_cancel_edit_post_yes(tr::now),
|
.confirmed = crl::guard(this, [this] {
|
||||||
tr::lng_cancel_edit_post_no(tr::now),
|
|
||||||
crl::guard(this, [this] {
|
|
||||||
if (_editMsgId) {
|
if (_editMsgId) {
|
||||||
cancelEdit();
|
cancelEdit();
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
}
|
}
|
||||||
})));
|
}),
|
||||||
|
.confirmText = tr::lng_cancel_edit_post_yes(),
|
||||||
|
.cancelText = tr::lng_cancel_edit_post_no(),
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
cancelEdit();
|
cancelEdit();
|
||||||
}
|
}
|
||||||
|
|
|
@ -811,8 +811,7 @@ rpl::producer<> ComposeControls::attachRequests() const {
|
||||||
_attachRequests.events()
|
_attachRequests.events()
|
||||||
) | rpl::filter([=] {
|
) | rpl::filter([=] {
|
||||||
if (isEditingMessage()) {
|
if (isEditingMessage()) {
|
||||||
_window->show(
|
_window->show(Ui::MakeInformBox(tr::lng_edit_caption_attach()));
|
||||||
Box<Ui::InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
@ -1753,7 +1752,7 @@ void ComposeControls::initVoiceRecordBar() {
|
||||||
ChatRestriction::SendMedia)
|
ChatRestriction::SendMedia)
|
||||||
: std::nullopt;
|
: std::nullopt;
|
||||||
if (error) {
|
if (error) {
|
||||||
_window->show(Box<Ui::InformBox>(*error));
|
_window->show(Ui::MakeInformBox(*error));
|
||||||
return true;
|
return true;
|
||||||
} else if (_showSlowmodeError && _showSlowmodeError()) {
|
} else if (_showSlowmodeError && _showSlowmodeError()) {
|
||||||
return true;
|
return true;
|
||||||
|
@ -2083,8 +2082,7 @@ void ComposeControls::editMessage(not_null<HistoryItem*> item) {
|
||||||
Expects(draftKeyCurrent() != Data::DraftKey::None());
|
Expects(draftKeyCurrent() != Data::DraftKey::None());
|
||||||
|
|
||||||
if (_voiceRecordBar->isActive()) {
|
if (_voiceRecordBar->isActive()) {
|
||||||
_window->show(Box<Ui::InformBox>(
|
_window->show(Ui::MakeInformBox(tr::lng_edit_caption_voice()));
|
||||||
tr::lng_edit_caption_voice(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1650,13 +1650,14 @@ void VoiceRecordBar::showDiscardBox(
|
||||||
callback();
|
callback();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_controller->show(Box<Ui::ConfirmBox>(
|
_controller->show(Ui::MakeConfirmBox({
|
||||||
(isListenState()
|
.text = (isListenState()
|
||||||
? tr::lng_record_listen_cancel_sure
|
? tr::lng_record_listen_cancel_sure
|
||||||
: tr::lng_record_lock_cancel_sure)(tr::now),
|
: tr::lng_record_lock_cancel_sure)(),
|
||||||
tr::lng_record_lock_discard(tr::now),
|
.confirmed = std::move(sure),
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_record_lock_discard(),
|
||||||
std::move(sure)));
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}));
|
||||||
_warningShown = true;
|
_warningShown = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -454,8 +454,8 @@ void ContactStatus::setupShareHandler(not_null<UserData*> user) {
|
||||||
}).send();
|
}).send();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
_controller->window().show(Box<Ui::ConfirmBox>(
|
_controller->window().show(Ui::MakeConfirmBox({
|
||||||
tr::lng_new_contact_share_sure(
|
.text = tr::lng_new_contact_share_sure(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_phone,
|
lt_phone,
|
||||||
Ui::Text::WithEntities(
|
Ui::Text::WithEntities(
|
||||||
|
@ -463,8 +463,9 @@ void ContactStatus::setupShareHandler(not_null<UserData*> user) {
|
||||||
lt_user,
|
lt_user,
|
||||||
Ui::Text::Bold(user->name),
|
Ui::Text::Bold(user->name),
|
||||||
Ui::Text::WithEntities),
|
Ui::Text::WithEntities),
|
||||||
tr::lng_box_ok(tr::now),
|
.confirmed = share,
|
||||||
share));
|
.confirmText = tr::lng_box_ok(),
|
||||||
|
}));
|
||||||
}, _bar.lifetime());
|
}, _bar.lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -509,14 +510,15 @@ void ContactStatus::setupReportHandler(not_null<PeerData*> peer) {
|
||||||
if (const auto user = peer->asUser()) {
|
if (const auto user = peer->asUser()) {
|
||||||
peer->session().api().blockedPeers().block(user);
|
peer->session().api().blockedPeers().block(user);
|
||||||
}
|
}
|
||||||
const auto text = ((peer->isChat() || peer->isMegagroup())
|
auto text = ((peer->isChat() || peer->isMegagroup())
|
||||||
? tr::lng_report_spam_sure_group
|
? tr::lng_report_spam_sure_group
|
||||||
: tr::lng_report_spam_sure_channel)(tr::now);
|
: tr::lng_report_spam_sure_channel)();
|
||||||
_controller->window().show(Box<Ui::ConfirmBox>(
|
_controller->window().show(Ui::MakeConfirmBox({
|
||||||
text,
|
.text= std::move(text),
|
||||||
tr::lng_report_spam_ok(tr::now),
|
.confirmed = callback,
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_report_spam_ok(),
|
||||||
callback));
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}));
|
||||||
}, _bar.lifetime());
|
}, _bar.lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1036,11 +1036,12 @@ void StopPoll(not_null<Main::Session*> session, FullMsgId itemId) {
|
||||||
session->api().polls().close(item);
|
session->api().polls().close(item);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_polls_stop_warning(tr::now),
|
.text = tr::lng_polls_stop_warning(),
|
||||||
tr::lng_polls_stop_sure(tr::now),
|
.confirmed = stop,
|
||||||
tr::lng_cancel(tr::now),
|
.confirmText = tr::lng_polls_stop_sure(),
|
||||||
stop));
|
.cancelText = tr::lng_cancel(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPollActions(
|
void AddPollActions(
|
||||||
|
|
|
@ -1017,8 +1017,7 @@ void RepliesWidget::edit(
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (!left.text.isEmpty()) {
|
} else if (!left.text.isEmpty()) {
|
||||||
controller()->show(Box<Ui::InformBox>(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_too_long()));
|
||||||
tr::lng_edit_too_long(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1043,15 +1042,13 @@ void RepliesWidget::edit(
|
||||||
|
|
||||||
const auto &err = error.type();
|
const auto &err = error.type();
|
||||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
||||||
controller()->show(Box<Ui::InformBox>(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_error()));
|
||||||
tr::lng_edit_error(tr::now)));
|
|
||||||
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
|
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
|
||||||
_composeControls->cancelEditMessage();
|
_composeControls->cancelEditMessage();
|
||||||
} else if (err == u"MESSAGE_EMPTY"_q) {
|
} else if (err == u"MESSAGE_EMPTY"_q) {
|
||||||
doSetInnerFocus();
|
doSetInnerFocus();
|
||||||
} else {
|
} else {
|
||||||
controller()->show(Box<Ui::InformBox>(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_error()));
|
||||||
tr::lng_edit_error(tr::now)));
|
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
return true;
|
return true;
|
||||||
|
@ -1089,7 +1086,7 @@ bool RepliesWidget::sendExistingDocument(
|
||||||
ChatRestriction::SendStickers);
|
ChatRestriction::SendStickers);
|
||||||
if (error) {
|
if (error) {
|
||||||
controller()->show(
|
controller()->show(
|
||||||
Box<Ui::InformBox>(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
} else if (showSlowmodeError()) {
|
} else if (showSlowmodeError()) {
|
||||||
|
@ -1125,7 +1122,7 @@ bool RepliesWidget::sendExistingPhoto(
|
||||||
ChatRestriction::SendMedia);
|
ChatRestriction::SendMedia);
|
||||||
if (error) {
|
if (error) {
|
||||||
controller()->show(
|
controller()->show(
|
||||||
Box<Ui::InformBox>(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
} else if (showSlowmodeError()) {
|
} else if (showSlowmodeError()) {
|
||||||
|
@ -1146,7 +1143,7 @@ void RepliesWidget::sendInlineResult(
|
||||||
not_null<UserData*> bot) {
|
not_null<UserData*> bot) {
|
||||||
const auto errorText = result->getErrorOnSend(_history);
|
const auto errorText = result->getErrorOnSend(_history);
|
||||||
if (!errorText.isEmpty()) {
|
if (!errorText.isEmpty()) {
|
||||||
controller()->show(Box<Ui::InformBox>(errorText));
|
controller()->show(Ui::MakeInformBox(errorText));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
sendInlineResult(result, bot, {}, std::nullopt);
|
sendInlineResult(result, bot, {}, std::nullopt);
|
||||||
|
|
|
@ -616,8 +616,7 @@ void ScheduledWidget::edit(
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
} else if (!left.text.isEmpty()) {
|
} else if (!left.text.isEmpty()) {
|
||||||
controller()->show(Box<Ui::InformBox>(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_too_long()));
|
||||||
tr::lng_edit_too_long(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -642,15 +641,13 @@ void ScheduledWidget::edit(
|
||||||
|
|
||||||
const auto &err = error.type();
|
const auto &err = error.type();
|
||||||
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
if (ranges::contains(Api::kDefaultEditMessagesErrors, err)) {
|
||||||
controller()->show(Box<Ui::InformBox>(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_error()));
|
||||||
tr::lng_edit_error(tr::now)));
|
|
||||||
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
|
} else if (err == u"MESSAGE_NOT_MODIFIED"_q) {
|
||||||
_composeControls->cancelEditMessage();
|
_composeControls->cancelEditMessage();
|
||||||
} else if (err == u"MESSAGE_EMPTY"_q) {
|
} else if (err == u"MESSAGE_EMPTY"_q) {
|
||||||
_composeControls->focus();
|
_composeControls->focus();
|
||||||
} else {
|
} else {
|
||||||
controller()->show(Box<Ui::InformBox>(
|
controller()->show(Ui::MakeInformBox(tr::lng_edit_error()));
|
||||||
tr::lng_edit_error(tr::now)));
|
|
||||||
}
|
}
|
||||||
update();
|
update();
|
||||||
return true;
|
return true;
|
||||||
|
@ -685,7 +682,7 @@ bool ScheduledWidget::sendExistingDocument(
|
||||||
ChatRestriction::SendStickers);
|
ChatRestriction::SendStickers);
|
||||||
if (error) {
|
if (error) {
|
||||||
controller()->show(
|
controller()->show(
|
||||||
Box<Ui::InformBox>(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -716,7 +713,7 @@ bool ScheduledWidget::sendExistingPhoto(
|
||||||
ChatRestriction::SendMedia);
|
ChatRestriction::SendMedia);
|
||||||
if (error) {
|
if (error) {
|
||||||
controller()->show(
|
controller()->show(
|
||||||
Box<Ui::InformBox>(*error),
|
Ui::MakeInformBox(*error),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -735,7 +732,7 @@ void ScheduledWidget::sendInlineResult(
|
||||||
not_null<UserData*> bot) {
|
not_null<UserData*> bot) {
|
||||||
const auto errorText = result->getErrorOnSend(_history);
|
const auto errorText = result->getErrorOnSend(_history);
|
||||||
if (!errorText.isEmpty()) {
|
if (!errorText.isEmpty()) {
|
||||||
controller()->show(Box<Ui::InformBox>(errorText));
|
controller()->show(Ui::MakeInformBox(errorText));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto callback = [=](Api::SendOptions options) {
|
const auto callback = [=](Api::SendOptions options) {
|
||||||
|
|
|
@ -1093,11 +1093,12 @@ void ListWidget::deleteItems(SelectedItems &&items, Fn<void()> confirmed) {
|
||||||
confirmed();
|
confirmed();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
setActionBoxWeak(window->show(Box<Ui::ConfirmBox>(
|
setActionBoxWeak(window->show(Ui::MakeConfirmBox({
|
||||||
phrase,
|
.text = phrase,
|
||||||
tr::lng_box_delete(tr::now),
|
.confirmed = deleteSure,
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_box_delete(tr::now),
|
||||||
deleteSure)));
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
})));
|
||||||
} else if (auto list = collectSelectedIds(items); !list.empty()) {
|
} else if (auto list = collectSelectedIds(items); !list.empty()) {
|
||||||
auto box = Box<DeleteMessagesBox>(
|
auto box = Box<DeleteMessagesBox>(
|
||||||
&_controller->session(),
|
&_controller->session(),
|
||||||
|
|
|
@ -351,10 +351,11 @@ void CodeWidget::gotPassword(const MTPaccount_Password &result) {
|
||||||
Core::UpdateApplication();
|
Core::UpdateApplication();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_passport_app_out_of_date(tr::now),
|
.text = tr::lng_passport_app_out_of_date(),
|
||||||
tr::lng_menu_update(tr::now),
|
.confirmed = callback,
|
||||||
callback));
|
.confirmText = tr::lng_menu_update(),
|
||||||
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
goReplace<PasswordCheckWidget>(Animate::Forward);
|
goReplace<PasswordCheckWidget>(Animate::Forward);
|
||||||
|
|
|
@ -311,16 +311,22 @@ void PasswordCheckWidget::toRecover() {
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
const auto box = Ui::show(
|
||||||
tr::lng_signin_no_email_forgot(tr::now),
|
Ui::MakeInformBox(tr::lng_signin_no_email_forgot()));
|
||||||
[=] { showReset(); }));
|
box->boxClosing(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
showReset();
|
||||||
|
}, box->lifetime());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasswordCheckWidget::toPassword() {
|
void PasswordCheckWidget::toPassword() {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
const auto box = Ui::show(
|
||||||
tr::lng_signin_cant_email_forgot(tr::now),
|
Ui::MakeInformBox(tr::lng_signin_cant_email_forgot()));
|
||||||
[=] { showReset(); }));
|
box->boxClosing(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
showReset();
|
||||||
|
}, box->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PasswordCheckWidget::showReset() {
|
void PasswordCheckWidget::showReset() {
|
||||||
|
@ -372,10 +378,11 @@ void PasswordCheckWidget::submit() {
|
||||||
send();
|
send();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_cloud_password_passport_losing(tr::now),
|
.text = tr::lng_cloud_password_passport_losing(),
|
||||||
tr::lng_continue(tr::now),
|
.confirmed = confirmed,
|
||||||
confirmed));
|
.confirmText = tr::lng_continue(),
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
send();
|
send();
|
||||||
}
|
}
|
||||||
|
|
|
@ -240,7 +240,7 @@ void PhoneWidget::phoneSubmitFail(const MTP::Error &error) {
|
||||||
_sentRequest = 0;
|
_sentRequest = 0;
|
||||||
auto &err = error.type();
|
auto &err = error.type();
|
||||||
if (err == qstr("PHONE_NUMBER_FLOOD")) {
|
if (err == qstr("PHONE_NUMBER_FLOOD")) {
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_error_phone_flood(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_error_phone_flood()));
|
||||||
} else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error
|
} else if (err == qstr("PHONE_NUMBER_INVALID")) { // show error
|
||||||
showPhoneError(tr::lng_bad_phone());
|
showPhoneError(tr::lng_bad_phone());
|
||||||
} else if (err == qstr("PHONE_NUMBER_BANNED")) {
|
} else if (err == qstr("PHONE_NUMBER_BANNED")) {
|
||||||
|
|
|
@ -401,10 +401,11 @@ void QrWidget::sendCheckPasswordRequest() {
|
||||||
Core::UpdateApplication();
|
Core::UpdateApplication();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_passport_app_out_of_date(tr::now),
|
.text = tr::lng_passport_app_out_of_date(),
|
||||||
tr::lng_menu_update(tr::now),
|
.confirmed = callback,
|
||||||
callback));
|
.confirmText = tr::lng_menu_update(),
|
||||||
|
}));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
goReplace<PasswordCheckWidget>(Animate::Forward);
|
goReplace<PasswordCheckWidget>(Animate::Forward);
|
||||||
|
|
|
@ -130,7 +130,7 @@ void SignupWidget::nameSubmitFail(const MTP::Error &error) {
|
||||||
|
|
||||||
auto &err = error.type();
|
auto &err = error.type();
|
||||||
if (err == qstr("PHONE_NUMBER_FLOOD")) {
|
if (err == qstr("PHONE_NUMBER_FLOOD")) {
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_error_phone_flood(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_error_phone_flood()));
|
||||||
} else if (err == qstr("PHONE_NUMBER_INVALID")
|
} else if (err == qstr("PHONE_NUMBER_INVALID")
|
||||||
|| err == qstr("PHONE_NUMBER_BANNED")
|
|| err == qstr("PHONE_NUMBER_BANNED")
|
||||||
|| err == qstr("PHONE_CODE_EXPIRED")
|
|| err == qstr("PHONE_CODE_EXPIRED")
|
||||||
|
|
|
@ -142,7 +142,7 @@ void Step::finish(const MTPUser &user, QImage &&photo) {
|
||||||
|| !user.c_user().vid().v) {
|
|| !user.c_user().vid().v) {
|
||||||
// No idea what to do here.
|
// No idea what to do here.
|
||||||
// We could've reset intro and MTP, but this really should not happen.
|
// We could've reset intro and MTP, but this really should not happen.
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(
|
||||||
"Internal error: bad user.is_self() after sign in."));
|
"Internal error: bad user.is_self() after sign in."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -237,7 +237,7 @@ void Widget::handleUpdate(const MTPUpdate &update) {
|
||||||
qs(data.vmessage()),
|
qs(data.vmessage()),
|
||||||
Api::EntitiesFromMTP(nullptr, data.ventities().v)
|
Api::EntitiesFromMTP(nullptr, data.ventities().v)
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::InformBox>(text));
|
Ui::show(Ui::MakeInformBox(text));
|
||||||
}, [](const auto &) {});
|
}, [](const auto &) {});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -551,15 +551,15 @@ void Widget::resetAccount() {
|
||||||
lt_minutes_count,
|
lt_minutes_count,
|
||||||
when);
|
when);
|
||||||
}
|
}
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_signin_reset_wait(
|
Ui::show(Ui::MakeInformBox(tr::lng_signin_reset_wait(
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_phone_number,
|
lt_phone_number,
|
||||||
Ui::FormatPhone(getData()->phone),
|
Ui::FormatPhone(getData()->phone),
|
||||||
lt_when,
|
lt_when,
|
||||||
when)));
|
when)));
|
||||||
} else if (type == qstr("2FA_RECENT_CONFIRM")) {
|
} else if (type == qstr("2FA_RECENT_CONFIRM")) {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(
|
||||||
tr::lng_signin_reset_cancelled(tr::now)));
|
tr::lng_signin_reset_cancelled()));
|
||||||
} else {
|
} else {
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
getStep()->showError(rpl::single(Lang::Hard::ServerError()));
|
getStep()->showError(rpl::single(Lang::Hard::ServerError()));
|
||||||
|
@ -567,11 +567,12 @@ void Widget::resetAccount() {
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
|
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_signin_sure_reset(tr::now),
|
.text = tr::lng_signin_sure_reset(),
|
||||||
tr::lng_signin_reset(tr::now),
|
.confirmed = callback,
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_signin_reset(),
|
||||||
callback));
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Widget::getNearestDC() {
|
void Widget::getNearestDC() {
|
||||||
|
|
|
@ -367,14 +367,14 @@ bool CloudManager::showOfferSwitchBox() {
|
||||||
Local::writeLangPack();
|
Local::writeLangPack();
|
||||||
};
|
};
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
"Do you want to switch your language to "
|
.text = QString("Do you want to switch your language to ")
|
||||||
+ language.nativeName
|
+ language.nativeName
|
||||||
+ "? You can always change your language in Settings.",
|
+ QString("? You can always change your language in Settings."),
|
||||||
"Change",
|
.confirmed = confirm,
|
||||||
tr::lng_cancel(tr::now),
|
.cancelled = cancel,
|
||||||
confirm,
|
.confirmText = QString("Change"),
|
||||||
cancel),
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -419,7 +419,7 @@ void CloudManager::requestLanguageAndSwitch(
|
||||||
Expects(!id.isEmpty());
|
Expects(!id.isEmpty());
|
||||||
|
|
||||||
if (LanguageIdOrDefault(_langpack.id()) == id) {
|
if (LanguageIdOrDefault(_langpack.id()) == id) {
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_language_already(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_language_already()));
|
||||||
return;
|
return;
|
||||||
} else if (id == qstr("#custom")) {
|
} else if (id == qstr("#custom")) {
|
||||||
performSwitchToCustom();
|
performSwitchToCustom();
|
||||||
|
@ -464,7 +464,7 @@ void CloudManager::sendSwitchingToLanguageRequest() {
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
_switchingToLanguageRequest = 0;
|
_switchingToLanguageRequest = 0;
|
||||||
if (error.type() == "LANG_CODE_NOT_SUPPORTED") {
|
if (error.type() == "LANG_CODE_NOT_SUPPORTED") {
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_language_not_found(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_language_not_found()));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
}
|
}
|
||||||
|
@ -502,11 +502,11 @@ void CloudManager::switchToLanguage(const Language &data) {
|
||||||
+ "\n\n"
|
+ "\n\n"
|
||||||
+ getValue(tr::lng_sure_save_language.base);
|
+ getValue(tr::lng_sure_save_language.base);
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_box_ok(tr::now),
|
.confirmed = [=] { performSwitchAndRestart(data); },
|
||||||
tr::lng_cancel(tr::now),
|
.confirmText = tr::lng_box_ok(),
|
||||||
[=] { performSwitchAndRestart(data); }),
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}).fail([=] {
|
}).fail([=] {
|
||||||
_getKeysForSwitchRequestId = 0;
|
_getKeysForSwitchRequestId = 0;
|
||||||
|
@ -550,16 +550,16 @@ void CloudManager::performSwitchToCustom() {
|
||||||
Core::Restart();
|
Core::Restart();
|
||||||
};
|
};
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_box_ok(tr::now),
|
.confirmed = change,
|
||||||
tr::lng_cancel(tr::now),
|
.confirmText = tr::lng_box_ok(),
|
||||||
change),
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(
|
||||||
"Custom lang failed :(\n\nError: " + loader.errors()),
|
"Custom lang failed :(\n\nError: " + loader.errors()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
|
@ -504,7 +504,7 @@ bool MainWidget::setForwardDraft(PeerId peerId, Data::ForwardDraft &&draft) {
|
||||||
session().data().idsToItems(draft.ids),
|
session().data().idsToItems(draft.ids),
|
||||||
true);
|
true);
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
Ui::show(Box<Ui::InformBox>(error), Ui::LayerOption::KeepOther);
|
Ui::show(Ui::MakeInformBox(error), Ui::LayerOption::KeepOther);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -525,7 +525,7 @@ bool MainWidget::shareUrl(
|
||||||
|
|
||||||
const auto peer = session().data().peer(peerId);
|
const auto peer = session().data().peer(peerId);
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_share_cant(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_share_cant()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
TextWithTags textWithTags = {
|
TextWithTags textWithTags = {
|
||||||
|
@ -555,7 +555,7 @@ bool MainWidget::inlineSwitchChosen(PeerId peerId, const QString &botAndQuery) {
|
||||||
|
|
||||||
const auto peer = session().data().peer(peerId);
|
const auto peer = session().data().peer(peerId);
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_inline_switch_cant(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_inline_switch_cant()));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
const auto h = peer->owner().history(peer);
|
const auto h = peer->owner().history(peer);
|
||||||
|
@ -578,13 +578,12 @@ bool MainWidget::sendPaths(PeerId peerId) {
|
||||||
|
|
||||||
auto peer = session().data().peer(peerId);
|
auto peer = session().data().peer(peerId);
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(tr::lng_forward_send_files_cant()));
|
||||||
tr::lng_forward_send_files_cant(tr::now)));
|
|
||||||
return false;
|
return false;
|
||||||
} else if (const auto error = Data::RestrictionError(
|
} else if (const auto error = Data::RestrictionError(
|
||||||
peer,
|
peer,
|
||||||
ChatRestriction::SendMedia)) {
|
ChatRestriction::SendMedia)) {
|
||||||
Ui::show(Box<Ui::InformBox>(*error));
|
Ui::show(Ui::MakeInformBox(*error));
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
Ui::showPeerHistory(peer, ShowAtTheEndMsgId);
|
Ui::showPeerHistory(peer, ShowAtTheEndMsgId);
|
||||||
|
@ -610,8 +609,7 @@ void MainWidget::onFilesOrForwardDrop(
|
||||||
} else {
|
} else {
|
||||||
auto peer = session().data().peer(peerId);
|
auto peer = session().data().peer(peerId);
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(tr::lng_forward_send_files_cant()));
|
||||||
tr::lng_forward_send_files_cant(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ui::showPeerHistory(peer, ShowAtTheEndMsgId);
|
Ui::showPeerHistory(peer, ShowAtTheEndMsgId);
|
||||||
|
@ -1302,7 +1300,7 @@ void MainWidget::ui_showPeerHistory(
|
||||||
const auto unavailable = peer->computeUnavailableReason();
|
const auto unavailable = peer->computeUnavailableReason();
|
||||||
if (!unavailable.isEmpty()) {
|
if (!unavailable.isEmpty()) {
|
||||||
if (params.activation != anim::activation::background) {
|
if (params.activation != anim::activation::background) {
|
||||||
controller()->show(Box<Ui::InformBox>(unavailable));
|
controller()->show(Ui::MakeInformBox(unavailable));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -2046,7 +2044,7 @@ void MainWidget::hideAll() {
|
||||||
void MainWidget::showAll() {
|
void MainWidget::showAll() {
|
||||||
if (cPasswordRecovered()) {
|
if (cPasswordRecovered()) {
|
||||||
cSetPasswordRecovered(false);
|
cSetPasswordRecovered(false);
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_cloud_password_updated(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_cloud_password_updated()));
|
||||||
}
|
}
|
||||||
if (isOneColumn()) {
|
if (isOneColumn()) {
|
||||||
if (_sideShadow) {
|
if (_sideShadow) {
|
||||||
|
@ -2643,7 +2641,7 @@ void MainWidget::activate() {
|
||||||
_controller,
|
_controller,
|
||||||
path.mid(interpret.size()));
|
path.mid(interpret.size()));
|
||||||
if (!error.isEmpty()) {
|
if (!error.isEmpty()) {
|
||||||
Ui::show(Box<Ui::InformBox>(error));
|
Ui::show(Ui::MakeInformBox(error));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
showSendPathsLayer();
|
showSendPathsLayer();
|
||||||
|
|
|
@ -743,7 +743,7 @@ bool MainWindow::skipTrayClick() const {
|
||||||
void MainWindow::toggleDisplayNotifyFromTray() {
|
void MainWindow::toggleDisplayNotifyFromTray() {
|
||||||
if (controller().locked()) {
|
if (controller().locked()) {
|
||||||
if (!isActive()) showFromTray();
|
if (!isActive()) showFromTray();
|
||||||
Ui::show(Box<Ui::InformBox>(tr::lng_passcode_need_unblock(tr::now)));
|
Ui::show(Ui::MakeInformBox(tr::lng_passcode_need_unblock()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (!sessionController()) {
|
if (!sessionController()) {
|
||||||
|
|
|
@ -1815,13 +1815,14 @@ void OverlayWidget::deleteMedia() {
|
||||||
if (deletingPeerPhoto) {
|
if (deletingPeerPhoto) {
|
||||||
if (photo) {
|
if (photo) {
|
||||||
window->show(
|
window->show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_delete_photo_sure(tr::now),
|
.text = tr::lng_delete_photo_sure(),
|
||||||
tr::lng_box_delete(tr::now),
|
.confirmed = crl::guard(_widget, [=] {
|
||||||
crl::guard(_widget, [=] {
|
|
||||||
session->api().peerPhoto().clear(photo);
|
session->api().peerPhoto().clear(photo);
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
})),
|
}),
|
||||||
|
.confirmText = tr::lng_box_delete(),
|
||||||
|
}),
|
||||||
Ui::LayerOption::CloseOther);
|
Ui::LayerOption::CloseOther);
|
||||||
}
|
}
|
||||||
} else if (message) {
|
} else if (message) {
|
||||||
|
|
|
@ -765,7 +765,7 @@ std::vector<not_null<const Value*>> FormController::submitGetErrors() {
|
||||||
} else if (AcceptErrorRequiresRestart(error.type())) {
|
} else if (AcceptErrorRequiresRestart(error.type())) {
|
||||||
suggestRestart();
|
suggestRestart();
|
||||||
} else {
|
} else {
|
||||||
_view->show(Box<Ui::InformBox>(
|
_view->show(Ui::MakeInformBox(
|
||||||
Lang::Hard::SecureAcceptError() + "\n" + error.type()));
|
Lang::Hard::SecureAcceptError() + "\n" + error.type()));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -974,8 +974,7 @@ void FormController::checkSavedPasswordSettings(
|
||||||
|
|
||||||
void FormController::recoverPassword() {
|
void FormController::recoverPassword() {
|
||||||
if (!_password.hasRecovery) {
|
if (!_password.hasRecovery) {
|
||||||
_view->show(Box<Ui::InformBox>(
|
_view->show(Ui::MakeInformBox(tr::lng_signin_no_email_forgot()));
|
||||||
tr::lng_signin_no_email_forgot(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
} else if (_recoverRequestId) {
|
} else if (_recoverRequestId) {
|
||||||
return;
|
return;
|
||||||
|
@ -1015,7 +1014,7 @@ void FormController::recoverPassword() {
|
||||||
}, box->lifetime());
|
}, box->lifetime());
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
_recoverRequestId = 0;
|
_recoverRequestId = 0;
|
||||||
_view->show(Box<Ui::InformBox>(Lang::Hard::ServerError()
|
_view->show(Ui::MakeInformBox(Lang::Hard::ServerError()
|
||||||
+ '\n'
|
+ '\n'
|
||||||
+ error.type()));
|
+ error.type()));
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -2245,7 +2244,7 @@ void FormController::requestPhoneCall(not_null<Value*> value) {
|
||||||
void FormController::valueSaveShowError(
|
void FormController::valueSaveShowError(
|
||||||
not_null<Value*> value,
|
not_null<Value*> value,
|
||||||
const MTP::Error &error) {
|
const MTP::Error &error) {
|
||||||
_view->show(Box<Ui::InformBox>(
|
_view->show(Ui::MakeInformBox(
|
||||||
Lang::Hard::SecureSaveError() + "\n" + error.type()));
|
Lang::Hard::SecureSaveError() + "\n" + error.type()));
|
||||||
valueSaveFailed(value);
|
valueSaveFailed(value);
|
||||||
}
|
}
|
||||||
|
@ -2320,11 +2319,12 @@ void FormController::saveSecret(
|
||||||
|
|
||||||
void FormController::suggestRestart() {
|
void FormController::suggestRestart() {
|
||||||
_suggestingRestart = true;
|
_suggestingRestart = true;
|
||||||
_view->show(Box<Ui::ConfirmBox>(
|
_view->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_passport_restart_sure(tr::now),
|
.text = tr::lng_passport_restart_sure(),
|
||||||
tr::lng_passport_restart(tr::now),
|
.confirmed = [=] { _controller->showPassportForm(_request); },
|
||||||
[=] { _controller->showPassportForm(_request); },
|
.cancelled = [=] { cancel(); },
|
||||||
[=] { cancel(); }));
|
.confirmText = tr::lng_passport_restart(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FormController::requestForm() {
|
void FormController::requestForm() {
|
||||||
|
@ -2684,11 +2684,12 @@ bool FormController::applyPassword(PasswordSettings &&settings) {
|
||||||
|
|
||||||
void FormController::cancel() {
|
void FormController::cancel() {
|
||||||
if (!_submitSuccess && _serviceErrorText.isEmpty()) {
|
if (!_submitSuccess && _serviceErrorText.isEmpty()) {
|
||||||
_view->show(Box<Ui::ConfirmBox>(
|
_view->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_passport_stop_sure(tr::now),
|
.text = tr::lng_passport_stop_sure(),
|
||||||
tr::lng_passport_stop(tr::now),
|
.confirmed = [=] { cancelSure(); },
|
||||||
[=] { cancelSure(); },
|
.cancelled = [=] { cancelAbort(); },
|
||||||
[=] { cancelAbort(); }));
|
.confirmText = tr::lng_passport_stop(),
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
cancelSure();
|
cancelSure();
|
||||||
}
|
}
|
||||||
|
|
|
@ -710,10 +710,14 @@ void PanelController::setupPassword() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanelController::cancelPasswordSubmit() {
|
void PanelController::cancelPasswordSubmit() {
|
||||||
show(Box<Ui::ConfirmBox>(
|
show(Ui::MakeConfirmBox({
|
||||||
tr::lng_passport_stop_password_sure(tr::now),
|
.text = tr::lng_passport_stop_password_sure(),
|
||||||
tr::lng_passport_stop(tr::now),
|
.confirmed = [=](Fn<void()> &&close) {
|
||||||
[=](Fn<void()> &&close) { close(); _form->cancelPassword(); }));
|
close();
|
||||||
|
_form->cancelPassword();
|
||||||
|
},
|
||||||
|
.confirmText = tr::lng_passport_stop(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanelController::validateRecoveryEmail() {
|
void PanelController::validateRecoveryEmail() {
|
||||||
|
@ -887,20 +891,22 @@ void PanelController::deleteValueSure(bool withDetails) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanelController::suggestReset(Fn<void()> callback) {
|
void PanelController::suggestReset(Fn<void()> callback) {
|
||||||
_resetBox = Ui::BoxPointer(show(Box<Ui::ConfirmBox>(
|
_resetBox = Ui::BoxPointer(show(Ui::MakeConfirmBox({
|
||||||
Lang::Hard::PassportCorrupted(),
|
.text = Lang::Hard::PassportCorrupted(),
|
||||||
Lang::Hard::PassportCorruptedReset(),
|
.confirmed = [=] { resetPassport(callback); },
|
||||||
[=] { resetPassport(callback); },
|
.cancelled = [=] { cancelReset(); },
|
||||||
[=] { cancelReset(); })).data());
|
.confirmText = Lang::Hard::PassportCorruptedReset(),
|
||||||
|
})).data());
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanelController::resetPassport(Fn<void()> callback) {
|
void PanelController::resetPassport(Fn<void()> callback) {
|
||||||
const auto box = show(Box<Ui::ConfirmBox>(
|
const auto box = show(Ui::MakeConfirmBox({
|
||||||
Lang::Hard::PassportCorruptedResetSure(),
|
.text = Lang::Hard::PassportCorruptedResetSure(),
|
||||||
Lang::Hard::PassportCorruptedReset(),
|
.confirmed = [=] { base::take(_resetBox); callback(); },
|
||||||
st::attentionBoxButton,
|
.cancelled = [=] { suggestReset(callback); },
|
||||||
[=] { base::take(_resetBox); callback(); },
|
.confirmText = Lang::Hard::PassportCorruptedReset(),
|
||||||
[=] { suggestReset(callback); }));
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}));
|
||||||
_resetBox = Ui::BoxPointer(box.data());
|
_resetBox = Ui::BoxPointer(box.data());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -942,11 +948,12 @@ void PanelController::showUpdateAppBox() {
|
||||||
Core::UpdateApplication();
|
Core::UpdateApplication();
|
||||||
};
|
};
|
||||||
show(
|
show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_passport_app_out_of_date(tr::now),
|
.text = tr::lng_passport_app_out_of_date(),
|
||||||
tr::lng_menu_update(tr::now),
|
.confirmed = callback,
|
||||||
callback,
|
.cancelled = [=] { _form->cancelSure(); },
|
||||||
[=] { _form->cancelSure(); }),
|
.confirmText = tr::lng_menu_update(),
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther,
|
Ui::LayerOption::KeepOther,
|
||||||
anim::type::instant);
|
anim::type::instant);
|
||||||
}
|
}
|
||||||
|
@ -1076,16 +1083,16 @@ void PanelController::editWithUpload(int index, int documentIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void PanelController::readScanError(ReadScanError error) {
|
void PanelController::readScanError(ReadScanError error) {
|
||||||
show(Box<Ui::InformBox>([&] {
|
show(Ui::MakeInformBox([&] {
|
||||||
switch (error) {
|
switch (error) {
|
||||||
case ReadScanError::FileTooLarge:
|
case ReadScanError::FileTooLarge:
|
||||||
return tr::lng_passport_error_too_large(tr::now);
|
return tr::lng_passport_error_too_large();
|
||||||
case ReadScanError::BadImageSize:
|
case ReadScanError::BadImageSize:
|
||||||
return tr::lng_passport_error_bad_size(tr::now);
|
return tr::lng_passport_error_bad_size();
|
||||||
case ReadScanError::CantReadImage:
|
case ReadScanError::CantReadImage:
|
||||||
return tr::lng_passport_error_cant_read(tr::now);
|
return tr::lng_passport_error_cant_read();
|
||||||
case ReadScanError::Unknown:
|
case ReadScanError::Unknown:
|
||||||
return Lang::Hard::UnknownSecureScanError();
|
return rpl::single(Lang::Hard::UnknownSecureScanError());
|
||||||
}
|
}
|
||||||
Unexpected("Error type in PanelController::readScanError.");
|
Unexpected("Error type in PanelController::readScanError.");
|
||||||
}()));
|
}()));
|
||||||
|
@ -1402,10 +1409,11 @@ void PanelController::cancelEditScope() {
|
||||||
|
|
||||||
if (_panelHasUnsavedChanges && _panelHasUnsavedChanges()) {
|
if (_panelHasUnsavedChanges && _panelHasUnsavedChanges()) {
|
||||||
if (!_confirmForgetChangesBox) {
|
if (!_confirmForgetChangesBox) {
|
||||||
_confirmForgetChangesBox = show(Box<Ui::ConfirmBox>(
|
_confirmForgetChangesBox = show(Ui::MakeConfirmBox({
|
||||||
tr::lng_passport_sure_cancel(tr::now),
|
.text = tr::lng_passport_sure_cancel(),
|
||||||
tr::lng_continue(tr::now),
|
.confirmed = [=] { _panel->showForm(); },
|
||||||
[=] { _panel->showForm(); }));
|
.confirmText = tr::lng_continue(),
|
||||||
|
}));
|
||||||
_editScopeBoxes.emplace_back(_confirmForgetChangesBox);
|
_editScopeBoxes.emplace_back(_confirmForgetChangesBox);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -460,7 +460,7 @@ void AppendEmojiPacks(
|
||||||
auto callback = [=] {
|
auto callback = [=] {
|
||||||
if (document) {
|
if (document) {
|
||||||
if (const auto error = RestrictionToSendStickers(_controller)) {
|
if (const auto error = RestrictionToSendStickers(_controller)) {
|
||||||
_controller->show(Box<Ui::InformBox>(*error));
|
_controller->show(Ui::MakeInformBox(*error));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
Api::SendExistingDocument(
|
Api::SendExistingDocument(
|
||||||
|
|
|
@ -400,10 +400,14 @@ void AutostartToggle(bool enabled, Fn<void(bool)> done) {
|
||||||
if (!requested || enabled) {
|
if (!requested || enabled) {
|
||||||
return;
|
return;
|
||||||
} else if (const auto window = Core::App().activeWindow()) {
|
} else if (const auto window = Core::App().activeWindow()) {
|
||||||
window->show(Box<Ui::ConfirmBox>(
|
window->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_settings_auto_start_disabled_uwp(tr::now),
|
.text = tr::lng_settings_auto_start_disabled_uwp(),
|
||||||
tr::lng_settings_open_system_settings(tr::now),
|
.confirmed = [] {
|
||||||
[] { AutostartTask::OpenSettings(); Ui::hideLayer(); }));
|
AutostartTask::OpenSettings();
|
||||||
|
Ui::hideLayer();
|
||||||
|
},
|
||||||
|
.confirmText = tr::lng_settings_open_system_settings(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}); };
|
}); };
|
||||||
AutostartTask::Toggle(
|
AutostartTask::Toggle(
|
||||||
|
|
|
@ -99,10 +99,11 @@ void GroupMembersWidget::removePeer(PeerData *selectedPeer) {
|
||||||
currentRestrictedRights);
|
currentRestrictedRights);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_box_remove(tr::now),
|
.confirmed = crl::guard(&peer->session(), callback),
|
||||||
crl::guard(&peer->session(), callback)));
|
.confirmText = tr::lng_box_remove(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void GroupMembersWidget::notifyPeerUpdated(const Data::PeerUpdate &update) {
|
void GroupMembersWidget::notifyPeerUpdated(const Data::PeerUpdate &update) {
|
||||||
|
|
|
@ -521,8 +521,8 @@ void SetupSystemIntegrationContent(
|
||||||
}) | rpl::start_with_next([=](bool checked) {
|
}) | rpl::start_with_next([=](bool checked) {
|
||||||
if (controller->session().domain().local().hasLocalPasscode()) {
|
if (controller->session().domain().local().hasLocalPasscode()) {
|
||||||
minimized->entity()->setChecked(false);
|
minimized->entity()->setChecked(false);
|
||||||
controller->show(Box<Ui::InformBox>(
|
controller->show(Ui::MakeInformBox(
|
||||||
tr::lng_error_start_minimized_passcoded(tr::now)));
|
tr::lng_error_start_minimized_passcoded()));
|
||||||
} else {
|
} else {
|
||||||
cSetStartMinimized(checked);
|
cSetStartMinimized(checked);
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
|
@ -638,10 +638,11 @@ void SetupANGLE(
|
||||||
}
|
}
|
||||||
Core::Restart();
|
Core::Restart();
|
||||||
});
|
});
|
||||||
controller->show(Box<Ui::ConfirmBox>(
|
controller->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_settings_need_restart(tr::now),
|
.text = tr::lng_settings_need_restart(),
|
||||||
tr::lng_settings_restart_now(tr::now),
|
.confirmed = confirmed,
|
||||||
confirmed));
|
.confirmText = tr::lng_settings_restart_now(),
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
SingleChoiceBox(box, {
|
SingleChoiceBox(box, {
|
||||||
.title = tr::lng_settings_angle_backend(),
|
.title = tr::lng_settings_angle_backend(),
|
||||||
|
@ -680,11 +681,12 @@ void SetupOpenGL(
|
||||||
const auto cancelled = crl::guard(button, [=] {
|
const auto cancelled = crl::guard(button, [=] {
|
||||||
toggles->fire(!enabled);
|
toggles->fire(!enabled);
|
||||||
});
|
});
|
||||||
controller->show(Box<Ui::ConfirmBox>(
|
controller->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_settings_need_restart(tr::now),
|
.text = tr::lng_settings_need_restart(),
|
||||||
tr::lng_settings_restart_now(tr::now),
|
.confirmed = confirmed,
|
||||||
confirmed,
|
.cancelled = cancelled,
|
||||||
cancelled));
|
.confirmText = tr::lng_settings_restart_now(),
|
||||||
|
}));
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ void Calls::setupContent() {
|
||||||
Platform::SystemSettingsType::Audio);
|
Platform::SystemSettingsType::Audio);
|
||||||
if (!opened) {
|
if (!opened) {
|
||||||
_controller->show(
|
_controller->show(
|
||||||
Box<Ui::InformBox>(tr::lng_linux_no_audio_prefs(tr::now)));
|
Ui::MakeInformBox(tr::lng_linux_no_audio_prefs()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -325,10 +325,11 @@ void Calls::requestPermissionAndStartTestingMicrophone() {
|
||||||
Platform::PermissionType::Microphone);
|
Platform::PermissionType::Microphone);
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
};
|
};
|
||||||
_controller->show(Box<Ui::ConfirmBox>(
|
_controller->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_no_mic_permission(tr::now),
|
.text = tr::lng_no_mic_permission(),
|
||||||
tr::lng_menu_settings(tr::now),
|
.confirmed = showSystemSettings,
|
||||||
showSystemSettings));
|
.confirmText = tr::lng_menu_settings(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1208,8 +1208,8 @@ void SetupDefaultThemes(
|
||||||
// in Window::Theme::Revert which is called by Editor.
|
// in Window::Theme::Revert which is called by Editor.
|
||||||
//
|
//
|
||||||
// So we check here, before we change the saved accent color.
|
// So we check here, before we change the saved accent color.
|
||||||
window->show(Box<Ui::InformBox>(
|
window->show(Ui::MakeInformBox(
|
||||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
tr::lng_theme_editor_cant_change_theme()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto type = chosen();
|
const auto type = chosen();
|
||||||
|
@ -1361,8 +1361,8 @@ void SetupAutoNightMode(
|
||||||
}) | rpl::start_with_next([=](bool checked) {
|
}) | rpl::start_with_next([=](bool checked) {
|
||||||
if (checked && Window::Theme::Background()->editingTheme()) {
|
if (checked && Window::Theme::Background()->editingTheme()) {
|
||||||
autoNight->setChecked(false);
|
autoNight->setChecked(false);
|
||||||
controller->show(Box<Ui::InformBox>(
|
controller->show(Ui::MakeInformBox(
|
||||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
tr::lng_theme_editor_cant_change_theme()));
|
||||||
} else {
|
} else {
|
||||||
Core::App().settings().setSystemDarkModeEnabled(checked);
|
Core::App().settings().setSystemDarkModeEnabled(checked);
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
|
|
|
@ -78,9 +78,9 @@ auto GenerateCodes() {
|
||||||
? qsl("Do you want to disable DEBUG logs?")
|
? qsl("Do you want to disable DEBUG logs?")
|
||||||
: qsl("Do you want to enable DEBUG logs?\n\n"
|
: qsl("Do you want to enable DEBUG logs?\n\n"
|
||||||
"All network events will be logged.");
|
"All network events will be logged.");
|
||||||
Ui::show(Box<Ui::ConfirmBox>(text, [] {
|
Ui::show(Ui::MakeConfirmBox({ text, [] {
|
||||||
Core::App().switchDebugMode();
|
Core::App().switchDebugMode();
|
||||||
}));
|
} }));
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("viewlogs"), [](SessionController *window) {
|
codes.emplace(qsl("viewlogs"), [](SessionController *window) {
|
||||||
File::ShowInFolder(cWorkingDir() + "log.txt");
|
File::ShowInFolder(cWorkingDir() + "log.txt");
|
||||||
|
@ -98,11 +98,11 @@ auto GenerateCodes() {
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("moderate"), [](SessionController *window) {
|
codes.emplace(qsl("moderate"), [](SessionController *window) {
|
||||||
auto text = Core::App().settings().moderateModeEnabled() ? qsl("Disable moderate mode?") : qsl("Enable moderate mode?");
|
auto text = Core::App().settings().moderateModeEnabled() ? qsl("Disable moderate mode?") : qsl("Enable moderate mode?");
|
||||||
Ui::show(Box<Ui::ConfirmBox>(text, [=] {
|
Ui::show(Ui::MakeConfirmBox({ text, [=] {
|
||||||
Core::App().settings().setModerateModeEnabled(!Core::App().settings().moderateModeEnabled());
|
Core::App().settings().setModerateModeEnabled(!Core::App().settings().moderateModeEnabled());
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
}));
|
} }));
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("getdifference"), [](SessionController *window) {
|
codes.emplace(qsl("getdifference"), [](SessionController *window) {
|
||||||
if (window) {
|
if (window) {
|
||||||
|
@ -121,11 +121,11 @@ auto GenerateCodes() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?");
|
auto text = cUseExternalVideoPlayer() ? qsl("Use internal video player?") : qsl("Use external video player?");
|
||||||
Ui::show(Box<Ui::ConfirmBox>(text, [=] {
|
Ui::show(Ui::MakeConfirmBox({ text, [=] {
|
||||||
cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer());
|
cSetUseExternalVideoPlayer(!cUseExternalVideoPlayer());
|
||||||
window->session().saveSettingsDelayed();
|
window->session().saveSettingsDelayed();
|
||||||
Ui::hideLayer();
|
Ui::hideLayer();
|
||||||
}));
|
} }));
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("endpoints"), [](SessionController *window) {
|
codes.emplace(qsl("endpoints"), [](SessionController *window) {
|
||||||
if (!Core::App().domain().started()) {
|
if (!Core::App().domain().started()) {
|
||||||
|
@ -138,7 +138,7 @@ auto GenerateCodes() {
|
||||||
if (!result.paths.isEmpty()) {
|
if (!result.paths.isEmpty()) {
|
||||||
const auto loadFor = [&](not_null<Main::Account*> account) {
|
const auto loadFor = [&](not_null<Main::Account*> account) {
|
||||||
if (!account->mtp().dcOptions().loadFromFile(result.paths.front())) {
|
if (!account->mtp().dcOptions().loadFromFile(result.paths.front())) {
|
||||||
Ui::show(Box<Ui::InformBox>("Could not load endpoints"
|
Ui::show(Ui::MakeInformBox("Could not load endpoints"
|
||||||
" :( Errors in 'log.txt'."));
|
" :( Errors in 'log.txt'."));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -188,9 +188,9 @@ auto GenerateCodes() {
|
||||||
#endif // !Q_OS_WIN
|
#endif // !Q_OS_WIN
|
||||||
: qsl("Switch font engine to FreeType?");
|
: qsl("Switch font engine to FreeType?");
|
||||||
|
|
||||||
Ui::show(Box<Ui::ConfirmBox>(text, [] {
|
Ui::show(Ui::MakeConfirmBox({ text, [] {
|
||||||
Core::App().switchFreeType();
|
Core::App().switchFreeType();
|
||||||
}));
|
} }));
|
||||||
});
|
});
|
||||||
#endif // Q_OS_WIN || Q_OS_MAC
|
#endif // Q_OS_WIN || Q_OS_MAC
|
||||||
|
|
||||||
|
@ -217,7 +217,7 @@ auto GenerateCodes() {
|
||||||
auto track = Media::Audio::Current().createTrack();
|
auto track = Media::Audio::Current().createTrack();
|
||||||
track->fillFromFile(result.paths.front());
|
track->fillFromFile(result.paths.front());
|
||||||
if (track->failed()) {
|
if (track->failed()) {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(
|
||||||
"Could not audio :( Errors in 'log.txt'."));
|
"Could not audio :( Errors in 'log.txt'."));
|
||||||
} else {
|
} else {
|
||||||
Core::App().settings().setSoundOverride(
|
Core::App().settings().setSoundOverride(
|
||||||
|
@ -232,7 +232,7 @@ auto GenerateCodes() {
|
||||||
codes.emplace(qsl("sounds_reset"), [](SessionController *window) {
|
codes.emplace(qsl("sounds_reset"), [](SessionController *window) {
|
||||||
Core::App().settings().clearSoundOverrides();
|
Core::App().settings().clearSoundOverrides();
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
Ui::show(Box<Ui::InformBox>("All sound overrides were reset."));
|
Ui::show(Ui::MakeInformBox("All sound overrides were reset."));
|
||||||
});
|
});
|
||||||
codes.emplace(qsl("unpacklog"), [](SessionController *window) {
|
codes.emplace(qsl("unpacklog"), [](SessionController *window) {
|
||||||
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open crash log file", "Crash dump (*.txt)", [=](const FileDialog::OpenResult &result) {
|
FileDialog::GetOpenPath(Core::App().getFileDialogParent(), "Open crash log file", "Crash dump (*.txt)", [=](const FileDialog::OpenResult &result) {
|
||||||
|
|
|
@ -53,11 +53,12 @@ void AddOption(
|
||||||
: nullptr;
|
: nullptr;
|
||||||
if (restarter) {
|
if (restarter) {
|
||||||
restarter->setCallback([=] {
|
restarter->setCallback([=] {
|
||||||
window->show(Box<Ui::ConfirmBox>(
|
window->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_settings_need_restart(tr::now),
|
.text = tr::lng_settings_need_restart(),
|
||||||
tr::lng_settings_restart_now(tr::now),
|
.confirmed = [] { Core::Restart(); },
|
||||||
tr::lng_settings_restart_later(tr::now),
|
.confirmText = tr::lng_settings_restart_now(),
|
||||||
[] { Core::Restart(); }));
|
.cancelText = tr::lng_settings_restart_later(),
|
||||||
|
}));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
button->toggledChanges(
|
button->toggledChanges(
|
||||||
|
|
|
@ -400,11 +400,12 @@ void SetupInterfaceScale(
|
||||||
button,
|
button,
|
||||||
[=] { repeatSetScale(cConfigScale(), repeatSetScale); });
|
[=] { repeatSetScale(cConfigScale(), repeatSetScale); });
|
||||||
});
|
});
|
||||||
window->show(Box<Ui::ConfirmBox>(
|
window->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_settings_need_restart(tr::now),
|
.text = tr::lng_settings_need_restart(),
|
||||||
tr::lng_settings_restart_now(tr::now),
|
.confirmed = confirmed,
|
||||||
confirmed,
|
.cancelled = cancelled,
|
||||||
cancelled));
|
.confirmText = tr::lng_settings_restart_now(),
|
||||||
|
}));
|
||||||
} else if (scale != cConfigScale()) {
|
} else if (scale != cConfigScale()) {
|
||||||
cSetConfigScale(scale);
|
cSetConfigScale(scale);
|
||||||
Local::writeSettings();
|
Local::writeSettings();
|
||||||
|
@ -505,13 +506,14 @@ void SetupHelp(
|
||||||
*requestId = 0;
|
*requestId = 0;
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
auto box = Box<Ui::ConfirmBox>(
|
auto box = Ui::MakeConfirmBox({
|
||||||
tr::lng_settings_ask_sure(tr::now),
|
.text = tr::lng_settings_ask_sure(),
|
||||||
tr::lng_settings_ask_ok(tr::now),
|
.confirmed = sure,
|
||||||
tr::lng_settings_faq_button(tr::now),
|
.cancelled = OpenFaq,
|
||||||
sure,
|
.confirmText = tr::lng_settings_ask_ok(),
|
||||||
OpenFaq);
|
.cancelText = tr::lng_settings_faq_button(),
|
||||||
box->setStrictCancel(true);
|
.strictCancel = true,
|
||||||
|
});
|
||||||
controller->show(std::move(box));
|
controller->show(std::move(box));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -595,11 +595,11 @@ void LastSeenPrivacyController::confirmSave(
|
||||||
Core::App().settings().setLastSeenWarningSeen(true);
|
Core::App().settings().setLastSeenWarningSeen(true);
|
||||||
Core::App().saveSettingsDelayed();
|
Core::App().saveSettingsDelayed();
|
||||||
};
|
};
|
||||||
auto box = Box<Ui::ConfirmBox>(
|
auto box = Ui::MakeConfirmBox({
|
||||||
tr::lng_edit_privacy_lastseen_warning(tr::now),
|
.text = tr::lng_edit_privacy_lastseen_warning(),
|
||||||
tr::lng_continue(tr::now),
|
.confirmed = std::move(callback),
|
||||||
tr::lng_cancel(tr::now),
|
.confirmText = tr::lng_continue(),
|
||||||
std::move(callback));
|
});
|
||||||
Ui::show(std::move(box), Ui::LayerOption::KeepOther);
|
Ui::show(std::move(box), Ui::LayerOption::KeepOther);
|
||||||
} else {
|
} else {
|
||||||
saveCallback();
|
saveCallback();
|
||||||
|
|
|
@ -569,11 +569,12 @@ void SetupCloudPassword(
|
||||||
*sent = false;
|
*sent = false;
|
||||||
}, container->lifetime());
|
}, container->lifetime());
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_cloud_password_reset_cancel_sure(tr::now),
|
.text = tr::lng_cloud_password_reset_cancel_sure(),
|
||||||
tr::lng_box_yes(tr::now),
|
.confirmed = cancel,
|
||||||
tr::lng_box_no(tr::now),
|
.confirmText = tr::lng_box_yes(),
|
||||||
cancel));
|
.cancelText = tr::lng_box_no(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -931,10 +932,11 @@ object_ptr<Ui::BoxContent> CloudPasswordAppOutdatedBox() {
|
||||||
Core::UpdateApplication();
|
Core::UpdateApplication();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
return Box<Ui::ConfirmBox>(
|
return Ui::MakeConfirmBox({
|
||||||
tr::lng_passport_app_out_of_date(tr::now),
|
.text = tr::lng_passport_app_out_of_date(),
|
||||||
tr::lng_menu_update(tr::now),
|
.confirmed = callback,
|
||||||
callback);
|
.confirmText = tr::lng_menu_update(),
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPrivacyButton(
|
void AddPrivacyButton(
|
||||||
|
|
|
@ -994,13 +994,13 @@ void FileLoadTask::process(Args &&args) {
|
||||||
void FileLoadTask::finish() {
|
void FileLoadTask::finish() {
|
||||||
if (!_result || !_result->filesize || _result->filesize < 0) {
|
if (!_result || !_result->filesize || _result->filesize < 0) {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(
|
||||||
tr::lng_send_image_empty(tr::now, lt_name, _filepath)),
|
tr::lng_send_image_empty(tr::now, lt_name, _filepath)),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
removeFromAlbum();
|
removeFromAlbum();
|
||||||
} else if (_result->filesize > kFileSizeLimit) {
|
} else if (_result->filesize > kFileSizeLimit) {
|
||||||
Ui::show(
|
Ui::show(
|
||||||
Box<Ui::InformBox>(
|
Ui::MakeInformBox(
|
||||||
tr::lng_send_image_too_large(tr::now, lt_name, _filepath)),
|
tr::lng_send_image_too_large(tr::now, lt_name, _filepath)),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
removeFromAlbum();
|
removeFromAlbum();
|
||||||
|
|
|
@ -1406,10 +1406,11 @@ void ToggleNightModeWithConfirmation(
|
||||||
toggle();
|
toggle();
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
window->show(Box<Ui::ConfirmBox>(
|
window->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_settings_auto_night_warning(tr::now),
|
.text = tr::lng_settings_auto_night_warning(),
|
||||||
tr::lng_settings_auto_night_disable(tr::now),
|
.confirmed = disableAndToggle,
|
||||||
disableAndToggle));
|
.confirmText = tr::lng_settings_auto_night_disable(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -423,8 +423,8 @@ Editor::Inner::Inner(QWidget *parent, const QString &path)
|
||||||
if (update.type == BackgroundUpdate::Type::TestingTheme) {
|
if (update.type == BackgroundUpdate::Type::TestingTheme) {
|
||||||
Revert();
|
Revert();
|
||||||
base::call_delayed(st::slideDuration, this, [] {
|
base::call_delayed(st::slideDuration, this, [] {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(Ui::MakeInformBox(
|
||||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
tr::lng_theme_editor_cant_change_theme()));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
@ -668,7 +668,7 @@ Editor::Editor(
|
||||||
[=] { save(); }));
|
[=] { save(); }));
|
||||||
|
|
||||||
_inner->setErrorCallback([=] {
|
_inner->setErrorCallback([=] {
|
||||||
window->show(Box<Ui::InformBox>(tr::lng_theme_editor_error(tr::now)));
|
window->show(Ui::MakeInformBox(tr::lng_theme_editor_error()));
|
||||||
|
|
||||||
// This could be from inner->_context observable notification.
|
// This could be from inner->_context observable notification.
|
||||||
// We should not destroy it while iterating in subscribers.
|
// We should not destroy it while iterating in subscribers.
|
||||||
|
@ -752,14 +752,12 @@ void Editor::exportTheme() {
|
||||||
QFile f(path);
|
QFile f(path);
|
||||||
if (!f.open(QIODevice::WriteOnly)) {
|
if (!f.open(QIODevice::WriteOnly)) {
|
||||||
LOG(("Theme Error: could not open zip-ed theme file '%1' for writing").arg(path));
|
LOG(("Theme Error: could not open zip-ed theme file '%1' for writing").arg(path));
|
||||||
_window->show(
|
_window->show(Ui::MakeInformBox(tr::lng_theme_editor_error()));
|
||||||
Box<Ui::InformBox>(tr::lng_theme_editor_error(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (f.write(result) != result.size()) {
|
if (f.write(result) != result.size()) {
|
||||||
LOG(("Theme Error: could not write zip-ed theme to file '%1'").arg(path));
|
LOG(("Theme Error: could not write zip-ed theme to file '%1'").arg(path));
|
||||||
_window->show(
|
_window->show(Ui::MakeInformBox(tr::lng_theme_editor_error()));
|
||||||
Box<Ui::InformBox>(tr::lng_theme_editor_error(tr::now)));
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Ui::Toast::Show(tr::lng_theme_editor_done(tr::now));
|
Ui::Toast::Show(tr::lng_theme_editor_done(tr::now));
|
||||||
|
@ -906,10 +904,11 @@ void Editor::closeWithConfirmation() {
|
||||||
closeEditor();
|
closeEditor();
|
||||||
close();
|
close();
|
||||||
});
|
});
|
||||||
_window->show(Box<Ui::ConfirmBox>(
|
_window->show(Ui::MakeConfirmBox({
|
||||||
tr::lng_theme_editor_sure_close(tr::now),
|
.text = tr::lng_theme_editor_sure_close(),
|
||||||
tr::lng_close(tr::now),
|
.confirmed = close,
|
||||||
close));
|
.confirmText = tr::lng_close(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void Editor::closeEditor() {
|
void Editor::closeEditor() {
|
||||||
|
|
|
@ -655,7 +655,7 @@ void StartEditor(
|
||||||
? GenerateDefaultPalette()
|
? GenerateDefaultPalette()
|
||||||
: ParseTheme(object, true).palette;
|
: ParseTheme(object, true).palette;
|
||||||
if (palette.isEmpty() || !CopyColorsToPalette(path, palette, cloud)) {
|
if (palette.isEmpty() || !CopyColorsToPalette(path, palette, cloud)) {
|
||||||
window->show(Box<Ui::InformBox>(tr::lng_theme_editor_error(tr::now)));
|
window->show(Ui::MakeInformBox(tr::lng_theme_editor_error()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Core::App().settings().systemDarkModeEnabled()) {
|
if (Core::App().settings().systemDarkModeEnabled()) {
|
||||||
|
|
|
@ -622,10 +622,11 @@ void CloudList::showMenu(Element &element) {
|
||||||
_window->session().data().cloudThemes().remove(id);
|
_window->session().data().cloudThemes().remove(id);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
_window->window().show(Box<Ui::ConfirmBox>(
|
_window->window().show(Ui::MakeConfirmBox({
|
||||||
tr::lng_theme_delete_sure(tr::now),
|
.text = tr::lng_theme_delete_sure(),
|
||||||
tr::lng_theme_delete(tr::now),
|
.confirmed = remove,
|
||||||
remove));
|
.confirmText = tr::lng_theme_delete(),
|
||||||
|
}));
|
||||||
}, &st::menuIconDelete);
|
}, &st::menuIconDelete);
|
||||||
_contextMenu->popup(QCursor::pos());
|
_contextMenu->popup(QCursor::pos());
|
||||||
}
|
}
|
||||||
|
|
|
@ -234,11 +234,12 @@ void Controller::showTermsDelete() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
show(
|
show(
|
||||||
Box<Ui::ConfirmBox>(
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_terms_delete_warning(tr::now),
|
.text = tr::lng_terms_delete_warning(),
|
||||||
tr::lng_terms_delete_now(tr::now),
|
.confirmed = deleteByTerms,
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_terms_delete_now(),
|
||||||
deleteByTerms),
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -403,11 +404,12 @@ void Controller::showLogoutConfirmation() {
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
show(Box<Ui::ConfirmBox>(
|
show(Ui::MakeConfirmBox({
|
||||||
tr::lng_sure_logout(tr::now),
|
.text = tr::lng_sure_logout(),
|
||||||
tr::lng_settings_logout(tr::now),
|
.confirmed = callback,
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_settings_logout(),
|
||||||
callback));
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
Window::Adaptive &Controller::adaptive() const {
|
Window::Adaptive &Controller::adaptive() const {
|
||||||
|
|
|
@ -345,10 +345,11 @@ void FiltersMenu::showEditBox(FilterId id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void FiltersMenu::showRemoveBox(FilterId id) {
|
void FiltersMenu::showRemoveBox(FilterId id) {
|
||||||
_session->window().show(Box<Ui::ConfirmBox>(
|
_session->window().show(Ui::MakeConfirmBox({
|
||||||
tr::lng_filters_remove_sure(tr::now),
|
.text = tr::lng_filters_remove_sure(),
|
||||||
tr::lng_filters_remove_yes(tr::now),
|
.confirmed = [=](Fn<void()> &&close) { close(); remove(id); },
|
||||||
[=](Fn<void()> &&close) { close(); remove(id); }));
|
.confirmText = tr::lng_filters_remove_yes(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void FiltersMenu::remove(FilterId id) {
|
void FiltersMenu::remove(FilterId id) {
|
||||||
|
|
|
@ -323,11 +323,12 @@ void AddUnreadBadge(
|
||||||
close();
|
close();
|
||||||
Core::App().logoutWithChecks(&session->account());
|
Core::App().logoutWithChecks(&session->account());
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_sure_logout(tr::now),
|
.text = tr::lng_sure_logout(),
|
||||||
tr::lng_settings_logout(tr::now),
|
.confirmed = crl::guard(session, callback),
|
||||||
st::attentionBoxButton,
|
.confirmText = tr::lng_settings_logout(),
|
||||||
crl::guard(session, callback)));
|
.confirmStyle = &st::attentionBoxButton,
|
||||||
|
}));
|
||||||
}, &st::menuIconLeave);
|
}, &st::menuIconLeave);
|
||||||
state->menu->popup(QCursor::pos());
|
state->menu->popup(QCursor::pos());
|
||||||
}, raw->lifetime());
|
}, raw->lifetime());
|
||||||
|
@ -1034,8 +1035,8 @@ void MainMenu::setupMenu() {
|
||||||
}) | rpl::start_with_next([=](bool night) {
|
}) | rpl::start_with_next([=](bool night) {
|
||||||
if (Window::Theme::Background()->editingTheme()) {
|
if (Window::Theme::Background()->editingTheme()) {
|
||||||
_nightThemeSwitches.fire(!night);
|
_nightThemeSwitches.fire(!night);
|
||||||
controller->show(Box<Ui::InformBox>(
|
controller->show(Ui::MakeInformBox(
|
||||||
tr::lng_theme_editor_cant_change_theme(tr::now)));
|
tr::lng_theme_editor_cant_change_theme()));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto weak = MakeWeak(this);
|
const auto weak = MakeWeak(this);
|
||||||
|
|
|
@ -219,7 +219,7 @@ bool PinnedLimitReached(Dialogs::Key key, FilterId filterId) {
|
||||||
tr::now,
|
tr::now,
|
||||||
lt_count,
|
lt_count,
|
||||||
pinnedMax);
|
pinnedMax);
|
||||||
Ui::show(Box<Ui::InformBox>(errorText));
|
Ui::show(Ui::MakeInformBox(errorText));
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -855,10 +855,11 @@ void PeerMenuDeleteContact(not_null<UserData*> user) {
|
||||||
user->session().api().applyUpdates(result);
|
user->session().api().applyUpdates(result);
|
||||||
}).send();
|
}).send();
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
text,
|
.text = text,
|
||||||
tr::lng_box_delete(tr::now),
|
.confirmed = deleteSure,
|
||||||
deleteSure));
|
.confirmText = tr::lng_box_delete(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerMenuShareContactBox(
|
void PeerMenuShareContactBox(
|
||||||
|
@ -867,8 +868,8 @@ void PeerMenuShareContactBox(
|
||||||
const auto weak = std::make_shared<QPointer<PeerListBox>>();
|
const auto weak = std::make_shared<QPointer<PeerListBox>>();
|
||||||
auto callback = [=](not_null<PeerData*> peer) {
|
auto callback = [=](not_null<PeerData*> peer) {
|
||||||
if (!peer->canWrite()) {
|
if (!peer->canWrite()) {
|
||||||
Ui::show(Box<Ui::InformBox>(
|
Ui::show(
|
||||||
tr::lng_forward_share_cant(tr::now)),
|
Ui::MakeInformBox(tr::lng_forward_share_cant()),
|
||||||
Ui::LayerOption::KeepOther);
|
Ui::LayerOption::KeepOther);
|
||||||
return;
|
return;
|
||||||
} else if (peer->isSelf()) {
|
} else if (peer->isSelf()) {
|
||||||
|
@ -884,19 +885,25 @@ void PeerMenuShareContactBox(
|
||||||
auto recipient = peer->isUser()
|
auto recipient = peer->isUser()
|
||||||
? peer->name
|
? peer->name
|
||||||
: '\xAB' + peer->name + '\xBB';
|
: '\xAB' + peer->name + '\xBB';
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(
|
||||||
tr::lng_forward_share_contact(tr::now, lt_recipient, recipient),
|
Ui::MakeConfirmBox({
|
||||||
tr::lng_forward_send(tr::now),
|
.text = tr::lng_forward_share_contact(
|
||||||
[peer, user, navigation] {
|
tr::now,
|
||||||
const auto history = peer->owner().history(peer);
|
lt_recipient,
|
||||||
navigation->showPeerHistory(
|
recipient),
|
||||||
history,
|
.confirmed = [peer, user, navigation] {
|
||||||
Window::SectionShow::Way::ClearStack,
|
const auto history = peer->owner().history(peer);
|
||||||
ShowAtTheEndMsgId);
|
navigation->showPeerHistory(
|
||||||
auto action = Api::SendAction(history);
|
history,
|
||||||
action.clearDraft = false;
|
Window::SectionShow::Way::ClearStack,
|
||||||
user->session().api().shareContact(user, action);
|
ShowAtTheEndMsgId);
|
||||||
}), Ui::LayerOption::KeepOther);
|
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>(
|
*weak = Ui::show(Box<PeerListBox>(
|
||||||
std::make_unique<ChooseRecipientBoxController>(
|
std::make_unique<ChooseRecipientBoxController>(
|
||||||
|
@ -1186,7 +1193,11 @@ QPointer<Ui::BoxContent> ShowSendNowMessagesBox(
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return Ui::show(
|
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();
|
Ui::LayerOption::KeepOther).data();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1247,10 +1258,11 @@ void ToggleMessagePinned(
|
||||||
session->api().applyUpdates(result);
|
session->api().applyUpdates(result);
|
||||||
}).send();
|
}).send();
|
||||||
});
|
});
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_pinned_unpin_sure(tr::now),
|
.text = tr::lng_pinned_unpin_sure(),
|
||||||
tr::lng_pinned_unpin(tr::now),
|
.confirmed = callback,
|
||||||
callback));
|
.confirmText = tr::lng_pinned_unpin(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1278,10 +1290,11 @@ void HidePinnedBar(
|
||||||
session.api().requestFullPeer(peer);
|
session.api().requestFullPeer(peer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_pinned_hide_all_sure(tr::now),
|
.text = tr::lng_pinned_hide_all_sure(),
|
||||||
tr::lng_pinned_hide_all_hide(tr::now),
|
.confirmed = callback,
|
||||||
callback));
|
.confirmText = tr::lng_pinned_hide_all_hide(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void UnpinAllMessages(
|
void UnpinAllMessages(
|
||||||
|
@ -1305,10 +1318,11 @@ void UnpinAllMessages(
|
||||||
};
|
};
|
||||||
sendRequest(sendRequest);
|
sendRequest(sendRequest);
|
||||||
});
|
});
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_pinned_unpin_all_sure(tr::now),
|
.text = tr::lng_pinned_unpin_all_sure(),
|
||||||
tr::lng_pinned_unpin(tr::now),
|
.confirmed = callback,
|
||||||
callback));
|
.confirmText = tr::lng_pinned_unpin(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void PeerMenuAddMuteAction(
|
void PeerMenuAddMuteAction(
|
||||||
|
@ -1348,9 +1362,10 @@ void MenuAddMarkAsReadAllChatsAction(
|
||||||
MarkAsReadChatList(folder->chatsList());
|
MarkAsReadChatList(folder->chatsList());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_context_mark_read_all_sure(tr::now),
|
tr::lng_context_mark_read_all_sure(),
|
||||||
std::move(boxCallback)));
|
std::move(boxCallback)
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
addAction(
|
addAction(
|
||||||
tr::lng_context_mark_read_all(tr::now),
|
tr::lng_context_mark_read_all(tr::now),
|
||||||
|
@ -1372,9 +1387,10 @@ void MenuAddMarkAsReadChatListAction(
|
||||||
MarkAsReadChatList(list());
|
MarkAsReadChatList(list());
|
||||||
close();
|
close();
|
||||||
};
|
};
|
||||||
Ui::show(Box<Ui::ConfirmBox>(
|
Ui::show(Ui::MakeConfirmBox({
|
||||||
tr::lng_context_mark_read_sure(tr::now),
|
tr::lng_context_mark_read_sure(),
|
||||||
std::move(boxCallback)));
|
std::move(boxCallback)
|
||||||
|
}));
|
||||||
} else {
|
} else {
|
||||||
MarkAsReadChatList(list());
|
MarkAsReadChatList(list());
|
||||||
}
|
}
|
||||||
|
|
|
@ -212,7 +212,7 @@ void SessionNavigation::resolveUsername(
|
||||||
}).fail([=](const MTP::Error &error) {
|
}).fail([=](const MTP::Error &error) {
|
||||||
_resolveRequestId = 0;
|
_resolveRequestId = 0;
|
||||||
if (error.code() == 400) {
|
if (error.code() == 400) {
|
||||||
show(Box<Ui::InformBox>(
|
show(Ui::MakeInformBox(
|
||||||
tr::lng_username_not_found(tr::now, lt_user, username)));
|
tr::lng_username_not_found(tr::now, lt_user, username)));
|
||||||
}
|
}
|
||||||
}).send();
|
}).send();
|
||||||
|
@ -1127,12 +1127,14 @@ void SessionController::startOrJoinGroupCall(
|
||||||
using JoinConfirm = Calls::StartGroupCallArgs::JoinConfirm;
|
using JoinConfirm = Calls::StartGroupCallArgs::JoinConfirm;
|
||||||
auto &calls = Core::App().calls();
|
auto &calls = Core::App().calls();
|
||||||
const auto askConfirmation = [&](QString text, QString button) {
|
const auto askConfirmation = [&](QString text, QString button) {
|
||||||
show(Box<Ui::ConfirmBox>(text, button, crl::guard(this, [=] {
|
show(Ui::MakeConfirmBox({
|
||||||
Ui::hideLayer();
|
.text = text,
|
||||||
startOrJoinGroupCall(
|
.confirmed = crl::guard(this, [=, hash = args.joinHash] {
|
||||||
peer,
|
Ui::hideLayer();
|
||||||
{ args.joinHash, JoinConfirm::None });
|
startOrJoinGroupCall(peer, { hash, JoinConfirm::None });
|
||||||
})));
|
}),
|
||||||
|
.confirmText = button,
|
||||||
|
}));
|
||||||
};
|
};
|
||||||
if (args.confirm != JoinConfirm::None && calls.inCall()) {
|
if (args.confirm != JoinConfirm::None && calls.inCall()) {
|
||||||
// Do you want to leave your active voice chat
|
// Do you want to leave your active voice chat
|
||||||
|
@ -1375,12 +1377,13 @@ void SessionController::cancelUploadLayer(not_null<HistoryItem*> item) {
|
||||||
session().uploader().unpause();
|
session().uploader().unpause();
|
||||||
};
|
};
|
||||||
|
|
||||||
show(Box<Ui::ConfirmBox>(
|
show(Ui::MakeConfirmBox({
|
||||||
tr::lng_selected_cancel_sure_this(tr::now),
|
.text = tr::lng_selected_cancel_sure_this(),
|
||||||
tr::lng_selected_upload_stop(tr::now),
|
.confirmed = stopUpload,
|
||||||
tr::lng_continue(tr::now),
|
.cancelled = continueUpload,
|
||||||
stopUpload,
|
.confirmText = tr::lng_selected_upload_stop(),
|
||||||
continueUpload));
|
.cancelText = tr::lng_continue(),
|
||||||
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
void SessionController::showSection(
|
void SessionController::showSection(
|
||||||
|
|
Loading…
Add table
Reference in a new issue