mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added ability to open profile info through menu from public forwards.
This commit is contained in:
parent
98c6a3ff79
commit
59099a8d46
2 changed files with 31 additions and 0 deletions
|
@ -730,6 +730,9 @@ void InnerWidget::fill() {
|
||||||
inner,
|
inner,
|
||||||
[=](RecentPostId id) {
|
[=](RecentPostId id) {
|
||||||
_showRequests.fire({
|
_showRequests.fire({
|
||||||
|
.info = (!id.messageId && !id.storyId)
|
||||||
|
? id.messageId.peer
|
||||||
|
: PeerId(0),
|
||||||
.history = id.messageId,
|
.history = id.messageId,
|
||||||
.story = id.storyId,
|
.story = id.storyId,
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,9 +23,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "ui/rect.h"
|
#include "ui/rect.h"
|
||||||
#include "ui/vertical_list.h"
|
#include "ui/vertical_list.h"
|
||||||
#include "ui/widgets/buttons.h"
|
#include "ui/widgets/buttons.h"
|
||||||
|
#include "ui/widgets/popup_menu.h"
|
||||||
#include "ui/wrap/slide_wrap.h"
|
#include "ui/wrap/slide_wrap.h"
|
||||||
#include "ui/wrap/vertical_layout.h"
|
#include "ui/wrap/vertical_layout.h"
|
||||||
#include "styles/style_dialogs.h" // dialogsStoriesFull.
|
#include "styles/style_dialogs.h" // dialogsStoriesFull.
|
||||||
|
#include "styles/style_menu_icons.h"
|
||||||
#include "styles/style_settings.h"
|
#include "styles/style_settings.h"
|
||||||
#include "styles/style_statistics.h"
|
#include "styles/style_statistics.h"
|
||||||
#include "styles/style_window.h"
|
#include "styles/style_window.h"
|
||||||
|
@ -274,6 +276,9 @@ public:
|
||||||
void prepare() override;
|
void prepare() override;
|
||||||
void rowClicked(not_null<PeerListRow*> row) override;
|
void rowClicked(not_null<PeerListRow*> row) override;
|
||||||
void loadMoreRows() override;
|
void loadMoreRows() override;
|
||||||
|
base::unique_qptr<Ui::PopupMenu> rowContextMenu(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<PeerListRow*> row) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void appendRow(not_null<PeerData*> peer, Data::RecentPostId contextId);
|
void appendRow(not_null<PeerData*> peer, Data::RecentPostId contextId);
|
||||||
|
@ -339,6 +344,29 @@ void PublicForwardsController::rowClicked(not_null<PeerListRow*> row) {
|
||||||
crl::on_main([=, id = rowWithId->contextId()] { _requestShow(id); });
|
crl::on_main([=, id = rowWithId->contextId()] { _requestShow(id); });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
base::unique_qptr<Ui::PopupMenu> PublicForwardsController::rowContextMenu(
|
||||||
|
QWidget *parent,
|
||||||
|
not_null<PeerListRow*> row) {
|
||||||
|
auto menu = base::make_unique_q<Ui::PopupMenu>(
|
||||||
|
parent,
|
||||||
|
st::popupMenuWithIcons);
|
||||||
|
const auto peer = row->peer();
|
||||||
|
const auto text = (peer->isChat() || peer->isMegagroup())
|
||||||
|
? tr::lng_context_view_group(tr::now)
|
||||||
|
: peer->isUser()
|
||||||
|
? tr::lng_context_view_profile(tr::now)
|
||||||
|
: peer->isChannel()
|
||||||
|
? tr::lng_context_view_channel(tr::now)
|
||||||
|
: QString();
|
||||||
|
if (text.isEmpty()) {
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
menu->addAction(text, crl::guard(parent, [=, peerId = peer->id] {
|
||||||
|
_requestShow({ .messageId = { peerId, MsgId() } });
|
||||||
|
}), peer->isUser() ? &st::menuIconProfile : &st::menuIconInfo);
|
||||||
|
return menu;
|
||||||
|
}
|
||||||
|
|
||||||
void PublicForwardsController::appendRow(
|
void PublicForwardsController::appendRow(
|
||||||
not_null<PeerData*> peer,
|
not_null<PeerData*> peer,
|
||||||
Data::RecentPostId contextId) {
|
Data::RecentPostId contextId) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue