add_subdirectory(declarativeimports)
add_subdirectory(desktoptheme)
add_subdirectory(runners)
-add_subdirectory(scriptengines)
+add_subdirectory(scriptengine)
add_subdirectory(shells)
add_subdirectory(wallpapers)
add_subdirectory(kpart)
--- /dev/null
+#DECLARATIVE APPLET
+set(declarative_appletscript_SRCS
+ common/extension_launchapp.cpp
+ common/extension_io.cpp
+ common/javascriptaddonpackagestructure.cpp
+ common/scriptenv.cpp
+ declarative/toolboxproxy.cpp
+ declarative/appletcontainer.cpp
+ declarative/declarativeitemcontainer.cpp
+ plasmoid/abstractjsappletscript.cpp
+ plasmoid/appletinterface.cpp
+ plasmoid/declarativeappletscript.cpp
+ plasmoid/themedsvg.cpp
+ simplebindings/bytearrayclass.cpp
+ simplebindings/bytearrayprototype.cpp
+ simplebindings/dataengine.cpp
+ simplebindings/dataenginereceiver.cpp
+ simplebindings/filedialogproxy.cpp
+ simplebindings/qscriptbookkeeping.cpp
+ simplebindings/url.cpp
+ simplebindings/point.cpp
+)
+
+include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common)
+
+kde4_add_plugin(plasma_appletscript_declarative ${declarative_appletscript_SRCS})
+target_link_libraries(plasma_appletscript_declarative
+ ${KDE4_PLASMA_LIBS}
+ ${KDE4_KIO_LIBS}
+ ${QT_QTSCRIPT_LIBRARY}
+ ${QT_QTDECLARATIVE_LIBRARY}
+ ${QT_QTUITOOLS_LIBRARY}
+
+)
+
+
+install(TARGETS plasma_appletscript_declarative DESTINATION ${PLUGIN_INSTALL_DIR})
+install(FILES data/plasma-scriptengine-applet-declarative.desktop DESTINATION ${SERVICES_INSTALL_DIR})
+
+
#include <Plasma/Package>
-#ifdef USEGUI
#include "simplebindings/filedialogproxy.h"
-#endif
-
#include "javascriptaddonpackagestructure.h"
Q_DECLARE_METATYPE(ScriptEnv*)
global.setProperty("__plasma_scriptenv", m_engine->newQObject(this),
QScriptValue::ReadOnly|QScriptValue::Undeletable|QScriptValue::SkipInEnumeration);
// Add utility functions
-#ifndef DECLARATIVE
- global.setProperty("print", m_engine->newFunction(ScriptEnv::print));
-#endif
global.setProperty("debug", m_engine->newFunction(ScriptEnv::debug));
}
{
kDebug() << extension;
if ("filedialog" == extension) {
-#ifdef USEGUI
FileDialogProxy::registerWithRuntime(m_engine);
return true;
-#endif
} else if ("launchapp" == extension) {
m_allowedUrls |= AppLaunching;
obj.setProperty("runApplication", m_engine->newFunction(ScriptEnv::runApplication));
return rv;
}
-QScriptValue ScriptEnv::print(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() != 1) {
- return throwNonFatalError(i18n("print() takes one argument"), context, engine);
- }
-
- std::cout << context->argument(0).toString().toLocal8Bit().constData() << std::endl;
- return engine->undefinedValue();
-}
-
QScriptValue ScriptEnv::listAddons(QScriptContext *context, QScriptEngine *engine)
{
if (context->argumentCount() < 1) {
return found;
}
-#ifndef USEGUI
#include "moc_scriptenv.cpp"
-#endif
bool importBuiltinExtension(const QString &extension, QScriptValue &obj);
static QScriptValue debug(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue print(QScriptContext *context, QScriptEngine *engine);
static QScriptValue runApplication(QScriptContext *context, QScriptEngine *engine);
static QScriptValue runCommand(QScriptContext *context, QScriptEngine *engine);
static QScriptValue defaultApplication(QScriptContext *context, QScriptEngine *engine);
return applet()->isUserConfiguring();
}
-int AppletInterface::apiVersion() const
-{
- const QString constraint("[X-Plasma-API] == 'javascript' and 'Applet' in [X-Plasma-ComponentTypes]");
- KService::List offers = KServiceTypeTrader::self()->query("Plasma/ScriptEngine", constraint);
- if (offers.isEmpty()) {
- return -1;
- }
-
- return offers.first()->property("X-KDE-PluginInfo-Version", QVariant::Int).toInt();
-}
-
bool AppletInterface::include(const QString &script)
{
const QString path = m_appletScriptEngine->filePath("scripts", script);
Q_PROPERTY(BackgroundHints backgroundHints WRITE setBackgroundHints READ backgroundHints)
Q_PROPERTY(bool immutable READ immutable NOTIFY immutableChanged)
Q_PROPERTY(bool userConfiguring READ userConfiguring) // @since 4.5
- Q_PROPERTY(int apiVersion READ apiVersion CONSTANT)
Q_PROPERTY(ItemStatus status READ status WRITE setStatus NOTIFY statusChanged)
Q_PROPERTY(QRectF rect READ rect)
Q_PROPERTY(QSizeF size READ size)
QList<QAction*> contextualActions() const;
bool immutable() const;
bool userConfiguring() const;
- int apiVersion() const;
static AppletInterface *extract(QScriptEngine *engine);
inline Plasma::Applet *applet() const { return m_appletScriptEngine->applet(); }
#include "common/scriptenv.h"
#include "declarative/declarativeitemcontainer_p.h"
#include "simplebindings/bytearrayclass.h"
-//not pretty but only way to avoid a double Q_DECLARE_METATYPE(QVariant) in dataengine.h
-#define DECLARATIVE_BINDING
#include "simplebindings/dataengine.h"
#include "simplebindings/dataenginereceiver.h"
--- /dev/null
+/****************************************************************************
+**
+** This file is part of the Qt Script Generator.
+**
+** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation info@qt.nokia.com
+**
+** GNU Lesser General Public License Usage
+** This file may be used under the terms of the GNU Lesser General Public
+** License version 2.1 as published by the Free Software Foundation
+** and appearing in the file LICENSE.LGPL included in the packaging of
+** this file. Please review the following information to ensure the GNU
+** Lesser General Public License version 2.1 requirements will be met:
+** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** Copyright (C) 2011 Nokia. All rights reserved
+****************************************************************************/
+#ifndef QTSCRIPTEXTENSIONS_GLOBAL_H
+#define QTSCRIPTEXTENSIONS_GLOBAL_H
+
+#include <QtGui/QPixmap>
+Q_DECLARE_METATYPE(QPixmap*)
+Q_DECLARE_METATYPE(QPixmap)
+
+#define DECLARE_SELF(Class, __fn__) \
+ Class* self = qscriptvalue_cast<Class*>(ctx->thisObject()); \
+ if (!self) { \
+ return ctx->throwError(QScriptContext::TypeError, \
+ QString::fromLatin1("%0.prototype.%1: this object is not a %0") \
+ .arg(#Class).arg(#__fn__)); \
+ }
+
+#endif // QTSCRIPTEXTENSIONS_GLOBAL_H
using namespace Plasma;
-#ifndef DECLARATIVE_BINDING
-Q_DECLARE_METATYPE(QVariant)
-#endif
Q_DECLARE_METATYPE(DataEngine::Dict)
Q_DECLARE_METATYPE(DataEngine::Data)
#include <QGraphicsWidget>
#include <QScriptEngine>
+#include <KConfigGroup>
+#include <KIO/Job>
+#include <KSharedConfig>
+
#include <Plasma/Applet>
#include <Plasma/Animation>
#include <Plasma/Extender>
-//Q_DECLARE_METATYPE(SimpleJavaScriptApplet*)
+#include "dataengine.h"
+
+Q_DECLARE_METATYPE(KConfigGroup)
+Q_DECLARE_METATYPE(KJob *)
+Q_DECLARE_METATYPE(KIO::Job *)
+
Q_DECLARE_METATYPE(QGraphicsWidget*)
Q_DECLARE_METATYPE(QGraphicsLayout*)
Q_DECLARE_METATYPE(Qt::MouseButton)
Q_DECLARE_METATYPE(QList<double>)
+typedef KJob* KJobPtr;
+QScriptValue qScriptValueFromKJob(QScriptEngine *engine, const KJobPtr &job)
+{
+ return engine->newQObject(const_cast<KJob *>(job), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+void qKJobFromQScriptValue(const QScriptValue &scriptValue, KJobPtr &job)
+{
+ QObject *obj = scriptValue.toQObject();
+ job = static_cast<KJob *>(obj);
+}
+
+typedef KIO::Job* KioJobPtr;
+QScriptValue qScriptValueFromKIOJob(QScriptEngine *engine, const KioJobPtr &job)
+{
+ return engine->newQObject(const_cast<KIO::Job *>(job), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject);
+}
+
+void qKIOJobFromQScriptValue(const QScriptValue &scriptValue, KioJobPtr &job)
+{
+ QObject *obj = scriptValue.toQObject();
+ job = static_cast<KIO::Job *>(obj);
+}
+
+QScriptValue qScriptValueFromKConfigGroup(QScriptEngine *engine, const KConfigGroup &config)
+{
+ QScriptValue obj = engine->newObject();
+
+ if (!config.isValid()) {
+ return obj;
+ }
+
+ QMap<QString, QString> entryMap = config.entryMap();
+ QMap<QString, QString>::const_iterator it = entryMap.constBegin();
+ QMap<QString, QString>::const_iterator begin = it;
+ QMap<QString, QString>::const_iterator end = entryMap.constEnd();
+
+ //setting the group name
+ obj.setProperty("__file", QScriptValue(engine, config.config()->name()));
+ obj.setProperty("__name", QScriptValue(engine, config.name()));
+
+ //setting the key/value pairs
+ for (it = begin; it != end; ++it) {
+ //kDebug() << "setting" << it.key() << "to" << it.value();
+ QString prop = it.key();
+ prop.replace(' ', '_');
+ obj.setProperty(prop, it.value());
+ }
+
+ return obj;
+}
+
+void kConfigGroupFromScriptValue(const QScriptValue& obj, KConfigGroup &config)
+{
+ config = KConfigGroup(KSharedConfig::openConfig(obj.property("__file").toString()), obj.property("__name").toString());
+
+ QScriptValueIterator it(obj);
+
+ while (it.hasNext()) {
+ it.next();
+ //kDebug() << it.name() << "is" << it.value().toString();
+ if (it.name() != "__name") {
+ config.writeEntry(it.name(), it.value().toString());
+ }
+ }
+}
+
typedef Plasma::Animation* AnimationPtr;
QScriptValue qScriptValueFromAnimation(QScriptEngine *engine, const AnimationPtr &anim)
{
button = static_cast<Qt::MouseButton>(scriptValue.toInt32());
}
-#include "simplebindings/qscriptnonguibookkeeping.cpp"
-
-using namespace Plasma;
-
void registerSimpleAppletMetaTypes(QScriptEngine *engine)
{
- registerNonGuiMetaTypes(engine);
+ qScriptRegisterMetaType<KConfigGroup>(engine, qScriptValueFromKConfigGroup, kConfigGroupFromScriptValue);
+ qScriptRegisterMetaType<KJob *>(engine, qScriptValueFromKJob, qKJobFromQScriptValue);
+ qScriptRegisterMetaType<KIO::Job *>(engine, qScriptValueFromKIOJob, qKIOJobFromQScriptValue);
+ registerDataEngineMetaTypes(engine);
+
qScriptRegisterMetaType<QGraphicsWidget*>(engine, qScriptValueFromQGraphicsWidget, graphicsWidgetFromQScriptValue);
qScriptRegisterMetaType<Plasma::Svg*>(engine, qScriptValueFromSvg, svgFromQScriptValue);
+++ /dev/null
-macro_optional_add_subdirectory(ruby)
-
-if(QT_QTWEBKIT_FOUND)
- macro_optional_add_subdirectory(webkit)
-endif()
-
-if (PYTHONLIBS_FOUND)
- macro_optional_add_subdirectory(python)
-endif()
-
-macro_optional_add_subdirectory(javascript)
\ No newline at end of file
+++ /dev/null
-# APPLET
-
-if(QT_QTWEBKIT_FOUND)
- add_definitions(-DHAVE_QTWEBKIT)
-endif()
-
-set(simple_javascript_engine_SRCS
- common/extension_launchapp.cpp
- common/extension_io.cpp
- common/guiscriptenv.cpp
- common/javascriptaddonpackagestructure.cpp
- declarative/toolboxproxy.cpp
- declarative/appletcontainer.cpp
- plasmoid/abstractjsappletscript.cpp
- plasmoid/jsappletinterface.cpp
- plasmoid/simplejavascriptapplet.cpp
- plasmoid/themedsvg.cpp
- simplebindings/animationgroup.cpp
- simplebindings/anchorlayout.cpp
- simplebindings/dataenginereceiver.cpp
- simplebindings/bytearrayclass.cpp
- simplebindings/bytearrayprototype.cpp
- simplebindings/color.cpp
- simplebindings/dataengine.cpp
- simplebindings/easingcurve.cpp
- simplebindings/font.cpp
- simplebindings/filedialogproxy.cpp
- simplebindings/graphicsitem.cpp
- simplebindings/icon.cpp
- simplebindings/i18n.cpp
- simplebindings/linearlayout.cpp
- simplebindings/gridlayout.cpp
- simplebindings/painter.cpp
- simplebindings/pen.cpp
- simplebindings/pixmap.cpp
- simplebindings/point.cpp
- simplebindings/rect.cpp
- simplebindings/qscriptbookkeeping.cpp
- simplebindings/size.cpp
- simplebindings/sizepolicy.cpp
- simplebindings/timer.cpp
- simplebindings/uiloader.cpp
- simplebindings/url.cpp
-)
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common)
-
-kde4_add_plugin(plasma_appletscript_simple_javascript ${simple_javascript_engine_SRCS})
-
-target_link_libraries(plasma_appletscript_simple_javascript
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KIO_LIBS}
- ${KDE4_PLASMA_LIBS}
- ${QT_QTDECLARATIVE_LIBRARY}
- ${QT_QTSCRIPT_LIBRARY}
- ${QT_QTUITOOLS_LIBRARY}
- ${QT_QTXML_LIBRARY}
- )
-
-install(TARGETS plasma_appletscript_simple_javascript DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES data/plasma-scriptengine-applet-simple-javascript.desktop DESTINATION ${SERVICES_INSTALL_DIR} )
-
-# RUNNER
-
-set(javascript_runner_engine_SRCS
- common/extension_launchapp.cpp
- common/extension_io.cpp
- common/javascriptaddonpackagestructure.cpp
- common/scriptenv.cpp
- runner/javascriptrunner.cpp
- simplebindings/i18n.cpp
-)
-
-kde4_add_plugin(plasma_runnerscript_javascript ${javascript_runner_engine_SRCS})
-
-target_link_libraries(plasma_runnerscript_javascript
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KIO_LIBS}
- ${KDE4_PLASMA_LIBS}
- ${QT_QTSCRIPT_LIBRARY})
-
-install(TARGETS plasma_runnerscript_javascript DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES data/plasma-scriptengine-runner-javascript.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-
-
-# DATAENGINE
-
-set(javascript_dataengine_engine_SRCS
- common/extension_launchapp.cpp
- common/extension_io.cpp
- common/javascriptaddonpackagestructure.cpp
- common/scriptenv.cpp
- dataengine/javascriptdataengine.cpp
- dataengine/javascriptservice.cpp
- simplebindings/dataengine.cpp
- simplebindings/i18n.cpp
- simplebindings/qscriptnonguibookkeeping.cpp
-)
-kde4_add_plugin(plasma_dataenginescript_javascript ${javascript_dataengine_engine_SRCS})
-
-target_link_libraries(plasma_dataenginescript_javascript
- ${KDE4_KDECORE_LIBS}
- ${KDE4_KIO_LIBS}
- ${KDE4_PLASMA_LIBS}
- ${QT_QTSCRIPT_LIBRARY})
-
-install(TARGETS plasma_dataenginescript_javascript DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES data/plasma-scriptengine-dataengine-javascript.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-
-# ADDONS
-
-set(javascript_addon_packagestructure_SRCS
- common/addonpackageplugin.cpp
- common/javascriptaddonpackagestructure.cpp
-)
-
-kde4_add_plugin(plasma_packagestructure_javascriptaddon ${javascript_addon_packagestructure_SRCS})
-target_link_libraries(plasma_packagestructure_javascriptaddon ${KDE4_PLASMA_LIBS})
-
-install(TARGETS plasma_packagestructure_javascriptaddon DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES data/plasma-packagestructure-javascript-addon.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-
-install(FILES data/plasma-javascriptaddon.desktop DESTINATION ${SERVICETYPES_INSTALL_DIR})
-
-#DECLARATIVE APPLET
-set(declarative_appletscript_SRCS
- common/extension_launchapp.cpp
- common/extension_io.cpp
- common/javascriptaddonpackagestructure.cpp
- common/declarativescriptenv.cpp
- declarative/toolboxproxy.cpp
- declarative/appletcontainer.cpp
- declarative/declarativeitemcontainer.cpp
- plasmoid/abstractjsappletscript.cpp
- plasmoid/appletinterface.cpp
- plasmoid/declarativeappletscript.cpp
- plasmoid/themedsvg.cpp
- simplebindings/bytearrayclass.cpp
- simplebindings/bytearrayprototype.cpp
- simplebindings/dataengine.cpp
- simplebindings/dataenginereceiver.cpp
- simplebindings/filedialogproxy.cpp
- simplebindings/qscriptbookkeeping.cpp
- simplebindings/url.cpp
- simplebindings/point.cpp
- )
-
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/common)
-
-kde4_add_plugin(plasma_appletscript_declarative ${declarative_appletscript_SRCS})
-target_link_libraries(plasma_appletscript_declarative
- ${KDE4_PLASMA_LIBS}
- ${KDE4_KIO_LIBS}
- ${QT_QTSCRIPT_LIBRARY}
- ${QT_QTDECLARATIVE_LIBRARY}
- ${QT_QTUITOOLS_LIBRARY}
-
-)
-
-
-install(TARGETS plasma_appletscript_declarative DESTINATION ${PLUGIN_INSTALL_DIR})
-install(FILES data/plasma-scriptengine-applet-declarative.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-
-
+++ /dev/null
-/*
- * Copyright 2010 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- */
-
-#include "javascriptaddonpackagestructure.h"
-
-K_EXPORT_PLASMA_PACKAGESTRUCTURE(javascriptaddon, JavascriptAddonPackageStructure)
-
+++ /dev/null
-/*
- * Copyright 2010 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#define USEGUI
-#define DECLARATIVE
-#include "scriptenv.cpp"
-#include "moc_scriptenv.cpp"
-
+++ /dev/null
-/*
- * Copyright 2010 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#define USEGUI
-#include "scriptenv.cpp"
-#include "moc_scriptenv.cpp"
-
+++ /dev/null
-[Desktop Entry]
-Name=Plasma JavaScript Addon
-Name[ar]=إضافة جافا سكربت بلازما
-Name[ast]=Complementu de JavaScript pa Plasma
-Name[bg]=Добавка за JavaScript на Plasma
-Name[bs]=Plazma javaskriptni dodatak
-Name[ca]=Complement del JavaScript pel Plasma
-Name[ca@valencia]=Complement del JavaScript pel Plasma
-Name[cs]=Doplněk Plasmy JavaScript
-Name[da]=Plasma JavaScript-tilføjelse
-Name[de]=JavaScript-Erweiterung für Plasma
-Name[el]=Πρόσθετο Plasma JavaScript
-Name[en_GB]=Plasma JavaScript Addon
-Name[eo]=Aldonaĵo de Plasmo en Ĝavaskripto
-Name[es]=Complemento de JavaScript para Plasma
-Name[et]=Plasma JavaScripti lisa
-Name[eu]=Plasma JavaScript gehigarria
-Name[fa]=افزودنی جاوااسکریپت پلاسما
-Name[fi]=Plasma JavaScript -liitännäinen
-Name[fr]=Module complémentaire Javascript de Plasma
-Name[ga]=Breiseán JavaScript Plasma
-Name[gl]=Engadido JavaScript para Plasma
-Name[gu]=પ્લાઝમા જાવાસ્ક્રિપ્ટ એડઓન્સ
-Name[he]=תוסף עבור JavaScript של Plasma
-Name[hi]=प्लाज़मा जावा-स्क्रिप्ट एडोन
-Name[hr]=Dodatak JavaScripta Plasmi
-Name[hu]=Plazma JavaScript-bővítmény
-Name[ia]=Plasma JavaScript Addon
-Name[id]=Addon JavaScript Plasma
-Name[is]=Plasma JavaScript viðbót
-Name[it]=Aggiunta per Java e JavaScript
-Name[ja]=Plasma JavaScript アドオン
-Name[kk]=Plasma JavaScript қосымшасы
-Name[km]=ផ្នែកបន្ថែម Plasma JavaScript
-Name[kn]=ಪ್ಲಾಸ್ಮಾ ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಆಡ್ಆನ್
-Name[ko]=Plasma 자바스크립트 추가 기능
-Name[lt]=Plasma JavaScript priedas
-Name[lv]=Plasma JavaScript papildinājums
-Name[mr]=प्लाज्मा जावास्क्रिप्ट Addon
-Name[nb]=Plasma JavaScript-tillegg
-Name[nds]=JavaScript-Verwiedern för Plasma
-Name[nl]=Addon voor Plasma JavaScript
-Name[nn]=Plasma–JavaScript-tillegg
-Name[pa]=ਪਲਾਜ਼ਮਾ ਜਾਵਾ ਸਕ੍ਰਿਪਟ ਐਡਆਨ
-Name[pl]=Dodatek dla JavaScript
-Name[pt]=Extensão de JavaScript do Plasma
-Name[pt_BR]=Complementos de JavaScript do Plasma
-Name[ro]=Supliment JavaScript Plasma
-Name[ru]=Расширение Plasma, использующее JavaScript
-Name[si]=ප්ලාස්මා හා ජාවාස්ක්රිප්ට ඇඩොන
-Name[sk]=Doplnok JavaScript pre plasmu
-Name[sl]=Dodatek za JavaScript za Plasmo
-Name[sr]=Плазма јаваскриптни додатак
-Name[sr@ijekavian]=Плазма јаваскриптни додатак
-Name[sr@ijekavianlatin]=Plasma JavaScript dodatak
-Name[sr@latin]=Plasma JavaScript dodatak
-Name[sv]=Plasma Javaskript-tillägg
-Name[tg]=Барномаи иловагии Plasma JavaScript
-Name[th]=ส่วนเสริมจาวาและจาวาสคริปต์สำหรับพลาสมาส่วนเสริมจาวาและจาวาสคริปต์สำหรับ
-Name[tr]=Plasma JavaScript Eklentisi
-Name[ug]=Plasma JavaScript قوشۇلما
-Name[uk]=Додаток JavaScript до Плазми
-Name[vi]=Phần bổ trợ JavaScript Plasma
-Name[wa]=Pacaedje di rawete Plasma JavaScript
-Name[x-test]=xxPlasma JavaScript Addonxx
-Name[zh_CN]=Plasma JavaScript 附加插件
-Name[zh_TW]=Plasma JavaScript Addon
-Type=ServiceType
-X-KDE-ServiceType=Plasma/JavascriptAddon
-Icon=plasma
+++ /dev/null
-[Desktop Entry]
-Name=Javascript Addon
-Name[ar]=إضافة جافا سكربت
-Name[ast]=Complementu de JavaScript
-Name[bg]=Добавка за Javascript
-Name[bn]=জাভাস্ক্রিপ্ট অ্যাড-অন
-Name[bs]=Javaskriptni dodatak
-Name[ca]=Complement del Javascript
-Name[ca@valencia]=Complement del Javascript
-Name[cs]=Doplněk JavaScript
-Name[da]=JavaScript-tilføjelse
-Name[de]=JavaScript-Erweiterung
-Name[el]=Πρόσθετο Javascript
-Name[en_GB]=Javascript Addon
-Name[eo]=Aldonaĵo de Ĝavaskripto
-Name[es]=Complemento de JavaScript
-Name[et]=JavaScripti lisa
-Name[eu]=Javascript gehigarria
-Name[fa]=افزودنی جاوااسکریپت
-Name[fi]=Javascript-liitännäinen
-Name[fr]=Module complémentaire Javascript
-Name[ga]=Breiseán JavaScript
-Name[gl]=Engadido JavaScript
-Name[gu]=જાવાસ્ક્રિપ્ટ એડઓન્સ
-Name[he]=תוסף JavaScript
-Name[hi]=जावास्क्रिप्ट एडोन
-Name[hr]=Dodadak za Javascript
-Name[hu]=Javascript-bővítmény
-Name[ia]=JavaScript Addon
-Name[id]=Addon JavaScript
-Name[is]=JavaScript viðbót
-Name[it]=Aggiunta per JavaScript
-Name[ja]=JavaScript アドオン
-Name[kk]=Javascript қосымшасы
-Name[km]=ផ្នែកបន្ថែម Javascript
-Name[kn]=ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಆಡ್ಆನ್
-Name[ko]=자바스크립트 추가 기능
-Name[lt]=Javascript priedas
-Name[lv]=JavaScript papildinājums
-Name[mr]=जावास्क्रिप्ट Addon
-Name[nb]=JavaScript-tillegg
-Name[nds]=JavaScript-Verwiedern
-Name[nl]=Addon voor JavaScript
-Name[nn]=JavaScript-tillegg
-Name[pa]=ਜਾਵਾ ਸਕ੍ਰਿਪਟ ਐਡ-ਆਨ
-Name[pl]=Dodatek dla JavaScript
-Name[pt]=Extensão de JavaScript
-Name[pt_BR]=Complementos de JavaScript
-Name[ro]=Supliment Javascript
-Name[ru]=Дополнение, использующее JavaScript
-Name[si]=ජාවාස්ක්රිප්ට ඇඩෝන
-Name[sk]=Doplnok JavaScript
-Name[sl]=Dodatek za JavaScript
-Name[sr]=Јаваскриптни додатак
-Name[sr@ijekavian]=Јаваскриптни додатак
-Name[sr@ijekavianlatin]=JavaScript dodatak
-Name[sr@latin]=JavaScript dodatak
-Name[sv]=Javaskript-tillägg
-Name[tg]=Барномаи иловагии Javascript
-Name[th]=ส่วนเสริมจาวาสคริปต์
-Name[tr]=Javascript Eklentisi
-Name[ug]=Javascript قوشۇلما
-Name[uk]=Додаток JavaScript
-Name[vi]=Phần bổ trợ Javascript
-Name[wa]=Pacaedje di rawete Javascript
-Name[x-test]=xxJavascript Addonxx
-Name[zh_CN]=Javascript 插件
-Name[zh_TW]=Javascript Addon
-Comment=Addons for Javascript Plasma plugins
-Comment[ar]=إضافة لملاحق جافا سكربت بلازما
-Comment[ast]=Amestaos pa complementos de JavaScript pa Plasma
-Comment[bg]=Добавки за приставките за Javascript на Plasma
-Comment[bs]=Dodaci za javaskriptne plazma priključke
-Comment[ca]=Complements pels connectors Javascript del Plasma
-Comment[ca@valencia]=Complements pels connectors Javascript del Plasma
-Comment[cs]=Doplňky pro javascriptové zásuvné moduly plasmy
-Comment[da]=Tilføjelse til Plasma-plugins i JavaScript
-Comment[de]=Erweiterungen für JavaScript-Module in Plasma
-Comment[el]=Πρόσθετο για Plasma JavaScript
-Comment[en_GB]=Addons for Javascript Plasma plugins
-Comment[eo]=Aldonaĵoj por kromprogramoj de Plasmo en Ĝavaskripto
-Comment[es]=Añadidos para complementos de JavaScript para Plasma
-Comment[et]=JavaScripti Plasma pluginate lisad
-Comment[eu]=Javascript Plasma pluginentzako gehigarriak
-Comment[fi]=Lisäosia JavaScript Plasma -liitännäisille
-Comment[fr]=Module complémentaire pour les modules externes en Javascript de Plasma
-Comment[ga]=Breiseáin le haghaidh forlíontán Javascript Plasma
-Comment[gl]=Engadidos para complementos Plasma Javascript
-Comment[gu]=જાવાસ્ક્રિપ્ટ પ્લાઝમા પ્લગઇન માટે એડઓન્સ
-Comment[he]=תוספים לתוספי JavaScript של Plasma
-Comment[hi]=जावास्क्रिप्ट प्लाज्मा प्लगिन के लिए Addons
-Comment[hr]=Dodaci za priključke za Javascript Plasma
-Comment[hu]=Bővítmények JavaScript Plazma-modulokhoz
-Comment[ia]=Addons (elementos adjuncte) pro plugins de Plasma de javascript
-Comment[id]=Addon untuk plugin Javascript Plasma
-Comment[is]=Viðbætur fyrir Plasma JavaScript íforrit
-Comment[it]=Aggiunte per le estensioni JavaScript di Plasma
-Comment[ja]=JavaScript Plasma プラグイン用のアドオン
-Comment[kk]=Javascript Plasma плагиніне қосымшасы
-Comment[km]=កម្មវិធីបន្ថែមសម្រាប់កម្មវិធីជំនួយ Javascript Plasma
-Comment[ko]=자바스크립트 Plasma 플러그인을 위한 추가 기능
-Comment[lt]=Javascript Plasma papildinio priedai
-Comment[lv]=Papildinājumi Javascript Plasma spraudņiem
-Comment[mr]=जावास्क्रिप्ट प्लाज्मा प्लगइनचे Addon
-Comment[nb]=Tillegg for JavaScript Plasma-programtillegg
-Comment[nds]=Verwiedern för Plasma sien JavaScript-Modulen
-Comment[nl]=Addons voor Javascript Plasma plugins
-Comment[nn]=Tillegg for JavaScript–Plasma-programtillegg
-Comment[pa]=ਜਾਵਾਸਕ੍ਰਿਪਟ ਪਲਾਜ਼ਮਾ ਪਲੱਗਇਨ ਲਈ ਐਡਐਨ
-Comment[pl]=Dodatki dla wtyczek Plazmy w JavaScript
-Comment[pt]=Extras para os 'plugins' do Plasma em JavaScript
-Comment[pt_BR]=Complementos para os plugins do Plasma em JavaScript
-Comment[ro]=Suplimente pentru module JavaScript Plasma
-Comment[ru]=Модули поддержки дополнений Plasma, использующих JavaScript
-Comment[si]=ජාවාස්ක්රිප්ට ප්ලාස්මා ප්ලගින සඳහා ඇඩෝන
-Comment[sk]=Doplnky pre Javascriptové moduly plasmy
-Comment[sl]=Dodatki za vstavke JavaScript za Plasmo
-Comment[sr]=Додаци за јаваскриптне плазма прикључке
-Comment[sr@ijekavian]=Додаци за јаваскриптне плазма прикључке
-Comment[sr@ijekavianlatin]=Dodaci za JavaScript plasma priključke
-Comment[sr@latin]=Dodaci za JavaScript plasma priključke
-Comment[sv]=Tillägg för Javascript Plasma-insticksprogram
-Comment[tg]=Барномаҳои иловагӣ барои плагинҳои Javascript Plasma
-Comment[th]=ส่วนขยายสำหรับส่วนเสริมพลาสมาที่เป็นจาวาสคริปต์
-Comment[tr]=Javascript Plasma eklentileri için ek araçlar
-Comment[ug]=Javascript Plasma قىستۇرمىسى ئۈچۈن قوشۇلما
-Comment[uk]=Додатки для використання Javascript у Плазмі
-Comment[vi]=Phần bổ trợ cho phần bổ sung Plasma Javascript
-Comment[wa]=Pacaedjes di rawete po les tchôkes-divins Plasma Javascript
-Comment[x-test]=xxAddons for Javascript Plasma pluginsxx
-Comment[zh_CN]=Javascript Plasma 插件的附件组件
-Comment[zh_TW]=Javascript Plasma 外掛程式的 Addon
-Type=Service
-X-KDE-ServiceTypes=Plasma/PackageStructure
-
-X-KDE-Library=plasma_packagestructure_javascriptaddon
-X-KDE-PluginInfo-Author=Aaron Seigo
-X-KDE-PluginInfo-Email=aseigh@kde.org
-X-KDE-PluginInfo-Name=Plasma/JavascriptAddon
-X-KDE-PluginInfo-Version=0.1
-X-KDE-PluginInfo-Website=http://plasma.kde.org/
-X-KDE-PluginInfo-License=GPLv2+
-X-KDE-PluginInfo-EnabledByDefault=true
-X-Plasma-PackageFileFilter=*.plasmaaddon
-X-Plasma-PackageFileMimetypes=application/zip
-
+++ /dev/null
-[Desktop Entry]
-Name=JavaScript Widget
-Name[ar]=ودجة جافا سكربت
-Name[ast]=Elementu gráficu JavaScript
-Name[be@latin]=Widžet „JavaScript”
-Name[bg]=Джаджа JavaScript
-Name[bn]=জাভাস্ক্রিপ্ট উইজেট
-Name[bn_IN]=JavaScript Widget
-Name[bs]=Javascript grafička kontrola
-Name[ca]=Estri del JavaScript
-Name[ca@valencia]=Estri del JavaScript
-Name[cs]=JavaScript Widget
-Name[csb]=Interfejs JavaScript
-Name[da]=JavaScript-widget
-Name[de]=JavaScript-Programm
-Name[el]=Συστατικό JavaScript
-Name[en_GB]=JavaScript Widget
-Name[eo]=Ĝavaskripta fenestraĵo
-Name[es]=Elemento gráfico JavaScript
-Name[et]=JavaScripti vidin
-Name[eu]=JavaScript trepeta
-Name[fa]=ویجت جاوااسکریپت
-Name[fi]=JavaScript-sovelma
-Name[fr]=Composant graphique JavaScript
-Name[fy]=JavaSkript Widget
-Name[ga]=Giuirléid JavaScript
-Name[gl]=Widget de JavaScript
-Name[gu]=જાવાસ્ક્રિપ્ટ વિજેટ
-Name[he]=ווידג׳ט JavaScript
-Name[hi]=जावास्क्रिप्ट विज़ेट
-Name[hne]=जावास्क्रिप्ट विजेट
-Name[hr]=JavaScript widgeti
-Name[hu]=JavaScript-objektum
-Name[ia]=JavaScript Widget
-Name[id]=Widget JavaScript
-Name[is]=JavaScript græja
-Name[it]=Oggetto JavaScript
-Name[ja]=JavaScript ウィジェット
-Name[kk]=JavaScript интерфейс бөлшегі
-Name[km]=ធាតុក្រាហ្វិក JavaScript
-Name[kn]=ಜಾವಾ ವಿಧಿಗುಚ್ಛ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Name[ko]=자바스크립트 위젯
-Name[ku]=Amîra JavaScriptê
-Name[lt]=JavaScript valdiklis
-Name[lv]=JavaScript sīkrīks
-Name[ml]=ജാവാസ്ക്രിപ്റ്റ് വിഡ്ജറ്റ്
-Name[mr]=जावास्क्रिप्ट विजेट
-Name[nb]=JavaScript-skjermelement
-Name[nds]=JavaScript-Finster
-Name[nl]=JavaScript-widget
-Name[nn]=JavaScript-element
-Name[or]=JavaScript ୱିଜେଟ
-Name[pa]=ਜਾਵਾ-ਸਕ੍ਰਿਪਟ ਵਿਦਜੈੱਟ
-Name[pl]=Element interfejsu w JavaScript
-Name[pt]=Elemento de JavaScript
-Name[pt_BR]=Widget de JavaScript
-Name[ro]=Miniaplicație JavaScript
-Name[ru]=Виджет на языке JavaScript
-Name[si]=Python මෙවලම්
-Name[sk]=JavaScript widget
-Name[sl]=Gradnik v JavaScriptu
-Name[sr]=јаваскриптни виџет
-Name[sr@ijekavian]=јаваскриптни виџет
-Name[sr@ijekavianlatin]=JavaScript vidžet
-Name[sr@latin]=JavaScript vidžet
-Name[sv]=Grafisk Javascript-komponent
-Name[ta]=JavaScript Widget
-Name[te]=జావాస్క్రిప్ట్ విడ్జ్ట్
-Name[tg]=Видҷети JavaScript
-Name[th]=วิดเจ็ตภาษาจาวาสคริปต์
-Name[tr]=JavaScript Gereci
-Name[ug]=JavaScript ۋىجېتى
-Name[uk]=Віджет JavaScript
-Name[vi]=Widget Javascript
-Name[wa]=Ahesse JavaScript
-Name[x-test]=xxJavaScript Widgetxx
-Name[zh_CN]=JavaScript 部件
-Name[zh_TW]=JavaScript 元件
-Comment=Native Plasma widget written in JavaScript
-Comment[ar]=ودجة بلازما أصلية كتبت بجافا سكربت
-Comment[ast]=Elementu gráficu nativu de Plasma escritu en JavaScript
-Comment[be@latin]=Widžet systemy „Plasma”, napisany ŭ movie „JavaScript”
-Comment[bg]=Оригинална джаджа за Plasma, написана с JavaScript
-Comment[bs]=Samosvojni plazma grafička kontrola napisana u javaskriptu
-Comment[ca]=Estri nadiu del Plasma escrit en JavaScript
-Comment[ca@valencia]=Estri nadiu del Plasma escrit en JavaScript
-Comment[cs]=Nativní Plasma widget napsaný v JavaScriptu
-Comment[csb]=Prôwdzëwi widżet Plasmë napisóny w JavaScript
-Comment[da]=Native Plasma-widget skrevet i JavaScript
-Comment[de]=Echtes Plasma-Programm, geschrieben in JavaScript
-Comment[el]=Εγγενές συστατικό Plasma γραμμένο σε JavaScript
-Comment[en_GB]=Native Plasma widget written in JavaScript
-Comment[eo]=Indiĝena fenestraĵo de Plasmo programita per Ĝavaskripto
-Comment[es]=Elemento gráfico nativo de Plasma escrito en JavaScript
-Comment[et]=JavaScriptis kirjutatud Plasma vidin
-Comment[eu]=Jatorrizko Plasma trepeta, JavaScript lengoaian idatzia
-Comment[fi]=Natiivi, JavaScript-pohjainen Plasma-sovelma
-Comment[fr]=Composant graphique natif de Plasma écrit en JavaScript
-Comment[fy]=Plasma widget skreaun yn JavaSkript
-Comment[ga]=Giuirléid dhúchasach Plasma, scríofa i JavaScript
-Comment[gl]=Widget nativo de Plasma escrito en JavaScript
-Comment[gu]=જાવાસ્ક્રિપ્ટમાં લખાયેલ સ્થાનિક પ્લાઝમા વિજેટ
-Comment[he]=ווידג׳ט של Plasma הנכתב ב־JavaScript
-Comment[hi]=जावास्क्रिप्ट में लिखा गया नेटिव प्लाज्मा विजेट
-Comment[hne]=जावास्क्रिप्ट मं लिखे नेटिव प्लाज्मा विजेट
-Comment[hr]=Izvorna Plasma widget napisana u JavaScriptu
-Comment[hu]=Plasma-elem Javascriptben elkészítve
-Comment[ia]=Widget native de Plasma scribite in JavaScript
-Comment[id]=Widget Plasma asli yang ditulis dalam JavaScript
-Comment[is]=Upprunabundin Plasma græja skrifuð í JavaScript
-Comment[it]=Oggetto nativo di Plasma scritto in JavaScript
-Comment[ja]=JavaScript で書かれた Plasma のネイティブウィジェット
-Comment[kk]=JavaScript-те жазылған Plasma тума виджеті
-Comment[km]=ធាតុក្រាហ្វិកប្លាស្មាដើម ដែលសរសេរក្នុង JavaScript
-Comment[kn]=ಜಾವಾ ಸ್ಕ್ರಿಪ್ಟ್ ನಲ್ಲಿ ಬರೆಯಲಾದ ಸ್ವಾಭಾವಿಕ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Comment[ko]=자바스크립트로 작성된 Plasma 위젯
-Comment[lt]=Nuosavas Plasma valdiklis parašytas JavaScript kalba
-Comment[lv]=Plasma sīkrīks, rakstīts JavaScript
-Comment[ml]=ജാവാസ്ക്രിപ്റ്റില് തയ്യാറാക്കിയിരിക്കുന്ന നേറ്റീവ് പ്ലാസ്മാ വിഡ്ജറ്റ്
-Comment[mr]=जावास्क्रिप्ट अंतर्गत लिहीले गेलेले मूळ प्लाज्मा विजेट
-Comment[nb]=Plasmaelement for dette systemet, skrevet i JavaScript
-Comment[nds]=En orginaal Plasmaelement, schreven in JavaScript
-Comment[nl]=Plasma-widget geschreven in JavaScript
-Comment[nn]=Plasma-element skriven i JavaScript
-Comment[or]=JavaScriptରେ ଲିଖିତ ସ୍ଥାନୀୟ ପ୍ଲାଜମା ୱିଜେଟ
-Comment[pa]=ਜਾਵਾ-ਸਕ੍ਰਿਪਟ ਵਿੱਚ ਲਿਖੇ ਨੇਟਿਵ ਪਲਾਜ਼ਮਾ ਵਿਦਜੈੱਟ
-Comment[pl]=Element interfejsu Plazmy napisany w JavaScript
-Comment[pt]=Elemento nativo do Plasma feito em JavaScript
-Comment[pt_BR]=Widget do Plasma nativo escrito em JavaScript
-Comment[ro]=Miniaplicație Plasma scrisă în JavaScript
-Comment[ru]=Виджет Plasma, написанный на языке JavaScript
-Comment[si]=ජාවා ස්ක්රිප්ට මගින් ලියූ ප්ලාස්මා විජෙට්ටු
-Comment[sk]=Natívny plasma widget napísaný v JavaScripte
-Comment[sl]=Pravi gradnik za Plasmo, ki je napisan v JavaScriptu
-Comment[sr]=Самосвојни плазма виџет написан у јаваскрипту
-Comment[sr@ijekavian]=Самосвојни плазма виџет написан у јаваскрипту
-Comment[sr@ijekavianlatin]=Samosvojni plasma vidžet napisan u JavaScriptu
-Comment[sr@latin]=Samosvojni plasma vidžet napisan u JavaScriptu
-Comment[sv]=Inbyggd grafisk Plasma-komponent skriven i Javascript
-Comment[ta]=Native Plasma widget written in JavaScript
-Comment[te]=జావాస్క్రిప్ట్లో వ్రాసిన నేటివ్ ప్లాజ్మా విడ్జ్ట్
-Comment[tg]=Ин модули Plasma дар JavaScript навишта шуд
-Comment[th]=วิดเจ็ตพลาสมาที่ถูกเขียนด้วยจาวาสคริปต์
-Comment[tr]=JavaScript ile yazılmış gerçek Plasma gereci
-Comment[ug]=JavaScript بىلەن يېزىلغان ئەسلى Plasma ۋىجېتى
-Comment[uk]=Віджет Плазми, написаний на JavaScript
-Comment[vi]=Widget Plasma được viết bằng JavaScript
-Comment[wa]=Ahesse askepieye po Plasma eyet scrîte e JavaScript
-Comment[x-test]=xxNative Plasma widget written in JavaScriptxx
-Comment[zh_CN]=使用 JavaScript 编写的原生 Plasma 部件
-Comment[zh_TW]=用 JavaScript 寫的原始 Plasma 元件
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-KDE-Library=plasma_appletscript_simple_javascript
-X-Plasma-API=javascript
-X-Plasma-ComponentTypes=Applet
-X-KDE-PluginInfo-Version=5
+++ /dev/null
-[Desktop Entry]
-Name=JavaScript DataEngine
-Name[ar]=مشغل جافا سكربت
-Name[ast]=Motor de datos JavaScript
-Name[bg]=Ядро за данни на JavaScript
-Name[bn]=জাভাস্ক্রিপ্ট ডেটা-ইঞ্জিন
-Name[bs]=Javascript pogon podataka
-Name[ca]=Motor de dades de JavaScript
-Name[ca@valencia]=Motor de dades de JavaScript
-Name[cs]=Datový nástroj JavaScript
-Name[csb]=Mòtór JavaScript
-Name[da]=JavaScript-datamotor
-Name[de]=JavaScript-Datenmodul
-Name[el]=Μηχανή δεδομένων JavaScript
-Name[en_GB]=JavaScript DataEngine
-Name[eo]=Datummodulo de Ĝavaskripto
-Name[es]=Motor de datos JavaScript
-Name[et]=JavaScripti andmemootor
-Name[eu]=JavaScript datu-motorra
-Name[fa]=موتور دادهی جاوااسکریپت
-Name[fi]=JavaScript-datakone
-Name[fr]=Moteur de données JavaScript
-Name[fy]=JavaSkript gegevens motor
-Name[ga]=Inneall Sonraí JavaScript
-Name[gl]=Motor de datos de JavaScript
-Name[gu]=જાવાસ્ક્રિપ્ટ માહિતીએન્જિન
-Name[he]=מנוע נתונים של JavaScript
-Name[hi]=जावास्क्रिप्ट डाटा इंजन
-Name[hr]=JavaScript podatkovni mehanizam
-Name[hu]=JavaScript-adatmodul
-Name[ia]=JavaScript Motor de Datos (Data Engine)
-Name[id]=Mesin Data JavaScript
-Name[is]=JavaScript gagnavél
-Name[it]=Motore di dati JavaScript
-Name[ja]=JavaScript データエンジン
-Name[kk]=JavaScript деректер тетігі
-Name[km]=ម៉ាស៊ីនទិន្នន័យ JavaScript
-Name[kn]=JavaScript DataEngine
-Name[ko]=자바스크립트 데이터 엔진
-Name[lt]=JavaScript duomenų variklis
-Name[lv]=JavaScript datu dzinējs
-Name[ml]=ജാവാസ്ക്രിപ്റ്റ് ഡാറ്റാഎഞ്ചിന്
-Name[mr]=जावास्क्रिप्ट डेटाइंजिन
-Name[nb]=JavaScript datamotor
-Name[nds]=JavaScript-Datenkarn
-Name[nl]=JavaScript-data-engine
-Name[nn]=JavaScript-datamotor
-Name[pa]=ਜਾਵਾ-ਸਕ੍ਰਿਪਟ ਡਾਟਾਇੰਜਣ
-Name[pl]=Silnik danych JavaScript
-Name[pt]=Motor de Dados do JavaScript
-Name[pt_BR]=Mecanismo de dados JavaScript
-Name[ro]=MotorDate JavaScript
-Name[ru]=Поставщик данных (JavaScript)
-Name[si]=JavaScript දත්ත එන්ජිම
-Name[sk]=Dátový nástroj JavaScript
-Name[sl]=Podatkovni pogon za JavaScript
-Name[sr]=јаваскриптни датомотор
-Name[sr@ijekavian]=јаваскриптни датомотор
-Name[sr@ijekavianlatin]=JavaScript datomotor
-Name[sr@latin]=JavaScript datomotor
-Name[sv]=Javascript-datagränssnitt
-Name[tg]=Маълумоти муҳаррики JavaScript
-Name[th]=กลไกข้อมูลของจาวาสคริปต์
-Name[tr]=JavaScript Veri Motoru
-Name[ug]=JavaScript سانلىق-مەلۇمات ماتورى
-Name[uk]=Рушій даних JavaScript
-Name[vi]=Nguồn dữ liệu JavaScript
-Name[wa]=Moteur di dnêyes JavaScript
-Name[x-test]=xxJavaScript DataEnginexx
-Name[zh_CN]=JavaScript 数据引擎
-Name[zh_TW]=JavaScript 資料引擎
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-KDE-Library=plasma_dataenginescript_javascript
-X-Plasma-API=javascript
-X-Plasma-ComponentTypes=DataEngine
+++ /dev/null
-[Desktop Entry]
-Name=JavaScript Runner
-Name[ar]=مشغل جافا سكربت
-Name[ast]=Motor de javascript
-Name[be@latin]=Uklučeńnie „JavaScript”
-Name[bg]=Изпълнение на JavaScript
-Name[bn]=জাভাস্ক্রিপ্ট রানার
-Name[bn_IN]=JavaScript Runner
-Name[bs]=Javascript izvođač
-Name[ca]=Executor de JavaScript
-Name[ca@valencia]=Executor de JavaScript
-Name[cs]=Spouštěč JavaScriptu
-Name[csb]=Mòtór JavaScript
-Name[da]=JavaScript-runner
-Name[de]=JavaScript-Ausführung
-Name[el]=Εκτελεστής JavaScript
-Name[en_GB]=JavaScript Runner
-Name[eo]=Ruligilo de Ĝavaskripto
-Name[es]=Lanzador JavaScript
-Name[et]=JavaScripti käivitaja
-Name[eu]=JavaScript exekutatzailea
-Name[fa]=اجراکننده جاوااسکریپت
-Name[fi]=JavaScript-suoritusohjelma
-Name[fr]=Lanceur JavaScript
-Name[fy]=JavaSkript rinner
-Name[ga]=Feidhmitheoir JavaScript
-Name[gl]=Executor de JavaScript
-Name[gu]=જાવાસ્ક્રિપ્ટ ચલાવનાર
-Name[he]=מריץ JavaScript
-Name[hi]=जावास्क्रिप्ट चलाने वाला
-Name[hne]=जावास्क्रिप्ट चलइया
-Name[hr]=JavaScript Pokretač
-Name[hu]=JavaScript-indító
-Name[ia]=JavaScript Executor
-Name[id]=Pelari JavaScript
-Name[is]=JavaScript keyrari
-Name[it]=Esecutore JavaScript
-Name[ja]=JavaScript Runner
-Name[kk]=JavaScript жеккіші
-Name[km]=កម្មវិធីរត់ JavaScript
-Name[kn]=ಜಾವಾ ವಿಧಿಗುಚ್ಛ (ಸ್ಕ್ರಿಪ್ಟ್) ಚಾಲಕ
-Name[ko]=자바스크립트 실행기
-Name[ku]=Xebatkara JavaScriptê
-Name[lt]=JavaScript paleidiklis
-Name[lv]=JavaScript darbinātājs
-Name[mk]=Извршувач на JavaScript
-Name[ml]=ജാവാസ്ക്രിപ്റ്റ് റണ്ണര്
-Name[mr]=जावास्क्रिप्ट चालक
-Name[nb]=JavaScript-kjører
-Name[nds]=JavaScript-Dreger
-Name[nl]=JavaScript-runner
-Name[nn]=JavaScript-køyrar
-Name[or]=JavaScript ଚାଳକ
-Name[pa]=ਜਾਵਾ-ਸਕ੍ਰਿਪਟ ਰਨਰ
-Name[pl]=Silnik JavaScript
-Name[pt]=Execução de JavaScript
-Name[pt_BR]=Mecanismo JavaScript
-Name[ro]=Executor JavaScript
-Name[ru]=JavaScript Runner
-Name[si]=JavaScript ධාවකය
-Name[sk]=Spúšťač JavaScriptu
-Name[sl]=Zaganjalnik JavaScripta
-Name[sr]=јаваскриптни извођач
-Name[sr@ijekavian]=јаваскриптни извођач
-Name[sr@ijekavianlatin]=JavaScript izvođač
-Name[sr@latin]=JavaScript izvođač
-Name[sv]=Kör Javascript
-Name[ta]=JavaScript Runner
-Name[te]=జావాస్క్రిప్ట్ నడుపునది
-Name[tg]=Иҷрогари JavaScript
-Name[th]=ตัวประมวลผลจาวาสคริปต์
-Name[tr]=JavaScript Çalıştırıcı
-Name[ug]=JavaScript ئىجراچىسى
-Name[uk]=Механізм запуску JavaScript
-Name[vi]=Trình chạy JavaScript
-Name[wa]=Enondeu JavaScript
-Name[x-test]=xxJavaScript Runnerxx
-Name[zh_CN]=JavaScript 运行器
-Name[zh_TW]=JavaScript 執行器
-Comment=JavaScript Runner
-Comment[ar]=مشغل جافا سكربت
-Comment[ast]=Motor de javascript
-Comment[be@latin]=Uklučeńnie „JavaScript”.
-Comment[bg]=Изпълнение на JavaScript
-Comment[bn]=জাভাস্ক্রিপ্ট চালক
-Comment[bn_IN]=JavaScript Runner
-Comment[bs]=Javascript izvođač
-Comment[ca]=Executor de JavaScript
-Comment[ca@valencia]=Executor de JavaScript
-Comment[cs]=Spouštěč JavaScriptu
-Comment[csb]=Zrëszôcz JavaScript
-Comment[da]=JavaScript-runner
-Comment[de]=JavaScript-Ausführung
-Comment[el]=Εκτελεστής JavaScript
-Comment[en_GB]=JavaScript Runner
-Comment[eo]=Ruligilo de Ĝavaskripto
-Comment[es]=Lanzador JavaScript
-Comment[et]=JavaScripti käivitaja
-Comment[eu]=JavaScript exekutatzailea
-Comment[fa]=اجراکننده جاوااسکریپت
-Comment[fi]=JavaScript-suoritusohjelma
-Comment[fr]=Lanceur JavaScript
-Comment[fy]=JavaSkript rinner
-Comment[ga]=Feidhmitheoir JavaScript
-Comment[gl]=Executor de JavaScript
-Comment[gu]=જાવાસ્ક્રિપ્ટ ચલાવનાર
-Comment[he]=מריץ JavaScript
-Comment[hi]=जावास्क्रिप्ट चलाने वाला
-Comment[hne]=जावास्क्रिप्ट चलइया
-Comment[hr]=JavaScript pokretač
-Comment[hu]=JavaScript-indító
-Comment[ia]=JavaScript Executor
-Comment[id]=Pelari JavaScript
-Comment[is]=JavaScript keyrari
-Comment[it]=Esecutore JavaScript
-Comment[ja]=JavaScript Runner
-Comment[kk]=JavaScript жеккіші
-Comment[km]=កម្មវិធីរត់ JavaScript
-Comment[kn]=ಜಾವಾ ವಿಧಿಗುಚ್ಛ (ಸ್ಕ್ರಿಪ್ಟ್) ಚಾಲಕ
-Comment[ko]=자바스크립트 실행기
-Comment[ku]=Xebatkara JavaScriptê
-Comment[lt]=JavaScript paleidiklis
-Comment[lv]=JavaScript darbinātājs
-Comment[mk]=Извршувач на JavaScript
-Comment[ml]=ജാവാസ്ക്രിപ്റ്റ് റണ്ണര്
-Comment[mr]=जावास्क्रिप्ट चालक
-Comment[nb]=JavaScript-kjører
-Comment[nds]=JavaScript-Dreger
-Comment[nl]=JavaScript-runner
-Comment[nn]=JavaScript-køyrar
-Comment[or]=JavaScript ଚାଳକ
-Comment[pa]=ਜਾਵਾ-ਸਕ੍ਰਿਪਟ ਰਨਰ
-Comment[pl]=Silnik JavaScript
-Comment[pt]=Execução de JavaScript
-Comment[pt_BR]=Mecanismo JavaScript
-Comment[ro]=Executor JavaScript
-Comment[ru]=Модуль запуска, написанный на языке JavaScript
-Comment[si]=JavaScript Runner
-Comment[sk]=Spúšťač JavaScriptu
-Comment[sl]=Zaganjalnik JavaScripta
-Comment[sr]=Јаваскриптни извођач
-Comment[sr@ijekavian]=Јаваскриптни извођач
-Comment[sr@ijekavianlatin]=JavaScript izvođač
-Comment[sr@latin]=JavaScript izvođač
-Comment[sv]=Kör Javascript
-Comment[ta]=JavaScript Runner
-Comment[te]=జావాస్క్రిప్ట్ నడుపునది
-Comment[tg]=Иҷрогари JavaScript
-Comment[th]=ตัวประมวลผลจาวาสคริปต์
-Comment[tr]=JavaScript Çalıştırıcı
-Comment[ug]=JavaScript ئىجراچىسى
-Comment[uk]=Механізм запуску JavaScript
-Comment[vi]=Trình chạy JavaScript
-Comment[wa]=Enondeu JavaScript
-Comment[x-test]=xxJavaScript Runnerxx
-Comment[zh_CN]=JavaScript 运行器
-Comment[zh_TW]=JavaScript 執行器
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-KDE-Library=plasma_runnerscript_javascript
-X-Plasma-API=javascript
-X-Plasma-ComponentTypes=Runner
+++ /dev/null
-/*
- * Copyright 2009 Aaron Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "javascriptdataengine.h"
-
-#include <QScriptEngine>
-
-#include <Plasma/Package>
-
-#include "javascriptservice.h"
-#include "common/scriptenv.h"
-#include "simplebindings/i18n.h"
-#include "simplebindings/dataengine.h"
-
-void registerNonGuiMetaTypes(QScriptEngine *engine);
-
-JavaScriptDataEngine::JavaScriptDataEngine(QObject *parent, const QVariantList &args)
- : DataEngineScript(parent)
-{
- Q_UNUSED(args);
-
- m_qscriptEngine = new QScriptEngine(this);
- m_env = new ScriptEnv(this, m_qscriptEngine);
-
- connect(m_env, SIGNAL(reportError(ScriptEnv*,bool)), this, SLOT(reportError(ScriptEnv*,bool)));
-}
-
-bool JavaScriptDataEngine::init()
-{
- QScriptValue global = m_qscriptEngine->globalObject();
-
- bindI18N(m_qscriptEngine);
-
- m_iface = m_qscriptEngine->newQObject(this);
- m_iface.setScope(global);
- m_env->addMainObjectProperties(m_iface);
-
- global.setProperty("engine", m_iface);
-
- global.setProperty("setData", m_qscriptEngine->newFunction(JavaScriptDataEngine::jsSetData));
- global.setProperty("removeAllData", m_qscriptEngine->newFunction(JavaScriptDataEngine::jsRemoveAllData));
- global.setProperty("removeData", m_qscriptEngine->newFunction(JavaScriptDataEngine::jsRemoveData));
- global.setProperty("removeAllSources", m_qscriptEngine->newFunction(JavaScriptDataEngine::jsRemoveAllSources));
- global.setProperty("Service", m_qscriptEngine->newFunction(JavaScriptDataEngine::serviceCtor));
-
- registerNonGuiMetaTypes(m_qscriptEngine);
-
- if (!m_env->importExtensions(description(), m_iface)) {
- return false;
- }
-
- return m_env->include(mainScript());
-}
-
-QScriptEngine *JavaScriptDataEngine::engine() const
-{
- return m_qscriptEngine;
-}
-
-void JavaScriptDataEngine::jsSetMaxSourceCount(int count)
-{
- setMaxSourceCount(count);
-}
-
-int JavaScriptDataEngine::maxSourceCount() const
-{
- return dataEngine()->maxSourceCount();
-}
-
-void JavaScriptDataEngine::jsSetMinimumPollingInterval(int interval)
-{
- setMinimumPollingInterval(interval);
-}
-
-int JavaScriptDataEngine::jsMinimumPollingInterval() const
-{
- return minimumPollingInterval();
-}
-
-void JavaScriptDataEngine::jsSetPollingInterval(int interval)
-{
- m_pollingInterval = interval;
- setPollingInterval(interval);
-}
-
-int JavaScriptDataEngine::pollingInterval() const
-{
- return m_pollingInterval;
-}
-
-QScriptValue JavaScriptDataEngine::jsSetData(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() < 1) {
- return context->throwError(i18n("setData() takes at least one argument"));
- }
-
- QString error;
- JavaScriptDataEngine *iFace = extractIFace(engine, error);
-
- if (!iFace) {
- return context->throwError(error);
- }
-
- const QString source = context->argument(0).toString();
- if (context->argumentCount() == 1) {
- iFace->setData(source, DataEngine::Data());
- } else if (context->argument(1).isArray() || context->argument(1).isObject()) {
- kDebug( )<< "array or object";
- QScriptValueIterator it(context->argument(1));
- DataEngine::Data data;
-
- while (it.hasNext()) {
- it.next();
- data.insert(it.name(), it.value().toVariant());
- }
-
- iFace->setData(source, data);
- } else {
- const QString value = context->argument(1).toString();
- if (context->argumentCount() > 2) {
- if (context->argument(2).isArray() || context->argument(2).isObject()) {
- QScriptValueIterator it(context->argument(2));
- DataEngine::Data data;
-
- while (it.hasNext()) {
- it.next();
- data.insert(it.name(), it.value().toVariant());
- }
-
- iFace->setData(source, value, data);
- } else {
- iFace->setData(source, value, context->argument(2).toString());
- }
- } else {
- iFace->setData(source, value);
- }
- }
-
- return engine->newVariant(true);
-}
-
-JavaScriptDataEngine *JavaScriptDataEngine::extractIFace(QScriptEngine *engine, QString &error)
-{
- JavaScriptDataEngine *interface = 0;
- QScriptValue engineValue = engine->globalObject().property("engine");
- QObject *engineObject = engineValue.toQObject();
-
- if (!engineObject) {
- error = i18n("Could not extract the DataEngineObject");
- } else {
- interface = qobject_cast<JavaScriptDataEngine *>(engineObject);
- if (!interface) {
- error = i18n("Could not extract the DataEngine");
- }
- }
-
- return interface;
-}
-
-QScriptValue JavaScriptDataEngine::jsRemoveAllData(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() < 1) {
- return context->throwError(i18n("removeAllData() takes at least one argument (the source name)"));
- }
-
- QString source = context->argument(0).toString();
- QString error;
- JavaScriptDataEngine *iFace = extractIFace(engine, error);
-
- if (iFace) {
- iFace->removeAllData(source);
- return engine->newVariant(true);
- }
-
- return context->throwError(error);
-}
-
-QScriptValue JavaScriptDataEngine::jsRemoveData(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() < 2) {
- return context->throwError(i18n("removeData() takes at least two arguments (the source and key names)"));
- }
-
- QString source = context->argument(0).toString();
- QString key = context->argument(1).toString();
- QString error;
- JavaScriptDataEngine *iFace = extractIFace(engine, error);
-
- if (iFace) {
- iFace->removeData(source, key);
- return engine->newVariant(true);
- }
-
- return context->throwError(error);
-}
-
-QScriptValue JavaScriptDataEngine::jsRemoveAllSources(QScriptContext *context, QScriptEngine *engine)
-{
- QString error;
- JavaScriptDataEngine *iFace = extractIFace(engine, error);
-
- if (iFace) {
- iFace->removeAllSources();
- return engine->newVariant(true);
- }
-
- return context->throwError(error);
-}
-
-QScriptValue JavaScriptDataEngine::serviceCtor(QScriptContext *context, QScriptEngine *engine)
-{
- QString error;
- JavaScriptDataEngine *iFace = extractIFace(engine, error);
- if (!iFace) {
- return context->throwError(error);
- }
-
- if (context->argumentCount() < 1) {
- return context->throwError(i18n("Service requires at least one parameter: the name of the service"));
- }
-
- const QString &serviceName = context->argument(0).toString();
- if (serviceName.isEmpty()) {
- return context->throwError(i18n("Service requires at least one parameter: the name of the service"));
- }
-
- JavaScriptService *service = new JavaScriptService(serviceName, iFace);
- if (service->wasFound()) {
- QScriptValue v = engine->newQObject(service, QScriptEngine::QtOwnership, QScriptEngine::ExcludeSuperClassContents);
- return v;
- }
-
- delete service;
- return context->throwError(i18n("Requested service %1 was not found in the Package.", serviceName));
-}
-
-QScriptValue JavaScriptDataEngine::callFunction(const QString &functionName, const QScriptValueList &args)
-{
- QScriptValue func = m_iface.property(functionName);
- return m_env->callFunction(func, args, m_iface);
-}
-
-void JavaScriptDataEngine::reportError(ScriptEnv *env, bool fatal) const
-{
- Q_UNUSED(fatal)
-
- kDebug() << "Error: " << env->engine()->uncaughtException().toString()
- << " at line " << env->engine()->uncaughtExceptionLineNumber() << endl;
- kDebug() << env->engine()->uncaughtExceptionBacktrace();
-}
-
-QStringList JavaScriptDataEngine::sources() const
-{
- JavaScriptDataEngine *unconst = const_cast<JavaScriptDataEngine *>(this);
- QScriptValueList args;
- QScriptValue rv = unconst->callFunction("sources", args);
- if (rv.isValid() && (rv.isVariant() || rv.isArray())) {
- return rv.toVariant().toStringList();
- }
-
- return DataEngineScript::sources();
-}
-
-bool JavaScriptDataEngine::sourceRequestEvent(const QString &name)
-{
- QScriptValueList args;
- args << name;
- m_env->callEventListeners("sourceRequestEvent", args);
- QScriptValue rv = callFunction("sourceRequestEvent", args);
- if (rv.isValid() && rv.isBool()) {
- return rv.toBool();
- }
-
- return false;
-}
-
-bool JavaScriptDataEngine::updateSourceEvent(const QString &source)
-{
- QScriptValueList args;
- args << source;
- m_env->callEventListeners("updateSourcEvent", args);
- QScriptValue rv = callFunction("updateSourceEvent", args);
- if (rv.isValid() && rv.isBool()) {
- return rv.toBool();
- }
-
- return false;
-}
-
-Plasma::Service *JavaScriptDataEngine::serviceForSource(const QString &source)
-{
- QScriptValueList args;
- args << source;
- QScriptValue rv = callFunction("serviceForSource", args);
- if (rv.isValid() && rv.isQObject()) {
- Plasma::Service *service = qobject_cast<Plasma::Service *>(rv.toQObject());
- if (service) {
- if (service->destination().isEmpty()) {
- service->setDestination(source);
- }
-
- return service;
- } else {
- delete rv.toQObject();
- }
- }
-
- return 0;
-}
-
-QString JavaScriptDataEngine::filePath(const char *type, const QString &file) const
-{
- const QString path = m_env->filePathFromScriptContext(type, file);
- if (!path.isEmpty()) {
- return path;
- }
-
- return package()->filePath(type, file);
-}
-
-bool JavaScriptDataEngine::include(const QString &script)
-{
- const QString path = filePath("scripts", script);
- if (path.isEmpty()) {
- return false;
- }
-
- return m_env->include(path);
-}
-
-K_EXPORT_PLASMA_DATAENGINESCRIPTENGINE(javascriptdataengine, JavaScriptDataEngine)
-
-#include "moc_javascriptdataengine.cpp"
-
+++ /dev/null
-/*
- * Copyright 2009 Aaron Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef JAVASCRIPTDATAENGINE_H
-#define JAVASCRIPTDATAENGINE_H
-
-#include <Plasma/DataEngineScript>
-
-#include <QScriptValue>
-
-class ScriptEnv;
-class QScriptContext;
-class QScriptEngine;
-
-class JavaScriptDataEngine : public Plasma::DataEngineScript
-{
- Q_OBJECT
- Q_PROPERTY(int sourceCount WRITE jsSetMaxSourceCount READ maxSourceCount)
- Q_PROPERTY(int minimumPollingInterval WRITE jsSetMinimumPollingInterval READ jsMinimumPollingInterval)
- Q_PROPERTY(int pollingInterval WRITE jsSetPollingInterval READ pollingInterval)
-
-public:
- JavaScriptDataEngine(QObject *parent, const QVariantList &args);
- bool init();
-
- QScriptEngine *engine() const;
- QString filePath(const char *type, const QString &file) const;
-
- QStringList sources() const;
- bool sourceRequestEvent(const QString &name);
- bool updateSourceEvent(const QString &source);
- Plasma::Service *serviceForSource(const QString &source);
-
- int maxSourceCount() const;
- void jsSetMaxSourceCount(int count);
- void jsSetMinimumPollingInterval(int interval);
- int jsMinimumPollingInterval() const;
- void jsSetPollingInterval(int interval);
- int pollingInterval() const;
-
-public Q_SLOTS:
- bool include(const QString &file);
-
-private Q_SLOTS:
- void reportError(ScriptEnv *engine, bool fatal) const;
-
-private:
- static JavaScriptDataEngine *extractIFace(QScriptEngine *engine, QString &error);
- static QScriptValue jsSetData(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue jsRemoveAllData(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue jsRemoveData(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue jsRemoveAllSources(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue serviceCtor(QScriptContext *context, QScriptEngine *engine);
-
- QScriptValue callFunction(const QString &functionName, const QScriptValueList &args);
-
- QScriptEngine *m_qscriptEngine;
- ScriptEnv *m_env;
- QScriptValue m_iface;
- int m_pollingInterval;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2010 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "javascriptservice.h"
-
-#include <QFile>
-#include <KDebug>
-#include <Plasma/ServiceJob>
-
-#include "common/scriptenv.h"
-#include "javascriptdataengine.h"
-
-JavaScriptServiceJob::JavaScriptServiceJob(QScriptEngine *engine, const QString &destination, const QString &operation,
- const QMap<QString, QVariant> ¶meters, QObject *parent)
- : Plasma::ServiceJob(destination, operation, parameters, parent),
- m_thisObject(engine->newQObject(this, QScriptEngine::QtOwnership, QScriptEngine::ExcludeSuperClassContents))
-{
-}
-
-void JavaScriptServiceJob::start()
-{
- if (!m_startFunction.isFunction()) {
- setResult(false);
- return;
- }
-
- m_startFunction.call(m_thisObject);
-}
-
-QScriptValue JavaScriptServiceJob::scriptValue() const
-{
- return m_thisObject;
-}
-
-QScriptValue JavaScriptServiceJob::startFunction() const
-{
- return m_startFunction;
-}
-
-void JavaScriptServiceJob::setStartFunction(const QScriptValue &v)
-{
- m_startFunction = v;
-}
-
-JavaScriptService::JavaScriptService(const QString &serviceName, JavaScriptDataEngine *engine)
- : Plasma::Service(engine),
- m_dataEngine(engine)
-{
- setName(serviceName);
-}
-
-JavaScriptService::~JavaScriptService()
-{
-// kDebug();
-}
-
-Plasma::ServiceJob *JavaScriptService::createJob(const QString &operation, QMap<QString, QVariant> ¶meters)
-{
- if (m_setupFunc.isFunction() && m_dataEngine && isOperationEnabled(operation)) {
- JavaScriptServiceJob *job = new JavaScriptServiceJob(m_dataEngine.data()->engine(), destination(), operation, parameters, this);
- QScriptValueList args;
- args << job->scriptValue();
- m_setupFunc.call(QScriptValue(), args);
- return job;
- }
-
- return 0;
-}
-
-bool JavaScriptService::wasFound() const
-{
- return m_dataEngine;
-}
-
-void JavaScriptService::registerOperationsScheme()
-{
- if (!m_dataEngine) {
- return;
- }
-
- const QString path = m_dataEngine.data()->filePath("services", name() + ".operations");
-
- if (path.isEmpty()) {
- kDebug() << "Cannot find operations description:" << name() << ".operations";
- m_dataEngine.clear();
- return;
- }
-
- QFile file(path);
- setOperationsScheme(&file);
-}
-
-QScriptValue JavaScriptService::setupJobFunction() const
-{
- return m_setupFunc;
-}
-
-void JavaScriptService::setSetupJobFunction(const QScriptValue &v)
-{
- m_setupFunc = v;
-}
-
-#include "moc_javascriptservice.cpp"
-
+++ /dev/null
-/*
- * Copyright 2010 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef JAVASCRIPTSERVICE_H
-#define JAVASCRIPTSERVICE_H
-
-#include <QtCore/qsharedpointer.h>
-#include <QScriptValue>
-
-#include <Plasma/Package>
-#include <Plasma/Service>
-#include <Plasma/ServiceJob>
-
-namespace Plasma
-{
- class Package;
-} // namespace Plasma
-
-class JavaScriptDataEngine;
-
-class JavaScriptServiceJob : public Plasma::ServiceJob
-{
- Q_OBJECT
- Q_PROPERTY(QString destination READ destination)
- Q_PROPERTY(QString operationName READ operationName)
- Q_PROPERTY(QVariantMap parameters READ parameters)
- Q_PROPERTY(QVariant result READ result WRITE setResult)
- Q_PROPERTY(int error READ error WRITE setError)
- Q_PROPERTY(QString errorText READ errorText WRITE setErrorText)
- Q_PROPERTY(QScriptValue start READ startFunction WRITE setStartFunction)
-
-public:
- JavaScriptServiceJob(QScriptEngine *engine, const QString &destination, const QString &operation,
- const QMap<QString, QVariant> ¶meters, QObject *parent = 0);
-
- void start();
-
- QScriptValue startFunction() const;
- void setStartFunction(const QScriptValue &v);
-
- QScriptValue scriptValue() const;
-
-private:
- QScriptValue m_startFunction;
- QScriptValue m_thisObject;
-};
-
-class JavaScriptService : public Plasma::Service
-{
- Q_OBJECT
- Q_PROPERTY(QString destination READ destination WRITE setDestination)
- Q_PROPERTY(QStringList operationNames READ operationNames)
- Q_PROPERTY(QString name READ name)
- Q_PROPERTY(QScriptValue setupJob READ setupJobFunction WRITE setSetupJobFunction)
-
-public:
- JavaScriptService(const QString &serviceName, JavaScriptDataEngine *engine);
- ~JavaScriptService();
-
- bool wasFound() const;
-
- QScriptValue setupJobFunction() const;
- void setSetupJobFunction(const QScriptValue &v);
-
-protected:
- Plasma::ServiceJob *createJob(const QString &operation, QMap<QString, QVariant> ¶meters);
- void registerOperationsScheme();
-
-private:
- QWeakPointer<JavaScriptDataEngine> m_dataEngine;
- QScriptValue m_setupFunc;
-};
-
-#endif
-
+++ /dev/null
-/*
- * Copyright 2010 Marco Martin <mart@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#define USE_JS_SCRIPTENGINE
-#include "appletinterface.cpp"
-#include "moc_appletinterface.cpp"
-
+++ /dev/null
-/*
- * Copyright 2007-2008,2010 Richard J. Moore <rich@kde.org>
- * Copyright 2009 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "simplejavascriptapplet.h"
-
-#include <iostream>
-
-#include <QFile>
-#include <QtGui/qevent.h>
-#include <QGraphicsLayout>
-#include <QtGui/qgraphicssceneevent.h>
-#include <QtGui/qgraphicssceneevent.h>
-#include <QtGui/qgraphicssceneevent.h>
-#include <QParallelAnimationGroup>
-#include <QPauseAnimation>
-#include <QSequentialAnimationGroup>
-#include <QUiLoader>
-#include <QWidget>
-#include <QScriptEngine>
-
-#include <KConfigGroup>
-#include <KDebug>
-#include <KFileDialog>
-#include <KIcon>
-#include <KIO/Job>
-#include <KMimeType>
-#include <KShell>
-#include <KStandardDirs>
-#include <KLocale>
-#include <KRun>
-
-#include <Plasma/Animation>
-#include <Plasma/Applet>
-#include <Plasma/Extender>
-#include <Plasma/ExtenderItem>
-#include <Plasma/FrameSvg>
-#include <Plasma/Package>
-#include <Plasma/PopupApplet>
-#include <Plasma/Svg>
-
-#define USE_JS_SCRIPTENGINE
-
-#include "appletinterface.h"
-#include "scriptenv.h"
-#include "simplebindings/animationgroup.h"
-#include "simplebindings/bytearrayclass.h"
-#include "simplebindings/dataengine.h"
-#include "simplebindings/dataenginereceiver.h"
-#include "simplebindings/i18n.h"
-#include "themedsvg.h"
-
-using namespace Plasma;
-
-Q_DECLARE_METATYPE(QKeyEvent*)
-Q_DECLARE_METATYPE(QPainter*)
-Q_DECLARE_METATYPE(QStyleOptionGraphicsItem*)
-Q_DECLARE_METATYPE(QGraphicsSceneHoverEvent *)
-Q_DECLARE_METATYPE(QGraphicsSceneMouseEvent *)
-Q_DECLARE_METATYPE(QGraphicsSceneWheelEvent *)
-
-QScriptValue constructColorClass(QScriptEngine *engine);
-QScriptValue constructEasingCurveClass(QScriptEngine *engine);
-QScriptValue constructFontClass(QScriptEngine *engine);
-QScriptValue constructGraphicsItemClass(QScriptEngine *engine);
-QScriptValue constructIconClass(QScriptEngine *engine);
-QScriptValue constructKUrlClass(QScriptEngine *engine);
-QScriptValue constructLinearLayoutClass(QScriptEngine *engine);
-QScriptValue constructGridLayoutClass(QScriptEngine *engine);
-QScriptValue constructAnchorLayoutClass(QScriptEngine *engine);
-QScriptValue constructPainterClass(QScriptEngine *engine);
-QScriptValue constructPenClass(QScriptEngine *engine);
-QScriptValue constructQPixmapClass(QScriptEngine *engine);
-QScriptValue constructQPointClass(QScriptEngine *engine);
-QScriptValue constructQRectFClass(QScriptEngine *engine);
-QScriptValue constructQSizeFClass(QScriptEngine *engine);
-QScriptValue constructQSizePolicyClass(QScriptEngine *engine);
-QScriptValue constructTimerClass(QScriptEngine *engine);
-void registerSimpleAppletMetaTypes(QScriptEngine *engine);
-
-KSharedPtr<UiLoader> SimpleJavaScriptApplet::s_widgetLoader;
-QHash<QString, Plasma::Animator::Animation> SimpleJavaScriptApplet::s_animationDefs;
-
-SimpleJavaScriptApplet::SimpleJavaScriptApplet(QObject *parent, const QVariantList &args)
- : AbstractJsAppletScript(parent),
- m_interface(0)
-{
- Q_UNUSED(args);
-// kDebug() << "Script applet launched, args" << applet()->startupArguments();
-
- // 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(reportError(ScriptEnv*,bool)));
-}
-
-SimpleJavaScriptApplet::~SimpleJavaScriptApplet()
-{
- delete m_interface;
- if (s_widgetLoader.count() == 1) {
- s_widgetLoader.clear();
- }
-}
-
-void SimpleJavaScriptApplet::reportError(ScriptEnv *env, bool fatal)
-{
- const QScriptValue error = env->engine()->uncaughtException();
- QString file = error.property("fileName").toString();
- file.remove(package()->path());
-
- const QString failureMsg = i18n("Error in %1 on line %2.<br><br>%3",
- file, error.property("lineNumber").toString(),
- error.toString());
- if (fatal) {
- setFailedToLaunch(true, failureMsg);
- } else {
- showMessage(KIcon("dialog-error"), failureMsg, Plasma::ButtonOk);
- }
-
- kDebug() << failureMsg;
- kDebug() << env->engine()->uncaughtExceptionBacktrace();
-}
-
-void SimpleJavaScriptApplet::configChanged()
-{
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (!env || !env->callEventListeners("configchanged")) {
- callPlasmoidFunction("configChanged", QScriptValueList(), env);
- }
-}
-
-void SimpleJavaScriptApplet::dataUpdated(const QString &name, const DataEngine::Data &data)
-{
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (!env) {
- return;
- }
-
- QScriptValueList args;
- args << m_engine->toScriptValue(name) << m_engine->toScriptValue(data);
-
- if (!env->callEventListeners("dataUpdated", args)) {
- callPlasmoidFunction("dataUpdated", args, env);
- }
-}
-
-void SimpleJavaScriptApplet::extenderItemRestored(Plasma::ExtenderItem* item)
-{
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (!env) {
- return;
- }
-
- QScriptValueList args;
- args << m_engine->newQObject(item, QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject);
-
- if (!env->callEventListeners("initExtenderItem", args)) {
- callPlasmoidFunction("initExtenderItem", args, env);
- }
-}
-
-void SimpleJavaScriptApplet::activate()
-{
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (!env || !env->callEventListeners("activate")) {
- callPlasmoidFunction("activate", QScriptValueList(), env);
- }
-}
-
-void SimpleJavaScriptApplet::popupEvent(bool popped)
-{
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (!env) {
- return;
- }
-
- QScriptValueList args;
- args << popped;
-
- if (!env->callEventListeners("popupEvent", args)) {
- callPlasmoidFunction("popupEvent", args, env);
- }
-}
-
-void SimpleJavaScriptApplet::executeAction(const QString &name)
-{
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (!env) {
- return;
- }
-
- const QString func("action_" + name);
- if (!env->callEventListeners(func)) {
- callPlasmoidFunction(func, QScriptValueList(), env);
- }
-}
-
-void SimpleJavaScriptApplet::paintInterface(QPainter *p, const QStyleOptionGraphicsItem *option, const QRect &contentsRect)
-{
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (!env) {
- return;
- }
-
- QScriptValueList args;
- args << m_engine->toScriptValue(p);
- args << m_engine->toScriptValue(const_cast<QStyleOptionGraphicsItem*>(option));
- args << m_engine->toScriptValue(QRectF(contentsRect));
-
- if (!env->callEventListeners("paintInterface")) {
- callPlasmoidFunction("paintInterface", args, env);
- }
-}
-
-QList<QAction*> SimpleJavaScriptApplet::contextualActions()
-{
- if (!m_interface) {
- return QList<QAction *>();
- }
-
- return m_interface->contextualActions();
-}
-
-void SimpleJavaScriptApplet::callPlasmoidFunction(const QString &functionName, const QScriptValueList &args, ScriptEnv *env)
-{
- if (!env) {
- env = ScriptEnv::findScriptEnv(m_engine);
- }
-
- if (env) {
- QScriptValue func = m_self.property(functionName);
- env->callFunction(func, args, m_self);
- }
-}
-
-void SimpleJavaScriptApplet::constraintsEvent(Plasma::Constraints constraints)
-{
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (!env) {
- return;
- }
-
- if (constraints & Plasma::FormFactorConstraint) {
- if (!env->callEventListeners("formFactorChanged")) {
- callPlasmoidFunction("formFactorChanged", QScriptValueList(), env);
- }
- }
-
- if (constraints & Plasma::LocationConstraint) {
- if (!env->callEventListeners("locationChanged")) {
- callPlasmoidFunction("locationChanged", QScriptValueList(), env);
- }
- }
-
- if (constraints & Plasma::SizeConstraint) {
- if (!env || !env->callEventListeners("sizeChanged")) {
- callPlasmoidFunction("sizeChanged", QScriptValueList(), env);
- }
- }
-
- if (constraints & Plasma::ImmutableConstraint) {
- if (!env->callEventListeners("immutabilityChanged")) {
- callPlasmoidFunction("immutabilityChanged", QScriptValueList(), env);
- }
- }
-}
-
-bool SimpleJavaScriptApplet::include(const QString &path)
-{
- return m_env->include(path);
-}
-
-void SimpleJavaScriptApplet::populateAnimationsHash()
-{
- if (s_animationDefs.isEmpty()) {
- s_animationDefs.insert("fade", Plasma::Animator::FadeAnimation);
- s_animationDefs.insert("geometry", Plasma::Animator::GeometryAnimation);
- s_animationDefs.insert("grow", Plasma::Animator::GrowAnimation);
- s_animationDefs.insert("pulse", Plasma::Animator::PulseAnimation);
- s_animationDefs.insert("rotate", Plasma::Animator::RotationAnimation);
- s_animationDefs.insert("rotateStacked", Plasma::Animator::RotationStackedAnimation);
- s_animationDefs.insert("slide", Plasma::Animator::SlideAnimation);
- s_animationDefs.insert("zoom", Plasma::Animator::ZoomAnimation);
- }
-}
-
-bool SimpleJavaScriptApplet::init()
-{
- connect(applet(), SIGNAL(extenderItemRestored(Plasma::ExtenderItem*)),
- this, SLOT(extenderItemRestored(Plasma::ExtenderItem*)));
- connect(applet(), SIGNAL(activate()),
- this, SLOT(activate()));
- KGlobal::locale()->insertCatalog("plasma_applet_" % description().pluginName());
- setupObjects();
-
- if (!m_env->importExtensions(description(), m_self)) {
- return false;
- }
-
- kDebug() << "ScriptName:" << applet()->name();
- kDebug() << "ScriptCategory:" << applet()->category();
- applet()->installEventFilter(this);
- return m_env->include(mainScript());
-}
-
-QScriptValue SimpleJavaScriptApplet::createKeyEventObject(QKeyEvent *event)
-{
- QScriptValue v = m_env->engine()->newObject();
- v.setProperty("count", event->count());
- v.setProperty("key", event->key());
- v.setProperty("modifiers", static_cast<int>(event->modifiers()));
- v.setProperty("text", event->text());
- return v;
-}
-
-QScriptValue SimpleJavaScriptApplet::createHoverEventObject(QGraphicsSceneHoverEvent *event)
-{
- QScriptEngine *engine = m_env->engine();
- QScriptValue v = engine->newObject();
- v.setProperty("pos", engine->toScriptValue<QPoint>(event->pos().toPoint()));
- v.setProperty("scenePos", engine->toScriptValue<QPoint>(event->scenePos().toPoint()));
- v.setProperty("screenPos", engine->toScriptValue<QPoint>(event->screenPos()));
- v.setProperty("lastPos", engine->toScriptValue<QPoint>(event->lastPos().toPoint()));
- v.setProperty("lastScenePos", engine->toScriptValue<QPoint>(event->lastScenePos().toPoint()));
- v.setProperty("lastScreenPos", engine->toScriptValue<QPoint>(event->lastScreenPos()));
- v.setProperty("modifiers", static_cast<int>(event->modifiers()));
- return v;
-}
-
-QScriptValue SimpleJavaScriptApplet::createMouseEventObject(QGraphicsSceneMouseEvent *event)
-{
- QScriptEngine *engine = m_env->engine();
- QScriptValue v = engine->newObject();
- v.setProperty("button", static_cast<int>(event->button()));
- v.setProperty("buttons", static_cast<int>(event->buttons()));
- v.setProperty("modifiers", static_cast<int>(event->modifiers()));
- v.setProperty("pos", engine->toScriptValue<QPoint>(event->pos().toPoint()));
- v.setProperty("scenePos", engine->toScriptValue<QPoint>(event->scenePos().toPoint()));
- v.setProperty("screenPos", engine->toScriptValue<QPoint>(event->screenPos()));
- v.setProperty("lastPos", engine->toScriptValue<QPoint>(event->lastPos().toPoint()));
- v.setProperty("lastScenePos", engine->toScriptValue<QPoint>(event->lastScenePos().toPoint()));
- v.setProperty("lastScreenPos", engine->toScriptValue<QPoint>(event->lastScreenPos()));
- return v;
-}
-
-QScriptValue SimpleJavaScriptApplet::createWheelEventObject(QGraphicsSceneWheelEvent *event)
-{
- QScriptEngine *engine = m_env->engine();
- QScriptValue v = engine->newObject();
- v.setProperty("delta", event->delta());
- v.setProperty("buttons", static_cast<int>(event->buttons()));
- v.setProperty("modifiers", static_cast<int>(event->modifiers()));
- v.setProperty("orientation", static_cast<int>(event->orientation()));
- v.setProperty("pos", engine->toScriptValue<QPoint>(event->pos().toPoint()));
- v.setProperty("scenePos", engine->toScriptValue<QPoint>(event->scenePos().toPoint()));
- v.setProperty("screenPos", engine->toScriptValue<QPoint>(event->screenPos()));
- return v;
-}
-
-bool SimpleJavaScriptApplet::eventFilter(QObject *watched, QEvent *event)
-{
- switch (event->type()) {
- case QEvent::KeyPress: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("keypress")) {
- QScriptValueList args;
- args << createKeyEventObject(static_cast<QKeyEvent *>(event));
- env->callEventListeners("keypress", args);
- return true;
- }
- }
-
- case QEvent::KeyRelease: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("keyrelease")) {
- QScriptValueList args;
- args << createKeyEventObject(static_cast<QKeyEvent *>(event));
- env->callEventListeners("keyrelease", args);
- return true;
- }
- }
- break;
-
- case QEvent::GraphicsSceneHoverEnter: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("hoverenter")) {
- QScriptValueList args;
- args << createHoverEventObject(static_cast<QGraphicsSceneHoverEvent *>(event));
- env->callEventListeners("hoverenter", args);
- return true;
- }
- }
- break;
-
- case QEvent::GraphicsSceneHoverLeave: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("hoverleave")) {
- QScriptValueList args;
- args << createHoverEventObject(static_cast<QGraphicsSceneHoverEvent *>(event));
- env->callEventListeners("hoverleave", args);
- return true;
- }
- }
- break;
-
- case QEvent::GraphicsSceneHoverMove: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("hovermove")) {
- QScriptValueList args;
- args << createHoverEventObject(static_cast<QGraphicsSceneHoverEvent *>(event));
- env->callEventListeners("hovermove", args);
- return true;
- }
- }
- break;
-
- case QEvent::GraphicsSceneMousePress: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("mousepress")) {
- QScriptValueList args;
- args << createMouseEventObject(static_cast<QGraphicsSceneMouseEvent *>(event));
- env->callEventListeners("mousepress", args);
- return true;
- }
- }
- break;
-
- case QEvent::GraphicsSceneMouseRelease: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("mouserelease")) {
- QScriptValueList args;
- args << createMouseEventObject(static_cast<QGraphicsSceneMouseEvent *>(event));
- env->callEventListeners("mouserelease", args);
- return true;
- }
- }
- break;
-
- case QEvent::GraphicsSceneMouseMove: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("mousemove")) {
- QScriptValueList args;
- args << createMouseEventObject(static_cast<QGraphicsSceneMouseEvent *>(event));
- env->callEventListeners("mousemove", args);
- return true;
- }
- }
- break;
-
- case QEvent::GraphicsSceneMouseDoubleClick: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("mousedoubleclick")) {
- QScriptValueList args;
- args << createMouseEventObject(static_cast<QGraphicsSceneMouseEvent *>(event));
- env->callEventListeners("mousedoubleclick", args);
- return true;
- }
- }
- break;
-
- case QEvent::GraphicsSceneWheel: {
- ScriptEnv *env = ScriptEnv::findScriptEnv(m_engine);
- if (env && env->hasEventListeners("wheel")) {
- QScriptValueList args;
- args << createWheelEventObject(static_cast<QGraphicsSceneWheelEvent *>(event));
- env->callEventListeners("wheel", args);
- return true;
- }
- }
- break;
-
- default:
- break;
- }
-
- return Plasma::AppletScript::eventFilter(watched, event);
-}
-
-void SimpleJavaScriptApplet::setupObjects()
-{
- QScriptValue global = m_engine->globalObject();
-
- // Bindings for animations
- global.setProperty("animation", m_engine->newFunction(SimpleJavaScriptApplet::animation));
- global.setProperty("AnimationGroup", m_engine->newFunction(SimpleJavaScriptApplet::animationGroup));
- global.setProperty("ParallelAnimationGroup", m_engine->newFunction(SimpleJavaScriptApplet::parallelAnimationGroup));
-
- QScriptValue v = m_engine->newVariant(QVariant::fromValue(*applet()->package()));
- global.setProperty("__plasma_package", v,
- QScriptValue::ReadOnly | QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
-
- // Bindings for data engine
-
- bindI18N(m_engine);
- global.setProperty("dataEngine", m_engine->newFunction(SimpleJavaScriptApplet::dataEngine));
- global.setProperty("service", m_engine->newFunction(SimpleJavaScriptApplet::service));
- global.setProperty("loadService", m_engine->newFunction(SimpleJavaScriptApplet::loadService));
-
- // Expose applet interface
- const bool isPopupApplet = qobject_cast<Plasma::PopupApplet *>(applet());
- m_interface = isPopupApplet ? new PopupAppletInterface(this) : new JsAppletInterface(this);
- m_self = m_engine->newQObject(m_interface, QScriptEngine::QtOwnership, QScriptEngine::ExcludeDeleteLater);
- m_env->addMainObjectProperties(m_self);
- m_self.setScope(global);
- global.setProperty("plasmoid", m_self);
-
- if (isPopupApplet) {
- connect(applet(), SIGNAL(popupEvent(bool)), this, SLOT(popupEvent(bool)));
- }
-
- QScriptValue args = m_engine->newArray();
- int i = 0;
- foreach (const QVariant &arg, applet()->startupArguments()) {
- args.setProperty(i, m_engine->newVariant(arg));
- ++i;
- }
- global.setProperty("startupArguments", args);
-
- ScriptEnv::registerEnums(global, AppletInterface::staticMetaObject);
-
- // Add a global loadui method for ui files
- QScriptValue fun = m_engine->newFunction(SimpleJavaScriptApplet::loadui);
- global.setProperty("loadui", fun);
-
- // Work around bug in 4.3.0
- qMetaTypeId<QVariant>();
-
- // Add stuff from Qt
- global.setProperty("QPainter", constructPainterClass(m_engine));
- global.setProperty("QGraphicsItem", constructGraphicsItemClass(m_engine));
- global.setProperty("QIcon", constructIconClass(m_engine));
- global.setProperty("QTimer", constructTimerClass(m_engine));
- global.setProperty("QFont", constructFontClass(m_engine));
- global.setProperty("QColor", constructColorClass(m_engine));
- global.setProperty("QEasingCurve", constructEasingCurveClass(m_engine));
- global.setProperty("QRectF", constructQRectFClass(m_engine));
- global.setProperty("QPen", constructPenClass(m_engine));
- global.setProperty("QPixmap", constructQPixmapClass(m_engine));
- global.setProperty("QSizeF", constructQSizeFClass(m_engine));
- global.setProperty("QSizePolicy", constructQSizePolicyClass(m_engine));
- global.setProperty("QPoint", constructQPointClass(m_engine));
- global.setProperty("LinearLayout", constructLinearLayoutClass(m_engine));
- global.setProperty("GridLayout", constructGridLayoutClass(m_engine));
- global.setProperty("AnchorLayout", constructAnchorLayoutClass(m_engine));
- ByteArrayClass *baClass = new ByteArrayClass(m_engine);
- global.setProperty("ByteArray", baClass->constructor());
-
- // Add stuff from KDE libs
- qScriptRegisterSequenceMetaType<KUrl::List>(m_engine);
- global.setProperty("Url", constructKUrlClass(m_engine));
-
- // Add stuff from Plasma
- global.setProperty("PlasmaSvg", m_engine->newFunction(SimpleJavaScriptApplet::newPlasmaSvg));
- global.setProperty("PlasmaFrameSvg", m_engine->newFunction(SimpleJavaScriptApplet::newPlasmaFrameSvg));
- global.setProperty("Svg", m_engine->newFunction(SimpleJavaScriptApplet::newPlasmaSvg));
- global.setProperty("FrameSvg", m_engine->newFunction(SimpleJavaScriptApplet::newPlasmaFrameSvg));
- global.setProperty("ExtenderItem", m_engine->newFunction(SimpleJavaScriptApplet::newPlasmaExtenderItem));
-
- registerSimpleAppletMetaTypes(m_engine);
- installWidgets(m_engine);
-}
-
-QScriptValue SimpleJavaScriptApplet::dataEngine(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() != 1) {
- return context->throwError(i18n("dataEngine() takes one argument"));
- }
-
- AppletInterface *interface = AppletInterface::extract(engine);
- if (!interface) {
- return context->throwError(i18n("Could not extract the Applet"));
- }
-
- const QString dataEngineName = context->argument(0).toString();
- DataEngine *dataEngine = interface->dataEngine(dataEngineName);
- QScriptValue v = engine->newQObject(dataEngine, QScriptEngine::QtOwnership, QScriptEngine::PreferExistingWrapperObject);
- v.setProperty("connectSource", engine->newFunction(DataEngineReceiver::connectSource));
- v.setProperty("connectAllSources", engine->newFunction(DataEngineReceiver::connectAllSources));
- v.setProperty("disconnectSource", engine->newFunction(DataEngineReceiver::disconnectSource));
- return v;
-}
-
-QScriptValue SimpleJavaScriptApplet::service(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() != 2) {
- return context->throwError(i18n("service() takes two arguments"));
- }
-
- QString dataEngine = context->argument(0).toString();
-
- AppletInterface *interface = AppletInterface::extract(engine);
- if (!interface) {
- return context->throwError(i18n("Could not extract the Applet"));
- }
-
- DataEngine *data = interface->dataEngine(dataEngine);
- QString source = context->argument(1).toString();
- Service *service = data->serviceForSource(source);
- //kDebug( )<< "lets try to get" << source << "from" << dataEngine;
- return engine->newQObject(service, QScriptEngine::AutoOwnership);
-}
-
-QScriptValue SimpleJavaScriptApplet::loadService(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() != 1) {
- return context->throwError(i18n("service() takes one argument"));
- }
-
- QString pluginName = context->argument(0).toString();
-
- AppletInterface *interface = AppletInterface::extract(engine);
- if (!interface) {
- return context->throwError(i18n("Could not extract the Applet"));
- }
-
- Plasma::Service *service = Plasma::Service::load(pluginName, interface);
-
- //kDebug( )<< "lets try to get" << source << "from" << dataEngine;
- return engine->newQObject(service, QScriptEngine::AutoOwnership);
-}
-
-QScriptValue SimpleJavaScriptApplet::animation(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() != 1) {
- return context->throwError(i18n("animation() takes one argument"));
- }
-
- populateAnimationsHash();
- QString name = context->argument(0).toString();
- QString animName = name.toLower();
- const bool isPause = animName == "pause";
- const bool isProperty = animName == "property";
-
- bool parentIsApplet = false;
- QGraphicsWidget *parent = extractParent(context, engine, 0, &parentIsApplet);
- QAbstractAnimation *anim = 0;
- Plasma::Animation *plasmaAnim = 0;
- if (isPause) {
- anim = new QPauseAnimation(parent);
- } else if (isProperty) {
- anim = new QPropertyAnimation(parent);
- } else if (s_animationDefs.contains(animName)) {
- plasmaAnim = Plasma::Animator::create(s_animationDefs.value(animName), parent);
- } else {
- SimpleJavaScriptApplet *jsApplet = qobject_cast<SimpleJavaScriptApplet *>(engine->parent());
- if (jsApplet) {
- //kDebug() << "trying to load it from the package";
- plasmaAnim = jsApplet->loadAnimationFromPackage(name, parent);
- }
-
- if (!plasmaAnim) {
- plasmaAnim = Plasma::Animator::create(animName, parent);
- }
- }
-
- if (plasmaAnim) {
- if (!parentIsApplet) {
- plasmaAnim->setTargetWidget(parent);
- }
- anim = plasmaAnim;
- }
-
- if (anim) {
- QScriptValue value = engine->newQObject(anim);
- ScriptEnv::registerEnums(value, *anim->metaObject());
- return value;
- }
-
- context->throwError(i18n("%1 is not a known animation type", animName));
-
- ScriptEnv *env = ScriptEnv::findScriptEnv(engine);
- if (env) {
- env->checkForErrors(false);
- }
- return engine->undefinedValue();
-}
-
-QScriptValue SimpleJavaScriptApplet::animationGroup(QScriptContext *context, QScriptEngine *engine)
-{
- QGraphicsWidget *parent = extractParent(context, engine);
- SequentialAnimationGroup *group = new SequentialAnimationGroup(parent);
- return engine->newQObject(group);
-}
-
-QScriptValue SimpleJavaScriptApplet::parallelAnimationGroup(QScriptContext *context, QScriptEngine *engine)
-{
- QGraphicsWidget *parent = extractParent(context, engine);
- ParallelAnimationGroup *group = new ParallelAnimationGroup(parent);
- return engine->newQObject(group);
-}
-
-QScriptValue SimpleJavaScriptApplet::loadui(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() != 1) {
- return context->throwError(i18n("loadui() takes one argument"));
- }
-
- QString filename = context->argument(0).toString();
- QFile f(filename);
- if (!f.open(QIODevice::ReadOnly)) {
- return context->throwError(i18n("Unable to open '%1'",filename));
- }
-
- QUiLoader loader;
- QWidget *w = loader.load(&f);
- f.close();
-
- return engine->newQObject(w, QScriptEngine::AutoOwnership);
-}
-
-QScriptValue SimpleJavaScriptApplet::newPlasmaSvg(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() == 0) {
- return context->throwError(i18n("Constructor takes at least 1 argument"));
- }
-
- const QString filename = context->argument(0).toString();
- bool parentedToApplet = false;
- QGraphicsWidget *parent = extractParent(context, engine, 1, &parentedToApplet);
- Svg *svg = new ThemedSvg(parent);
- svg->setImagePath(ThemedSvg::findSvg(engine, filename));
-
- QScriptValue obj = engine->newQObject(svg);
- ScriptEnv::registerEnums(obj, *svg->metaObject());
-
- return obj;
-}
-
-QScriptValue SimpleJavaScriptApplet::newPlasmaFrameSvg(QScriptContext *context, QScriptEngine *engine)
-{
- if (context->argumentCount() == 0) {
- return context->throwError(i18n("Constructor takes at least 1 argument"));
- }
-
- QString filename = context->argument(0).toString();
-
- bool parentedToApplet = false;
- QGraphicsWidget *parent = extractParent(context, engine, 1, &parentedToApplet);
- FrameSvg *frameSvg = new ThemedFrameSvg(parent);
- frameSvg->setImagePath(ThemedSvg::findSvg(engine, filename));
-
- QScriptValue obj = engine->newQObject(frameSvg);
- ScriptEnv::registerEnums(obj, *frameSvg->metaObject());
-
- return obj;
-}
-
-QScriptValue SimpleJavaScriptApplet::newPlasmaExtenderItem(QScriptContext *context, QScriptEngine *engine)
-{
- Plasma::Extender *extender = 0;
- if (context->argumentCount() > 0) {
- extender = qobject_cast<Plasma::Extender *>(context->argument(0).toQObject());
- }
-
- if (!extender) {
- AppletInterface *interface = AppletInterface::extract(engine);
- if (!interface) {
- engine->undefinedValue();
- }
-
- extender = interface->extender();
- }
-
- Plasma::ExtenderItem *extenderItem = new Plasma::ExtenderItem(extender);
- QScriptValue fun = engine->newQObject(extenderItem);
- ScriptEnv::registerEnums(fun, *extenderItem->metaObject());
- return fun;
-}
-
-QScriptValue SimpleJavaScriptApplet::widgetAdjustSize(QScriptContext *context, QScriptEngine *engine)
-{
- QGraphicsWidget *widget = qobject_cast<QGraphicsWidget*>(context->thisObject().toQObject());
- if (widget) {
- widget->adjustSize();
- }
- return engine->undefinedValue();
-}
-
-void SimpleJavaScriptApplet::installWidgets(QScriptEngine *engine)
-{
- QScriptValue globalObject = engine->globalObject();
- if (!s_widgetLoader) {
- s_widgetLoader = new UiLoader;
- }
-
- foreach (const QString &widget, s_widgetLoader->availableWidgets()) {
- QScriptValue fun = engine->newFunction(createWidget);
- QScriptValue name = engine->toScriptValue(widget);
- fun.setProperty(QString("functionName"), name,
- QScriptValue::ReadOnly | QScriptValue::Undeletable | QScriptValue::SkipInEnumeration);
- fun.setProperty(QString("prototype"), engine->newObject());
- globalObject.setProperty(widget, fun);
- }
-}
-
-QScriptEngine *SimpleJavaScriptApplet::engine() const
-{
- return m_engine;
-}
-
-QGraphicsWidget *SimpleJavaScriptApplet::extractParent(QScriptContext *context, QScriptEngine *engine,
- int argIndex, bool *parentedToApplet)
-{
- if (parentedToApplet) {
- *parentedToApplet = false;
- }
-
- QGraphicsWidget *parent = 0;
- if (context->argumentCount() >= argIndex) {
- parent = qobject_cast<QGraphicsWidget*>(context->argument(argIndex).toQObject());
- }
-
- if (!parent) {
- AppletInterface *interface = AppletInterface::extract(engine);
- if (!interface) {
- return 0;
- }
-
- //kDebug() << "got the applet!";
- parent = interface->applet();
-
- if (parentedToApplet) {
- *parentedToApplet = true;
- }
- }
-
- return parent;
-}
-
-QScriptValue SimpleJavaScriptApplet::createWidget(QScriptContext *context, QScriptEngine *engine)
-{
- QGraphicsWidget *parent = extractParent(context, engine);
- QString self = context->callee().property("functionName").toString();
- if (!s_widgetLoader) {
- s_widgetLoader = new UiLoader;
- }
-
- QGraphicsWidget *w = s_widgetLoader->createWidget(self, parent);
-
- if (!w) {
- return QScriptValue();
- }
-
- QScriptValue fun = engine->newQObject(w);
- fun.setPrototype(context->callee().property("prototype"));
- fun.setProperty("adjustSize", engine->newFunction(widgetAdjustSize));
-
- //register enums will be accessed for instance as frame.Sunken for Frame shadow...
- ScriptEnv::registerEnums(fun, *w->metaObject());
- return fun;
-}
-
-void SimpleJavaScriptApplet::collectGarbage()
-{
- m_engine->collectGarbage();
-}
-
-QString SimpleJavaScriptApplet::filePath(const QString &type, const QString &file) const
-{
- const QString path = m_env->filePathFromScriptContext(type.toLocal8Bit().constData(), file);
- if (!path.isEmpty()) {
- return path;
- }
-
- return package()->filePath(type.toLocal8Bit().constData(), file);
-}
-
-QScriptValue SimpleJavaScriptApplet::variantToScriptValue(QVariant var)
-{
- return m_engine->newVariant(var);
-}
-
-K_EXPORT_PLASMA_APPLETSCRIPTENGINE(qscriptapplet, SimpleJavaScriptApplet)
-
+++ /dev/null
-/*
- * Copyright 2007, 2010 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef SCRIPT_H
-#define SCRIPT_H
-
-#include <QScriptValue>
-
-#include <Plasma/Animator>
-#include <Plasma/DataEngine>
-
-#include "simplebindings/uiloader.h"
-#include "abstractjsappletscript.h"
-
-class QScriptContext;
-class QScriptEngine;
-
-class AppletInterface;
-class ScriptEnv;
-
-namespace Plasma
-{
- class ExtenderItem;
-} // namespace Plasma
-
-class SimpleJavaScriptApplet : public AbstractJsAppletScript
-{
- Q_OBJECT
-
-public:
- SimpleJavaScriptApplet(QObject *parent, const QVariantList &args);
- ~SimpleJavaScriptApplet();
- bool init();
-
-
- void paintInterface(QPainter *painter, const QStyleOptionGraphicsItem *option, const QRect &contentsRect);
- QList<QAction*> contextualActions();
- void constraintsEvent(Plasma::Constraints constraints);
- bool include(const QString &path);
- QSet<QString> loadedExtensions() const;
- QScriptValue variantToScriptValue(QVariant var);
- QString filePath(const QString &type, const QString &file) const;
-
- bool eventFilter(QObject *watched, QEvent *event);
-
- QScriptEngine *engine() const;
-
-public Q_SLOTS:
- void dataUpdated(const QString &name, const Plasma::DataEngine::Data &data);
- void configChanged();
- void executeAction(const QString &name);
- void collectGarbage();
- void extenderItemRestored(Plasma::ExtenderItem* item);
- void popupEvent(bool popped);
- void activate();
-
-private Q_SLOTS:
- void reportError(ScriptEnv *error, bool fatal);
-
-private:
- void setupObjects();
- void callPlasmoidFunction(const QString &functionName, const QScriptValueList &args = QScriptValueList(), ScriptEnv *env = 0);
- QScriptValue createKeyEventObject(QKeyEvent *event);
- QScriptValue createHoverEventObject(QGraphicsSceneHoverEvent *event);
- QScriptValue createMouseEventObject(QGraphicsSceneMouseEvent *event);
- QScriptValue createWheelEventObject(QGraphicsSceneWheelEvent *event);
- static void populateAnimationsHash();
-
- static QString findSvg(QScriptContext *context, QScriptEngine *engine, const QString &file);
- static QScriptValue animation(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue animationGroup(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue parallelAnimationGroup(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue jsi18n(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue jsi18nc(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue jsi18np(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue jsi18ncp(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue dataEngine(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue service(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue loadService(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue loadui(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue newPlasmaSvg(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue newPlasmaFrameSvg(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue newPlasmaExtenderItem(QScriptContext *context, QScriptEngine *engine);
-
- void installWidgets(QScriptEngine *engine);
- static QScriptValue createWidget(QScriptContext *context, QScriptEngine *engine);
- static QScriptValue widgetAdjustSize(QScriptContext *context, QScriptEngine *engine);
-
- static QGraphicsWidget *extractParent(QScriptContext *context,
- QScriptEngine *engine,
- int parentIndex = 0,
- bool *parentedToApplet = 0);
-
-private:
- static KSharedPtr<UiLoader> s_widgetLoader;
- static QHash<QString, Plasma::Animator::Animation> s_animationDefs;
- ScriptEnv *m_env;
- QScriptEngine *m_engine;
- QScriptValue m_self;
- QVariantList m_args;
- AppletInterface *m_interface;
- friend class AppletInterface;
-};
-
-#endif // SCRIPT_H
-
+++ /dev/null
-/*
- * Copyright 2008 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "javascriptrunner.h"
-
-#include <QFile>
-
-#include <KDebug>
-
-#include <Plasma/AbstractRunner>
-#include <Plasma/Package>
-#include <Plasma/QueryMatch>
-
-#include "scriptenv.h"
-
-typedef const Plasma::RunnerContext* ConstRunnerContextStar;
-typedef const Plasma::QueryMatch* ConstSearchMatchStar;
-
-Q_DECLARE_METATYPE(Plasma::QueryMatch*)
-Q_DECLARE_METATYPE(Plasma::RunnerContext*)
-Q_DECLARE_METATYPE(ConstRunnerContextStar)
-Q_DECLARE_METATYPE(ConstSearchMatchStar)
-
-JavaScriptRunner::JavaScriptRunner(QObject *parent, const QVariantList &args)
- : RunnerScript(parent)
-{
- Q_UNUSED(args);
-
- m_engine = new QScriptEngine(this);
- m_env = new ScriptEnv(this, m_engine);
-
- connect(m_engine, SIGNAL(reportError(ScriptEnv*,bool)), this, SLOT(reportError(ScriptEnv*,bool)));
-}
-
-JavaScriptRunner::~JavaScriptRunner()
-{
-}
-
-Plasma::AbstractRunner* JavaScriptRunner::runner() const
-{
- return RunnerScript::runner();
-}
-
-bool JavaScriptRunner::init()
-{
- setupObjects();
-
- if (!m_env->importExtensions(description(), m_self)) {
- return false;
- }
-
- QFile file(mainScript());
- if (!file.open(QIODevice::ReadOnly | QIODevice::Text) ) {
- kWarning() << "Unable to load script file";
- return false;
- }
-
- QString script = file.readAll();
- kDebug() << "Script says" << script;
-
- m_engine->evaluate(script);
- if (m_engine->hasUncaughtException()) {
- reportError(m_env, true);
- return false;
- }
-
- return m_env->include(mainScript());
-}
-
-void JavaScriptRunner::match(Plasma::RunnerContext &search)
-{
- QScriptValue fun = m_self.property("match");
- if (!fun.isFunction()) {
- kDebug() << "Script: match is not a function, " << fun.toString();
- return;
- }
-
- QScriptValueList args;
- args << m_engine->toScriptValue(&search);
-
- QScriptContext *ctx = m_engine->pushContext();
- ctx->setActivationObject(m_self);
- fun.call(m_self, args);
- m_engine->popContext();
-
- if (m_engine->hasUncaughtException()) {
- reportError(m_env, false);
- m_engine->clearExceptions();
- }
-}
-
-void JavaScriptRunner::exec(const Plasma::RunnerContext *search, const Plasma::QueryMatch *action)
-{
- QScriptValue fun = m_self.property("exec");
- if (!fun.isFunction()) {
- kDebug() << "Script: exec is not a function, " << fun.toString();
- return;
- }
-
- QScriptValueList args;
- args << m_engine->toScriptValue(search);
- args << m_engine->toScriptValue(action);
-
- QScriptContext *ctx = m_engine->pushContext();
- ctx->setActivationObject(m_self);
- fun.call(m_self, args);
- m_engine->popContext();
-
- if (m_engine->hasUncaughtException()) {
- reportError(m_env, false);
- m_engine->clearExceptions();
- }
-}
-
-void JavaScriptRunner::setupObjects()
-{
- QScriptValue global = m_engine->globalObject();
-
- // Expose the runner
- m_self = m_engine->newQObject(this);
- m_self.setScope(global);
- m_env->addMainObjectProperties(m_self);
-
- global.setProperty("runner", m_self);
-}
-
-void JavaScriptRunner::reportError(ScriptEnv *env, bool fatal)
-{
- Q_UNUSED(fatal)
- kDebug() << "Error: " << env->engine()->uncaughtException().toString()
- << " at line " << env->engine()->uncaughtExceptionLineNumber() << endl;
- kDebug() << env->engine()->uncaughtExceptionBacktrace();
-}
-
-QString JavaScriptRunner::filePath(const char *type, const QString &file) const
-{
- const QString path = m_env->filePathFromScriptContext(type, file);
- if (!path.isEmpty()) {
- return path;
- }
-
- return package()->filePath(type, file);
-}
-
-bool JavaScriptRunner::include(const QString &script)
-{
- const QString path = filePath("scripts", script);
- if (path.isEmpty()) {
- return false;
- }
-
- return m_env->include(path);
-}
-
-#include "moc_javascriptrunner.cpp"
+++ /dev/null
-// -*- c++ -*-
-
-/*
- * Copyright 2008 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef JAVASCRIPTRUNNER_H
-#define JAVASCRIPTRUNNER_H
-
-#include <QScriptValue>
-
-#include <Plasma/RunnerScript>
-
-class QScriptEngine;
-
-class ScriptEnv;
-
-class JavaScriptRunner : public Plasma::RunnerScript
-{
- Q_OBJECT
-
-public:
- JavaScriptRunner(QObject *parent, const QVariantList &args);
- ~JavaScriptRunner();
-
- bool init();
-
- /** Reimplemented to add Q_INVOKABLE. */
- Q_INVOKABLE Plasma::AbstractRunner* runner() const;
-
- /** Reimplemented to forward to script. */
- void match(Plasma::RunnerContext &search);
-
- /** Reimplemented to forward to script. */
- void exec(const Plasma::RunnerContext *search, const Plasma::QueryMatch *action);
-
-public Q_SLOTS:
- bool include(const QString &script);
-
-private:
- void setupObjects();
- void importExtensions();
- void reportError(ScriptEnv *engine, bool fatal);
- QString filePath(const char *type, const QString &file) const;
-
- QScriptEngine *m_engine;
- ScriptEnv *m_env;
- QScriptValue m_self;
-};
-
-K_EXPORT_PLASMA_RUNNERSCRIPTENGINE(qscriptrunner, JavaScriptRunner)
-
-#endif // JAVASCRIPTRUNNER_H
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- * Copyright 2009 Artur Duque de Souza <asouza@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QGraphicsWidget>
-#include <QGraphicsAnchorLayout>
-
-#include <Plasma/Applet>
-
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QScript::Pointer<QGraphicsItem>::wrapped_pointer_type)
-Q_DECLARE_METATYPE(QGraphicsWidget*)
-Q_DECLARE_METATYPE(QGraphicsAnchor*)
-Q_DECLARE_METATYPE(QGraphicsLayoutItem*)
-DECLARE_POINTER_METATYPE(QGraphicsAnchorLayout)
-
-// QGraphicsAnchorLayout
-DECLARE_VOID_NUMBER_METHOD(QGraphicsAnchorLayout, setSpacing)
-DECLARE_NUMBER_GET_SET_METHODS(QGraphicsAnchorLayout, horizontalSpacing, setHorizontalSpacing)
-DECLARE_NUMBER_GET_SET_METHODS(QGraphicsAnchorLayout, verticalSpacing, setVerticalSpacing)
-DECLARE_VOID_NUMBER_METHOD(QGraphicsAnchorLayout, removeAt)
-
-
-/////////////////////////////////////////////////////////////
-
-QGraphicsLayoutItem *extractLayoutItem(QScriptContext *ctx, int index = 0, bool noExistingLayout = false);
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- QGraphicsLayoutItem *parent = extractLayoutItem(ctx, 0, true);
- //FIXME: don't leak memory when parent is 0
- return qScriptValueFromValue(eng, new QGraphicsAnchorLayout(parent));
-}
-
-BEGIN_DECLARE_METHOD(QGraphicsAnchorLayout, addAnchor) {
- QGraphicsLayoutItem *item1 = extractLayoutItem(ctx, 0);
- QGraphicsLayoutItem *item2 = extractLayoutItem(ctx, 2);
-
- if (!item1 || !item2) {
- return eng->undefinedValue();
- }
-
- QGraphicsAnchor *anchor = self->addAnchor(item1, static_cast<Qt::AnchorPoint>(ctx->argument(1).toInt32()),
- item2, static_cast<Qt::AnchorPoint>(ctx->argument(3).toInt32()));
-
- return eng->newQObject(anchor, QScriptEngine::QtOwnership);
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsAnchorLayout, anchor) {
- QGraphicsLayoutItem *item1 = extractLayoutItem(ctx, 0);
- QGraphicsLayoutItem *item2 = extractLayoutItem(ctx, 2);
-
- if (!item1 || !item2) {
- return eng->undefinedValue();
- }
-
- QGraphicsAnchor *anchor = self->anchor(item1, static_cast<Qt::AnchorPoint>(ctx->argument(1).toInt32()),
- item2, static_cast<Qt::AnchorPoint>(ctx->argument(3).toInt32()));
-
- return eng->newQObject(anchor, QScriptEngine::QtOwnership);
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsAnchorLayout, addCornerAnchors) {
- QGraphicsLayoutItem *item1 = extractLayoutItem(ctx, 0);
- QGraphicsLayoutItem *item2 = extractLayoutItem(ctx, 2);
-
- if (!item1 || !item2) {
- return eng->undefinedValue();
- }
-
- self->addCornerAnchors(item1, static_cast<Qt::Corner>(ctx->argument(1).toInt32()),
- item2, static_cast<Qt::Corner>(ctx->argument(3).toInt32()));
-
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsAnchorLayout, addAnchors) {
- QGraphicsLayoutItem *item1 = extractLayoutItem(ctx, 0);
- QGraphicsLayoutItem *item2 = extractLayoutItem(ctx, 1);
-
- if (!item1 || !item2) {
- return eng->undefinedValue();
- }
-
- self->addAnchors(item1, item2, static_cast<Qt::Orientation>(ctx->argument(2).toInt32()));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsAnchorLayout, toString) {
- return QScriptValue(eng, "QGraphicsAnchorLayout");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsAnchorLayout, activate) {
- self->activate();
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-/////////////////////////////////////////////////////////////
-/////////////////////////////////////////////////////////////
-
-class PrototypeAnchorLayout : public QGraphicsAnchorLayout
-{
-public:
- PrototypeAnchorLayout()
- { }
-};
-
-QScriptValue constructAnchorLayoutClass(QScriptEngine *eng)
-{
- QScriptValue proto =
- QScript::wrapPointer<QGraphicsAnchorLayout>(eng,
- new QGraphicsAnchorLayout(),
- QScript::UserOwnership);
- const QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- const QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
-
- proto.setProperty("horizontalSpacing", eng->newFunction(horizontalSpacing), getter);
- proto.setProperty("horizontalSpacing", eng->newFunction(setHorizontalSpacing), setter);
- proto.setProperty("verticalSpacing", eng->newFunction(verticalSpacing), getter);
- proto.setProperty("verticalSpacing", eng->newFunction(setVerticalSpacing), setter);
-
- ADD_METHOD(proto, setSpacing);
- ADD_METHOD(proto, removeAt);
- ADD_METHOD(proto, addAnchor);
- ADD_METHOD(proto, anchor);
- ADD_METHOD(proto, addAnchors);
- ADD_METHOD(proto, addCornerAnchors);
- ADD_METHOD(proto, toString);
- ADD_METHOD(proto, activate);
-
- QScript::registerPointerMetaType<QGraphicsAnchorLayout>(eng, proto);
-
- QScriptValue ctorFun = eng->newFunction(ctor, proto);
- return ctorFun;
-}
+++ /dev/null
-/*
- * Copyright 2009 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "animationgroup.h"
-
-ParallelAnimationGroup::ParallelAnimationGroup(QObject *parent)
- : QParallelAnimationGroup(parent)
-{
-}
-
-void ParallelAnimationGroup::addAnimation(QAbstractAnimation *animation)
-{
- QParallelAnimationGroup::addAnimation(animation);
-}
-
-QAbstractAnimation *ParallelAnimationGroup::animationAt(int index) const
-{
- return QParallelAnimationGroup::animationAt(index);
-}
-
-int ParallelAnimationGroup::animationCount() const
-{
- return QParallelAnimationGroup::animationCount();
-}
-
-void ParallelAnimationGroup::clear()
-{
- QParallelAnimationGroup::clear();
-}
-
-int ParallelAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const
-{
- return QParallelAnimationGroup::indexOfAnimation(animation);
-}
-
-void ParallelAnimationGroup::insertAnimation(int index, QAbstractAnimation *animation)
-{
- QParallelAnimationGroup::insertAnimation(index, animation);
-}
-
-void ParallelAnimationGroup::removeAnimation(QAbstractAnimation *animation)
-{
- QParallelAnimationGroup::removeAnimation(animation);
-}
-
-
-SequentialAnimationGroup::SequentialAnimationGroup(QObject *parent)
- : QSequentialAnimationGroup(parent)
-{
-}
-
-void SequentialAnimationGroup::addAnimation(QAbstractAnimation *animation)
-{
- QSequentialAnimationGroup::addAnimation(animation);
-}
-
-QAbstractAnimation *SequentialAnimationGroup::animationAt(int index) const
-{
- return QSequentialAnimationGroup::animationAt(index);
-}
-
-int SequentialAnimationGroup::animationCount() const
-{
- return QSequentialAnimationGroup::animationCount();
-}
-
-void SequentialAnimationGroup::clear()
-{
- QSequentialAnimationGroup::clear();
-}
-
-int SequentialAnimationGroup::indexOfAnimation(QAbstractAnimation *animation) const
-{
- return QSequentialAnimationGroup::indexOfAnimation(animation);
-}
-
-void SequentialAnimationGroup::insertAnimation(int index, QAbstractAnimation *animation)
-{
- QSequentialAnimationGroup::insertAnimation(index, animation);
-}
-
-void SequentialAnimationGroup::removeAnimation(QAbstractAnimation *animation)
-{
- QSequentialAnimationGroup::removeAnimation(animation);
-}
-
-#include "moc_animationgroup.cpp"
+++ /dev/null
-/****************************************************************************
-**
-** This file is part of the Qt Script Generator.
-**
-** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
-**
-** Contact: Nokia Corporation info@qt.nokia.com
-**
-** GNU Lesser General Public License Usage
-** This file may be used under the terms of the GNU Lesser General Public
-** License version 2.1 as published by the Free Software Foundation
-** and appearing in the file LICENSE.LGPL included in the packaging of
-** this file. Please review the following information to ensure the GNU
-** Lesser General Public License version 2.1 requirements will be met:
-** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
-**
-** Copyright (C) 2011 Nokia. All rights reserved
-****************************************************************************/
-#ifndef QTSCRIPTEXTENSIONS_GLOBAL_H
-#define QTSCRIPTEXTENSIONS_GLOBAL_H
-
-#include <QtCore/QSharedData>
-
-#include <QPixmap>
-Q_DECLARE_METATYPE(QPixmap*)
-Q_DECLARE_METATYPE(QPixmap)
-
-#define DECLARE_SELF(Class, __fn__) \
- Class* self = qscriptvalue_cast<Class*>(ctx->thisObject()); \
- if (!self) { \
- return ctx->throwError(QScriptContext::TypeError, \
- QString::fromLatin1("%0.prototype.%1: this object is not a %0") \
- .arg(#Class).arg(#__fn__)); \
- }
-
-#define DECLARE_SELF2(Class, __fn__, __ret__) \
- Class* self = qscriptvalue_cast<Class*>(thisObject()); \
- if (!self) { \
- context()->throwError(QScriptContext::TypeError, \
- QString::fromLatin1("%0.prototype.%1: this object is not a %0") \
- .arg(#Class).arg(#__fn__)); \
- return __ret__; \
- }
-
-
-
-#define ADD_METHOD(__p__, __f__) \
- __p__.setProperty(#__f__, __p__.engine()->newFunction(__f__))
-
-#define ADD_GET_METHOD(__p__, __get__) \
- ADD_METHOD(__p__, __get__)
-
-#define ADD_GET_SET_METHODS(__p__, __get__, __set__) \
-do { \
- ADD_METHOD(__p__, __get__); \
- ADD_METHOD(__p__, __set__); \
-} while (0);
-
-#define ADD_CTOR_FUNCTION(__c__, __f__) ADD_METHOD(__c__, __f__)
-
-#define ADD_ENUM_VALUE(__c__, __ns__, __v__) \
- __c__.setProperty(#__v__, QScriptValue(__c__.engine(), __ns__::__v__))
-
-
-#define BEGIN_DECLARE_METHOD(Class, __mtd__) \
-static QScriptValue __mtd__(QScriptContext *ctx, QScriptEngine *eng) \
-{ \
- DECLARE_SELF(Class, __mtd__);
-
-#define END_DECLARE_METHOD \
-}
-
-
-#define DECLARE_GET_METHOD(Class, __get__) \
-BEGIN_DECLARE_METHOD(Class, __get__) { \
- return qScriptValueFromValue(eng, self->__get__()); \
-} END_DECLARE_METHOD
-
-#define DECLARE_SET_METHOD(Class, T, __set__) \
-BEGIN_DECLARE_METHOD(Class, __set__) { \
- self->__set__(qscriptvalue_cast<T>(ctx->argument(0))); \
- return eng->undefinedValue(); \
-} END_DECLARE_METHOD
-
-#define DECLARE_GET_SET_METHODS(Class, T, __get__, __set__) \
-DECLARE_GET_METHOD(Class, /*T,*/ __get__) \
-DECLARE_SET_METHOD(Class, T, __set__)
-
-
-
-#define DECLARE_SIMPLE_GET_METHOD(Class, __get__) \
-BEGIN_DECLARE_METHOD(Class, __get__) { \
- return QScriptValue(eng, self->__get__()); \
-} END_DECLARE_METHOD
-
-#define DECLARE_SIMPLE_SET_METHOD(Class, ToType, __set__) \
-BEGIN_DECLARE_METHOD(Class, __set__) { \
- self->__set__(ctx->argument(0).ToType()); \
- return eng->undefinedValue(); \
-} END_DECLARE_METHOD
-
-#define DECLARE_BOOLEAN_GET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_GET_METHOD(Class, __set__)
-#define DECLARE_BOOLEAN_SET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_SET_METHOD(Class, toBoolean, __set__)
-
-#define DECLARE_INT_GET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_GET_METHOD(Class, __set__)
-#define DECLARE_INT_SET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_SET_METHOD(Class, toInt32, __set__)
-
-#define DECLARE_NUMBER_GET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_GET_METHOD(Class, __set__)
-#define DECLARE_NUMBER_SET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_SET_METHOD(Class, toNumber, __set__)
-
-#define DECLARE_STRING_GET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_GET_METHOD(Class, __set__)
-#define DECLARE_STRING_SET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_SET_METHOD(Class, toString, __set__)
-
-#define DECLARE_QOBJECT_GET_METHOD(Class, __get__) \
-BEGIN_DECLARE_METHOD(Class, __get__) { \
- return eng->newQObject(self->__get__()); \
-} END_DECLARE_METHOD
-#define DECLARE_QOBJECT_SET_METHOD(Class, __set__) \
- DECLARE_SIMPLE_SET_METHOD(Class, toQObject, __set__)
-
-#define DECLARE_BOOLEAN_GET_SET_METHODS(Class, __get__, __set__) \
- DECLARE_BOOLEAN_GET_METHOD(Class, __get__) \
- DECLARE_BOOLEAN_SET_METHOD(Class, __set__)
-
-#define DECLARE_NUMBER_GET_SET_METHODS(Class, __get__, __set__) \
- DECLARE_NUMBER_GET_METHOD(Class, __get__) \
- DECLARE_NUMBER_SET_METHOD(Class, __set__)
-
-#define DECLARE_INT_GET_SET_METHODS(Class, __get__, __set__) \
- DECLARE_INT_GET_METHOD(Class, __get__) \
- DECLARE_INT_SET_METHOD(Class, __set__)
-
-#define DECLARE_STRING_GET_SET_METHODS(Class, __get__, __set__) \
- DECLARE_STRING_GET_METHOD(Class, __get__) \
- DECLARE_STRING_SET_METHOD(Class, __set__)
-
-#define DECLARE_QOBJECT_GET_SET_METHODS(Class, __get__, __set__) \
- DECLARE_QOBJECT_GET_METHOD(Class, __get__) \
- DECLARE_QOBJECT_SET_METHOD(Class, __set__)
-
-
-#define DECLARE_VOID_METHOD(Class, __fun__) \
-BEGIN_DECLARE_METHOD(Class, __fun__) { \
- self->__fun__(); \
- return eng->undefinedValue(); \
-} END_DECLARE_METHOD
-
-#define DECLARE_VOID_NUMBER_METHOD(Class, __fun__) \
-BEGIN_DECLARE_METHOD(Class, __fun__) { \
- self->__fun__(ctx->argument(0).toNumber()); \
- return eng->undefinedValue(); \
-} END_DECLARE_METHOD
-
-#define DECLARE_VOID_NUMBER_NUMBER_METHOD(Class, __fun__) \
-BEGIN_DECLARE_METHOD(Class, __fun__) { \
- self->__fun__(ctx->argument(0).toNumber(), ctx->argument(1).toNumber()); \
- return eng->undefinedValue(); \
-} END_DECLARE_METHOD
-
-#define DECLARE_VOID_QUAD_NUMBER_METHOD(Class, __fun__) \
-BEGIN_DECLARE_METHOD(Class, __fun__) { \
- self->__fun__(ctx->argument(0).toNumber(), ctx->argument(1).toNumber(), ctx->argument(2).toNumber(), ctx->argument(3).toNumber()); \
- return eng->undefinedValue(); \
-} END_DECLARE_METHOD
-
-#define DECLARE_VOID_1ARG_METHOD(Class, ArgType, __fun__) \
-BEGIN_DECLARE_METHOD(Class, __fun__) { \
- self->__fun__(qscriptvalue_cast<ArgType>(ctx->argument(0))); \
- return eng->undefinedValue(); \
-} END_DECLARE_METHOD
-
-#define DECLARE_BOOLEAN_1ARG_METHOD(Class, ArgType, __fun__) \
-BEGIN_DECLARE_METHOD(Class, __fun__) { \
- return QScriptValue(eng, self->__fun__(qscriptvalue_cast<ArgType>(ctx->argument(0)))); \
-} END_DECLARE_METHOD
-
-
-#define DECLARE_POINTER_METATYPE(T) \
- Q_DECLARE_METATYPE(T*) \
- Q_DECLARE_METATYPE(QScript::Pointer<T>::wrapped_pointer_type)
-
-namespace QScript
-{
-
-enum {
- UserOwnership = 1
-};
-
-template <typename T>
-class Pointer : public QSharedData
-{
-public:
- typedef T* pointer_type;
- typedef QExplicitlySharedDataPointer<Pointer<T> > wrapped_pointer_type;
-
- ~Pointer()
- {
- if (!(m_flags & UserOwnership))
- delete m_value;
- }
-
- operator T*()
- {
- return m_value;
- }
-
- operator const T*() const
- {
- return m_value;
- }
-
- static wrapped_pointer_type create(T *value, uint flags = 0)
- {
- return wrapped_pointer_type(new Pointer(value, flags));
- }
-
- static QScriptValue toScriptValue(QScriptEngine *engine, T* const &source)
- {
- if (!source)
- return engine->nullValue();
- return engine->newVariant(QVariant::fromValue(source));
- }
-
- static void fromScriptValue(const QScriptValue &value, T* &target)
- {
- if (value.isVariant()) {
- QVariant var = value.toVariant();
- if (var.canConvert<T*>()) {
- target = qvariant_cast<T*>(var);
- } else if (var.canConvert<wrapped_pointer_type>()) {
- target = qvariant_cast<wrapped_pointer_type>(var)->operator T*();
- } else {
- // look in prototype chain
- target = 0;
- int type = qMetaTypeId<T*>();
- int pointerType = qMetaTypeId<wrapped_pointer_type>();
- QScriptValue proto = value.prototype();
- while (proto.isObject() && proto.isVariant()) {
- int protoType = proto.toVariant().userType();
- if ((type == protoType) || (pointerType == protoType)) {
- QByteArray name = QMetaType::typeName(var.userType());
- if (name.startsWith("QScript::Pointer<")) {
- target = (*reinterpret_cast<wrapped_pointer_type*>(var.data()))->operator T*();
- break;
- } else {
- target = static_cast<T*>(var.data());
- break;
- }
- }
- proto = proto.prototype();
- }
- }
- } else if (value.isQObject()) {
- QObject *qobj = value.toQObject();
- QByteArray typeName = QMetaType::typeName(qMetaTypeId<T*>());
- target = reinterpret_cast<T*>(qobj->qt_metacast(typeName.left(typeName.size()-1)));
- } else {
- target = 0;
- }
- }
-
- uint flags() const
- { return m_flags; }
- void setFlags(uint flags)
- { m_flags = flags; }
- void unsetFlags(uint flags)
- { m_flags &= ~flags; }
-
-protected:
- Pointer(T* value, uint flags)
- : m_flags(flags), m_value(value)
- {}
-
-private:
- uint m_flags;
- T* m_value;
-};
-
-template <typename T>
-int registerPointerMetaType(
- QScriptEngine *eng,
- const QScriptValue &prototype = QScriptValue(),
- T * /* dummy */ = 0
-)
-{
- QScriptValue (*mf)(QScriptEngine *, T* const &) = Pointer<T>::toScriptValue;
- void (*df)(const QScriptValue &, T* &) = Pointer<T>::fromScriptValue;
- const int id = qMetaTypeId<T*>();
- qScriptRegisterMetaType_helper(
- eng, id, reinterpret_cast<QScriptEngine::MarshalFunction>(mf),
- reinterpret_cast<QScriptEngine::DemarshalFunction>(df),
- prototype);
- eng->setDefaultPrototype(qMetaTypeId<typename Pointer<T>::wrapped_pointer_type>(), prototype);
- return id;
-}
-
-inline void maybeReleaseOwnership(const QScriptValue &value)
-{
- if (value.isVariant()) {
- QVariant var = value.toVariant();
- QByteArray name = QMetaType::typeName(var.userType());
- if (name.startsWith("QScript::Pointer<"))
- (*reinterpret_cast<Pointer<void*>::wrapped_pointer_type *>(var.data()))->setFlags(UserOwnership);
- }
-}
-
-inline void maybeTakeOwnership(const QScriptValue &value)
-{
- if (value.isVariant()) {
- QVariant var = value.toVariant();
- QByteArray name = QMetaType::typeName(var.userType());
- if (name.startsWith("QScript::Pointer<"))
- (*reinterpret_cast<Pointer<void*>::wrapped_pointer_type *>(var.data()))->unsetFlags(UserOwnership);
- }
-}
-
-template <class T>
-inline QScriptValue wrapPointer(QScriptEngine *eng, T *ptr, uint flags = 0)
-{
- return eng->newVariant(QVariant::fromValue(Pointer<T>::create(ptr, flags)));
-}
-
-} // namespace QScript
-
-#ifdef QGRAPHICSITEM_H
-
-namespace QScript {
-
-template <class T>
-inline QScriptValue wrapGVPointer(QScriptEngine *eng, T *item)
-{
- uint flags = item->parentItem() ? UserOwnership : 0;
- return wrapPointer<T>(eng, item, flags);
-}
-
-} // namespace QScript
-
-#endif // QGRAPHICSITEM_H
-
-#endif // QTSCRIPTEXTENSIONS_GLOBAL_H
+++ /dev/null
-/*
- * Copyright (c) 2009 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QColor>
-
-#include <KDebug>
-
-#include <Plasma/Theme>
-
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QColor*)
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() == 0) {
- return qScriptValueFromValue(eng, QColor());
- } else if (ctx->argumentCount() == 1) {
- QString namedColor = ctx->argument(0).toString();
- return qScriptValueFromValue(eng, QColor(namedColor));
- }
-
- int r = 0;
- int g = 0;
- int b = 0;
- int a = 255;
- if (ctx->argumentCount() == 3) {
- r = ctx->argument(0).toInt32();
- g = ctx->argument(1).toInt32();
- b = ctx->argument(2).toInt32();
- }
-
- if (ctx->argumentCount() == 4) {
- a = ctx->argument(3).toInt32();
- }
-
- return qScriptValueFromValue(eng, QColor(r, g, b, a));
-}
-
-// red, green, blue, alpha, setRed, setGreen, setBlue, setAlpha, isValid, toString, name
-
-static QScriptValue red(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QColor, red);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setRed(arg.toInt32());
- }
-
- return QScriptValue(eng, self->red());
-}
-
-static QScriptValue green(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QColor, green);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setGreen(arg.toInt32());
- }
-
- return QScriptValue(eng, self->green());
-}
-
-static QScriptValue blue(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QColor, blue);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setBlue(arg.toInt32());
- }
-
- return QScriptValue(eng, self->blue());
-}
-
-static QScriptValue alpha(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QColor, alpha);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setAlpha(arg.toInt32());
- }
-
- return QScriptValue(eng, self->alpha());
-}
-
-static QScriptValue valid(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QColor, valid);
- return QScriptValue(eng, self->isValid());
-}
-
-static QScriptValue setThemeColor(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QColor, themeColor);
-
- if (ctx->argumentCount() > 0) {
- const qint32 arg = ctx->argument(0).toInt32();
- if (arg >= 0 && arg <= Plasma::Theme::VisitedLinkColor) {
- kDebug() << "setting to: " << static_cast<Plasma::Theme::ColorRole>(arg);
- kDebug() << "color is: " << Plasma::Theme::defaultTheme()->color(static_cast<Plasma::Theme::ColorRole>(arg));
- self->setRgba(Plasma::Theme::defaultTheme()->color(static_cast<Plasma::Theme::ColorRole>(arg)).rgba());
- }
- }
-
- return ctx->thisObject();//.property("themeColor");
-}
-
-QScriptValue constructColorClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QColor());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
- proto.setProperty("red", eng->newFunction(red), getter | setter);
- proto.setProperty("green", eng->newFunction(green), getter | setter);
- proto.setProperty("blue", eng->newFunction(blue), getter | setter);
- proto.setProperty("alpha", eng->newFunction(alpha), getter | setter);
- proto.setProperty("valid", eng->newFunction(valid), getter);
- ADD_METHOD(proto, setThemeColor);
-
- eng->setDefaultPrototype(qMetaTypeId<QColor>(), proto);
- eng->setDefaultPrototype(qMetaTypeId<QColor*>(), proto);
-
- return eng->newFunction(ctor, proto);
-}
+++ /dev/null
-/*
- * Copyright 2010 Aaron Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QEasingCurve>
-#include <QtCore/qmetaobject.h>
-#include <QScriptValue>
-#include <QScriptEngine>
-#include <QScriptContext>
-#include <QScriptable>
-
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QEasingCurve)
-Q_DECLARE_METATYPE(QEasingCurve*)
-
-#include <KDebug>
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- if (arg.isNumber()) {
- qint32 type = arg.toInt32();
- if (type > -1 && type < QEasingCurve::Custom) {
- return qScriptValueFromValue(eng, QEasingCurve(static_cast<QEasingCurve::Type>(type)));
- }
- }
- }
-
- return qScriptValueFromValue(eng, QEasingCurve());
-}
-
-static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QEasingCurve, toString);
- return QScriptValue(eng, QString::fromLatin1("QEasingCurve(type=%0)").arg(self->type()));
-}
-
-static QScriptValue type(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QEasingCurve, type);
-
- if (ctx->argumentCount()) {
- QScriptValue arg = ctx->argument(0);
-
- qint32 type = -1;
- if (arg.isNumber()) {
- type = arg.toInt32();
- } else if (arg.isString()) {
- QMetaObject meta = QEasingCurve::staticMetaObject;
- QMetaEnum easingCurveEnum = meta.enumerator(meta.indexOfEnumerator("Type"));
-
- type = easingCurveEnum.keyToValue(arg.toString().toAscii().data());
- }
- if (type > -1 && type < QEasingCurve::Custom) {
- self->setType(static_cast<QEasingCurve::Type>(type));
- }
- }
-
- return QScriptValue(eng, self->type());
-}
-
-static QScriptValue valueForProgress(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QEasingCurve, valueForProgress);
- if (ctx->argumentCount() < 1 || !ctx->argument(0).isNumber()) {
- return eng->undefinedValue();
- }
-
- return self->valueForProgress(ctx->argument(0).toNumber());
-}
-
-QScriptValue constructEasingCurveClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QEasingCurve());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
-
- proto.setProperty("type", eng->newFunction(type), getter | setter);
- proto.setProperty("toString", eng->newFunction(toString), getter);
- proto.setProperty("valueForProgress", eng->newFunction(valueForProgress), getter);
-
- QScriptValue ctorFun = eng->newFunction(ctor, proto);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, Linear);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InQuad);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutQuad);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutQuad);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInQuad);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InCubic);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutCubic);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutCubic);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInCubic);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InQuart);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutQuart);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutQuart);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInQuart);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InQuint);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutQuint);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutQuint);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInQuint);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InSine);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutSine);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutSine);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInSine);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InExpo);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutExpo);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutExpo);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInExpo);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InCirc);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutCirc);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutCirc);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInCirc);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InElastic);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutElastic);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutElastic);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInElastic);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InBack);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutBack);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutBack);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutInBack);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InBounce);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutBounce);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InOutBounce);
-
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, InCurve);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, OutCurve);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, SineCurve);
- ADD_ENUM_VALUE(ctorFun, QEasingCurve, CosineCurve);
-
- eng->setDefaultPrototype(qMetaTypeId<QEasingCurve>(), proto);
- eng->setDefaultPrototype(qMetaTypeId<QEasingCurve*>(), proto);
-
- return ctorFun;
-}
-
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QFont>
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QFont*)
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() == 0)
- return qScriptValueFromValue(eng, QFont());
- QString family = ctx->argument(0).toString();
- if (ctx->argumentCount() == 1) {
- QFont *other = qscriptvalue_cast<QFont*>(ctx->argument(0));
- if (other)
- return qScriptValueFromValue(eng, QFont(*other));
- return qScriptValueFromValue(eng, QFont(family));
- }
- int pointSize = ctx->argument(1).toInt32();
- if (ctx->argumentCount() == 2)
- return qScriptValueFromValue(eng, QFont(family, pointSize));
- int weight = ctx->argument(2).toInt32();
- if (ctx->argumentCount() == 3)
- return qScriptValueFromValue(eng, QFont(family, pointSize, weight));
- bool italic = ctx->argument(3).toBoolean();
- return qScriptValueFromValue(eng, QFont(family, pointSize, weight, italic));
-}
-
-static QScriptValue bold(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, bold);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setBold(arg.toBoolean());
- }
-
- return QScriptValue(eng, self->bold());
-}
-
-static QScriptValue defaultFamily(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, defaultFamily);
- return QScriptValue(eng, self->defaultFamily());
-}
-
-static QScriptValue exactMatch(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, exactMatch);
- return QScriptValue(eng, self->exactMatch());
-}
-
-static QScriptValue family(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, family);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setFamily(arg.toString());
- }
-
- return QScriptValue(eng, self->family());
-}
-
-static QScriptValue fixedPitch(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, fixedPitch);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setFixedPitch(arg.toBoolean());
- }
-
- return QScriptValue(eng, self->fixedPitch());
-}
-
-static QScriptValue fromString(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, fromString);
- return QScriptValue(eng, self->fromString(ctx->argument(0).toString()));
-}
-
-static QScriptValue isCopyOf(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, isCopyOf);
- QFont *other = qscriptvalue_cast<QFont*>(ctx->argument(0));
- if (!other) {
- return ctx->throwError(QScriptContext::TypeError,
- "QFont.prototype.isCopyOf: argument is not a Font");
- }
- return QScriptValue(eng, self->isCopyOf(*other));
-}
-
-static QScriptValue italic(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, italic);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setItalic(arg.toBoolean());
- }
-
- return QScriptValue(eng, self->italic());
-}
-
-static QScriptValue kerning(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, kerning);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setKerning(arg.toBoolean());
- }
-
- return QScriptValue(eng, self->kerning());
-}
-
-static QScriptValue key(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, key);
- return QScriptValue(eng, self->key());
-}
-
-static QScriptValue lastResortFamily(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, lastResortFamily);
- return QScriptValue(eng, self->lastResortFamily());
-}
-
-static QScriptValue lastResortFont(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, lastResortFont);
- return QScriptValue(eng, self->lastResortFont());
-}
-
-static QScriptValue overline(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, overline);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setOverline(arg.toBoolean());
- }
-
- return QScriptValue(eng, self->overline());
-}
-
-static QScriptValue pixelSize(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, pixelSize);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setPixelSize(arg.toInt32());
- }
-
- return QScriptValue(eng, self->pixelSize());
-}
-
-static QScriptValue pointSize(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, pointSize);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setPointSize(arg.toInt32());
- }
-
- return QScriptValue(eng, self->pointSize());
-}
-
-static QScriptValue pointSizeF(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, pointSizeF);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setPointSizeF(arg.toNumber());
- }
-
- return QScriptValue(eng, self->pointSizeF());
-}
-
-static QScriptValue resolve(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, resolve);
- QFont *other = qscriptvalue_cast<QFont*>(ctx->argument(0));
- if (!other) {
- return ctx->throwError(QScriptContext::TypeError,
- "QFont.prototype.isCopyOf: argument is not a Font");
- }
- return qScriptValueFromValue(eng, self->resolve(*other));
-}
-
-static QScriptValue stretch(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, stretch);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setStretch(arg.toInt32());
- }
-
- return QScriptValue(eng, self->stretch());
-}
-
-static QScriptValue strikeOut(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, strikeOut);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setStrikeOut(arg.toBoolean());
- }
-
- return QScriptValue(eng, self->strikeOut());
-}
-
-static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, toString);
- return QScriptValue(eng, self->toString());
-}
-
-static QScriptValue underline(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, underline);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setUnderline(arg.toBoolean());
- }
-
- return QScriptValue(eng, self->underline());
-}
-
-static QScriptValue weight(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QFont, weight);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setWeight(arg.toInt32());
- }
-
- return QScriptValue(eng, self->weight());
-}
-
-QScriptValue constructFontClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QFont());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
-
- proto.setProperty("key", eng->newFunction(key), getter);
- proto.setProperty("lastResortFamily", eng->newFunction(lastResortFamily), getter);
- proto.setProperty("lastResortFont", eng->newFunction(lastResortFont), getter);
- proto.setProperty("defaultFamily", eng->newFunction(defaultFamily), getter);
- proto.setProperty("exactMatch", eng->newFunction(exactMatch), getter);
- proto.setProperty("toString", eng->newFunction(toString), getter);
-
- proto.setProperty("bold", eng->newFunction(bold), getter | setter);
- proto.setProperty("family", eng->newFunction(family), getter|setter);
- proto.setProperty("fixedPitch", eng->newFunction(fixedPitch), getter);
- proto.setProperty("fromString", eng->newFunction(fromString), setter);
- proto.setProperty("italic", eng->newFunction(italic), getter | setter);
- proto.setProperty("kerning", eng->newFunction(kerning), getter | setter);
- proto.setProperty("overline", eng->newFunction(overline), getter | setter);
- proto.setProperty("pixelSize", eng->newFunction(pixelSize), getter | setter);
- proto.setProperty("pointSize", eng->newFunction(pointSize), getter | setter);
- proto.setProperty("pointSizeF", eng->newFunction(pointSizeF), getter | setter);
- proto.setProperty("strikeOut", eng->newFunction(strikeOut), getter | setter);
- proto.setProperty("stretch", eng->newFunction(stretch), getter | setter);
- proto.setProperty("underline", eng->newFunction(underline), getter | setter);
- proto.setProperty("weight", eng->newFunction(weight), getter | setter);
-
- proto.setProperty("isCopyOf", eng->newFunction(isCopyOf));
- proto.setProperty("resolve", eng->newFunction(resolve));
-
- eng->setDefaultPrototype(qMetaTypeId<QFont>(), proto);
- eng->setDefaultPrototype(qMetaTypeId<QFont*>(), proto);
-
- return eng->newFunction(ctor, proto);
-}
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QCursor>
-#include <QGraphicsItem>
-#include <QGraphicsScene>
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QScript::Pointer<QGraphicsItem>::wrapped_pointer_type)
-Q_DECLARE_METATYPE(QList<QGraphicsItem*>)
-Q_DECLARE_METATYPE(QPainterPath)
-#ifndef QT_NO_CURSOR
-Q_DECLARE_METATYPE(QCursor)
-#endif
-Q_DECLARE_METATYPE(QGraphicsItemGroup*)
-Q_DECLARE_METATYPE(QPainter*)
-Q_DECLARE_METATYPE(QStyleOptionGraphicsItem*)
-
-Q_DECLARE_METATYPE(QGraphicsPathItem*)
-Q_DECLARE_METATYPE(QGraphicsRectItem*)
-Q_DECLARE_METATYPE(QGraphicsEllipseItem*)
-Q_DECLARE_METATYPE(QGraphicsPolygonItem*)
-Q_DECLARE_METATYPE(QGraphicsLineItem*)
-Q_DECLARE_METATYPE(QGraphicsPixmapItem*)
-Q_DECLARE_METATYPE(QGraphicsTextItem*)
-Q_DECLARE_METATYPE(QGraphicsSimpleTextItem*)
-
-DECLARE_BOOLEAN_GET_SET_METHODS(QGraphicsItem, acceptDrops, setAcceptDrops)
-DECLARE_BOOLEAN_GET_SET_METHODS(QGraphicsItem, acceptHoverEvents, setAcceptHoverEvents)
-DECLARE_GET_METHOD(QGraphicsItem, boundingRect)
-DECLARE_GET_METHOD(QGraphicsItem, childItems)
-DECLARE_GET_METHOD(QGraphicsItem, childrenBoundingRect)
-#ifndef QT_NO_CURSOR
-DECLARE_GET_SET_METHODS(QGraphicsItem, QCursor, cursor, setCursor)
-DECLARE_BOOLEAN_GET_METHOD(QGraphicsItem, hasCursor)
-#endif
-DECLARE_GET_SET_METHODS(QGraphicsItem, QGraphicsItemGroup*, group, setGroup)
-DECLARE_BOOLEAN_GET_SET_METHODS(QGraphicsItem, handlesChildEvents, setHandlesChildEvents)
-DECLARE_BOOLEAN_GET_METHOD(QGraphicsItem, hasFocus)
-DECLARE_BOOLEAN_GET_SET_METHODS(QGraphicsItem, isEnabled, setEnabled)
-DECLARE_BOOLEAN_GET_SET_METHODS(QGraphicsItem, isSelected, setSelected)
-DECLARE_BOOLEAN_GET_SET_METHODS(QGraphicsItem, isVisible, setVisible)
-DECLARE_GET_METHOD(QGraphicsItem, opaqueArea)
-DECLARE_GET_METHOD(QGraphicsItem, pos)
-DECLARE_QOBJECT_GET_METHOD(QGraphicsItem, scene)
-DECLARE_GET_METHOD(QGraphicsItem, sceneBoundingRect)
-DECLARE_GET_METHOD(QGraphicsItem, scenePos)
-DECLARE_GET_METHOD(QGraphicsItem, sceneTransform)
-DECLARE_GET_METHOD(QGraphicsItem, shape)
-#ifndef QT_NO_TOOLTIP
-DECLARE_STRING_GET_SET_METHODS(QGraphicsItem, toolTip, setToolTip)
-#endif
-DECLARE_GET_METHOD(QGraphicsItem, topLevelItem)
-DECLARE_GET_SET_METHODS(QGraphicsItem, QTransform, transform, setTransform)
-DECLARE_NUMBER_GET_METHOD(QGraphicsItem, type)
-DECLARE_NUMBER_GET_METHOD(QGraphicsItem, x)
-DECLARE_NUMBER_GET_METHOD(QGraphicsItem, y)
-DECLARE_NUMBER_GET_SET_METHODS(QGraphicsItem, zValue, setZValue)
-
-DECLARE_BOOLEAN_1ARG_METHOD(QGraphicsItem, QPointF, contains)
-DECLARE_VOID_METHOD(QGraphicsItem, clearFocus)
-DECLARE_VOID_METHOD(QGraphicsItem, hide)
-DECLARE_BOOLEAN_1ARG_METHOD(QGraphicsItem, QGraphicsItem*, isAncestorOf)
-DECLARE_BOOLEAN_1ARG_METHOD(QGraphicsItem, QGraphicsItem*, isObscuredBy)
-DECLARE_VOID_NUMBER_NUMBER_METHOD(QGraphicsItem, moveBy)
-DECLARE_VOID_METHOD(QGraphicsItem, resetTransform)
-#ifndef QT_NO_CURSOR
-DECLARE_VOID_METHOD(QGraphicsItem, unsetCursor)
-#endif
-DECLARE_VOID_METHOD(QGraphicsItem, show)
-DECLARE_VOID_NUMBER_NUMBER_METHOD(QGraphicsItem, translate)
-DECLARE_VOID_NUMBER_NUMBER_METHOD(QGraphicsItem, scale)
-DECLARE_VOID_NUMBER_NUMBER_METHOD(QGraphicsItem, shear)
-DECLARE_VOID_1ARG_METHOD(QGraphicsItem, QGraphicsItem*, installSceneEventFilter)
-DECLARE_VOID_1ARG_METHOD(QGraphicsItem, QGraphicsItem*, removeSceneEventFilter)
-DECLARE_VOID_NUMBER_METHOD(QGraphicsItem, rotate)
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *)
-{
- return ctx->throwError("QGraphicsItem cannot be instantiated");
-}
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, acceptedMouseButtons) {
- return QScriptValue(eng, static_cast<int>(self->acceptedMouseButtons()));
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, advance) {
- self->advance(ctx->argument(0).toInt32());
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, collidesWithItem) {
- QGraphicsItem *other = qscriptvalue_cast<QGraphicsItem*>(ctx->argument(0));
- if (!other) {
- return ctx->throwError(QScriptContext::TypeError,
- "QGraphicsItem.prototype.collidesWithItem: argument is not a GraphicsItem");
- }
- if (ctx->argument(1).isUndefined())
- return QScriptValue(eng, self->collidesWithItem(other));
- else
- return QScriptValue(eng, self->collidesWithItem(other, static_cast<Qt::ItemSelectionMode>(ctx->argument(1).toInt32())));
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, collidesWithPath) {
- QPainterPath path = qscriptvalue_cast<QPainterPath>(ctx->argument(0));
- if (ctx->argument(1).isUndefined())
- return QScriptValue(eng, self->collidesWithPath(path));
- else
- return QScriptValue(eng, self->collidesWithPath(path, static_cast<Qt::ItemSelectionMode>(ctx->argument(1).toInt32())));
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, collidingItems) {
- if (ctx->argument(0).isUndefined())
- return qScriptValueFromValue(eng, self->collidingItems());
- else
- return qScriptValueFromValue(eng, self->collidingItems(static_cast<Qt::ItemSelectionMode>(ctx->argument(0).toInt32())));
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, data) {
- return eng->newVariant(self->data(ctx->argument(0).toInt32()));
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, ensureVisible) {
- Q_UNUSED(eng);
- return ctx->throwError("QGraphicsItem.prototype.ensureVisible is not implemented");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, flags) {
- return QScriptValue(eng, static_cast<int>(self->flags()));
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, isObscured) {
- if (ctx->argumentCount() == 0) {
- return QScriptValue(eng, self->isObscured());
- } else if (ctx->argumentCount() > 1) {
- return QScriptValue(eng, self->isObscured(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32()));
- } else {
- return QScriptValue(eng, self->isObscured(qscriptvalue_cast<QRectF>(ctx->argument(0))));
- }
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, mapFromItem) {
- Q_UNUSED(eng);
- return ctx->throwError("QGraphicsItem.prototype.mapFromItem is not implemented");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, mapFromParent) {
- Q_UNUSED(eng);
- return ctx->throwError("QGraphicsItem.prototype.mapFromParent is not implemented");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, mapFromScene) {
- Q_UNUSED(eng);
- return ctx->throwError("QGraphicsItem.prototype.mapFromScene is not implemented");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, mapToItem) {
- Q_UNUSED(eng);
- return ctx->throwError("QGraphicsItem.prototype.mapToItem is not implemented");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, mapToParent) {
- Q_UNUSED(eng);
- return ctx->throwError("QGraphicsItem.prototype.mapToParent is not implemented");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, mapToScene) {
- Q_UNUSED(eng);
- return ctx->throwError("QGraphicsItem.prototype.mapToScene is not implemented");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, paint) {
- self->paint(qscriptvalue_cast<QPainter*>(ctx->argument(0)),
- qscriptvalue_cast<QStyleOptionGraphicsItem*>(ctx->argument(1)),
- qscriptvalue_cast<QWidget*>(ctx->argument(2)));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, parentItem) {
- QGraphicsItem *parent = self->parentItem();
- if (!parent)
- return eng->nullValue();
- QScriptValue ret = qScriptValueFromValue(eng, parent);
- QScriptValue proto;
- switch (parent->type()) {
- case 2:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsPathItem*>());
- break;
- case 3:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsRectItem*>());
- break;
- case 4:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsEllipseItem*>());
- break;
- case 5:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsPolygonItem*>());
- break;
- case 6:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsLineItem*>());
- break;
- case 7:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsPixmapItem*>());
- break;
- case 8:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsTextItem*>());
- break;
- case 9:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsSimpleTextItem*>());
- break;
- case 10:
- proto = eng->defaultPrototype(qMetaTypeId<QGraphicsItemGroup*>());
- break;
- }
- if (proto.isValid())
- ret.setPrototype(proto);
- return ret;
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, setAcceptedMouseButtons) {
- self->setAcceptedMouseButtons(static_cast<Qt::MouseButtons>(ctx->argument(0).toInt32()));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, setData) {
- self->setData(ctx->argument(0).toInt32(), ctx->argument(1).toVariant());
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, setFlag) {
- QGraphicsItem::GraphicsItemFlag flag = static_cast<QGraphicsItem::GraphicsItemFlag>(ctx->argument(0).toInt32());
- if (ctx->argument(1).isUndefined())
- self->setFlag(flag);
- else
- self->setFlag(flag, ctx->argument(1).toBoolean());
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, setFlags) {
- self->setFlags(static_cast<QGraphicsItem::GraphicsItemFlags>(ctx->argument(0).toInt32()));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, setFocus) {
- if (ctx->argument(0).isUndefined())
- self->setFocus();
- else
- self->setFocus(static_cast<Qt::FocusReason>(ctx->argument(0).toInt32()));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, setParentItem) {
- QScriptValue arg = ctx->argument(0);
- QGraphicsItem *item = qscriptvalue_cast<QGraphicsItem*>(arg);
- self->setParentItem(item);
- if (item)
- QScript::maybeReleaseOwnership(ctx->thisObject());
- else if (!self->scene())
- QScript::maybeTakeOwnership(ctx->thisObject());
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, setPos) {
- if (ctx->argumentCount() > 1)
- self->setPos(ctx->argument(0).toNumber(), ctx->argument(1).toNumber());
- else
- self->setPos(qscriptvalue_cast<QPointF>(ctx->argument(0)));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, update) {
- if (ctx->argumentCount() > 1) {
- self->update(ctx->argument(0).toNumber(),
- ctx->argument(1).toNumber(),
- ctx->argument(2).toNumber(),
- ctx->argument(3).toNumber());
- } else {
- self->update(qscriptvalue_cast<QRectF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, toString) {
- return QScriptValue(eng, "QGraphicsItem");
-} END_DECLARE_METHOD
-
-/////////////////////////////////////////////////////////////
-
-class PrototypeGraphicsItem : public QGraphicsItem
-{
-public:
- PrototypeGraphicsItem()
- { }
- QRectF boundingRect() const
- { return QRectF(); }
- void paint(QPainter *, const QStyleOptionGraphicsItem *, QWidget *)
- { }
-};
-
-QScriptValue constructGraphicsItemClass(QScriptEngine *eng)
-{
- QScriptValue proto = QScript::wrapGVPointer<QGraphicsItem>(eng, new PrototypeGraphicsItem());
- ADD_GET_SET_METHODS(proto, acceptDrops, setAcceptDrops);
- ADD_GET_SET_METHODS(proto, acceptHoverEvents, setAcceptHoverEvents);
- ADD_GET_METHOD(proto, boundingRect);
- ADD_GET_METHOD(proto, childItems);
- ADD_GET_METHOD(proto, childrenBoundingRect);
-#ifndef QT_NO_CURSOR
- ADD_GET_SET_METHODS(proto, cursor, setCursor);
- ADD_GET_METHOD(proto, hasCursor);
-#endif
- ADD_GET_SET_METHODS(proto, group, setGroup);
- ADD_GET_SET_METHODS(proto, handlesChildEvents, setHandlesChildEvents);
- ADD_GET_METHOD(proto, hasFocus);
- ADD_GET_SET_METHODS(proto, isEnabled, setEnabled);
- ADD_GET_SET_METHODS(proto, isSelected, setSelected);
- ADD_GET_SET_METHODS(proto, isVisible, setVisible);
- ADD_GET_METHOD(proto, opaqueArea);
- ADD_GET_METHOD(proto, pos);
- ADD_GET_METHOD(proto, scene);
- ADD_GET_METHOD(proto, sceneBoundingRect);
- ADD_GET_METHOD(proto, scenePos);
- ADD_GET_METHOD(proto, sceneTransform);
- ADD_GET_METHOD(proto, shape);
-#ifndef QT_NO_TOOLTIP
- ADD_GET_SET_METHODS(proto, toolTip, setToolTip);
-#endif
- ADD_GET_METHOD(proto, topLevelItem);
- ADD_GET_SET_METHODS(proto, transform, setTransform);
- ADD_GET_METHOD(proto, type);
- ADD_GET_METHOD(proto, x);
- ADD_GET_METHOD(proto, y);
- ADD_GET_SET_METHODS(proto, zValue, setZValue);
-
- ADD_METHOD(proto, acceptedMouseButtons);
- ADD_METHOD(proto, advance);
- ADD_METHOD(proto, clearFocus);
- ADD_METHOD(proto, collidesWithItem);
- ADD_METHOD(proto, collidesWithPath);
- ADD_METHOD(proto, collidingItems);
- ADD_METHOD(proto, contains);
- ADD_METHOD(proto, data);
- ADD_METHOD(proto, ensureVisible);
- ADD_METHOD(proto, flags);
- ADD_METHOD(proto, hide);
- ADD_METHOD(proto, installSceneEventFilter);
- ADD_METHOD(proto, isAncestorOf);
- ADD_METHOD(proto, isObscured);
- ADD_METHOD(proto, isObscuredBy);
- ADD_METHOD(proto, mapFromItem);
- ADD_METHOD(proto, mapFromParent);
- ADD_METHOD(proto, mapFromScene);
- ADD_METHOD(proto, mapToItem);
- ADD_METHOD(proto, mapToParent);
- ADD_METHOD(proto, mapToScene);
- ADD_METHOD(proto, moveBy);
- ADD_METHOD(proto, paint);
- ADD_METHOD(proto, parentItem);
- ADD_METHOD(proto, removeSceneEventFilter);
- ADD_METHOD(proto, resetTransform);
- ADD_METHOD(proto, rotate);
- ADD_METHOD(proto, scale);
- ADD_METHOD(proto, setAcceptedMouseButtons);
- ADD_METHOD(proto, setData);
- ADD_METHOD(proto, setFlag);
- ADD_METHOD(proto, setFlags);
- ADD_METHOD(proto, setFocus);
- ADD_METHOD(proto, setParentItem);
- ADD_METHOD(proto, setPos);
- ADD_METHOD(proto, shear);
- ADD_METHOD(proto, show);
- ADD_METHOD(proto, toString);
- ADD_METHOD(proto, translate);
-#ifndef QT_NO_CURSOR
- ADD_METHOD(proto, unsetCursor);
-#endif
- ADD_METHOD(proto, update);
-
- QScript::registerPointerMetaType<QGraphicsItem>(eng, proto);
-
- QScriptValue ctorFun = eng->newFunction(ctor, proto);
- ADD_ENUM_VALUE(ctorFun, QGraphicsItem, ItemIsMovable);
- ADD_ENUM_VALUE(ctorFun, QGraphicsItem, ItemIsSelectable);
- ADD_ENUM_VALUE(ctorFun, QGraphicsItem, ItemIsFocusable);
- ADD_ENUM_VALUE(ctorFun, QGraphicsItem, ItemClipsToShape);
- ADD_ENUM_VALUE(ctorFun, QGraphicsItem, ItemClipsChildrenToShape);
- ADD_ENUM_VALUE(ctorFun, QGraphicsItem, ItemIgnoresTransformations);
-
- return ctorFun;
-}
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QGraphicsWidget>
-#include <QGraphicsGridLayout>
-#include <QGraphicsLayout>
-
-#include <Plasma/Applet>
-
-#include "backportglobal.h"
-
-#define DECLARE_INT_NUMBER_GET_METHOD(Class, __get__) \
-BEGIN_DECLARE_METHOD(Class, __get__) { \
- return QScriptValue(eng, self->__get__(ctx->argument(0).toInt32())); \
-} END_DECLARE_METHOD
-
-#define DECLARE_INT_NUMBER_SET_METHOD(Class, __set__) \
-BEGIN_DECLARE_METHOD(Class, __set__) { \
- self->__set__(ctx->argument(0).toInt32(), ctx->argument(1).toNumber()); \
- return eng->undefinedValue(); \
-} END_DECLARE_METHOD
-
-#define DECLARE_INT_NUMBER_GET_SET_METHODS(Class, __get__, __set__) \
- DECLARE_INT_NUMBER_GET_METHOD(Class, __get__) \
- DECLARE_INT_NUMBER_SET_METHOD(Class, __set__)
-
-Q_DECLARE_METATYPE(QScript::Pointer<QGraphicsItem>::wrapped_pointer_type)
-Q_DECLARE_METATYPE(QGraphicsWidget*)
-Q_DECLARE_METATYPE(QGraphicsLayout*)
-Q_DECLARE_METATYPE(QGraphicsLayoutItem*)
-DECLARE_POINTER_METATYPE(QGraphicsGridLayout)
-
-DECLARE_VOID_NUMBER_METHOD(QGraphicsGridLayout, removeAt)
-DECLARE_VOID_NUMBER_METHOD(QGraphicsGridLayout, setSpacing)
-DECLARE_VOID_QUAD_NUMBER_METHOD(QGraphicsGridLayout, setContentsMargins)
-
-DECLARE_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, horizontalSpacing, setHorizontalSpacing)
-DECLARE_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, verticalSpacing, setVerticalSpacing)
-
-DECLARE_INT_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, rowSpacing, setRowSpacing)
-DECLARE_INT_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, columnSpacing, setColumnSpacing)
-
-DECLARE_INT_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, rowMinimumHeight, setRowMinimumHeight)
-DECLARE_INT_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, rowPreferredHeight, setRowPreferredHeight)
-DECLARE_INT_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, rowMaximumHeight, setRowMaximumHeight)
-DECLARE_INT_NUMBER_SET_METHOD(QGraphicsGridLayout, setRowFixedHeight)
-
-DECLARE_INT_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, columnMinimumWidth, setColumnMinimumWidth)
-DECLARE_INT_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, columnPreferredWidth, setColumnPreferredWidth)
-DECLARE_INT_NUMBER_GET_SET_METHODS(QGraphicsGridLayout, columnMaximumWidth, setColumnMaximumWidth)
-DECLARE_INT_NUMBER_SET_METHOD(QGraphicsGridLayout, setColumnFixedWidth)
-
-
-/////////////////////////////////////////////////////////////
-
-QGraphicsLayoutItem *extractLayoutItem(QScriptContext *ctx, int index = 0, bool noExistingLayout = false);
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- QGraphicsLayoutItem *parent = extractLayoutItem(ctx, 0, true);
- //FIXME: don't leak memory when parent is 0
- return qScriptValueFromValue(eng, new QGraphicsGridLayout(parent));
-}
-
-BEGIN_DECLARE_METHOD(QGraphicsGridLayout, setAlignment) {
- QGraphicsLayoutItem *item = extractLayoutItem(ctx);
-
- if (!item) {
- return eng->undefinedValue();
- }
-
- self->setAlignment(item, static_cast<Qt::Alignment>(ctx->argument(1).toInt32()));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsGridLayout, addItem) {
- QGraphicsLayoutItem *item = extractLayoutItem(ctx);
-
- if (!item) {
- return eng->undefinedValue();
- }
-
- int rowSpan = 1;
- int colSpan = 1;
- Qt::Alignment alignment = 0;
- const int argCount = ctx->argumentCount();
- if (argCount > 3) {
- rowSpan = ctx->argument(3).toInt32();
- if (argCount > 4) {
- colSpan = ctx->argument(4).toInt32();
-
- if (argCount > 5) {
- alignment = static_cast<Qt::Alignment>(ctx->argument(5).toInt32());
- }
- }
- }
-
- self->addItem(item, ctx->argument(1).toInt32(), ctx->argument(2).toInt32(),
- rowSpan, colSpan, alignment);
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsGridLayout, toString) {
- return QScriptValue(eng, "QGraphicsGridLayout");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsGridLayout, activate) {
- self->activate();
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-/////////////////////////////////////////////////////////////
-
-class PrototypeGridLayout : public QGraphicsGridLayout
-{
-public:
- PrototypeGridLayout()
- { }
-};
-
-QScriptValue constructGridLayoutClass(QScriptEngine *eng)
-{
- QScriptValue proto = QScript::wrapPointer<QGraphicsGridLayout>(eng, new QGraphicsGridLayout(), QScript::UserOwnership);
- const QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- const QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
- proto.setProperty("horizontalSpacing", eng->newFunction(horizontalSpacing), getter);
- proto.setProperty("horizontalSpacing", eng->newFunction(setHorizontalSpacing), setter);
- proto.setProperty("verticalSpacing", eng->newFunction(verticalSpacing), getter);
- proto.setProperty("verticalSpacing", eng->newFunction(setVerticalSpacing), setter);
-
- ADD_METHOD(proto, rowSpacing);
- ADD_METHOD(proto, setRowSpacing);
- ADD_METHOD(proto, columnSpacing);
- ADD_METHOD(proto, setColumnSpacing);
-
- ADD_METHOD(proto, rowMinimumHeight);
- ADD_METHOD(proto, setRowMinimumHeight);
- ADD_METHOD(proto, rowPreferredHeight);
- ADD_METHOD(proto, setRowPreferredHeight);
- ADD_METHOD(proto, rowMaximumHeight);
- ADD_METHOD(proto, setRowMaximumHeight);
- ADD_METHOD(proto, setRowFixedHeight);
-
- ADD_METHOD(proto, columnMinimumWidth);
- ADD_METHOD(proto, setColumnMinimumWidth);
- ADD_METHOD(proto, columnPreferredWidth);
- ADD_METHOD(proto, setColumnPreferredWidth);
- ADD_METHOD(proto, columnMaximumWidth);
- ADD_METHOD(proto, setColumnMaximumWidth);
- ADD_METHOD(proto, setColumnFixedWidth);
-
- ADD_METHOD(proto, removeAt);
- ADD_METHOD(proto, setAlignment);
- ADD_METHOD(proto, setSpacing);
- ADD_METHOD(proto, setContentsMargins);
- ADD_METHOD(proto, addItem);
- ADD_METHOD(proto, toString);
- ADD_METHOD(proto, activate);
-
- QScript::registerPointerMetaType<QGraphicsGridLayout>(eng, proto);
-
- QScriptValue ctorFun = eng->newFunction(ctor, proto);
- return ctorFun;
-}
+++ /dev/null
-/*
- * Copyright 2009 Aaron Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "i18n.h"
-
-#include <QScriptContext>
-#include <QScriptEngine>
-
-#include <KDebug>
-#include <KLocalizedString>
-
-QScriptValue jsi18n(QScriptContext *context, QScriptEngine *engine)
-{
- Q_UNUSED(engine)
-
- if (context->argumentCount() < 1) {
- kDebug() << i18n("i18n() takes at least one argument");
- return engine->undefinedValue();
- }
-
- KLocalizedString message = ki18n(context->argument(0).toString().toUtf8());
-
- const int numArgs = context->argumentCount();
- for (int i = 1; i < numArgs; ++i) {
- message = message.subs(context->argument(i).toString());
- }
-
- return message.toString();
-}
-
-QScriptValue jsi18nc(QScriptContext *context, QScriptEngine *engine)
-{
- Q_UNUSED(engine)
-
- if (context->argumentCount() < 2) {
- kDebug() << i18n("i18nc() takes at least two arguments");
- return engine->undefinedValue();
- }
-
- KLocalizedString message = ki18nc(context->argument(0).toString().toUtf8(),
- context->argument(1).toString().toUtf8());
-
- const int numArgs = context->argumentCount();
- for (int i = 2; i < numArgs; ++i) {
- message = message.subs(context->argument(i).toString());
- }
-
- return message.toString();
-}
-
-QScriptValue jsi18np(QScriptContext *context, QScriptEngine *engine)
-{
- Q_UNUSED(engine)
-
- if (context->argumentCount() < 2) {
- kDebug() << i18n("i18np() takes at least two arguments");
- return engine->undefinedValue();
- }
-
- KLocalizedString message = ki18np(context->argument(0).toString().toUtf8(),
- context->argument(1).toString().toUtf8());
-
- const int numArgs = context->argumentCount();
- for (int i = 2; i < numArgs; ++i) {
- QScriptValue v = context->argument(i);
- if (v.isNumber()) {
- message = message.subs(v.toInt32());
- } else {
- message = message.subs(v.toString());
- }
- }
-
- return message.toString();
-}
-
-QScriptValue jsi18ncp(QScriptContext *context, QScriptEngine *engine)
-{
- Q_UNUSED(engine)
-
- if (context->argumentCount() < 3) {
- kDebug() << i18n("i18ncp() takes at least three arguments");
- return engine->undefinedValue();
- }
-
- KLocalizedString message = ki18ncp(context->argument(0).toString().toUtf8(),
- context->argument(1).toString().toUtf8(),
- context->argument(2).toString().toUtf8());
-
- const int numArgs = context->argumentCount();
- for (int i = 3; i < numArgs; ++i) {
- message = message.subs(context->argument(i).toString());
- }
-
- return message.toString();
-}
-
-void bindI18N(QScriptEngine *engine)
-{
- QScriptValue global = engine->globalObject();
- global.setProperty("i18n", engine->newFunction(jsi18n));
- global.setProperty("i18nc", engine->newFunction(jsi18nc));
- global.setProperty("i18np", engine->newFunction(jsi18np));
- global.setProperty("i18ncp", engine->newFunction(jsi18ncp));
-}
-
+++ /dev/null
-/*
- * Copyright 2009 Aaron Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef JAVASCRIPTBINDI18N_H
-#define JAVASCRIPTBINDI18N_H
-
-#include <QScriptValue>
-
-class QScriptContext;
-class QScriptEngine;
-
-QScriptValue jsi18n(QScriptContext *context, QScriptEngine *engine);
-QScriptValue jsi18nc(QScriptContext *context, QScriptEngine *engine);
-QScriptValue jsi18np(QScriptContext *context, QScriptEngine *engine);
-QScriptValue jsi18ncp(QScriptContext *context, QScriptEngine *engine);
-void bindI18N(QScriptEngine *engine);
-
-#endif
-
+++ /dev/null
-/*
- * Copyright (c) 2009 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-
-#include <KIcon>
-
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QIcon)
-Q_DECLARE_METATYPE(QIcon*)
-Q_DECLARE_METATYPE(KIcon)
-Q_DECLARE_METATYPE(KIcon*)
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() > 0) {
- QScriptValue v = ctx->argument(0);
- if (v.isString()) {
- QIcon icon = KIcon(v.toString());
- return qScriptValueFromValue(eng, icon);
- } else if (v.isVariant()) {
- QVariant variant = v.toVariant();
- QPixmap p = variant.value<QPixmap>();
- if (!p.isNull()) {
- return qScriptValueFromValue(eng, QIcon(p));
- }
- }
- }
- return qScriptValueFromValue(eng, QIcon());
-}
-
-static QScriptValue addPixmap(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QIcon, addPixmap);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
-
- if (arg.isVariant()) {
- QVariant variant = arg.toVariant();
- QPixmap p = variant.value<QPixmap>();
- if (!p.isNull()) {
- self->addPixmap(p);
- }
- }
- }
-
- return eng->undefinedValue();
-}
-
-static QScriptValue addFile(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QIcon, addFile);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
-
- if (arg.isString()) {
- self->addFile(arg.toString());
- }
- }
-
- return eng->undefinedValue();
-}
-
-static QScriptValue isNull(QScriptContext *ctx, QScriptEngine *eng)
-{
- Q_UNUSED(eng)
- DECLARE_SELF(QIcon, isNull);
- return self->isNull();
-}
-
-QScriptValue constructIconClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QIcon());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- proto.setProperty("addPixmap", eng->newFunction(addPixmap));
- proto.setProperty("addFile", eng->newFunction(addFile));
- proto.setProperty("null", eng->newFunction(isNull), getter);
-
- QScriptValue ctorFun = eng->newFunction(ctor, proto);
- ADD_ENUM_VALUE(ctorFun, QIcon, Normal);
- ADD_ENUM_VALUE(ctorFun, QIcon, Disabled);
- ADD_ENUM_VALUE(ctorFun, QIcon, Active);
- ADD_ENUM_VALUE(ctorFun, QIcon, Selected);
- ADD_ENUM_VALUE(ctorFun, QIcon, Off);
- ADD_ENUM_VALUE(ctorFun, QIcon, On);
-
- eng->setDefaultPrototype(qMetaTypeId<QIcon>(), proto);
-
- return ctorFun;
-}
-
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QGraphicsAnchorLayout>
-#include <QGraphicsLayout>
-#include <QGraphicsLinearLayout>
-#include <QGraphicsGridLayout>
-#include <QGraphicsWidget>
-
-#include <Plasma/Applet>
-
-#include "backportglobal.h"
-#include "plasmoid/appletinterface.h"
-
-Q_DECLARE_METATYPE(QScript::Pointer<QGraphicsItem>::wrapped_pointer_type)
-Q_DECLARE_METATYPE(QGraphicsWidget*)
-Q_DECLARE_METATYPE(QGraphicsLayout*)
-Q_DECLARE_METATYPE(QGraphicsLayoutItem*)
-Q_DECLARE_METATYPE(QGraphicsAnchorLayout*)
-Q_DECLARE_METATYPE(QGraphicsGridLayout*)
-DECLARE_POINTER_METATYPE(QGraphicsLinearLayout)
-
-DECLARE_VOID_NUMBER_METHOD(QGraphicsLinearLayout, removeAt)
-DECLARE_VOID_NUMBER_NUMBER_METHOD(QGraphicsLinearLayout, insertStretch)
-DECLARE_VOID_NUMBER_NUMBER_METHOD(QGraphicsLinearLayout, setItemSpacing)
-DECLARE_VOID_QUAD_NUMBER_METHOD(QGraphicsLinearLayout, setContentsMargins)
-
-/////////////////////////////////////////////////////////////
-
-// Q_DECLARE_METATYPE(QGraphicsLayoutItem*)
-QGraphicsLayoutItem *extractLayoutItem(QScriptContext *ctx, int index = 0, bool noExistingLayout = false)
-{
- QScriptValue v = ctx->argument(index);
- if (ctx->argumentCount() == 0 || v.isQObject()) {
- QObject *object = v.toQObject();
- QGraphicsWidget *w = qobject_cast<QGraphicsWidget *>(object);
- if (!w) {
- AppletInterface *interface = qobject_cast<AppletInterface*>(object);
- if (!interface) {
- interface = qobject_cast<AppletInterface*>(ctx->engine()->globalObject().property("plasmoid").toQObject());
- }
-
- if (interface) {
- w = interface->applet();
- }
- }
-
- if (noExistingLayout && w->layout()) {
- return 0;
- }
-
- return w;
- }
-
- QVariant variant = v.toVariant();
- QGraphicsLayoutItem *item = variant.value<QGraphicsLayoutItem *>();
- //this is horribly ugly code, but when a QLinearLayout* is stuffed into a QVariant,
- //QVariant does not know that it is a QGraphicsLayoutItem. repeat for all subclasses
- //of same
- if (!item) {
- item = variant.value<QGraphicsLayout *>();
-
- if (!item) {
- item = variant.value<QGraphicsLinearLayout *>();
-
- if (!item) {
- item = variant.value<QGraphicsGridLayout *>();
-
- if (!item) {
- item = variant.value<QGraphicsAnchorLayout *>();
- }
- }
- }
- }
-
- QGraphicsWidget *w = dynamic_cast<QGraphicsWidget *>(item);
- if (noExistingLayout && w && w->layout()) {
- return 0;
- }
-
- return item;
-}
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- QGraphicsLayoutItem *parent = extractLayoutItem(ctx, 0, true);
- //FIXME: don't leak memory when parent is 0
- return qScriptValueFromValue(eng, new QGraphicsLinearLayout(parent));
-}
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, orientation) {
- if (ctx->argumentCount() > 0) {
- self->setOrientation(static_cast<Qt::Orientation>(ctx->argument(0).toInt32()));
- }
-
- return QScriptValue(eng, static_cast<int>(self->orientation()));
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, setAlignment) {
- QGraphicsLayoutItem *item = extractLayoutItem(ctx);
-
- if (!item) {
- return eng->undefinedValue();
- }
-
- self->setAlignment(item, static_cast<Qt::Alignment>(ctx->argument(1).toInt32()));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, insertItem) {
- QGraphicsLayoutItem *item = extractLayoutItem(ctx, 1);
-
- if (!item) {
- return eng->undefinedValue();
- }
-
- self->insertItem(ctx->argument(0).toInt32(), item);
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, removeItem) {
- QGraphicsLayoutItem *item = extractLayoutItem(ctx);
-
- if (!item) {
- return eng->undefinedValue();
- }
-
- self->removeItem(item);
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, addStretch) {
- self->addStretch(qMax(1, ctx->argument(0).toInt32()));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, setStretchFactor) {
- QGraphicsLayoutItem *item = ctx->argument(0).toVariant().value<QGraphicsLayoutItem*>();
-
- if (!item) {
- return eng->undefinedValue();
- }
-
- self->setStretchFactor(item, static_cast<Qt::Orientation>(ctx->argument(1).toInt32()));
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, addItem) {
- QGraphicsLayoutItem *item = extractLayoutItem(ctx);
- if (!item) {
- return ctx->throwError(QScriptContext::TypeError,
- "QGraphicsLinearLayout.prototype.addItem: argument is not a GraphicsLayoutItem");
- }
-
- self->addItem(item);
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsItem, toString) {
- return QScriptValue(eng, "QGraphicsLinearLayout");
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, count) {
- return QScriptValue(eng, self->count());
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, itemAt) {
- if (ctx->argumentCount() < 1) {
- return eng->undefinedValue();
- }
-
- int index = ctx->argument(0).toInt32();
- return qScriptValueFromValue(eng, self->itemAt(index));
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, spacing) {
- if (ctx->argumentCount() > 0) {
- int pixels = ctx->argument(0).toInt32();
- self->setSpacing(pixels);
- }
-
- return QScriptValue(eng, self->spacing());
-} END_DECLARE_METHOD
-
-BEGIN_DECLARE_METHOD(QGraphicsLinearLayout, activate) {
- self->activate();
- return eng->undefinedValue();
-} END_DECLARE_METHOD
-
-/////////////////////////////////////////////////////////////
-
-QScriptValue constructLinearLayoutClass(QScriptEngine *eng)
-{
-// QScriptValue proto = QScript::wrapGVPointer<QGraphicsLinearLayout>(eng, new QGraphicsLinearLayout(), );
- qRegisterMetaType<QGraphicsLayoutItem*>();
- QGraphicsLayoutItem * i = new QGraphicsLinearLayout;
- QVariant v;
- ///v.setValue<QGraphicsLayoutItem*>(i);
- v.setValue<void*>(i);
- QScriptValue proto = QScript::wrapPointer<QGraphicsLinearLayout>(eng, new QGraphicsLinearLayout(), QScript::UserOwnership);
- const QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- const QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
- proto.setProperty("count", eng->newFunction(count), getter);
- proto.setProperty("spacing", eng->newFunction(spacing), getter | setter);
- proto.setProperty("orientation", eng->newFunction(orientation), getter | setter);
- ADD_METHOD(proto, itemAt);
- ADD_METHOD(proto, removeAt);
- ADD_METHOD(proto, addStretch);
- ADD_METHOD(proto, setStretchFactor);
- ADD_METHOD(proto, setAlignment);
- ADD_METHOD(proto, insertStretch);
- ADD_METHOD(proto, setItemSpacing);
- ADD_METHOD(proto, setContentsMargins);
- ADD_METHOD(proto, addItem);
- ADD_METHOD(proto, removeItem);
- ADD_METHOD(proto, insertItem);
- ADD_METHOD(proto, toString);
- ADD_METHOD(proto, activate);
-
- QScript::registerPointerMetaType<QGraphicsLinearLayout>(eng, proto);
-
- QScriptValue ctorFun = eng->newFunction(ctor, proto);
- //ADD_ENUM_VALUE(ctorFun, QGraphicsItem, ItemIsMovable);
-
- return ctorFun;
-}
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-
-#include <QPainter>
-#include <QPicture>
-#include <QtGui/qpolygon.h>
-#include <QWidget>
-
-#include <QtCore/qdebug.h>
-
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QPolygonF)
-Q_DECLARE_METATYPE(QPainterPath)
-Q_DECLARE_METATYPE(QPainterPath*)
-Q_DECLARE_METATYPE(QPicture)
-Q_DECLARE_METATYPE(QVector<QRectF>)
-Q_DECLARE_METATYPE(QPaintDevice*)
-Q_DECLARE_METATYPE(QPaintEngine*)
-
-DECLARE_POINTER_METATYPE(QPainter)
-
-static QScriptValue newPainter(QScriptEngine *eng, QPainter *p)
-{
- return QScript::wrapPointer(eng, p);
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() > 0) {
- QPaintDevice *device = qscriptvalue_cast<QPaintDevice*>(ctx->argument(0));
- if (!device) {
- QPixmap *pixmap = qscriptvalue_cast<QPixmap *>(ctx->argument(0));
- if (pixmap) {
- return newPainter(eng, new QPainter(pixmap));
- } else {
- return newPainter(eng, new QPainter());
- }
- }
- return newPainter(eng, new QPainter(device));
- } else {
- return newPainter(eng, new QPainter());
- }
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue background(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, background);
- return qScriptValueFromValue(eng, self->background());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue backgroundMode(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, backgroundMode);
- return QScriptValue(eng, static_cast<int>(self->backgroundMode()));
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue begin(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, begin);
- QWidget *device = qscriptvalue_cast<QWidget*>(ctx->argument(0));
- if (!device) {
- return ctx->throwError(QScriptContext::TypeError,
- "QPainter.prototype.begin: argument is not a QWidget");
- }
- return QScriptValue(eng, self->begin(device));
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue boundingRect(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, boundingRect);
- QRect result;
- if (ctx->argumentCount() == 3) {
- result = self->boundingRect(qscriptvalue_cast<QRect>(ctx->argument(0)),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toString());
- } else if (ctx->argumentCount() == 6) {
- result = self->boundingRect(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32(),
- ctx->argument(4).toInt32(),
- ctx->argument(5).toString());
- }
- return qScriptValueFromValue(eng, result);
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue brush(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, brush);
- return qScriptValueFromValue(eng, self->brush());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue brushOrigin(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, brushOrigin);
- return qScriptValueFromValue(eng, self->brushOrigin());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue clipPath(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, clipPath);
- return qScriptValueFromValue(eng, self->clipPath());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue clipRegion(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, clipRegion);
- return qScriptValueFromValue(eng, self->clipRegion());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue combinedMatrix(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, combinedMatrix);
- return qScriptValueFromValue(eng, self->combinedMatrix());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue combinedTransform(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, combinedTransform);
- return qScriptValueFromValue(eng, self->combinedTransform());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue compositionMode(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, compositionMode);
- return QScriptValue(eng, static_cast<int>(self->compositionMode()));
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawArc(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawArc);
- if (ctx->argumentCount() == 6) {
- // drawArc(x, y, height, width, startAngle, spanAngle)
- self->drawArc(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32(),
- ctx->argument(4).toInt32(),
- ctx->argument(5).toInt32());
- } else if (ctx->argumentCount() == 3) {
- // drawArc(rectangle, startAngle, spanAngle)
- self->drawArc(qscriptvalue_cast<QRectF>(ctx->argument(0)),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32());
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawChord(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawChord);
- if (ctx->argumentCount() == 6) {
- // x, y, height, width, startAngle, spanAngle
- self->drawChord(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32(),
- ctx->argument(4).toInt32(),
- ctx->argument(5).toInt32());
- } else if (ctx->argumentCount() == 3) {
- // rectangle, startAngle, spanAngle
- self->drawChord(qscriptvalue_cast<QRectF>(ctx->argument(0)),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32());
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawConvexPolygon(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawConvexPolygon);
- self->drawConvexPolygon(qscriptvalue_cast<QPolygonF>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawEllipse(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawEllipse);
- if (ctx->argumentCount() == 4) {
- // drawEllipse(x, y, width, height)
- self->drawEllipse(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32());
- } else if (ctx->argumentCount() == 1) {
- // drawEllipse(rect)
- self->drawEllipse(qscriptvalue_cast<QRectF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawImage(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawImage);
- if (ctx->argumentCount() == 2) {
- // target, image
- QScriptValue arg0 = ctx->argument(0);
- QImage image = qscriptvalue_cast<QImage>(ctx->argument(1));
- if (arg0.property("width").isValid()) {
- self->drawImage(qscriptvalue_cast<QRectF>(arg0), image);
- } else {
- self->drawImage(qscriptvalue_cast<QPointF>(arg0), image);
- }
- } else if (ctx->argumentCount() == 3) {
- // x, y, image
- self->drawImage(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- qscriptvalue_cast<QImage>(ctx->argument(2)));
- } else if (ctx->argumentCount() == 5) {
- // x, y, width, height, image
- self->drawImage(QRect(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32()),
- qscriptvalue_cast<QImage>(ctx->argument(4)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawLine(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawLine);
- if (ctx->argumentCount() == 4) {
- // x1, y1, x2, y2
- self->drawLine(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32());
- } else if (ctx->argumentCount() == 2) {
- // p1, p2
- self->drawLine(qscriptvalue_cast<QPointF>(ctx->argument(0)),
- qscriptvalue_cast<QPointF>(ctx->argument(1)));
- } else if (ctx->argumentCount() == 1) {
- // line
- self->drawLine(qscriptvalue_cast<QLineF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawLines(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawLines);
- return ctx->throwError("QPainter.prototype.drawLines is not implemented");
-// self->drawLines(qscriptvalue_cast<QVector<QLineF> >(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawPath(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawPath);
- self->drawPath(qscriptvalue_cast<QPainterPath>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawPicture(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawPicture);
- if (ctx->argumentCount() == 2) {
- self->drawPicture(qscriptvalue_cast<QPointF>(ctx->argument(0)),
- qscriptvalue_cast<QPicture>(ctx->argument(1)));
- } else if (ctx->argumentCount() == 3) {
- self->drawPicture(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- qscriptvalue_cast<QPicture>(ctx->argument(2)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawPie(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawPie);
- if (ctx->argumentCount() == 6) {
- // x, y, height, width, startAngle, spanAngle
- self->drawPie(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32(),
- ctx->argument(4).toInt32(),
- ctx->argument(5).toInt32());
- } else if (ctx->argumentCount() == 3) {
- // rectangle, startAngle, spanAngle
- self->drawPie(qscriptvalue_cast<QRectF>(ctx->argument(0)),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32());
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawPixmap(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawPixmap);
- if (ctx->argumentCount() == 2) {
- // target, pixmap
- QScriptValue arg0 = ctx->argument(0);
- QPixmap pixmap = qscriptvalue_cast<QPixmap>(ctx->argument(1));
- if (arg0.property("width").isValid()) {
- self->drawPixmap(qscriptvalue_cast<QRectF>(arg0), pixmap,
- QRectF(0, 0, pixmap.width(), pixmap.height()));
- } else {
- self->drawPixmap(qscriptvalue_cast<QPointF>(arg0), pixmap);
- }
- } else if (ctx->argumentCount() == 3) {
- // x, y, pixmap
- self->drawPixmap(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- qscriptvalue_cast<QPixmap>(ctx->argument(2)));
- } else if (ctx->argumentCount() == 5) {
- // x, y, width, height, pixmap
- self->drawPixmap(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32(),
- qscriptvalue_cast<QPixmap>(ctx->argument(4)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawPoint(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawPoint);
- if (ctx->argumentCount() == 2) {
- // drawPoint(x, y)
- self->drawPoint(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32());
- } else if (ctx->argumentCount() == 1) {
- // drawPoint(point)
- self->drawPoint(qscriptvalue_cast<QPointF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawPoints(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawPoints);
- self->drawPoints(qscriptvalue_cast<QPolygonF>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawPolygon(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawPolygon);
- // ### fillRule (2nd argument)
- self->drawPolygon(qscriptvalue_cast<QPolygonF>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawPolyline(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawPolyline);
- self->drawPolyline(qscriptvalue_cast<QPolygonF>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawRect(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawRect);
- if (ctx->argumentCount() == 4) {
- // x, y, width, height
- self->drawRect(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32());
- } else if (ctx->argumentCount() == 1) {
- // rect
- self->drawRect(qscriptvalue_cast<QRectF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawRects(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawRects);
- self->drawRects(qscriptvalue_cast<QVector<QRectF> >(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawRoundRect(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawRoundRect);
- // ### xRnd, yRnd
- if (ctx->argumentCount() >= 4) {
- self->drawRoundRect(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32());
- } else {
- self->drawRoundRect(qscriptvalue_cast<QRectF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawText(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawText);
- if (ctx->argumentCount() == 3) {
- // x, y, text
- self->drawText(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toString());
- } else if (ctx->argumentCount() == 2) {
- QScriptValue arg0 = ctx->argument(0);
- if (arg0.property("width").isValid()) {
- self->drawText(qscriptvalue_cast<QRectF>(arg0),
- ctx->argument(1).toString());
- } else {
- self->drawText(qscriptvalue_cast<QPointF>(arg0),
- ctx->argument(1).toString());
- }
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue drawTiledPixmap(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, drawTiledPixmap);
- if (ctx->argumentCount() >= 5) {
- // x, y, width, height, pixmap, sx, sy
- self->drawTiledPixmap(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32(),
- qscriptvalue_cast<QPixmap>(ctx->argument(4)),
- ctx->argument(5).toInt32(),
- ctx->argument(6).toInt32());
- } else {
- // rect, pixmap, position
- self->drawTiledPixmap(qscriptvalue_cast<QRectF>(ctx->argument(0)),
- qscriptvalue_cast<QPixmap>(ctx->argument(1)),
- qscriptvalue_cast<QPointF>(ctx->argument(2)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue end(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, end);
- return QScriptValue(eng, self->end());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue eraseRect(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, eraseRect);
- if (ctx->argumentCount() == 4) {
- // x, y, width, height
- self->eraseRect(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32());
- } else if (ctx->argumentCount() == 1) {
- // rect
- self->eraseRect(qscriptvalue_cast<QRectF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue fillPath(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, fillPath);
- QPainterPath *path = qscriptvalue_cast<QPainterPath*>(ctx->argument(0));
- if (!path) {
- return ctx->throwError(QScriptContext::TypeError,
- "QPainter.prototype.fillPath: argument is not a PainterPath");
- }
- self->fillPath(*path, qscriptvalue_cast<QBrush>(ctx->argument(1)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue fillRect(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, fillRect);
- if (ctx->argumentCount() == 5) {
- // x, y, width, height, brush
- self->fillRect(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32(),
- qscriptvalue_cast<QBrush>(ctx->argument(4)));
- } else if (ctx->argumentCount() == 2) {
- // rect, brush
- self->fillRect(qscriptvalue_cast<QRectF>(ctx->argument(0)),
- qscriptvalue_cast<QBrush>(ctx->argument(1)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue font(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, font);
- return qScriptValueFromValue(eng, self->font());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue hasClipping(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, hasClipping);
- return QScriptValue(eng, self->hasClipping());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue active(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, active);
- return QScriptValue(eng, self->isActive());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue layoutDirection(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, layoutDirection);
- return QScriptValue(eng, static_cast<int>(self->layoutDirection()));
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue opacity(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, opacity);
- return QScriptValue(eng, self->opacity());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue pen(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, pen);
- return qScriptValueFromValue(eng, self->pen());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue renderHints(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, renderHints);
- return QScriptValue(eng, static_cast<int>(self->renderHints()));
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue resetMatrix(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, resetMatrix);
- self->resetMatrix();
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue resetTransform(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, resetTransform);
- self->resetTransform();
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue restore(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, restore);
- self->restore();
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue rotate(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, rotate);
- self->rotate(ctx->argument(0).toNumber());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue save(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, save);
- self->save();
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue scale(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, scale);
- self->scale(ctx->argument(0).toNumber(),
- ctx->argument(1).toNumber());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setBackground(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setBackground);
- self->setBackground(qscriptvalue_cast<QBrush>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setBackgroundMode(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setBackgroundMode);
- self->setBackgroundMode(static_cast<Qt::BGMode>(ctx->argument(0).toInt32()));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setBrush(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setBrush);
- self->setBrush(qscriptvalue_cast<QBrush>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setBrushOrigin(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setBrushOrigin);
- self->setBrushOrigin(qscriptvalue_cast<QPointF>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setClipPath(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setClipPath);
- // ### ClipOperation
- self->setClipPath(qscriptvalue_cast<QPainterPath>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setClipRect(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setClipRect);
- // ### ClipOperation
- if (ctx->argumentCount() >= 4) {
- // x, y, width, height [, operation]
- self->setClipRect(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32());
- } else if (ctx->argumentCount() >= 1) {
- // rect [, operation]
- self->setClipRect(qscriptvalue_cast<QRectF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setClipRegion(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setClipRegion);
- // ### ClipOperation
- self->setClipRegion(qscriptvalue_cast<QRegion>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setClipping(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setClipping);
- self->setClipping(ctx->argument(0).toBoolean());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setCompositionMode(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setCompositionMode);
- self->setCompositionMode(static_cast<QPainter::CompositionMode>(ctx->argument(0).toInt32()));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setFont(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setFont);
- self->setFont(qscriptvalue_cast<QFont>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setLayoutDirection(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setLayoutDirection);
- self->setLayoutDirection(static_cast<Qt::LayoutDirection>(ctx->argument(0).toInt32()));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setOpacity(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setOpacity);
- self->setOpacity(ctx->argument(0).toNumber());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setPen(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setPen);
- self->setPen(qscriptvalue_cast<QPen>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setRenderHint(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setRenderHint);
- self->setRenderHint(static_cast<QPainter::RenderHint>(ctx->argument(0).toInt32()),
- ctx->argument(1).toBoolean());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setRenderHints(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setRenderHints);
- self->setRenderHints(static_cast<QPainter::RenderHints>(ctx->argument(0).toInt32()),
- ctx->argument(1).toBoolean());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setTransform(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setTransform);
- self->setTransform(qscriptvalue_cast<QTransform>(ctx->argument(0)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setViewTransformEnabled(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setViewTransformEnabled);
- self->setViewTransformEnabled(ctx->argument(0).toBoolean());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setViewport(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setViewport);
- if (ctx->argumentCount() == 4) {
- // x, y, width, height
- self->setViewport(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32());
- } else if (ctx->argumentCount() == 1) {
- // rect
- self->setViewport(qscriptvalue_cast<QRect>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setWindow(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setWindow);
- if (ctx->argumentCount() == 4) {
- // x, y, width, height
- self->setWindow(ctx->argument(0).toInt32(),
- ctx->argument(1).toInt32(),
- ctx->argument(2).toInt32(),
- ctx->argument(3).toInt32());
- } else if (ctx->argumentCount() == 1) {
- // rect
- self->setWindow(qscriptvalue_cast<QRect>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setWorldMatrix(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setWorldMatrix);
- self->setWorldMatrix(qscriptvalue_cast<QMatrix>(ctx->argument(0)),
- ctx->argument(1).toBoolean());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setWorldMatrixEnabled(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setWorldMatrixEnabled);
- self->setWorldMatrixEnabled(ctx->argument(0).toBoolean());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue setWorldTransform(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, setWorldTransform);
- self->setWorldTransform(qscriptvalue_cast<QTransform>(ctx->argument(0)),
- ctx->argument(1).toBoolean());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue shear(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, shear);
- self->shear(ctx->argument(0).toNumber(),
- ctx->argument(1).toNumber());
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue strokePath(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, strokePath);
- QPainterPath *path = qscriptvalue_cast<QPainterPath*>(ctx->argument(0));
- if (!path) {
- return ctx->throwError(QScriptContext::TypeError,
- "QPainter.prototype.strokePath: argument is not a PainterPath");
- }
- self->strokePath(*path, qscriptvalue_cast<QPen>(ctx->argument(1)));
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue testRenderHint(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, testRenderHint);
- return QScriptValue(eng, self->testRenderHint(static_cast<QPainter::RenderHint>(ctx->argument(0).toInt32())));
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue transform(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, transform);
- return qScriptValueFromValue(eng, self->transform());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue translate(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, translate);
- if (ctx->argumentCount() == 2) {
- // dx, dy
- self->translate(ctx->argument(0).toNumber(),
- ctx->argument(1).toNumber());
- } else if (ctx->argumentCount() == 1) {
- // offset
- self->translate(qscriptvalue_cast<QPointF>(ctx->argument(0)));
- }
- return eng->undefinedValue();
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue viewTransformEnabled(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, viewTransformEnabled);
- return QScriptValue(eng, self->viewTransformEnabled());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue viewport(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, viewport);
- return qScriptValueFromValue(eng, self->viewport());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue window(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, window);
- return qScriptValueFromValue(eng, self->window());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue worldMatrix(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, worldMatrix);
- return qScriptValueFromValue(eng, self->worldMatrix());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue worldMatrixEnabled(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, worldMatrixEnabled);
- return QScriptValue(eng, self->worldMatrixEnabled());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue worldTransform(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, worldTransform);
- return qScriptValueFromValue(eng, self->worldTransform());
-}
-
-/////////////////////////////////////////////////////////////
-
-static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPainter, toString);
- return QScriptValue(eng, "QPainter");
-}
-
-/////////////////////////////////////////////////////////////
-
-QScriptValue constructPainterClass(QScriptEngine *eng)
-{
- QScriptValue proto = newPainter(eng, new QPainter());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
-
- proto.setProperty("background", eng->newFunction(background), getter);
- proto.setProperty("background", eng->newFunction(setBackground), setter);
-
- proto.setProperty("backgroundMode", eng->newFunction(backgroundMode), getter);
- proto.setProperty("backgroundMode", eng->newFunction(setBackgroundMode), setter);
-
- proto.setProperty("brush", eng->newFunction(brush), getter);
- proto.setProperty("brush", eng->newFunction(setBrush), setter);
-
- proto.setProperty("brushOrigin", eng->newFunction(brushOrigin), getter);
- proto.setProperty("brushOrigin", eng->newFunction(setBrushOrigin), setter);
-
- proto.setProperty("clipping", eng->newFunction(hasClipping), getter);
- proto.setProperty("clipping", eng->newFunction(setClipping), getter);
-
- proto.setProperty("clipPath", eng->newFunction(clipPath), getter);
- proto.setProperty("clipPath", eng->newFunction(setClipPath), setter);
-
- proto.setProperty("clipRegion", eng->newFunction(clipRegion), getter);
- proto.setProperty("clipRegion", eng->newFunction(setClipRegion), setter);
-
- proto.setProperty("compositionMode", eng->newFunction(compositionMode), getter);
- proto.setProperty("compositionMode", eng->newFunction(setCompositionMode), setter);
-
- proto.setProperty("font", eng->newFunction(font), getter);
- proto.setProperty("font", eng->newFunction(setFont), setter);
-
- proto.setProperty("layoutDirection", eng->newFunction(layoutDirection), getter);
- proto.setProperty("layoutDirection", eng->newFunction(setLayoutDirection), setter);
-
- proto.setProperty("opacity", eng->newFunction(opacity), getter);
- proto.setProperty("opacity", eng->newFunction(setOpacity), setter);
-
- proto.setProperty("pen", eng->newFunction(pen), getter);
- proto.setProperty("pen", eng->newFunction(setPen), setter);
-
- proto.setProperty("renderHints", eng->newFunction(renderHints), getter);
- proto.setProperty("renderHints", eng->newFunction(setRenderHints), setter);
-
- proto.setProperty("transform", eng->newFunction(transform), getter);
- proto.setProperty("transform", eng->newFunction(setTransform), getter);
-
- proto.setProperty("viewport", eng->newFunction(viewport), getter);
- proto.setProperty("viewport", eng->newFunction(setViewport), setter);
-
- proto.setProperty("viewTransformEnabled", eng->newFunction(viewTransformEnabled), getter);
- proto.setProperty("viewTransformEnabled", eng->newFunction(setViewTransformEnabled), setter);
-
- proto.setProperty("window", eng->newFunction(window), getter);
- proto.setProperty("window", eng->newFunction(setWindow), setter);
-
- proto.setProperty("worldMatrix", eng->newFunction(worldMatrix), getter);
- proto.setProperty("worldMatrix", eng->newFunction(setWorldMatrix), setter);
-
- proto.setProperty("worldTransform", eng->newFunction(worldTransform), getter);
- proto.setProperty("worldTransform", eng->newFunction(setWorldTransform), setter);
-
- proto.setProperty("worldMatrixEnabled", eng->newFunction(worldMatrixEnabled), getter);
- proto.setProperty("worldMatrixEnabled", eng->newFunction(setWorldMatrixEnabled), setter);
-
- proto.setProperty("combinedMatrix", eng->newFunction(combinedMatrix), getter);
- proto.setProperty("combinedTransform", eng->newFunction(combinedTransform), getter);
- proto.setProperty("active", eng->newFunction(active), getter);
-
- ADD_METHOD(proto, begin);
- ADD_METHOD(proto, end);
- ADD_METHOD(proto, boundingRect);
- ADD_METHOD(proto, drawChord);
- ADD_METHOD(proto, drawConvexPolygon);
- ADD_METHOD(proto, drawArc);
- ADD_METHOD(proto, drawEllipse);
- ADD_METHOD(proto, drawImage);
- ADD_METHOD(proto, drawLine);
- ADD_METHOD(proto, drawLines);
- ADD_METHOD(proto, drawPath);
- ADD_METHOD(proto, drawPicture);
- ADD_METHOD(proto, drawPie);
- ADD_METHOD(proto, drawPixmap);
- ADD_METHOD(proto, drawPoint);
- ADD_METHOD(proto, drawPoints);
- ADD_METHOD(proto, drawPolygon);
- ADD_METHOD(proto, drawPolyline);
- ADD_METHOD(proto, drawRect);
- ADD_METHOD(proto, drawRects);
- ADD_METHOD(proto, drawRoundRect);
- ADD_METHOD(proto, drawText);
- ADD_METHOD(proto, drawTiledPixmap);
- ADD_METHOD(proto, eraseRect);
- ADD_METHOD(proto, fillPath);
- ADD_METHOD(proto, fillRect);
- ADD_METHOD(proto, resetMatrix);
- ADD_METHOD(proto, resetTransform);
- ADD_METHOD(proto, restore);
- ADD_METHOD(proto, rotate);
- ADD_METHOD(proto, save);
- ADD_METHOD(proto, scale);
- ADD_METHOD(proto, setClipRect);
- ADD_METHOD(proto, setRenderHint);
- ADD_METHOD(proto, shear);
- ADD_METHOD(proto, strokePath);
- ADD_METHOD(proto, testRenderHint);
- ADD_METHOD(proto, toString);
- ADD_METHOD(proto, translate);
-
- QScript::registerPointerMetaType<QPainter>(eng, proto);
-
- qScriptRegisterSequenceMetaType<QVector<QRectF> >(eng);
-
- QScriptValue ctorFun = eng->newFunction(ctor, proto);
- ADD_ENUM_VALUE(ctorFun, QPainter, Antialiasing);
- ADD_ENUM_VALUE(ctorFun, QPainter, TextAntialiasing);
- ADD_ENUM_VALUE(ctorFun, QPainter, SmoothPixmapTransform);
- ADD_ENUM_VALUE(ctorFun, QPainter, HighQualityAntialiasing);
-
- eng->setDefaultPrototype(qMetaTypeId<QPainter*>(), proto);
-
- return ctorFun;
-}
+++ /dev/null
-/*
- * Copyright (c) 2009 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QPen>
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QPen*)
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- Q_UNUSED(ctx)
- return qScriptValueFromValue(eng, QPen());
-}
-
-static QScriptValue brush(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, brush);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setBrush(qscriptvalue_cast<QBrush>(arg));
- }
-
- return qScriptValueFromValue(eng, self->brush());
-}
-
-static QScriptValue color(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, color);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setColor(qscriptvalue_cast<QColor>(arg));
- }
-
- return qScriptValueFromValue(eng, self->color());
-}
-
-static QScriptValue style(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, style);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setStyle(Qt::PenStyle(arg.toInt32()));
- }
-
- return QScriptValue(eng, self->style());
-}
-
-static QScriptValue capStyle(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, capStyle);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setCapStyle(Qt::PenCapStyle(arg.toInt32()));
- }
-
- return QScriptValue(eng, self->capStyle());
-}
-
-static QScriptValue joinStyle(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, joinStyle);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setJoinStyle(Qt::PenJoinStyle(arg.toInt32()));
- }
-
- return QScriptValue(eng, self->joinStyle());
-}
-
-static QScriptValue dashOffset(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, dashOffset);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setDashOffset(arg.toInt32());
- }
-
- return QScriptValue(eng, self->dashOffset());
-}
-
-static QScriptValue miterLimit(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, miterLimit);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setMiterLimit(arg.toInt32());
- }
-
- return QScriptValue(eng, self->miterLimit());
-}
-
-static QScriptValue width(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, width);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setWidth(arg.toInt32());
- }
-
- return QScriptValue(eng, self->width());
-}
-
-static QScriptValue solid(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPen, solid);
- return QScriptValue(eng, self->isSolid());
-}
-
-QScriptValue constructPenClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QColor());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
- proto.setProperty("brush", eng->newFunction(brush), getter | setter);
- proto.setProperty("color", eng->newFunction(color), getter | setter);
- proto.setProperty("capStyle", eng->newFunction(capStyle), getter | setter);
- proto.setProperty("joinStyle", eng->newFunction(joinStyle), getter | setter);
- proto.setProperty("style", eng->newFunction(style), getter | setter);
- proto.setProperty("dashOffset", eng->newFunction(dashOffset), getter | setter);
- proto.setProperty("miterLimit", eng->newFunction(miterLimit), getter | setter);
- proto.setProperty("width", eng->newFunction(width), getter | setter);
- proto.setProperty("solid", eng->newFunction(solid), getter);
-
- QScriptValue ctorFun = eng->newFunction(ctor, proto);
- ADD_ENUM_VALUE(ctorFun, Qt, FlatCap);
- ADD_ENUM_VALUE(ctorFun, Qt, SquareCap);
- ADD_ENUM_VALUE(ctorFun, Qt, RoundCap);
- ADD_ENUM_VALUE(ctorFun, Qt, RoundCap);
- ADD_ENUM_VALUE(ctorFun, Qt, BevelJoin);
- ADD_ENUM_VALUE(ctorFun, Qt, MiterJoin);
- ADD_ENUM_VALUE(ctorFun, Qt, RoundJoin);
- ADD_ENUM_VALUE(ctorFun, Qt, SolidLine);
- ADD_ENUM_VALUE(ctorFun, Qt, DashLine);
- ADD_ENUM_VALUE(ctorFun, Qt, DotLine);
- ADD_ENUM_VALUE(ctorFun, Qt, DashDotLine);
- ADD_ENUM_VALUE(ctorFun, Qt, DashDotDotLine);
- ADD_ENUM_VALUE(ctorFun, Qt, CustomDashLine);
-
- eng->setDefaultPrototype(qMetaTypeId<QPen>(), proto);
- eng->setDefaultPrototype(qMetaTypeId<QPen*>(), proto);
-
- return ctorFun;
-}
-
+++ /dev/null
-/*
- * Copyright 2009 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QPixmap>
-#include "backportglobal.h"
-#include "plasmoid/appletinterface.h"
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() == 1 && ctx->argument(0).isString()) {
- // a path on disk in the package
- AppletInterface *interface = AppletInterface::extract(eng);
- const QString path = interface ? interface->file("images", ctx->argument(0).toString()) : QString();
- return qScriptValueFromValue(eng, QPixmap(path));
- }
-
- if (ctx->argumentCount() == 2) {
- qreal x = ctx->argument(0).toNumber();
- qreal y = ctx->argument(1).toNumber();
- return qScriptValueFromValue(eng, QPixmap(x, y));
- }
-
- return qScriptValueFromValue(eng, QPixmap());
-}
-
-static QScriptValue rect(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPixmap, rect)
- return qScriptValueFromValue(eng, QRectF(self->rect()));
-}
-
-static QScriptValue null(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPixmap, null);
- return QScriptValue(eng, self->isNull());
-}
-
-static QScriptValue scaled(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QPixmap, scaled);
- qreal x = ctx->argument(0).toNumber();
- qreal y = ctx->argument(1).toNumber();
- return qScriptValueFromValue(eng, self->scaled(x, y));
-}
-
-QScriptValue constructQPixmapClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QPixmap());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- proto.setProperty("null", eng->newFunction(null), getter);
- proto.setProperty("rect", eng->newFunction(rect), getter);
- proto.setProperty("scaled", eng->newFunction(scaled));
-
- eng->setDefaultPrototype(qMetaTypeId<QPixmap>(), proto);
- eng->setDefaultPrototype(qMetaTypeId<QPixmap*>(), proto);
-
- return eng->newFunction(ctor, proto);
-}
+++ /dev/null
-/*
- * Copyright 2007-2008 Richard J. Moore <rich@kde.org>
- * Copyright 2009 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QScriptEngine>
-
-#include <KConfigGroup>
-#include <KIO/Job>
-#include <KSharedConfig>
-
-#include "dataengine.h"
-
-Q_DECLARE_METATYPE(KConfigGroup)
-Q_DECLARE_METATYPE(KJob *)
-
-typedef KJob* KJobPtr;
-QScriptValue qScriptValueFromKJob(QScriptEngine *engine, const KJobPtr &job)
-{
- return engine->newQObject(const_cast<KJob *>(job), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject);
-}
-
-void qKJobFromQScriptValue(const QScriptValue &scriptValue, KJobPtr &job)
-{
- QObject *obj = scriptValue.toQObject();
- job = static_cast<KJob *>(obj);
-}
-
-Q_DECLARE_METATYPE(KIO::Job *)
-typedef KIO::Job* KioJobPtr;
-QScriptValue qScriptValueFromKIOJob(QScriptEngine *engine, const KioJobPtr &job)
-{
- return engine->newQObject(const_cast<KIO::Job *>(job), QScriptEngine::AutoOwnership, QScriptEngine::PreferExistingWrapperObject);
-}
-
-void qKIOJobFromQScriptValue(const QScriptValue &scriptValue, KioJobPtr &job)
-{
- QObject *obj = scriptValue.toQObject();
- job = static_cast<KIO::Job *>(obj);
-}
-
-QScriptValue qScriptValueFromKConfigGroup(QScriptEngine *engine, const KConfigGroup &config)
-{
- QScriptValue obj = engine->newObject();
-
- if (!config.isValid()) {
- return obj;
- }
-
- QMap<QString, QString> entryMap = config.entryMap();
- QMap<QString, QString>::const_iterator it = entryMap.constBegin();
- QMap<QString, QString>::const_iterator begin = it;
- QMap<QString, QString>::const_iterator end = entryMap.constEnd();
-
- //setting the group name
- obj.setProperty("__file", QScriptValue(engine, config.config()->name()));
- obj.setProperty("__name", QScriptValue(engine, config.name()));
-
- //setting the key/value pairs
- for (it = begin; it != end; ++it) {
- //kDebug() << "setting" << it.key() << "to" << it.value();
- QString prop = it.key();
- prop.replace(' ', '_');
- obj.setProperty(prop, it.value());
- }
-
- return obj;
-}
-
-void kConfigGroupFromScriptValue(const QScriptValue& obj, KConfigGroup &config)
-{
- config = KConfigGroup(KSharedConfig::openConfig(obj.property("__file").toString()), obj.property("__name").toString());
-
- QScriptValueIterator it(obj);
-
- while (it.hasNext()) {
- it.next();
- //kDebug() << it.name() << "is" << it.value().toString();
- if (it.name() != "__name") {
- config.writeEntry(it.name(), it.value().toString());
- }
- }
-}
-
-using namespace Plasma;
-
-void registerNonGuiMetaTypes(QScriptEngine *engine)
-{
- qScriptRegisterMetaType<KConfigGroup>(engine, qScriptValueFromKConfigGroup, kConfigGroupFromScriptValue);
- qScriptRegisterMetaType<KJob *>(engine, qScriptValueFromKJob, qKJobFromQScriptValue);
- qScriptRegisterMetaType<KIO::Job *>(engine, qScriptValueFromKIOJob, qKIOJobFromQScriptValue);
- registerDataEngineMetaTypes(engine);
-}
-
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QtCore/qrect.h>
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QRectF*)
-Q_DECLARE_METATYPE(QRectF)
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() == 4)
- {
- qreal x = ctx->argument(0).toNumber();
- qreal y = ctx->argument(1).toNumber();
- qreal width = ctx->argument(2).toNumber();
- qreal height = ctx->argument(3).toNumber();
- return qScriptValueFromValue(eng, QRectF(x, y, width, height));
- }
-
- return qScriptValueFromValue(eng, QRectF());
-}
-
-static QScriptValue adjust(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, adjust);
- qreal dx1 = ctx->argument(0).toNumber();
- qreal dy1 = ctx->argument(1).toNumber();
- qreal dx2 = ctx->argument(2).toNumber();
- qreal dy2 = ctx->argument(3).toNumber();
-
- self->adjust(dx1, dy1, dx2, dy2);
- return QScriptValue();
-}
-
-static QScriptValue adjusted(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, adjusted);
- qreal dx1 = ctx->argument(0).toNumber();
- qreal dy1 = ctx->argument(1).toNumber();
- qreal dx2 = ctx->argument(2).toNumber();
- qreal dy2 = ctx->argument(3).toNumber();
-
- QRectF tmp = self->adjusted(dx1, dy1, dx2, dy2);
- return qScriptValueFromValue(eng, tmp);
-}
-
-static QScriptValue bottom(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, bottom);
-
- if (ctx->argumentCount() > 0) {
- int bottom = ctx->argument(0).toInt32();
- self->setBottom(bottom);
- }
-
- return QScriptValue(eng, self->bottom());
-}
-
-static QScriptValue top(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, top);
-
- if (ctx->argumentCount() > 0) {
- int top = ctx->argument(0).toInt32();
- self->setTop(top);
- }
-
- return QScriptValue(eng, self->top());
-}
-
-static QScriptValue contains(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, contains);
- qreal x = ctx->argument(0).toNumber();
- qreal y = ctx->argument(1).toNumber();
- return QScriptValue(eng, self->contains(x, y));
-}
-
-static QScriptValue height(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, height);
-
- if (ctx->argumentCount() > 0) {
- int height = ctx->argument(0).toInt32();
- self->setHeight(height);
- }
-
- return QScriptValue(eng, self->height());
-}
-
-static QScriptValue empty(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, empty);
- return QScriptValue(eng, self->isEmpty());
-}
-
-static QScriptValue null(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, null);
- return QScriptValue(eng, self->isNull());
-}
-
-static QScriptValue valid(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, valid);
- return QScriptValue(eng, self->isValid());
-}
-
-static QScriptValue left(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, left);
-
- if (ctx->argumentCount() > 0) {
- int left = ctx->argument(0).toInt32();
- self->setLeft(left);
- }
-
- return QScriptValue(eng, self->left());
-}
-
-static QScriptValue moveBottom(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, moveBottom);
- qreal bottom = ctx->argument(0).toNumber();
- self->moveBottom(bottom);
- return QScriptValue();
-}
-
-static QScriptValue moveLeft(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, moveLeft);
- qreal left = ctx->argument(0).toNumber();
- self->moveLeft(left);
- return QScriptValue();
-}
-
-static QScriptValue moveRight(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, moveRight);
- qreal right = ctx->argument(0).toNumber();
- self->moveRight(right);
- return QScriptValue();
-}
-
-
-static QScriptValue moveTo(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, moveTo);
- qreal x = ctx->argument(0).toNumber();
- qreal y = ctx->argument(1).toNumber();
- self->moveTo(x, y);
- return QScriptValue();
-}
-
-static QScriptValue moveTop(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, moveTop);
- qreal top = ctx->argument(0).toNumber();
- self->moveTop(top);
- return QScriptValue();
-}
-
-static QScriptValue right(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, right);
-
- if (ctx->argumentCount() > 0) {
- int right = ctx->argument(0).toInt32();
- self->setRight(right);
- }
-
- return QScriptValue(eng, self->right());
-}
-
-static QScriptValue setCoords(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, setCoords);
- qreal x1 = ctx->argument(0).toNumber();
- qreal y1 = ctx->argument(1).toNumber();
- qreal x2 = ctx->argument(2).toNumber();
- qreal y2 = ctx->argument(3).toNumber();
- self->setCoords(x1, y1, x2, y2);
- return QScriptValue();
-}
-
-static QScriptValue setRect(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, setRect);
- qreal x = ctx->argument(0).toNumber();
- qreal y = ctx->argument(1).toNumber();
- qreal width = ctx->argument(2).toNumber();
- qreal height = ctx->argument(3).toNumber();
- self->setRect(x, y, width, height);
- return QScriptValue();
-}
-
-static QScriptValue translate(QScriptContext *ctx, QScriptEngine *)
-{
- DECLARE_SELF(QRectF, translate);
- qreal dx = ctx->argument(0).toNumber();
- qreal dy = ctx->argument(1).toNumber();
- self->translate(dx, dy);
- return QScriptValue();
-}
-
-static QScriptValue width(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, width);
-
- if (ctx->argumentCount() > 0) {
- int width = ctx->argument(0).toInt32();
- self->setWidth(width);
- }
-
- return QScriptValue(eng, self->width());
-}
-
-static QScriptValue x(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, x);
-
- if (ctx->argumentCount() > 0) {
- int x = ctx->argument(0).toInt32();
- self->setX(x);
- }
-
- return QScriptValue(eng, self->x());
-}
-
-static QScriptValue y(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QRectF, y);
-
- if (ctx->argumentCount() > 0) {
- int y = ctx->argument(0).toInt32();
- self->setY(y);
- }
-
- return QScriptValue(eng, self->y());
-}
-
-/* Not Implemented Yet */
-// QPointF bottomLeft () const
-// QPointF bottomRight () const
-// QPointF center () const
-// bool contains ( const QPointF & point ) const
-// bool contains ( const QRectF & rectangle ) const
-// void getCoords ( qreal * x1, qreal * y1, qreal * x2, qreal * y2 ) const
-// void getRect ( qreal * x, qreal * y, qreal * width, qreal * height ) const
-// QRectF intersected ( const QRectF & rectangle ) const
-// bool intersects ( const QRectF & rectangle ) const
-// void moveBottomLeft ( const QPointF & position )
-// void moveBottomRight ( const QPointF & position )
-// void moveCenter ( const QPointF & position )
-// void moveTo ( const QPointF & position )
-// void moveTopLeft ( const QPointF & position )
-// void moveTopRight ( const QPointF & position )
-// QRectF normalized () const
-// void setBottomLeft ( const QPointF & position )
-// void setBottomRight ( const QPointF & position )
-// void setSize ( const QSizeF & size )
-// void setTopLeft ( const QPointF & position )
-// void setTopRight ( const QPointF & position )
-// QSizeF size () const
-// QRect toAlignedRect () const
-// QRect toRect () const
-// QPointF topLeft () const
-// QPointF topRight () const
-// void translate ( const QPointF & offset )
-// QRectF translated ( qreal dx, qreal dy ) const
-// QRectF translated ( const QPointF & offset ) const
-// QRectF united ( const QRectF & rectangle ) const
-
-QScriptValue constructQRectFClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QRectF());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
-
- proto.setProperty("adjust", eng->newFunction(adjust));
- proto.setProperty("adjusted", eng->newFunction(adjusted));
- proto.setProperty("translate", eng->newFunction(translate));
- proto.setProperty("setCoords", eng->newFunction(setCoords));
- proto.setProperty("setRect", eng->newFunction(setRect));
-
- proto.setProperty("contains", eng->newFunction(contains));
-
- proto.setProperty("moveBottom", eng->newFunction(moveBottom));
- proto.setProperty("moveLeft", eng->newFunction(moveLeft));
- proto.setProperty("moveRight", eng->newFunction(moveRight));
- proto.setProperty("moveTo", eng->newFunction(moveTo));
- proto.setProperty("moveTop", eng->newFunction(moveTop));
-
- proto.setProperty("empty", eng->newFunction(empty), getter);
- proto.setProperty("null", eng->newFunction(null), getter);
- proto.setProperty("valid", eng->newFunction(valid), getter);
-
- proto.setProperty("left", eng->newFunction(left), getter | setter);
- proto.setProperty("top", eng->newFunction(top), getter | setter);
- proto.setProperty("bottom", eng->newFunction(bottom), getter | setter);
- proto.setProperty("right", eng->newFunction(right), getter | setter);
- proto.setProperty("height", eng->newFunction(height), getter | setter);
- proto.setProperty("width", eng->newFunction(width), getter | setter);
- proto.setProperty("x", eng->newFunction(x), getter | setter);
- proto.setProperty("y", eng->newFunction(y), getter | setter);
-
- eng->setDefaultPrototype(qMetaTypeId<QRectF>(), proto);
- eng->setDefaultPrototype(qMetaTypeId<QRectF*>(), proto);
-
- return eng->newFunction(ctor, proto);
-}
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QtCore/qsize.h>
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QSizeF*)
-Q_DECLARE_METATYPE(QSizeF)
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- if (ctx->argumentCount() == 2) {
- qreal width = ctx->argument(1).toNumber();
- qreal height = ctx->argument(1).toNumber();
- return qScriptValueFromValue(eng, QSizeF(width, height));
- }
-
- return qScriptValueFromValue(eng, QSizeF());
-}
-
-static QScriptValue width(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QSizeF, width);
- if (ctx->argumentCount() > 0) {
- qreal width = ctx->argument(0).toNumber();
- self->setWidth(width);
- }
-
- return QScriptValue(eng, self->width());
-}
-
-static QScriptValue height(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QSizeF, height);
- if (ctx->argumentCount() > 0) {
- qreal height = ctx->argument(0).toNumber();
- self->setHeight(height);
- }
-
- return QScriptValue(eng, self->height());
-}
-
-QScriptValue constructQSizeFClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QSizeF());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
-
- proto.setProperty("width", eng->newFunction(width), getter | setter);
- proto.setProperty("height", eng->newFunction(height), getter | setter);
-
- eng->setDefaultPrototype(qMetaTypeId<QSizeF>(), proto);
- eng->setDefaultPrototype(qMetaTypeId<QSizeF*>(), proto);
- return eng->newFunction(ctor, proto);
-}
-
+++ /dev/null
-/*
- * Copyright (c) 2010 Aaron J. Seigo <aseigo@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QSizePolicy>
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QSizePolicy*)
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- QSizePolicy::Policy h(QSizePolicy::Fixed);
- QSizePolicy::Policy v(QSizePolicy::Fixed);
- if (ctx->argumentCount() > 1) {
- h = static_cast<QSizePolicy::Policy>(ctx->argument(0).toInt32());
- v = static_cast<QSizePolicy::Policy>(ctx->argument(1).toInt32());
- }
-
- QScriptValue value = qScriptValueFromValue(eng, QSizePolicy(h, v));
- return value;
-}
-
-static QScriptValue horizontalPolicy(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QSizePolicy, horizontalPolicy);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setHorizontalPolicy(static_cast<QSizePolicy::Policy>(arg.toInt32()));
- }
-
- return QScriptValue(eng, self->horizontalPolicy());
-}
-
-static QScriptValue verticalPolicy(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QSizePolicy, vertialPolicy);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setVerticalPolicy(static_cast<QSizePolicy::Policy>(arg.toInt32()));
- }
-
- return QScriptValue(eng, self->verticalPolicy());
-}
-
-static QScriptValue horizontalStretch(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QSizePolicy, horizontalStretch);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setHorizontalStretch(arg.toInt32());
- }
-
- return QScriptValue(eng, self->horizontalStretch());
-}
-
-static QScriptValue verticalStretch(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QSizePolicy, verticalStretch);
-
- if (ctx->argumentCount() > 0) {
- QScriptValue arg = ctx->argument(0);
- self->setVerticalStretch(arg.toInt32());
- }
-
- return QScriptValue(eng, self->verticalStretch());
-}
-
-QScriptValue constructQSizePolicyClass(QScriptEngine *eng)
-{
- QScriptValue proto = qScriptValueFromValue(eng, QSizePolicy());
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
- proto.setProperty("horizontalPolicy", eng->newFunction(horizontalPolicy), getter | setter);
- proto.setProperty("verticalPolicy", eng->newFunction(verticalPolicy), getter | setter);
- proto.setProperty("horizontalStretch", eng->newFunction(horizontalStretch), getter | setter);
- proto.setProperty("verticalStretch", eng->newFunction(verticalStretch), getter | setter);
-
- eng->setDefaultPrototype(qMetaTypeId<QSizePolicy>(), proto);
- eng->setDefaultPrototype(qMetaTypeId<QSizePolicy*>(), proto);
-
- return eng->newFunction(ctor, proto);
-}
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License version 2 as
- * published by the Free Software Foundation
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include <QtScript/QScriptValue>
-#include <QtScript/QScriptEngine>
-#include <QtScript/QScriptContext>
-#include <QtScript/QScriptable>
-#include <QtCore/QTimer>
-#include "backportglobal.h"
-
-Q_DECLARE_METATYPE(QTimer*)
-
-static QScriptValue newTimer(QScriptEngine *eng, QTimer *timer)
-{
- return eng->newQObject(timer, QScriptEngine::AutoOwnership);
-}
-
-static QScriptValue ctor(QScriptContext *ctx, QScriptEngine *eng)
-{
- return newTimer(eng, new QTimer(qscriptvalue_cast<QObject*>(ctx->argument(0))));
-}
-
-static QScriptValue toString(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QTimer, toString);
- return QScriptValue(eng, QString::fromLatin1("QTimer(interval=%0)")
- .arg(self->interval()));
-}
-
-static QScriptValue active(QScriptContext *ctx, QScriptEngine *eng)
-{
- DECLARE_SELF(QTimer, active);
-
- if (ctx->argumentCount()) {
- if (ctx->argument(0).toBool()) {
- self->start();
- } else {
- self->stop();
- }
- }
-
- return QScriptValue(eng, self->isActive());
-}
-
-QScriptValue constructTimerClass(QScriptEngine *eng)
-{
- QScriptValue proto = newTimer(eng, new QTimer());
- ADD_METHOD(proto, toString);
- eng->setDefaultPrototype(qMetaTypeId<QTimer*>(), proto);
- QScriptValue::PropertyFlags getter = QScriptValue::PropertyGetter;
- QScriptValue::PropertyFlags setter = QScriptValue::PropertySetter;
- proto.setProperty("active", eng->newFunction(active), getter | setter);
-
- return eng->newFunction(ctor, proto);
-}
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#include "uiloader.h"
-
-#include <QGraphicsGridLayout>
-#include <QGraphicsLinearLayout>
-#include <QStringList>
-
-#include <KDebug>
-
-#include <Plasma/BusyWidget>
-#include <Plasma/CheckBox>
-#include <Plasma/ComboBox>
-#include <Plasma/FlashingLabel>
-#include <Plasma/Frame>
-#include <Plasma/GroupBox>
-#include <Plasma/IconWidget>
-#include <Plasma/ItemBackground>
-#include <Plasma/Label>
-#include <Plasma/LineEdit>
-#include <Plasma/Meter>
-#include <Plasma/PushButton>
-#include <Plasma/RadioButton>
-#include <Plasma/ScrollBar>
-#include <Plasma/ScrollWidget>
-#include <Plasma/Separator>
-#include <Plasma/SignalPlotter>
-#include <Plasma/Slider>
-#include <Plasma/SpinBox>
-#include <Plasma/SvgWidget>
-#include <Plasma/TabBar>
-#include <Plasma/TextEdit>
-#include <Plasma/ToolButton>
-#include <Plasma/TreeView>
-#include <Plasma/WebView>
-
-
-QGraphicsWidget *createBusyWidget(QGraphicsWidget *parent) { return new Plasma::BusyWidget(parent); }
-QGraphicsWidget *createCheckBox(QGraphicsWidget *parent) { return new Plasma::CheckBox(parent); }
-QGraphicsWidget *createComboBox(QGraphicsWidget *parent) { return new Plasma::ComboBox(parent); }
-QGraphicsWidget *createFlashingLabel(QGraphicsWidget *parent) { return new Plasma::FlashingLabel(parent); }
-QGraphicsWidget *createFrame(QGraphicsWidget *parent) { return new Plasma::Frame(parent); }
-QGraphicsWidget *createGroupBox(QGraphicsWidget *parent) { return new Plasma::GroupBox(parent); }
-QGraphicsWidget *createIconWidget(QGraphicsWidget *parent) { return new Plasma::IconWidget(parent); }
-QGraphicsWidget *createItemBackground(QGraphicsWidget *parent) { return new Plasma::ItemBackground(parent); }
-QGraphicsWidget *createLabel(QGraphicsWidget *parent) { return new Plasma::Label(parent); }
-QGraphicsWidget *createLineEdit(QGraphicsWidget *parent) { return new Plasma::LineEdit(parent); }
-QGraphicsWidget *createMeter(QGraphicsWidget *parent) { return new Plasma::Meter(parent); }
-QGraphicsWidget *createPushButton(QGraphicsWidget *parent) { return new Plasma::PushButton(parent); }
-QGraphicsWidget *createRadioButton(QGraphicsWidget *parent) { return new Plasma::RadioButton(parent); }
-QGraphicsWidget *createScrollBar(QGraphicsWidget *parent) { return new Plasma::ScrollBar(parent); }
-QGraphicsWidget *createScrollWidget(QGraphicsWidget *parent) { return new Plasma::ScrollWidget(parent); }
-QGraphicsWidget *createSeparator(QGraphicsWidget *parent) { return new Plasma::Separator(parent); }
-QGraphicsWidget *createSignalPlotter(QGraphicsWidget *parent) { return new Plasma::SignalPlotter(parent); }
-QGraphicsWidget *createSlider(QGraphicsWidget *parent) { return new Plasma::Slider(parent); }
-QGraphicsWidget *createSpinBox(QGraphicsWidget *parent) { return new Plasma::SpinBox(parent); }
-QGraphicsWidget *createSvgWidget(QGraphicsWidget *parent) { return new Plasma::SvgWidget(parent); }
-QGraphicsWidget *createTabBar(QGraphicsWidget *parent) { return new Plasma::TabBar(parent); }
-QGraphicsWidget *createTextEdit(QGraphicsWidget *parent) { return new Plasma::TextEdit(parent); }
-QGraphicsWidget *createToolButton(QGraphicsWidget *parent) { return new Plasma::ToolButton(parent); }
-QGraphicsWidget *createTreeView(QGraphicsWidget *parent) { return new Plasma::TreeView(parent); }
-#ifdef HAVE_QTWEBKIT
-QGraphicsWidget *createWebView(QGraphicsWidget *parent) { return new Plasma::WebView(parent); }
-#endif
-QGraphicsWidget *createGraphicsWidget(QGraphicsWidget *parent) { return new QGraphicsWidget(parent); }
-
-UiLoader::UiLoader()
-{
- m_widgetCtors.insert("BusyWidget", createBusyWidget);
- m_widgetCtors.insert("CheckBox", createCheckBox);
- m_widgetCtors.insert("ComboBox", createComboBox);
- m_widgetCtors.insert("FlashingLabel", createFlashingLabel);
- m_widgetCtors.insert("Frame", createFrame);
- m_widgetCtors.insert("GroupBox", createGroupBox);
- m_widgetCtors.insert("IconWidget", createIconWidget);
- m_widgetCtors.insert("ItemBackground", createItemBackground);
- m_widgetCtors.insert("Label", createLabel);
- m_widgetCtors.insert("LineEdit", createLineEdit);
- m_widgetCtors.insert("Meter", createMeter);
- m_widgetCtors.insert("PushButton", createPushButton);
- m_widgetCtors.insert("RadioButton", createRadioButton);
- m_widgetCtors.insert("ScrollBar", createScrollBar);
- m_widgetCtors.insert("ScrollWidget", createScrollWidget);
- m_widgetCtors.insert("Separator", createSeparator);
- m_widgetCtors.insert("SignalPlotter", createSignalPlotter);
- m_widgetCtors.insert("Slider", createSlider);
- m_widgetCtors.insert("SpinBox", createSpinBox);
- m_widgetCtors.insert("SvgWidget", createSvgWidget);
- m_widgetCtors.insert("TabBar", createTabBar);
- m_widgetCtors.insert("TextEdit", createTextEdit);
- m_widgetCtors.insert("ToolButton", createToolButton);
- m_widgetCtors.insert("TreeView", createTreeView);
-#ifdef HAVE_QTWEBKIT
- m_widgetCtors.insert("WebView", createWebView);
-#endif
- m_widgetCtors.insert("GraphicsWidget", createGraphicsWidget);
-}
-
-UiLoader::~UiLoader()
-{
- kDebug();
-}
-
-QStringList UiLoader::availableWidgets() const
-{
- return m_widgetCtors.keys();
-}
-
-QGraphicsWidget *UiLoader::createWidget(const QString &className, QGraphicsWidget *parent)
-{
- widgetCreator w = m_widgetCtors.value(className, 0);
- if (w) {
- return (w)(parent);
- }
-
- return 0;
-}
-
-
+++ /dev/null
-/*
- * Copyright 2007 Richard J. Moore <rich@kde.org>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- */
-
-#ifndef PLASMA_UILOADER_H
-#define PLASMA_UILOADER_H
-
-#include <KSharedPtr>
-
-#include <plasma/applet.h>
-
-class QGraphicsWidget;
-
-class UiLoader : public QSharedData
-{
-public:
- UiLoader();
- virtual ~UiLoader();
-
- QStringList availableWidgets() const;
- QGraphicsWidget *createWidget(const QString &className, QGraphicsWidget *parent = 0);
-
-private:
- typedef QGraphicsWidget *(*widgetCreator)(QGraphicsWidget*);
- QHash<QString, widgetCreator> m_widgetCtors;
-};
-
-
-#endif // PLASMA_UILOADER_H
+++ /dev/null
-project(plasma-python)
-
-# install the library, .desktop, and plasma.py
-install(
- FILES
- pyappletscript.py
- plasma_importer.py
- pydataengine.py
- pyrunner.py
- pywallpaper.py
- DESTINATION
- ${DATA_INSTALL_DIR}/plasma_scriptengine_python
-)
-install(
- FILES plasmascript.py
- DESTINATION ${PYTHON_SITE_PACKAGES_DIR}/PyKDE4
-)
-
-install(
- FILES
- plasma-scriptengine-applet-python.desktop
- plasma-scriptengine-dataengine-python.desktop
- plasma-scriptengine-runner-python.desktop
- plasma-scriptengine-wallpaper-python.desktop
- DESTINATION ${SERVICES_INSTALL_DIR}
-)
-
-###########################################################################
-# Test plasmoids
-option(INSTALL_PYTHON_TEST_PLASMA "Install test python applet" OFF)
-
-if(INSTALL_PYTHON_TEST_PLASMA )
-
- install(DIRECTORY test/plasma-applet-pyclock DESTINATION ${DATA_INSTALL_DIR}/plasma/plasmoids)
-
- #TODO where install it ?
- #install(DIRECTORY test/plasma-dataengine-pytime DESTINATION ${DATA_INSTALL_DIR}/plasma/engines)
-
-endif(INSTALL_PYTHON_TEST_PLASMA)
+++ /dev/null
-[Desktop Entry]
-Name=Python Widget
-Name[ar]=ودجة بايثون
-Name[ast]=Widget de Python
-Name[be@latin]=Widžet „Python”
-Name[bg]=Джаджа на Python
-Name[bn]=পাইথন উইজেট
-Name[bn_IN]=Python উইজেট
-Name[bs]=Python grafičkih kontrola
-Name[ca]=Estri en Python
-Name[ca@valencia]=Estri en Python
-Name[cs]=Python widget
-Name[csb]=Interfejs Phythona
-Name[da]=Python-widget
-Name[de]=Python-Miniprogramm
-Name[el]=Συστατικό Python
-Name[en_GB]=Python Widget
-Name[eo]=Pitona fenestraĵo
-Name[es]=Widget de Python
-Name[et]=Pythoni vidin
-Name[eu]=Python trepeta
-Name[fi]=Python-sovelma
-Name[fr]=Composant graphique Python
-Name[fy]=Python Widget
-Name[ga]=Giuirléid Python
-Name[gl]=Widget de Python
-Name[gu]=પાયથોન વિજેટ
-Name[he]=ווידג׳ט של Python
-Name[hi]=पायथन विज़ेट
-Name[hne]=पायथन विजेट
-Name[hr]=Python widget
-Name[hu]=Python-elem
-Name[ia]=Elemento graphic (Widget) de Python
-Name[id]=Widget Python
-Name[is]=Python græja
-Name[ja]=Python ウィジェット
-Name[kk]=Python бөлшегі
-Name[km]=ធាតុក្រាហ្វិក Python
-Name[kn]=ಪೈಥಾನ್ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Name[ko]=파이썬 위젯
-Name[ku]=Alava Python
-Name[lt]=Python valdiklis
-Name[lv]=Python sīkrīks
-Name[ml]=പൈത്തണ് ഉരുപ്പടി
-Name[mr]=Python Widget
-Name[nb]=Pythonelement
-Name[nds]=Python-Lüttprogramm
-Name[nl]=Python-widget
-Name[nn]=Python-element
-Name[or]=ପାଇଥନ ୱିଜେଟ
-Name[pa]=ਪਾਈਥਨ ਵਿਦਜੈੱਟ
-Name[pl]=Element interfejsu w Pythonie
-Name[pt]=Elemento em Python
-Name[pt_BR]=Widget em Python
-Name[ro]=Control Python
-Name[ru]=Виджет на языке Python
-Name[si]=QEdje
-Name[sk]=Python widget
-Name[sl]=Gradnik v Pythonu
-Name[sr]=питонски виџет
-Name[sr@ijekavian]=питонски виџет
-Name[sr@ijekavianlatin]=Python vidžet
-Name[sr@latin]=Python vidžet
-Name[sv]=Grafisk Python-komponent
-Name[ta]=Python Widget
-Name[tg]=Илова ба Python
-Name[th]=วิดเจ็ตภาษาไพธอน
-Name[tr]=Python Programcığı
-Name[ug]=Python Widget
-Name[uk]=Віджет Python
-Name[wa]=Ahesse Python
-Name[x-test]=xxPython Widgetxx
-Name[zh_CN]=Python 部件
-Name[zh_TW]=Python 元件
-Comment=Plasma widget support written in Python
-Comment[ar]=دعم ودجات البلازما المكتوبة بالبايثون
-Comment[ast]=Elementu gráficu nativu de Plasma escritu en Python
-Comment[be@latin]=Widžet systemy „Plasma”, napisany ŭ movie „Python”
-Comment[bg]=Оригинална джаджа за Plasma, написана на Python
-Comment[bs]=Podrška plazma grafičkim kontrolama pisanih u Pythonu
-Comment[ca]=Estri nadiu del Plasma escrit en Python
-Comment[ca@valencia]=Estri nadiu del Plasma escrit en Python
-Comment[cs]=Podpora pro plasmoidy napsaná v Pythonu
-Comment[da]=Understøttelse af plasma-widgets skrevet i Python
-Comment[de]=Plasma-Miniprogramm-Unterstützung, geschrieben in Python
-Comment[el]=Υποστήριξη συστατικού Plasma γραμμένο σε Python
-Comment[en_GB]=Plasma widget support written in Python
-Comment[es]=Elemento gráfico nativo de Plasma escrito en Python
-Comment[et]=Pythonis kirjutatud Plasma vidina toetus
-Comment[eu]=Python-en idatzitako Plasmaren trepeta-euskarria
-Comment[fi]=Tuki Pythonilla kirjoitetuille Plasma-sovelmille
-Comment[fr]=Prise en charge des composants graphiques de Plasma écrits en Python
-Comment[fy]=Plasma widget stipe skreaun yn Python
-Comment[ga]=Tacaíocht giuirléidí Plasma scríofa i Python
-Comment[gl]=Widget nativo de Plasma escrito en Python
-Comment[gu]=પાયથોનમાં લખાયેલ પ્લાઝમા વિજેટ આધાર
-Comment[he]=תמיכה בווידג׳טים של Plasma עבור Python
-Comment[hi]=पायथन में लिखा गया प्लाज्मा विजेट समर्थन
-Comment[hne]=पायथन मं लिखे प्लाज्मा विजेट सपोर्ट
-Comment[hr]=Podrška za Plasma widgete napisana u Pythonu
-Comment[hu]=Plazmoid-támogatás Python nyelven
-Comment[ia]=Supporto de elemento graphic (Widget) de Plasma scribite in Python
-Comment[id]=Dukungan widget Plasma didukung oleh Python
-Comment[is]=Stuðningur við plasmadót skrifaður í Python
-Comment[ja]=Python で書かれた Plasma のウィジェット
-Comment[kk]=Python-да жазылған Plasma интерфейс бөлшегі
-Comment[km]=ការគាំទ្រធាតុក្រាហ្វិកប្លាស្មាត្រូវបានសរសេរនៅក្នុងភាសា Python
-Comment[kn]=ಪೈಥಾನಿನಲ್ಲಿ ಬರೆಯಲಾದ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ(ವಿಡ್ಗೆಟ್) ಬೆಂಬಲ
-Comment[ko]=파이썬으로 작성된 Plasma 위젯
-Comment[lt]=Plasma valdiklių palaikymas, parašytas su Python
-Comment[lv]=Plasma sīkrīks, kas rakstīts Python
-Comment[ml]=പൈത്തണില് തയ്യാറാക്കിയിരിക്കുന്ന പ്ലാസ്മയില് ഉരുപ്പടികള്ക്കുള്ള പിന്തുണ
-Comment[mr]=Python अंतर्गत लिहीले गेलेले स्थानिक Plasma विजेट
-Comment[nb]=Plasma skjermelement skrevet i Python
-Comment[nds]=Plasma-Lüttprogrammünnerstütten, schreven in Python
-Comment[nl]=Plasma-widget-ondersteuning geschreven in Python
-Comment[nn]=Plasmoidestøtte skriven i Python
-Comment[or]=ପାଇଥନରେ ଲିଖିତ ପ୍ଲାଜମା ୱିଜେଟ ସମର୍ଥନ
-Comment[pa]=ਪਾਈਥਨ ਵਿੱਚ ਲਿਖੇ ਪਲਾਜ਼ਮਾ ਵਿਦਜੈੱਟ ਸਹਿਯੋਗ
-Comment[pl]=Obsługa elementu interfejsu Plazmy w Pythonie
-Comment[pt]=Elemento nativo do Plasma feito em Python
-Comment[pt_BR]=Widget nativo do Plasma escrito em Python
-Comment[ro]=Suport controale Plasma scris în Python
-Comment[ru]=Виджет Plasma, написанный на языке Python
-Comment[si]=Plasma widget support written in Python
-Comment[sk]=Podpora widgetov plasmy napísaných v Pythone
-Comment[sl]=Podpora za gradnike napisane v Pythonu
-Comment[sr]=Подршка плазма виџета писаних у питону
-Comment[sr@ijekavian]=Подршка плазма виџета писаних у питону
-Comment[sr@ijekavianlatin]=Podrška plasma vidžeta pisanih u Pythonu
-Comment[sr@latin]=Podrška plasma vidžeta pisanih u Pythonu
-Comment[sv]=Stöd för grafisk Plasma-komponent skriven i Python
-Comment[ta]=Plasma widget support written in Python
-Comment[tg]=Модуль Plasma, написанный на языке JavaScript
-Comment[th]=วิดเจ็ตพลาสมาที่ถูกเขียนด้วยภาษาไพธอน
-Comment[tr]=Python ile yazılmış Plasma gereci desteği
-Comment[ug]=Python بىلەن يېزىلغان Plasma widget نى قوللايدۇ
-Comment[uk]=Віджет Плазми, написаний на Python
-Comment[wa]=Sopoirt des ahesses sicrîtes e Python po Plasma
-Comment[x-test]=xxPlasma widget support written in Pythonxx
-Comment[zh_CN]=Plasma 部件支持用 Python 来编写
-Comment[zh_TW]=用 Python 寫的 Plasma 元件支援
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-Plasma-API=python
-X-Plasma-ComponentTypes=Applet
-X-KDE-Library=kpythonpluginfactory
-X-KDE-PluginKeyword=plasma_scriptengine_python/pyappletscript.py
+++ /dev/null
-[Desktop Entry]
-Name=Python data engine
-Name[ar]=محرك بيانات بايثون
-Name[ast]=Motor de datos de Python
-Name[be@latin]=Systema źviestak u movie „Python”
-Name[bg]=Ядро за данни с Python
-Name[bn_IN]=Python ডাটা ইঞ্জিন
-Name[bs]=Python pogon podataka
-Name[ca]=Motor de dades en Python
-Name[ca@valencia]=Motor de dades en Python
-Name[cs]=Rozhraní v Pythonu
-Name[csb]=Czérownik Phythona
-Name[da]=Datamotor til Python
-Name[de]=Python-Datentreiber
-Name[el]=Μηχανή δεδομένων Python
-Name[en_GB]=Python data engine
-Name[eo]=Pitona datuma motoro
-Name[es]=Motor de datos de Python
-Name[et]=Pythoni andmete mootor
-Name[eu]=Python-en datu-motorra
-Name[fi]=Python-tietomoottori
-Name[fr]=Moteur de données Python
-Name[fy]=Python gegevens motor
-Name[ga]=Inneall sonraí Python
-Name[gl]=Motor de datos de Python
-Name[gu]=પાયથોન માહિતી એન્જિન
-Name[he]=מנוע תוכן של Python
-Name[hi]=पायथन डाटा इंजिन
-Name[hne]=पायथन डाटा इंजिन
-Name[hr]=Pythonov podatkovni mehanizam
-Name[hu]=Adatkezelő modul Python nyelven
-Name[ia]=Motor de datos de Python
-Name[id]=Mesin data Python
-Name[is]=Python gagnavél
-Name[ja]=Python データエンジン
-Name[kk]=Python деректер тетігі
-Name[km]=ម៉ាស៊ីនទិន្នន័យ Python
-Name[kn]=ಪೈಥಾನ್ ದತ್ತಾಂಶ ಎಂಜಿನ್
-Name[ko]=파이썬 데이터 엔진
-Name[lt]=Python duomenų variklis
-Name[lv]=Python datu dzinējs
-Name[ml]=പൈത്തണ് ഡേറ്റാ എഞ്ചിന്
-Name[mr]=Python माहिती इन्जीन
-Name[nb]=Python datamotor
-Name[nds]=Python-Datenkarn
-Name[nl]=Python (gegevensengine)
-Name[nn]=Python-datamotor
-Name[or]=ପାଇଥନ ତଥ୍ୟ ମେସିନ
-Name[pa]=ਪਾਈਥਨ ਡਾਟਾ ਇੰਜਣ
-Name[pl]=Silnik danych w Pythonie
-Name[pt]=Motor de dados em Python
-Name[pt_BR]=Mecanismo de dados Python
-Name[ro]=Motor de date Python
-Name[ru]=Источник данных на языке Python
-Name[si]=Python data engine
-Name[sk]=Python dátový nástroj
-Name[sl]=Podatkovni vir v Pythonu
-Name[sr]=питонски датомотор
-Name[sr@ijekavian]=питонски датомотор
-Name[sr@ijekavianlatin]=Python datomotor
-Name[sr@latin]=Python datomotor
-Name[sv]=Python datagränssnitt
-Name[ta]=Python data engine
-Name[tg]=Системаи санаи Python
-Name[th]=กลไกข้อมูลภาษาไพธอน
-Name[tr]=Python veri motoru
-Name[ug]=Python سانلىق-مەلۇمات ماتورى
-Name[uk]=Рушій даних Python
-Name[wa]=Moteur di dnêyes Python
-Name[x-test]=xxPython data enginexx
-Name[zh_CN]=Python 数据引擎
-Name[zh_TW]=Python 資料引擎
-Comment=Plasma data engine support for Python
-Comment[ar]=دعم محرك بيانات بلازما للبايثون
-Comment[ast]=Sofitu del motor de datos de plasma pa Python
-Comment[be@latin]=Absłuhoŭvańnie systemy źviestak „Plasma” u movie „Python”
-Comment[bg]=Поддръжка за създаване на ядра за данни на Plasma с Python
-Comment[bs]=Podrška plazma pogona podataka za Python
-Comment[ca]=Implementació de motor de dades del Plasma per al Python
-Comment[ca@valencia]=Implementació de motor de dades del Plasma per al Python
-Comment[cs]=Podpora datového rozhraní Plasmy v Pythonu
-Comment[da]=Plasma datamotor-understøttelse af Python
-Comment[de]=Unterstützung für Plasma-Datentreiber in Python
-Comment[el]=Υποστήριξη μηχανής δεδομένων Plasma για την Python
-Comment[en_GB]=Plasma data engine support for Python
-Comment[eo]=Plasma datummotora apogo por Pitono
-Comment[es]=Soporte del motor de datos de plasma para Python
-Comment[et]=Plasma andmemootori toetus Pythonile
-Comment[eu]=Python-erako Plasmaren datu-motorraren euskarria
-Comment[fi]=Plasma-tietomoottorituki Python-kielelle
-Comment[fr]=Prise en charge du moteur de données Python pour Plasma
-Comment[fy]=Plasma-gegevensmotor-stipe foar Python
-Comment[ga]=Tacaíocht innill sonraí Plasma le haghaidh Python
-Comment[gl]=Motor de datos de Plasma para dar soporte a Python
-Comment[gu]=પાયથોન માટે પ્લાઝમા માહિતી એન્જિન આધાર
-Comment[he]=תמיכה במנועי תוכן של Plasma עבור Python
-Comment[hi]=पायथन के लिए प्लाज्मा डाटा इंजिन समर्थन
-Comment[hne]=पायथन बर प्लाज्मा डाटा इंजिन सपोर्ट
-Comment[hr]=Plasmin podatkovni mehanizam koji podržava Python
-Comment[hu]=Plazma adatkezelő modul Pythonhoz
-Comment[ia]=Supporto de motor de datos de Plasma pro Python
-Comment[id]=Mesin data Plasma didukung oleh Python
-Comment[is]=Plasma gagnavélarstuðningur fyrir Python
-Comment[ja]=Python のための Plasma データエンジンのサポート
-Comment[kk]=Python деректер тетігінің Plasma қолдауы
-Comment[km]=ការគាំទ្រម៉ាស៊ីនទិន្នន័យប្លាស្មាសម្រាប់ Python
-Comment[kn]=ಪೈಥಾನ್ಗಾಗಿ ಪ್ಲಾಸ್ಮಾ ದತ್ತ ಸಾಧನದ ಬೆಂಬಲ
-Comment[ko]=파이썬을 위한 Plasma 데이터 엔진 지원
-Comment[lt]=Plasma duomenų variklio palaikymas Python kalbai
-Comment[lv]=Plasma datu dzinēju atbalsts Python
-Comment[ml]=പൈത്തിണിനുള്ള പ്ലാസ്മ ഡാറ്റാഎഞ്ചിന് പിന്തുണ
-Comment[mr]=Python करिता Plasma माहिती इन्जीन समर्थन
-Comment[nb]=Plasma datamotor-støtte for Python
-Comment[nds]=Plasma-Datenkarnünnerstütten för Python
-Comment[nl]=Plasma-gegevensengine-ondersteuning voor Python
-Comment[nn]=Plasma-datamotorstøtte for Python
-Comment[or]=ପାଇଥନ ପାଇଁ ପ୍ଲାଜମା ତଥ୍ୟ ମେସିନ ସମର୍ଥନ
-Comment[pa]=ਪਾਈਥਨ ਲਈ ਪਲਾਜ਼ਮਾ ਡਾਟਾ ਇੰਜਣ ਸਹਿਯੋਗ
-Comment[pl]=Obsługa silnika danych Plazmy w Pythonie
-Comment[pt]=Suporte para os motores de dados do Plasma em Python
-Comment[pt_BR]=Suporte aos mecanismos de dados em Python
-Comment[ro]=Suport motor de date Plasma pentru Python
-Comment[ru]=Поддержка источников данных для Python
-Comment[si]=Plasma data engine support for Python
-Comment[sk]=Podpora dátového nástroja plasmy pre Python
-Comment[sl]=Podpora za podatkovne vire napisane v Pythonu
-Comment[sr]=Подршка плазма датомотора за питон
-Comment[sr@ijekavian]=Подршка плазма датомотора за питон
-Comment[sr@ijekavianlatin]=Podrška plasma datomotora za Python
-Comment[sr@latin]=Podrška plasma datomotora za Python
-Comment[sv]=Plasma datagränssnittstöd för Python
-Comment[ta]=Plasma data engine support for Python
-Comment[te]=ఫైథాన్ మద్దతుకొరకు ప్లాస్మా డాటా యింజన్
-Comment[tg]=Пуштибонии Python дар асоси маълумоти Plasma
-Comment[th]=กลไกข้อมูลของพลาสมาที่เป็นภาษาไพธอน
-Comment[tr]=Python için Plasma veri motoru desteği
-Comment[ug]=Python نىڭ Plasma سانلىق-مەلۇمات ماتورىنى قوللىشى
-Comment[uk]=Підтримка у рушіях даних для Python
-Comment[wa]=Sopoirt po Python do moteur di dnêyes di Plasma
-Comment[x-test]=xxPlasma data engine support for Pythonxx
-Comment[zh_CN]=Python 的 Plasma 数据引擎支持
-Comment[zh_TW]=支援 Python 的 Plasma 資料引擎
-
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-KDE-Library=kpythonpluginfactory
-X-KDE-PluginKeyword=plasma_scriptengine_python/pydataengine.py
-X-EngineName=pythondataengine
-X-Plasma-API=python
-X-Plasma-ComponentTypes=DataEngine
+++ /dev/null
-[Desktop Entry]
-Name=Python Runner
-Name[ar]=مشغل بايثون
-Name[ast]=Llanzador Python
-Name[bg]=Стартер с Python
-Name[bs]=Python izvođač
-Name[ca]=Executor en Python
-Name[ca@valencia]=Executor en Python
-Name[cs]=Python spouštěč
-Name[da]=Python Runner
-Name[de]=Python-Starter
-Name[el]=Εκτελεστής Python
-Name[en_GB]=Python Runner
-Name[eo]=Pitona motoro
-Name[es]=Lanzador Python
-Name[et]=Pythoni käivitaja
-Name[eu]=Python abiarazlea
-Name[fi]=Python-suoritusohjelma
-Name[fr]=Lanceur Python
-Name[ga]=Feidhmitheoir Python
-Name[gl]=Executor en Python
-Name[gu]=Python રનર
-Name[he]=Python Runner
-Name[hi]=पायथन रनर
-Name[hr]=Python Runner
-Name[hu]=Python-indító
-Name[ia]=Executor de Python
-Name[id]=Pelari Python
-Name[is]=Python keyrari
-Name[ja]=Python ラナー
-Name[kk]=Python-ды жегу
-Name[km]=កម្មវិធីរត់ Python
-Name[kn]=ಪೈಥಾನ್ ರನ್ನರ್
-Name[ko]=파이썬 실행기
-Name[lt]=Python leistukas
-Name[lv]=Python darbinātājs
-Name[mr]=पायथोन रनर
-Name[nb]=Python-kjører
-Name[nds]=Python-Dreger
-Name[nl]=Python-starter
-Name[nn]=Python-køyrar
-Name[pa]=ਪਾਈਥਨ ਰਨਰ
-Name[pl]=Uruchamianie w Pythonie
-Name[pt]=Módulo de Execução em Python
-Name[pt_BR]=Execução em Python
-Name[ro]=Executor Python
-Name[ru]=Модули запуска команд на языке Python
-Name[si]=Python ධාවකය
-Name[sk]=Python spúšťač
-Name[sl]=Zaganjalnik v Pythonu
-Name[sr]=питонски извођач
-Name[sr@ijekavian]=питонски извођач
-Name[sr@ijekavianlatin]=Python izvođač
-Name[sr@latin]=Python izvođač
-Name[sv]=Python körningsprogram
-Name[tg]=Системаи санаи Python
-Name[th]=ตัวเรียกใช้โปรแกรมภาษาไพธอน
-Name[tr]=Python Çalıştırıcı
-Name[ug]=Python ئىجراچىسى
-Name[uk]=Запуск для Python
-Name[wa]=Enondeu Python
-Name[x-test]=xxPython Runnerxx
-Name[zh_CN]=Python 运行器
-Name[zh_TW]=Python 執行器
-Comment=Plasma Runner support for Python
-Comment[ar]=دعم مشغل بلازما لبايثون
-Comment[ast]=Implementación de llanzador Plasma pa Python
-Comment[bg]=Поддръжка за създаване на стартери на Plasma с Python
-Comment[bs]=Podrška plazma izvođača za Python
-Comment[ca]=Implementació de l'executor del Plasma per al Python
-Comment[ca@valencia]=Implementació de l'executor del Plasma per al Python
-Comment[cs]=Podpora Plasma spouštěče pro Python
-Comment[da]=Understøttelse af Plasma Runner til Python
-Comment[de]=Plasma-Starter-Unterstützung für Python
-Comment[el]=Υποστήριξη εκτελεστή Plasma για την Python
-Comment[en_GB]=Plasma Runner support for Python
-Comment[es]=Implementación de lanzador Plasma para Python
-Comment[et]=Plasma käivitaja toetus Pythonile
-Comment[eu]=Python-erako Plasmaren abiarazlearen euskarria
-Comment[fi]=Plasma-suoritusohjelmatuki Python-kielelle
-Comment[fr]=Prise en charge du lanceur Plasma pour Python
-Comment[gl]=Executor de Plasma que permite usar Python
-Comment[he]=תמיכה ב־Runner של Plasma עבור Python
-Comment[hi]=पायथन के लिए प्लाज्मा रनर समर्थन
-Comment[hr]=Plasma Runner podrška za Python
-Comment[hu]=Plazma-indító támogatás Pythonhoz
-Comment[ia]=Supporto de executor de Plasma pro Python
-Comment[id]=Dukungan Pelari Plasma terhadap Python
-Comment[is]=Plasma gagnavélarstuðningur fyrir Python
-Comment[ja]=Python のための Plasma ラナーサポート
-Comment[kk]=Plasma-дағы Python-ды жегуін қолдауы
-Comment[km]=ការគាំទ្រកម្មវិធីរត់ប្លាស្មាសម្រាប់ Python
-Comment[kn]=ಪೈಥಾನ್ಗಾಗಿ ಪ್ಲಾಸ್ಮಾ ರನ್ನರ್ ಬೆಂಬಲ
-Comment[ko]=Plasma 파이썬 실행기
-Comment[lt]=Plasma paleidiklio palaikymas Python kalbai
-Comment[lv]=Plasma darbinātāja atbalsts Python
-Comment[mr]=पायथोन करिता प्लाज्मा रनर समर्थन
-Comment[nb]=Plasma kjørerstøtte for Python
-Comment[nds]=Plasma-Dregerünnerstütten för Python
-Comment[nl]=Plasma-starter-ondersteuning voor Python
-Comment[nn]=Plasma-køyrarstøtte for Python
-Comment[pa]=ਪਾਈਥਨ ਲਈ ਪਲਾਜ਼ਮਾ ਰਨਰ ਸਹਿਯੋਗ
-Comment[pl]=Obsługa programów uruchamiających dla Pythona
-Comment[pt]=Suporte de módulos de execução do Plasma em Python
-Comment[pt_BR]=Suporte aos mecanismos de execução do Plasma para Python
-Comment[ro]=Suport executori Plasma pentru Python
-Comment[ru]=Поддержка модулей запуска KRunner на языке Python
-Comment[si]=Python සඳහා ප්ලාස්මා ධාවක සහාය
-Comment[sk]=Podpora spúšťača plasmy pre Python
-Comment[sl]=Podpora za zaganjalnike napisane v Pythonu
-Comment[sr]=Подршка плазма извођача за питон
-Comment[sr@ijekavian]=Подршка плазма извођача за питон
-Comment[sr@ijekavianlatin]=Podrška plasma izvođača za Python
-Comment[sr@latin]=Podrška plasma izvođača za Python
-Comment[sv]=Plasma körningsstöd för Python
-Comment[tg]=Пуштибонии Python дар асоси маълумоти Plasma
-Comment[th]=ตัวเรียกใช้งานของพลาสมาที่รองรับสำหรับโปรแกรมภาษาไพธอน
-Comment[tr]=Python için Plasma Çalıştırıcı desteği
-Comment[ug]=Python نى قوللايدىغان Plasma ئىجراچىسى
-Comment[uk]=Підтримка Python у інструментах запуску
-Comment[wa]=Sopoirt po Python di l' enondeu di Plasma
-Comment[x-test]=xxPlasma Runner support for Pythonxx
-Comment[zh_CN]=支持 Python 的 Plasma 运行器
-Comment[zh_TW]=支援 Python 的執行器
-
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-KDE-Library=kpythonpluginfactory
-X-KDE-PluginKeyword=plasma_scriptengine_python/pyrunner.py
-X-EngineName=pythonrunner
-X-Plasma-API=python
-X-Plasma-ComponentTypes=Runner
+++ /dev/null
-[Desktop Entry]
-Name=Python wallpaper
-Name[ar]=خلفية شاشة مكتوبة باستخدام بايثون
-Name[ast]=Fondu d'escritoriu en Python
-Name[bg]=Тапети с Python
-Name[bn]=পাইথন ওয়ালপেপার
-Name[bs]=Python pozadinska slika
-Name[ca]=Fons d'escriptori en Python
-Name[ca@valencia]=Fons d'escriptori en Python
-Name[cs]=Python pozadí plochy
-Name[da]=Python-baggrundsbillede
-Name[de]=Python-Hintergrundbild
-Name[el]=Ταπετσαρία Python
-Name[en_GB]=Python wallpaper
-Name[eo]=Pitona ekranfono
-Name[es]=Fondo de escritorio en Python
-Name[et]=Pythoni taustapilt
-Name[eu]=Python-en horma-papera
-Name[fi]=Python-taustakuva
-Name[fr]=Papier peint Python
-Name[fy]=Python eftergrûnôfbylding
-Name[ga]=Cúlbhrat Python
-Name[gl]=Fondo de escritorio en Python
-Name[gu]=પાયથોન વોલપેપર
-Name[he]=רקע לשולחן עבודה של Python
-Name[hr]=Python podloga
-Name[hu]=Python háttérkép
-Name[ia]=Tapete de papiro de Python
-Name[id]=Wallpaper Python
-Name[is]=Python veggfóður
-Name[ja]=Python 壁紙
-Name[kk]=Python тұсқағазы
-Name[km]=ផ្ទាំងរូបភាពរបស់ Python
-Name[kn]=ಪೈಥಾನ್ ಹಿನ್ನೆಲೆ ತೆರೆಚಿತ್ರ (ವಾಲ್ ಪೇಪರ್)
-Name[ko]=파이썬 배경 그림
-Name[lt]=Python darbastalio fonas
-Name[lv]=Python ekrāntapete
-Name[ml]=പൈത്തണ് ചുവര്ചിത്രം
-Name[mr]=पायथोन वॉलपेपर
-Name[nb]=Python bakgrunnsbilde
-Name[nds]=Python-Achtergrundbild
-Name[nl]=Python-achtergrondafbeelding
-Name[nn]=Python-bakgrunnsbilete
-Name[pa]=ਪਾਈਥਨ ਵਾਲਪੇਪਰ
-Name[pl]=Tapeta w Pythonie
-Name[pt]=Papel de parede em Python
-Name[pt_BR]=Papel de parede em Python
-Name[ro]=Fundal Python
-Name[ru]=Обои рабочего стола на языке Python
-Name[si]=Python වෝල්පේපර
-Name[sk]=Python tapeta
-Name[sl]=Ozadje v Pythonu
-Name[sr]=питонски тапет
-Name[sr@ijekavian]=питонски тапет
-Name[sr@ijekavianlatin]=Python tapet
-Name[sr@latin]=Python tapet
-Name[sv]=Python skrivbordsunderlägg
-Name[tg]=Барномаи Plasma
-Name[th]=ภาพพื้นหลังของโปรแกรมไพธอน
-Name[tr]=Python duvar kağıdı
-Name[ug]=Python تام قەغىزى
-Name[uk]=Шпалери для Python
-Name[wa]=Tapisreye Python
-Name[x-test]=xxPython wallpaperxx
-Name[zh_CN]=Python 壁纸
-Name[zh_TW]=Python 桌布
-Comment=Plasma wallpaper support for Python
-Comment[ar]=دعم خلفية شاشة بلازما لبايثون
-Comment[ast]=Fondos de pantalla de Plasma pa Python
-Comment[bg]=Поддръжка за работа с тапети на Plasma с Python
-Comment[bs]=Podrška plazma pozadinskih slika za Python
-Comment[ca]=Implementació de fons d'escriptori del Plasma per al Python
-Comment[ca@valencia]=Implementació de fons d'escriptori del Plasma per al Python
-Comment[cs]=Podpora Plasma pozadí plochy pro Python
-Comment[da]=Understøttelse af Plasma wallpaper til Python
-Comment[de]=Unterstützung in Plasma für Python-Hintergrundbilder
-Comment[el]=Υποστήριξη ταπετσαρίας Plasma για την Python
-Comment[en_GB]=Plasma wallpaper support for Python
-Comment[es]=Fondos de pantalla de Plasma para Python
-Comment[et]=Plasma taustapildi toetus Pythonile
-Comment[eu]=Python-erako Plasma horma-paperaren euskarria
-Comment[fi]=Plasma-taustakuvatuki Python-kielelle
-Comment[fr]=Prise en charge du papier peint de Plasma pour Python
-Comment[fy]=Plasma eftergrûnôfbylding stipe foar Python
-Comment[gl]=Compatibilidade de Python co fondo de escritorio de Plasma
-Comment[he]=תמיכה ברקעי שולחן עבודה של Plasma עבור Python
-Comment[hi]=पायथन के लिए प्लाज्मा वालपेपर समर्थन
-Comment[hr]=Plasmina podloga koja podržava Python
-Comment[hu]=Plasma-háttérkép támogatás Pythonhoz
-Comment[ia]=Supporto de tapete de papiro pro Python
-Comment[id]=Wallpeper Plasma yang mendukung Python
-Comment[is]=Plasma veggfóðurstuðningur fyrir Python
-Comment[ja]=Python のための Plasma の壁紙
-Comment[kk]=Plasma-дағы Python тұсқағазының қолдауы
-Comment[km]=ការគាំទ្រផ្ទាំងរូបភាពប្លាស្មាសម្រាប់ Python
-Comment[kn]=ಪೈಥಾನ್ಗಾಗಿ ಪ್ಲಾಸ್ಮಾ ಗಣಕತೆರೆ ಹಿನ್ನೆಲೆ ಚಿತ್ರ ಬೆಂಬಲ
-Comment[ko]=파이썬을 위한 Plasma 배경 그림 지원
-Comment[lt]=Plasma apmušalo palaikymas Python kalbai
-Comment[lv]=Plasma ekrāntapetes atbalsts Python
-Comment[ml]=പൈത്തിണിനുള്ള പ്ലാസ്മ ചുമര്ച്ചിത്ര പിന്തുണ
-Comment[mr]=पायथोन करिता प्लाज्मा वॉलपेपर समर्थन
-Comment[nb]=Plasma bakgrunnsbilde-støtte for Python
-Comment[nds]=Plasma-Achtergrundünnerstütten för Python
-Comment[nl]=Plasma-achtergrondafbeelding-ondersteuning voor Python
-Comment[nn]=Plasma-bakgrunnsbiletstøtte for Python
-Comment[pa]=ਪਾਈਥਨ ਲਈ ਪਲਾਜ਼ਮਾ ਵਾਲਪੇਪਰ ਸਹਿਯੋਗ
-Comment[pl]=Obsługa tapet Plazmy w Pythonie
-Comment[pt]=Suporte para os papéis de parede do Plasma em Python
-Comment[pt_BR]=Suporte aos mecanismos a papéis de parede do Plasma em Python
-Comment[ro]=Suport fundaluri Plasma pentru Python
-Comment[ru]=Поддержка обоев рабочего стола на языке Python
-Comment[si]=Python සඳහා ප්ලාස්මා වෝල්පේපර් සහය
-Comment[sk]=Podpora tapiet plasmy pre Python
-Comment[sl]=Podpora za ozadja napisana v Pythonu
-Comment[sr]=Подршка плазма тапета за питон
-Comment[sr@ijekavian]=Подршка плазма тапета за питон
-Comment[sr@ijekavianlatin]=Podrška plasma tapeta za Python
-Comment[sr@latin]=Podrška plasma tapeta za Python
-Comment[sv]=Plasma skrivbordsunderläggsstöd för Python
-Comment[tg]=Пуштибонии Python дар асоси маълумоти Plasma
-Comment[th]=ภาพพื้นหลังของพลาสมาที่รองรับสำหรับโปรแกรมภาษาไพธอน
-Comment[tr]=Python için Plasma duvar kağıdı desteği
-Comment[ug]=Python نى قوللايدىغان Plasma تام قەغەز
-Comment[uk]=Підтримка Python у шпалерах Плазми
-Comment[wa]=Sopoirt po Python del tapisreye di Plasma
-Comment[x-test]=xxPlasma wallpaper support for Pythonxx
-Comment[zh_CN]=支持 Python 的 Plasma 壁纸
-Comment[zh_TW]=支援 Python 的 Plasma 桌布
-
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-KDE-Library=kpythonpluginfactory
-X-KDE-PluginKeyword=plasma_scriptengine_python/pywallpaper.py
-X-EngineName=pythonwallpaper
-X-Plasma-API=python
-X-Plasma-ComponentTypes=Wallpaper
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright 2008 Simon Edwards <simon@simonzone.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-import sys
-import os
-import imp
-
-class PlasmaImporter(object):
- def __init__(self):
- self.toplevel = {}
- self.toplevelcount = {}
- self.marker = '<plasma>' + str(id(self))
- sys.path.append(self.marker)
- sys.path_hooks.append(self.hook)
-
- def hook(self,path):
- if path==self.marker:
- return self
- else:
- raise ImportError()
-
- def register_top_level(self,name,path):
- if name not in self.toplevel:
- self.toplevelcount[name] = 1
- self.toplevel[name] = path
- else:
- self.toplevelcount[name] += 1
-
- def unregister_top_level(self,name):
- value = self.toplevelcount[name]-1
- self.toplevelcount[name] = value
- if value==0:
- del self.toplevelcount[name]
- del self.toplevel[name]
- for key in list(sys.modules.keys()):
- if key==name or key.startswith(name+"."):
- del sys.modules[key]
-
- def find_module(self,fullname, path=None):
- location = self.find_pymod(fullname)
- if location is not None:
- return self
- else:
- return None
-
- # Find the given module in the plasma directory.
- # Result a tuple on success otherwise None. The tuple contains the location
- # of the module/package in disk and a boolean indicating if it is a package
- # or module
- def find_pymod(self,modulename):
- parts = modulename.split('.')
- toppackage = parts[0]
- rest = parts[1:]
-
- if toppackage in self.toplevel:
- path = self.toplevel[toppackage]
- if len(rest)==0:
- # Simple top level Plasma package
- return (path,True)
- else:
- restpath = apply(os.path.join,rest)
- fullpath = os.path.join(path,'contents','code',restpath)
- if os.path.isdir(fullpath):
- return (fullpath,True)
- elif os.path.exists(fullpath+'.py'):
- return (fullpath+'.py',False)
- else:
- return None
-
- def _get_code(self,location):
- return open(location).read()
-
- def load_module(self, fullname):
- location,ispkg = self.find_pymod(fullname)
- if ispkg: # Package dir.
- initlocation = os.path.join(location,'__init__.py')
- code = None
- if os.path.isfile(initlocation):
- code = open(initlocation)
- else:
- code = open(location)
-
- mod = sys.modules.setdefault(fullname, imp.new_module(fullname))
- mod.__file__ = location #"<%s>" % self.__class__.__name__
- mod.__loader__ = self
- if ispkg:
- mod.__path__ = [self.marker]
- if code is not None:
- try:
- exec(code in mod.__dict__)
- finally:
- code.close()
- return mod
-
-#plasma_importer = PlasmaImporter()
-#plasma_importer.register_top_level('plasma_pyclock','/home/sbe/devel/python_plasma_2/test/plasma-pyclock')
-#from plasma_pyclock import main
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright 2008 Simon Edwards <simon@simonzone.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-
-# Plasma applet API for Python
-
-from PyQt4.QtCore import QObject
-from PyQt4.QtGui import QGraphicsWidget
-from PyKDE4.plasma import Plasma # Plasma C++ namespace
-
-#import sip
-#import gc
-
-class Applet(QObject):
- ''' Subclass Applet in your module and return an instance of it in a global function named
- applet(). Implement the following functions to breathe life into your applet:
- * paint - Draw the applet given a QPainter and some options
- It provides the same API as Plasma.Applet; it just has slightly less irritating event names. '''
- def __init__(self, parent=None):
- # this should be set when the applet is created
- QObject.__init__(self, parent)
- #sip.settracemask(0x3f)
- self.applet = None
- self.applet_script = None
- self._forward_to_applet = True
-
- def __getattr__(self, key):
- # provide transparent access to the real applet instance
- if self._forward_to_applet:
- try:
- return getattr(self.applet_script, key)
- except:
- return getattr(self.applet, key)
- else:
- raise AttributeError(key)
-
- def _enableForwardToApplet(self):
- self._forward_to_applet = True
- def _disableForwardToApplet(self):
- self._forward_to_applet = False
-
- # Events
- def setApplet(self,applet):
- self.applet = applet
-
- def setAppletScript(self,appletScript):
- self.applet_script = appletScript
-
- def init(self):
- pass
-
- def configChanged(self):
- pass
-
- def paintInterface(self, painter, options, rect):
- pass
-
- def constraintsEvent(self, flags):
- pass
-
- def showConfigurationInterface(self):
- self.dlg = self.standardConfigurationDialog()
- self.createConfigurationInterface(self.dlg)
- self.addStandardConfigurationPages(self.dlg)
- self.dlg.show()
-
- def createConfigurationInterface(self, dlg):
- pass
-
- def contextualActions(self):
- return []
-
- def shape(self):
- return QGraphicsWidget.shape(self.applet)
-
- def initExtenderItem(self, item):
- print ("Missing implementation of initExtenderItem in the applet " + \
- item.config().readEntry('SourceAppletPluginName', '').toString() + \
- "!\nAny applet that uses extenders should implement initExtenderItem to " + \
- "instantiate a widget.")
-
- def saveState(self, config):
- pass
-
-###########################################################################
-class DataEngine(QObject):
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
- self.dataengine = None
- self.dataengine_script = None
-
- def setDataEngine(self,dataEngine):
- self.dataEngine = dataEngine
-
- def setDataEngineScript(self,dataEngineScript):
- self.data_engine_script = dataEngineScript
-
- def __getattr__(self, key):
- # provide transparent access to the real dataengine script instance
- try:
- return getattr(self.data_engine_script, key)
- except:
- return getattr(self.dataEngine, key)
-
- def init(self):
- pass
-
- def sources(self):
- return []
-
- def sourceRequestEvent(self,name):
- return False
-
- def updateSourceEvent(self,source):
- return False
-
- def serviceForSource(self,source):
- return Plasma.DataEngineScript.serviceForSource(self.data_engine_script,source)
-
-###########################################################################
-class Wallpaper(QObject):
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
- self.wallpaper = None
- self.wallpaper_script = None
-
- def setWallpaper(self,wallpaper):
- self.wallpaper = wallpaper
-
- def setWallpaperScript(self,wallpaperScript):
- self.wallpaper_script = wallpaperScript
-
- def __getattr__(self, key):
- # provide transparent access to the real wallpaper script instance
- try:
- return getattr(self.wallpaper_script, key)
- except:
- return getattr(self.wallpaper, key)
-
- def init(self, config):
- pass
-
- def paint(self,painter, exposedRect):
- pass
-
- def save(self,config):
- pass
-
- def createConfigurationInterface(self,parent):
- return None
-
- def mouseMoveEvent(self,event):
- pass
-
- def mousePressEvent(self,event):
- pass
-
- def mouseReleaseEvent(self,event):
- pass
-
- def wheelEvent(self,event):
- pass
-
- def renderCompleted(self, image):
- pass
-
- def urlDropped(self, url):
- pass
-
-###########################################################################
-class Runner(QObject):
- def __init__(self, parent=None):
- QObject.__init__(self, parent)
- self.runner = None
- self.runner_script = None
-
- def setRunner(self,runner):
- self.runner = runner
-
- def setRunnerScript(self,runnerScript):
- self.runner_script = runnerScript
-
- def __getattr__(self, key):
- # provide transparent access to the real runner script instance
- try:
- return getattr(self.runner_script, key)
- except:
- return getattr(self.runner, key)
-
- def init(self):
- pass
-
- def match(self, search):
- pass
-
- def run(self, search, action):
- pass
-
- def prepare(self):
- pass
-
- def teardown(self):
- pass
-
- def createRunOptions(self, widget):
- pass
-
- def reloadConfiguration(self):
- pass
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright 2008 Simon Edwards <simon@simonzone.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
-from PyKDE4.plasma import Plasma
-import plasma_importer
-import os.path
-
-class PythonAppletScript(Plasma.AppletScript):
- importer = None
-
- def __init__(self, parent):
- Plasma.AppletScript.__init__(self,parent)
- #print("PythonAppletScript()")
- if PythonAppletScript.importer is None:
- PythonAppletScript.importer = plasma_importer.PlasmaImporter()
- self.initialized = False
-
- def init(self):
- #print("Script Name: " + str(self.applet().name()))
- #print("Script Category: " + str(self.applet().category()))
-
- # applet() cannot be relied on to give the right details in the destructor,
- # so the plugin name is stored aside. (n.b module.__name__ cannot be relied
- # on either; it might have been changed in the module itself)
- self.moduleName = str(self.applet().pluginName())
- #print("pluginname: " + str(self.applet().pluginName()))
- self.pluginName = 'applet_' + self.moduleName.replace('-','_')
-
- PythonAppletScript.importer.register_top_level(self.pluginName, str(self.applet().package().path()))
-
- #print("mainScript: " + str(self.mainScript()))
- #print("package path: " + str(self.applet().package().path()))
-
- # import the code at the file name reported by mainScript()
- relpath = os.path.relpath(str(self.mainScript()),str(self.applet().package().path()))
- if relpath.startswith("contents/code/"):
- relpath = relpath[14:]
- if relpath.endswith(".py"):
- relpath = relpath[:-3]
- relpath = relpath.replace("/",".")
- self.module = __import__(self.pluginName+'.'+relpath)
-
- # Plasma main scripts not necessarily are named "main"
- # So we use __dict__ to get the right main script name
- basename = os.path.basename(str(self.mainScript()))
- basename = os.path.splitext(basename)[0]
- self.pyapplet = self.module.__dict__[basename].CreateApplet(None)
- self.pyapplet.setApplet(self.applet())
- self.pyapplet.setAppletScript(self)
- self.connect(self.applet(), SIGNAL('extenderItemRestored(Plasma::ExtenderItem*)'),
- self, SLOT('initExtenderItem(Plasma::ExtenderItem*)'))
- self.connect(self, SIGNAL('saveState(KConfigGroup&)'),
- self, SLOT('saveStateSlot(KConfigGroup&)'))
- self._setUpEventHandlers()
- self.initialized = True
-
- self.pyapplet.init()
- return True
-
- def __dtor__(self):
- #print("~PythonAppletScript()")
- if not self.initialized:
- return
-
- PythonAppletScript.importer.unregister_top_level(self.pluginName)
- self.pyapplet = None
-
- @pyqtSignature("initExtenderItem(Plasma::ExtenderItem*)")
- def initExtenderItem(self, item):
- if not self.initialized:
- return
- self.pyapplet.initExtenderItem(item)
-
- @pyqtSignature("saveStateSlot(KConfigGroup&)")
- def saveStateSlot(self, config):
- if not self.initialized:
- return
- self.pyapplet.saveState(config)
-
- def constraintsEvent(self, constraints):
- if not self.initialized:
- return
- self.pyapplet.constraintsEvent(constraints)
-
- def showConfigurationInterface(self):
- if not self.initialized:
- return
- #print("Script: showConfigurationInterface")
- self.pyapplet.showConfigurationInterface()
-
- def configChanged(self):
- if not self.initialized:
- return
- self.pyapplet.configChanged()
-
- def paintInterface(self, painter, option, contentsRect):
- if not self.initialized:
- return
- self.pyapplet.paintInterface(painter, option, contentsRect)
-
- def contextualActions(self):
- if not self.initialized:
- return
-
- #print("pythonapplet contextualActions()")
- return self.pyapplet.contextualActions()
-
- def shape(self):
- if not self.initialized:
- return QPainterPath()
- return self.pyapplet.shape()
-
- def eventFilter(self, obj, event):
- handler = self.event_handlers.get(event.type(),None)
- if handler is not None:
- apply(getattr(self.pyapplet,handler), (event,) )
- return True
- else:
- return False
-
- def _setUpEventHandlers(self):
- self.event_handlers = {}
-
- self.pyapplet._disableForwardToApplet()
- for event_type,handler in {
- QEvent.GraphicsSceneMousePress: "mousePressEvent",
- QEvent.GraphicsSceneContextMenu: "contextMenuEvent",
- QEvent.GraphicsSceneDragEnter: "dragEnterEvent",
- QEvent.GraphicsSceneDragLeave: "dragLeaveEvent",
- QEvent.GraphicsSceneDragMove: "dragMoveEvent",
- QEvent.GraphicsSceneDrop: "dropEvent",
- QEvent.FocusIn: "focusInEvent",
- QEvent.FocusOut: "focusOutEvent",
- QEvent.GraphicsSceneHoverEnter: "hoverEnterEvent",
- QEvent.GraphicsSceneHoverLeave: "hoverLeaveEvent",
- QEvent.GraphicsSceneHoverMove: "hoverMoveEvent",
- QEvent.InputMethod: "inputMethodEvent",
- QEvent.KeyPress: "keyPressEvent",
- QEvent.KeyRelease: "keyReleaseEvent",
- QEvent.GraphicsSceneMouseDoubleClick: "mouseDoubleClickEvent",
- QEvent.GraphicsSceneMouseMove: "mouseMoveEvent",
- QEvent.GraphicsSceneMousePress: "mousePressEvent",
- QEvent.GraphicsSceneMouseRelease: "mouseReleaseEvent",
- QEvent.GraphicsSceneWheel: "wheelEvent"
- }.iteritems():
- if hasattr(self.pyapplet,handler):
- self.event_handlers[event_type] = handler
- self.pyapplet._enableForwardToApplet()
-
- if self.event_handlers:
- self.applet().installEventFilter(self)
-
-def CreatePlugin(widget_parent, parent, component_data):
- return PythonAppletScript(parent)
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright 2008 Simon Edwards <simon@simonzone.com>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
-from PyKDE4.plasma import Plasma
-import plasma_importer
-import os.path
-
-class PythonDataEngineScript(Plasma.DataEngineScript):
- importer = None
-
- def __init__(self, parent):
- Plasma.DataEngineScript.__init__(self,parent)
- if PythonDataEngineScript.importer is None:
- PythonDataEngineScript.importer = plasma_importer.PlasmaImporter()
- self.initialized = False
-
- def init(self):
- self.moduleName = str(self.dataEngine().pluginName())
- self.pluginName = 'dataengine_' + self.moduleName.replace('-','_')
-
- PythonDataEngineScript.importer.register_top_level(self.pluginName, str(self.dataEngine().package().path()))
-
- # import the code at the file name reported by mainScript()
- relpath = os.path.relpath(str(self.mainScript()),str(self.dataEngine().package().path()))
- if relpath.startswith("contents/code/"):
- relpath = relpath[14:]
- if relpath.endswith(".py"):
- relpath = relpath[:-3]
- relpath = relpath.replace("/",".")
- self.module = __import__(self.pluginName+'.'+relpath)
- # The script may not necessarily be called "main"
- # So we use __dict__ to look up the right name
- basename = os.path.basename(str(self.mainScript()))
- basename = os.path.splitext(basename)[0]
-
- self.pydataengine = self.module.__dict__[basename].CreateDataEngine(None)
- self.pydataengine.setDataEngine(self.dataEngine())
- self.pydataengine.setDataEngineScript(self)
- self.pydataengine.init()
-
- self.initialized = True
- return True
-
- def __dtor__(self):
- PythonDataEngineScript.importer.unregister_top_level(self.pluginName)
- self.pydataengine = None
-
- def sources(self):
- return self.pydataengine.sources()
-
- def serviceForSource(self,source):
- return self.pydataengine.serviceForSource(source)
-
- def sourceRequestEvent(self,name):
- return self.pydataengine.sourceRequestEvent(name)
-
- def updateSourceEvent(self,source):
- return self.pydataengine.updateSourceEvent(source)
-
-def CreatePlugin(widget_parent, parent, component_data):
- return PythonDataEngineScript(parent)
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright 2008 Simon Edwards <simon@simonzone.com>
-# Copyright 2009 Petri Damstén <damu@iki.fi>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
-from PyKDE4.plasma import Plasma
-import plasma_importer
-import os.path
-
-class PythonRunnerScript(Plasma.RunnerScript):
- importer = None
-
- def __init__(self, parent):
- Plasma.RunnerScript.__init__(self,parent)
- if PythonRunnerScript.importer is None:
- PythonRunnerScript.importer = plasma_importer.PlasmaImporter()
- self.initialized = False
-
- def init(self):
- self.moduleName = str(self.runner().package().metadata().pluginName())
- self.pluginName = 'runner_' + self.moduleName.replace('-','_')
-
- PythonRunnerScript.importer.register_top_level(self.pluginName, str(self.runner().package().path()))
-
- # import the code at the file name reported by mainScript()
- relpath = os.path.relpath(str(self.mainScript()),str(self.runner().package().path()))
- if relpath.startswith("contents/code/"):
- relpath = relpath[14:]
- if relpath.endswith(".py"):
- relpath = relpath[:-3]
- relpath = relpath.replace("/",".")
- self.module = __import__(self.pluginName+'.'+relpath)
- basename = os.path.basename(str(self.mainScript()))
- basename = os.path.splitext(basename)[0]
- self.pyrunner = self.module.__dict__[basename].CreateRunner(None)
- self.pyrunner.setRunner(self.runner())
- self.pyrunner.setRunnerScript(self)
- self.connect(self, SIGNAL('prepare()'), self, SLOT('prepare()'))
- self.connect(self, SIGNAL('teardown()'), self, SLOT('teardown()'))
- self.connect(self, SIGNAL('createRunOptions(QWidget*)'),
- self, SLOT('createRunOptions(QWidget*)'))
- self.connect(self, SIGNAL('reloadConfiguration()'),
- self, SLOT('reloadConfiguration()'))
- self.pyrunner.init()
-
- self.initialized = True
- return True
-
- def __dtor__(self):
- PythonRunnerScript.importer.unregister_top_level(self.pluginName)
- self.pyrunner = None
-
- def match(self, search):
- self.pyrunner.match(search)
-
- def run(self, search, action):
- self.pyrunner.run(search, action)
-
- @pyqtSignature("prepare()")
- def prepare(self):
- self.pyrunner.prepare()
-
- @pyqtSignature("teardown()")
- def teardown(self):
- self.pyrunner.teardown()
-
- @pyqtSignature("createRunOptions(QWidget*)")
- def createRunOptions(self, widget):
- self.pyrunner.createRunOptions(widget)
-
- @pyqtSignature("reloadConfiguration()")
- def reloadConfiguration(self):
- self.pyrunner.reloadConfiguration()
-
-def CreatePlugin(widget_parent, parent, component_data):
- return PythonRunnerScript(parent)
+++ /dev/null
-# -*- coding: utf-8 -*-
-#
-# Copyright 2008 Simon Edwards <simon@simonzone.com>
-# Copyright 2009 Petri Damstén <damu@iki.fi>
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Library General Public License as
-# published by the Free Software Foundation; either version 2, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details
-#
-# You should have received a copy of the GNU Library General Public
-# License along with this program; if not, write to the
-# Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-#
-from PyQt4.QtCore import *
-from PyQt4.QtGui import *
-from PyKDE4.plasma import Plasma
-import plasma_importer
-import os.path
-
-class PythonWallpaperScript(Plasma.WallpaperScript):
- importer = None
-
- def __init__(self, parent):
- Plasma.WallpaperScript.__init__(self,parent)
- if PythonWallpaperScript.importer is None:
- PythonWallpaperScript.importer = plasma_importer.PlasmaImporter()
- self.initialized = False
-
- def init(self):
- self.moduleName = str(self.wallpaper().pluginName())
- self.pluginName = 'wallpaper_' + self.moduleName.replace('-','_')
-
- PythonWallpaperScript.importer.register_top_level(self.pluginName, str(self.wallpaper().package().path()))
-
- # import the code at the file name reported by mainScript()
- relpath = os.path.relpath(str(self.mainScript()),str(self.wallpaper().package().path()))
- if relpath.startswith("contents/code/"):
- relpath = relpath[14:]
- if relpath.endswith(".py"):
- relpath = relpath[:-3]
- relpath = relpath.replace("/",".")
- self.module = __import__(self.pluginName+'.'+relpath)
- self.pywallpaper = self.module.main.CreateWallpaper(None)
- self.pywallpaper.setWallpaper(self.wallpaper())
- self.pywallpaper.setWallpaperScript(self)
- self.initialized = True
- return True
-
- def __dtor__(self):
- PythonWallpaperScript.importer.unregister_top_level(self.pluginName)
- self.pywallpaper = None
-
- def paint(self, painter, exposedRect):
- self.pywallpaper.paint(painter, exposedRect)
-
- def initWallpaper(self, config):
- self.pywallpaper.init(config)
-
- def save(self, config):
- self.pywallpaper.save(config)
-
- def createConfigurationInterface(self, parent):
- self.connect(self, SIGNAL('settingsChanged(bool)'), parent, SLOT('settingsChanged(bool)'))
- return self.pywallpaper.createConfigurationInterface(parent)
-
- def settingsChanged(self, changed):
- self.emit(SIGNAL('settingsChanged(bool)'), changed)
-
- def mouseMoveEvent(self, event):
- self.pywallpaper.mouseMoveEvent(event)
-
- def mousePressEvent(self, event):
- self.pywallpaper.mousePressEvent(event)
-
- def mouseReleaseEvent(self, event):
- self.pywallpaper.mouseReleaseEvent(event)
-
- def wheelEvent(self, event):
- self.pywallpaper.wheelEvent(event)
-
- @pyqtSignature("renderCompleted(const QImage&)")
- def renderCompleted(self, image):
- self.pywallpaper.renderCompleted(image)
-
- @pyqtSignature("urlDropped(const KUrl&)")
- def urlDropped(self, url):
- self.pywallpaper.urlDropped(url)
-
-def CreatePlugin(widget_parent, parent, component_data):
- return PythonWallpaperScript(parent)
+++ /dev/null
-install(FILES applet.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_scriptengine_ruby)
-install(FILES data_engine.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_scriptengine_ruby)
-
-install(FILES plasma-scriptengine-ruby-applet.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-install(FILES plasma-scriptengine-ruby-dataengine.desktop DESTINATION ${SERVICES_INSTALL_DIR})
-
+++ /dev/null
-=begin
- * Copyright 2008-2010 by Richard Dale <richard.j.dale@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-=end
-
-require 'plasma_applet'
-
-module PlasmaScripting
- class Applet < Qt::Object
- slots "setImmutability(Plasma::ImmutabilityType)",
- :destroy,
- :showConfigurationInterface,
- :raise,
- :lower,
- :flushPendingConstraintsEvents,
- :init,
- 'initExtenderItem(Plasma::ExtenderItem*)'
-
- signals :releaseVisualFocus,
- :geometryChanged,
- :configNeedsSaving,
- :activate
-
- attr_accessor :applet_script
-
- def initialize(parent, args = nil)
- super(parent)
- @applet_script = parent
- connect(@applet_script.applet, SIGNAL(:releaseVisualFocus), self, SIGNAL(:releaseVisualFocus))
- connect(@applet_script.applet, SIGNAL(:geometryChanged), self, SIGNAL(:geometryChanged))
- connect(@applet_script.applet, SIGNAL(:configNeedsSaving), self, SIGNAL(:configNeedsSaving))
- connect(@applet_script.applet, SIGNAL(:activate), self, SIGNAL(:activate))
- connect(@applet_script.applet, SIGNAL('extenderItemRestored(Plasma::ExtenderItem*)'), self, SLOT('initExtenderItem(Plasma::ExtenderItem*)'))
- end
-
- # If a method is called on a PlasmaScripting::Applet instance is found to be missing
- # then try calling the method on the underlying Plasma::Applet in the ScriptEngine.
- def method_missing(method, *args)
- begin
- super(method, *args)
- rescue
- applet_script.applet.method_missing(method, *args)
- end
- end
-
- def self.const_missing(name)
- begin
- super(name)
- rescue
- Plasma::Applet.const_missing(name)
- end
- end
-
- def configChanged
- end
-
- def paintInterface(painter, option, contentsRect)
- end
-
- def initExtenderItem(item)
- puts "Missing implementation of initExtenderItem in the applet " \
- "#{item.config.readEntry('SourceAppletPluginName', '')}" \
- "!\n Any applet that uses extenders should implement initExtenderItem to " \
- "instantiate a widget."
- end
-
- def size
- @applet_script.size
- end
-
- def shape
- @applet_script.shape
- end
-
- def resize(*args)
- if args.length == 1 && args[0].kindof?(Qt::Size)
- puts "Warning: invalid resize() call. Add this to your metadata.desktop file:"
- puts "X-Plasma-DefautSize=%d,%d" % [args[0].width, args[0].height]
- elsif args.length == 2
- puts "Warning: invalid resize() call. Add this to your metadata.desktop file:"
- puts "X-Plasma-DefautSize=%d,%d" % [args[0].to_i, args[1].to_i]
- else
- super(*args)
- end
- end
-
- def constraintsEvent(constraints)
- end
-
- def contextualActions
- return []
- end
-
- def createConfigurationInterface(dialog)
- end
-
- def showConfigurationInterface
- end
-
- def dataEngine(engine)
- @applet_script.dataEngine(engine)
- end
-
- def package
- @applet_script.package
- end
-
- def setImmutability(immutabilityType)
- @applet_script.applet.setImmutability(immutabilityType)
- end
-
- def immutability=(immutabilityType)
- setImmutability(immutabilityType)
- end
-
- def destroy
- @applet_script.applet.destroy
- end
-
- def raise
- @applet_script.applet.raise
- end
-
- def lower
- @applet_script.applet.lower
- end
-
- def flushPendingConstraintsEvents
- @applet_script.applet.flushPendingConstraintsEvents
- end
- end
-
- class Containment < Applet
- def initialize(parent, args = nil)
- super(parent, args)
- end
- end
-
- class PopupApplet < Applet
- def initialize(parent, args = nil)
- super(parent, args)
- end
- end
-end
-
-module PlasmaScriptengineRuby
- class Applet < Plasma::AppletScript
- def initialize(parent, args)
- super(parent)
- end
-
- def camelize(str)
- str.gsub(/(^|[._-])(.)/) { $2.upcase }
- end
-
- def init
- oldSize = applet.size
-
- puts "RubyAppletScript::Applet#init mainScript: #{mainScript}"
- program = Qt::FileInfo.new(mainScript)
- $: << program.path
- load Qt::File.encodeName(program.filePath).to_s
- moduleName = camelize(Qt::Dir.new(package.path).dirName)
- className = camelize(program.baseName)
- puts "RubyAppletScript::Applet#init instantiating: #{moduleName}::#{className}"
- klass = Object.const_get(moduleName.to_sym).const_get(className.to_sym)
- @applet_script = klass.new(self)
- @applet_script.init
- if oldSize.height > 10 && oldSize.width > 10
- applet.resize(oldSize)
- end
-
- set_up_event_handlers
- return true
- end
-
- def configChanged
- @applet_script.configChanged
- end
-
- def paintInterface(painter, option, contentsRect)
- @applet_script.paintInterface(painter, option, contentsRect)
- end
-
- def constraintsEvent(constraints)
- @applet_script.constraintsEvent(constraints)
- end
-
- def contextualActions
- @applet_script.contextualActions
- end
-
- def showConfigurationInterface
- dialog = standardConfigurationDialog()
- @applet_script.createConfigurationInterface(dialog)
- addStandardConfigurationPages(dialog)
- dialog.show
- end
-
- protected
-
- def eventFilter(obj, event)
- handler = @event_handlers[event.type.to_i]
- if handler
- @applet_script.send(handler, event)
- return true
- else
- return false
- end
- end
-
- private
-
- def set_up_event_handlers
- @event_handlers = {}
-
- if @applet_script.respond_to?(:mousePressEvent)
- @event_handlers[Qt::Event::GraphicsSceneMousePress.to_i] = :mousePressEvent
- end
-
- if @applet_script.respond_to?(:contextMenuEvent)
- @event_handlers[Qt::Event::GraphicsSceneContextMenu.to_i] = :contextMenuEvent
- end
-
- if @applet_script.respond_to?(:dragEnterEvent)
- @event_handlers[Qt::Event::GraphicsSceneDragEnter.to_i] = :dragEnterEvent
- end
-
- if @applet_script.respond_to?(:dragLeaveEvent)
- @event_handlers[Qt::Event::GraphicsSceneDragLeave.to_i] = :dragLeaveEvent
- end
-
- if @applet_script.respond_to?(:dragMoveEvent)
- @event_handlers[Qt::Event::GraphicsSceneDragMove.to_i] = :dragMoveEvent
- end
-
- if @applet_script.respond_to?(:dropEvent)
- @event_handlers[Qt::Event::GraphicsSceneDrop.to_i] = :dropEvent
- end
-
- if @applet_script.respond_to?(:focusInEvent)
- @event_handlers[Qt::Event::FocusIn.to_i] = :focusInEvent
- end
-
- if @applet_script.respond_to?(:focusOutEvent)
- @event_handlers[Qt::Event::FocusOut.to_i] = :focusOutEvent
- end
-
- if @applet_script.respond_to?(:hoverEnterEvent)
- @event_handlers[Qt::Event::GraphicsSceneHoverEnter.to_i] = :hoverEnterEvent
- end
-
- if @applet_script.respond_to?(:hoverLeaveEvent)
- @event_handlers[Qt::Event::GraphicsSceneHoverLeave.to_i] = :hoverLeaveEvent
- end
-
- if @applet_script.respond_to?(:hoverMoveEvent)
- @event_handlers[Qt::Event::GraphicsSceneHoverMove.to_i] = :hoverMoveEvent
- end
-
- if @applet_script.respond_to?(:inputMethodEvent)
- @event_handlers[Qt::Event::InputMethod.to_i] = :inputMethodEvent
- end
-
- if @applet_script.respond_to?(:keyPressEvent)
- @event_handlers[Qt::Event::KeyPress.to_i] = :keyPressEvent
- end
-
- if @applet_script.respond_to?(:keyReleaseEvent)
- @event_handlers[Qt::Event::KeyRelease.to_i] = :keyReleaseEvent
- end
-
- if @applet_script.respond_to?(:mouseDoubleClickEvent)
- @event_handlers[Qt::Event::GraphicsSceneMouseDoubleClick.to_i] = :mouseDoubleClickEvent
- end
-
- if @applet_script.respond_to?(:mouseMoveEvent)
- @event_handlers[Qt::Event::GraphicsSceneMouseMove.to_i] = :mouseMoveEvent
- end
-
- if @applet_script.respond_to?(:mousePressEvent)
- @event_handlers[Qt::Event::GraphicsSceneMousePress.to_i] = :mousePressEvent
- end
-
- if @applet_script.respond_to?(:mouseReleaseEvent)
- @event_handlers[Qt::Event::GraphicsSceneMouseRelease.to_i] = :mouseReleaseEvent
- end
-
- if @applet_script.respond_to?(:wheelEvent)
- @event_handlers[Qt::Event::GraphicsSceneWheel.to_i] = :wheelEvent
- end
-
- if !@event_handlers.empty?
- applet.installEventFilter(self)
- end
- end
-
- end
-end
-
-module Plasma
- #
- # Because a PlasmaScript::Applet is not actually a Plasma::Applet we
- # need to 'cheat' in the api, to pretend that it is. So the constructors
- # in the Plasma widget classes will substitute any PlasmaScript::Applet
- # argument passed for the real Plasma::Applet in the ScriptEngine
- #
-
- class BusyWidget < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class CheckBox < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class ComboBox < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class Extender < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class FlashingLabel < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class Frame < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class GroupBox < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class IconWidget < Qt::Base
- def initialize(*args)
- sargs = []
- for i in 0...args.length do
- if args[i].kind_of?(PlasmaScripting::Applet)
- sargs << args[i].applet_script.applet
- else
- sargs << args[i]
- end
- end
- super(*sargs)
- end
- end
-
- class ItemBackground < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class Label < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class LineEdit < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class Meter < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class PushButton < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class RadioButton < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class ScrollBar < Qt::Base
- def initialize(orientation, parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(orientation, parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class ScrollWidget < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class Separator < Qt::Base
- def initialize(parent = nil, wFlags = 0)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
- end
-
- class SignalPlotter < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class Slider < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class SpinBox < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
-
- def range=(arg)
- if arg.kind_of? Range
- return super(arg.begin, arg.exclude_end? ? arg.end - 1 : arg.end)
- else
- return super(arg)
- end
- end
- end
-
- class SvgWidget < Qt::Base
- def initialize(*args)
- if args.length > 0 && args[0].kind_of?(PlasmaScripting::Applet)
- args[0] = args[0].applet_script.applet
- super(*args)
- elsif args.length > 2 && args[2].kind_of?(PlasmaScripting::Applet)
- args[2] = args[2].applet_script.applet
- super(*args)
- else
- super
- end
- end
- end
-
- class TabBar < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class TextBrowser < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class TextEdit < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class ToolButton < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class ToolTipManager < Qt::Base
- def setContent(widget, data)
- if widget.kind_of?(PlasmaScripting::Applet)
- super(widget.applet_script.applet, data)
- else
- super
- end
- end
-
- def set_content(widget, data)
- setContent(widget, data)
- end
-
- def clearContent(widget)
- if widget.kind_of?(PlasmaScripting::Applet)
- super(widget.applet_script.applet)
- else
- super
- end
- end
-
- def clear_content(widget)
- clearContent(widget)
- end
-
- def show(widget)
- if widget.kind_of?(PlasmaScripting::Applet)
- super(widget.applet_script.applet)
- else
- super
- end
- end
-
- def visible?(widget)
- return isVisible(widget)
- end
-
- def isVisible(widget)
- if widget.kind_of?(PlasmaScripting::Applet)
- super(widget.applet_script.applet)
- else
- super
- end
- end
-
- def registerWidget(widget)
- if widget.kind_of?(PlasmaScripting::Applet)
- super(widget.applet_script.applet)
- else
- super
- end
- end
-
- def register_widget(widget)
- registerWidget(widget)
- end
-
- def unregisterWidget(widget)
- if widget.kind_of?(PlasmaScripting::Applet)
- super(widget.applet_script.applet)
- else
- super
- end
- end
-
- def unregister_widget(widget)
- unregisterWidget(widget)
- end
- end
-
- class TreeView < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class VideoWidget < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
- class WebView < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
- end
-
-end
-
-module Qt
- class GraphicsProxyWidget < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class QAbstractGraphicsShapeItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsEllipseItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsItemGroup < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsLineItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsPathItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsPixmapItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsPolygonItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsRectItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsSimpleTextItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsSvgItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsTextItem < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsWidget < Qt::Base
- def initialize(parent = nil, wFlags = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet, wFlags)
- else
- super
- end
- end
-
- def parent_item=(item)
- setParentItem(item)
- end
-
- def parentItem=(item)
- setParentItem(item)
- end
-
- def setParentItem(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def type(*args)
- method_missing(:type, *args)
- end
- end
-
- class GraphicsGridLayout < Qt::Base
- def initialize(parent = nil)
- if parent.kind_of?(PlasmaScripting::Applet)
- super(parent.applet_script.applet)
- else
- super
- end
- end
-
- def add_item(*args)
- addItem(*args)
- end
-
- def addItem(*args)
- sargs = []
- for i in 0...args.length do
- if args[i].kind_of?(PlasmaScripting::Applet)
- sargs << args[i].applet_script.applet
- else
- sargs << args[i]
- end
- end
- super(*sargs)
- end
-
- def alignment(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def set_alignment(item, alignment)
- setAlignment(item, alignment)
- end
-
- def setAlignment(item, alignment)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet, alignment)
- else
- super
- end
- end
- end
-
- class GraphicsLinearLayout < Qt::Base
- def initialize(*args)
- sargs = []
- for i in 0...args.length do
- if args[i].kind_of?(PlasmaScripting::Applet)
- sargs << args[i].applet_script.applet
- else
- sargs << args[i]
- end
- end
- super(*sargs)
- end
-
- def add_item(*args)
- addItem(*args)
- end
-
- def addItem(*args)
- sargs = []
- for i in 0...args.length do
- if args[i].kind_of?(PlasmaScripting::Applet)
- sargs << args[i].applet_script.applet
- else
- sargs << args[i]
- end
- end
- super(*sargs)
- end
-
- def alignment(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
-
- def insert_item(index, item)
- insertItem(index, item)
- end
-
- def insertItem(index, item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(index, item.applet_script.applet)
- else
- super
- end
- end
-
- def set_alignment(item, alignment)
- setAlignment(item, alignment)
- end
-
- def setAlignment(item, alignment)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet, alignment)
- else
- super
- end
- end
-
- def set_stretch_factor(item, stretch)
- setStretchFactor(item, stretch)
- end
-
- def setStretchFactor(item, stretch)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet, stretch)
- else
- super
- end
- end
-
- def stretch_factor(item)
- stretchFactor(item)
- end
-
- def stretchFactor(item)
- if item.kind_of?(PlasmaScripting::Applet)
- super(item.applet_script.applet)
- else
- super
- end
- end
- end
-end
-
-# kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;
+++ /dev/null
-=begin
- * Copyright 2008 by Richard Dale <richard.j.dale@gmail.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU Library General Public License as
- * published by the Free Software Foundation; either version 2, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details
- *
- * You should have received a copy of the GNU Library General Public
- * License along with this program; if not, write to the
- * Free Software Foundation, Inc.,
- * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-=end
-
-require 'plasma_applet'
-
-module PlasmaScripting
- class DataEngine < Qt::Object
- slots :updateAllSources, "removeSource(QString)"
- signals "sourceAdded(QString)", "sourceRemoved(QString)"
-
- attr_accessor :data_engine_script
-
- def initialize(parent, args = nil)
- super(parent)
- @data_engine_script = parent
- connect(@data_engine_script.dataEngine, SIGNAL("sourceAdded(QString)"), self, SIGNAL("sourceAdded(QString)"))
- connect(@data_engine_script.dataEngine, SIGNAL("sourceRemoved(QString)"), self, SIGNAL("sourceRemoved(QString)"))
- end
-
- def init
- end
-
- def sourceRequestEvent(name)
- end
-
- def updateSourceEvent(source)
- end
-
- def setData(*args)
- if args.length == 2 && !args[1].kind_of?(Qt::Variant)
- args[1] = Qt::Variant.fromValue(args[1])
- elsif args.length == 3 && !args[2].kind_of?(Qt::Variant)
- args[2] = Qt::Variant.fromValue(args[2])
- end
- @data_engine_script.setData(*args)
- end
-
- def removeAllData(source)
- @data_engine_script.removeAllData(source)
- end
-
- def removeData(source, key)
- @data_engine_script.removeData(source, key)
- end
-
- def setMaxSourceCount(limit)
- @data_engine_script.setMaxSourceCount(limit)
- end
-
- def maxSourceCount=(limit)
- setMaxSourceCount(limit)
- end
-
- def setMinimumPollingInterval(minimumMs)
- @data_engine_script.setMinimumPollingInterval(minimumMs)
- end
-
- def minimumPollingInterval=(minimumMs)
- setMinimumPollingInterval(minimumMs)
- end
-
- def minimumPollingInterval
- @data_engine_script.minimumPollingInterval
- end
-
- def setPollingInterval(frequency)
- @data_engine_script.setPollingInterval(frequency)
- end
-
- def pollingInterval=(frequency)
- setPollingInterval(frequency)
- end
-
- def removeAllSources
- @data_engine_script.removeAllSources
- end
-
- def sources
- return []
- end
-
- def removeSource(source)
- @data_engine_script.dataEngine.removeSource(source)
- end
-
- def updateAllSources
- @data_engine_script.dataEngine.updateAllSources
- end
- end
-end
-
-module PlasmaScriptengineRuby
- class DataEngine < Plasma::DataEngineScript
- def initialize(parent, args)
- super(parent)
- end
-
- def camelize(str)
- str.gsub(/(^|[._-])(.)/) { $2.upcase }
- end
-
- def init
- puts "RubyAppletScript::DataEngine#init mainScript: #{mainScript}"
- program = Qt::FileInfo.new(mainScript)
- $: << program.path
- load Qt::File.encodeName(program.filePath).to_s
- moduleName = camelize(Qt::Dir.new(package.path).dirName)
- className = camelize(program.baseName)
- puts "RubyAppletScript::DataEngine#init instantiating: #{moduleName}::#{className}"
- klass = Object.const_get(moduleName.to_sym).const_get(className.to_sym)
- @data_engine_script = klass.new(self)
- @data_engine_script.init
- return true
- end
-
- def sources
- @data_engine_script.sources
- end
-
- def sourceRequestEvent(name)
- @data_engine_script.sourceRequestEvent(name)
- end
-
- def updateSourceEvent(source)
- @data_engine_script.updateSourceEvent(source)
- end
- end
-end
-
-# kate: space-indent on; indent-width 2; replace-tabs on; mixed-indent off;
-
+++ /dev/null
-[Desktop Entry]
-Name=Ruby Widget
-Name[ar]=ودجة روبي
-Name[ast]=Elementu gráficu en Ruby
-Name[be@latin]=Widžet u movie „Ruby”
-Name[bg]=Джаджа на Ruby
-Name[bn]=রুবি উইজেট
-Name[bn_IN]=Ruby উইজেট
-Name[bs]=Ruby grafička kontrola
-Name[ca]=Estri Ruby
-Name[ca@valencia]=Estri Ruby
-Name[cs]=Ruby widget
-Name[csb]=Interfejs Ruby
-Name[da]=Ruby-widget
-Name[de]=Ruby-Miniprogramm
-Name[el]=Συστατικό Ruby
-Name[en_GB]=Ruby Widget
-Name[eo]=Ruby-fenestraĵo
-Name[es]=Elemento gráfico en Ruby
-Name[et]=Ruby vidin
-Name[eu]=Ruby trepeta
-Name[fi]=Ruby-sovelma
-Name[fr]=Composant graphique Ruby
-Name[fy]=Ruby widget
-Name[ga]=Giuirléid Ruby
-Name[gl]=Widget escrito en Ruby
-Name[gu]=રૂબી વિજેટ
-Name[he]=ווידג׳ט של Ruby
-Name[hi]=रूबी विज़ेट
-Name[hne]=रूबी विजेट
-Name[hr]=Ruby widget
-Name[hu]=Ruby-elem
-Name[ia]=Elemento graphic (Widget) de Ruby
-Name[id]=Widget Ruby
-Name[is]=Ruby græja
-Name[ja]=Ruby ウィジェット
-Name[kk]=Ruby бөлшегі
-Name[km]=ធាតុក្រាហ្វិក
-Name[kn]=ರೂಬಿ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Name[ko]=루비 위젯
-Name[ku]=Alava Ruby
-Name[lt]=Ruby valdiklis
-Name[lv]=Ruby sīkrīks
-Name[ml]=റൂബി ഉരുപ്പടി
-Name[mr]=Ruby विजेट
-Name[nb]=Ruby-element
-Name[nds]=Ruby-Lüttprogramm
-Name[nl]=Ruby-widget
-Name[nn]=Ruby-element
-Name[or]=ରୁବି ୱିଜେଟ
-Name[pa]=ਰੂਬੀ ਵਿਦਜੈੱਟ
-Name[pl]=Element interfejsu w języku Ruby
-Name[pt]=Elemento em Ruby
-Name[pt_BR]=Widget Ruby
-Name[ro]=Control Ruby
-Name[ru]=Виджет на языке Ruby
-Name[si]=Ruby මෙවලම්
-Name[sk]=Ruby widget
-Name[sl]=Gradnik v Ruby
-Name[sr]=рубијевски виџет
-Name[sr@ijekavian]=рубијевски виџет
-Name[sr@ijekavianlatin]=ruby vidžet
-Name[sr@latin]=ruby vidžet
-Name[sv]=Grafisk Ruby-komponent
-Name[ta]=Ruby Widget
-Name[tg]=Илова ба Ruby
-Name[th]=วิดเจ็ตภาษารูบี้
-Name[tr]=Ruby Gereci
-Name[ug]=Ruby ۋىجېتى
-Name[uk]=Віджет Ruby
-Name[wa]=Ahesse Ruby
-Name[x-test]=xxRuby Widgetxx
-Name[zh_CN]=Ruby 部件
-Name[zh_TW]=Ruby 元件
-Comment=Native Plasma widget written in Ruby
-Comment[ar]=وجة بلازما أصلية مكتوبة بروبي
-Comment[ast]=Elementu gráficu nativu de Plasma escrito en Ruby
-Comment[be@latin]=Rodny widžet systemy „Plasma”, napisany ŭ movie „Ruby”
-Comment[bg]=Оригинална джаджа за Plasma, написана на Ruby
-Comment[bs]=Samosvojni plazma grafička kontrola napisana u Ruby-ju
-Comment[ca]=Estri nadiu del Plasma escrit en Ruby
-Comment[ca@valencia]=Estri nadiu del Plasma escrit en Ruby
-Comment[cs]=Nativní plasmoid napsaný v Ruby
-Comment[da]=Ægte Plasma-widget skrevet i Ruby
-Comment[de]=Echtes Plasma-Programm, geschrieben in Ruby
-Comment[el]=Εγγενές συστατικό Plasma γραμμένο σε Ruby
-Comment[en_GB]=Native Plasma widget written in Ruby
-Comment[es]=Elemento gráfico nativo de Plasma escrito en Ruby
-Comment[et]=Rubys kirjutatud Plasma vidin
-Comment[eu]=Jatorrizko Plasma trepeta, Ruby lengoaian idatzia
-Comment[fi]=Natiivi, Ruby-pohjainen Plasma-sovelma
-Comment[fr]=Composant graphique natif de Plasma écrit en Ruby
-Comment[fy]=Plasma widget skreaun yn Ruby
-Comment[ga]=Giuirléid dhúchasach Plasma scríofa i Ruby
-Comment[gl]=Widget nativo de Plasma escrito en Ruby
-Comment[gu]=રૂબીમાં લખાયેલ મૂળભૂત પ્લાઝમા વિજેટ
-Comment[he]=ווידג׳ט Plasma הנכתב ב־Ruby
-Comment[hi]=रूबी में लिखा गया नेटिव प्लाज्मा विजेट
-Comment[hne]=रुबी मं लिखे नेटिव प्लाज्मा विजेट
-Comment[hr]=Izvorna Plasma widget napisana u Rubyu
-Comment[hu]=Plasma-elem Ruby nyelven
-Comment[ia]=Elemento graphic (widget) native de Plasma scribite in Ruby
-Comment[id]=Widget Plasma asli yang ditulis dalam Ruby
-Comment[is]=Upprunabundin Plasma græja skrifuð í Ruby
-Comment[ja]=Ruby で書かれた Plasma のネイティブウィジェット
-Comment[kk]=Ruby-дег жазылған Plasma интерфейс бөлшегі
-Comment[km]=ធាតុក្រាហ្វិកប្លាស្មាដើមបានសរសេរនៅក្នុង Ruby
-Comment[kn]=ರೂಬಿಯಲ್ಲಿ ಬರೆಯಲಾದ ಸ್ಥಳೀಯ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Comment[ko]=루비로 작성된 Plasma 위젯
-Comment[lt]=Nuosavas Plasma valdiklis parašytas Ruby kalba
-Comment[lv]=Plasma sīkrīks, rakstīts Ruby
-Comment[ml]=റൂബിയില് തയ്യാറാക്കിയിരിക്കുന്ന നേറ്റീവ് പ്ലാസ്മാ ഉരുപ്പടി
-Comment[mr]=Ruby अंतर्गत लिहीले गेलेले मूळ Plasma विजेट
-Comment[nb]=Plasmaelement for dette systemet, skrevet i Ruby
-Comment[nds]=En orginaal Plasma-Lüttprogramm, schreven in Ruby
-Comment[nl]=Plasma-widget geschreven in Ruby
-Comment[nn]=Lokalt Plasma-element skrive i Ruby
-Comment[or]=Ruby ରେ ଲେଖା ହୋଇଥିବା ସ୍ଥାନୀୟ ପ୍ଲାଜମା ୱିଜେଟ
-Comment[pa]=ਰੂਬੀ ਵਿੱਚ ਲਿਖੇ ਨੇਟਿਵ ਪਲਾਜ਼ਮਾ ਵਿਦਜੈੱਟ
-Comment[pl]=Element interfejsu Plazmy napisany w języku Ruby
-Comment[pt]=Elemento nativo do Plasma feito em Ruby
-Comment[pt_BR]=Widget nativo do Plasma, escrito em Ruby
-Comment[ro]=Miniaplicație Plasma scrisă în Ruby
-Comment[ru]=Виджет Plasma, написанный на языке Ruby
-Comment[si]=Native Plasma widget written in Ruby
-Comment[sk]=Natívny plasma widget napísaný v Ruby
-Comment[sl]=Lastni gradnik za Plasmo, ki je napisan v Rubyu
-Comment[sr]=Самосвојни плазма виџет написан у рубију
-Comment[sr@ijekavian]=Самосвојни плазма виџет написан у рубију
-Comment[sr@ijekavianlatin]=Samosvojni plasma vidžet napisan u Rubyju
-Comment[sr@latin]=Samosvojni plasma vidžet napisan u Rubyju
-Comment[sv]=Inbyggd grafisk Plasma-komponent skriven i Ruby
-Comment[ta]=Native Plasma widget written in Ruby
-Comment[tg]=Модуль Plasma, написанный на языке JavaScript
-Comment[th]=วิดเจ็ตพลาสมาแท้ที่ถูกเขียนด้วยภาษารูบี้
-Comment[tr]=Ruby ile yazılmış gerçek Plasma gereci
-Comment[ug]=Ruby بىلەن يېزىلغان ئەسلى Plasma widget
-Comment[uk]=Віджет Плазми, написаний на Ruby
-Comment[wa]=Ahesse askepieye po Plasma eyet scrîte e Ruby
-Comment[x-test]=xxNative Plasma widget written in Rubyxx
-Comment[zh_CN]=使用 Ruby 编写的原生 Plasma 部件
-Comment[zh_TW]=用 Ruby 寫的原始 Plasma 元件
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-KDE-Library=krubypluginfactory
-X-KDE-PluginKeyword=plasma_scriptengine_ruby/applet.rb
-X-Plasma-API=ruby-script
-X-Plasma-ComponentTypes=Applet
+++ /dev/null
-[Desktop Entry]
-Name=Ruby Widget
-Name[ar]=ودجة روبي
-Name[ast]=Elementu gráficu en Ruby
-Name[be@latin]=Widžet u movie „Ruby”
-Name[bg]=Джаджа на Ruby
-Name[bn]=রুবি উইজেট
-Name[bn_IN]=Ruby উইজেট
-Name[bs]=Ruby grafička kontrola
-Name[ca]=Estri Ruby
-Name[ca@valencia]=Estri Ruby
-Name[cs]=Ruby widget
-Name[csb]=Interfejs Ruby
-Name[da]=Ruby-widget
-Name[de]=Ruby-Miniprogramm
-Name[el]=Συστατικό Ruby
-Name[en_GB]=Ruby Widget
-Name[eo]=Ruby-fenestraĵo
-Name[es]=Elemento gráfico en Ruby
-Name[et]=Ruby vidin
-Name[eu]=Ruby trepeta
-Name[fi]=Ruby-sovelma
-Name[fr]=Composant graphique Ruby
-Name[fy]=Ruby widget
-Name[ga]=Giuirléid Ruby
-Name[gl]=Widget escrito en Ruby
-Name[gu]=રૂબી વિજેટ
-Name[he]=ווידג׳ט של Ruby
-Name[hi]=रूबी विज़ेट
-Name[hne]=रूबी विजेट
-Name[hr]=Ruby widget
-Name[hu]=Ruby-elem
-Name[ia]=Elemento graphic (Widget) de Ruby
-Name[id]=Widget Ruby
-Name[is]=Ruby græja
-Name[ja]=Ruby ウィジェット
-Name[kk]=Ruby бөлшегі
-Name[km]=ធាតុក្រាហ្វិក
-Name[kn]=ರೂಬಿ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Name[ko]=루비 위젯
-Name[ku]=Alava Ruby
-Name[lt]=Ruby valdiklis
-Name[lv]=Ruby sīkrīks
-Name[ml]=റൂബി ഉരുപ്പടി
-Name[mr]=Ruby विजेट
-Name[nb]=Ruby-element
-Name[nds]=Ruby-Lüttprogramm
-Name[nl]=Ruby-widget
-Name[nn]=Ruby-element
-Name[or]=ରୁବି ୱିଜେଟ
-Name[pa]=ਰੂਬੀ ਵਿਦਜੈੱਟ
-Name[pl]=Element interfejsu w języku Ruby
-Name[pt]=Elemento em Ruby
-Name[pt_BR]=Widget Ruby
-Name[ro]=Control Ruby
-Name[ru]=Виджет на языке Ruby
-Name[si]=Ruby මෙවලම්
-Name[sk]=Ruby widget
-Name[sl]=Gradnik v Ruby
-Name[sr]=рубијевски виџет
-Name[sr@ijekavian]=рубијевски виџет
-Name[sr@ijekavianlatin]=ruby vidžet
-Name[sr@latin]=ruby vidžet
-Name[sv]=Grafisk Ruby-komponent
-Name[ta]=Ruby Widget
-Name[tg]=Илова ба Ruby
-Name[th]=วิดเจ็ตภาษารูบี้
-Name[tr]=Ruby Gereci
-Name[ug]=Ruby ۋىجېتى
-Name[uk]=Віджет Ruby
-Name[wa]=Ahesse Ruby
-Name[x-test]=xxRuby Widgetxx
-Name[zh_CN]=Ruby 部件
-Name[zh_TW]=Ruby 元件
-Comment=Native Plasma widget written in Ruby
-Comment[ar]=وجة بلازما أصلية مكتوبة بروبي
-Comment[ast]=Elementu gráficu nativu de Plasma escrito en Ruby
-Comment[be@latin]=Rodny widžet systemy „Plasma”, napisany ŭ movie „Ruby”
-Comment[bg]=Оригинална джаджа за Plasma, написана на Ruby
-Comment[bs]=Samosvojni plazma grafička kontrola napisana u Ruby-ju
-Comment[ca]=Estri nadiu del Plasma escrit en Ruby
-Comment[ca@valencia]=Estri nadiu del Plasma escrit en Ruby
-Comment[cs]=Nativní plasmoid napsaný v Ruby
-Comment[da]=Ægte Plasma-widget skrevet i Ruby
-Comment[de]=Echtes Plasma-Programm, geschrieben in Ruby
-Comment[el]=Εγγενές συστατικό Plasma γραμμένο σε Ruby
-Comment[en_GB]=Native Plasma widget written in Ruby
-Comment[es]=Elemento gráfico nativo de Plasma escrito en Ruby
-Comment[et]=Rubys kirjutatud Plasma vidin
-Comment[eu]=Jatorrizko Plasma trepeta, Ruby lengoaian idatzia
-Comment[fi]=Natiivi, Ruby-pohjainen Plasma-sovelma
-Comment[fr]=Composant graphique natif de Plasma écrit en Ruby
-Comment[fy]=Plasma widget skreaun yn Ruby
-Comment[ga]=Giuirléid dhúchasach Plasma scríofa i Ruby
-Comment[gl]=Widget nativo de Plasma escrito en Ruby
-Comment[gu]=રૂબીમાં લખાયેલ મૂળભૂત પ્લાઝમા વિજેટ
-Comment[he]=ווידג׳ט Plasma הנכתב ב־Ruby
-Comment[hi]=रूबी में लिखा गया नेटिव प्लाज्मा विजेट
-Comment[hne]=रुबी मं लिखे नेटिव प्लाज्मा विजेट
-Comment[hr]=Izvorna Plasma widget napisana u Rubyu
-Comment[hu]=Plasma-elem Ruby nyelven
-Comment[ia]=Elemento graphic (widget) native de Plasma scribite in Ruby
-Comment[id]=Widget Plasma asli yang ditulis dalam Ruby
-Comment[is]=Upprunabundin Plasma græja skrifuð í Ruby
-Comment[ja]=Ruby で書かれた Plasma のネイティブウィジェット
-Comment[kk]=Ruby-дег жазылған Plasma интерфейс бөлшегі
-Comment[km]=ធាតុក្រាហ្វិកប្លាស្មាដើមបានសរសេរនៅក្នុង Ruby
-Comment[kn]=ರೂಬಿಯಲ್ಲಿ ಬರೆಯಲಾದ ಸ್ಥಳೀಯ ಪ್ಲಾಸ್ಮಾ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Comment[ko]=루비로 작성된 Plasma 위젯
-Comment[lt]=Nuosavas Plasma valdiklis parašytas Ruby kalba
-Comment[lv]=Plasma sīkrīks, rakstīts Ruby
-Comment[ml]=റൂബിയില് തയ്യാറാക്കിയിരിക്കുന്ന നേറ്റീവ് പ്ലാസ്മാ ഉരുപ്പടി
-Comment[mr]=Ruby अंतर्गत लिहीले गेलेले मूळ Plasma विजेट
-Comment[nb]=Plasmaelement for dette systemet, skrevet i Ruby
-Comment[nds]=En orginaal Plasma-Lüttprogramm, schreven in Ruby
-Comment[nl]=Plasma-widget geschreven in Ruby
-Comment[nn]=Lokalt Plasma-element skrive i Ruby
-Comment[or]=Ruby ରେ ଲେଖା ହୋଇଥିବା ସ୍ଥାନୀୟ ପ୍ଲାଜମା ୱିଜେଟ
-Comment[pa]=ਰੂਬੀ ਵਿੱਚ ਲਿਖੇ ਨੇਟਿਵ ਪਲਾਜ਼ਮਾ ਵਿਦਜੈੱਟ
-Comment[pl]=Element interfejsu Plazmy napisany w języku Ruby
-Comment[pt]=Elemento nativo do Plasma feito em Ruby
-Comment[pt_BR]=Widget nativo do Plasma, escrito em Ruby
-Comment[ro]=Miniaplicație Plasma scrisă în Ruby
-Comment[ru]=Виджет Plasma, написанный на языке Ruby
-Comment[si]=Native Plasma widget written in Ruby
-Comment[sk]=Natívny plasma widget napísaný v Ruby
-Comment[sl]=Lastni gradnik za Plasmo, ki je napisan v Rubyu
-Comment[sr]=Самосвојни плазма виџет написан у рубију
-Comment[sr@ijekavian]=Самосвојни плазма виџет написан у рубију
-Comment[sr@ijekavianlatin]=Samosvojni plasma vidžet napisan u Rubyju
-Comment[sr@latin]=Samosvojni plasma vidžet napisan u Rubyju
-Comment[sv]=Inbyggd grafisk Plasma-komponent skriven i Ruby
-Comment[ta]=Native Plasma widget written in Ruby
-Comment[tg]=Модуль Plasma, написанный на языке JavaScript
-Comment[th]=วิดเจ็ตพลาสมาแท้ที่ถูกเขียนด้วยภาษารูบี้
-Comment[tr]=Ruby ile yazılmış gerçek Plasma gereci
-Comment[ug]=Ruby بىلەن يېزىلغان ئەسلى Plasma widget
-Comment[uk]=Віджет Плазми, написаний на Ruby
-Comment[wa]=Ahesse askepieye po Plasma eyet scrîte e Ruby
-Comment[x-test]=xxNative Plasma widget written in Rubyxx
-Comment[zh_CN]=使用 Ruby 编写的原生 Plasma 部件
-Comment[zh_TW]=用 Ruby 寫的原始 Plasma 元件
-X-KDE-ServiceTypes=Plasma/ScriptEngine
-Type=Service
-Icon=text-x-script
-X-KDE-Library=krubypluginfactory
-X-KDE-PluginKeyword=plasma_scriptengine_ruby/data_engine.rb
-X-EngineName=ruby-dataengine-script
-X-Plasma-API=ruby-script
-X-Plasma-ComponentTypes=DataEngine
+++ /dev/null
-add_subdirectory(dashboard)
-
-project(plasma-webapplet)
-
-set(webapplet_SRCS
- webpage.cpp webapplet.cpp plasmawebapplet.cpp plasmajs.cpp webapplet_plugin.cpp)
-kde4_add_plugin(plasma_appletscriptengine_webapplet ${webapplet_SRCS})
-target_link_libraries(plasma_appletscriptengine_webapplet ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${QT_QTWEBKIT_LIBRARY} )
-install(TARGETS plasma_appletscriptengine_webapplet DESTINATION ${PLUGIN_INSTALL_DIR})
-
-set(webappletpackage_SRCS
- webapplet_package.cpp)
-kde4_add_plugin(plasma_packagestructure_web ${webappletpackage_SRCS})
-target_link_libraries(plasma_packagestructure_web ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${QT_QTWEBKIT_LIBRARY} )
-install(TARGETS plasma_packagestructure_web DESTINATION ${PLUGIN_INSTALL_DIR})
-
-set(dashboardapplet_SRCS
- webpage.cpp webapplet.cpp dashboardapplet.cpp bundle.cpp dashboardjs.cpp)
-kde4_add_plugin(plasma_appletscriptengine_dashboard ${dashboardapplet_SRCS})
-target_link_libraries(plasma_appletscriptengine_dashboard ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${QT_QTWEBKIT_LIBRARY} )
-install(TARGETS plasma_appletscriptengine_dashboard DESTINATION ${PLUGIN_INSTALL_DIR})
-
-set(bundlepackage_SRCS
- bundle.cpp dashboard_plugin.cpp)
-kde4_add_plugin(plasma_packagestructure_dashboard ${bundlepackage_SRCS})
-target_link_libraries(plasma_packagestructure_dashboard ${KDE4_PLASMA_LIBS} ${KDE4_KIO_LIBS} ${QT_QTWEBKIT_LIBRARY} )
-install(TARGETS plasma_packagestructure_dashboard DESTINATION ${PLUGIN_INSTALL_DIR})
-
-install(FILES plasma-scriptengine-applet-web.desktop
- plasma-scriptengine-applet-dashboard.desktop
- plasma-packagestructure-dashboard.desktop
- plasma-packagestructure-web.desktop
- DESTINATION ${SERVICES_INSTALL_DIR})
+++ /dev/null
-#!/bin/bash
-$XGETTEXT *.cpp -o $podir/plasma_appletscriptengine_dashboard.pot
+++ /dev/null
-Document about dashboard stuff
-http://developer.apple.com/documentation/AppleApplications/Conceptual/Dashboard_ProgTopics/Dashboard_ProgTopics.pdf
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-
-#include "bundle.h"
-
-#include <QBuffer>
-#include <QDebug>
-#include <QDir>
-#include <QFile>
-#include <QtCore/qxmlstream.h>
-
-#include <KDebug>
-
-#include <KIO/CopyJob>
-#include <KIO/Job>
-
-#include <Plasma/PackageMetadata>
-#include <Plasma/Package>
-
-void recursive_print(const KArchiveDirectory *dir, const QString &path)
-{
- const QStringList l = dir->entries();
- QStringList::const_iterator it = l.constBegin();
- for (; it != l.end(); ++it)
- {
- const KArchiveEntry* entry = dir->entry((*it));
- printf("mode=%07o %s %s size: %lld pos: %lld %s%s isdir=%d%s",
- entry->permissions(),
- entry->user().toLatin1().constData(),
- entry->group().toLatin1().constData(),
- entry->isDirectory() ? 0 : ((KArchiveFile*)entry)->size(),
- entry->isDirectory() ? 0 : ((KArchiveFile*)entry)->position(),
- path.toLatin1().constData(),
- (*it).toLatin1().constData(), entry->isDirectory(),
- entry->symLinkTarget().isEmpty() ? "" :
- QString(" symlink: %1").arg(
- entry->symLinkTarget()).toLatin1().constData());
-
- //if (!entry->isDirectory()) printf("%d",
- // ((KArchiveFile*)entry)->size());
- printf("\n");
- if (entry->isDirectory())
- recursive_print((KArchiveDirectory *)entry, path+(*it)+'/');
- }
-}
-
-
-static const KArchiveDirectory *recursiveFind(const KArchiveDirectory *dir)
-{
- const QStringList l = dir->entries();
- QStringList::const_iterator it;
- for (it = l.constBegin(); it != l.constEnd(); ++it) {
- const KArchiveEntry* entry = dir->entry((*it));
- if (entry->isDirectory()) {
- QString name = *it;
- if (name.startsWith(QLatin1String("__MACOSX"))) {
- //skip this
- continue;
- } else if (name.endsWith(QLatin1String(".wdgt"))) {
- //got our bad boy
- return static_cast<const KArchiveDirectory*>(entry);
- } else {
- const KArchiveDirectory *fd =
- recursiveFind(static_cast<const KArchiveDirectory*>(entry));
- if (fd)
- return fd;
- }
- }
- }
- return 0;
-}
-
-Bundle::Bundle(const QString &path)
- : PackageStructure(0, "MacDashboard"),
- m_isValid(false),
- m_width(0), m_height(0)
-{
- setContentsPrefixPaths(QStringList());
- QFile f(path);
- f.open(QIODevice::ReadOnly);
- m_data = f.readAll();
- f.close();
- initTempDir();
- open();
-}
-
-Bundle::Bundle(const QByteArray &data)
- : PackageStructure(0, "MacDashboard"),
- m_isValid(false),
- m_width(0),
- m_height(0)
-{
- setContentsPrefixPaths(QStringList());
- m_data = data;
- initTempDir();
- open();
-}
-
-Bundle::Bundle(QObject *parent, QVariantList args)
- : PackageStructure(parent, "MacDashboard"),
- m_isValid(false),
- m_tempDir(0),
- m_width(0),
- m_height(0)
-{
- Q_UNUSED(args)
- setContentsPrefixPaths(QStringList());
-}
-
-Bundle::~Bundle()
-{
- close();
-}
-
-void Bundle::setData(const QByteArray &data)
-{
- m_data = data;
- close();
- open();
-}
-
-QByteArray Bundle::data() const
-{
- return m_data;
-}
-
-bool Bundle::open()
-{
- if (!m_tempDir) {
- initTempDir();
- }
-
- if (m_data.isEmpty()) {
- return false;
- }
-
- QBuffer buffer(&m_data);
- KZip zip(&buffer);
- if (!zip.open(QIODevice::ReadOnly)) {
- qWarning("Couldn't open the bundle!");
- return false;
- }
-
- const KArchiveDirectory *dir = zip.directory();
-
- const KArchiveDirectory *foundDir = recursiveFind(dir);
- if (!foundDir) {
- qWarning("not a bundle");
- m_isValid = false;
- zip.close();
- return 0;
- }
-
- m_isValid = extractArchive(foundDir, QLatin1String(""));
- qDebug()<<"Dir = "<<foundDir->name() << m_isValid;
-
- if (m_isValid) {
- setPath(m_tempDir->name());
- }
-
- zip.close();
-
- return m_isValid;
-}
-
-bool Bundle::close()
-{
- bool ret = m_tempDir;
- delete m_tempDir;
- m_tempDir = 0;
- return ret;
-}
-
-bool Bundle::extractArchive(const KArchiveDirectory *dir, const QString &path)
-{
- const QStringList l = dir->entries();
-
- QStringList::const_iterator it;
- for (it = l.constBegin(); it != l.constEnd(); ++it) {
- const KArchiveEntry* entry = dir->entry((*it));
- QString fullPath = QString("%1/%2").arg(path).arg(*it);
- if (entry->isDirectory()) {
- QString outDir = QString("%1%2").arg(m_tempDir->name()).arg(path);
- QDir qdir(outDir);
- qdir.mkdir(*it);
- extractArchive(static_cast<const KArchiveDirectory*>(entry), fullPath);
- } else if (entry->isFile()) {
- QString outName = QString("%1%2").arg(m_tempDir->name()).arg(fullPath.remove(0, 1));
- //qDebug()<<"-------- "<<outName;
- QFile f(outName);
- if (!f.open(QIODevice::WriteOnly)) {
- qWarning("Couldn't create %s", qPrintable(outName));
- continue;
- }
- const KArchiveFile *archiveFile = static_cast<const KArchiveFile*>(entry);
- f.write(archiveFile->data());
- f.close();
- } else {
- qWarning("Unidentified entry at %s", qPrintable(fullPath));
- }
- }
- return true;
-}
-
-void Bundle::pathChanged()
-{
- //qDebug() << "path changed";
- m_isValid = extractInfo();
-}
-
-bool Bundle::extractInfo()
-{
- QString plistLocation = QString("%1Info.plist").arg(path());
- QString configXml = QString("%1config.xml").arg(path());
- if (QFile::exists(plistLocation)) {
- //qDebug() << "doing plist";
- return parsePlist(plistLocation);
- } else if (QFile::exists(configXml)) {
- return parseConfigXml(configXml);
- }
-
- return false;
-}
-
-bool Bundle::parsePlist(const QString &loc)
-{
- QFile f(loc);
- if (!f.open(QIODevice::ReadOnly)) {
- qWarning("Couldn't open info file: '%s'", qPrintable(loc));
- return false;
- }
-
- QMap<QString, QString> infoMap;
- QString str = f.readAll();
- QXmlStreamReader reader(str);
- while (!reader.atEnd()) {
- reader.readNext();
- // do processing
- if (reader.isStartElement()) {
- //qDebug() << reader.name().toString();
- if (reader.name() == "key") {
- QString key, value;
- reader.readNext();
- if (reader.isCharacters()) {
- QString str = reader.text().toString();
- str = str.trimmed();
- if (!str.isEmpty())
- key = str;
- }
- if (key.isEmpty())
- continue;
- while (!reader.isStartElement())
- reader.readNext();
- if (reader.name() != "string" &&
- reader.name() != "integer") {
- qDebug()<<"Unrecognized val "<<reader.name().toString()
- <<" for key "<<key;
- continue;
- }
- reader.readNext();
- if (reader.isCharacters()) {
- QString str = reader.text().toString();
- str = str.trimmed();
- if (!str.isEmpty())
- value = str;
- }
- //qDebug()<<"key = "<<key<<", value = "<<value;
- infoMap.insert(key, value);
- }
- }
- }
-
- QMap<QString, QString>::const_iterator itr;
- for (itr = infoMap.constBegin(); itr != infoMap.constEnd(); ++itr) {
- kDebug() << itr.key() << itr.value();
- if (itr.key() == QLatin1String("CFBundleIdentifier")) {
- m_bundleId = itr.value();
- } else if (itr.key() == QLatin1String("CFBundleName")) {
- m_description = itr.value();
- } else if (itr.key() == QLatin1String("CFBundleDisplayName")) {
- m_name = itr.value();
- } else if (itr.key() == QLatin1String("CFBundleVersion")) {
- m_version = itr.value();
- } else if (itr.key() == QLatin1String("CloseBoxInsetX")) {
-
- } else if (itr.key() == QLatin1String("CloseBoxInsetY")) {
-
- } else if (itr.key() == QLatin1String("Height")) {
- m_height = itr.value().toInt();
- } else if (itr.key() == QLatin1String("Width")) {
- m_width = itr.value().toInt();
- } else if (itr.key() == QLatin1String("MainHTML")) {
- m_htmlLocation = QString("%1%2").arg(path()).arg(itr.value());
- addFileDefinition("mainscript", itr.value(), i18n("Main Webpage"));
- } else {
- qDebug()<<"Unrecognized key = "<<itr.key();
- }
- }
- m_iconLocation = QString("%1Icon.png").arg(path());
- kDebug() << path();
- addDirectoryDefinition("root", "/", i18n("Root HTML directory"));
-
- //qDebug()<<"name = "<<m_name;
- //qDebug()<<"id = "<<m_bundleId;
- //qDebug()<<"html = "<<m_htmlLocation;
- //qDebug()<<"icon = "<<m_iconLocation;
-
- return !m_bundleId.isEmpty();
-}
-
-bool Bundle::installPackage(const QString &archivePath, const QString &packageRoot)
-{
- //kDebug() << "??????????????" << archivePath << packageRoot;
- QFile f(archivePath);
- f.open(QIODevice::ReadOnly);
- m_data = f.readAll();
- f.close();
- open();
-
- if (m_isValid) {
- m_tempDir->setAutoRemove(false);
- QString pluginName = "dashboard_" + m_bundleId;
- //kDebug() << "valid, so going to move it in to" << pluginName;
- KIO::CopyJob* job = KIO::move(m_tempDir->name(), QString(packageRoot + pluginName), KIO::HideProgressInfo);
- m_isValid = job->exec();
-
- if (m_isValid) {
- //kDebug() << "still so good ... registering";
- Plasma::PackageMetadata data;
- data.setName(m_name);
- data.setDescription(m_description);
- data.setPluginName(pluginName);
- data.setImplementationApi("dashboard");
- Plasma::Package::registerPackage(data, m_iconLocation);
- }
- }
-
- if (!m_isValid) {
- // make sure we clean up after ourselves afterwards on failure
- m_tempDir->setAutoRemove(true);
- }
-
- return m_isValid;
-}
-
-bool Bundle::parseConfigXml(const QString &loc)
-{
- QFile f(loc);
- if (!f.open(QIODevice::ReadOnly)) {
- qWarning("Couldn't open info file: '%s'", qPrintable(loc));
- return false;
- }
-
- qWarning("FIXME: Widgets 1.0 not implemented");
-
- return false;
-}
-
-void Bundle::initTempDir()
-{
- m_tempDir = new KTempDir();
- //make it explicit
- m_tempDir->setAutoRemove(true);
-}
-
-QString Bundle::bundleId() const
-{
- return m_bundleId;
-}
-
-QString Bundle::name() const
-{
- return m_name;
-}
-
-QString Bundle::version() const
-{
- return m_version;
-}
-
-QString Bundle::description() const
-{
- return m_description;
-}
-
-int Bundle::width() const
-{
- return m_width;
-}
-
-int Bundle::height() const
-{
- return m_height;
-}
-
-QString Bundle::htmlLocation() const
-{
- return m_htmlLocation;
-}
-
-QString Bundle::iconLocation() const
-{
- return m_iconLocation;
-}
-
-bool Bundle::isValid() const
-{
- return m_isValid;
-}
-
-
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#ifndef BUNDLE_H
-#define BUNDLE_H
-
-#include <KZip>
-#include <KTempDir>
-
-#include <Plasma/PackageStructure>
-
-class KArchiveDirectory;
-
-class Bundle : public Plasma::PackageStructure
-{
- Q_OBJECT
-public:
- Bundle(const QString &path);
- Bundle(const QByteArray &data);
- Bundle(QObject *parent, QVariantList args);
- ~Bundle();
-
- bool isValid() const;
-
- void setData(const QByteArray &fn);
- QByteArray data() const;
-
- QString bundleId() const;
- QString name() const;
- QString version() const;
- QString description() const;
- int width() const;
- int height() const;
- QString htmlLocation() const;
- QString iconLocation() const;
-
-protected:
- void pathChanged();
-
-private:
- bool extractArchive(const KArchiveDirectory *dir, const QString &path);
- bool extractInfo();
-
- bool parsePlist(const QString &loc);
- bool parseConfigXml(const QString &loc);
-
- void initTempDir();
-
- bool open();
- bool close();
- bool installPackage(const QString &archivePath, const QString &packageRoot);
-
-private:
- QByteArray m_data;
- bool m_isValid;
- KTempDir *m_tempDir;
-
- QString m_bundleId;
- QString m_name;
- QString m_version;
- QString m_description;
- int m_width;
- int m_height;
- QString m_htmlLocation;
- QString m_iconLocation;
-};
-
-#endif
+++ /dev/null
-/*
- * Copyright 2008 Stefan Buller <hikingpete@cain.afraid.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) version 3, or any
- * later version accepted by the membership of KDE e.V. (or its
- * successor approved by the membership of KDE e.V.), which shall
- * act as a proxy defined in Section 6 of version 3 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-function AppleAnimator(duration, interval, start, finish, handler)
-{
- //properties specified by Apple
- this.duration = duration;
- this.interval = interval;
- this.animations = [];
- this.timer = 0;
- this.oncomplete; //no documentation exists for this.
-
- //internal members:
- this.intervalPointer = undefined;
-
- var that = this;
-
- if (arguments.length === 5) {
- var animation = new AppleAnimation(start, finish, handler);
- that.addAnimation(animation); //I hope I can use this already
- }
-};
-
-AppleAnimator.prototype.addAnimation = function (animation) {
- //I'm unsure what the behaviour of this function should be if
- //AppleAnimator.start() has already been called.
- animation.initialize(this.duration, this.interval);
- this.animations.push(animation);
-};
-
-AppleAnimator.prototype.start = function ()
-{
- if (this.intervalPointer == undefined) {
-
- var that = this; //for the closure (may not be necessary?)
- function intervalHandler() {
- //setInterval doesn't pass 'this', so we need a closure instead.
- that.timer += that.interval;
- if (that.timer > that.duration) {
- that.stop();
- } else {
- for (var i=0; i<that.animations.length; i++) {
- var animation = that.animations[i];
- animation.step();
- animation.callback(animation, animation.now,
- animation.from, animation.to);
- }
- }
- }
-
- this.intervalPointer = setInterval(intervalHandler, this.interval);
- }
-};
-
-AppleAnimator.prototype.stop = function ()
-{
- if (this.intervalPointer != undefined) {
- clearInterval(this.intervalPointer);
- delete this.intervalPointer;
- //Maybe this.timer should be set to 0, and animations re-initialized
- }
-};
-
-function AppleAnimation(start, finish, handler)
-{
- this.from = start;
- this.to = finish;
- this.now = undefined;
- this.callback = handler;
-
- //internal members:
- //prototype.initialize
- //this.step
-};
-
-AppleAnimation.prototype.initialize = function(duration, interval)
-{
- this.now = this.from;
-
- var frac = interval / duration;
- var diff = this.to - this.from; //Oh memory/speed trade-off (premature optimization?)
-
- this.step = function () {
- //This is a closure, and don't forget it.
- this.now += diff * frac;
- }
-};
-
-function AppleRect(left, top, right, bottom)
-{
- this.left = left;
- this.top = top;
- this.right = right;
- this.bottom = bottom;
-};
-
-function AppleRectAnimation(start, finish, handler)
-{
- this.from = start;
- this.to = finish;
- this.now = undefined;
- this.callback = handler;
-};
-
-AppleRectAnimation.prototype.initialize = function(duration, interval)
-{
- this.now = this.from;
-
- var frac = interval / duration;
- var diff = {
- left: this.to.left - this.from.left,
- top: this.to.top - this.from.top,
- right: this.to.right - this.from.right,
- bottom: this.to.bottom - this.from.bottom
- }
-
- this.step = function () {
- //This is a closure, and don't forget it.
- this.now = new AppleRect(this.now.left + frac * diff.left,
- this.now.top + frac * diff.top,
- this.now.right + frac * diff.right,
- this.now.bottom + frac * diff.right)
- }
-};
-
+++ /dev/null
-
-function AppleInfoButton( placeElement, unknown, colorA, colorB, clickHandler){
-
-var b = document.createElement("button");
- b.appendChild(document.createTextNode("i"));
- b.onclick = clickHandler;
- placeElement.appendChild(b);
-
-}
\ No newline at end of file
+++ /dev/null
-/*
- * Copyright 2008 Stefan Buller <hikingpete@cain.afraid.org>
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2.1 of the License, or (at your option) version 3, or any
- * later version accepted by the membership of KDE e.V. (or its
- * successor approved by the membership of KDE e.V.), which shall
- * act as a proxy defined in Section 6 of version 3 of the license.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library. If not, see <http://www.gnu.org/licenses/>.
- */
-
-function AppleScrollArea(content) {
- for (var i = 0; i < arguments.length; i++) {
- this.addScrollbar(arguments[i]);
- }
- var that=this;
- var handler=function(e) {
- switch(e.which) {
- case 37: //left
- that.horizontalScrollTo(that.content.scrollLeft -
- that.singlepressScrollPixels);
- break;
- case 38: //up
- that.verticalScrollTo(that.content.scrollTop -
- that.singlepressScrollPixels);
- break;
- case 39: //right
- that.horizontalScrollTo(that.content.scrollLeft +
- that.singlepressScrollPixels);
- break;
- case 40: //down
- that.verticalScrollTo(that.content.scrollTop +
- that.singlepressScrollPixels);
- break;
- default:
- //the event may contiue to propagate
- return true;
- }
- //arrest propagation
- return false;
- }
- content.addEventListener('keydown',handler,false);
-
- //Apple mandated properties that must be reacted to.
- this.scrollsVertically = false;
- this.scrollsHorizontally = false;
- this.singlepressScrollPixels = 10; //Somebody change this. Please.
-
- //Apple mandated properties that are `read only'.
- this.viewHeight = content.clientHeight;
- this.viewToContentHeightRatio = content.clientHeight / content.scrollHeight;
- this.viewWidth = content.clientWidth;
- this.viewToContentWidthRatio = content.clientWidth / content.scrollWidth;
- //I'm worried that the scrollHeight/Width could change on me. If that turns
- //out to be a problem, then getters would be the way to go.
-
- //extras
- this.scrollbars = [];
- this.content = content;
-}
-
-AppleScrollArea.prototype.addScrollbar = function(scrollbar) {
- this.scrollbars.push(scrollbar);
- scrollbar.setScrollArea(this);
-}
-
-AppleScrollArea.prototype.removeScrollbar = function(scrollbar) {
- this.scrollbars.filter(function(element){return (element === scrollbar);});
- scrollbar.setScrollArea(null); //Just a guess. This might not be right.
-}
-
-AppleScrollArea.prototype.remove = function() {
- //Remove the div, or remove the effects of AppleScrollArea?
- //Perhaps this can all be replaced with a simple removeChild()
- content.scrollTop = 0;
- content.scrollLeft = 0;
- for (var i = 0; i < this.scrollbars.length; i++) {
- this.scrollbars[i].remove();
- delete this.scrollbars[i];
- }
- delete this;
-}
-
-AppleScrollArea.prototype.reveal = function(element) {
- //First we find it
- var distX = 0;
- var distY = 0;
- var el = element;
- while (el !== this.content) {
- distX += (+el.offsetTop);
- distY += (+el.offsetLeft);
- el = el.parentNode;
- if (el == null) {
- throw "Target element not in ScrollArea.";
- }
- }
-
- this.verticalScrollTo(distY);
- this.horizontalScrollTo(distX);
-}
-
-AppleScrollArea.prototype.focus = function() {
- this.content.focus();
-}
-
-AppleScrollArea.prototype.blur = function() {
- this.content.blur();
-}
-
-AppleScrollArea.prototype.verticalScrollTo = function(position) {
- this.scrollTop = position;
-}
-
-AppleScrollArea.prototype.horizontalScrollTo = function(position) {
- this.scrollLeft = position;
-}
-
-
+++ /dev/null
-install(FILES AppleButton.js
- AppleInfoButton.js
- AppleAnimator.js
- AppleScrollArea.js
- AppleScrollbar.js
- AppleSlider.js
- DESTINATION ${DATA_INSTALL_DIR}/plasma/dashboard/AppleClasses/)
+++ /dev/null
-add_subdirectory(button)
-add_subdirectory(AppleClasses)
\ No newline at end of file
+++ /dev/null
-install(FILES genericButton.js
- DESTINATION ${DATA_INSTALL_DIR}/plasma/dashboard/button)
+++ /dev/null
-
-
-function createGenericButton(placeElement,buttonText,clickHandler) {
- var b = document.createElement("button");
- b.appendChild(document.createTextNode(buttonText));
- b.onclick = clickHandler;
- placeElement.appendChild(b);
-}
\ No newline at end of file
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#include "bundle.h"
-
-K_EXPORT_PLASMA_PACKAGESTRUCTURE(dashboard, Bundle)
-
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-Copyright (c) 2008 Beat Wolf <asraniel@fryx.ch>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#include "dashboardapplet.h"
-
-#include <QWebFrame>
-#include <QFile>
-#include <QByteArray>
-
-#include <KGlobal>
-#include <KStandardDirs>
-
-#include <Plasma/WebView>
-#include <Plasma/Applet>
-#include <Plasma/Package>
-
-#include "dashboardjs.h"
-
-DashboardApplet::DashboardApplet(QObject *parent, const QVariantList &args)
- : WebApplet(parent, args)
-{
-}
-
-DashboardApplet::~DashboardApplet()
-{
-}
-
-bool DashboardApplet::init()
-{
- applet()->setAspectRatioMode(Plasma::FixedSize);
- return WebApplet::init();
-}
-
-void DashboardApplet::loadFinished(bool success)
-{
- WebApplet::loadFinished(success);
- if (success) {
- view()->resize(view()->mainFrame()->contentsSize());
- applet()->resize(view()->mainFrame()->contentsSize());
- }
-}
-
-void DashboardApplet::constraintsEvent(Plasma::Constraints constraints)
-{
- if (constraints & Plasma::FormFactorConstraint) {
- applet()->setBackgroundHints(Plasma::Applet::NoBackground);
- }
-}
-
-void DashboardApplet::initJsObjects()
-{
- QWebFrame *frame = qobject_cast<QWebFrame*>(sender());
- Q_ASSERT(frame);
- frame->addToJavaScriptWindowObject(QLatin1String("applet"), this);
- frame->addToJavaScriptWindowObject(QLatin1String("widget"), new DashboardJs(frame, this, applet()));
-}
-
-QByteArray DashboardApplet::dataFor(const QString &str)
-{
- QFile f(str);
- f.open(QIODevice::ReadOnly);
- QByteArray data = f.readAll();
- f.close();
-
- //replace the apple javascript imports with the kde ones
- QString jsBaseDir = KGlobal::dirs()->findResourceDir("data","plasma/dashboard/button/genericButton.js")
- + "plasma/dashboard";
-
- data.replace("file:///System/Library/WidgetResources", jsBaseDir.toUtf8());
- data.replace("/System/Library/WidgetResources", jsBaseDir.toUtf8());
-
- return data;
-}
-
-#include "moc_dashboardapplet.cpp"
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#ifndef SAMPLEITEM_H
-#define SAMPLEITEM_H
-
-#include "webapplet.h"
-#include "bundle.h"
-
-#include "dashboardjs.h"
-
-#include <Plasma/DataEngine>
-
-#include <QtGui/QWidget>
-
-class DashboardApplet : public WebApplet
-{
- Q_OBJECT
-public:
- DashboardApplet(QObject *parent, const QVariantList &args);
- ~DashboardApplet();
-
- bool init();
-
-protected:
- virtual QByteArray dataFor(const QString &str);
-
-protected slots:
- virtual void loadFinished(bool success);
- virtual void initJsObjects();
- virtual void constraintsEvent(Plasma::Constraints constraints);
-};
-
-K_EXPORT_PLASMA_APPLETSCRIPTENGINE(dashboard, DashboardApplet)
-
-#endif
+++ /dev/null
-/*
-Copyright (c) 2008 Beat Wolf <asraniel@fryx.ch>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#include "dashboardjs.h"
-#include <kdebug.h>
-
-#include <KRun>
-#include <KConfigGroup>
-
-#include <QPainter>
-#include <QtGui/qstyleoption.h>
-#include <QWidget>
-
-#include <QGraphicsItem>
-#include <QEvent>
-#include <QGraphicsScene>
-
-DashboardJs::DashboardJs(QWebFrame *frame, QObject *parent, Plasma::Applet *applet)
- : QObject(parent)
-{
- m_applet = applet;
- m_frame = frame;
-}
-
-DashboardJs::~DashboardJs()
-{
- if(m_frame){
- kDebug() << "deconstructor calles javascript: " << m_onremove;
- m_frame->evaluateJavaScript(m_onremove);
- }
-}
-
-void DashboardJs::openApplication(QString name)
-{
- //STUB
- kDebug() << "not implemented: open application" << name;
-
- //WARNING: this might be dangerous and exploited (or not)
- /* create list of applications:
- * com.apple.ical
- * com.RealNetworks.RealPlayer
- */
-}
-
-void DashboardJs::openURL(QString name)
-{
- //TODO: this could be dangerous(really?). filter valid urls
- new KRun(name, 0);
-}
-
-QVariant DashboardJs::preferenceForKey(QString key)
-{
- KConfigGroup conf = m_applet->config();
-
- if (!conf.hasKey(key)) {
- return QVariant();
- }
-
- return conf.readEntry(key,"");
-}
-
-void DashboardJs::prepareForTransition(QString transition)
-{
- //STUB
- kDebug() << "not implemented: transition with name" << transition;
- //TODO:freeze widget drawing. possible?
- //not really needed for things to work, but would be prettier
-}
-
-void DashboardJs::performTransition()
-{
- //STUB
- //TODO: enable widget drawing again, perform nice animation.
- kDebug() << "not implemented: perform transition";
- //not really needed for things to work, but would be prettier
-}
-
-void DashboardJs::setCloseBoxOffset(int x, int y)
-{
- //STUB, not needed, plasma has its own close box
- kDebug() << "not implemented: close box offset" << x << y;
-}
-
-void DashboardJs::setPreferenceForKey(QString value, QString key)
-{
- kDebug() << "save key" << key << value;
- KConfigGroup conf = m_applet->config();
- conf.writeEntry(key, value);
-}
-
-void DashboardJs::system(QString command, QString handler)
-{
- //WARNING: this might be dangerous and exploited.
- //STUB
- kDebug() << "not implemented: system command:" << command << handler;
-}
-
-//Property sets and gets
-QString DashboardJs::identifier() const
-{
- return QString::number(m_applet->id());
-}
-
-QString DashboardJs::onshow() const
-{
- return m_onshow;
-}
-
-void DashboardJs::setOnshow(const QString &value)
-{
- m_onshow = value;
-}
-
-QString DashboardJs::onhide() const
-{
- return m_onhide;
-}
-
-void DashboardJs::setOnhide(const QString &value)
-{
- m_onhide = value;
-}
-
-QString DashboardJs::onremove() const
-{
- return m_onremove;
-}
-
-void DashboardJs::setOnremove(const QString &value)
-{
- m_onremove = value;
-}
-
-
-QString DashboardJs::ondragstart() const
-{
- return m_ondragstart;
-}
-
-void DashboardJs::setOndragstart(const QString &value)
-{
- m_ondragstart = value;
-}
-
-QString DashboardJs::ondragstop() const
-{
- return m_ondragstop;
-}
-
-void DashboardJs::setOndragstop(const QString &value)
-{
- m_ondragstop = value;
-}
-//only for testing purpose
-//TODO: remove when not needed anymore
-void DashboardJs::hello(int test)
-{
- kDebug() << "hello world" << test;
-}
-
+++ /dev/null
-/*
-Copyright (c) 2008 Beat Wolf <asraniel@fryx.ch>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-
-#ifndef DASHBOARDJS_H
-#define DASHBOARDJS_H
-
-#include <QObject>
-#include <QVariant>
-#include <QGraphicsItem>
-
-#include <QWebFrame>
-
-#include <Plasma/Applet>
-
-/**
- * Implements the Mac OS X Dashboard widget javascript functions.
- * This document was used to create this class:
- * http://developer.apple.com/documentation/AppleApplications/Reference/Dashboard_Ref/Dashboard_Ref.pdf
- */
-class DashboardJs : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QString identifier READ identifier)
-
- Q_PROPERTY(QString onshow READ onshow WRITE setOnshow)
- Q_PROPERTY(QString onhide READ onhide WRITE setOnhide)
- Q_PROPERTY(QString onremove READ onremove WRITE setOnremove)
- Q_PROPERTY(QString ondragstart READ ondragstart WRITE setOndragstart)
- Q_PROPERTY(QString ondragstop READ ondragstop WRITE setOndragstop)
-
-public:
- DashboardJs(QWebFrame *frame, QObject *parent= 0, Plasma::Applet *applet = 0);
- ~DashboardJs();
-
- QString identifier() const;
-
- QString onshow() const;
- void setOnshow(const QString &onshow);
-
- QString onhide() const;
- void setOnhide(const QString &onhide);
-
- QString onremove() const;
- void setOnremove(const QString &onremove);
-
- QString ondragstart() const;
- void setOndragstart(const QString &ondragstart);
-
- QString ondragstop() const;
- void setOndragstop(const QString &ondragstop);
-
-public slots:
- void hello(int test);
-
- /**
- * opens a certain application
- */
- void openApplication(QString name);
-
- /**
- * opens a URL. Does not open file urls by default.
- * TODO: find out what protocols dashboard widgets support. filter out the others
- */
- void openURL(QString name); //ok
-
- /**
- * Returns the value associated with a certain key
- */
- QVariant preferenceForKey(QString key); //ok
-
- void prepareForTransition(QString transition);
-
- void performTransition();
-
- void setCloseBoxOffset(int x, int y); //not needed
-
- /**
- * Saves a value to a key
- */
- void setPreferenceForKey(QString value, QString key); //ok
-
- void system(QString command, QString handler); //cannot really be implemented
-private:
- //TODO: execute when needed
- QString m_onshow; //has no equivalent in plasma, because always shown
- QString m_onhide; //has no equivalent in plasma, because always shown
- QString m_onremove; //ok
-
- QString m_ondragstart;
- QString m_ondragstop;
-
- //my private stuff
- Plasma::Applet *m_applet;
- QWebFrame *m_frame;
-};
-
-#endif
+++ /dev/null
-[Desktop Entry]
-Name=MacOS Dashboard Widgets
-Name[ar]=ودجات لوحة MacOS
-Name[ast]=Elementos gráficos del tableru de mandos de MacOS
-Name[be@latin]=Widžety „Dashboard” dla systemy „MacOS”
-Name[bg]=Джаджи за табло на MacOS
-Name[bs]=Grafičke kontrole instrument-table MacOS‑a
-Name[ca]=Estri del tauler del MacOS
-Name[ca@valencia]=Estri del tauler del MacOS
-Name[cs]=Widgety palubní desky MacOS
-Name[da]=MacOS dashboard-widgets
-Name[de]=MacOS-Dashboard-Miniprogramme
-Name[el]=Συστατικά του MacOS dashboard
-Name[en_GB]=MacOS Dashboard Widgets
-Name[eo]=MacOS stirtabla fenestraĵo
-Name[es]=Elementos gráficos del tablero de mandos de MacOS
-Name[et]=MacOS-i vidinavaate vidinad
-Name[eu]=MacOS-ren aginte-mahaiko trepetak
-Name[fi]=MacOS-kojelautasovelmat
-Name[fr]=Composants graphiques du panneau de contrôle de MacOS
-Name[fy]=MacOS Dashboard Widgets
-Name[ga]=Giuirléidí Dashboard MacOS
-Name[gl]=Widget do Dashboard de MacOS
-Name[gu]=MacOS ડેશબોર્ડ વિજેટ
-Name[he]=ווידג׳טים של MacOS Dashboard
-Name[hi]=मैकओएस डैशबोर्ड विजेट
-Name[hne]=मेकओएस डेसबोर्ड विजेट
-Name[hr]=MacOS widgeti nadzorne ploče
-Name[hu]=MacOS Dashboard-elem
-Name[ia]=MacOS Dashboard Widgets
-Name[id]=Widget Dasbor MacOS
-Name[is]=MacOS dashboard græjur
-Name[ja]=MacOS ダッシュボードウィジェット
-Name[kk]=MacOS аспаптар панелі
-Name[km]=ធាតុក្រាហ្វិកផ្ទាំងគ្រប់គ្រង MacOS
-Name[kn]=MacOS ಯಂತ್ರೋಪಕರಣ ಪಟ್ಟಿ (ಡ್ಯಾಶ್ಬೋರ್ಡ್) ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟಗಳು (ವಿಡ್ಗೆಟ್)
-Name[ko]=MacOS 대시보드 위젯
-Name[ku]=Alavên Panela Kontrolê yên MacOS
-Name[lt]=MacOS prietaisų skydelio valdikliai
-Name[lv]=MacOS dashboard sīkrīki
-Name[ml]=മാക് ഓഎസ് ഡാഷ്ബോര്ഡ് ഉരുപ്പടികള്
-Name[mr]=MacOS डॅशबोर्ड विजेट
-Name[nb]=Kontrollpult-elementer for MacOS
-Name[nds]=MacOs-Klockpaneel-Lüttprogrammen
-Name[nl]=MacOS Dashboard Widgets
-Name[nn]=MacOS-kontrollpultelement
-Name[or]=MacOS ଡ୍ୟାସବୋର୍ଡ ୱିଜେଟଗୁଡ଼ିକ
-Name[pa]=MacOS ਡੈਸ਼ਬੋਰਡ ਵਿਦਜੈੱਟ
-Name[pl]=Element interfejsu na tablicy z MacOS
-Name[pt]=Elementos do Painel do MacOS
-Name[pt_BR]=Widgets do painel do MacOS
-Name[ro]=Controale ale tabloului de bord MacOS
-Name[ru]=Виджеты Mac OS
-Name[si]=MacOS Dashboard Widgets
-Name[sk]=MacOS Dashboard widgety
-Name[sl]=Gradniki za Mac OS Dashboard
-Name[sr]=виџети инструмент-табле МекОС‑а
-Name[sr@ijekavian]=виџети инструмент-табле МекОС‑а
-Name[sr@ijekavianlatin]=vidžeti instrument-table MacOS‑a
-Name[sr@latin]=vidžeti instrument-table MacOS‑a
-Name[sv]=Grafiska komponenter för MacOS instrumentpanel
-Name[ta]=MacOS Dashboard Widgets
-Name[tg]=Илова ба панели MacOS
-Name[th]=วิดเจ็ตของแดชบอร์ด MacOS
-Name[tr]=MacOS Kontrol Paneli Gereçleri
-Name[ug]=MacOS تىزگىن تاختا ۋىجېتلىرى
-Name[uk]=Віджети панелі приладів MacOS
-Name[vi]=Widget bảng thông tin MacOS
-Name[wa]=Ahesses Dashboard MacOS
-Name[x-test]=xxMacOS Dashboard Widgetsxx
-Name[zh_CN]=MacOS 部件板部件
-Name[zh_TW]=MacOS 資訊看板元件
-Comment=MacOS dashboard widget
-Comment[ar]=ودجة لوحة MacOS
-Comment[ast]=Elementu gráficu del tableru de mandos de MacOS
-Comment[be@latin]=Widžet „Dashboard” dla systemy „MacOS”
-Comment[bg]=Джаджа за табло на MacOS
-Comment[bs]=Grafičke kontrola instrument-table kao u MacOS‑u
-Comment[ca]=Estri del tauler del MacOS
-Comment[ca@valencia]=Estri del tauler del MacOS
-Comment[cs]=Widget palubní desky MacOS
-Comment[da]=MacOS dashboard-widget
-Comment[de]=MacOS-Dashboard-Miniprogramm
-Comment[el]=Συστατικό του MacOS dashboard
-Comment[en_GB]=MacOS dashboard widget
-Comment[eo]=MacOS stirtabla fenestraĵo
-Comment[es]=Elemento gráfico del tablero de mandos de MacOS
-Comment[et]=MacOS-i vidinavaate vidin
-Comment[eu]=MacOS-ren aginte-mahaiko trepeta
-Comment[fi]=MacOS-kojelautasovelma
-Comment[fr]=Composant graphique du panneau de contrôle de MacOS
-Comment[fy]=MacOS dashboard widget
-Comment[ga]=Giuirléid Dashboard MacOS
-Comment[gl]=Widget do dashboard de MacOS
-Comment[gu]=MacOS ડેશબોર્ડ વિજેટ
-Comment[he]=ווידג׳ט של MacOS dashboard
-Comment[hi]=मैकओएस डैशबोर्ड विजेट
-Comment[hne]=मेकओएस डेसबोर्ड विजेट
-Comment[hr]=MacOS widget nadzorne ploče
-Comment[hu]=MacOS Dashboard-elem
-Comment[ia]=Widget de pannello de instrumentos de MacOS
-Comment[id]=Widget dasbor MacOS
-Comment[is]=MacOS dashboard græja
-Comment[ja]=MacOS ダッシュボードウィジェット
-Comment[kk]=MacOS аспаптар панелі
-Comment[km]=ធាតុក្រាហ្វិកផ្ទាំងគ្រប់គ្រងរបស់ MacOS
-Comment[kn]=MacOS ಯಂತ್ರೋಪಕರಣ ಪಟ್ಟಿ (ಡಾಶ್ ಬೋರ್ಡ್) ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Comment[ko]=MacOS 대시보드 위젯
-Comment[ku]=Amûrê MacOS dashboardê
-Comment[lt]=MacOS prietaisų skydelio valdiklis
-Comment[lv]=MacOS dashboard skrīks
-Comment[ml]=മാക് ഓഎസ് ഡാഷ്ബോര്ഡ് ഉരുപ്പടി
-Comment[mr]=MacOS डॅशबोर्ड विजेट
-Comment[nb]=Kontrollpult-element for MacOS
-Comment[nds]=MacOs-Klockpaneel
-Comment[nl]=MacOS-dashboard-widget
-Comment[nn]=MacOS-kontrollpultelement
-Comment[or]=MacOS ଡ୍ୟାସବୋର୍ଡ ୱିଜେଟ
-Comment[pa]=MacOS ਡੈਸ਼ਬੋਰਡ ਵਿਦਜੈੱਟ
-Comment[pl]=Element interfejsu przypominający tablicę z MacOS
-Comment[pt]=Elemento do Painel do MacOS
-Comment[pt_BR]=Widget do painel do MacOS
-Comment[ro]=Control al tabloului de bord MacOS
-Comment[ru]=Виджет Mac OS
-Comment[si]=MacOS dashboard widget
-Comment[sk]=MacOS dashboard widget
-Comment[sl]=Gradnik za Mac OS Dashboard
-Comment[sr]=Виџет инструмент-табле као у МекОС‑у
-Comment[sr@ijekavian]=Виџет инструмент-табле као у МекОС‑у
-Comment[sr@ijekavianlatin]=Vidžet instrument-table kao u MacOS‑u
-Comment[sr@latin]=Vidžet instrument-table kao u MacOS‑u
-Comment[sv]=Grafisk komponent för MacOS instrumentpanel
-Comment[ta]=MacOS dashboard widget
-Comment[te]=MacOS డాష్బోర్డ్ విడ్జట్
-Comment[tg]=Илова ба панели MacOS
-Comment[th]=วิดเจ็ตของแดชบอร์ด MacOS
-Comment[tr]=MacOS kontrol paneli gereci
-Comment[ug]=MacOS تىزگىن تاختا ۋىجېتى
-Comment[uk]=Віджет панелі приладів MacOS
-Comment[vi]=Widget bảng thông tin MacOS
-Comment[wa]=Ahesse do tåvlea d' boird dashboard di MacOS
-Comment[x-test]=xxMacOS dashboard widgetxx
-Comment[zh_CN]=MacOS 部件板
-Comment[zh_TW]=MacOS 資訊看板元件
-Type=Service
-ServiceTypes=Plasma/PackageStructure
-
-X-KDE-Library=plasma_packagestructure_dashboard
-X-KDE-PluginInfo-Author=Zack Rusin
-X-KDE-PluginInfo-Email=zackr@kde.org
-X-KDE-PluginInfo-Name=dashboard
-X-KDE-PluginInfo-Version=pre0.1
-X-KDE-PluginInfo-Website=http://plasma.kde.org/
-X-KDE-PluginInfo-Category=Applet
-X-KDE-PluginInfo-Depends=
-X-KDE-PluginInfo-License=BSD
-X-KDE-PluginInfo-EnabledByDefault=true
-X-Plasma-PackageFileFilter=*
-X-Plasma-PackageFileMimetypes=application/zip
+++ /dev/null
-[Desktop Entry]
-Name=Web Widgets
-Name[ar]=ودجات الوِب
-Name[ast]=Elementos gráficos Web
-Name[be@latin]=Sieciŭnyja widžety
-Name[bg]=Уеб джаджи
-Name[bn]=ওয়েব উইজেট
-Name[bn_IN]=ওয়েব উইজেট
-Name[bs]=Web grafičke kontrola
-Name[ca]=Estris web
-Name[ca@valencia]=Estris web
-Name[cs]=Webové widgety
-Name[csb]=Interfejs sécë Web
-Name[da]=Web-widgets
-Name[de]=Web-Miniprogramme
-Name[el]=Συστατικά ιστού
-Name[en_GB]=Web Widgets
-Name[eo]=Reta fenestraĵo
-Name[es]=Elementos gráficos Web
-Name[et]=Veebividinad
-Name[eu]=Web-trepetak
-Name[fi]=Web-sovelmat
-Name[fr]=Composants graphiques Web
-Name[fy]=Web Widgets
-Name[ga]=Giuirléidí Gréasáin
-Name[gl]=Widgets web
-Name[gu]=વેબ વિજેટ્સ
-Name[he]=ווידג׳טים אינטרנטיים
-Name[hi]=वेब विजेट
-Name[hne]=वेब विजेट
-Name[hr]=Web widgeti
-Name[hu]=Webes elem
-Name[ia]=Web Widgets
-Name[id]=Widget Web
-Name[is]=Vefgræjur
-Name[ja]=ウェブウィジェット
-Name[kk]=Веб интерфейс бөлшегі
-Name[km]=ធាតុក្រាហ្វិកបណ្ដាញ
-Name[kn]=ಜಾಲ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟಗಳು (ವಿಡ್ಗೆಟ್)
-Name[ko]=웹 위젯
-Name[ku]=Alavên Torê
-Name[lt]=Žiniatinklio valdikliai
-Name[lv]=Tīmekļa sīkrīki
-Name[ml]=വെബ് ഉരുപ്പടികള്
-Name[mr]=वेब विजेट
-Name[nb]=Nett-elementer
-Name[nds]=Nett-Lüttprogrammen
-Name[nl]=Web Widgets
-Name[nn]=Vevelement
-Name[or]=ୱେବ ୱିଜେଟଗୁଡ଼ିକ
-Name[pa]=ਵੈੱਬ ਵਿਦਜੈੱਟ
-Name[pl]=Strona sieci Web (element interfejsu)
-Name[pt]=Elementos Web
-Name[pt_BR]=Widgets da Internet
-Name[ro]=Controale WEB
-Name[ru]=Веб-виджеты
-Name[si]=වෙබ් මෙවලම්
-Name[sk]=Webové widgety
-Name[sl]=Spletni gradniki
-Name[sr]=веб виџети
-Name[sr@ijekavian]=веб виџети
-Name[sr@ijekavianlatin]=veb vidžeti
-Name[sr@latin]=veb vidžeti
-Name[sv]=Grafiska webbkomponenter
-Name[ta]=Web Widgets
-Name[tg]=Иловагиҳо ба Интернет
-Name[th]=วิดเจ็ตแบบเว็บ
-Name[tr]=Web Gereçleri
-Name[ug]=تور بەت Widget
-Name[uk]=Віджети Тенет
-Name[wa]=Ahesses waibe
-Name[x-test]=xxWeb Widgetsxx
-Name[zh_CN]=网页部件
-Name[zh_TW]=網頁元件
-Comment=HTML widget
-Comment[ar]=ودجة HTML
-Comment[ast]=Elementu gráficu HTML
-Comment[be@latin]=Widžet HTML
-Comment[bg]=HTML джаджи
-Comment[bn]=HTML উইজেট
-Comment[bn_IN]=HTML উইজেট
-Comment[bs]=HTML grafička kontrola
-Comment[ca]=Estri HTML
-Comment[ca@valencia]=Estri HTML
-Comment[cs]=HTML widget
-Comment[csb]=Interfejs HTML
-Comment[da]=HTML-widget
-Comment[de]=HTML-Miniprogramme
-Comment[el]=Συστατικό HTML
-Comment[en_GB]=HTML widget
-Comment[eo]=HTML-fenestraĵo
-Comment[es]=Elemento gráfico HTML
-Comment[et]=HTML-vidin
-Comment[eu]=HTML trepeta
-Comment[fi]=HTML-sovelma
-Comment[fr]=Composant graphique HTML
-Comment[fy]=HTML widget
-Comment[ga]=Giuirléid HTML
-Comment[gl]=Widget HTML
-Comment[gu]=HTML વિજેટ
-Comment[he]=ווידג׳ט HTML
-Comment[hi]=एचटीएमएल विज़ेट
-Comment[hne]=एचटीएमएल विजेट
-Comment[hr]=HTML widget
-Comment[hu]=HTML-elem
-Comment[ia]=widget HTML
-Comment[id]=Widget HTML
-Comment[is]=HTML græja
-Comment[ja]=HTML ウィジェット
-Comment[kk]=HTML интерфейс бөлшегі
-Comment[km]=ធាតុក្រាហ្វិក HTML
-Comment[kn]=HTML ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Comment[ko]=HTML 위젯
-Comment[ku]=Alava HTML
-Comment[lt]=HTML valdiklis
-Comment[lv]=HTML sīkrīks
-Comment[ml]=എച്ച്ടിഎംഎല് ഉരുപ്പടി
-Comment[mr]=HTML विजेट
-Comment[nb]=HTML-element
-Comment[nds]=HTML-Lüttprogramm
-Comment[nl]=HTML-widget
-Comment[nn]=HTML-element
-Comment[or]=HTML ୱିଜେଟ
-Comment[pa]=HTML ਵਿਦਜੈੱਟ
-Comment[pl]=Element interfejsu będący stroną w HTML-u
-Comment[pt]=Elemento HTML
-Comment[pt_BR]=Widget HTML
-Comment[ro]=Control HTML
-Comment[ru]=Виджет на HTML
-Comment[si]=HTML මෙවලම්
-Comment[sk]=HTML widget
-Comment[sl]=Gradnik HTML
-Comment[sr]=ХТМЛ виџет
-Comment[sr@ijekavian]=ХТМЛ виџет
-Comment[sr@ijekavianlatin]=HTML vidžet
-Comment[sr@latin]=HTML vidžet
-Comment[sv]=Grafisk HTML-komponent
-Comment[ta]=HTML widget
-Comment[tg]=Илова ба HTML
-Comment[th]=วิดเจ็ตแบบ HTML
-Comment[tr]=HTML parçacığı
-Comment[ug]=HTML widget
-Comment[uk]=Віджет HTML
-Comment[vi]=Widget HTML
-Comment[wa]=Ahesse HTML
-Comment[x-test]=xxHTML widgetxx
-Comment[zh_CN]=HTML 部件
-Comment[zh_TW]=HTML 元件
-Type=Service
-ServiceTypes=Plasma/PackageStructure
-
-X-KDE-Library=plasma_packagestructure_web
-X-KDE-PluginInfo-Author=Petri Damstén
-X-KDE-PluginInfo-Email=damu@iki.fi
-X-KDE-PluginInfo-Name=webkit
-X-KDE-PluginInfo-Version=pre0.1
-X-KDE-PluginInfo-Website=http://plasma.kde.org/
-X-KDE-PluginInfo-Category=Applet
-X-KDE-PluginInfo-Depends=
-X-KDE-PluginInfo-License=BSD
-X-KDE-PluginInfo-EnabledByDefault=true
-X-Plasma-PackageFileFilter=*
-X-Plasma-PackageFileMimetypes=application/zip
+++ /dev/null
-[Desktop Entry]
-Name=Dashboard
-Name[ar]=لوحة الودجات
-Name[ast]=Tableru de mandos
-Name[be@latin]=Dashboard
-Name[bg]=Табло
-Name[bn]=ড্যাশবোর্ড
-Name[bn_IN]=Dashboard
-Name[bs]=instrument-tabla
-Name[ca]=Tauler
-Name[ca@valencia]=Tauler
-Name[cs]=Dashboard
-Name[csb]=Panel
-Name[da]=Instrumentbræt
-Name[de]=Dashboard
-Name[el]=Πίνακας συστατικών
-Name[en_GB]=Dashboard
-Name[eo]=Stirtablo
-Name[es]=Tablero de mandos
-Name[et]=Vidinavaade
-Name[eu]=Agente-mahaia
-Name[fi]=Kojelauta
-Name[fr]=Panneau de contrôle
-Name[fy]=Dashboard
-Name[ga]=Dashboard
-Name[gl]=Cadro de control
-Name[gu]=ડેશબોર્ડ
-Name[he]=מכתבה
-Name[hi]=डैशबोर्ड
-Name[hne]=डेशबोर्ड
-Name[hr]=Nadzorna ploča
-Name[hu]=Dashboard
-Name[ia]=Pannello de instrumentos
-Name[id]=Dasbor
-Name[is]=Dashboard
-Name[it]=Dashboard
-Name[ja]=ダッシュボード
-Name[kk]=Аспаптар панелі
-Name[km]=ផ្ទាំងគ្រប់គ្រង
-Name[kn]=ಯಂತ್ರೋಪಕರಣ ಪಟ್ಟಿ (ಡಾಶ್ ಬೋರ್ಡ್)
-Name[ko]=대시보드
-Name[ku]=Panela Kontrolê
-Name[lt]=Prietaisų skydelis
-Name[lv]=Dashboard
-Name[ml]=ഡാഷ്ബോര്ഡ്
-Name[mr]=डॅशबोर्ड
-Name[nb]=Kontrollpult
-Name[nds]=Klockpaneel
-Name[nl]=Dashboard
-Name[nn]=Kontrollpult
-Name[or]=ଡ୍ୟାସବୋର୍ଡ
-Name[pa]=ਡੈਸ਼ਬੋਰਡ
-Name[pl]=Tablica
-Name[pt]=Dashboard
-Name[pt_BR]=Painel
-Name[ro]=Tablou de bord
-Name[ru]=Приборная доска
-Name[si]=පාලක පුරුව
-Name[sk]=Nástenka
-Name[sl]=Nadzorna plošča
-Name[sr]=инструмент-табла
-Name[sr@ijekavian]=инструмент-табла
-Name[sr@ijekavianlatin]=instrument-tabla
-Name[sr@latin]=instrument-tabla
-Name[sv]=Instrumentpanel
-Name[ta]= எக்ஸ்போர்டு
-Name[te]=డాష్బోర్డ్
-Name[tg]=Панели иловагиҳо
-Name[th]=แดชบอร์ด
-Name[tr]=Kontrol Paneli
-Name[ug]=باشقۇرۇش بېتى
-Name[uk]=Панель приладів
-Name[vi]=Bảng thông tin
-Name[wa]=Tåvlea d' boird
-Name[x-test]=xxDashboardxx
-Name[zh_CN]=部件板
-Name[zh_TW]=資訊看板
-Comment=MacOS X dashboard widget
-Comment[ar]=ودجة لوحة MacOS
-Comment[ast]=Elementu gráficu del tableru de mandos de MacOS X
-Comment[be@latin]=Widžet „Dashboard” systemy „MacOS X”.
-Comment[bg]=Джаджа за табло на MacOS X
-Comment[bs]=Grafička kontrola instrument-table MacOS‑a X
-Comment[ca]=Estri del tauler del MacOS X
-Comment[ca@valencia]=Estri del tauler del MacOS X
-Comment[cs]=Widget palubní desky MacOS
-Comment[da]=MacOS X dashboard-widget
-Comment[de]=MacOS-X-Dashboard-Miniprogramm
-Comment[el]=Συστατικό MacOS X dashboard
-Comment[en_GB]=MacOS X dashboard widget
-Comment[eo]=MacOS X stirtabla fenestraĵo
-Comment[es]=Elemento gráfico del tablero de mandos de MacOS X
-Comment[et]=MacOS X vidinavaate vidin
-Comment[eu]=MacOS X-ren aginte-mahaiko trepeta
-Comment[fi]=MacOS X -kojelautasovelma
-Comment[fr]=Composant graphique du panneau de contrôle de MacOS X
-Comment[fy]=MacOS X dashboard widget
-Comment[ga]=Giuirléid Dashboard MacOS X
-Comment[gl]=Widget do dashboard de MacOS X
-Comment[gu]=MacOS X ડેશબોર્ડ વિજેટ
-Comment[he]=ווידג׳טים של MacOS X dashboard
-Comment[hi]=मैकओएस X डैशबोर्ड विजेट
-Comment[hne]=मेकओएस X डेसबोर्ड विजेट
-Comment[hr]=MacOS X nadzorna ploča za widgete
-Comment[hu]=MacOS X Dashboard-elem
-Comment[ia]=Widget de pannello de instrumentos de MacOS X
-Comment[id]=Widget dasbor MacOS X
-Comment[is]=MacOS X dashboard græja
-Comment[ja]=MacOS X ダッシュボードウィジェット
-Comment[kk]=MacOS X аспаптар панелі
-Comment[km]=ធាតុក្រាហ្វិកផ្ទាំងគ្រប់គ្រងរបស់ MacOS
-Comment[kn]=MacOS X ಯಂತ್ರೋಪಕರಣ ಪಟ್ಟಿ (ಡಾಶ್ ಬೋರ್ಡ್) ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Comment[ko]=Mac OS X 대시보드 위젯
-Comment[ku]=Amûrê MacOS X dashboardê
-Comment[lt]=MacOS X prietaisų skydelio valdiklis
-Comment[lv]=MacOS X dashboard sīkrīks
-Comment[ml]=മാക് ഓഎസ് എക്സ് ഡാഷ്ബോര്ഡ് ഉരുപ്പടി
-Comment[mr]=MacOS X डॅशबोर्ड विजेट
-Comment[nb]=MacOS X kontrollpult-element
-Comment[nds]=MacOs-X-Klockpaneel
-Comment[nl]=MacOS X-dashboard-widget
-Comment[nn]=MacOS X-kontrollpultelement
-Comment[or]=MacOS X ଡ୍ୟାସବୋର୍ଡ ୱିଜେଟ
-Comment[pa]=MacOS X ਡੈਸ਼ਬੋਰਡ ਵਿਦਜੈੱਟ
-Comment[pl]=Element interfejsu przypominający tablicę z MacOS X
-Comment[pt]=Elemento gráfico do painel do MacOS X
-Comment[pt_BR]=Widget do painel do MacOS X
-Comment[ro]=Control al tabloului de bord MacOS X
-Comment[ru]=Виджет Mac OS X
-Comment[si]=MacOS X dashboard widget
-Comment[sk]=MacOS X dashboard widget
-Comment[sl]=Gradnik za Mac OS X Dashboard
-Comment[sr]=Виџет инструмент-табле МекОС‑а X
-Comment[sr@ijekavian]=Виџет инструмент-табле МекОС‑а X
-Comment[sr@ijekavianlatin]=Vidžet instrument-table MacOS‑a X
-Comment[sr@latin]=Vidžet instrument-table MacOS‑a X
-Comment[sv]=Grafisk komponent för MacOS X instrumentpanel
-Comment[ta]=MacOS X dashboard widget
-Comment[te]=MacOS X డాష్బోర్డ్ విడ్జట్
-Comment[tg]=Илова ба панели MacOS X
-Comment[th]=วิดเจ็ตของแดชบอร์ด MacOS X
-Comment[tr]=MacOS X kontrol paneli programcığı
-Comment[ug]=MacOS X تىزگىن تاختا ۋىجېتى
-Comment[uk]=Віджет панелі приладів MacOS X
-Comment[vi]=Widget bảng thông tin MacOS X
-Comment[wa]=Ahesse do tåvlea d' boird dashboard di MacOS X
-Comment[x-test]=xxMacOS X dashboard widgetxx
-Comment[zh_CN]=MacOS X 部件板
-Comment[zh_TW]=MacOS X 資訊看板元件
-Type=Service
-ServiceTypes=Plasma/ScriptEngine
-Icon=internet-web-browser
-
-X-KDE-Library=plasma_appletscriptengine_dashboard
-X-KDE-PluginInfo-Author=Zack Rusin
-X-KDE-PluginInfo-Email=zackr@kde.org
-X-KDE-PluginInfo-Name=dashboard
-X-KDE-PluginInfo-Version=pre0.1
-X-KDE-PluginInfo-Website=http://plasma.kde.org/
-X-KDE-PluginInfo-Category=Applet
-X-KDE-PluginInfo-Depends=
-X-KDE-PluginInfo-License=BSD
-X-KDE-PluginInfo-EnabledByDefault=true
-X-Plasma-ComponentTypes=Applet
-X-Plasma-API=dashboard
-X-Plasma-PackageFormat=dashboard
+++ /dev/null
-[Desktop Entry]
-Name=Web Widget
-Name[ar]=ودجة وِب
-Name[ast]=Elementu gráficu Web
-Name[be@latin]=Sieciŭny widžet
-Name[bg]=Уеб джаджа
-Name[bn]=ওয়েব উইজেট
-Name[bn_IN]=ওয়েব উইজেট
-Name[bs]=Web grafička kontrola
-Name[ca]=Estri web
-Name[ca@valencia]=Estri web
-Name[cs]=Webový widget
-Name[csb]=Sztél zblëżający bedënk do sécë Web
-Name[da]=Webwidget
-Name[de]=Web-Miniprogramm
-Name[el]=Συστατικό ιστού
-Name[en_GB]=Web Widget
-Name[eo]=Reta fenestraĵo
-Name[es]=Elemento gráfico Web
-Name[et]=Veebividin
-Name[eu]=Web-trepeta
-Name[fi]=Web-sovelma
-Name[fr]=Composant graphique Web
-Name[fy]=Web Widget
-Name[ga]=Giuirléid Ghréasáin
-Name[gl]=Widget web
-Name[gu]=વેબ વિજેટ
-Name[he]=ווידג׳ט אינטרנט
-Name[hi]=वेब विज़ेट
-Name[hne]=वेब विजेट
-Name[hr]=Web widget
-Name[hu]=Webes elem
-Name[ia]=Web Widget
-Name[id]=Widget Web
-Name[is]=Vefgræja
-Name[ja]=ウェブウィジェット
-Name[kk]=Веб интерфейс бөлшегі
-Name[km]=ធាតុក្រាហ្វិកបណ្ដាញ
-Name[kn]=ಜಾಲ ನಿಯಂತ್ರಣಾ ಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Name[ko]=웹 위젯
-Name[ku]=Alava Torê
-Name[lt]=Žiniatinklio valdiklis
-Name[lv]=Tīmekļa sīkrīks
-Name[ml]=വെബ് ഉരുപ്പടി
-Name[mr]=वेब विजेट
-Name[nb]=Nett-element
-Name[nds]=Nett-Lüttprogramm
-Name[nl]=Web-widget
-Name[nn]=Vevelement
-Name[or]=ୱେବ ୱିଜେଟ
-Name[pa]=ਵੈੱਬ ਵਿਦਜੈੱਟ
-Name[pl]=Strona sieci Web (element interfejsu)
-Name[pt]=Elemento Web
-Name[pt_BR]=Widget da Internet
-Name[ro]=Control WEB
-Name[ru]=Веб-виджет
-Name[si]=වෙබ් මෙවලම්
-Name[sk]=Webový widget
-Name[sl]=Spletni gradnik
-Name[sr]=веб виџет
-Name[sr@ijekavian]=веб виџет
-Name[sr@ijekavianlatin]=veb vidžet
-Name[sr@latin]=veb vidžet
-Name[sv]=Webbkomponent
-Name[ta]=Web Widget
-Name[te]=వెబ్ విడ్జట్
-Name[tg]=Илова ба Интернет
-Name[th]=วิดเจ็ตแบบเว็บ
-Name[tr]=Web Programcığı
-Name[ug]=تور بەت Widget
-Name[uk]=Віджет тенет
-Name[wa]=Ahesse waibe
-Name[x-test]=xxWeb Widgetxx
-Name[zh_CN]=网页部件
-Name[zh_TW]=網頁元件
-Comment=Webpage widget using HTML and JavaScript
-Comment[ar]=صفحة وِب باستخدام HTML وجافا سكربت
-Comment[ast]=Elementu gráficu de páxina web qu'usa HTML y JavaScript
-Comment[be@latin]=Widžet z staronkaj u farmacie „HTML” i z skryptami „JavaScript”.
-Comment[bg]=Джаджа за уеб страници (HTML и JavaScript)
-Comment[bs]=Grafička kontrola web stranice sa HTML‑om i JavaScriptom
-Comment[ca]=Estri per a pàgines web que usa HTML i JavaScript
-Comment[ca@valencia]=Estri per a pàgines web que usa HTML i JavaScript
-Comment[cs]=Widget webové stránky s HTML a JS
-Comment[da]=Hjemmeside-widget som bruger HTML og JavaScript
-Comment[de]=Webseiten-Miniprogramm (verwendet HTML und JavaScript)
-Comment[el]=Συστατικό ιστοσελίδας με χρήση HTML και JavaScript
-Comment[en_GB]=Webpage widget using HTML and JavaScript
-Comment[eo]=Reta fenestraĵo kiu uzas HTML-on kaj Ĝavoskripton
-Comment[es]=Elemento gráfico de página web que usa HTML y JavaScript
-Comment[et]=HTML-i ja JavaScripti kasutav veebilehekülje vidin
-Comment[eu]=HTML eta JavaScript erabiltzen dituen web-orriko trepeta
-Comment[fi]=HTML:ää ja JavaScriptiä käyttävä verkkosivusovelma
-Comment[fr]=Composant graphique de page Web utilisant HTML et JavaScript
-Comment[fy]=Webside widget brûkend HTML en JavaSkript
-Comment[ga]=Giuirléid Ghréasáin a úsáideann HTML agus JavaScript
-Comment[gl]=Widget de páxina web que emprega HTML e JavaScript
-Comment[gu]=HTML અને જાવાસ્ક્રિપ્ટ ઉપયોગ કરીને વેબપાનું વિજેટ
-Comment[he]=ווידג׳ט עמוד אינטרנט העושה שימוש ב־HTML וב־JavaScript
-Comment[hi]=एचटीएमएल एवं जावा-स्क्रिप्ट के प्रयोग से जालपृष्ठ विजेट
-Comment[hne]=एचटीएमएल अउ जावास्क्रिप्ट के उपयोग से वेबपेज विजेट
-Comment[hr]=Widgeti web stranice koja koristi HTML i JavaScript
-Comment[hu]=Webes elem HTML/Javascript használatával
-Comment[ia]=Elemento graphic (Widget) de pagina web usante HTML e JavaScript
-Comment[id]=Widget halaman web menggunakan HTML dan JavaScript
-Comment[is]=Vefsíðugræja sem notar HTML og JavaScript
-Comment[ja]=HTML と JavaScript を使ったウェブページウィジェット
-Comment[kk]=HTML мен JavaScript негіздеген Веб-парақ бөлшегі
-Comment[km]=ធាតុក្រាហ្វិកទំព័របណ្ដាញដោយប្រើ HTML និង JavaScript
-Comment[kn]=HTML ಮತ್ತು ಜಾವಾಸ್ಕ್ರಿಪ್ಟ್ ಬಳಸುವ ಜಾಲಪುಟ ನಿಯಂತ್ರಣಾಸಂಪರ್ಕತಟ (ವಿಡ್ಗೆಟ್)
-Comment[ko]=HTML과 자바스크립트를 사용하는 웹 페이지 위젯
-Comment[ku]=Amûrê Rûpela Webê HTML û JavaScript bi kar tîne
-Comment[lt]=Žiniatinklio puslapio valdiklis naudojantis HTML ir JavaScript
-Comment[lv]=Tīmekļa lapas sīkrīks, kas izmanto HTML un JavaScript
-Comment[ml]=എച്ച്ടിഎംഎലും ജാവാസ്ക്രിപ്റ്റും ഉപയോഗിക്കുന്ന വെബ്താള് ഉരുപ്പടി
-Comment[mr]=HTML व जावास्क्रिप्टचा वापर करणारे वेबपान विजेट
-Comment[nb]=Nettside-element som bruker HTML og JavaScript
-Comment[nds]=Nettsieden-Finster, bruukt HTML un JavaScript
-Comment[nl]=Webpagina-widget, gebruikmakend van HTML en JavaScript
-Comment[nn]=Nettsideelement som brukar HTML og JavaScript
-Comment[or]=HTML ଏବଂ JavaScript ବ୍ୟବହାର କରି ୱେବ ପୃଷ୍ଠା ୱିଜେଟ
-Comment[pa]=HTML ਅਤੇ ਜਾਵਾ-ਸਕ੍ਰਿਪਟ ਨਾਲ ਵੈੱਬ-ਪੇਜ਼ ਵਿਦਜੈੱਟ
-Comment[pl]=Element interfejsu wykorzystujący HTML oraz JavaScript
-Comment[pt]=Elemento de página Web que usa HTML e JavaScript
-Comment[pt_BR]=Widget de página da Internet usando HTML e JavaScript
-Comment[ro]=Control web scris în HTML și JavaScript
-Comment[ru]=Показ веб-страницы
-Comment[si]=Webpage widget using HTML and JavaScript
-Comment[sk]=Widget webovej stránky, ktorý používa HTML a JavaScript
-Comment[sl]=Spletni gradnik, ki uporablja HTML in JavaScript
-Comment[sr]=Виџет веб странице са ХТМЛ‑ом и јаваскриптом
-Comment[sr@ijekavian]=Виџет веб странице са ХТМЛ‑ом и јаваскриптом
-Comment[sr@ijekavianlatin]=Vidžet veb stranice sa HTML‑om i JavaScriptom
-Comment[sr@latin]=Vidžet veb stranice sa HTML‑om i JavaScriptom
-Comment[sv]=Grafisk webbkomponent som använder HTML och Javascript
-Comment[ta]=Webpage widget using HTML and JavaScript
-Comment[te]=HTML మరియు జావాస్క్రిప్ట్ ఉపయోగించు వెబ్పేజ్ విడ్జట్
-Comment[tg]=Модуль, использующий HTML и JavaScript
-Comment[th]=วิดเจ็ตหน้าเว็บที่ถูกเขียนด้วย HTML และจาวาสคริปต์
-Comment[tr]=HTML ve JavaScript kullanan Web sayfası programcığı
-Comment[ug]=HTML ۋە JavaScript ئىشلەتكەن تور بەت widget
-Comment[uk]=Віджет сторінки тенет, що використовує HTML і JavaScript
-Comment[wa]=Ahesse di pådje waibe eployant l' HTML eyet JavaScript
-Comment[x-test]=xxWebpage widget using HTML and JavaScriptxx
-Comment[zh_CN]=使用 HTML 和JavaScript 的网页部件
-Comment[zh_TW]=使用 HTML 與 JavaScript 的網頁元件
-Type=Service
-ServiceTypes=Plasma/ScriptEngine
-Icon=internet-web-browser
-
-X-KDE-Library=plasma_appletscriptengine_webapplet
-X-KDE-PluginInfo-Author=Zack Rusin
-X-KDE-PluginInfo-Email=zack@kde.org
-X-KDE-PluginInfo-Name=webkit
-X-KDE-PluginInfo-Version=pre0.1
-X-KDE-PluginInfo-Website=http://plasma.kde.org/
-X-KDE-PluginInfo-Category=Applet
-X-KDE-PluginInfo-Depends=
-X-KDE-PluginInfo-License=BSD
-X-KDE-PluginInfo-EnabledByDefault=true
-X-Plasma-API=webkit
-X-Plasma-ComponentTypes=Applet
-X-Plasma-PackageFormat=webkit
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#include "plasmajs.h"
-#include "plasmawebapplet.h"
-
-#include <Plasma/DataEngine>
-
-using namespace Plasma;
-
-ConfigGroupWrapper::ConfigGroupWrapper(const KConfigGroup &config)
-: m_config(config)
-{
-}
-
-void ConfigGroupWrapper::setConfig(const KConfigGroup &config)
-{
- //kDebug() << config.config()->name() << config.name();
- m_config = config;
-}
-
-QVariant ConfigGroupWrapper::readEntry(const QString &key, const QVariant &aDefault) const
-{
- // Should KConfig do this?
- // There is readEntry(key, QVariant) but it does not seem to work
- // (if writeEntry was not QVariant??)
- // kDebug() << aDefault.typeName();
- if (aDefault.type() == QVariant::Int) {
- return m_config.readEntry(key, aDefault.toInt());
- } else if (aDefault.type() == QVariant::Double) {
- return m_config.readEntry(key, aDefault.toDouble());
- } else if (aDefault.type() == QVariant::Bool) {
- return m_config.readEntry(key, aDefault.toBool());
- } else {
- return m_config.readEntry(key, aDefault.toString());
- }
-}
-
-void ConfigGroupWrapper::writeEntry(const QString &key, const QVariant& value)
-{
- m_config.writeEntry(key, value);
-}
-
-DataEngineDataWrapper::DataEngineDataWrapper(const DataEngine::Data &data)
- : m_data(data)
-{
-}
-
-int DataEngineDataWrapper::length() const
-{
- return m_data.count();
-}
-
-void DataEngineDataWrapper::setData(const Plasma::DataEngine::Data &data)
-{
- m_data = data;
-}
-
-QVariant DataEngineDataWrapper::value(const QString &key) const
-{
- return m_data[key];
-}
-
-bool DataEngineDataWrapper::contains(const QString &key) const
-{
- return m_data.keys().contains(key);
-}
-
-QStringList DataEngineDataWrapper::keys() const
-{
- return m_data.keys();
-}
-
-QString DataEngineDataWrapper::key(int i) const
-{
- return m_data.keys().at(i);
-}
-
-DataEngineWrapper::DataEngineWrapper(Plasma::DataEngine *engine, QObject *applet)
- : QObject(engine), m_engine(engine), m_applet(applet)
-{
-}
-
-QStringList DataEngineWrapper::sources() const
-{
- return m_engine->sources();
-}
-
-QString DataEngineWrapper::engineName() const
-{
- return m_engine->name();
-}
-
-bool DataEngineWrapper::isValid() const
-{
- return m_engine->isValid();
-}
-
-QString DataEngineWrapper::icon() const
-{
- return m_engine->icon();
-}
-
-QObject * DataEngineWrapper::query(const QString &str) const
-{
- DataEngine::Data data = m_engine->query(str);
- return new DataEngineDataWrapper(data);
-}
-
-DataEngineWrapper::~DataEngineWrapper()
-{
-}
-
-void DataEngineWrapper::connectSource(const QString& source,
- uint pollingInterval, uint intervalAlignment)
-{
- if (m_applet) {
- m_engine->connectSource(source, m_applet, pollingInterval,
- (Plasma::IntervalAlignment)intervalAlignment);
- }
-}
-
-#include "moc_plasmajs.cpp"
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#ifndef PLASMAJS_H
-#define PLASMAJS_H
-
-#include <QObject>
-#include <KConfigGroup>
-#include <Plasma/DataEngine>
-
-class PlasmaWebApplet;
-
-class DataEngineDataWrapper : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(int length READ length)
-public:
- DataEngineDataWrapper(const Plasma::DataEngine::Data &data = Plasma::DataEngine::Data());
-
- int length() const;
- void setData(const Plasma::DataEngine::Data &data);
-
-public Q_SLOTS:
- bool contains(const QString &key) const;
- QVariant value(const QString &key) const;
- QStringList keys() const;
- QString key(int i) const;
-
-private:
- Plasma::DataEngine::Data m_data;
-};
-
-class DataEngineWrapper : public QObject
-{
- Q_OBJECT
- Q_PROPERTY(QStringList sources READ sources)
- Q_PROPERTY(bool valid READ isValid)
- Q_PROPERTY(QString icon READ icon)
- Q_PROPERTY(QString engineName READ engineName)
-public:
- DataEngineWrapper(Plasma::DataEngine *engine, QObject *applet = 0);
- ~DataEngineWrapper();
-
- QStringList sources() const;
- QString engineName() const;
- bool isValid() const;
- QString icon() const;
-
-public Q_SLOTS:
- QObject *query(const QString &str) const;
- void connectSource(const QString& source,
- uint pollingInterval = 0, uint intervalAlignment = 0);
-
-private:
- Plasma::DataEngine *m_engine;
- QObject *m_applet;
-};
-
-class ConfigGroupWrapper : public QObject
-{
- Q_OBJECT
-public:
- ConfigGroupWrapper(const KConfigGroup &config = KConfigGroup());
-
- void setConfig(const KConfigGroup &config);
-
-public Q_SLOTS:
- QVariant readEntry(const QString &key, const QVariant &aDefault) const;
- void writeEntry(const QString &key, const QVariant& value);
-
-private:
- KConfigGroup m_config;
-};
-
-#endif
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-Copyright (c) 2008 Petri Damstén <damu@iki.fi>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#include "plasmawebapplet.h"
-
-#include <QAction>
-#include <QWebPage>
-#include <QWebFrame>
-
-#include <KColorScheme>
-
-#include <Plasma/DataEngineManager>
-#include <Plasma/Applet>
-#include <Plasma/Theme>
-#include <Plasma/WebView>
-
-#define JS_CONSTANTS_CONSTRAINT \
-"var NoConstraint = %1;\n"\
-"var FormFactorConstraint = %2;\n"\
-"var LocationConstraint = %3;\n"\
-"var ScreenConstraint = %4;\n"\
-"var SizeConstraint = %5;\n"\
-"var ImmutableConstraint = %6;\n"\
-"var StartupCompletedConstraint = %7;\n"\
-"var ContextConstraint = %8;\n"\
-"var AllConstraints = %9;\n"
-
-#define JS_CONSTANTS_BACKGROUND \
-"var NoBackground = %1;\n"\
-"var StandardBackground = %2;\n"\
-"var TranslucentBackground = %3;\n"\
-"var DefaultBackground = %5;\n"
-
-#define JS_CONSTANTS_SCROLLBAR \
-"var QtHorizontal = %1;\n"\
-"var QtVertical = %2;\n"\
-"var ScrollBarAsNeeded = %3;\n"\
-"var ScrollBarAlwaysOff = %4;\n"\
-"var ScrollBarAlwaysOn = %5;\n"\
-
-#define JS_CONSTANTS_ASPECTRATIO \
-"var InvalidAspectRatioMode = %1;\n"\
-"var IgnoreAspectRatio = %2;\n"\
-"var KeepAspectRatio = %3;\n"\
-"var Square = %4;\n"\
-"var ConstrainedSquare = %5;\n"\
-"var FixedSize = %6;\n"
-
-#define JS_CONSTANTS_FORMFACTOR \
-"var Planar = %1;\n"\
-"var MediaCenter = %2;\n"\
-"var Horizontal = %3;\n"\
-"var Vertical = %4;\n"\
-
-#define JS_CONSTANTS_LOCATION \
-"var Floating = %1;\n"\
-"var Desktop = %2;\n"\
-"var FullScreen = %3;\n"\
-"var TopEdge = %4;\n"\
-"var BottomEdge = %5;\n"\
-"var LeftEdge = %6;\n"\
-"var RightEdge = %7;\n"
-
-#define JS_CONSTANTS_OTHER \
-"var size_width = 0;\n"\
-"var size_height = 1;\n"\
-"var point_x = 0;\n"\
-"var point_y = 1;\n"\
-"var rect_x = 0;\n"\
-"var rect_y = 1;\n"\
-"var rect_width = 2;\n"\
-"var rect_height = 3;\n"\
-"var margin_left = 0;\n"\
-"var margin_top = 1;\n"\
-"var margin_right = 2;\n"\
-"var margin_bottom = 3;\n"\
-
-#define CSS "body { font-family: %3; font-size: %4pt; color:%1; background-color:%2 }\n"
-
-QString PlasmaWebApplet::s_jsConstants;
-
-PlasmaWebApplet::PlasmaWebApplet(QObject *parent, const QVariantList &args)
-: WebApplet(parent, args)
-{
- if (s_jsConstants.isEmpty()) {
- s_jsConstants = JS_CONSTANTS_OTHER;
- s_jsConstants += QString(JS_CONSTANTS_CONSTRAINT)
- .arg(Plasma::NoConstraint)
- .arg(Plasma::FormFactorConstraint)
- .arg(Plasma::LocationConstraint)
- .arg(Plasma::ScreenConstraint)
- .arg(Plasma::SizeConstraint)
- .arg(Plasma::ImmutableConstraint)
- .arg(Plasma::StartupCompletedConstraint)
- .arg(Plasma::ContextConstraint)
- .arg(Plasma::AllConstraints);
- s_jsConstants += QString(JS_CONSTANTS_BACKGROUND)
- .arg(Plasma::Applet::NoBackground)
- .arg(Plasma::Applet::StandardBackground)
- .arg(Plasma::Applet::TranslucentBackground)
- .arg(Plasma::Applet::DefaultBackground);
- s_jsConstants += QString(JS_CONSTANTS_SCROLLBAR)
- .arg(Qt::Horizontal)
- .arg(Qt::Vertical)
- .arg(Qt::ScrollBarAsNeeded)
- .arg(Qt::ScrollBarAlwaysOff)
- .arg(Qt::ScrollBarAlwaysOn);
- s_jsConstants += QString(JS_CONSTANTS_ASPECTRATIO)
- .arg(Plasma::InvalidAspectRatioMode)
- .arg(Plasma::IgnoreAspectRatio)
- .arg(Plasma::KeepAspectRatio)
- .arg(Plasma::Square)
- .arg(Plasma::ConstrainedSquare)
- .arg(Plasma::FixedSize);
- s_jsConstants += QString(JS_CONSTANTS_FORMFACTOR)
- .arg(Plasma::Planar)
- .arg(Plasma::MediaCenter)
- .arg(Plasma::Horizontal)
- .arg(Plasma::Vertical);
- s_jsConstants += QString(JS_CONSTANTS_LOCATION)
- .arg(Plasma::Floating)
- .arg(Plasma::Desktop)
- .arg(Plasma::FullScreen)
- .arg(Plasma::TopEdge)
- .arg(Plasma::BottomEdge)
- .arg(Plasma::LeftEdge)
- .arg(Plasma::RightEdge);
- }
-}
-
-PlasmaWebApplet::~PlasmaWebApplet()
-{
-}
-
-bool PlasmaWebApplet::init()
-{
- if (WebApplet::init()) {
- connect(Plasma::Theme::defaultTheme(), SIGNAL(themeChanged()),
- this, SLOT(themeChanged()));
- makeStylesheet();
- page()->settings()->setAttribute(QWebSettings::DeveloperExtrasEnabled, true);
- QAction *inspectAction = page()->action(QWebPage::InspectElement);
- inspectAction->setText(i18n("Inspect this widget"));
- return true;
- }
-
- return false;
-}
-
-void PlasmaWebApplet::makeStylesheet()
-{
- if (!page()) {
- return;
- }
-
- // this temporary file contains the style sheet to be used when loading/reloading the
- // web content. we keep it around for the lifetime of the widget since it needs to be there
- // when reloaded
-
- //TODO perhaps share this file between all instances? perhaps even keep it persistent on disk
- // to limit disk write/deletes. that would be simple enough, the only trick would be to
- // ensure it updates (and only updates once) on Plasma theme changes so that it doesn't get
- // written to in a flury by every PlasmaWebApplet when the theme updates
- // probably a reference counted singleton would be the way to go here.
- if (!m_styleSheetFile.open()) {
- return;
- }
-
- KColorScheme plasmaColorTheme = KColorScheme(QPalette::Active, KColorScheme::View,
- Plasma::Theme::defaultTheme()->colorScheme());
- QColor textColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::TextColor);
- QColor backgroundColor = Plasma::Theme::defaultTheme()->color(Plasma::Theme::BackgroundColor);
- QFont font = Plasma::Theme::defaultTheme()->font(Plasma::Theme::DefaultFont);
-
- QString css = QString(CSS).arg(textColor.name())
- .arg(backgroundColor.name())
- .arg(font.family())
- .arg(font.pointSize());
- m_styleSheetFile.write(css.toUtf8());
- page()->settings()->setUserStyleSheetUrl(QUrl(m_styleSheetFile.fileName()));
- m_styleSheetFile.close();
-}
-
-void PlasmaWebApplet::themeChanged()
-{
- makeStylesheet();
- callJsFunction("themeChanged");
-}
-
-void PlasmaWebApplet::loadFinished(bool success)
-{
- WebApplet::loadFinished(success);
- if (success) {
- page()->mainFrame()->evaluateJavaScript(s_jsConstants);
- callJsFunction("init");
- }
-}
-
-void PlasmaWebApplet::constraintsEvent(Plasma::Constraints constraints)
-{
- if (page() && constraints & Plasma::SizeConstraint) {
- qreal left;
- qreal top;
- qreal right;
- qreal bottom;
- applet()->getContentsMargins(&left, &top, &right, &bottom);
- view()->setPos(QPointF(left, top));
- view()->resize(WebApplet::size() - QSizeF(left + right, top + bottom));
- //kDebug() << WebApplet::size() << left << right << top << bottom << page()->size();
- }
- callJsFunction("constraintsEvent", QVariantList() << (int)constraints);
-}
-
-QVariant PlasmaWebApplet::arg(int index) const
-{
- return m_args[index];
-}
-
-QObject* PlasmaWebApplet::objArg(int index) const
-{
- return m_args[index].value<QObject*>();
-}
-
-QString PlasmaWebApplet::name() const
-{
- return applet()->name();
-}
-
-uint PlasmaWebApplet::id() const
-{
- return applet()->id();
-}
-
-int PlasmaWebApplet::formFactor() const
-{
- return (int)applet()->formFactor();
-}
-
-int PlasmaWebApplet::location() const
-{
- return (int)applet()->location();
-}
-
-QString PlasmaWebApplet::pluginName() const
-{
- return applet()->pluginName();
-}
-
-QString PlasmaWebApplet::icon() const
-{
- return applet()->icon();
-}
-
-QString PlasmaWebApplet::category() const
-{
- return applet()->category();
-}
-
-bool PlasmaWebApplet::shouldConserveResources() const
-{
- return applet()->shouldConserveResources();
-}
-
-QStringList PlasmaWebApplet::listAllDataEngines()
-{
- return Plasma::DataEngineManager::listAllEngines();
-}
-
-QObject* PlasmaWebApplet::dataEngine(const QString& name)
-{
- QString id = QString("%1").arg(applet()->id());
- Plasma::DataEngine *de = applet()->dataEngine(name);
- DataEngineWrapper *wrapper = de->findChild<DataEngineWrapper*>(id);
- if (!wrapper) {
- wrapper = new DataEngineWrapper(de, this);
- wrapper->setObjectName(id);
- }
- return wrapper;
-}
-
-QObject* PlasmaWebApplet::config()
-{
- m_config.setConfig(applet()->config());
- return &m_config;
-}
-
-QObject* PlasmaWebApplet::globalConfig()
-{
- m_globalConfig.setConfig(applet()->globalConfig());
- return &m_globalConfig;
-}
-
-void PlasmaWebApplet::resize(qreal w, qreal h)
-{
- applet()->resize(w, h);
-}
-
-void PlasmaWebApplet::setBackgroundHints(int hints)
-{
- applet()->setBackgroundHints((Plasma::Applet::BackgroundHints)hints);
-}
-
-void PlasmaWebApplet::setScrollBarPolicy(int orientation, int policy)
-{
- page()->mainFrame()->setScrollBarPolicy((Qt::Orientation)orientation,
- (Qt::ScrollBarPolicy)policy);
-}
-
-void PlasmaWebApplet::setAspectRatioMode(int mode)
-{
- applet()->setAspectRatioMode((Plasma::AspectRatioMode)mode);
-}
-
-QVariant PlasmaWebApplet::callJsFunction(const QString& func, const QVariantList& args)
-{
- if (loaded()) {
- m_args = args;
- QString cmd = "if (window." + func + ") { " + func + '(';
- for(int i = 0; i < args.count(); ++i) {
- if (i > 0) {
- cmd += ',';
- }
- if (args[i].canConvert<QObject*>()) {
- cmd += QString("window.plasmoid.objArg(%1)").arg(i);
- } else {
- cmd += QString("window.plasmoid.arg(%1)").arg(i);
- }
- }
- cmd += ") }";
- //kDebug() << cmd;
- return page()->mainFrame()->evaluateJavaScript(cmd);
- }
- return QVariant();
-}
-
-void PlasmaWebApplet::dataUpdated(const QString& source, const Plasma::DataEngine::Data &data)
-{
- m_dataEngineData.setData(data);
- callJsFunction("dataUpdated",
- QVariantList() << source << QVariant::fromValue((QObject*)&m_dataEngineData));
-}
-
-void PlasmaWebApplet::configChanged()
-{
- callJsFunction("configChanged");
-}
-
-void PlasmaWebApplet::initJsObjects()
-{
- QWebFrame *frame = qobject_cast<QWebFrame*>(sender());
- Q_ASSERT(frame);
- frame->addToJavaScriptWindowObject(QLatin1String("plasmoid"), this);
-}
-
-QVariantList PlasmaWebApplet::geometry()
-{
- return QVariantList() << applet()->geometry().left() << applet()->geometry().top()
- << applet()->geometry().width() << applet()->geometry().height();
-}
-
-QVariantList PlasmaWebApplet::screenRect()
-{
- return QVariantList() << applet()->screenRect().left() << applet()->screenRect().top()
- << applet()->screenRect().width() << applet()->screenRect().height();
-}
-
-int PlasmaWebApplet::backgroundHints()
-{
- return applet()->backgroundHints();
-}
-
-int PlasmaWebApplet::aspectRatioMode()
-{
- return applet()->aspectRatioMode();
-}
-
-void PlasmaWebApplet::setConfigurationRequired(bool needsConfiguring, const QString &reason)
-{
- WebApplet::setConfigurationRequired(needsConfiguring, reason);
-}
-
-void PlasmaWebApplet::setMaximumSize(qreal w, qreal h)
-{
- applet()->setMaximumSize(w, h);
-}
-
-void PlasmaWebApplet::setMinimumSize(qreal w, qreal h)
-{
- applet()->setMinimumSize(w, h);
-}
-
-void PlasmaWebApplet::setPreferredSize(qreal w, qreal h)
-{
- applet()->setPreferredSize(w, h);
-}
-
-QVariantList PlasmaWebApplet::maximumSize()
-{
- return QVariantList() << applet()->maximumSize().width() << applet()->maximumSize().height();
-}
-
-QVariantList PlasmaWebApplet::minimumSize()
-{
- return QVariantList() << applet()->minimumSize().width() << applet()->minimumSize().height();
-}
-
-QVariantList PlasmaWebApplet::preferredSize()
-{
- return QVariantList() << applet()->preferredSize().width()
- << applet()->preferredSize().height();
-}
-
-QVariantList PlasmaWebApplet::getContentsMargins()
-{
- qreal left;
- qreal top;
- qreal right;
- qreal bottom;
- applet()->getContentsMargins(&left, &top, &right, &bottom);
- return QVariantList() << left << top << right << bottom;
-}
-
-void PlasmaWebApplet::setGeometry(qreal x, qreal y, qreal w, qreal h)
-{
- applet()->setGeometry(x, y, w, h);
-}
-
-void PlasmaWebApplet::setPos(qreal x, qreal y)
-{
- applet()->setPos(x, y);
-}
-
-QVariantList PlasmaWebApplet::pos()
-{
- return QVariantList() << applet()->pos().x() << applet()->pos().y();
-}
-
-QVariantList PlasmaWebApplet::size()
-{
- return QVariantList() << applet()->size().width() << applet()->size().height();
-}
-
-void PlasmaWebApplet::setFailedToLaunch(bool failed, const QString &reason)
-{
- WebApplet::setFailedToLaunch(failed, reason);
-}
-
-void PlasmaWebApplet::update()
-{
- applet()->update();
-}
-
-bool PlasmaWebApplet::isBusy() const
-{
- return applet()->isBusy();
-}
-
-void PlasmaWebApplet::setBusy(bool busy)
-{
- applet()->setBusy(busy);
-}
-
-#include "moc_plasmawebapplet.cpp"
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-Copyright (c) 2008 Petri Damstén <damu@iki.fi>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef PLASMAWEBAPPLET_H
-#define PLASMAWEBAPPLET_H
-
-#include "webapplet.h"
-#include "plasmajs.h"
-
-#include <KTemporaryFile>
-
-class PlasmaWebApplet : public WebApplet
-{
- Q_OBJECT
- Q_PROPERTY(QString name READ name)
- Q_PROPERTY(uint id READ id)
- Q_PROPERTY(QString pluginName READ pluginName)
- Q_PROPERTY(QString icon READ icon)
- Q_PROPERTY(QString category READ category)
- Q_PROPERTY(int formFactor READ formFactor)
- Q_PROPERTY(int location READ location)
-
-public:
- PlasmaWebApplet(QObject *parent, const QVariantList &args);
- virtual ~PlasmaWebApplet();
-
- virtual bool init();
-
- QString name() const;
- uint id() const;
- QString pluginName() const;
- QString icon() const;
- QString category() const;
- bool shouldConserveResources() const;
- int formFactor() const;
- int location() const;
-
-public slots:
- QStringList listAllDataEngines();
- QObject* dataEngine(const QString& name);
- QObject* config();
- QObject* globalConfig();
- void setScrollBarPolicy(int orientation, int policy);
- QVariantList screenRect();
- void setConfigurationRequired(bool needsConfiguring, const QString &reason = QString());
- QVariantList getContentsMargins();
- void resize(qreal w, qreal h);
- QVariantList size();
- void setBackgroundHints(int hints);
- int backgroundHints();
- void setAspectRatioMode(int mode);
- int aspectRatioMode();
- void setMaximumSize(qreal w, qreal h);
- QVariantList maximumSize();
- void setMinimumSize(qreal w, qreal h);
- QVariantList minimumSize();
- void setPreferredSize(qreal w, qreal h);
- QVariantList preferredSize();
- void setGeometry(qreal x, qreal y, qreal w, qreal h);
- QVariantList geometry();
- void setPos(qreal x, qreal y);
- QVariantList pos();
- void setFailedToLaunch(bool failed, const QString &reason = QString());
- void update();
- bool isBusy() const;
- void setBusy(bool busy);
-
- QVariant arg(int index) const;
- QObject* objArg(int index) const;
- void dataUpdated(const QString& source, const Plasma::DataEngine::Data &data);
- void configChanged();
- void themeChanged();
- void makeStylesheet();
-
-protected:
- QVariant callJsFunction(const QString &func, const QVariantList &args = QVariantList());
- void constraintsEvent(Plasma::Constraints constraints);
-
-protected slots:
- virtual void loadFinished(bool success);
- virtual void initJsObjects();
-
-private:
- QVariantList m_args;
- DataEngineDataWrapper m_dataEngineData;
- ConfigGroupWrapper m_config;
- ConfigGroupWrapper m_globalConfig;
- KTemporaryFile m_styleSheetFile;
- static QString s_jsConstants;
-};
-
-#endif
+++ /dev/null
-<html>
- <head>
- <script type="text/javascript" src="AppleClasses/AppleAnimator.js" charset='utf-8'></script>
- <script>
- function colorchanger(animation, cur, from, to)
- {
- var box = document.getElementById('testbox');
- box.style.background = 'rgb(127,0,' + parseInt(cur) + ')';
- };
-
- function boxchanger(animation, cur, from, to)
- {
- var box = document.getElementById('testbox');
- box.style.left = cur.left + 'px';
- box.style.top = cur.top + 'px';
- box.style.width = (cur.right - cur.left) + 'px';
- box.style.height = (cur.bottom - cur.top) + 'px';
- };
-
- window.onload = function ()
- {
- var element = document.getElementById('testbox');
- element.style.height = '100px';
- element.style.width = '250px';
- element.style.background = 'rgb(127,0,0)';
- element.style.position = 'absolute';
- element.style.left = '50px';
- element.style.top = '100px';
- var animator = new AppleAnimator(10000,100,0,255,colorchanger);
- var rectanim = new AppleRectAnimation( new AppleRect(50,100,400,200), new AppleRect(75,100,500,300), boxchanger);
- animator.addAnimation(rectanim);
- animator.start();
- }
- </script>
- </head>
- <body>
- <div id="testbox"></div>
- </body>
-</html>
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#include "webapplet.h"
-
-#include "webpage.h"
-
-#include <QPainter>
-#include <QWebView>
-#include <QWebFrame>
-#include <QWebPage>
-#include <QFile>
-
-#include <KDebug>
-
-#include <Plasma/Applet>
-#include <Plasma/Package>
-#include <Plasma/WebView>
-
-using namespace Plasma;
-
-class WebApplet::Private
-{
-public:
- Private()
- : view(0)
- {
- }
-
- void init(WebApplet *q)
- {
- loaded = false;
-
- Plasma::Applet *applet = q->applet();
- applet->setAcceptHoverEvents(true);
-
- view = new Plasma::WebView(applet);
- QObject::connect(view, SIGNAL(loadFinished(bool)),
- q, SLOT(loadFinished(bool)));
- QObject::connect(view->page(), SIGNAL(frameCreated(QWebFrame*)),
- q, SLOT(connectFrame(QWebFrame*)));
- q->connectFrame(view->mainFrame());
-
- view->mainFrame()->setScrollBarPolicy(Qt::Horizontal, Qt::ScrollBarAlwaysOff);
- view->mainFrame()->setScrollBarPolicy(Qt::Vertical, Qt::ScrollBarAlwaysOff);
-
- QPalette palette = view->palette();
- palette.setColor(QPalette::Base, Qt::transparent);
- view->page()->setPalette(palette);
- }
-
- Plasma::WebView *view;
- bool loaded;
-};
-
-WebApplet::WebApplet(QObject *parent, const QVariantList &args)
- : AppletScript(parent),
- d(new Private)
-{
- Q_UNUSED(args)
-}
-
-WebApplet::~WebApplet()
-{
- delete d;
-}
-
-bool WebApplet::init()
-{
- d->init(this);
-
- QString webpage;
- webpage = package()->filePath("mainscript");
-
- if (webpage.isEmpty()) {
- kDebug() << "fail! no page";
- delete d->view;
- d->view = 0;
- return false;
- }
-
- KUrl url(package()->filePath("html"));
- kDebug() << webpage << package()->path() << url;
- d->view->mainFrame()->setHtml(dataFor(webpage), url);
- return true;
-}
-
-void WebApplet::paintInterface(QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- const QRect &contentsRect)
-{
- Q_UNUSED(painter)
- Q_UNUSED(option)
- Q_UNUSED(contentsRect)
-}
-
-Plasma::WebView* WebApplet::view() const
-{
- return d->view;
-}
-
-void WebApplet::loadFinished(bool success)
-{
- d->loaded = success;
-}
-
-void WebApplet::connectFrame(QWebFrame *frame)
-{
- connect(frame, SIGNAL(javaScriptWindowObjectCleared()),
- this, SLOT(initJsObjects()));
-}
-
-void WebApplet::initJsObjects()
-{
-}
-
-QByteArray WebApplet::dataFor(const QString &str)
-{
- QFile f(str);
- f.open(QIODevice::ReadOnly);
- QByteArray data = f.readAll();
- f.close();
- return data;
-}
-
-QWebPage *WebApplet::page()
-{
- return d->view ? d->view->page() : 0;
-}
-
-bool WebApplet::loaded()
-{
- return d->loaded;
-}
-
-#include "moc_webapplet.cpp"
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#ifndef WEBAPPLET_H
-#define WEBAPPLET_H
-
-#include <QUrl>
-
-#include <Plasma/DataEngine>
-#include <Plasma/AppletScript>
-
-class QWebFrame;
-class QWebPage;
-
-namespace Plasma
-{
- class WebView;
-} // namespace Plasma
-
-class WebApplet : public Plasma::AppletScript
-{
- Q_OBJECT
-public:
- WebApplet(QObject *parent, const QVariantList &args);
- ~WebApplet();
-
- bool init();
-
-protected:
- Plasma::WebView *view() const;
- void paintInterface(QPainter *painter,
- const QStyleOptionGraphicsItem *option,
- const QRect &contentsRect);
- virtual QByteArray dataFor(const QString &str);
- QWebPage *page();
- bool loaded();
-
-protected slots:
- void connectFrame(QWebFrame *);
- virtual void loadFinished(bool);
- virtual void initJsObjects();
-
-private:
- class Private;
- Private *const d;
-};
-
-#endif
+++ /dev/null
-/*
-Copyright (c) 2008 Petri Damstén <damu@iki.fi>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#include "webapplet_package.h"
-
-#include <Plasma/Applet>
-
-WebAppletPackage::WebAppletPackage(QObject *parent, QVariantList args)
-: Plasma::PackageStructure(parent, "Web")
-{
- Q_UNUSED(args)
- // copy the main applet structure
- Plasma::PackageStructure::operator=(*Plasma::Applet::packageStructure());
- addFileDefinition("mainscript", "code/main.html", i18n("Main Script File"));
- setRequired("mainscript", true);
-
- // For Webapplet::init()
- addDirectoryDefinition("html", "code/", i18n("Root HTML directory"));
-}
-
-void WebAppletPackage::pathChanged()
-{
- KDesktopFile config(path() + "/metadata.desktop");
- KConfigGroup cg = config.desktopGroup();
- QString mainScript = cg.readEntry("X-Plasma-MainScript", QString());
- if (!mainScript.isEmpty()) {
- addFileDefinition("mainscript", mainScript, i18n("Main Script File"));
- setRequired("mainscript", true);
- }
-}
-
+++ /dev/null
-/*
-Copyright (c) 2008 Petri Damstén <damu@iki.fi>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
-*/
-
-#ifndef WEBAPPLET_PACKAGE_H
-#define WEBAPPLET_PACKAGE_H
-
-#include <KDesktopFile>
-
-#include <Plasma/PackageStructure>
-
-class WebAppletPackage : public Plasma::PackageStructure
-{
-public:
- WebAppletPackage(QObject *parent, QVariantList args);
-
-protected:
- void pathChanged();
-};
-
-K_EXPORT_PLASMA_PACKAGESTRUCTURE(webkit, WebAppletPackage)
-
-#endif
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#include "plasmawebapplet.h"
-
-K_EXPORT_PLASMA_APPLETSCRIPTENGINE(webkit, PlasmaWebApplet)
-
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#include "webpage.h"
-
-#include <QtWebKit/QWebSettings>
-#include <QDebug>
-
-namespace Plasma
-{
-
-WebPage::WebPage(QObject *parent)
- : QWebPage(parent)
-{
- settings()->setAttribute(QWebSettings::JavascriptCanOpenWindows, false);
- settings()->setAttribute(QWebSettings::JavascriptCanAccessClipboard, true);
- settings()->setAttribute(QWebSettings::LinksIncludedInFocusChain, true);
-}
-
-QWebPage * WebPage::createWindow(QWebPage::WebWindowType)
-{
- Q_ASSERT(0);
- return 0;
-}
-
-void WebPage::javaScriptAlert(QWebFrame *frame, const QString& message)
-{
- Q_UNUSED(frame)
- qDebug()<< "JS ALERT: "<< message;
-}
-
-void WebPage::javaScriptConsoleMessage(const QString& message, int lineNumber,
- const QString& sourceID)
-{
- Q_UNUSED(sourceID)
- qDebug()<< "JS CONSOLE MESSAGE: line "<< lineNumber<<": " << message;
-}
-
-bool WebPage::javaScriptConfirm(QWebFrame *frame, const QString& msg)
-{
- Q_UNUSED(frame)
- qDebug()<< "JS CONFIRM: "<< msg;
- return true;
-}
-
-bool WebPage::javaScriptPrompt(QWebFrame *frame, const QString& msg,
- const QString& defaultValue, QString* result)
-{
- Q_UNUSED(frame)
- qDebug()<<"JS PROMPT: "<< msg <<", default text: "<<defaultValue;
- *result = defaultValue;
- return true;
-}
-
-} // namespace Plasma
-
-#include "moc_webpage.cpp"
+++ /dev/null
-/*
-Copyright (c) 2007 Zack Rusin <zack@kde.org>
-
-Permission is hereby granted, free of charge, to any person obtaining a copy
-of this software and associated documentation files (the "Software"), to deal
-in the Software without restriction, including without limitation the rights
-to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
-copies of the Software, and to permit persons to whom the Software is
-furnished to do so, subject to the following conditions:
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
-THE SOFTWARE.
- */
-#ifndef WEBPAGE_H
-#define WEBPAGE_H
-
-#include <QObject>
-#include <QtWebKit/QWebPage>
-
-namespace Plasma
-{
-
-class WebPage : public QWebPage
-{
- Q_OBJECT
-public:
- WebPage(QObject *parent=0);
-
- QWebPage *createWindow(QWebPage::WebWindowType);
-
- void javaScriptAlert(QWebFrame *frame, const QString& message);
- void javaScriptConsoleMessage(const QString& message, int lineNumber,
- const QString& sourceID);
- bool javaScriptConfirm(QWebFrame *frame, const QString& msg);
- bool javaScriptPrompt(QWebFrame *frame, const QString& msg,
- const QString& defaultValue, QString* result);
-};
-
-} // namespace Plasma
-
-#endif