2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 23:55:12 +00:00

Open jump-to-date by date click in topics.

This commit is contained in:
John Preston
2022-10-27 11:52:18 +04:00
parent 850746b0ba
commit 46ebbdb547
10 changed files with 42 additions and 14 deletions

View File

@@ -167,8 +167,9 @@ bool operator!=(const PeerThemeOverride &a, const PeerThemeOverride &b) {
}
DateClickHandler::DateClickHandler(Dialogs::Key chat, QDate date)
: _chat(chat)
, _date(date) {
: _chat(chat)
, _weak(chat.topic())
, _date(date) {
}
void DateClickHandler::setDate(QDate date) {
@@ -178,7 +179,11 @@ void DateClickHandler::setDate(QDate date) {
void DateClickHandler::onClick(ClickContext context) const {
const auto my = context.other.value<ClickHandlerContext>();
if (const auto window = my.sessionWindow.get()) {
window->showCalendar(_chat, _date);
if (!_chat.topic()) {
window->showCalendar(_chat, _date);
} else if (const auto strong = _weak.get()) {
window->showCalendar(strong, _date);
}
}
}