mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 06:26:18 +00:00
Copy t.me/+phonenumber link from Phone Number Privacy.
This commit is contained in:
@@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/widgets/checkbox.h"
|
||||
#include "ui/widgets/labels.h"
|
||||
#include "ui/widgets/buttons.h"
|
||||
#include "ui/text/text_utilities.h"
|
||||
#include "ui/wrap/slide_wrap.h"
|
||||
#include "ui/wrap/vertical_layout.h"
|
||||
#include "history/history.h"
|
||||
@@ -211,7 +212,7 @@ Ui::Radioenum<EditPrivacyBox::Option> *EditPrivacyBox::AddOption(
|
||||
|
||||
Ui::FlatLabel *EditPrivacyBox::addLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
rpl::producer<TextWithEntities> text,
|
||||
int topSkip) {
|
||||
if (!text) {
|
||||
return nullptr;
|
||||
@@ -228,15 +229,17 @@ Ui::FlatLabel *EditPrivacyBox::addLabel(
|
||||
)->entity();
|
||||
}
|
||||
|
||||
void EditPrivacyBox::addLabelOrDivider(
|
||||
Ui::FlatLabel *EditPrivacyBox::addLabelOrDivider(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
rpl::producer<TextWithEntities> text,
|
||||
int topSkip) {
|
||||
if (!addLabel(container, std::move(text), topSkip)) {
|
||||
container->add(
|
||||
object_ptr<Ui::BoxContentDivider>(container),
|
||||
{ 0, topSkip, 0, 0 });
|
||||
if (const auto result = addLabel(container, std::move(text), topSkip)) {
|
||||
return result;
|
||||
}
|
||||
container->add(
|
||||
object_ptr<Ui::BoxContentDivider>(container),
|
||||
{ 0, topSkip, 0, 0 });
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void EditPrivacyBox::setupContent() {
|
||||
@@ -320,10 +323,13 @@ void EditPrivacyBox::setupContent() {
|
||||
addOptionRow(Option::Everyone);
|
||||
addOptionRow(Option::Contacts);
|
||||
addOptionRow(Option::Nobody);
|
||||
addLabelOrDivider(
|
||||
const auto warning = addLabelOrDivider(
|
||||
content,
|
||||
_controller->warning(),
|
||||
st::settingsSectionSkip + st::settingsPrivacySkipTop);
|
||||
if (warning) {
|
||||
_controller->prepareWarningLabel(warning);
|
||||
}
|
||||
|
||||
auto middle = _controller->setupMiddleWidget(
|
||||
_window,
|
||||
@@ -342,7 +348,7 @@ void EditPrivacyBox::setupContent() {
|
||||
const auto never = addExceptionLink(Exception::Never);
|
||||
addLabel(
|
||||
content,
|
||||
_controller->exceptionsDescription(),
|
||||
_controller->exceptionsDescription() | Ui::Text::ToWithEntities(),
|
||||
st::settingsSectionSkip);
|
||||
|
||||
if (auto below = _controller->setupBelowWidget(_window, content)) {
|
||||
|
@@ -46,9 +46,11 @@ public:
|
||||
}
|
||||
[[nodiscard]] virtual rpl::producer<QString> optionsTitleKey() = 0;
|
||||
[[nodiscard]] virtual QString optionLabel(Option option);
|
||||
[[nodiscard]] virtual rpl::producer<QString> warning() {
|
||||
[[nodiscard]] virtual rpl::producer<TextWithEntities> warning() {
|
||||
return nullptr;
|
||||
}
|
||||
virtual void prepareWarningLabel(not_null<Ui::FlatLabel*> warning) {
|
||||
}
|
||||
[[nodiscard]] virtual rpl::producer<QString> exceptionButtonTextKey(
|
||||
Exception exception) = 0;
|
||||
[[nodiscard]] virtual rpl::producer<QString> exceptionBoxTitle(
|
||||
@@ -127,11 +129,11 @@ private:
|
||||
|
||||
Ui::FlatLabel *addLabel(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
rpl::producer<TextWithEntities> text,
|
||||
int topSkip);
|
||||
void addLabelOrDivider(
|
||||
Ui::FlatLabel *addLabelOrDivider(
|
||||
not_null<Ui::VerticalLayout*> container,
|
||||
rpl::producer<QString> text,
|
||||
rpl::producer<TextWithEntities> text,
|
||||
int topSkip);
|
||||
|
||||
void editExceptions(Exception exception, Fn<void()> done);
|
||||
|
Reference in New Issue
Block a user