mirror of
https://github.com/vale981/tdesktop
synced 2025-03-05 09:41:41 -05:00
No fast reply and double click reply if selecting.
Also fix messages selection glitch.
This commit is contained in:
parent
ab8e7897cc
commit
66ac4d6150
12 changed files with 45 additions and 4 deletions
|
@ -513,6 +513,10 @@ TimeMs InnerWidget::elementHighlightTime(
|
|||
return TimeMs(0);
|
||||
}
|
||||
|
||||
bool InnerWidget::elementInSelectionMode() {
|
||||
return false;
|
||||
}
|
||||
|
||||
void InnerWidget::saveState(not_null<SectionMemento*> memento) {
|
||||
memento->setFilter(std::move(_filter));
|
||||
memento->setAdmins(std::move(_admins));
|
||||
|
|
|
@ -87,6 +87,7 @@ public:
|
|||
not_null<const HistoryView::Element*> view) override;
|
||||
TimeMs elementHighlightTime(
|
||||
not_null<const HistoryView::Element*> element) override;
|
||||
bool elementInSelectionMode() override;
|
||||
|
||||
~InnerWidget();
|
||||
|
||||
|
|
|
@ -1378,7 +1378,8 @@ void HistoryInner::mouseDoubleClickEvent(QMouseEvent *e) {
|
|||
}
|
||||
if (!ClickHandler::getActive()
|
||||
&& !ClickHandler::getPressed()
|
||||
&& _mouseCursorState == CursorState::None) {
|
||||
&& _mouseCursorState == CursorState::None
|
||||
&& !inSelectionMode()) {
|
||||
if (const auto item = _mouseActionItem) {
|
||||
mouseActionCancel();
|
||||
_widget->replyToMessage(item);
|
||||
|
@ -2249,6 +2250,18 @@ bool HistoryInner::canDeleteSelected() const {
|
|||
return (selectedState.count > 0) && (selectedState.count == selectedState.canDeleteCount);
|
||||
}
|
||||
|
||||
bool HistoryInner::inSelectionMode() const {
|
||||
if (!_selected.empty()
|
||||
&& (_selected.begin()->second == FullSelection)) {
|
||||
return true;
|
||||
} else if (_mouseAction == MouseAction::Selecting
|
||||
&& _dragSelFrom
|
||||
&& _dragSelTo) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
auto HistoryInner::getSelectionState() const
|
||||
-> HistoryView::TopBarWidget::SelectedState {
|
||||
auto result = HistoryView::TopBarWidget::SelectedState {};
|
||||
|
@ -2534,13 +2547,13 @@ void HistoryInner::mouseActionUpdate() {
|
|||
if (selectingDown) {
|
||||
if (m.y() < dragSelTo->marginTop()) {
|
||||
dragSelTo = (dragSelFrom != dragSelTo)
|
||||
? prevItem(dragSelFrom)
|
||||
? prevItem(dragSelTo)
|
||||
: nullptr;
|
||||
}
|
||||
} else {
|
||||
if (m.y() >= dragSelTo->height() - dragSelTo->marginBottom()) {
|
||||
dragSelTo = (dragSelFrom != dragSelTo)
|
||||
? nextItem(dragSelFrom)
|
||||
? nextItem(dragSelTo)
|
||||
: nullptr;
|
||||
}
|
||||
}
|
||||
|
@ -3031,6 +3044,9 @@ not_null<HistoryView::ElementDelegate*> HistoryInner::ElementDelegate() {
|
|||
}
|
||||
return TimeMs(0);
|
||||
}
|
||||
bool elementInSelectionMode() override {
|
||||
return App::main()->historyInSelectionMode();
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -69,6 +69,7 @@ public:
|
|||
void clearSelected(bool onlyTextSelection = false);
|
||||
MessageIdsList getSelectedItems() const;
|
||||
void selectItem(not_null<HistoryItem*> item);
|
||||
bool inSelectionMode() const;
|
||||
|
||||
void updateBotInfo(bool recount = true);
|
||||
|
||||
|
|
|
@ -921,6 +921,10 @@ int HistoryWidget::itemTopForHighlight(
|
|||
return qMax(itemTop - (heightLeft / 2), 0);
|
||||
}
|
||||
|
||||
bool HistoryWidget::inSelectionMode() const {
|
||||
return _list ? _list->inSelectionMode() : false;
|
||||
}
|
||||
|
||||
void HistoryWidget::start() {
|
||||
Auth().data().stickersUpdated(
|
||||
) | rpl::start_with_next([this] {
|
||||
|
|
|
@ -247,6 +247,7 @@ public:
|
|||
|
||||
void enqueueMessageHighlight(not_null<HistoryView::Element*> view);
|
||||
TimeMs highlightStartTime(not_null<const HistoryItem*> item) const;
|
||||
bool inSelectionMode() const;
|
||||
|
||||
MessageIdsList getSelectedItems() const;
|
||||
void itemEdited(HistoryItem *item);
|
||||
|
|
|
@ -44,6 +44,7 @@ public:
|
|||
not_null<const Element*> element) = 0;
|
||||
virtual TimeMs elementHighlightTime(
|
||||
not_null<const Element*> element) = 0;
|
||||
virtual bool elementInSelectionMode() = 0;
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1119,6 +1119,10 @@ TimeMs ListWidget::elementHighlightTime(
|
|||
return TimeMs(0);
|
||||
}
|
||||
|
||||
bool ListWidget::elementInSelectionMode() {
|
||||
return hasSelectedItems() || !_dragSelected.empty();
|
||||
}
|
||||
|
||||
void ListWidget::saveState(not_null<ListMemento*> memento) {
|
||||
memento->setAroundPosition(_aroundPosition);
|
||||
auto state = countScrollState();
|
||||
|
|
|
@ -178,6 +178,7 @@ public:
|
|||
void elementAnimationAutoplayAsync(
|
||||
not_null<const Element*> view) override;
|
||||
TimeMs elementHighlightTime(not_null<const Element*> element) override;
|
||||
bool elementInSelectionMode() override;
|
||||
|
||||
~ListWidget();
|
||||
|
||||
|
|
|
@ -1334,7 +1334,9 @@ bool Message::hasFastReply() const {
|
|||
}
|
||||
|
||||
bool Message::displayFastReply() const {
|
||||
return hasFastReply() && data()->history()->peer->canWrite();
|
||||
return hasFastReply()
|
||||
&& data()->history()->peer->canWrite()
|
||||
&& !delegate()->elementInSelectionMode();
|
||||
}
|
||||
|
||||
bool Message::displayRightAction() const {
|
||||
|
|
|
@ -1390,6 +1390,10 @@ TimeMs MainWidget::highlightStartTime(not_null<const HistoryItem*> item) const {
|
|||
return _history->highlightStartTime(item);
|
||||
}
|
||||
|
||||
bool MainWidget::historyInSelectionMode() const {
|
||||
return _history->inSelectionMode();
|
||||
}
|
||||
|
||||
void MainWidget::sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo) {
|
||||
_history->sendBotCommand(peer, bot, cmd, replyTo);
|
||||
}
|
||||
|
|
|
@ -238,7 +238,9 @@ public:
|
|||
|
||||
void unreadCountChanged(not_null<History*> history);
|
||||
|
||||
// While HistoryInner is not HistoryView::ListWidget.
|
||||
TimeMs highlightStartTime(not_null<const HistoryItem*> item) const;
|
||||
bool historyInSelectionMode() const;
|
||||
|
||||
void sendBotCommand(PeerData *peer, UserData *bot, const QString &cmd, MsgId replyTo);
|
||||
void hideSingleUseKeyboard(PeerData *peer, MsgId replyTo);
|
||||
|
|
Loading…
Add table
Reference in a new issue