Install all plasma files in a prefix/share/plasma directory

At the moment, we could say that plasma is co-installable by chance,
it's only working because KF5 dropped the apps relative directory.
This change introduces a PLASMA_RELATIVE_DATA_INSTALL_DIR that will
be available to know where in share the components are and
PLASMA_DATA_INSTALL_DIR to know where data has to be installed to.

Reviewed by David Edmundson

CCMAIL: plasma-devel@kde.org
This commit is contained in:
Aleix Pol 2014-04-27 17:14:22 +02:00
parent d149d719a9
commit e6f1fec0c7
23 changed files with 109 additions and 92 deletions

View File

@ -2,6 +2,8 @@
find_package(ECM 0.0.9 CONFIG REQUIRED)
include(KDEInstallDirs)
set(PLASMA_RELATIVE_DATA_INSTALL_DIR "plasma")
set(PLASMA_DATA_INSTALL_DIR "${DATA_INSTALL_DIR}/${PLASMA_RELATIVE_DATA_INSTALL_DIR}")
# plasma_install_package(path componentname [root] [type])
#
@ -9,26 +11,25 @@ include(KDEInstallDirs)
# @arg path The source path to install from, location of metadata.desktop
# @arg componentname The plugin name of the component, corresponding to the
# X-KDE-PluginInfo-Name key in metadata.desktop
# @arg root The subdirectory to install to, default: plasma/plasmoids
# @arg root The subdirectory to install to, default: plasma/plasmoids
# @arg root The subdirectory to install to, default: plasmoids
# @arg type The type, default to applet, or applet, package, containment,
# wallpaper, shell, lookandfeel, etc.
# @see Types column in plasmapkg --list-types
#
# Examples:
# plasma_install_package(mywidget org.kde.plasma.mywidget) # installs an applet
# plasma_install_package(declarativetoolbox org.kde.toolbox plasma/packages package) # installs a generic package
# plasma_install_package(declarativetoolbox org.kde.toolbox packages package) # installs a generic package
#
macro(plasma_install_package dir component)
set(root ${ARGV2})
set(type ${ARGV3})
if(NOT root)
set(root plasma/plasmoids)
set(root plasmoids)
endif()
if(NOT type)
set(type applet)
endif()
install(DIRECTORY ${dir}/ DESTINATION ${DATA_INSTALL_DIR}/${root}/${component} PATTERN .svn EXCLUDE PATTERN CMakeLists.txt EXCLUDE PATTERN Messages.sh EXCLUDE)
install(DIRECTORY ${dir}/ DESTINATION ${PLASMA_DATA_INSTALL_DIR}/${root}/${component} PATTERN .svn EXCLUDE PATTERN CMakeLists.txt EXCLUDE PATTERN Messages.sh EXCLUDE)
install(FILES ${dir}/metadata.desktop DESTINATION ${SERVICES_INSTALL_DIR} RENAME plasma-${type}-${component}.desktop)
endmacro()

View File

@ -1,2 +1,2 @@
plasma_install_package(testcontainment org.kde.example.testcontainment plasma/plasmoids containment)
plasma_install_package(testcontainment org.kde.example.testcontainment plasmoids containment)

View File

