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 // TODO this will be set to the engine we get from QML
m_engine = new QScriptEngine(this); m_engine = new QScriptEngine(this);
m_env = new ScriptEnv(this, m_engine); 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() 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) void SimpleJavaScriptApplet::reportError(ScriptEnv *env, bool fatal)
{ {
SimpleJavaScriptApplet *jsApplet = qobject_cast<SimpleJavaScriptApplet *>(env->parent()); SimpleJavaScriptApplet *jsApplet = qobject_cast<SimpleJavaScriptApplet *>(env->parent());
@ -137,7 +132,7 @@ void SimpleJavaScriptApplet::reportError(ScriptEnv *env, bool fatal)
if (fatal) { if (fatal) {
jsApplet->setFailedToLaunch(true, failureMsg); jsApplet->setFailedToLaunch(true, failureMsg);
} else { } else {
jsApplet->showMessage(KIcon("dialog-error"), failureMsg, Plasma::ButtonNone); jsApplet->showMessage(KIcon("dialog-error"), failureMsg, Plasma::ButtonOk);
} }
} else { } else {
kDebug() << failureMsg; kDebug() << failureMsg;

View File

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