Commit dcd4cad6 authored by Andreas Traczyk's avatar Andreas Traczyk
Browse files

chatview: fix webengine binding for msg linkify/preview mechanism

This was broken in commit 3f88ceda, 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
parent 0000f053
......@@ -32,13 +32,13 @@ function getPreviewInfo(messageId, url) {
title = "Twitter. It's what's happening."
}
window.jsbridge.infoReady(messageId, {
'title': title,
'image': image,
'description': description,
'url': url,
'domain': domain,
})
window.jsbridge.emitInfoReady(messageId, {
'title': title,
'image': image,
'description': description,
'url': url,
'domain': domain,
})
}).catch(function (err) {
log("Error occured while fetching document: " + err)
})
......@@ -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;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment