mirror of https://github.com/procxx/kepka.git
Refresh emoji after server responds.
This commit is contained in:
parent
b353af00c9
commit
932ed20c4b
|
@ -85,8 +85,8 @@ rpl::producer<QString> SuggestionsWidget::triggered() const {
|
||||||
return _triggered.events();
|
return _triggered.events();
|
||||||
}
|
}
|
||||||
|
|
||||||
void SuggestionsWidget::showWithQuery(const QString &query) {
|
void SuggestionsWidget::showWithQuery(const QString &query, bool force) {
|
||||||
if (_query == query) {
|
if (!force && (_query == query)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
_query = query;
|
_query = query;
|
||||||
|
@ -428,6 +428,10 @@ SuggestionsController::SuggestionsController(
|
||||||
) | rpl::start_with_next([=](QString replacement) {
|
) | rpl::start_with_next([=](QString replacement) {
|
||||||
replaceCurrent(replacement);
|
replaceCurrent(replacement);
|
||||||
}, _lifetime);
|
}, _lifetime);
|
||||||
|
Core::App().emojiKeywords().refreshed(
|
||||||
|
) | rpl::start_with_next([=] {
|
||||||
|
showFromTextChange(getEmojiQuery(), true);
|
||||||
|
}, _lifetime);
|
||||||
|
|
||||||
updateForceHidden();
|
updateForceHidden();
|
||||||
|
|
||||||
|
@ -477,10 +481,16 @@ void SuggestionsController::handleTextChange() {
|
||||||
|
|
||||||
const auto query = getEmojiQuery();
|
const auto query = getEmojiQuery();
|
||||||
if (query.isEmpty() || _textChangeAfterKeyPress) {
|
if (query.isEmpty() || _textChangeAfterKeyPress) {
|
||||||
_suggestions->showWithQuery(query);
|
showFromTextChange(query);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SuggestionsController::showFromTextChange(
|
||||||
|
const QString &query,
|
||||||
|
bool force) {
|
||||||
|
_suggestions->showWithQuery(query, force);
|
||||||
|
}
|
||||||
|
|
||||||
QString SuggestionsController::getEmojiQuery() {
|
QString SuggestionsController::getEmojiQuery() {
|
||||||
if (!Global::SuggestEmoji()) {
|
if (!Global::SuggestEmoji()) {
|
||||||
return QString();
|
return QString();
|
||||||
|
|
|
@ -21,7 +21,7 @@ class SuggestionsWidget : public TWidget {
|
||||||
public:
|
public:
|
||||||
SuggestionsWidget(QWidget *parent, const style::Menu &st);
|
SuggestionsWidget(QWidget *parent, const style::Menu &st);
|
||||||
|
|
||||||
void showWithQuery(const QString &query);
|
void showWithQuery(const QString &query, bool force = false);
|
||||||
void handleKeyEvent(int key);
|
void handleKeyEvent(int key);
|
||||||
|
|
||||||
rpl::producer<bool> toggleAnimated() const;
|
rpl::producer<bool> toggleAnimated() const;
|
||||||
|
@ -88,6 +88,7 @@ public:
|
||||||
private:
|
private:
|
||||||
void handleCursorPositionChange();
|
void handleCursorPositionChange();
|
||||||
void handleTextChange();
|
void handleTextChange();
|
||||||
|
void showFromTextChange(const QString &query, bool force = false);
|
||||||
QString getEmojiQuery();
|
QString getEmojiQuery();
|
||||||
void suggestionsUpdated(bool visible);
|
void suggestionsUpdated(bool visible);
|
||||||
void updateGeometry();
|
void updateGeometry();
|
||||||
|
|
Loading…
Reference in New Issue