mirror of https://github.com/procxx/kepka.git
Copy public channel link instead of following it.
This commit is contained in:
parent
0517f9f780
commit
027340a8e0
|
@ -29,6 +29,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org
|
||||||
#include "observer_peer.h"
|
#include "observer_peer.h"
|
||||||
#include "apiwrap.h"
|
#include "apiwrap.h"
|
||||||
#include "lang/lang_keys.h"
|
#include "lang/lang_keys.h"
|
||||||
|
#include "ui/toast/toast.h"
|
||||||
#include "messenger.h"
|
#include "messenger.h"
|
||||||
|
|
||||||
namespace Profile {
|
namespace Profile {
|
||||||
|
@ -215,8 +216,21 @@ void InfoWidget::refreshChannelLink() {
|
||||||
}
|
}
|
||||||
setSingleLineLabeledText(nullptr, lang(lng_profile_link), &_channelLink, channelLinkText, QString());
|
setSingleLineLabeledText(nullptr, lang(lng_profile_link), &_channelLink, channelLinkText, QString());
|
||||||
setSingleLineLabeledText(&_channelLinkLabel, lang(lng_profile_link), &_channelLinkShort, channelLinkTextShort, QString());
|
setSingleLineLabeledText(&_channelLinkLabel, lang(lng_profile_link), &_channelLinkShort, channelLinkTextShort, QString());
|
||||||
|
auto copyLinkHandlerHook = [this](const ClickHandlerPtr &handler, Qt::MouseButton button) {
|
||||||
|
if (auto channel = peer()->asChannel()) {
|
||||||
|
auto link = Messenger::Instance().createInternalLinkFull(channel->username);
|
||||||
|
QGuiApplication::clipboard()->setText(link);
|
||||||
|
Ui::Toast::Show(lang(lng_create_channel_link_copied));
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
if (_channelLink) {
|
||||||
|
_channelLink->setClickHandlerHook(copyLinkHandlerHook);
|
||||||
|
}
|
||||||
if (_channelLinkShort) {
|
if (_channelLinkShort) {
|
||||||
_channelLinkShort->setExpandLinksMode(ExpandLinksUrlOnly);
|
_channelLinkShort->setExpandLinksMode(ExpandLinksUrlOnly);
|
||||||
|
_channelLinkShort->setClickHandlerHook(copyLinkHandlerHook);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue