mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-08 08:04:08 +02:00
Added ability to attach file with shortcut in sections.
This commit is contained in:
parent
062c451c27
commit
0b98cfbfec
2 changed files with 10 additions and 2 deletions
|
@ -768,8 +768,10 @@ rpl::producer<MessageToEdit> ComposeControls::editRequests() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
rpl::producer<> ComposeControls::attachRequests() const {
|
rpl::producer<> ComposeControls::attachRequests() const {
|
||||||
return _attachToggle->clicks(
|
return rpl::merge(
|
||||||
) | rpl::to_empty | rpl::filter([=] {
|
_attachToggle->clicks() | rpl::to_empty,
|
||||||
|
_attachRequests.events()
|
||||||
|
) | rpl::filter([=] {
|
||||||
if (isEditingMessage()) {
|
if (isEditingMessage()) {
|
||||||
Ui::show(Box<InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
Ui::show(Box<InformBox>(tr::lng_edit_caption_attach(tr::now)));
|
||||||
return false;
|
return false;
|
||||||
|
@ -1057,6 +1059,11 @@ void ComposeControls::initKeyHandler() {
|
||||||
}) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
}) | rpl::start_with_next([=](not_null<QEvent*> e) {
|
||||||
auto keyEvent = static_cast<QKeyEvent*>(e.get());
|
auto keyEvent = static_cast<QKeyEvent*>(e.get());
|
||||||
const auto key = keyEvent->key();
|
const auto key = keyEvent->key();
|
||||||
|
const auto isCtrl = keyEvent->modifiers() == Qt::ControlModifier;
|
||||||
|
if (key == Qt::Key_O && isCtrl) {
|
||||||
|
_attachRequests.fire({});
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (key == Qt::Key_Up) {
|
if (key == Qt::Key_Up) {
|
||||||
if (!isEditingMessage()) {
|
if (!isEditingMessage()) {
|
||||||
_editLastMessageRequests.fire(std::move(keyEvent));
|
_editLastMessageRequests.fire(std::move(keyEvent));
|
||||||
|
|
|
@ -296,6 +296,7 @@ private:
|
||||||
rpl::event_stream<QString> _sendCommandRequests;
|
rpl::event_stream<QString> _sendCommandRequests;
|
||||||
rpl::event_stream<not_null<QKeyEvent*>> _scrollKeyEvents;
|
rpl::event_stream<not_null<QKeyEvent*>> _scrollKeyEvents;
|
||||||
rpl::event_stream<not_null<QKeyEvent*>> _editLastMessageRequests;
|
rpl::event_stream<not_null<QKeyEvent*>> _editLastMessageRequests;
|
||||||
|
rpl::event_stream<> _attachRequests;
|
||||||
|
|
||||||
TextUpdateEvents _textUpdateEvents = TextUpdateEvents()
|
TextUpdateEvents _textUpdateEvents = TextUpdateEvents()
|
||||||
| TextUpdateEvent::SaveDraft
|
| TextUpdateEvent::SaveDraft
|
||||||
|
|
Loading…
Add table
Reference in a new issue