mirror of
https://github.com/Chatterino/chatterino2.git
synced 2024-11-13 19:49:51 +01:00
fixed right clicking links
This commit is contained in:
parent
05339aad2d
commit
f35ca0d2c8
|
@ -13,6 +13,7 @@
|
||||||
#include "widgets/split.hpp"
|
#include "widgets/split.hpp"
|
||||||
#include "widgets/tooltipwidget.hpp"
|
#include "widgets/tooltipwidget.hpp"
|
||||||
|
|
||||||
|
#include <QClipboard>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QDesktopServices>
|
#include <QDesktopServices>
|
||||||
#include <QGraphicsBlurEffect>
|
#include <QGraphicsBlurEffect>
|
||||||
|
@ -825,7 +826,24 @@ void ChannelView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case messages::Link::Url: {
|
case messages::Link::Url: {
|
||||||
|
if (event->button() == Qt::RightButton) {
|
||||||
|
static QMenu *menu = nullptr;
|
||||||
|
static QString url;
|
||||||
|
|
||||||
|
if (menu == nullptr) {
|
||||||
|
menu = new QMenu;
|
||||||
|
menu->addAction("Open in browser",
|
||||||
|
[] { QDesktopServices::openUrl(QUrl(url)); });
|
||||||
|
menu->addAction("Copy to clipboard",
|
||||||
|
[] { QApplication::clipboard()->setText(url); });
|
||||||
|
}
|
||||||
|
|
||||||
|
url = link.getValue();
|
||||||
|
menu->move(QCursor::pos());
|
||||||
|
menu->show();
|
||||||
|
} else {
|
||||||
QDesktopServices::openUrl(QUrl(link.getValue()));
|
QDesktopServices::openUrl(QUrl(link.getValue()));
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case messages::Link::UserAction: {
|
case messages::Link::UserAction: {
|
||||||
|
|
Loading…
Reference in a new issue