2021-05-24 07:25:56 +00:00
|
|
|
/*
|
|
|
|
SPDX-FileCopyrightText: 2008 Pino Toscano <pino@kde.org>
|
|
|
|
SPDX-FileCopyrightText: 2008 Harri Porten <porten@kde.org>
|
|
|
|
|
|
|
|
SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
*/
|
2008-05-18 19:33:46 +00:00
|
|
|
|
2023-06-22 15:40:50 +00:00
|
|
|
#ifndef OKULAR_SCRIPT_JS_APP_P_H
|
|
|
|
#define OKULAR_SCRIPT_JS_APP_P_H
|
2008-05-18 19:33:46 +00:00
|
|
|
|
2023-05-20 14:51:09 +00:00
|
|
|
#include <QJSValue>
|
|
|
|
#include <QObject>
|
2023-08-01 23:25:25 +00:00
|
|
|
#include <QPoint>
|
2023-05-20 14:51:09 +00:00
|
|
|
|
2024-01-14 00:18:47 +00:00
|
|
|
class QMenu;
|
2019-07-19 20:26:17 +00:00
|
|
|
class QTimer;
|
2019-05-23 13:28:53 +00:00
|
|
|
|
2008-05-18 19:33:46 +00:00
|
|
|
namespace Okular
|
|
|
|
{
|
|
|
|
class DocumentPrivate;
|
|
|
|
|
2023-05-20 14:51:09 +00:00
|
|
|
class JSApp : public QObject
|
2008-05-18 19:33:46 +00:00
|
|
|
{
|
2023-05-20 14:51:09 +00:00
|
|
|
Q_OBJECT
|
|
|
|
Q_PROPERTY(int formsVersion READ formsVersion CONSTANT)
|
|
|
|
Q_PROPERTY(QString language READ language CONSTANT)
|
|
|
|
Q_PROPERTY(int numPlugIns READ numPlugIns CONSTANT)
|
|
|
|
Q_PROPERTY(QString platform READ platform CONSTANT)
|
|
|
|
Q_PROPERTY(QJSValue plugIns READ plugIns CONSTANT)
|
|
|
|
Q_PROPERTY(QStringList printColorProfiles READ printColorProfiles CONSTANT)
|
|
|
|
Q_PROPERTY(QStringList printerNames READ printerNames CONSTANT)
|
|
|
|
Q_PROPERTY(QString viewerType READ viewerType CONSTANT)
|
|
|
|
Q_PROPERTY(QString viewerVariation READ viewerVariation CONSTANT)
|
|
|
|
Q_PROPERTY(int viewerVersion READ viewerVersion CONSTANT)
|
|
|
|
|
2008-05-18 19:33:46 +00:00
|
|
|
public:
|
2023-05-20 14:51:09 +00:00
|
|
|
explicit JSApp(DocumentPrivate *doc, QTimer *watchdogTimer, QObject *parent = nullptr);
|
|
|
|
~JSApp() override;
|
2019-05-23 13:28:53 +00:00
|
|
|
static void clearCachedFields();
|
2023-05-20 14:51:09 +00:00
|
|
|
|
|
|
|
int formsVersion() const;
|
|
|
|
QString language() const;
|
|
|
|
int numPlugIns() const;
|
|
|
|
QString platform() const;
|
|
|
|
QJSValue plugIns() const;
|
|
|
|
QStringList printColorProfiles() const;
|
|
|
|
QStringList printerNames() const;
|
|
|
|
QString viewerType() const;
|
|
|
|
QString viewerVariation() const;
|
|
|
|
int viewerVersion() const;
|
|
|
|
|
|
|
|
Q_INVOKABLE int alert(const QJSValue &arguments);
|
|
|
|
Q_INVOKABLE int alert(const QString &cMsg, int nIcon = 0, int nType = 0, const QString &cTitle = {}, const QJSValue &oDoc = {}, const QJSValue &oCheckbox = {});
|
|
|
|
Q_INVOKABLE void beep(int nType = 4);
|
|
|
|
Q_INVOKABLE QJSValue getNthPlugInName(int nIndex) const;
|
|
|
|
Q_INVOKABLE void goBack();
|
|
|
|
Q_INVOKABLE void goForward();
|
|
|
|
Q_INVOKABLE QJSValue setInterval(const QString &cExpr, int nMilliseconds);
|
|
|
|
Q_INVOKABLE void clearInterval(const QJSValue &oInterval);
|
|
|
|
Q_INVOKABLE QJSValue setTimeOut(const QString &cExpr, int nMilliseconds);
|
|
|
|
Q_INVOKABLE void clearTimeOut(const QJSValue &oTime);
|
2023-08-01 23:25:25 +00:00
|
|
|
Q_INVOKABLE QJSValue okular_popUpMenuEx(const QJSValue &arguments);
|
2023-05-20 14:51:09 +00:00
|
|
|
|
|
|
|
private:
|
|
|
|
QJSValue wrapTimer(QTimer *timer) const;
|
2024-01-14 00:18:47 +00:00
|
|
|
static bool createPopUpMenuTree(int depth, QMenu *rootMenu, const QJSValue &arguments);
|
2023-05-20 14:51:09 +00:00
|
|
|
|
|
|
|
DocumentPrivate *m_doc = nullptr;
|
|
|
|
QTimer *m_watchdogTimer = nullptr;
|
2008-05-18 19:33:46 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|