mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 22:57:11 +02:00
Added ability to open peers in window with middle button from contacts.
This commit is contained in:
parent
b7162b5fad
commit
aab7ba264c
1 changed files with 17 additions and 0 deletions
|
@ -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<Ui::BoxContent> PrepareContactsBox(
|
|||
public:
|
||||
using ContactsBoxController::ContactsBoxController;
|
||||
|
||||
[[nodiscard]] rpl::producer<not_null<PeerData*>> wheelClicks() const {
|
||||
return _wheelClicks.events();
|
||||
}
|
||||
|
||||
protected:
|
||||
std::unique_ptr<PeerListRow> createRow(
|
||||
not_null<UserData*> user) override {
|
||||
|
@ -72,6 +77,14 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
|
|||
: nullptr;
|
||||
}
|
||||
|
||||
void rowMiddleClicked(
|
||||
not_null<PeerListRow*> row) override {
|
||||
_wheelClicks.fire(row->peer());
|
||||
}
|
||||
|
||||
private:
|
||||
rpl::event_stream<not_null<PeerData*>> _wheelClicks;
|
||||
|
||||
};
|
||||
auto controller = std::make_unique<Controller>(
|
||||
&sessionController->session());
|
||||
|
@ -100,6 +113,10 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
|
|||
online ? &st::contactsSortOnlineIconOver : nullptr);
|
||||
});
|
||||
raw->setSortMode(Mode::Online);
|
||||
|
||||
raw->wheelClicks() | rpl::start_with_next([=](not_null<PeerData*> p) {
|
||||
sessionController->showInNewWindow(p);
|
||||
}, box->lifetime());
|
||||
};
|
||||
return Box<PeerListBox>(std::move(controller), std::move(init));
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue