mirror of https://github.com/procxx/kepka.git
parent
6bd5301828
commit
e6c0f0f774
|
@ -1223,9 +1223,6 @@ void History::clearSendAction(not_null<UserData*> from) {
|
||||||
void History::mainViewRemoved(
|
void History::mainViewRemoved(
|
||||||
not_null<HistoryBlock*> block,
|
not_null<HistoryBlock*> block,
|
||||||
not_null<HistoryView::Element*> view) {
|
not_null<HistoryView::Element*> view) {
|
||||||
if (lastSentMsg == view->data()) {
|
|
||||||
lastSentMsg = nullptr;
|
|
||||||
}
|
|
||||||
if (_joinedMessage == view->data()) {
|
if (_joinedMessage == view->data()) {
|
||||||
_joinedMessage = nullptr;
|
_joinedMessage = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -2271,6 +2268,21 @@ MsgId History::msgIdForRead() const {
|
||||||
: result;
|
: result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
HistoryItem *History::lastSentMessage() const {
|
||||||
|
if (!loadedAtBottom()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
for (const auto &block : base::reversed(blocks)) {
|
||||||
|
for (const auto &message : base::reversed(block->messages)) {
|
||||||
|
const auto item = message->data();
|
||||||
|
if (IsServerMsgId(item->id) && item->out()) {
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
void History::resizeToWidth(int newWidth) {
|
void History::resizeToWidth(int newWidth) {
|
||||||
const auto resizeAllItems = (_width != newWidth);
|
const auto resizeAllItems = (_width != newWidth);
|
||||||
|
|
||||||
|
@ -2517,7 +2529,6 @@ void History::unloadBlocks() {
|
||||||
void History::clearBlocks(bool leaveItems) {
|
void History::clearBlocks(bool leaveItems) {
|
||||||
_unreadBarView = nullptr;
|
_unreadBarView = nullptr;
|
||||||
_firstUnreadView = nullptr;
|
_firstUnreadView = nullptr;
|
||||||
lastSentMsg = nullptr;
|
|
||||||
_joinedMessage = nullptr;
|
_joinedMessage = nullptr;
|
||||||
|
|
||||||
if (scrollTopItem) {
|
if (scrollTopItem) {
|
||||||
|
|
|
@ -242,6 +242,7 @@ public:
|
||||||
MsgId minMsgId() const;
|
MsgId minMsgId() const;
|
||||||
MsgId maxMsgId() const;
|
MsgId maxMsgId() const;
|
||||||
MsgId msgIdForRead() const;
|
MsgId msgIdForRead() const;
|
||||||
|
HistoryItem *lastSentMessage() const;
|
||||||
|
|
||||||
void resizeToWidth(int newWidth);
|
void resizeToWidth(int newWidth);
|
||||||
int height() const;
|
int height() const;
|
||||||
|
@ -351,7 +352,6 @@ public:
|
||||||
std::deque<std::unique_ptr<HistoryBlock>> blocks;
|
std::deque<std::unique_ptr<HistoryBlock>> blocks;
|
||||||
|
|
||||||
not_null<PeerData*> peer;
|
not_null<PeerData*> peer;
|
||||||
HistoryItem *lastSentMsg = nullptr;
|
|
||||||
|
|
||||||
typedef QList<HistoryItem*> NotifyQueue;
|
typedef QList<HistoryItem*> NotifyQueue;
|
||||||
NotifyQueue notifies;
|
NotifyQueue notifies;
|
||||||
|
|
|
@ -5153,13 +5153,16 @@ void HistoryWidget::keyPressEvent(QKeyEvent *e) {
|
||||||
}
|
}
|
||||||
} else if (e->key() == Qt::Key_Up) {
|
} else if (e->key() == Qt::Key_Up) {
|
||||||
if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) {
|
if (!(e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier))) {
|
||||||
if (_history
|
const auto item = _history
|
||||||
&& _history->lastSentMsg
|
? _history->lastSentMessage()
|
||||||
&& _history->lastSentMsg->allowsEdit(unixtime())) {
|
: nullptr;
|
||||||
if (_field->isEmpty() && !_editMsgId && !_replyToId && _history->lastSentMsg) {
|
if (item
|
||||||
editMessage(_history->lastSentMsg);
|
&& item->allowsEdit(unixtime())
|
||||||
return;
|
&& _field->isEmpty()
|
||||||
}
|
&& !_editMsgId
|
||||||
|
&& !_replyToId) {
|
||||||
|
editMessage(item);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
_scroll->keyPressEvent(e);
|
_scroll->keyPressEvent(e);
|
||||||
} else if ((e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier)) == Qt::ControlModifier) {
|
} else if ((e->modifiers() & (Qt::ShiftModifier | Qt::MetaModifier | Qt::ControlModifier)) == Qt::ControlModifier) {
|
||||||
|
|
|
@ -1345,8 +1345,6 @@ void MainWidget::sendMessage(const MessageToSend &message) {
|
||||||
history->sendRequestId);
|
history->sendRequestId);
|
||||||
}
|
}
|
||||||
|
|
||||||
history->lastSentMsg = lastMessage;
|
|
||||||
|
|
||||||
finishForwarding(history);
|
finishForwarding(history);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue