PackageStructure plugin for plasmapkg et al as well as some fixes to the addon package structure definition

svn path=/trunk/KDE/kdebase/runtime/; revision=1161152
This commit is contained in:
Aaron J. Seigo 2010-08-09 20:40:13 +00:00
parent 88f7ff8f53
commit 4d6e335156
5 changed files with 66 additions and 20 deletions

View File

@ -1,6 +1,7 @@
# APPLET
set(simple_javascript_engine_SRCS
common/javascriptaddonpackagestructure.cpp
common/scriptenvui.cpp
plasmoid/appletauthorization.cpp
plasmoid/appletinterface.cpp
@ -52,6 +53,7 @@ install(FILES data/plasma-scriptengine-applet-simple-javascript.desktop DESTINAT
# RUNNER
set(javascript_runner_engine_SRCS
common/javascriptaddonpackagestructure.cpp
common/scriptenv.cpp
runner/javascriptrunner.cpp
)
@ -71,9 +73,10 @@ install(FILES data/plasma-scriptengine-runner-javascript.desktop DESTINATION ${S
# DATAENGINE
set(javascript_dataengine_engine_SRCS
common/javascriptaddonpackagestructure.cpp
common/scriptenv.cpp
dataengine/javascriptdataengine.cpp
dataengine/javascriptservice.cpp
common/scriptenv.cpp
simplebindings/dataengine.cpp
simplebindings/variant.cpp
)
@ -88,5 +91,20 @@ target_link_libraries(plasma_dataenginescript_javascript
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})

View File

@ -0,0 +1,45 @@
/*
* 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 "javascriptaddonpackagestructure.h"
#include <KConfigGroup>
#include <KDesktopFile>
JavascriptAddonPackageStructure::JavascriptAddonPackageStructure(QObject *parent, const QVariantList &args)
: Plasma::PackageStructure(parent, "Plasma/JavascriptAddon")
{
Q_UNUSED(args)
setServicePrefix("plasma-javascriptaddon");
setDefaultPackageRoot("plasma/javascript-addons/");
addFileDefinition("mainscript", "code/main.js", i18n("Main Script File"));
setRequired("mainscript", true);
}
void JavascriptAddonPackageStructure::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"));
}
}
#include "javascriptaddonpackagestructure.moc"

View File

@ -26,24 +26,9 @@ class JavascriptAddonPackageStructure : public Plasma::PackageStructure
Q_OBJECT
public:
JavascriptAddonPackageStructure(QObject *parent = 0)
: Plasma::PackageStructure(parent)
{
setServicePrefix("plasma-layout-template");
setDefaultPackageRoot("plasma/javascript-addons/");
addFileDefinition("mainscript", "code/main.js", i18n("Main Script File"));
setRequired("mainscript", true);
}
JavascriptAddonPackageStructure(QObject *parent = 0, const QVariantList &args = QVariantList());
void 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"));
}
}
void pathChanged();
};
#endif

View File

@ -581,5 +581,4 @@ bool ScriptEnv::removeEventListener(const QString &event, const QScriptValue &fu
#ifndef USEGUI
#include "scriptenv.moc"
#include "javascriptaddonpackagestructure.moc"
#endif

View File

@ -19,5 +19,4 @@
#define USEGUI
#include "scriptenv.cpp"
#include "scriptenv.moc"
#include "javascriptaddonpackagestructure.moc"