Fix forward messages by keyboard with opening chat on click option
This commit is contained in:
parent
76a69b4e75
commit
235938256e
1 changed files with 30 additions and 12 deletions
|
|
@ -68,6 +68,8 @@ public:
|
||||||
void activateSkipPage(int pageHeight, int direction);
|
void activateSkipPage(int pageHeight, int direction);
|
||||||
void updateFilter(QString filter = QString());
|
void updateFilter(QString filter = QString());
|
||||||
void selectActive();
|
void selectActive();
|
||||||
|
void tryGoToChat();
|
||||||
|
void selectionMade();
|
||||||
|
|
||||||
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
rpl::producer<Ui::ScrollToRequest> scrollToRequests() const;
|
||||||
rpl::producer<> searchRequests() const;
|
rpl::producer<> searchRequests() const;
|
||||||
|
|
@ -249,11 +251,16 @@ void ShareBox::prepare() {
|
||||||
});
|
});
|
||||||
_select->setResizedCallback([=] { updateScrollSkips(); });
|
_select->setResizedCallback([=] { updateScrollSkips(); });
|
||||||
_select->setSubmittedCallback([=](Qt::KeyboardModifiers modifiers) {
|
_select->setSubmittedCallback([=](Qt::KeyboardModifiers modifiers) {
|
||||||
if (modifiers.testFlag(Qt::ControlModifier)
|
if ((modifiers.testFlag(Qt::ControlModifier) && !cForwardChatOnClick())
|
||||||
|| modifiers.testFlag(Qt::MetaModifier)) {
|
|| modifiers.testFlag(Qt::MetaModifier)) {
|
||||||
submit({});
|
submit({});
|
||||||
} else {
|
} else {
|
||||||
_inner->selectActive();
|
_inner->selectActive();
|
||||||
|
if (!modifiers.testFlag(Qt::ControlModifier) || cForwardChatOnClick()) {
|
||||||
|
_inner->tryGoToChat();
|
||||||
|
} else {
|
||||||
|
_inner->selectionMade();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
_comment->heightValue(
|
_comment->heightValue(
|
||||||
|
|
@ -940,17 +947,10 @@ void ShareBox::Inner::mousePressEvent(QMouseEvent *e) {
|
||||||
if (e->button() == Qt::LeftButton) {
|
if (e->button() == Qt::LeftButton) {
|
||||||
updateUpon(e->pos());
|
updateUpon(e->pos());
|
||||||
changeCheckState(getChatAtIndex(_upon));
|
changeCheckState(getChatAtIndex(_upon));
|
||||||
if (!_hadSelection
|
if (!e->modifiers().testFlag(Qt::ControlModifier)) {
|
||||||
&& !(e->modifiers() & Qt::ControlModifier)
|
tryGoToChat();
|
||||||
&& _selected.size() == 1) {
|
} else {
|
||||||
if (_submitRequest && _selected.front()->isSelf()) {
|
selectionMade();
|
||||||
_submitRequest();
|
|
||||||
} else if (_goToChatRequest && cForwardChatOnClick()) {
|
|
||||||
_goToChatRequest();
|
|
||||||
}
|
|
||||||
_hadSelection = true;
|
|
||||||
} else if (!_hadSelection) {
|
|
||||||
_hadSelection = true;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -959,6 +959,24 @@ void ShareBox::Inner::selectActive() {
|
||||||
changeCheckState(getChatAtIndex(_active > 0 ? _active : 0));
|
changeCheckState(getChatAtIndex(_active > 0 ? _active : 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ShareBox::Inner::tryGoToChat() {
|
||||||
|
if (!_hadSelection
|
||||||
|
&& _selected.size() == 1) {
|
||||||
|
if (_submitRequest && _selected.front()->isSelf()) {
|
||||||
|
_submitRequest();
|
||||||
|
} else if (_goToChatRequest && cForwardChatOnClick()) {
|
||||||
|
_goToChatRequest();
|
||||||
|
}
|
||||||
|
_hadSelection = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ShareBox::Inner::selectionMade() {
|
||||||
|
if (!_hadSelection) {
|
||||||
|
_hadSelection = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void ShareBox::Inner::resizeEvent(QResizeEvent *e) {
|
void ShareBox::Inner::resizeEvent(QResizeEvent *e) {
|
||||||
_columnSkip = (width() - _columnCount * st::sharePhotoCheckbox.imageRadius * 2) / float64(_columnCount + 1);
|
_columnSkip = (width() - _columnCount * st::sharePhotoCheckbox.imageRadius * 2) / float64(_columnCount + 1);
|
||||||
_rowWidthReal = st::sharePhotoCheckbox.imageRadius * 2 + _columnSkip;
|
_rowWidthReal = st::sharePhotoCheckbox.imageRadius * 2 + _columnSkip;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue