2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Make date service messages clickable.

Open jump to date box when clicking on dates including floating date.
This commit is contained in:
John Preston
2017-03-07 20:45:08 +03:00
parent f663a2bf08
commit ed3b2cc017
5 changed files with 126 additions and 34 deletions

View File

@@ -2759,7 +2759,7 @@ void MainWidget::dlgUpdated(PeerData *peer, MsgId msgId) {
}
}
void MainWidget::showJumpToDate(PeerData *peer) {
void MainWidget::showJumpToDate(PeerData *peer, QDate requestedDate) {
t_assert(peer != nullptr);
auto currentPeerDate = [peer] {
if (auto history = App::historyLoaded(peer)) {
@@ -2798,7 +2798,8 @@ void MainWidget::showJumpToDate(PeerData *peer) {
}
return QDate(2013, 8, 1); // Telegram was launched in August 2013 :)
};
auto highlighted = currentPeerDate(), month = highlighted;
auto highlighted = requestedDate.isNull() ? currentPeerDate() : requestedDate;
auto month = highlighted;
auto box = Box<CalendarBox>(month, highlighted, [this, peer](const QDate &date) { jumpToDate(peer, date); });
box->setMinDate(minPeerDate());
box->setMaxDate(maxPeerDate());