use kdeclarative in configview
export current containment actions
This commit is contained in:
parent
4fcedcbc46
commit
d025f583b2
@ -32,6 +32,7 @@
|
||||
|
||||
#include <KGlobal>
|
||||
#include <KLocalizedString>
|
||||
#include <kdeclarative/kdeclarative.h>
|
||||
|
||||
#include <Plasma/Corona>
|
||||
#include <Plasma/PluginLoader>
|
||||
@ -266,6 +267,9 @@ ConfigView::ConfigView(Plasma::Applet *applet, QWindow *parent)
|
||||
m_applet(applet)
|
||||
{
|
||||
applet->setUserConfiguring(true);
|
||||
KDeclarative kdeclarative;
|
||||
kdeclarative.setDeclarativeEngine(engine());
|
||||
kdeclarative.setupBindings();
|
||||
qmlRegisterType<ConfigModel>("org.kde.plasma.configuration", 2, 0, "ConfigModel");
|
||||
qmlRegisterType<ConfigCategory>("org.kde.plasma.configuration", 2, 0, "ConfigCategory");
|
||||
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include <KLocalizedString>
|
||||
|
||||
#include <Plasma/Corona>
|
||||
#include <Plasma/ContainmentActions>
|
||||
#include <Plasma/PluginLoader>
|
||||
|
||||
|
||||
@ -88,6 +89,20 @@ ConfigModel *ContainmentConfigView::containmentActionConfigModel()
|
||||
return m_containmentActionConfigModel;
|
||||
}
|
||||
|
||||
QVariantMap ContainmentConfigView::currentContainmentActions() const
|
||||
{
|
||||
QHash<QString, Plasma::ContainmentActions*> actions = m_containment->containmentActions();
|
||||
|
||||
QVariantMap actionsMap;
|
||||
|
||||
QHash<QString, Plasma::ContainmentActions*>::const_iterator i = actions.constBegin();
|
||||
while (i != actions.constEnd()) {
|
||||
actionsMap[i.key()] = i.value()->pluginInfo().name();
|
||||
}
|
||||
|
||||
return actionsMap;
|
||||
}
|
||||
|
||||
ConfigModel *ContainmentConfigView::wallpaperConfigModel()
|
||||
{
|
||||
if (!m_wallpaperConfigModel) {
|
||||
|
@ -34,6 +34,7 @@ class ContainmentConfigView : public ConfigView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(ConfigModel *containmentActionConfigModel READ containmentActionConfigModel CONSTANT)
|
||||
Q_PROPERTY(QVariantMap currentContainmentActions READ currentContainmentActions NOTIFY currentContainmentActionsChanged)
|
||||
Q_PROPERTY(ConfigModel *wallpaperConfigModel READ wallpaperConfigModel CONSTANT)
|
||||
Q_PROPERTY(ConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY wallpaperConfigurationChanged)
|
||||
Q_PROPERTY(QString currentWallpaper READ currentWallpaper WRITE setCurrentWallpaper NOTIFY currentWallpaperChanged)
|
||||
@ -45,6 +46,7 @@ public:
|
||||
virtual void init();
|
||||
|
||||
ConfigModel *containmentActionConfigModel();
|
||||
QVariantMap currentContainmentActions() const;
|
||||
ConfigModel *wallpaperConfigModel();
|
||||
QString currentWallpaper() const;
|
||||
void setCurrentWallpaper(const QString &wallpaper);
|
||||
@ -55,6 +57,7 @@ public:
|
||||
Q_SIGNALS:
|
||||
void currentWallpaperChanged();
|
||||
void wallpaperConfigurationChanged();
|
||||
void currentContainmentActionsChanged();
|
||||
|
||||
protected:
|
||||
void syncWallpaperObjects();
|
||||
|
Loading…
Reference in New Issue
Block a user