adressing pr comments

This commit is contained in:
amerhifi 2019-05-24 14:36:42 -07:00
parent 6f04e039fe
commit 5a3585ea5b
3 changed files with 7 additions and 13 deletions

View file

@ -112,10 +112,8 @@ InteractiveWindow::InteractiveWindow(const QString& sourceUrl, const QVariantMap
Application::setupQmlSurface(quickView->rootContext() , true);
//add any whitelisted callbacks
auto offscreenUi = DependencyManager::get<OffscreenUi>();
offscreenUi->widgetContextForUrl(sourceUrl, quickView->rootContext());
OffscreenUi::applyWhiteList(sourceUrl, quickView->rootContext());
/**jsdoc
* Configures how a <code>NATIVE</code> window is displayed.

View file

@ -307,15 +307,10 @@ void OffscreenQmlSurface::onRootContextCreated(QQmlContext* qmlContext) {
#endif
}
void OffscreenQmlSurface::widgetContextForUrl(const QUrl& url, QQmlContext* context) {
// Get any whitelist functionality
void OffscreenQmlSurface::applyWhiteList(const QUrl& url, QQmlContext* context) {
QList<QmlContextCallback> callbacks = getQmlWhitelist()->getCallbacksForUrl(url);
// If we have whitelisted content, we must load a new context
if(!callbacks.empty()){
for(const auto& callback : callbacks){
callback(context);
}
for(const auto& callback : callbacks){
callback(context);
}
}

View file

@ -26,7 +26,8 @@ public:
static void addWhitelistContextHandler(const std::initializer_list<QUrl>& urls, const QmlContextCallback& callback);
static void addWhitelistContextHandler(const QUrl& url, const QmlContextCallback& callback) { addWhitelistContextHandler({ { url } }, callback); };
static void applyWhiteList(const QUrl& url,QQmlContext* context);
bool isFocusText() const { return _focusText; }
bool getCleaned() { return _isCleaned; }
@ -36,7 +37,7 @@ public:
Q_INVOKABLE void lowerKeyboard();
PointerEvent::EventType choosePointerEventType(QEvent::Type type);
Q_INVOKABLE unsigned int deviceIdByTouchPoint(qreal x, qreal y);
void widgetContextForUrl(const QUrl& url,QQmlContext* context);
signals:
void focusObjectChanged(QObject* newFocus);