Commit 6e4e18b0 authored by Laurent Montel's avatar Laurent Montel 😁

Continue to implement script

parent b35912e5
......@@ -275,29 +275,7 @@ void MailWebEngineView::toggleFullAddressList(const QString &field, const boost:
}
qDebug() << "void MailWebEngineView::toggleFullAddressList(const QString &field, const boost::function<QString()> &delayedHtml, bool doShow)" << html << " fields " << field;
//page()->runJavaScript(MessageViewer::WebEngineScript::toggleFullAddressList(field, QStringLiteral("*#attachmentInjectionPoint")));
#if 0
if (mViewer->replaceInnerHtml(QLatin1String("iconFull") + field + QLatin1String("AddressList"),
bind(&ViewerPrivate::recipientsQuickListLinkHtml, this, doShow, field))) {
// Then show/hide the full address list
mViewer->setElementByIdVisible(QLatin1String("dotsFull") + field + QLatin1String("AddressList"), !doShow);
mViewer->setElementByIdVisible(QLatin1String("hiddenFull") + field + QLatin1String("AddressList"), doShow);
}
qDebug() << "bool MailWebEngineView::replaceInnerHtml(const QString &id, const boost::function<QString()> &delayedHtml)";
#if 0
QWebElement doc = page()->currentFrame()->documentElement();
QWebElement tag = doc.findFirst(QLatin1String("*#") + id);
if (tag.isNull()) {
return false;
}
tag.setInnerXml(delayedHtml());
return true;
#endif
//TODO
return false;
#endif
//TODO
page()->runJavaScript(MessageViewer::WebEngineScript::toggleFullAddressList(field, QStringLiteral("*#attachmentInjectionPoint"), doShow));
}
bool MailWebEngineView::hasVerticalScrollBar() const
......
......@@ -192,7 +192,30 @@ QString WebEngineScript::injectAttachments(const QString &delayedHtml, const QSt
{
const QString source = QString::fromLatin1("var element = document.getElementById('%1'); "
"if (element) { "
" element.innerHTML = '%2';"
" element.innerHTML += '%2';"
"}").arg(elementStr).arg(delayedHtml);
qDebug() << "QString WebEngineScript::injectAttachments(const QString &delayedHtml, const QString &elementStr) :"<<source;
return source;
}
QString WebEngineScript::toggleFullAddressList(const QString &field, const QString &html, bool doShow)
{
#if 0
if (mViewer->replaceInnerHtml(QLatin1String("iconFull") + field + QLatin1String("AddressList"),
bind(&ViewerPrivate::recipientsQuickListLinkHtml, this, doShow, field))) {
// Then show/hide the full address list
mViewer->setElementByIdVisible(QLatin1String("dotsFull") + field + QLatin1String("AddressList"), !doShow);
mViewer->setElementByIdVisible(QLatin1String("hiddenFull") + field + QLatin1String("AddressList"), doShow);
}
qDebug() << "bool MailWebEngineView::replaceInnerHtml(const QString &id, const boost::function<QString()> &delayedHtml)";
QWebElement doc = page()->currentFrame()->documentElement();
QWebElement tag = doc.findFirst(QLatin1String("*#") + id);
if (tag.isNull()) {
return false;
}
tag.setInnerXml(delayedHtml());
return true;
#endif
//TODO
return {};
}
......@@ -40,6 +40,7 @@ MESSAGEVIEWER_EXPORT QString scrollToRelativePosition(int pos);
MESSAGEVIEWER_EXPORT QString removeStyleToElement(const QString &element);
MESSAGEVIEWER_EXPORT QString replaceInnerHtml();
MESSAGEVIEWER_EXPORT QString injectAttachments(const QString &delayedHtml, const QString &element);
MESSAGEVIEWER_EXPORT QString toggleFullAddressList(const QString &field, const QString &html, bool doShow);
}
}
#endif // WEBENGINESCRIPT_H
Markdown is supported
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