mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Support custom keyboard placeholders.
This commit is contained in:
@@ -201,6 +201,7 @@ bool BotKeyboard::updateMarkup(HistoryItem *to, bool force) {
|
||||
if (_wasForMsgId.msg) {
|
||||
_maximizeSize = _singleUse = _forceReply = false;
|
||||
_wasForMsgId = FullMsgId();
|
||||
_placeholder = QString();
|
||||
_impl = nullptr;
|
||||
return true;
|
||||
}
|
||||
@@ -218,6 +219,12 @@ bool BotKeyboard::updateMarkup(HistoryItem *to, bool force) {
|
||||
_maximizeSize = !(markupFlags & MTPDreplyKeyboardMarkup::Flag::f_resize);
|
||||
_singleUse = _forceReply || (markupFlags & MTPDreplyKeyboardMarkup::Flag::f_single_use);
|
||||
|
||||
if (const auto markup = to->Get<HistoryMessageReplyMarkup>()) {
|
||||
_placeholder = markup->placeholder;
|
||||
} else {
|
||||
_placeholder = QString();
|
||||
}
|
||||
|
||||
_impl = nullptr;
|
||||
if (auto markup = to->Get<HistoryMessageReplyMarkup>()) {
|
||||
if (!markup->rows.empty()) {
|
||||
|
@@ -31,8 +31,12 @@ public:
|
||||
// With force=true the markup is updated even if it is
|
||||
// already shown for the passed history item.
|
||||
bool updateMarkup(HistoryItem *last, bool force = false);
|
||||
bool hasMarkup() const;
|
||||
bool forceReply() const;
|
||||
[[nodiscard]] bool hasMarkup() const;
|
||||
[[nodiscard]] bool forceReply() const;
|
||||
|
||||
[[nodiscard]] QString placeholder() const {
|
||||
return _placeholder;
|
||||
}
|
||||
|
||||
void step_selected(crl::time ms, bool timer);
|
||||
void resizeToWidth(int newWidth, int maxOuterHeight) {
|
||||
@@ -40,10 +44,10 @@ public:
|
||||
return TWidget::resizeToWidth(newWidth);
|
||||
}
|
||||
|
||||
bool maximizeSize() const;
|
||||
bool singleUse() const;
|
||||
[[nodiscard]] bool maximizeSize() const;
|
||||
[[nodiscard]] bool singleUse() const;
|
||||
|
||||
FullMsgId forMsgId() const {
|
||||
[[nodiscard]] FullMsgId forMsgId() const {
|
||||
return _wasForMsgId;
|
||||
}
|
||||
|
||||
@@ -76,6 +80,7 @@ private:
|
||||
|
||||
const not_null<Main::Session*> _session;
|
||||
FullMsgId _wasForMsgId;
|
||||
QString _placeholder;
|
||||
int _height = 0;
|
||||
int _maxOuterHeight = 0;
|
||||
bool _maximizeSize = false;
|
||||
|
Reference in New Issue
Block a user