try to add a config
This commit is contained in:
parent
be06b06015
commit
f5664e8b3f
@ -34,12 +34,9 @@
|
||||
WallpaperInterface::WallpaperInterface(ContainmentInterface *parent)
|
||||
: QQuickItem(parent),
|
||||
m_containmentInterface(parent),
|
||||
m_qmlObject(0)
|
||||
m_qmlObject(0),
|
||||
m_configLoader(0)
|
||||
{
|
||||
if (configScheme()) {
|
||||
m_configuration = new ConfigPropertyMap(configScheme(), this);
|
||||
}
|
||||
|
||||
connect(m_containmentInterface->containment(), &Plasma::Containment::wallpaperChanged,
|
||||
this, &WallpaperInterface::syncWallpaperPackage);
|
||||
|
||||
@ -64,8 +61,10 @@ Plasma::ConfigLoader *WallpaperInterface::configScheme()
|
||||
{
|
||||
if (!m_configLoader) {
|
||||
const QString xmlPath = m_pkg.filePath("mainconfigxml");
|
||||
|
||||
KConfigGroup cfg = m_containmentInterface->containment()->config();
|
||||
cfg = KConfigGroup(&cfg, "Wallpaper");
|
||||
|
||||
if (xmlPath.isEmpty()) {
|
||||
m_configLoader = new Plasma::ConfigLoader(&cfg, 0);
|
||||
} else {
|
||||
@ -88,6 +87,10 @@ void WallpaperInterface::syncWallpaperPackage()
|
||||
m_pkg.setDefaultPackageRoot("plasma/wallpapers");
|
||||
m_pkg.setPath(m_containmentInterface->containment()->wallpaper());
|
||||
|
||||
if (configScheme()) {
|
||||
m_configuration = new ConfigPropertyMap(configScheme(), this);
|
||||
}
|
||||
|
||||
m_qmlObject->setSource(QUrl::fromLocalFile(m_pkg.filePath("mainscript")));
|
||||
m_qmlObject->engine()->rootContext()->setContextProperty("wallpaper", this);
|
||||
m_qmlObject->completeInitialization();
|
||||
|
15
src/shell/qmlpackages/wallpaper/contents/config/main.xml
Normal file
15
src/shell/qmlpackages/wallpaper/contents/config/main.xml
Normal file
@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<kcfg xmlns="http://www.kde.org/standards/kcfg/1.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://www.kde.org/standards/kcfg/1.0
|
||||
http://www.kde.org/standards/kcfg/1.0/kcfg.xsd" >
|
||||
<kcfgfile name=""/>
|
||||
|
||||
<group name="General">
|
||||
<entry name="Color" type="Color">
|
||||
<label>Color of the wallpaper</label>
|
||||
<default>#0000ff</default>
|
||||
</entry>
|
||||
</group>
|
||||
|
||||
</kcfg>
|
@ -20,6 +20,6 @@ import QtQuick 2.0
|
||||
|
||||
Rectangle {
|
||||
id: root
|
||||
color: "darkblue"
|
||||
|
||||
color: wallpaper.configuration.Color
|
||||
Text{text:"Color:"+wallpaper.configuration.Color}
|
||||
}
|
Loading…
Reference in New Issue
Block a user