mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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 "dialogs/dialogs_main_list.h"
|
||||||
#include "ui/effects/outline_segments.h"
|
#include "ui/effects/outline_segments.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
|
#include "window/window_separate_id.h"
|
||||||
#include "window/window_session_controller.h" // showAddContact()
|
#include "window/window_session_controller.h" // showAddContact()
|
||||||
#include "base/unixtime.h"
|
#include "base/unixtime.h"
|
||||||
#include "styles/style_boxes.h"
|
#include "styles/style_boxes.h"
|
||||||
|
@ -64,6 +65,10 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
|
||||||
public:
|
public:
|
||||||
using ContactsBoxController::ContactsBoxController;
|
using ContactsBoxController::ContactsBoxController;
|
||||||
|
|
||||||
|
[[nodiscard]] rpl::producer<not_null<PeerData*>> wheelClicks() const {
|
||||||
|
return _wheelClicks.events();
|
||||||
|
}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::unique_ptr<PeerListRow> createRow(
|
std::unique_ptr<PeerListRow> createRow(
|
||||||
not_null<UserData*> user) override {
|
not_null<UserData*> user) override {
|
||||||
|
@ -72,6 +77,14 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
|
||||||
: nullptr;
|
: 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>(
|
auto controller = std::make_unique<Controller>(
|
||||||
&sessionController->session());
|
&sessionController->session());
|
||||||
|
@ -100,6 +113,10 @@ object_ptr<Ui::BoxContent> PrepareContactsBox(
|
||||||
online ? &st::contactsSortOnlineIconOver : nullptr);
|
online ? &st::contactsSortOnlineIconOver : nullptr);
|
||||||
});
|
});
|
||||||
raw->setSortMode(Mode::Online);
|
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));
|
return Box<PeerListBox>(std::move(controller), std::move(init));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue