mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add "Copy Topic Link" topic profile menu item.
This commit is contained in:
parent
afc9eb7cef
commit
76d44172f1
2 changed files with 27 additions and 1 deletions
|
@ -2241,6 +2241,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
"lng_context_copy_link" = "Copy Link";
|
"lng_context_copy_link" = "Copy Link";
|
||||||
"lng_context_copy_message_link" = "Copy Message Link";
|
"lng_context_copy_message_link" = "Copy Message Link";
|
||||||
"lng_context_copy_post_link" = "Copy Post Link";
|
"lng_context_copy_post_link" = "Copy Post Link";
|
||||||
|
"lng_context_copy_topic_link" = "Copy Topic Link";
|
||||||
"lng_context_copy_email" = "Copy Email Address";
|
"lng_context_copy_email" = "Copy Email Address";
|
||||||
"lng_context_copy_hashtag" = "Copy Hashtag";
|
"lng_context_copy_hashtag" = "Copy Hashtag";
|
||||||
"lng_context_copy_mention" = "Copy Username";
|
"lng_context_copy_mention" = "Copy Username";
|
||||||
|
|
|
@ -88,6 +88,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "styles/style_menu_icons.h"
|
#include "styles/style_menu_icons.h"
|
||||||
|
|
||||||
#include <QAction>
|
#include <QAction>
|
||||||
|
#include <QtGui/QGuiApplication>
|
||||||
|
|
||||||
namespace Window {
|
namespace Window {
|
||||||
namespace {
|
namespace {
|
||||||
|
@ -286,6 +287,7 @@ private:
|
||||||
void addDeleteChat();
|
void addDeleteChat();
|
||||||
void addLeaveChat();
|
void addLeaveChat();
|
||||||
void addJoinChat();
|
void addJoinChat();
|
||||||
|
void addTopicLink();
|
||||||
void addManageTopic();
|
void addManageTopic();
|
||||||
void addManageChat();
|
void addManageChat();
|
||||||
void addCreatePoll();
|
void addCreatePoll();
|
||||||
|
@ -925,6 +927,28 @@ void Filler::addDeleteTopic() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Filler::addTopicLink() {
|
||||||
|
if (!_topic || _topic->creating()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
const auto channel = _topic->channel();
|
||||||
|
const auto id = _topic->rootId();
|
||||||
|
const auto controller = _controller;
|
||||||
|
_addAction(tr::lng_context_copy_topic_link(tr::now), [=] {
|
||||||
|
const auto base = channel->hasUsername()
|
||||||
|
? channel->username()
|
||||||
|
: "c/" + QString::number(peerToChannel(channel->id).bare);
|
||||||
|
const auto query = base + '/' + QString::number(id.bare);
|
||||||
|
const auto link = channel->session().createInternalLinkFull(query);
|
||||||
|
QGuiApplication::clipboard()->setText(link);
|
||||||
|
Ui::Toast::Show(
|
||||||
|
Window::Show(controller).toastParent(),
|
||||||
|
(channel->hasUsername()
|
||||||
|
? tr::lng_channel_public_link_copied(tr::now)
|
||||||
|
: tr::lng_context_about_private_link(tr::now)));
|
||||||
|
}, &st::menuIconCopy);
|
||||||
|
}
|
||||||
|
|
||||||
void Filler::addManageTopic() {
|
void Filler::addManageTopic() {
|
||||||
if (!_topic || !_topic->canEdit()) {
|
if (!_topic || !_topic->canEdit()) {
|
||||||
return;
|
return;
|
||||||
|
@ -1187,8 +1211,9 @@ void Filler::fillProfileActions() {
|
||||||
addGiftPremium();
|
addGiftPremium();
|
||||||
addBotToGroup();
|
addBotToGroup();
|
||||||
addNewMembers();
|
addNewMembers();
|
||||||
addManageTopic();
|
|
||||||
addManageChat();
|
addManageChat();
|
||||||
|
addTopicLink();
|
||||||
|
addManageTopic();
|
||||||
addToggleTopicClosed();
|
addToggleTopicClosed();
|
||||||
addViewDiscussion();
|
addViewDiscussion();
|
||||||
addExportChat();
|
addExportChat();
|
||||||
|
|
Loading…
Add table
Reference in a new issue