2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Pass modifiers inside InputField submitted signal.

Also use non-MOC connections for all InputFields.
Also use Ctrl/Cmd + Enter to submit fast share box.
Fixes #4769.
This commit is contained in:
John Preston
2018-05-31 15:20:28 +03:00
parent b3059248d4
commit bfc748cd31
36 changed files with 272 additions and 332 deletions

View File

@@ -1558,17 +1558,18 @@ void SendFilesBox::applyAlbumOrder() {
void SendFilesBox::setupCaption() {
_caption->setMaxLength(MaxPhotoCaption);
_caption->setSubmitSettings(Ui::InputField::SubmitSettings::Both);
connect(_caption, &Ui::InputField::resized, this, [this] {
connect(_caption, &Ui::InputField::resized, [=] {
captionResized();
});
connect(_caption, &Ui::InputField::submitted, this, [this](
bool ctrlShiftEnter) {
connect(_caption, &Ui::InputField::submitted, [=](
Qt::KeyboardModifiers modifiers) {
const auto ctrlShiftEnter = modifiers.testFlag(Qt::ShiftModifier)
&& (modifiers.testFlag(Qt::ControlModifier)
|| modifiers.testFlag(Qt::MetaModifier));
send(ctrlShiftEnter);
});
connect(_caption, &Ui::InputField::cancelled, this, [this] {
closeBox();
});
_caption->setMimeDataHook([this](
connect(_caption, &Ui::InputField::cancelled, [=] { closeBox(); });
_caption->setMimeDataHook([=](
not_null<const QMimeData*> data,
Ui::InputField::MimeAction action) {
if (action == Ui::InputField::MimeAction::Check) {