diff --git a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp index 05b8d6d20..ff3e2722a 100644 --- a/Telegram/SourceFiles/boxes/peer_list_controllers.cpp +++ b/Telegram/SourceFiles/boxes/peer_list_controllers.cpp @@ -43,6 +43,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "dialogs/dialogs_main_list.h" #include "ui/effects/outline_segments.h" #include "ui/wrap/slide_wrap.h" +#include "window/window_separate_id.h" #include "window/window_session_controller.h" // showAddContact() #include "base/unixtime.h" #include "styles/style_boxes.h" @@ -64,6 +65,10 @@ object_ptr PrepareContactsBox( public: using ContactsBoxController::ContactsBoxController; + [[nodiscard]] rpl::producer> wheelClicks() const { + return _wheelClicks.events(); + } + protected: std::unique_ptr createRow( not_null user) override { @@ -72,6 +77,14 @@ object_ptr PrepareContactsBox( : nullptr; } + void rowMiddleClicked( + not_null row) override { + _wheelClicks.fire(row->peer()); + } + + private: + rpl::event_stream> _wheelClicks; + }; auto controller = std::make_unique( &sessionController->session()); @@ -100,6 +113,10 @@ object_ptr PrepareContactsBox( online ? &st::contactsSortOnlineIconOver : nullptr); }); raw->setSortMode(Mode::Online); + + raw->wheelClicks() | rpl::start_with_next([=](not_null p) { + sessionController->showInNewWindow(p); + }, box->lifetime()); }; return Box(std::move(controller), std::move(init)); }