Esempio n. 1
0
int
executeScriptFunction(const QString& functionName, const QString& rcfile, const QString& containerName/*, QValueList<QVariant> *parameters=0*/)
{
	aEngine* engine = new aEngine();
	bool ok = false;
	aContainer container(containerName);
	if ( engine->db.init( rcfile ) ) 
	{
		engine->md = &(engine->db.cfg);
		engine->code = engine->project.interpreter();
		engine->code->setErrorMode(QSInterpreter::Nothing);
		//connect(engine->code, SIGNAL( error ( const QString &, QObject *, const QString &, int )),
		//	engine, SLOT  ( error ( const QString &, QObject *, const QString &, int )));
		engine->code->addObjectFactory( new QSInputDialogFactory );
		engine->code->addObjectFactory( new aObjectsFactory( engine ) );
		engine->code->addObjectFactory( new QSUtilFactory );
		engine->project.addObject( engine );
		engine->project.addObject( engine->md );
		engine->project.addObject( &container );
		if(container.open())
		{
			QString script = container.getFileContent(QString("scripts/%1.qsa").arg(functionName));
			engine->project.createScript("containerScript", script);
			if ( engine->project.interpreter()->functions(&container).findIndex(functionName)!=-1)
			{
				engine->project.interpreter()->call(functionName,QSArgumentList(/*parameters*/), &container);
			}
			container.close();
			return 0;
		}
	} 
	return 4;

}
Esempio n. 2
0
bool FLFormRecordDB::validateForm() {
    if ( iface && ( cursor_->modeAccess() == FLSqlCursor::INSERT || cursor_->modeAccess() == FLSqlCursor::EDIT ) ) {
        QVariant v = static_cast<FLApplication *>( qApp ) ->call( "validateForm", QSArgumentList(), iface ).variant();
        if ( v.isValid() && !v.toBool() )
            return false;
    }
    return true;
}
Esempio n. 3
0
void FLFormRecordDB::afterCommitTransaction() {
    if ( iface )
        static_cast<FLApplication *>( qApp ) ->call( "afterCommitTransaction", QSArgumentList(), iface );
}
Esempio n. 4
0
void FLFormRecordDB::canceledForm() {
    if ( iface )
        static_cast<FLApplication *>( qApp ) ->call( "canceledForm", QSArgumentList(), iface );
}
Esempio n. 5
0
void FLFormRecordDB::initScript() {
    if ( iface && cursor_ )
        static_cast<FLApplication *>( qApp ) ->call( "init", QSArgumentList(), iface );
}