diff --git a/src/shell/containmentconfigview.cpp b/src/shell/containmentconfigview.cpp index 078b0e253..6236dade5 100644 --- a/src/shell/containmentconfigview.cpp +++ b/src/shell/containmentconfigview.cpp @@ -41,6 +41,7 @@ ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow m_containment(cont), m_wallpaperConfigModel(0), m_containmentActionConfigModel(0), + m_currentContainmentActionConfigModel(0), m_currentWallpaperConfig(0), m_ownWallpaperConfig(0) { @@ -89,18 +90,24 @@ ConfigModel *ContainmentConfigView::containmentActionConfigModel() return m_containmentActionConfigModel; } -QVariantMap ContainmentConfigView::currentContainmentActions() const +ConfigModel *ContainmentConfigView::currentContainmentActionConfigModel() { - QHash actions = m_containment->containmentActions(); + if (!m_currentContainmentActionConfigModel) { + m_currentContainmentActionConfigModel = new ConfigModel(this); - QVariantMap actionsMap; + QHash actions = m_containment->containmentActions(); - QHash::const_iterator i = actions.constBegin(); - while (i != actions.constEnd()) { - actionsMap[i.key()] = i.value()->pluginInfo().name(); + QHashIterator i(actions); + while (i.hasNext()) { + i.next(); + + ConfigCategory *cat = new ConfigCategory(m_currentContainmentActionConfigModel); + cat->setName(i.key()); + cat->setPluginName(i.value()->pluginInfo().name()); + m_currentContainmentActionConfigModel->appendCategory(cat); + } } - - return actionsMap; + return m_currentContainmentActionConfigModel; } ConfigModel *ContainmentConfigView::wallpaperConfigModel() diff --git a/src/shell/containmentconfigview.h b/src/shell/containmentconfigview.h index c9177a7a2..bd286db78 100644 --- a/src/shell/containmentconfigview.h +++ b/src/shell/containmentconfigview.h @@ -34,7 +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 *currentContainmentActionConfigModel READ currentContainmentActionConfigModel CONSTANT) 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) @@ -46,7 +46,7 @@ public: virtual void init(); ConfigModel *containmentActionConfigModel(); - QVariantMap currentContainmentActions() const; + ConfigModel *currentContainmentActionConfigModel(); ConfigModel *wallpaperConfigModel(); QString currentWallpaper() const; void setCurrentWallpaper(const QString &wallpaper); @@ -57,7 +57,6 @@ public: Q_SIGNALS: void currentWallpaperChanged(); void wallpaperConfigurationChanged(); - void currentContainmentActionsChanged(); protected: void syncWallpaperObjects(); @@ -66,6 +65,7 @@ private: Plasma::Containment *m_containment; ConfigModel *m_wallpaperConfigModel; ConfigModel *m_containmentActionConfigModel; + ConfigModel *m_currentContainmentActionConfigModel; QString m_currentWallpaper; ConfigPropertyMap *m_currentWallpaperConfig; ConfigPropertyMap *m_ownWallpaperConfig; diff --git a/src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentActions.qml b/src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentActions.qml index c56d0ebd6..a1ed4f29a 100644 --- a/src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentActions.qml +++ b/src/shell/qmlpackages/desktop/contents/configuration/ConfigurationContainmentActions.qml @@ -31,7 +31,7 @@ Item { anchors.centerIn: parent Repeater { - model: 3 + model: configDialog.currentContainmentActionConfigModel delegate: RowLayout { width: root.width * 0.8 QtControls.Button { @@ -58,6 +58,12 @@ Item { } QtControls.Button { text: "Add Action" + onClicked: { + for (var i in configDialog.currentContainmentActions) { + print("AAA"+i+configDialog.currentContainmentActions[i]) + } + print(configDialog.currentContainmentActions) + } } }