mirror of
https://github.com/savoirfairelinux/jami-client-qt.git
synced 2025-12-18 08:35:26 +08:00
chatview: fix webengine binding for msg linkify/preview mechanism
This was broken in commit 3f88ced, as the webchannel js object can
not be used to invoke Qt signal methods directly. Wrapping with
an emitter method is required.
Change-Id: I8633a5693105efd928fb68f227fdf75c161371fe
Gitlab: #735
This commit is contained in:
@@ -32,7 +32,7 @@ function getPreviewInfo(messageId, url) {
|
||||
title = "Twitter. It's what's happening."
|
||||
}
|
||||
|
||||
window.jsbridge.infoReady(messageId, {
|
||||
window.jsbridge.emitInfoReady(messageId, {
|
||||
'title': title,
|
||||
'image': image,
|
||||
'description': description,
|
||||
@@ -51,5 +51,5 @@ function parseMessage(messageId, message, showPreview) {
|
||||
}
|
||||
if (showPreview)
|
||||
getPreviewInfo(messageId, links[0].href)
|
||||
window.jsbridge.linkifyReady(messageId, linkifyStr(message))
|
||||
window.jsbridge.emitLinkified(messageId, linkifyStr(message))
|
||||
}
|
||||
|
||||
@@ -40,5 +40,13 @@ void
|
||||
PreviewEngine::log(const QString&)
|
||||
{}
|
||||
|
||||
void
|
||||
PreviewEngine::emitInfoReady(const QString&, const QVariantMap&)
|
||||
{}
|
||||
|
||||
void
|
||||
PreviewEngine::emitLinkified(const QString&, const QString&)
|
||||
{}
|
||||
|
||||
#include "moc_previewengine.cpp"
|
||||
#include "previewengine.moc"
|
||||
|
||||
@@ -96,5 +96,17 @@ PreviewEngine::log(const QString& str)
|
||||
qDebug() << str;
|
||||
}
|
||||
|
||||
void
|
||||
PreviewEngine::emitInfoReady(const QString& messageId, const QVariantMap& info)
|
||||
{
|
||||
Q_EMIT infoReady(messageId, info);
|
||||
}
|
||||
|
||||
void
|
||||
PreviewEngine::emitLinkified(const QString& messageId, const QString& linkifiedStr)
|
||||
{
|
||||
Q_EMIT linkified(messageId, linkifiedStr);
|
||||
}
|
||||
|
||||
#include "moc_previewengine.cpp"
|
||||
#include "previewengine.moc"
|
||||
|
||||
@@ -33,10 +33,12 @@ public:
|
||||
void parseMessage(const QString& messageId, const QString& msg, bool showPreview);
|
||||
|
||||
Q_INVOKABLE void log(const QString& str);
|
||||
Q_INVOKABLE void emitInfoReady(const QString& messageId, const QVariantMap& info);
|
||||
Q_INVOKABLE void emitLinkified(const QString& messageId, const QString& linkifiedStr);
|
||||
|
||||
Q_SIGNALS:
|
||||
Q_INVOKABLE void infoReady(const QString& messageId, const QVariantMap& info);
|
||||
Q_INVOKABLE void linkified(const QString& messageId, const QString& linkified);
|
||||
void infoReady(const QString& messageId, const QVariantMap& info);
|
||||
void linkified(const QString& messageId, const QString& linkifiedStr);
|
||||
|
||||
private:
|
||||
struct Impl;
|
||||
|
||||
Reference in New Issue
Block a user