1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-18 22:45:25 +02:00

chatview: correctly handle clicked links in the webview

Change-Id: I16edca89fe0e66fb3845cc0420c251c70c12bdec
Gitlab: #11
This commit is contained in:
Sébastien Blin 2020-08-29 13:45:07 -04:00 committed by Adrien Béraud
parent 214d9add58
commit 06fbda77e0
3 changed files with 16 additions and 0 deletions

View file

@ -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(

View file

@ -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)
{

View file

@ -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);