throw an exception when someone tries to instantiate VideoWidgetwhen
Phonon is not compiled in thanks richmoore :) svn path=/trunk/KDE/kdebase/workspace/plasma/scriptengines/javascript/; revision=923937
This commit is contained in:
parent
a478c54582
commit
ec7e1e0c73
@ -636,6 +636,13 @@ void SimpleJavaScriptApplet::installWidgets(QScriptEngine *engine)
|
||||
|
||||
globalObject.setProperty(widget, fun);
|
||||
}
|
||||
#ifndef HAVE_PHONON
|
||||
QScriptValue fun = engine->newFunction(notSupported);
|
||||
fun.setProperty( QString("message"),
|
||||
i18n("Phonon support was not available"),
|
||||
QScriptValue::ReadOnly | QScriptValue::Undeletable | QScriptValue::SkipInEnumeration );
|
||||
globalObject.setProperty(QString("VideoWidget"), fun);
|
||||
#endif
|
||||
}
|
||||
|
||||
QScriptValue SimpleJavaScriptApplet::createWidget(QScriptContext *context, QScriptEngine *engine)
|
||||
@ -670,6 +677,13 @@ QScriptValue SimpleJavaScriptApplet::createWidget(QScriptContext *context, QScri
|
||||
return fun;
|
||||
}
|
||||
|
||||
QScriptValue SimpleJavaScriptApplet::notSupported(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
QString message = context->callee().property("message").toString();
|
||||
return context->throwError(i18n("This operation was not supported, %1").arg(message) );
|
||||
}
|
||||
|
||||
|
||||
QScriptValue SimpleJavaScriptApplet::print(QScriptContext *context, QScriptEngine *engine)
|
||||
{
|
||||
if (context->argumentCount() != 1) {
|
||||
|
@ -68,6 +68,7 @@ private:
|
||||
|
||||
void installWidgets( QScriptEngine *engine );
|
||||
static QScriptValue createWidget(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue notSupported(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue print(QScriptContext *context, QScriptEngine *engine);
|
||||
static QScriptValue createPrototype( QScriptEngine *engine, const QString &name );
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user