diff --git a/Telegram/SourceFiles/dialogs/dialogs.style b/Telegram/SourceFiles/dialogs/dialogs.style index 7a1f2f1224..e3f4bbc579 100644 --- a/Telegram/SourceFiles/dialogs/dialogs.style +++ b/Telegram/SourceFiles/dialogs/dialogs.style @@ -179,6 +179,15 @@ dialogsCancelSearch: CrossButton { ripple: emptyRippleAnimation; } +dialogCalendar: IconButton(dialogsMenuToggle) { + icon: icon {{ "dialogs/dialogs_calendar", lightButtonFg }}; + iconOver: icon {{ "dialogs/dialogs_calendar", lightButtonFgOver }}; + iconPosition: point(8px, 9px); + + rippleAreaPosition: point(3px, 3px); + rippleAreaSize: 34px; +} + dialogsChatTypeSkip: 20px; dialogsChatIcon: icon {{ "dialogs/dialogs_chat", dialogsChatIconFg, point(1px, 4px) }}; dialogsChatIconOver: icon {{ "dialogs/dialogs_chat", dialogsChatIconFgOver, point(1px, 4px) }}; diff --git a/Telegram/SourceFiles/history/view/controls/history_view_compose_search.cpp b/Telegram/SourceFiles/history/view/controls/history_view_compose_search.cpp index 2dcedd422f..610c25fb1f 100644 --- a/Telegram/SourceFiles/history/view/controls/history_view_compose_search.cpp +++ b/Telegram/SourceFiles/history/view/controls/history_view_compose_search.cpp @@ -97,12 +97,15 @@ public: void setTotal(int total); [[nodiscard]] rpl::producer showItemRequests() const; + [[nodiscard]] rpl::producer<> showCalendarRequests() const; private: void updateText(int current); base::unique_qptr _previous; base::unique_qptr _next; + + base::unique_qptr _jumpToDate; base::unique_qptr _counter; int _total = -1; @@ -114,6 +117,7 @@ BottomBar::BottomBar(not_null parent) // Icons are swaped. , _previous(base::make_unique_q(this, st::calendarNext)) , _next(base::make_unique_q(this, st::calendarPrevious)) +, _jumpToDate(base::make_unique_q(this, st::dialogCalendar)) , _counter(base::make_unique_q( this, st::defaultSettingsRightLabel)) { @@ -135,7 +139,12 @@ BottomBar::BottomBar(not_null parent) (s.height() - _next->height()) / 2); const auto left = st::topBarActionSkip; - _counter->moveToLeft(left, (s.height() - _counter->height()) / 2); + _jumpToDate->moveToLeft( + left, + (s.height() - _jumpToDate->height()) / 2); + _counter->moveToLeft( + _jumpToDate->x() + _jumpToDate->width(), + (s.height() - _counter->height()) / 2); }, lifetime()); paintRequest( @@ -195,6 +204,10 @@ rpl::producer BottomBar::showItemRequests() const { return _current.changes() | rpl::map(rpl::mappers::_1 - 1); } +rpl::producer<> BottomBar::showCalendarRequests() const { + return _jumpToDate->clicks() | rpl::to_empty; +} + } // namespace class ComposeSearch::Inner final { @@ -285,6 +298,11 @@ ComposeSearch::Inner::Inner( }); } }, _bottomBar->lifetime()); + + _bottomBar->showCalendarRequests( + ) | rpl::start_with_next([=] { + _window->showCalendar({ _history }, QDate()); + }, _bottomBar->lifetime()); } void ComposeSearch::Inner::showAnimated() {