Fix/Workaround file where we can't enter values in some fields

The problem was that the JS checker for the field format was using the
willCommit property of event and we don't define it so the JS
interpreter was going "ok nope, out of here" and the field didn't get edited.

I've read the willCommit definition in js_api_reference.pdf for almost
30 minutes, and even it's just 3 lines i don't think i understand it,
but i think that returning true is "safer", i.e. says that this event is
going to actually change the field, which as far as i can see it's what
we always do

BUGS: 421508
remotes/origin/work/windows_style_scale
Albert Astals Cid 6 years ago
parent 35e43602d4
commit d78cbb79c9
  1. 8
      core/script/kjs_event.cpp

@ -121,6 +121,13 @@ static void eventSetReturnCode( KJSContext *ctx, void *object, KJSObject value )
event->setReturnCode ( value.toBoolean ( ctx ) );
}
// Event.willCommit (getter)
static KJSObject eventGetWillCommit( KJSContext *, void */*object*/ )
{
// TODO Someone try to understand the defintion of willCommit better from js_api_reference.pdf
return KJSBoolean( true );
}
void JSEvent::initType( KJSContext *ctx )
{
static bool initialized = false;
@ -138,6 +145,7 @@ void JSEvent::initType( KJSContext *ctx )
g_eventProto->defineProperty( ctx, QStringLiteral( "shift" ), eventGetShift );
g_eventProto->defineProperty( ctx, QStringLiteral( "source" ), eventGetSource );
g_eventProto->defineProperty( ctx, QStringLiteral( "target" ), eventGetTarget );
g_eventProto->defineProperty( ctx, QStringLiteral( "willCommit" ), eventGetWillCommit );
g_eventProto->defineProperty( ctx, QStringLiteral( "value" ), eventGetValue, eventSetValue );
g_eventProto->defineProperty( ctx, QStringLiteral( "rc" ), eventGetReturnCode, eventSetReturnCode );
}

Loading…
Cancel
Save