@ -12,6 +12,6 @@ target_link_libraries(plasma-example-kpart-shell KF5::Plasma KF5::Parts)
########### install files ###############
install(TARGETS plasma-example-kpart-shell ${KF5_INSTALL_TARGETS_DEFAULT_ARGS} )
install( PROGRAMS plasma-example-kpart-shell.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install( PROGRAMS plasma-example-kpart-shell.desktop DESTINATION ${XDG_APPS_INSTALL_DIR} )
install(FILES plasma-default-layoutrc DESTINATION ${DATA_INSTALL_DIR}/plasma-example-kpart-shell/)
install( FILES plasma-kpart-shellui.rc DESTINATION ${DATA_INSTALL_DIR}/plasma-example-kpart-shell/ )

View File

@ -1,2 +1,2 @@
plasma_install_package(autumn org.kde.autumn plasma/wallpapers wallpaper)
plasma_install_package(autumn org.kde.autumn wallpapers wallpaper)

View File

@ -41,8 +41,6 @@ QImage AppBackgroundProvider::requestImage(const QString &id, QSize *size, const
{
Q_UNUSED(size)
Q_UNUSED(requestedSize)
QString search = QLatin1Literal("desktoptheme/") % m_theme->themeName() % QLatin1Literal("/appbackgrounds/") % id % ".png";
search = QStandardPaths::locate(QStandardPaths::GenericDataLocation, search);
return QImage(search);
return QImage(m_theme->backgroundPath(id % ".png"));
}

View File

@ -1,24 +1,24 @@
install(FILES colors metadata.desktop DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/air/)
install(FILES colors metadata.desktop DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/air/)
FILE(GLOB widgets widgets/*.svgz)
install( FILES ${widgets} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/air/widgets/ )
install( FILES ${widgets} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/air/widgets/ )
FILE(GLOB dialogs dialogs/*.svgz)
install( FILES ${dialogs} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/air/dialogs/ )
install( FILES ${dialogs} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/air/dialogs/ )
FILE(GLOB opaque_dialogs opaque/dialogs/*.svgz)
install( FILES ${opaque_dialogs} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/air/opaque/dialogs/ )
install( FILES ${opaque_dialogs} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/air/opaque/dialogs/ )
FILE(GLOB opaque_widgets opaque/widgets/*.svgz)
install( FILES ${opaque_widgets} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/air/opaque/widgets/ )
install( FILES ${opaque_widgets} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/air/opaque/widgets/ )
FILE(GLOB translucent_widgets translucent/widgets/*.svgz)
install( FILES ${translucent_widgets} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/air/translucent/widgets/ )
install( FILES ${translucent_widgets} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/air/translucent/widgets/ )
FILE(GLOB translucent_dialogs translucent/dialogs/*.svgz)
install( FILES ${translucent_dialogs} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/air/translucent/dialogs/ )
install( FILES ${translucent_dialogs} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/air/translucent/dialogs/ )
FILE(GLOB icons icons/*.svgz)
install( FILES ${icons} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/air/icons/ )
install( FILES ${icons} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/air/icons/ )

View File

@ -1,2 +1,2 @@
install(FILES colors metadata.desktop DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/breeze-dark/)
install(FILES colors metadata.desktop DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/breeze-dark/)

View File

@ -1,24 +1,24 @@
install(FILES colors metadata.desktop DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/)
install(FILES colors metadata.desktop DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default/)
FILE(GLOB widgets widgets/*.svgz)
install( FILES ${widgets} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/widgets/ )
install( FILES ${widgets} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default/widgets/ )
FILE(GLOB dialogs dialogs/*.svgz)
install( FILES ${dialogs} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/dialogs/ )
install( FILES ${dialogs} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default/dialogs/ )
FILE(GLOB opaque_dialogs opaque/dialogs/*.svgz)
install( FILES ${opaque_dialogs} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/opaque/dialogs/ )
install( FILES ${opaque_dialogs} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default/opaque/dialogs/ )
FILE(GLOB opaque_widgets opaque/widgets/*.svgz)
install( FILES ${opaque_widgets} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/opaque/widgets/ )
install( FILES ${opaque_widgets} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default/opaque/widgets/ )
FILE(GLOB translucent_widgets translucent/widgets/*.svgz)
install( FILES ${translucent_widgets} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/translucent/widgets/ )
install( FILES ${translucent_widgets} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default/translucent/widgets/ )
FILE(GLOB translucent_dialogs translucent/dialogs/*.svgz)
install( FILES ${translucent_dialogs} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/translucent/dialogs/ )
install( FILES ${translucent_dialogs} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default/translucent/dialogs/ )
FILE(GLOB icons icons/*.svgz)
install( FILES ${icons} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/default/icons/ )
install( FILES ${icons} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/default/icons/ )

View File

@ -1,18 +1,18 @@
install(FILES colors metadata.desktop DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/oxygen/)
install(FILES colors metadata.desktop DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/oxygen/)
FILE(GLOB widgets widgets/*.svgz)
install( FILES ${widgets} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/oxygen/widgets/ )
install( FILES ${widgets} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/oxygen/widgets/ )
FILE(GLOB dialogs dialogs/*.svgz)
install( FILES ${dialogs} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/oxygen/dialogs/ )
install( FILES ${dialogs} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/oxygen/dialogs/ )
FILE(GLOB opaque opaque/widgets/*.svgz)
install( FILES ${opaque} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/oxygen/opaque/widgets/ )
install( FILES ${opaque} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/oxygen/opaque/widgets/ )
FILE(GLOB opaque opaque/dialogs/*.svgz)
install( FILES ${opaque} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/oxygen/opaque/dialogs/ )
install( FILES ${opaque} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/oxygen/opaque/dialogs/ )
FILE(GLOB icons ../air/icons/*.svgz)
install( FILES ${icons} DESTINATION ${DATA_INSTALL_DIR}/desktoptheme/oxygen/icons/ )
install( FILES ${icons} DESTINATION ${PLASMA_DATA_INSTALL_DIR}/desktoptheme/oxygen/icons/ )

View File

@ -200,9 +200,9 @@ install(FILES
data/servicetypes/plasma-lookandfeel.desktop
DESTINATION ${SERVICETYPES_INSTALL_DIR})
install(FILES data/operations/dataengineservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/operations/plasmoidservice.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/operations/storage.operations DESTINATION ${DATA_INSTALL_DIR}/plasma/services)
install(FILES data/operations/dataengineservice.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
install(FILES data/operations/plasmoidservice.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
install(FILES data/operations/storage.operations DESTINATION ${PLASMA_DATA_INSTALL_DIR}/services)
install(TARGETS KF5Plasma EXPORT KF5PlasmaTargets ${KF5_INSTALL_TARGETS_DEFAULT_ARGS})

View File

@ -4,3 +4,5 @@
#cmakedefine01 HAVE_X11
#cmakedefine01 HAVE_GLX
#cmakedefine01 HAVE_EGL
#define PLASMA_RELATIVE_DATA_INSTALL_DIR "@PLASMA_RELATIVE_DATA_INSTALL_DIR@"

View File

@ -45,6 +45,7 @@
#include "private/datacontainer_p.h"
#include "private/service_p.h"
#include "private/storage_p.h"
#include "config-plasma.h"
namespace Plasma
{
@ -430,7 +431,7 @@ DataEnginePrivate::DataEnginePrivate(DataEngine *e, const KPluginInfo &info)
if (!api.isEmpty()) {
const QString path =
QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"plasma/dataengines/" + dataEngineDescription.pluginName() + '/',
PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/" + dataEngineDescription.pluginName() + '/',
QStandardPaths::LocateDirectory);
package = new Package(PluginLoader::self()->loadPackage("Plasma/DataEngine", api));
package->setPath(path);

View File

@ -79,7 +79,7 @@ void GenericPackage::initPackage(Package *package)
package->setContentsPrefixPaths(platform);
}
package->setDefaultPackageRoot("plasma/packages/");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/");
package->addDirectoryDefinition("images", "images", i18n("Images"));
package->addDirectoryDefinition("theme", "theme", i18n("Themed Images"));
@ -109,7 +109,7 @@ void PlasmoidPackage::initPackage(Package *package)
{
GenericPackage::initPackage(package);
package->setServicePrefix("plasma-applet-");
package->setDefaultPackageRoot("plasma/plasmoids/");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/");
package->addFileDefinition("configmodel", "config/config.qml", i18n("Configuration UI pages model"));
package->addFileDefinition("mainconfigxml", "config/main.xml", i18n("Configuration XML file"));
@ -124,7 +124,7 @@ void DataEnginePackage::initPackage(Package *package)
{
ChangeableMainScriptPackage::initPackage(package);
package->setServicePrefix("plasma-dataengine-");
package->setDefaultPackageRoot("plasma/dataengines/");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/");
package->addDirectoryDefinition("data", "data", i18n("Data Files"));
@ -238,12 +238,12 @@ void ThemePackage::initPackage(Package *package)
void ContainmentActionsPackage::initPackage(Package *package)
{
ChangeableMainScriptPackage::initPackage(package);
package->setDefaultPackageRoot("plasma/containmentactions/");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/containmentactions/");
}
void ShellPackage::initPackage(Plasma::Package *package)
{
package->setDefaultPackageRoot("plasma/shells/");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/shells/");
//Directories
package->addDirectoryDefinition("applet", "applet", i18n("Applets furniture"));

View File

@ -146,9 +146,10 @@ bool ThemePrivate::useCache()
if (!themeMetadataPath.isEmpty()) {
KDirWatch::self()->removeFile(themeMetadataPath);
}
themeMetadataPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % themeName % QLatin1Literal("/metadata.desktop"));
if (isRegularTheme) {
themeMetadataPath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % themeName % QLatin1Literal("/metadata.desktop"));
Q_ASSERT(!themeMetadataPath.isEmpty() || themeName.isEmpty());
const QString cacheFileBase = cacheFile + QStringLiteral("*.kcache");
QString currentCacheFileName;
@ -236,6 +237,12 @@ void ThemePrivate::onAppExitCleanup()
cacheTheme = false;
}
QString ThemePrivate::imagePath(const QString& theme, const QString& type, const QString& image)
{
QString subdir = QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % type % image;
return QStandardPaths::locate(QStandardPaths::GenericDataLocation, subdir);
}
QString ThemePrivate::findInTheme(const QString &image, const QString &theme, bool cache)
{
if (cache) {
@ -245,23 +252,20 @@ QString ThemePrivate::findInTheme(const QString &image, const QString &theme, bo
}
}
QString search;
QString type;
if (locolor) {
search = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/locolor/") % image;
search = QStandardPaths::locate(QStandardPaths::GenericDataLocation, search);
type = QStringLiteral("/locolor/");
} else if (!compositingActive) {
search = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/opaque/") % image;
search = QStandardPaths::locate(QStandardPaths::GenericDataLocation, search);
type = QStringLiteral("/opaque/");
} else if (KWindowEffects::isEffectAvailable(KWindowEffects::BlurBehind)) {
search = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/translucent/") % image;
search = QStandardPaths::locate(QStandardPaths::GenericDataLocation, search);
type = QStringLiteral("/translucent/");
}
QString search = imagePath(theme, type, image);
//not found or compositing enabled
if (search.isEmpty()) {
search = QLatin1Literal("desktoptheme/") % theme % QLatin1Char('/') % image;
search = QStandardPaths::locate(QStandardPaths::GenericDataLocation, search);
search = imagePath(theme, QStringLiteral("/"), image);
}
if (cache && !search.isEmpty()) {
@ -567,15 +571,14 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
return;
}
}
qDebug() << tempThemeName;
// we have one special theme: essentially a dummy theme used to cache things with
// the system colors.
bool realTheme = theme != systemColorsTheme;
if (realTheme) {
QString themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % theme % QLatin1Char('/'));
QString themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Char('/'));
if (themePath.isEmpty() && themeName.isEmpty()) {
themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral("desktoptheme/default"), QStandardPaths::LocateDirectory);
themePath = QStandardPaths::locate(QStandardPaths::GenericDataLocation, QStringLiteral(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/default"), QStandardPaths::LocateDirectory);
if (themePath.isEmpty()) {
return;
@ -593,7 +596,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
themeName = theme;
// load the color scheme config
const QString colorsFile = realTheme ? QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/colors"))
const QString colorsFile = realTheme ? QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/colors"))
: QString();
//qDebug() << "we're going for..." << colorsFile << "*******************";
@ -613,12 +616,12 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
colorScheme = KColorScheme(QPalette::Active, KColorScheme::Window, colors);
buttonColorScheme = KColorScheme(QPalette::Active, KColorScheme::Button, colors);
viewColorScheme = KColorScheme(QPalette::Active, KColorScheme::View, colors);
const QString wallpaperPath = QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/wallpapers/");
const QString wallpaperPath = QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/wallpapers/");
hasWallpapers = !QStandardPaths::locate(QStandardPaths::GenericDataLocation, wallpaperPath, QStandardPaths::LocateDirectory).isEmpty();
// load the wallpaper settings, if any
if (realTheme) {
const QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
const QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
KConfig metadata(metadataPath);
pluginInfo = KPluginInfo(metadataPath);
@ -633,7 +636,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
while (!fallback.isEmpty() && !fallbackThemes.contains(fallback)) {
fallbackThemes.append(fallback);
QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
KConfig metadata(metadataPath);
KConfigGroup cg(&metadata, "Settings");
fallback = cg.readEntry("FallbackTheme", QString());
@ -644,7 +647,7 @@ void ThemePrivate::setThemeName(const QString &tempThemeName, bool writeSettings
}
foreach (const QString &theme, fallbackThemes) {
QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal("desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
QString metadataPath(QStandardPaths::locate(QStandardPaths::GenericDataLocation, QLatin1Literal(PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/") % theme % QLatin1Literal("/metadata.desktop")));
KConfig metadata(metadataPath);
processWallpaperSettings(&metadata);
}

View File

@ -72,6 +72,7 @@ public:
KConfigGroup &config();
QString imagePath(const QString &theme, const QString &type, const QString &image);
QString findInTheme(const QString &image, const QString &theme, bool cache = true);
void discardCache(CacheTypes caches);
void scheduleThemeChangeNotification(CacheTypes caches);

View File

@ -199,7 +199,7 @@ void Service::registerOperationsScheme()
return;
}
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, "plasma/services/" + d->name + ".operations");
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation, PLASMA_RELATIVE_DATA_INSTALL_DIR "/services/" + d->name + ".operations");
if (path.isEmpty()) {
#ifndef NDEBUG

View File

@ -199,6 +199,11 @@ QString Theme::imagePath(const QString &name) const
return path;
}
QString Theme::backgroundPath(const QString& image) const
{
return d->imagePath(themeName(), QLatin1Literal("/appbackgrounds/"), image);
}
QString Theme::styleSheet(const QString &css) const
{
return d->processStyleSheet(css);

View File

@ -487,6 +487,8 @@ public:
*/
Q_INVOKABLE QSizeF mSize(const QFont &font = QApplication::font()) const;
QString backgroundPath(const QString &image) const;
Q_SIGNALS:
/**
* Emitted when the user changes the theme. Stylesheet usage, colors, etc. should

View File

@ -45,6 +45,8 @@
#include <iostream>
#include <iomanip>
#include "config-plasma.h"
static QTextStream cout(stdout);
namespace Plasma
@ -189,18 +191,18 @@ void PlasmaPkg::runMain()
if (type.compare(i18nc("package type", "plasmoid"), Qt::CaseInsensitive) == 0 ||
type.compare("plasmoid", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/plasmoids/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/";
d->servicePrefix = "plasma-applet-";
d->pluginTypes << "Plasma/Applet";
d->pluginTypes << "Plasma/Containment";
} else if (type.compare(i18nc("package type", "package"), Qt::CaseInsensitive) == 0 /*||
type.compare("theme", Qt::CaseInsensitive) == 0*/) {
d->packageRoot = "plasma/packages/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/";
d->servicePrefix = "plasma-package-";
d->pluginTypes << "Plasma/Generic";
} else if (type.compare(i18nc("package type", "theme"), Qt::CaseInsensitive) == 0 ||
type.compare("theme", Qt::CaseInsensitive) == 0) {
d->packageRoot = "desktoptheme/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/";
d->pluginTypes << "Plasma/Theme";
} else if (type.compare(i18nc("package type", "wallpaper"), Qt::CaseInsensitive) == 0 ||
type.compare("wallpaper", Qt::CaseInsensitive) == 0) {
@ -209,32 +211,32 @@ void PlasmaPkg::runMain()
d->servicePrefix = "plasma-wallpaper-";
} else if (type.compare(i18nc("package type", "dataengine"), Qt::CaseInsensitive) == 0 ||
type.compare("dataengine", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/dataengines/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/";
d->servicePrefix = "plasma-dataengine-";
d->pluginTypes << "Plasma/DataEngine";
} else if (type.compare(i18nc("package type", "runner"), Qt::CaseInsensitive) == 0 ||
type.compare("runner", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/runners/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/runners/";
d->servicePrefix = "plasma-runner-";
d->pluginTypes << "Plasma/Runner";
} else if (type.compare(i18nc("package type", "wallpaperplugin"), Qt::CaseInsensitive) == 0 ||
type.compare("wallpaperplugin", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/wallpapers/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/";
d->servicePrefix = "plasma-wallpaper-";
d->pluginTypes << "Plasma/Wallpaper";
} else if (type.compare(i18nc("package type", "lookandfeel"), Qt::CaseInsensitive) == 0 ||
type.compare("lookandfeel", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/look-and-feel/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/";
d->servicePrefix = "plasma-lookandfeel-";
d->pluginTypes << "Plasma/LookAndFeel";
} else if (type.compare(i18nc("package type", "shell"), Qt::CaseInsensitive) == 0 ||
type.compare("shell", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/shells/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/shells/";
d->servicePrefix = "plasma-shell-";
d->pluginTypes << "Plasma/Shell";
} else if (type.compare(i18nc("package type", "layout-template"), Qt::CaseInsensitive) == 0 ||
type.compare("layout-template", Qt::CaseInsensitive) == 0) {
d->packageRoot = "plasma/layout-templates/";
d->packageRoot = PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates/";
d->servicePrefix = "plasma-layout-";
d->pluginTypes << "Plasma/LayoutTemplate";
} else if (type.compare(i18nc("package type", "kwineffect"), Qt::CaseInsensitive) == 0 ||
@ -396,7 +398,7 @@ QStringList PlasmaPkgPrivate::packages(const QStringList &types)
foreach (const QString &type, types) {
if (type.compare("Plasma/Generic", Qt::CaseInsensitive) == 0) {
const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "plasma/packages/", QStandardPaths::LocateDirectory);
const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/", QStandardPaths::LocateDirectory);
foreach (const QString &ppath, packs) {
const QDir cd(ppath);
const QStringList &entries = cd.entryList(QDir::Dirs);
@ -426,7 +428,7 @@ QStringList PlasmaPkgPrivate::packages(const QStringList &types)
}
if (type.compare("Plasma/Theme", Qt::CaseInsensitive) == 0) {
const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, "desktoptheme/", QStandardPaths::LocateDirectory);
const QStringList &packs = QStandardPaths::locateAll(QStandardPaths::GenericDataLocation, PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/", QStandardPaths::LocateDirectory);
foreach (const QString &ppath, packs) {
const QDir cd(ppath);
const QStringList &entries = cd.entryList(QDir::Dirs);
@ -567,16 +569,16 @@ void PlasmaPkgPrivate::listTypes()
coutput(i18n("Built in:"));
QMap<QString, QStringList> builtIns;
builtIns.insert(i18n("DataEngine"), QStringList() << "Plasma/DataEngine" << "plasma/dataengines/" << "dataengine");
builtIns.insert(i18n("Layout Template"), QStringList() << "Plasma/LayoutTemplate" << "plasma/layout-templates/" << "layout-template");
builtIns.insert(i18n("Look and Feel"), QStringList() << "Plasma/LookAndFeel" << "plasma/look-and-feel/" << "lookandfeel");
builtIns.insert(i18n("Package"), QStringList() << "Plasma/Generic" << "plasma/packages/" << "package");
builtIns.insert(i18n("Plasmoid"), QStringList() << "Plasma/Applet" << "plasma/plasmoids/" << "plasmoid");
builtIns.insert(i18n("Runner"), QStringList() << "Plasma/Runner" << "plasma/runners/" << "runner");
builtIns.insert(i18n("Shell"), QStringList() << "Plasma/Shell" << "plasma/shells/" << "shell");
builtIns.insert(i18n("Theme"), QStringList() << "" << "desktoptheme/" << "theme");
builtIns.insert(i18n("DataEngine"), QStringList() << "Plasma/DataEngine" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/dataengines/" << "dataengine");
builtIns.insert(i18n("Layout Template"), QStringList() << "Plasma/LayoutTemplate" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates/" << "layout-template");
builtIns.insert(i18n("Look and Feel"), QStringList() << "Plasma/LookAndFeel" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/" << "lookandfeel");
builtIns.insert(i18n("Package"), QStringList() << "Plasma/Generic" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/packages/" << "package");
builtIns.insert(i18n("Plasmoid"), QStringList() << "Plasma/Applet" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/plasmoids/" << "plasmoid");
builtIns.insert(i18n("Runner"), QStringList() << "Plasma/Runner" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/runners/" << "runner");
builtIns.insert(i18n("Shell"), QStringList() << "Plasma/Shell" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/shells/" << "shell");
builtIns.insert(i18n("Theme"), QStringList() << "" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/desktoptheme/" << "theme");
builtIns.insert(i18n("Wallpaper Images"), QStringList() << "" << "wallpapers/" << "wallpaper");
builtIns.insert(i18n("Animated Wallpaper"), QStringList() << "Plasma/Wallpaper" << "plasma/wallpapers/" << "wallpaperplugin");
builtIns.insert(i18n("Animated Wallpaper"), QStringList() << "Plasma/Wallpaper" << PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/" << "wallpaperplugin");
builtIns.insert(i18n("KWin Effect"), QStringList() << "KWin/Effect" << "kwin/effects/" << "kwineffect");
builtIns.insert(i18n("KWin Window Switcher"), QStringList() << "KWin/WindowSwitcher" << "kwin/tabbox/" << "windowswitcher");
builtIns.insert(i18n("KWin Script"), QStringList() << "KWin/Script" << "kwin/scripts/" << "kwinscript");
@ -607,7 +609,7 @@ void PlasmaPkgPrivate::listTypes()
renderTypeTable(plugins);
}
QStringList desktopFiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, "plasma/packageformats/*rc", QStandardPaths::LocateFile);
QStringList desktopFiles = QStandardPaths::locateAll(QStandardPaths::DataLocation, PLASMA_RELATIVE_DATA_INSTALL_DIR "/packageformats/*rc", QStandardPaths::LocateFile);
if (!desktopFiles.isEmpty()) {
coutput(i18n("Provided by .desktop files:"));

View File

@ -26,12 +26,13 @@
#include <kdeclarative/kdeclarative.h>
#include <Plasma/Package>
#include "../plasma/config-plasma.h"
void LookAndFeelPackage::initPackage(Plasma::Package *package)
{
// http://community.kde.org/Plasma/lookAndFeelPackage#
package->setDefaultPackageRoot("plasma/look-and-feel/");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/look-and-feel/");
//Defaults
package->addFileDefinition("defaults", "defaults", i18n("Default settings for theme, etc."));
@ -97,7 +98,7 @@ void QmlWallpaperPackage::initPackage(Plasma::Package *package)
package->setContentsPrefixPaths(platform);
}
package->setDefaultPackageRoot("plasma/wallpapers/");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/wallpapers/");
package->addDirectoryDefinition("images", "images", i18n("Images"));
package->addDirectoryDefinition("theme", "theme", i18n("Themed Images"));
@ -126,7 +127,7 @@ void QmlWallpaperPackage::initPackage(Plasma::Package *package)
void LayoutTemplatePackage::initPackage(Plasma::Package *package)
{
package->setServicePrefix("plasma-layout-template");
package->setDefaultPackageRoot("plasma/layout-templates");
package->setDefaultPackageRoot(PLASMA_RELATIVE_DATA_INSTALL_DIR "/layout-templates");
package->addFileDefinition("mainscript", "layout.js", i18n("Main Script File"));
package->setRequired("mainscript", true);
}

View File

@ -11,6 +11,7 @@
#include <qstandardpaths.h>
#include "platformstatusadaptor.h"
#include "../plasma/config-plasma.h"
const char *defaultPackage = "org.kde.desktop";
@ -35,7 +36,7 @@ void PlatformStatus::findShellPackage(bool sendSignal)
const QString package = group.readEntry("shellPackage", defaultPackage);
const QString path = QStandardPaths::locate(QStandardPaths::GenericDataLocation,
"plasma/shells/" + package + '/',
PLASMA_RELATIVE_DATA_INSTALL_DIR "/shells/" + package + '/',
QStandardPaths::LocateDirectory);
if (path.isEmpty()) {
if (package != defaultPackage) {

View File

@ -3,8 +3,8 @@ project(plasma-python)
include(PythonMacros)
# install the library, .desktop, and plasma.py
python_install(plasma_importer.py ${DATA_INSTALL_DIR}/plasma_scriptengine_python)
python_install(pydataengine.py ${DATA_INSTALL_DIR}/plasma_scriptengine_python)
python_install(plasma_importer.py ${PLASMA_DATA_INSTALL_DIR}/plasma_scriptengine_python)
python_install(pydataengine.py ${PLASMA_DATA_INSTALL_DIR}/plasma_scriptengine_python)
# remove the following three lines once we branch 4.5, they are only necessary as long
# as people update kdebase but not yet kdelibs (PYTHON_SITE_PACKAGES_INSTALL_DIR has just

View File

@ -1,4 +1,4 @@
install(FILES data_engine.rb DESTINATION ${DATA_INSTALL_DIR}/plasma_scriptengine_ruby)
install(FILES data_engine.rb DESTINATION ${PLASMA_DATA_INSTALL_DIR}/plasma_scriptengine_ruby)
install(FILES plasma-scriptengine-ruby-dataengine.desktop DESTINATION ${SERVICES_INSTALL_DIR})