Allow HiddenUrlClickHandler to work in a payment form.
This commit is contained in:
parent
7027c0db0b
commit
66e9c5ef16
|
@ -123,16 +123,17 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
|
||||||
const auto use = controller
|
const auto use = controller
|
||||||
? &controller->window()
|
? &controller->window()
|
||||||
: Core::App().activeWindow();
|
: Core::App().activeWindow();
|
||||||
if (use) {
|
auto box = Ui::MakeConfirmBox({
|
||||||
use->show(
|
|
||||||
Ui::MakeConfirmBox({
|
|
||||||
.text = (tr::lng_open_this_link(tr::now)
|
.text = (tr::lng_open_this_link(tr::now)
|
||||||
+ qsl("\n\n")
|
+ qsl("\n\n")
|
||||||
+ displayUrl),
|
+ displayUrl),
|
||||||
.confirmed = [=](Fn<void()> hide) { hide(); open(); },
|
.confirmed = [=](Fn<void()> hide) { hide(); open(); },
|
||||||
.confirmText = tr::lng_open_link(),
|
.confirmText = tr::lng_open_link(),
|
||||||
}),
|
});
|
||||||
Ui::LayerOption::KeepOther);
|
if (my.show) {
|
||||||
|
my.show->showBox(std::move(box));
|
||||||
|
} else if (use) {
|
||||||
|
use->show(std::move(box), Ui::LayerOption::KeepOther);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
open();
|
open();
|
||||||
|
|
|
@ -8,6 +8,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "ui/basic_click_handlers.h"
|
#include "ui/basic_click_handlers.h"
|
||||||
|
#include "data/data_msg_id.h"
|
||||||
|
|
||||||
constexpr auto kPeerLinkPeerIdProperty = 0x01;
|
constexpr auto kPeerLinkPeerIdProperty = 0x01;
|
||||||
constexpr auto kPhotoLinkMediaProperty = 0x02;
|
constexpr auto kPhotoLinkMediaProperty = 0x02;
|
||||||
|
@ -15,6 +16,10 @@ constexpr auto kDocumentLinkMediaProperty = 0x03;
|
||||||
constexpr auto kSendReactionEmojiProperty = 0x04;
|
constexpr auto kSendReactionEmojiProperty = 0x04;
|
||||||
constexpr auto kReactionsCountEmojiProperty = 0x05;
|
constexpr auto kReactionsCountEmojiProperty = 0x05;
|
||||||
|
|
||||||
|
namespace Ui {
|
||||||
|
class Show;
|
||||||
|
} // namespace Ui
|
||||||
|
|
||||||
namespace Main {
|
namespace Main {
|
||||||
class Session;
|
class Session;
|
||||||
} // namespace Main
|
} // namespace Main
|
||||||
|
@ -35,6 +40,7 @@ struct ClickHandlerContext {
|
||||||
// Is filled from sections.
|
// Is filled from sections.
|
||||||
Fn<HistoryView::ElementDelegate*()> elementDelegate;
|
Fn<HistoryView::ElementDelegate*()> elementDelegate;
|
||||||
base::weak_ptr<Window::SessionController> sessionWindow;
|
base::weak_ptr<Window::SessionController> sessionWindow;
|
||||||
|
std::shared_ptr<Ui::Show> show;
|
||||||
bool skipBotAutoLogin = false;
|
bool skipBotAutoLogin = false;
|
||||||
bool botStartAutoSubmit = false;
|
bool botStartAutoSubmit = false;
|
||||||
// Is filled from peer info.
|
// Is filled from peer info.
|
||||||
|
|
|
@ -20,6 +20,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "core/local_url_handlers.h" // TryConvertUrlToLocal.
|
#include "core/local_url_handlers.h" // TryConvertUrlToLocal.
|
||||||
#include "core/file_utilities.h" // File::OpenUrl.
|
#include "core/file_utilities.h" // File::OpenUrl.
|
||||||
#include "core/core_cloud_password.h" // Core::CloudPasswordState
|
#include "core/core_cloud_password.h" // Core::CloudPasswordState
|
||||||
|
#include "core/click_handler_types.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "api/api_cloud_password.h"
|
#include "api/api_cloud_password.h"
|
||||||
|
@ -808,6 +809,12 @@ void CheckoutProcess::panelShowBox(object_ptr<Ui::BoxContent> box) {
|
||||||
_panel->showBox(std::move(box));
|
_panel->showBox(std::move(box));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QVariant CheckoutProcess::panelClickHandlerContext() {
|
||||||
|
return QVariant::fromValue(ClickHandlerContext{
|
||||||
|
.show = _panel->uiShow(),
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
void CheckoutProcess::performInitialSilentValidation() {
|
void CheckoutProcess::performInitialSilentValidation() {
|
||||||
const auto &invoice = _form->invoice();
|
const auto &invoice = _form->invoice();
|
||||||
const auto &saved = _form->information();
|
const auto &saved = _form->information();
|
||||||
|
|
|
@ -147,6 +147,7 @@ private:
|
||||||
Ui::UncheckedCardDetails data,
|
Ui::UncheckedCardDetails data,
|
||||||
bool saveInformation) override;
|
bool saveInformation) override;
|
||||||
void panelShowBox(object_ptr<Ui::BoxContent> box) override;
|
void panelShowBox(object_ptr<Ui::BoxContent> box) override;
|
||||||
|
QVariant panelClickHandlerContext();
|
||||||
|
|
||||||
QString panelWebviewDataPath() override;
|
QString panelWebviewDataPath() override;
|
||||||
|
|
||||||
|
|
|
@ -19,6 +19,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/text/format_values.h"
|
#include "ui/text/format_values.h"
|
||||||
#include "ui/text/text_utilities.h"
|
#include "ui/text/text_utilities.h"
|
||||||
#include "ui/effects/radial_animation.h"
|
#include "ui/effects/radial_animation.h"
|
||||||
|
#include "ui/click_handler.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
#include "webview/webview_embed.h"
|
#include "webview/webview_embed.h"
|
||||||
#include "webview/webview_interface.h"
|
#include "webview/webview_interface.h"
|
||||||
|
@ -679,6 +680,17 @@ void Panel::requestTermsAcceptance(
|
||||||
st::boxRowPadding.right(),
|
st::boxRowPadding.right(),
|
||||||
st::defaultBoxCheckbox.margin.bottom(),
|
st::defaultBoxCheckbox.margin.bottom(),
|
||||||
});
|
});
|
||||||
|
row->setAllowTextLines(5);
|
||||||
|
row->setClickHandlerFilter([=](
|
||||||
|
const ClickHandlerPtr &link,
|
||||||
|
Qt::MouseButton button) {
|
||||||
|
ActivateClickHandler(_widget.get(), link, ClickContext{
|
||||||
|
.button = button,
|
||||||
|
.other = _delegate->panelClickHandlerContext(),
|
||||||
|
});
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
|
||||||
(*update) = [=] { row->update(); };
|
(*update) = [=] { row->update(); };
|
||||||
|
|
||||||
struct State {
|
struct State {
|
||||||
|
@ -830,6 +842,10 @@ void Panel::showCriticalError(const TextWithEntities &text) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::shared_ptr<Show> Panel::uiShow() {
|
||||||
|
return _widget->uiShow();
|
||||||
|
}
|
||||||
|
|
||||||
void Panel::showWebviewError(
|
void Panel::showWebviewError(
|
||||||
const QString &text,
|
const QString &text,
|
||||||
const Webview::Available &information) {
|
const Webview::Available &information) {
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "base/object_ptr.h"
|
#include "base/object_ptr.h"
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
|
class Show;
|
||||||
class RpWidget;
|
class RpWidget;
|
||||||
class SeparatePanel;
|
class SeparatePanel;
|
||||||
class BoxContent;
|
class BoxContent;
|
||||||
|
@ -85,6 +86,7 @@ public:
|
||||||
void showBox(object_ptr<Ui::BoxContent> box);
|
void showBox(object_ptr<Ui::BoxContent> box);
|
||||||
void showToast(const TextWithEntities &text);
|
void showToast(const TextWithEntities &text);
|
||||||
void showCriticalError(const TextWithEntities &text);
|
void showCriticalError(const TextWithEntities &text);
|
||||||
|
[[nodiscard]] std::shared_ptr<Show> uiShow();
|
||||||
|
|
||||||
[[nodiscard]] rpl::lifetime &lifetime();
|
[[nodiscard]] rpl::lifetime &lifetime();
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,7 @@ public:
|
||||||
Ui::UncheckedCardDetails data,
|
Ui::UncheckedCardDetails data,
|
||||||
bool saveInformation) = 0;
|
bool saveInformation) = 0;
|
||||||
virtual void panelShowBox(object_ptr<BoxContent> box) = 0;
|
virtual void panelShowBox(object_ptr<BoxContent> box) = 0;
|
||||||
|
virtual QVariant panelClickHandlerContext() = 0;
|
||||||
|
|
||||||
virtual QString panelWebviewDataPath() = 0;
|
virtual QString panelWebviewDataPath() = 0;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 6f856ce495872bb202be03c056fdbcd13ec162f3
|
Subproject commit b305df8cc5c853b564ec0fe0b8b121c2a4e10b19
|
Loading…
Reference in New Issue