Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
Loading...
Searching...
No Matches
Sonde::QmlTemplates::LibraryGuard Class Reference

Checks every file the QML engine loads from a library against the trust store. More...

#include <qmltemplates_p.h>

Inheritance diagram for Sonde::QmlTemplates::LibraryGuard:

Public Member Functions

void begin (const Locations &where)
 Starts checking, for the libraries and store in where; clears the record.
void end ()
 Stops checking (for compiling a template before it is saved).
QList< TrustFile > untrusted () const
 The untrusted files recorded since begin().
bool check (const QString &path)
 Checks path now, as intercept() would, recording it if it isn't trusted.
bool isTrusted (const QString &path)
 Whether path is trusted, without recording it (looking for a file that may be passed over, such as a value visualiser).
QUrl intercept (const QUrl &path, DataType type) override
 See QQmlAbstractUrlInterceptor.

Private Member Functions

bool check (const QString &path, bool record)
 Checks path; records it if it isn't trusted and record.

Private Attributes

QMutex m_mutex
 Guards everything below.
bool m_active = false
 Whether files are checked.
Locations m_where
 The libraries and store being checked against.
QList< TrustFile > m_untrusted
 What was refused since begin().

Detailed Description

Checks every file the QML engine loads from a library against the trust store.

An untrusted file is redirected to a URL that can't load, and recorded, so the caller can say which files need trust instead of passing on the QML error. The engine may call intercept() from its loader thread.

Member Function Documentation

◆ check()

bool Sonde::QmlTemplates::LibraryGuard::check ( const QString & path)
inline

Checks path now, as intercept() would, recording it if it isn't trusted.

Returns
Whether it is trusted.

The documentation for this class was generated from the following files: