Added ability to copy link from confirmation box on hidden url.

Fixed #17480.
This commit is contained in:
23rd 2022-07-07 14:50:06 +03:00 committed by John Preston
parent df66743c61
commit c14d9b18f7
1 changed files with 13 additions and 6 deletions

View File

@ -26,6 +26,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "data/data_session.h"
#include "window/window_controller.h"
#include "window/window_session_controller.h"
#include "styles/style_layers.h"
namespace {
@ -123,12 +124,18 @@ void HiddenUrlClickHandler::Open(QString url, QVariant context) {
const auto use = controller
? &controller->window()
: Core::App().activeWindow();
auto box = Ui::MakeConfirmBox({
.text = (tr::lng_open_this_link(tr::now)
+ qsl("\n\n")
+ displayUrl),
.confirmed = [=](Fn<void()> hide) { hide(); open(); },
.confirmText = tr::lng_open_link(),
auto box = Box([=](not_null<Ui::GenericBox*> box) {
Ui::ConfirmBox(box, {
.text = (tr::lng_open_this_link(tr::now)),
.confirmed = [=](Fn<void()> hide) { hide(); open(); },
.confirmText = tr::lng_open_link(),
});
const auto &st = st::boxLabel;
box->addSkip(st.style.lineHeight - st::boxPadding.bottom());
const auto url = box->addRow(
object_ptr<Ui::FlatLabel>(box, displayUrl, st));
url->setSelectable(true);
url->setContextCopyText(tr::lng_context_copy_link(tr::now));
});
if (my.show) {
my.show->showBox(std::move(box));