mirror of
https://invent.kde.org/graphics/okular
synced 2024-10-03 22:54:31 +00:00
Fix creation of new JS objects
A default constructed QJSValue is undefined, not an object. BUG: 474256 FIXED-IN: 23.08.1
This commit is contained in:
parent
c31696be6a
commit
e41f682b3d
|
@ -106,7 +106,7 @@ QJSValue JSApp::plugIns() const
|
||||||
QJSValue plugins = qjsEngine(this)->newArray(s_num_fake_plugins);
|
QJSValue plugins = qjsEngine(this)->newArray(s_num_fake_plugins);
|
||||||
for (int i = 0; i < s_num_fake_plugins; ++i) {
|
for (int i = 0; i < s_num_fake_plugins; ++i) {
|
||||||
const FakePluginInfo &info = s_fake_plugins[i];
|
const FakePluginInfo &info = s_fake_plugins[i];
|
||||||
QJSValue plugin;
|
QJSValue plugin = qjsEngine(this)->newObject();
|
||||||
plugin.setProperty(QStringLiteral("certified"), info.certified);
|
plugin.setProperty(QStringLiteral("certified"), info.certified);
|
||||||
plugin.setProperty(QStringLiteral("loaded"), info.loaded);
|
plugin.setProperty(QStringLiteral("loaded"), info.loaded);
|
||||||
plugin.setProperty(QStringLiteral("name"), info.name);
|
plugin.setProperty(QStringLiteral("name"), info.name);
|
||||||
|
|
|
@ -113,7 +113,7 @@ int JSDocument::numFields() const
|
||||||
|
|
||||||
QJSValue JSDocument::info() const
|
QJSValue JSDocument::info() const
|
||||||
{
|
{
|
||||||
QJSValue obj;
|
QJSValue obj = qjsEngine(this)->newObject();
|
||||||
QSet<DocumentInfo::Key> keys;
|
QSet<DocumentInfo::Key> keys;
|
||||||
keys << DocumentInfo::Title << DocumentInfo::Author << DocumentInfo::Subject << DocumentInfo::Keywords << DocumentInfo::Creator << DocumentInfo::Producer;
|
keys << DocumentInfo::Title << DocumentInfo::Author << DocumentInfo::Subject << DocumentInfo::Keywords << DocumentInfo::Creator << DocumentInfo::Producer;
|
||||||
const DocumentInfo docinfo = m_doc->m_parent->documentInfo(keys);
|
const DocumentInfo docinfo = m_doc->m_parent->documentInfo(keys);
|
||||||
|
|
|
@ -250,7 +250,7 @@ void JSField::setDisplay(int display)
|
||||||
// Instead of getting the Icon, we pick the field.
|
// Instead of getting the Icon, we pick the field.
|
||||||
QJSValue JSField::buttonGetIcon([[maybe_unused]] int nFace) const
|
QJSValue JSField::buttonGetIcon([[maybe_unused]] int nFace) const
|
||||||
{
|
{
|
||||||
QJSValue fieldObject;
|
QJSValue fieldObject = qjsEngine(this)->newObject();
|
||||||
fieldObject.setProperty(OKULAR_NAME, m_field->fullyQualifiedName());
|
fieldObject.setProperty(OKULAR_NAME, m_field->fullyQualifiedName());
|
||||||
g_buttonCache->insert(m_field->fullyQualifiedName(), m_field);
|
g_buttonCache->insert(m_field->fullyQualifiedName(), m_field);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue