Enable instant replaces in title edit fields.

This commit is contained in:
John Preston 2018-05-24 17:57:35 +03:00
parent f1816815a9
commit f35bf41d26
2 changed files with 10 additions and 1 deletions

View File

@ -32,7 +32,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
namespace {
constexpr auto kMaxGroupChannelTitle = 255;
constexpr auto kMaxGroupChannelTitle = 255; // See also edit_peer_info_box.
constexpr auto kMaxChannelDescription = 255; // See also edit_peer_info_box.
constexpr auto kMaxBioLength = 70;
constexpr auto kMinUsernameLength = 5;
@ -320,6 +320,8 @@ void GroupInfoBox::prepare() {
? lng_dlg_new_channel_name
: lng_dlg_new_group_name));
_title->setMaxLength(kMaxGroupChannelTitle);
_title->setInstantReplaces(Ui::InstantReplaces::Default());
_title ->setInstantReplacesEnabled(Global::ReplaceEmojiValue());
if (_creating == CreatingGroupChannel) {
_description.create(
@ -1164,6 +1166,8 @@ void EditChannelBox::prepare() {
setMouseTracking(true);
_title->setMaxLength(kMaxGroupChannelTitle);
_title->setInstantReplaces(Ui::InstantReplaces::Default());
_title->setInstantReplacesEnabled(Global::ReplaceEmojiValue());
_description->setMaxLength(kMaxChannelDescription);
_description->setInstantReplaces(Ui::InstantReplaces::Default());
_description->setInstantReplacesEnabled(Global::ReplaceEmojiValue());

View File

@ -38,6 +38,7 @@ namespace {
constexpr auto kUsernameCheckTimeout = TimeMs(200);
constexpr auto kMinUsernameLength = 5;
constexpr auto kMaxGroupChannelTitle = 255; // See also add_contact_box.
constexpr auto kMaxChannelDescription = 255; // See also add_contact_box.
class Controller
@ -299,6 +300,10 @@ object_ptr<Ui::RpWidget> Controller::createTitleEdit() {
: lng_dlg_new_channel_name),
_peer->name),
st::editPeerTitleMargins);
result->entity()->setMaxLength(kMaxGroupChannelTitle);
result->entity()->setInstantReplaces(Ui::InstantReplaces::Default());
result->entity()->setInstantReplacesEnabled(
Global::ReplaceEmojiValue());
QObject::connect(
result->entity(),