Commit 2644e577 authored by Marco Martin's avatar Marco Martin

use proper padding for list contents

Summary:
every item is in a ListItem, which in kirigami master
put the proper padding considering scrollbars
use proper colors as well

Test Plan: correctly aligned now

Reviewers: #kirigami

Subscribers: plasma-devel

Tags: #plasma, #kirigami

Differential Revision: https://phabricator.kde.org/D10193
parent a3a24b09
......@@ -5,7 +5,7 @@ import QtQuick.Layouts 1.1
import org.kde.discover 2.0
import org.kde.discover.app 1.0
import org.kde.kquickcontrolsaddons 2.0
import org.kde.kirigami 2.1 as Kirigami
import org.kde.kirigami 2.2 as Kirigami
import "navigation.js" as Navigation
DiscoverPage {
......@@ -14,7 +14,16 @@ DiscoverPage {
title: i18n("Settings")
property string search: ""
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.View
background: Rectangle {
color: Kirigami.Theme.backgroundColor
}
header: QQC2.ToolBar {
Kirigami.Theme.inherit: false
Kirigami.Theme.colorSet: Kirigami.Theme.Window
anchors {
right: parent.right
left: parent.left
......@@ -56,75 +65,80 @@ DiscoverPage {
Component {
id: sourceBackendDelegate
RowLayout {
id: backendItem
readonly property QtObject backend: sourcesBackend
readonly property bool isDefault: ResourcesModel.currentApplicationBackend == resourcesBackend
anchors {
right: parent.right
left: parent.left
}
Kirigami.Heading {
Layout.fillWidth: true
leftPadding: Kirigami.Units.largeSpacing
text: backendItem.isDefault ? i18n("%1 (Default)", resourcesBackend.displayName) : resourcesBackend.displayName
}
Button {
Layout.rightMargin: Kirigami.Units.smallSpacing
iconName: "preferences-other"
Connections {
target: backend
onPassiveMessage: window.showPassiveNotification(message)
Kirigami.AbstractListItem {
hoverEnabled: false
supportsMouseEvents: false
RowLayout {
id: backendItem
readonly property QtObject backend: sourcesBackend
readonly property bool isDefault: ResourcesModel.currentApplicationBackend == resourcesBackend
anchors {
right: parent.right
left: parent.left
rightMargin: parent.rightPadding
leftMargin: parent.leftPadding
}
visible: resourcesBackend && resourcesBackend.hasApplications
Component {
id: dialogComponent
AddSourceDialog {
source: backendItem.backend
onVisibleChanged: if (!visible) {
destroy()
}
}
Kirigami.Heading {
Layout.fillWidth: true
text: backendItem.isDefault ? i18n("%1 (Default)", resourcesBackend.displayName) : resourcesBackend.displayName
}
Button {
Layout.rightMargin: Kirigami.Units.smallSpacing
iconName: "preferences-other"
menu: Menu {
id: settingsMenu
MenuItem {
enabled: !backendItem.isDefault
text: i18n("Make default")
onTriggered: ResourcesModel.currentApplicationBackend = backendItem.backend.resourcesBackend
Connections {
target: backend
onPassiveMessage: window.showPassiveNotification(message)
}
MenuItem {
text: i18n("Add Source...")
visible: backendItem.backend
onTriggered: {
var addSourceDialog = dialogComponent.createObject(null, {displayName: backendItem.backend.resourcesBackend.displayName })
addSourceDialog.open()
visible: resourcesBackend && resourcesBackend.hasApplications
Component {
id: dialogComponent
AddSourceDialog {
source: backendItem.backend
onVisibleChanged: if (!visible) {
destroy()
}
}
}
MenuSeparator {
visible: backendActionsInst.count>0
}
Instantiator {
id: backendActionsInst
model: ActionsModel {
actions: backendItem.backend ? backendItem.backend.actions : undefined
menu: Menu {
id: settingsMenu
MenuItem {
enabled: !backendItem.isDefault
text: i18n("Make default")
onTriggered: ResourcesModel.currentApplicationBackend = backendItem.backend.resourcesBackend
}
delegate: MenuItem {
action: ActionBridge { action: modelData }
MenuItem {
text: i18n("Add Source...")
visible: backendItem.backend
onTriggered: {
var addSourceDialog = dialogComponent.createObject(null, {displayName: backendItem.backend.resourcesBackend.displayName })
addSourceDialog.open()
}
}
onObjectAdded: {
settingsMenu.insertItem(index, object)
MenuSeparator {
visible: backendActionsInst.count>0
}
onObjectRemoved: {
object.destroy()
Instantiator {
id: backendActionsInst
model: ActionsModel {
actions: backendItem.backend ? backendItem.backend.actions : undefined
}
delegate: MenuItem {
action: ActionBridge { action: modelData }
}
onObjectAdded: {
settingsMenu.insertItem(index, object)
}
onObjectRemoved: {
object.destroy()
}
}
}
}
......
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