Disabled drag'n'drop area when user is recording voice message.

This commit is contained in:
23rd 2020-10-12 14:45:48 +03:00 committed by John Preston
parent ad4bf9b5c8
commit 57eb4f8234
5 changed files with 9 additions and 4 deletions

View file

@ -368,7 +368,7 @@ HistoryWidget::HistoryWidget(
_attachDragAreas = DragArea::SetupDragAreaToContainer( _attachDragAreas = DragArea::SetupDragAreaToContainer(
this, this,
crl::guard(this, [=](not_null<const QMimeData*> d) { crl::guard(this, [=](not_null<const QMimeData*> d) {
return _history && _canSendMessages; return _history && _canSendMessages && !isRecording();
}), }),
crl::guard(this, [=](bool f) { _field->setAcceptDrops(f); }), crl::guard(this, [=](bool f) { _field->setAcceptDrops(f); }),
crl::guard(this, [=] { updateControlsGeometry(); })); crl::guard(this, [=] { updateControlsGeometry(); }));

View file

@ -580,7 +580,7 @@ int ComposeControls::heightCurrent() const {
} }
bool ComposeControls::focus() { bool ComposeControls::focus() {
if (_voiceRecordBar->isRecording()) { if (isRecording()) {
return false; return false;
} }
_field->setFocus(); _field->setFocus();
@ -1345,4 +1345,8 @@ rpl::producer<bool> ComposeControls::lockShowStarts() const {
return _voiceRecordBar->lockShowStarts(); return _voiceRecordBar->lockShowStarts();
} }
bool ComposeControls::isRecording() const {
return _voiceRecordBar->isRecording();
}
} // namespace HistoryView } // namespace HistoryView

View file

@ -137,6 +137,7 @@ public:
[[nodiscard]] rpl::producer<bool> lockShowStarts() const; [[nodiscard]] rpl::producer<bool> lockShowStarts() const;
[[nodiscard]] bool isLockPresent() const; [[nodiscard]] bool isLockPresent() const;
[[nodiscard]] bool isRecording() const;
private: private:
enum class TextUpdateEvent { enum class TextUpdateEvent {

View file

@ -1761,7 +1761,7 @@ void RepliesWidget::clearSelected() {
void RepliesWidget::setupDragArea() { void RepliesWidget::setupDragArea() {
const auto areas = DragArea::SetupDragAreaToContainer( const auto areas = DragArea::SetupDragAreaToContainer(
this, this,
[=](not_null<const QMimeData*> d) { return _history; }, [=](auto d) { return _history && !_composeControls->isRecording(); },
nullptr, nullptr,
[=] { updateControlsGeometry(); }); [=] { updateControlsGeometry(); });

View file

@ -1188,7 +1188,7 @@ void ScheduledWidget::clearSelected() {
void ScheduledWidget::setupDragArea() { void ScheduledWidget::setupDragArea() {
const auto areas = DragArea::SetupDragAreaToContainer( const auto areas = DragArea::SetupDragAreaToContainer(
this, this,
[=](not_null<const QMimeData*> d) { return _history; }, [=](auto d) { return _history && !_composeControls->isRecording(); },
nullptr, nullptr,
[=] { updateControlsGeometry(); }); [=] { updateControlsGeometry(); });