very raw stub for containment actions config
correctly lists them, still not possible to config them
This commit is contained in:
parent
24c60ed48c
commit
0e107c4f1f
@ -39,6 +39,7 @@ ContainmentConfigView::ContainmentConfigView(Plasma::Containment *cont, QWindow
|
||||
: ConfigView(cont, parent),
|
||||
m_containment(cont),
|
||||
m_wallpaperConfigModel(0),
|
||||
m_containmentActionConfigModel(0),
|
||||
m_currentWallpaperConfig(0),
|
||||
m_ownWallpaperConfig(0)
|
||||
{
|
||||
@ -64,6 +65,29 @@ void ContainmentConfigView::init()
|
||||
setSource(QUrl::fromLocalFile(m_containment->containment()->corona()->package().filePath("containmentconfigurationui")));
|
||||
}
|
||||
|
||||
ConfigModel *ContainmentConfigView::containmentActionConfigModel()
|
||||
{
|
||||
if (!m_containmentActionConfigModel) {
|
||||
m_containmentActionConfigModel = new ConfigModel(this);
|
||||
|
||||
KPluginInfo::List actions = Plasma::PluginLoader::self()->listContainmentActionsInfo(QString());
|
||||
|
||||
Plasma::Package pkg = Plasma::PluginLoader::self()->loadPackage("Plasma/Generic");
|
||||
|
||||
foreach (const KPluginInfo &info, actions) {
|
||||
pkg.setDefaultPackageRoot(QStandardPaths::locate(QStandardPaths::GenericDataLocation, "plasma/containmentactions", QStandardPaths::LocateDirectory));
|
||||
ConfigCategory *cat = new ConfigCategory(m_containmentActionConfigModel);
|
||||
cat->setName(info.name());
|
||||
cat->setIcon(info.icon());
|
||||
cat->setSource(pkg.filePath("ui", "config.qml"));
|
||||
cat->setPluginName(info.pluginName());
|
||||
m_containmentActionConfigModel->appendCategory(cat);
|
||||
}
|
||||
|
||||
}
|
||||
return m_containmentActionConfigModel;
|
||||
}
|
||||
|
||||
ConfigModel *ContainmentConfigView::wallpaperConfigModel()
|
||||
{
|
||||
if (!m_wallpaperConfigModel) {
|
||||
|
@ -33,6 +33,7 @@ class ConfigPropertyMap;
|
||||
class ContainmentConfigView : public ConfigView
|
||||
{
|
||||
Q_OBJECT
|
||||
Q_PROPERTY(ConfigModel *containmentActionConfigModel READ containmentActionConfigModel 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)
|
||||
@ -43,6 +44,7 @@ public:
|
||||
|
||||
virtual void init();
|
||||
|
||||
ConfigModel *containmentActionConfigModel();
|
||||
ConfigModel *wallpaperConfigModel();
|
||||
QString currentWallpaper() const;
|
||||
void setCurrentWallpaper(const QString &wallpaper);
|
||||
@ -60,6 +62,7 @@ protected:
|
||||
private:
|
||||
Plasma::Containment *m_containment;
|
||||
ConfigModel *m_wallpaperConfigModel;
|
||||
ConfigModel *m_containmentActionConfigModel;
|
||||
QString m_currentWallpaper;
|
||||
ConfigPropertyMap *m_currentWallpaperConfig;
|
||||
ConfigPropertyMap *m_ownWallpaperConfig;
|
||||
|
@ -17,14 +17,48 @@
|
||||
*/
|
||||
|
||||
import QtQuick 2.0
|
||||
import org.kde.plasma.components 2.0 as PlasmaComponents
|
||||
import QtQuick.Controls 1.0 as QtControls
|
||||
import QtQuick.Layouts 1.0
|
||||
|
||||
|
||||
Item {
|
||||
id: root
|
||||
|
||||
implicitWidth: childrenRect.width
|
||||
implicitHeight: childrenRect.height
|
||||
|
||||
PlasmaComponents.Label {
|
||||
text: "Containment actions go here"
|
||||
Column {
|
||||
anchors.centerIn: parent
|
||||
|
||||
Repeater {
|
||||
model: 3
|
||||
delegate: RowLayout {
|
||||
width: root.width * 0.8
|
||||
QtControls.Button {
|
||||
text: "Middle Button"
|
||||
}
|
||||
QtControls.ComboBox {
|
||||
Layout.fillWidth: true
|
||||
model: configDialog.containmentActionConfigModel
|
||||
textRole: "name"
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "configure"
|
||||
width: height
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "dialog-information"
|
||||
width: height
|
||||
}
|
||||
QtControls.Button {
|
||||
iconName: "list-remove"
|
||||
width: height
|
||||
}
|
||||
}
|
||||
}
|
||||
QtControls.Button {
|
||||
text: "Add Action"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user