mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2025-12-18 16:44:52 +08:00
chatview: correctly handle clicked links in the webview
Change-Id: I16edca89fe0e66fb3845cc0420c251c70c12bdec Gitlab: #11
This commit is contained in:
committed by
Adrien Béraud
parent
214d9add58
commit
06fbda77e0
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user