• Skip to content
  • Skip to link menu
KDE 4.2 API Reference
  • KDE API Reference
  • API Reference
  • Sitemap
  • Contact Us
 

Plasma

simplejavascriptapplet.h

Go to the documentation of this file.
00001 /*
00002  *   Copyright 2007 Richard J. Moore <rich@kde.org>
00003  *
00004  *   This program is free software; you can redistribute it and/or modify
00005  *   it under the terms of the GNU Library General Public License version 2 as
00006  *   published by the Free Software Foundation
00007  *
00008  *   This program is distributed in the hope that it will be useful,
00009  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00010  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00011  *   GNU General Public License for more details
00012  *
00013  *   You should have received a copy of the GNU Library General Public
00014  *   License along with this program; if not, write to the
00015  *   Free Software Foundation, Inc.,
00016  *   51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00017  */
00018 
00019 #ifndef SCRIPT_H
00020 #define SCRIPT_H
00021 
00022 #include <QScriptValue>
00023 
00024 #include <Plasma/AppletScript>
00025 #include <Plasma/DataEngine>
00026 
00027 #include "uiloader.h"
00028 
00029 class QScriptEngine;
00030 class QScriptContext;
00031 
00032 class AppletInterface;
00033 
00034 class SimpleJavaScriptApplet : public Plasma::AppletScript
00035 {
00036     Q_OBJECT
00037 
00038 public:
00039     SimpleJavaScriptApplet( QObject *parent, const QVariantList &args );
00040     ~SimpleJavaScriptApplet();
00041     bool init();
00042 
00043     void reportError();
00044 
00045     void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
00046     QList<QAction*> contextualActions();
00047     void constraintsEvent(Plasma::Constraints constraints);
00048 
00049     Q_INVOKABLE QString findDataResource( const QString &filename );
00050     Q_INVOKABLE void debug( const QString &msg );
00051 
00052 public slots:
00053     void dataUpdated( const QString &name, const Plasma::DataEngine::Data &data );
00054     void showConfigurationInterface();
00055     void configAccepted();
00056     void executeAction(const QString &name);
00057 
00058 private:
00059     void importExtensions();
00060     void setupObjects();
00061     void callFunction(const QString &functionName, const QScriptValueList &args = QScriptValueList());
00062 
00063     static QString findSvg(QScriptEngine *engine, const QString &file);
00064     static QScriptValue dataEngine(QScriptContext *context, QScriptEngine *engine);
00065     static QScriptValue service(QScriptContext *context, QScriptEngine *engine);
00066     static QScriptValue loadui(QScriptContext *context, QScriptEngine *engine);
00067     static QScriptValue newPlasmaSvg(QScriptContext *context, QScriptEngine *engine);
00068     static QScriptValue newPlasmaFrameSvg(QScriptContext *context, QScriptEngine *engine);
00069 
00070     void installWidgets( QScriptEngine *engine );
00071     static QScriptValue createWidget(QScriptContext *context, QScriptEngine *engine);
00072     static QScriptValue print(QScriptContext *context, QScriptEngine *engine);
00073     static QScriptValue createPrototype( QScriptEngine *engine, const QString &name );
00074 
00075 private:
00076     static KSharedPtr<UiLoader> s_widgetLoader;
00077     QScriptEngine *m_engine;
00078     QScriptValue m_self;
00079     AppletInterface *m_interface;
00080     friend class AppletInterface;
00081 };
00082 
00083 
00084 #endif // SCRIPT_H
00085 

Plasma

Skip menu "Plasma"
  • Main Page
  • Namespace List
  • Class Hierarchy
  • Alphabetical List
  • Class List
  • File List
  • Namespace Members
  • Class Members

API Reference

Skip menu "API Reference"
  • KWin
  •   KWin Libraries
  • Libraries
  •   libkworkspace
  •   libsolidcontrol
  •   libtaskmanager
  • Plasma
  •   Animators
  •   Applets
  •   Engines
  • Solid Modules
Generated for API Reference by doxygen 1.5.7
This website is maintained by Adriaan de Groot and Allen Winter.
KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal