From fd459910b901d70431638ec48600563bc2efbf44 Mon Sep 17 00:00:00 2001 From: Volker Krause Date: Thu, 22 Jun 2023 17:45:08 +0200 Subject: [PATCH] Remove the last references to kjs from the JS executor --- core/script/executor_js.cpp | 16 ++++++++-------- core/script/executor_js_p.h | 16 ++++++++-------- core/scripter.cpp | 10 +++++----- 3 files changed, 21 insertions(+), 21 deletions(-) diff --git a/core/script/executor_js.cpp b/core/script/executor_js.cpp index 1e9aaa4dd..c87be441d 100644 --- a/core/script/executor_js.cpp +++ b/core/script/executor_js.cpp @@ -31,15 +31,15 @@ using namespace Okular; -class Okular::ExecutorKJSPrivate +class Okular::ExecutorJSPrivate { public: - explicit ExecutorKJSPrivate(DocumentPrivate *doc) + explicit ExecutorJSPrivate(DocumentPrivate *doc) : m_doc(doc) { initTypes(); } - ~ExecutorKJSPrivate() + ~ExecutorJSPrivate() { m_watchdogTimer->deleteLater(); m_watchdogThread.quit(); @@ -55,7 +55,7 @@ public: QTimer *m_watchdogTimer = nullptr; }; -void ExecutorKJSPrivate::initTypes() +void ExecutorJSPrivate::initTypes() { m_watchdogThread.start(); m_watchdogTimer = new QTimer; @@ -73,19 +73,19 @@ void ExecutorKJSPrivate::initTypes() m_interpreter.globalObject().setProperty(QStringLiteral("util"), m_interpreter.newQObject(new JSUtil)); } -ExecutorKJS::ExecutorKJS(DocumentPrivate *doc) - : d(new ExecutorKJSPrivate(doc)) +ExecutorJS::ExecutorJS(DocumentPrivate *doc) + : d(new ExecutorJSPrivate(doc)) { } -ExecutorKJS::~ExecutorKJS() +ExecutorJS::~ExecutorJS() { JSField::clearCachedFields(); JSApp::clearCachedFields(); delete d; } -void ExecutorKJS::execute(const QString &script, Event *event) +void ExecutorJS::execute(const QString &script, Event *event) { const auto eventVal = event ? d->m_interpreter.newQObject(new JSEvent(event)) : QJSValue(QJSValue::UndefinedValue); d->m_interpreter.globalObject().setProperty(QStringLiteral("event"), eventVal); diff --git a/core/script/executor_js_p.h b/core/script/executor_js_p.h index d7ef564d9..e4776bceb 100644 --- a/core/script/executor_js_p.h +++ b/core/script/executor_js_p.h @@ -12,23 +12,23 @@ class QString; namespace Okular { class DocumentPrivate; -class ExecutorKJSPrivate; +class ExecutorJSPrivate; class Event; -class ExecutorKJS +class ExecutorJS { public: - explicit ExecutorKJS(DocumentPrivate *doc); - ~ExecutorKJS(); + explicit ExecutorJS(DocumentPrivate *doc); + ~ExecutorJS(); - ExecutorKJS(const ExecutorKJS &) = delete; - ExecutorKJS &operator=(const ExecutorKJS &) = delete; + ExecutorJS(const ExecutorJS &) = delete; + ExecutorJS &operator=(const ExecutorJS &) = delete; void execute(const QString &script, Event *event); private: - friend class ExecutorKJSPrivate; - ExecutorKJSPrivate *d; + friend class ExecutorJSPrivate; + ExecutorJSPrivate *d; }; } diff --git a/core/scripter.cpp b/core/scripter.cpp index 85086fdf7..419be3e9a 100644 --- a/core/scripter.cpp +++ b/core/scripter.cpp @@ -22,7 +22,7 @@ public: explicit ScripterPrivate(DocumentPrivate *doc) : m_doc(doc) #if HAVE_JS - , m_kjs(nullptr) + , m_js(nullptr) #endif , m_event(nullptr) { @@ -30,7 +30,7 @@ public: DocumentPrivate *m_doc; #if HAVE_JS - QScopedPointer m_kjs; + QScopedPointer m_js; #endif Event *m_event; }; @@ -62,10 +62,10 @@ void Scripter::execute(ScriptType type, const QString &script) switch (type) { case JavaScript: - if (!d->m_kjs) { - d->m_kjs.reset(new ExecutorKJS(d->m_doc)); + if (!d->m_js) { + d->m_js.reset(new ExecutorJS(d->m_doc)); } - d->m_kjs->execute(builtInScript + script, d->m_event); + d->m_js->execute(builtInScript + script, d->m_event); } #endif }