Class which represents script actions. More...
#include <kockpitscriptaction.h>
Public Member Functions | |
| KockpitScriptAction (LDAPModule *lmod) | |
| Constructor. | |
| virtual | ~KockpitScriptAction () |
| Destructor. | |
| void | initEngine (const QString &dir) |
| Initialize Engine. | |
| void | evaluateEach (const QString &dir, const scriptmode &mode, KockpitValidator *validator, KockpitUnit *kunit) |
| Evaluate. | |
| QString * | readJsFile (const QString &filepath) |
| Read file. | |
| QStringList * | getJsFilesInDir (const QString &dirname, const QStringList &files) |
| Get files. | |
Private Member Functions | |
| void | evaluate (const QString &script, const QString &function, KockpitUser *kuser) |
| Run script. | |
| void | evaluate (const QString &script, const QString &function, KockpitGroup *kgrp) |
| Run script. | |
Private Attributes | |
| QScriptEngine | engine |
| script engine | |
Class which represents script actions.
This class represents all actions associated with the QtScript Engine.
| KockpitScriptAction::KockpitScriptAction | ( | LDAPModule * | lmod | ) |
Constructor.
| lmod | Pointer to LDAP Module - the primary datasource for kockpit. Over this pointer a LDAP connection can be used also in the scripts. |
| virtual KockpitScriptAction::~KockpitScriptAction | ( | ) | [inline, virtual] |
Destructor.
| void KockpitScriptAction::evaluate | ( | const QString & | script, | |
| const QString & | function, | |||
| KockpitGroup * | kgrp | |||
| ) | [private] |
Run script.
This function runs the scecified function of the given script to the given unit.
| script | Script to execute. | |
| function | Function to call. | |
| kgrp | Object which is handle over to the script. |
| void KockpitScriptAction::evaluate | ( | const QString & | script, | |
| const QString & | function, | |||
| KockpitUser * | kuser | |||
| ) | [private] |
Run script.
This function runs the scecified function of the given script to the given unit.
| script | Script to execute. | |
| function | Function to call. | |
| kuser | Object which is handle over to the script. |
| void KockpitScriptAction::evaluateEach | ( | const QString & | dir, | |
| const scriptmode & | mode, | |||
| KockpitValidator * | validator, | |||
| KockpitUnit * | kunit | |||
| ) |
Evaluate.
The object type will be checked. In dependency of the scriptmode a suitable javascript function will be called.
| dir | Directory which contains the java scripts. | |
| mode | Script mode which specifies the function to call. | |
| validator | Pointer to a validator which will be hand over to the QtScript engine. | |
| kunit | Pointer to KockpitUnit - points to object which has to be validated. |
| QStringList * KockpitScriptAction::getJsFilesInDir | ( | const QString & | dirname, | |
| const QStringList & | files | |||
| ) |
Get files.
This function determines script files in a directory and returns the filenames as List.
| dirname | Directory to scan. | |
| files | act as filters - it contains valid file suffixes. |
| void KockpitScriptAction::initEngine | ( | const QString & | dir | ) |
Initialize Engine.
The base scripts will be read in. Base scripts are scripts which are used by all other scripts.
| dir | This directory will be scanned for javascript files. |
| QString * KockpitScriptAction::readJsFile | ( | const QString & | filepath | ) |
Read file.
This function reads a javascript file and returns a pointer to a dynamically allocated QString object which contains the script.
| filepath | Path to js file. |
QScriptEngine KockpitScriptAction::engine [private] |
script engine
1.6.3