Skip to content
Snippets Groups Projects
Commit 06fbda77 authored by Sébastien Blin's avatar Sébastien Blin Committed by Adrien Béraud
Browse files

chatview: correctly handle clicked links in the webview

Change-Id: I16edca89fe0e66fb3845cc0420c251c70c12bdec
Gitlab: #11
parent 214d9add
No related branches found
No related tags found
No related merge requests found
......@@ -232,6 +232,13 @@ Rectangle {
}
}
onNavigationRequested: {
if(request.navigationType === WebEngineView.LinkClickedNavigation) {
MessagesAdapter.openUrl(request.url)
request.action = WebEngineView.IgnoreRequest
}
}
onLoadingChanged: {
if (loadRequest.status == WebEngineView.LoadSucceededStatus) {
messageWebView.runJavaScript(ClientWrapper.utilsAdaptor.getStyleSheet(
......
......@@ -332,6 +332,14 @@ MessagesAdapter::openFile(const QString &arg)
}
}
void
MessagesAdapter::openUrl(const QString &url)
{
if (!QDesktopServices::openUrl(url)) {
qDebug() << "Couldn't open url: " << url;
}
}
void
MessagesAdapter::acceptFile(const QString &arg)
{
......
......@@ -49,6 +49,7 @@ public:
Q_INVOKABLE void sendFile(const QString &message);
Q_INVOKABLE void retryInteraction(const QString &arg);
Q_INVOKABLE void deleteInteraction(const QString &arg);
Q_INVOKABLE void openUrl(const QString &url);
Q_INVOKABLE void openFile(const QString &arg);
Q_INVOKABLE void acceptFile(const QString &arg);
Q_INVOKABLE void refuseFile(const QString &arg);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment