mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-08-31 14:38:15 +00:00
Delete messages box labels fix and confirm by Enter key.
Also context menu fixed in case of non-transparent windows. Also pausing GIFs when the window is not active.
This commit is contained in:
@@ -371,8 +371,6 @@ PinMessageBox::PinMessageBox(QWidget*, ChannelData *channel, MsgId msgId)
|
||||
}
|
||||
|
||||
void PinMessageBox::prepare() {
|
||||
_text->resizeToWidth(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right());
|
||||
|
||||
addButton(lang(lng_pinned_pin), [this] { pinMessage(); });
|
||||
addButton(lang(lng_cancel), [this] { closeBox(); });
|
||||
|
||||
@@ -385,6 +383,14 @@ void PinMessageBox::resizeEvent(QResizeEvent *e) {
|
||||
_notify->moveToLeft(st::boxPadding.left(), _text->y() + _text->height() + st::boxMediumSkip);
|
||||
}
|
||||
|
||||
void PinMessageBox::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
pinMessage();
|
||||
} else {
|
||||
BoxContent::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void PinMessageBox::pinMessage() {
|
||||
if (_requestId) return;
|
||||
|
||||
@@ -458,16 +464,17 @@ void DeleteMessagesBox::prepare() {
|
||||
canDeleteAllForEveryone = false;
|
||||
}
|
||||
}
|
||||
auto count = qMax(1, _ids.size());
|
||||
if (canDeleteAllForEveryone) {
|
||||
_forEveryone.create(this, forEveryoneText, false, st::defaultBoxCheckbox);
|
||||
} else if (peer && peer->isChannel()) {
|
||||
if (peer->isMegagroup()) {
|
||||
text += qsl("\n\n") + (_singleItem ? lang(lng_delete_for_everyone_this_hint) : lng_delete_for_everyone_hint(lt_count, _ids.size()));
|
||||
text += qsl("\n\n") + lng_delete_for_everyone_hint(lt_count, count);
|
||||
}
|
||||
} else if (peer->isChat()) {
|
||||
text += qsl("\n\n") + (_singleItem ? lang(lng_delete_for_me_chat_this_hint) : lng_delete_for_me_chat_hint(lt_count, _ids.size()));
|
||||
} else {
|
||||
text += qsl("\n\n") + (_singleItem ? lang(lng_delete_for_me_this_hint) : lng_delete_for_me_hint(lt_count, _ids.size()));
|
||||
text += qsl("\n\n") + lng_delete_for_me_chat_hint(lt_count, count);
|
||||
} else if (!peer->isSelf()) {
|
||||
text += qsl("\n\n") + lng_delete_for_me_hint(lt_count, count);
|
||||
}
|
||||
}
|
||||
_text.create(this, text, Ui::FlatLabel::InitType::Simple, st::boxLabel);
|
||||
@@ -475,7 +482,6 @@ void DeleteMessagesBox::prepare() {
|
||||
addButton(lang(lng_box_delete), [this] { deleteAndClear(); });
|
||||
addButton(lang(lng_cancel), [this] { closeBox(); });
|
||||
|
||||
_text->resizeToWidth(st::boxWidth - st::boxPadding.left() - st::boxButtonPadding.right());
|
||||
auto fullHeight = st::boxPadding.top() + _text->height() + st::boxPadding.bottom();
|
||||
if (_moderateFrom) {
|
||||
fullHeight += st::boxMediumSkip + _banUser->heightNoMargins() + st::boxLittleSkip + _reportSpam->heightNoMargins() + st::boxLittleSkip + _deleteAll->heightNoMargins();
|
||||
@@ -497,6 +503,14 @@ void DeleteMessagesBox::resizeEvent(QResizeEvent *e) {
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteMessagesBox::keyPressEvent(QKeyEvent *e) {
|
||||
if (e->key() == Qt::Key_Enter || e->key() == Qt::Key_Return) {
|
||||
deleteAndClear();
|
||||
} else {
|
||||
BoxContent::keyPressEvent(e);
|
||||
}
|
||||
}
|
||||
|
||||
void DeleteMessagesBox::deleteAndClear() {
|
||||
if (!App::main()) {
|
||||
return;
|
||||
|
Reference in New Issue
Block a user