KockpitScriptAction Class Reference

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

Detailed Description

Class which represents script actions.

This class represents all actions associated with the QtScript Engine.


Constructor & Destructor Documentation

KockpitScriptAction::KockpitScriptAction ( LDAPModule lmod  ) 

Constructor.

Parameters:
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.


Member Function Documentation

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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
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.

Parameters:
filepath Path to js file.
Returns:
QString* Pointer to QString contains file content.

Field Documentation

QScriptEngine KockpitScriptAction::engine [private]

script engine


The documentation for this class was generated from the following files:
Generated on Wed Mar 24 09:58:14 2010 for kockpit by  doxygen 1.6.3