put the current containment actions in a ConfigModel
This commit is contained in:
parent
d025f583b2
commit
0502f8f972
@ -41,6 +41,7 @@ ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow
|
|||||||
m_containment(cont),
|
m_containment(cont),
|
||||||
m_wallpaperConfigModel(0),
|
m_wallpaperConfigModel(0),
|
||||||
m_containmentActionConfigModel(0),
|
m_containmentActionConfigModel(0),
|
||||||
|
m_currentContainmentActionConfigModel(0),
|
||||||
m_currentWallpaperConfig(0),
|
m_currentWallpaperConfig(0),
|
||||||
m_ownWallpaperConfig(0)
|
m_ownWallpaperConfig(0)
|
||||||
{
|
{
|
||||||
@ -89,18 +90,24 @@ ConfigModel *ContainmentConfigView::containmentActionConfigModel()
|
|||||||
return m_containmentActionConfigModel;
|
return m_containmentActionConfigModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariantMap ContainmentConfigView::currentContainmentActions() const
|
ConfigModel *ContainmentConfigView::currentContainmentActionConfigModel()
|
||||||
{
|
{
|
||||||
|
if (!m_currentContainmentActionConfigModel) {
|
||||||
|
m_currentContainmentActionConfigModel = new ConfigModel(this);
|
||||||
|
|
||||||
QHash<QString, Plasma::ContainmentActions*> actions = m_containment->containmentActions();
|
QHash<QString, Plasma::ContainmentActions*> actions = m_containment->containmentActions();
|
||||||
|
|
||||||
QVariantMap actionsMap;
|
QHashIterator<QString, Plasma::ContainmentActions*> i(actions);
|
||||||
|
while (i.hasNext()) {
|
||||||
|
i.next();
|
||||||
|
|
||||||
QHash<QString, Plasma::ContainmentActions*>::const_iterator i = actions.constBegin();
|
ConfigCategory *cat = new ConfigCategory(m_currentContainmentActionConfigModel);
|
||||||
while (i != actions.constEnd()) {
|
cat->setName(i.key());
|
||||||
actionsMap[i.key()] = i.value()->pluginInfo().name();
|
cat->setPluginName(i.value()->pluginInfo().name());
|
||||||
|
m_currentContainmentActionConfigModel->appendCategory(cat);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return actionsMap;
|
return m_currentContainmentActionConfigModel;
|
||||||
}
|
}
|
||||||
|
|
||||||
ConfigModel *ContainmentConfigView::wallpaperConfigModel()
|
ConfigModel *ContainmentConfigView::wallpaperConfigModel()
|
||||||
|
@ -34,7 +34,7 @@ class ContainmentConfigView : public ConfigView
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
Q_PROPERTY(ConfigModel *containmentActionConfigModel READ containmentActionConfigModel CONSTANT)
|
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(ConfigModel *wallpaperConfigModel READ wallpaperConfigModel CONSTANT)
|
||||||
Q_PROPERTY(ConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY wallpaperConfigurationChanged)
|
Q_PROPERTY(ConfigPropertyMap *wallpaperConfiguration READ wallpaperConfiguration NOTIFY wallpaperConfigurationChanged)
|
||||||
Q_PROPERTY(QString currentWallpaper READ currentWallpaper WRITE setCurrentWallpaper NOTIFY currentWallpaperChanged)
|
Q_PROPERTY(QString currentWallpaper READ currentWallpaper WRITE setCurrentWallpaper NOTIFY currentWallpaperChanged)
|
||||||
@ -46,7 +46,7 @@ public:
|
|||||||
virtual void init();
|
virtual void init();
|
||||||
|
|
||||||
ConfigModel *containmentActionConfigModel();
|
ConfigModel *containmentActionConfigModel();
|
||||||
QVariantMap currentContainmentActions() const;
|
ConfigModel *currentContainmentActionConfigModel();
|
||||||
ConfigModel *wallpaperConfigModel();
|
ConfigModel *wallpaperConfigModel();
|
||||||
QString currentWallpaper() const;
|
QString currentWallpaper() const;
|
||||||
void setCurrentWallpaper(const QString &wallpaper);
|
void setCurrentWallpaper(const QString &wallpaper);
|
||||||
@ -57,7 +57,6 @@ public:
|
|||||||
Q_SIGNALS:
|
Q_SIGNALS:
|
||||||
void currentWallpaperChanged();
|
void currentWallpaperChanged();
|
||||||
void wallpaperConfigurationChanged();
|
void wallpaperConfigurationChanged();
|
||||||
void currentContainmentActionsChanged();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void syncWallpaperObjects();
|
void syncWallpaperObjects();
|
||||||
@ -66,6 +65,7 @@ private:
|
|||||||
Plasma::Containment *m_containment;
|
Plasma::Containment *m_containment;
|
||||||
ConfigModel *m_wallpaperConfigModel;
|
ConfigModel *m_wallpaperConfigModel;
|
||||||
ConfigModel *m_containmentActionConfigModel;
|
ConfigModel *m_containmentActionConfigModel;
|
||||||
|
ConfigModel *m_currentContainmentActionConfigModel;
|
||||||
QString m_currentWallpaper;
|
QString m_currentWallpaper;
|
||||||
ConfigPropertyMap *m_currentWallpaperConfig;
|
ConfigPropertyMap *m_currentWallpaperConfig;
|
||||||
ConfigPropertyMap *m_ownWallpaperConfig;
|
ConfigPropertyMap *m_ownWallpaperConfig;
|
||||||
|
@ -31,7 +31,7 @@ Item {
|
|||||||
anchors.centerIn: parent
|
anchors.centerIn: parent
|
||||||
|
|
||||||
Repeater {
|
Repeater {
|
||||||
model: 3
|
model: configDialog.currentContainmentActionConfigModel
|
||||||
delegate: RowLayout {
|
delegate: RowLayout {
|
||||||
width: root.width * 0.8
|
width: root.width * 0.8
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
@ -58,6 +58,12 @@ Item {
|
|||||||
}
|
}
|
||||||
QtControls.Button {
|
QtControls.Button {
|
||||||
text: "Add Action"
|
text: "Add Action"
|
||||||
|
onClicked: {
|
||||||
|
for (var i in configDialog.currentContainmentActions) {
|
||||||
|
print("AAA"+i+configDialog.currentContainmentActions[i])
|
||||||
|
}
|
||||||
|
print(configDialog.currentContainmentActions)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user