2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Fixed display of most of simple toasts in corresponding window.

This commit is contained in:
23rd
2022-06-14 12:48:25 +03:00
parent 29910cd1f7
commit 629574685e
27 changed files with 179 additions and 79 deletions

View File

@@ -18,7 +18,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "ui/widgets/labels.h"
#include "ui/widgets/buttons.h"
#include "ui/widgets/checkbox.h"
#include "ui/toast/toast.h"
#include "ui/text/text_utilities.h"
#include "main/main_session.h"
#include "core/application.h"
@@ -776,7 +775,7 @@ void CreatePollBox::setInnerFocus() {
}
void CreatePollBox::submitFailed(const QString &error) {
Ui::Toast::Show(error);
Ui::Toast::Show(Ui::BoxShow(this).toastParent(), error);
}
not_null<Ui::InputField*> CreatePollBox::setupQuestion(
@@ -990,8 +989,11 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
multiple->events(
) | rpl::filter([=](not_null<QEvent*> e) {
return (e->type() == QEvent::MouseButtonPress) && quiz->checked();
}) | rpl::start_with_next([=] {
Ui::Toast::Show(tr::lng_polls_create_one_answer(tr::now));
}) | rpl::start_with_next([
toastParent = Ui::BoxShow(this).toastParent()] {
Ui::Toast::Show(
toastParent,
tr::lng_polls_create_one_answer(tr::now));
}, multiple->lifetime());
}
@@ -1068,8 +1070,10 @@ object_ptr<Ui::RpWidget> CreatePollBox::setupContent() {
*error &= ~Error::Solution;
}
};
const auto showError = [](tr::phrase<> text) {
Ui::Toast::Show(text(tr::now));
const auto showError = [
toastParent = Ui::BoxShow(this).toastParent()](
tr::phrase<> text) {
Ui::Toast::Show(toastParent, text(tr::now));
};
const auto send = [=](Api::SendOptions sendOptions) {
collectError();