[graphics/okular] /: Drop custom non-functioning console logger; just debug dump things
Sune Vuorela <[email protected]>
| Newsgroups | gmane.comp.kde.cvs |
|---|---|
| Message-ID | <[email protected]> |
Git commit 77f2f4728a41edabeab3bf05d42e20db012f7c14 by Sune Vuorela.
Committed on 17/08/2026 at 08:06.
Pushed by sune into branch 'master'.
Drop custom non-functioning console logger; just debug dump things
M +0 -1 CMakeLists.txt
M +1 -2 core/script/executor_js.cpp
D +0 -82 core/script/js_console.cpp
D +0 -27 core/script/js_console_p.h
https://invent.kde.org/graphics/okular/-/commit/77f2f4728a41edabeab3bf05d42e20db012f7c14
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f946d98e5..a832cbb5d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -467,7 +467,6 @@ if (TARGET Qt6::Qml)
target_sources(okularcore PRIVATE
core/script/executor_js.cpp
core/script/js_app.cpp
- core/script/js_console.cpp
core/script/js_data.cpp
core/script/js_display.cpp
core/script/js_document.cpp
diff --git a/core/script/executor_js.cpp b/core/script/executor_js.cpp
index f4787eb33..ac441d40b 100644
--- a/core/script/executor_js.cpp
+++ b/core/script/executor_js.cpp
@@ -13,7 +13,6 @@
#include "event_p.h"
#include "js_app_p.h"
-#include "js_console_p.h"
#include "js_data_p.h"
#include "js_display_p.h"
#include "js_document_p.h"
@@ -69,9 +68,9 @@ void ExecutorJSPrivate::initTypes()
m_watchdogTimer->setSingleShot(true);
m_watchdogTimer->moveToThread(&m_watchdogThread);
QObject::connect(m_watchdogTimer, &QTimer::timeout, &m_interpreter, [this]() { m_interpreter.setInterrupted(true); }, Qt::DirectConnection);
+ m_interpreter.installExtensions(QJSEngine::ConsoleExtension);
m_interpreter.globalObject().setProperty(QStringLiteral("app"), m_interpreter.newQObject(new JSApp(m_doc, m_watchdogTimer)));
- m_interpreter.globalObject().setProperty(QStringLiteral("console"), m_interpreter.newQObject(new JSConsole));
m_interpreter.globalObject().setProperty(QStringLiteral("Doc"), m_interpreter.newQObject(new JSDocument(m_doc)));
m_interpreter.globalObject().setProperty(QStringLiteral("display"), m_interpreter.newQObject(new JSDisplay));
m_interpreter.globalObject().setProperty(QStringLiteral("spell"), m_interpreter.newQObject(new JSSpell));
diff --git a/core/script/js_console.cpp b/core/script/js_console.cpp
deleted file mode 100644
index ebaf26b6d..000000000
--- a/core/script/js_console.cpp
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Pino Toscano <[email protected]>
- SPDX-FileCopyrightText: 2008 Harri Porten <[email protected]>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#include "js_console_p.h"
-
-#include <QDebug>
-
-#include "../debug_p.h"
-
-using namespace Okular;
-
-#ifdef OKULAR_JS_CONSOLE
-
-#include <QLayout>
-#include <QPlainTextEdit>
-
-#include <KDialog>
-#include <KStandardGuiItem>
-
-K_GLOBAL_STATIC(KDialog, g_jsConsoleWindow)
-static QPlainTextEdit *g_jsConsoleLog = 0;
-
-static void createConsoleWindow()
-{
- if (g_jsConsoleWindow.exists())
- return;
-
- g_jsConsoleWindow->setButtons(KDialog::Close | KDialog::User1);
- g_jsConsoleWindow->setButtonGuiItem(KDialog::User1, KStandardGuiItem::clear());
-
- QVBoxLayout *mainLay = new QVBoxLayout(g_jsConsoleWindow->mainWidget());
- mainLay->setContentsMargins(0, 0, 0, 0);
- g_jsConsoleLog = new QPlainTextEdit(g_jsConsoleWindow->mainWidget());
- g_jsConsoleLog->setReadOnly(true);
- mainLay->addWidget(g_jsConsoleLog);
-
- QObject::connect(g_jsConsoleWindow, SIGNAL(closeClicked()), g_jsConsoleWindow, SLOT(close()));
- QObject::connect(g_jsConsoleWindow, SIGNAL(user1Clicked()), g_jsConsoleLog, SLOT(clear()));
-}
-#endif
-
-void JSConsole::show()
-{
-#ifdef OKULAR_JS_CONSOLE
- createConsoleWindow();
- g_jsConsoleWindow->show();
-#endif
-}
-
-void JSConsole::hide()
-{
-#ifdef OKULAR_JS_CONSOLE
- if (!g_jsConsoleWindow.exists())
- return;
-
- g_jsConsoleWindow->hide();
-#endif
-}
-
-void JSConsole::clear()
-{
-#ifdef OKULAR_JS_CONSOLE
- if (!g_jsConsoleWindow.exists())
- return;
-
- g_jsConsoleLog->clear();
-#endif
-}
-
-void JSConsole::println(const QString &cMessage)
-{
-#ifdef OKULAR_JS_CONSOLE
- showConsole();
- g_jsConsoleLog->appendPlainText(cMessage);
-#else
- Q_UNUSED(cMessage);
-#endif
-}
diff --git a/core/script/js_console_p.h b/core/script/js_console_p.h
deleted file mode 100644
index 2daae9fe8..000000000
--- a/core/script/js_console_p.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- SPDX-FileCopyrightText: 2008 Pino Toscano <[email protected]>
- SPDX-FileCopyrightText: 2008 Harri Porten <[email protected]>
-
- SPDX-License-Identifier: GPL-2.0-or-later
-*/
-
-#ifndef OKULAR_SCRIPT_JS_CONSOLE_P_H
-#define OKULAR_SCRIPT_JS_CONSOLE_P_H
-
-#include <QObject>
-
-namespace Okular
-{
-class JSConsole : public QObject
-{
- Q_OBJECT
-public:
- Q_INVOKABLE void clear();
- Q_INVOKABLE void hide();
- Q_INVOKABLE void println(const QString &cMessage);
- Q_INVOKABLE void show();
-};
-
-}
-
-#endif