Fix inline keyboard. Disable it in the event log.

Also disable game preview click handler in the event log.
This commit is contained in:
John Preston 2017-06-24 13:32:30 +03:00
parent 816ee794e8
commit 85e234938d
5 changed files with 22 additions and 5 deletions

View File

@ -797,6 +797,10 @@ void HistoryItem::setId(MsgId newId) {
markup->inlineKeyboard->updateMessageId();
}
}
if (_media) {
_media->updateMessageId();
}
}
bool HistoryItem::canPin() const {

View File

@ -60,6 +60,8 @@ public:
return false;
}
virtual void initDimensions() = 0;
virtual void updateMessageId() {
}
virtual int resizeGetHeight(int width) {
_width = qMin(width, _maxw);
return _height;

View File

@ -3696,7 +3696,7 @@ HistoryGame::HistoryGame(gsl::not_null<HistoryItem*> parent, const HistoryGame &
void HistoryGame::initDimensions() {
auto lineHeight = unitedLineHeight();
if (!_openl) {
if (!_openl && _parent->id > 0) {
_openl = MakeShared<ReplyMarkupClickHandler>(_parent, 0, 0);
}
@ -3774,6 +3774,12 @@ void HistoryGame::initDimensions() {
}
}
void HistoryGame::updateMessageId() {
if (_openl) {
_openl = MakeShared<ReplyMarkupClickHandler>(_parent, 0, 0);
}
}
int HistoryGame::resizeGetHeight(int width) {
_width = width = qMin(width, _maxw);
width -= st::msgPadding.left() + st::webPageLeft + st::msgPadding.right();
@ -3934,7 +3940,9 @@ HistoryTextState HistoryGame::getState(QPoint point, HistoryStateRequest request
tshift += _descriptionLines * lineHeight;
}
if (inThumb) {
result.link = _openl;
if (!_parent->isLogEntry()) {
result.link = _openl;
}
} else if (_attach) {
auto attachAtTop = !_titleLines && !_descriptionLines;
if (!attachAtTop) tshift += st::mediaInBubbleSkip;
@ -3945,7 +3953,9 @@ HistoryTextState HistoryGame::getState(QPoint point, HistoryStateRequest request
if (QRect(attachLeft, tshift, _attach->currentWidth(), _height - tshift - bshift).contains(point)) {
if (_attach->isReadyForOpen()) {
result.link = _openl;
if (!_parent->isLogEntry()) {
result.link = _openl;
}
} else {
result = _attach->getState(point - QPoint(attachLeft, attachTop), request);
}

View File

@ -882,6 +882,7 @@ public:
void initDimensions() override;
int resizeGetHeight(int width) override;
void updateMessageId() override;
void draw(Painter &p, const QRect &r, TextSelection selection, TimeMs ms) const override;
HistoryTextState getState(QPoint point, HistoryStateRequest request) const override;

View File

@ -1792,10 +1792,10 @@ HistoryTextState HistoryMessage::getState(QPoint point, HistoryStateRequest requ
result.symbol += _text.length();
}
if (keyboard) {
if (keyboard && !isLogEntry()) {
auto keyboardTop = g.top() + g.height() + st::msgBotKbButton.margin;
if (QRect(g.left(), keyboardTop, g.width(), keyboardHeight).contains(point)) {
result.link = keyboard->getState(point - g.topLeft());
result.link = keyboard->getState(point - QPoint(g.left(), keyboardTop));
return result;
}
}