mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-16 14:17:12 +02:00
On typing in messages selection focus input field.
This commit is contained in:
parent
a57e9990b0
commit
21543338d7
13 changed files with 38 additions and 0 deletions
|
@ -2915,6 +2915,9 @@ void HistoryInner::keyPressEvent(QKeyEvent *e) {
|
|||
&& selectedState.canDeleteCount == selectedState.count) {
|
||||
_widget->confirmDeleteSelected();
|
||||
}
|
||||
} else if (!(e->modifiers() & ~Qt::ShiftModifier)
|
||||
&& e->key() != Qt::Key_Shift) {
|
||||
_widget->tryProcessKeyInput(e);
|
||||
} else {
|
||||
e->ignore();
|
||||
}
|
||||
|
|
|
@ -1803,6 +1803,13 @@ bool HistoryWidget::notify_switchInlineBotButtonReceived(
|
|||
return false;
|
||||
}
|
||||
|
||||
void HistoryWidget::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||
if (_canSendTexts && _field->isVisible()) {
|
||||
_field->setFocusFast();
|
||||
QCoreApplication::sendEvent(_field->rawTextEdit(), e);
|
||||
}
|
||||
}
|
||||
|
||||
void HistoryWidget::setupShortcuts() {
|
||||
Shortcuts::Requests(
|
||||
) | rpl::filter([=] {
|
||||
|
|
|
@ -280,6 +280,8 @@ public:
|
|||
|
||||
bool notify_switchInlineBotButtonReceived(const QString &query, UserData *samePeerBot, MsgId samePeerReplyTo);
|
||||
|
||||
void tryProcessKeyInput(not_null<QKeyEvent*> e);
|
||||
|
||||
~HistoryWidget();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -2843,6 +2843,13 @@ bool ComposeControls::handleCancelRequest() {
|
|||
return false;
|
||||
}
|
||||
|
||||
void ComposeControls::tryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||
if (_field->isVisible()) {
|
||||
_field->setFocusFast();
|
||||
QCoreApplication::sendEvent(_field->rawTextEdit(), e);
|
||||
}
|
||||
}
|
||||
|
||||
void ComposeControls::initWebpageProcess() {
|
||||
if (!_history) {
|
||||
_preview = nullptr;
|
||||
|
|
|
@ -200,6 +200,7 @@ public:
|
|||
void cancelForward();
|
||||
|
||||
bool handleCancelRequest();
|
||||
void tryProcessKeyInput(not_null<QKeyEvent*> e);
|
||||
|
||||
[[nodiscard]] TextWithTags getTextWithAppliedMarkdown() const;
|
||||
[[nodiscard]] WebPageId webPageId() const;
|
||||
|
|
|
@ -2460,6 +2460,9 @@ void ListWidget::keyPressEvent(QKeyEvent *e) {
|
|||
#endif // Q_OS_MAC
|
||||
} else if (e == QKeySequence::Delete) {
|
||||
_delegate->listDeleteRequest();
|
||||
} else if (!(e->modifiers() & ~Qt::ShiftModifier)
|
||||
&& e->key() != Qt::Key_Shift) {
|
||||
_delegate->listTryProcessKeyInput(e);
|
||||
} else {
|
||||
e->ignore();
|
||||
}
|
||||
|
|
|
@ -93,6 +93,7 @@ public:
|
|||
virtual bool listScrollTo(int top, bool syntetic = true) = 0;
|
||||
virtual void listCancelRequest() = 0;
|
||||
virtual void listDeleteRequest() = 0;
|
||||
virtual void listTryProcessKeyInput(not_null<QKeyEvent*> e) = 0;
|
||||
virtual rpl::producer<Data::MessagesSlice> listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
|
|
|
@ -497,6 +497,9 @@ void PinnedWidget::listDeleteRequest() {
|
|||
confirmDeleteSelected();
|
||||
}
|
||||
|
||||
void PinnedWidget::listTryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||
}
|
||||
|
||||
rpl::producer<Data::MessagesSlice> PinnedWidget::listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
|
|
|
@ -82,6 +82,7 @@ public:
|
|||
bool listScrollTo(int top, bool syntetic = true) override;
|
||||
void listCancelRequest() override;
|
||||
void listDeleteRequest() override;
|
||||
void listTryProcessKeyInput(not_null<QKeyEvent*> e) override;
|
||||
rpl::producer<Data::MessagesSlice> listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
|
|
|
@ -2383,6 +2383,10 @@ void RepliesWidget::listDeleteRequest() {
|
|||
confirmDeleteSelected();
|
||||
}
|
||||
|
||||
void RepliesWidget::listTryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||
_composeControls->tryProcessKeyInput(e);
|
||||
}
|
||||
|
||||
rpl::producer<Data::MessagesSlice> RepliesWidget::listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
|
|
|
@ -126,6 +126,7 @@ public:
|
|||
bool listScrollTo(int top, bool syntetic = true) override;
|
||||
void listCancelRequest() override;
|
||||
void listDeleteRequest() override;
|
||||
void listTryProcessKeyInput(not_null<QKeyEvent*> e) override;
|
||||
rpl::producer<Data::MessagesSlice> listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
|
|
|
@ -1078,6 +1078,10 @@ void ScheduledWidget::listDeleteRequest() {
|
|||
confirmDeleteSelected();
|
||||
}
|
||||
|
||||
void ScheduledWidget::listTryProcessKeyInput(not_null<QKeyEvent*> e) {
|
||||
_composeControls->tryProcessKeyInput(e);
|
||||
}
|
||||
|
||||
rpl::producer<Data::MessagesSlice> ScheduledWidget::listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
|
|
|
@ -104,6 +104,7 @@ public:
|
|||
bool listScrollTo(int top, bool syntetic = true) override;
|
||||
void listCancelRequest() override;
|
||||
void listDeleteRequest() override;
|
||||
void listTryProcessKeyInput(not_null<QKeyEvent*> e) override;
|
||||
rpl::producer<Data::MessagesSlice> listSource(
|
||||
Data::MessagePosition aroundId,
|
||||
int limitBefore,
|
||||
|
|
Loading…
Add table
Reference in a new issue