Commit 786951fe authored by Marco Martin's avatar Marco Martin
Browse files

support userBackgroundhints in the scripting ui

Summary: bind userBackgroundHints to the desktopscript interface

Test Plan:
from the scripting console is possible to correctly change applets background and
it gets immediately applied

Reviewers: #plasma

Subscribers: apol, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D25744
parent a1371138
......@@ -20,6 +20,7 @@
#include "widget.h"
#include <QAction>
#include <QMetaEnum>
#include <Plasma/Applet>
#include <Plasma/Containment>
......@@ -176,6 +177,22 @@ void Widget::showConfigurationInterface()
}*/
}
QString Widget::userBackgroundHints() const
{qWarning()<<"DJENT";
QMetaEnum hintEnum = QMetaEnum::fromType<Plasma::Types::BackgroundHints>();
return hintEnum.valueToKey(applet()->userBackgroundHints());
}
void Widget::setUserBackgroundHints(QString hint)
{
QMetaEnum hintEnum = QMetaEnum::fromType<Plasma::Types::BackgroundHints>();
bool ok;
int value = hintEnum.keyToValue(hint.toUtf8().constData(), &ok);
if (ok) {
applet()->setUserBackgroundHints(Plasma::Types::BackgroundHints(value));
}
}
}
......
......@@ -49,6 +49,7 @@ class Widget : public Applet
Q_PROPERTY(QStringList currentConfigGroup WRITE setCurrentConfigGroup READ currentConfigGroup)
Q_PROPERTY(QString globalShortcut WRITE setGlobalShortcut READ globalShorcut)
Q_PROPERTY(bool locked READ locked WRITE setLocked)
Q_PROPERTY(QString userBackgroundHints WRITE setUserBackgroundHints READ userBackgroundHints)
public:
explicit Widget(Plasma::Applet *applet, QObject *parent = nullptr);
......@@ -66,6 +67,9 @@ public:
void setGlobalShortcut(const QString &shortcut);
QString globalShorcut() const;
QString userBackgroundHints() const;
void setUserBackgroundHints(QString hint);
Plasma::Applet *applet() const override;
public Q_SLOTS:
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment