Changeset View
Changeset View
Standalone View
Standalone View
src/script/katescripthelpers.h
Context not available. | |||||
21 | #ifndef KATE_SCRIPTHELPERS_H | 21 | #ifndef KATE_SCRIPTHELPERS_H | ||
---|---|---|---|---|---|
22 | #define KATE_SCRIPTHELPERS_H | 22 | #define KATE_SCRIPTHELPERS_H | ||
23 | 23 | | |||
24 | #include <QScriptValue> | 24 | #include <QtCore/QObject> | ||
25 | #include <QtQml/QJSValue> | ||||
25 | #include <ktexteditor_export.h> | 26 | #include <ktexteditor_export.h> | ||
26 | 27 | | |||
27 | class QScriptEngine; | 28 | class QJSEngine; | ||
28 | class QScriptContext; | | |||
29 | 29 | | |||
30 | namespace Kate | 30 | namespace Kate | ||
31 | { | 31 | { | ||
Context not available. | |||||
36 | /** read complete file contents, helper */ | 36 | /** read complete file contents, helper */ | ||
37 | KTEXTEDITOR_EXPORT bool readFile(const QString &sourceUrl, QString &sourceCode); | 37 | KTEXTEDITOR_EXPORT bool readFile(const QString &sourceUrl, QString &sourceCode); | ||
38 | 38 | | |||
39 | KTEXTEDITOR_EXPORT QScriptValue read(QScriptContext *context, QScriptEngine *engine); | 39 | } // namespace Script | ||
40 | KTEXTEDITOR_EXPORT QScriptValue require(QScriptContext *context, QScriptEngine *engine); | 40 | | ||
41 | KTEXTEDITOR_EXPORT QScriptValue debug(QScriptContext *context, QScriptEngine *engine); | 41 | class KTEXTEDITOR_EXPORT ScriptHelper : public QObject { | ||
42 | KTEXTEDITOR_EXPORT QScriptValue i18n(QScriptContext *context, QScriptEngine *engine); | 42 | Q_OBJECT | ||
43 | KTEXTEDITOR_EXPORT QScriptValue i18nc(QScriptContext *context, QScriptEngine *engine); | 43 | QJSEngine *m_engine; | ||
44 | KTEXTEDITOR_EXPORT QScriptValue i18np(QScriptContext *context, QScriptEngine *engine); | 44 | public: | ||
45 | KTEXTEDITOR_EXPORT QScriptValue i18ncp(QScriptContext *context, QScriptEngine *engine); | 45 | ScriptHelper(QJSEngine *engine) : m_engine(engine) {} | ||
46 | } | 46 | Q_INVOKABLE QString read(const QString &file); | ||
47 | } | 47 | Q_INVOKABLE void require(const QString &file); | ||
48 | Q_INVOKABLE void debug(const QString &msg); | ||||
49 | Q_INVOKABLE QString _i18n(const QString &msg); | ||||
50 | Q_INVOKABLE QString _i18nc(const QString &textContext, const QString &text); | ||||
51 | Q_INVOKABLE QString _i18np(const QString &trSingular, const QString &trPlural, int number); | ||||
52 | Q_INVOKABLE QString _i18ncp(const QString &trContext, const QString &trSingular, | ||||
53 | const QString &trPlural, int number = 0); | ||||
54 | }; | ||||
55 | | ||||
56 | } // namespace Kate | ||||
48 | 57 | | |||
49 | #endif | 58 | #endif | ||
50 | 59 | | |||
Context not available. |