Allow mentions in service notifications.

This commit is contained in:
John Preston 2020-03-26 12:10:35 +04:00
parent c3b807d483
commit bf5356fd91
1 changed files with 33 additions and 5 deletions

View File

@ -43,13 +43,32 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include <QtGui/QGuiApplication> #include <QtGui/QGuiApplication>
#include <QtGui/QClipboard> #include <QtGui/QClipboard>
TextParseOptions _confirmBoxTextOptions = { namespace {
TextParseLinks | TextParseMultiline | TextParseMarkdown | TextParseRichText, // flags
TextParseOptions kInformBoxTextOptions = {
(TextParseLinks
| TextParseMultiline
| TextParseMarkdown
| TextParseRichText), // flags
0, // maxw 0, // maxw
0, // maxh 0, // maxh
Qt::LayoutDirectionAuto, // dir Qt::LayoutDirectionAuto, // dir
}; };
TextParseOptions kMarkedTextBoxOptions = {
(TextParseLinks
| TextParseMultiline
| TextParseMarkdown
| TextParseRichText
| TextParseMentions
| TextParseHashtags), // flags
0, // maxw
0, // maxh
Qt::LayoutDirectionAuto, // dir
};
} // namespace
ConfirmBox::ConfirmBox( ConfirmBox::ConfirmBox(
QWidget*, QWidget*,
const QString &text, const QString &text,
@ -185,11 +204,11 @@ void ConfirmBox::init(const QString &text) {
_text.setText( _text.setText(
st::boxLabelStyle, st::boxLabelStyle,
text, text,
_informative ? _confirmBoxTextOptions : _textPlainOptions); _informative ? kInformBoxTextOptions : _textPlainOptions);
} }
void ConfirmBox::init(const TextWithEntities &text) { void ConfirmBox::init(const TextWithEntities &text) {
_text.setMarkedText(st::boxLabelStyle, text, _confirmBoxTextOptions); _text.setMarkedText(st::boxLabelStyle, text, kMarkedTextBoxOptions);
} }
void ConfirmBox::prepare() { void ConfirmBox::prepare() {
@ -326,7 +345,16 @@ InformBox::InformBox(QWidget*, const TextWithEntities &text, const QString &done
MaxInviteBox::MaxInviteBox(QWidget*, not_null<ChannelData*> channel) : BoxContent() MaxInviteBox::MaxInviteBox(QWidget*, not_null<ChannelData*> channel) : BoxContent()
, _channel(channel) , _channel(channel)
, _text(st::boxLabelStyle, tr::lng_participant_invite_sorry(tr::now, lt_count, Global::ChatSizeMax()), _confirmBoxTextOptions, st::boxWidth - st::boxPadding.left() - st::defaultBox.buttonPadding.right()) { , _text(
st::boxLabelStyle,
tr::lng_participant_invite_sorry(
tr::now,
lt_count,
Global::ChatSizeMax()),
kInformBoxTextOptions,
(st::boxWidth
- st::boxPadding.left()
- st::defaultBox.buttonPadding.right())) {
} }
void MaxInviteBox::prepare() { void MaxInviteBox::prepare() {