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