Commit 89f1b089 authored by Marco Martin's avatar Marco Martin

heuristic to decide whether to use our own padding or not

parent 6d9b6bca
......@@ -140,9 +140,19 @@ void SettingsComponent::loadModule(const QString &name)
d->settingsModule->setModule(info.pluginId());
d->valid = true;
emit mainUiChanged();
emit validChanged();
}
QQuickItem *SettingsComponent::mainUi() const
{
if (d->kcm) {
return d->kcm->mainUi();
}
return nullptr;
}
bool SettingsComponent::isValid() const
{
return d->valid;
......
......@@ -32,6 +32,7 @@ class SettingsComponent : public QQuickItem
Q_PROPERTY(QString name READ name WRITE setName NOTIFY nameChanged)
Q_PROPERTY(QString icon READ icon WRITE setIcon NOTIFY iconChanged)
Q_PROPERTY(bool valid READ isValid NOTIFY validChanged)
Q_PROPERTY(QQuickItem *mainUi READ mainUi NOTIFY mainUiChanged)
public:
SettingsComponent(QQuickItem *parent = 0);
......@@ -44,6 +45,7 @@ public:
QString icon() const;
bool isValid() const;
QQuickItem *mainUi() const;
Q_SIGNALS:
void descriptionChanged();
......@@ -51,6 +53,7 @@ Q_SIGNALS:
void nameChanged();
void iconChanged();
void validChanged();
void mainUiChanged();
public Q_SLOTS:
void setModule(const QString &module);
......
......@@ -26,6 +26,11 @@ import org.kde.active.settings 2.0 as ActiveSettings
Kirigami.Page {
title: settingsComponent.name
property alias module: settingsComponent.module
readonly property bool hasOwnPadding: settingsComponent.mainUi && (settingsComponent.mainUi.hasOwnProperty("leftPadding") || settingsComponent.mainUi.hasOwnProperty("contentItem"))
leftPadding: hasOwnPadding ? 0 : Kirigami.Units.gridUnit
topPadding: hasOwnPadding ? 0 : Kirigami.Units.gridUnit
rightPadding: hasOwnPadding ? 0 : Kirigami.Units.gridUnit
bottomPadding: hasOwnPadding ? 0 : Kirigami.Units.gridUnit
contentItem: ActiveSettings.SettingsComponent {
id: settingsComponent
......@@ -34,7 +39,6 @@ Kirigami.Page {
signal moduleLoaded
Loader {
id: settingsLoader
anchors.fill: parent
......
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