more simplifications thanks to ScriptEnv

svn path=/trunk/KDE/kdebase/runtime/; revision=1171463
This commit is contained in:
Aaron J. Seigo 2010-09-03 21:59:55 +00:00
parent bf35cc9176
commit bb4f213215
2 changed files with 3 additions and 9 deletions

View File

@ -105,7 +105,7 @@ SimpleJavaScriptApplet::SimpleJavaScriptApplet(QObject *parent, const QVariantLi
// TODO this will be set to the engine we get from QML
m_engine = new QScriptEngine(this);
m_env = new ScriptEnv(this, m_engine);
connect(m_env, SIGNAL(reportError(ScriptEnv*,bool)), this, SLOT(engineReportsError(ScriptEnv*,bool)));
connect(m_env, SIGNAL(reportError(ScriptEnv*,bool)), this, SLOT(reportError(ScriptEnv*,bool)));
}
SimpleJavaScriptApplet::~SimpleJavaScriptApplet()
@ -115,11 +115,6 @@ SimpleJavaScriptApplet::~SimpleJavaScriptApplet()
}
}
void SimpleJavaScriptApplet::engineReportsError(ScriptEnv *engine, bool fatal)
{
reportError(engine, fatal);
}
void SimpleJavaScriptApplet::reportError(ScriptEnv *env, bool fatal)
{
SimpleJavaScriptApplet *jsApplet = qobject_cast<SimpleJavaScriptApplet *>(env->parent());
@ -137,7 +132,7 @@ void SimpleJavaScriptApplet::reportError(ScriptEnv *env, bool fatal)
if (fatal) {
jsApplet->setFailedToLaunch(true, failureMsg);
} else {
jsApplet->showMessage(KIcon("dialog-error"), failureMsg, Plasma::ButtonNone);
jsApplet->showMessage(KIcon("dialog-error"), failureMsg, Plasma::ButtonOk);
}
} else {
kDebug() << failureMsg;

View File

@ -47,7 +47,6 @@ public:
~SimpleJavaScriptApplet();
bool init();
static void reportError(ScriptEnv *error, bool fatal = false);
void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
QList<QAction*> contextualActions();
@ -68,7 +67,7 @@ public Q_SLOTS:
void activate();
private Q_SLOTS:
void engineReportsError(ScriptEnv *engine, bool fatal);
void reportError(ScriptEnv *error, bool fatal);
private:
bool importExtensions();