Added mention of user by right-clicking on his nickname. (#589)

* Added mention of user by right-clicking on his nickname.

* Removed possibility of choice. Always add @ to username.
This commit is contained in:
23rd 2018-07-10 19:27:42 +03:00 committed by fourtf
parent d82c647edd
commit c3793121cb
3 changed files with 16 additions and 1 deletions

View file

@ -963,7 +963,15 @@ void ChannelView::handleMouseClick(QMouseEvent *event, const MessageLayoutElemen
}
} break;
case Qt::RightButton: {
auto &link = hoveredElement->getLink();
if (link.type == Link::UserInfo) {
Split *split = dynamic_cast<Split *>(this->parentWidget());
if (split != nullptr) {
split->insertTextToInput("@" + link.value + ", ");
}
} else {
this->addContextMenuItems(hoveredElement, layout);
}
} break;
default:;
}

View file

@ -227,6 +227,11 @@ bool Split::getModerationMode() const
return this->moderationMode_;
}
void Split::insertTextToInput(const QString &text)
{
this->input_.insertText(text);
}
void Split::showChangeChannelPopup(const char *dialogTitle, bool empty,
std::function<void(bool)> callback)
{

View file

@ -60,6 +60,8 @@ public:
void setModerationMode(bool value);
bool getModerationMode() const;
void insertTextToInput(const QString &text);
void showChangeChannelPopup(const char *dialogTitle, bool empty,
std::function<void(bool)> callback);
void giveFocus(Qt::FocusReason reason);