|
|
@ -189,6 +189,8 @@ PlasmaComponents.Page {
|
|
|
|
onDocksCountChanged: locationLayout.lockReservedEdges();
|
|
|
|
onDocksCountChanged: locationLayout.lockReservedEdges();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Component.onCompleted: lockReservedEdges()
|
|
|
|
|
|
|
|
|
|
|
|
ExclusiveGroup {
|
|
|
|
ExclusiveGroup {
|
|
|
|
id: locationGroup
|
|
|
|
id: locationGroup
|
|
|
|
property bool inStartup: true
|
|
|
|
property bool inStartup: true
|
|
|
@ -202,64 +204,64 @@ PlasmaComponents.Page {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function lockReservedEdges() {
|
|
|
|
function lockReservedEdges() {
|
|
|
|
var buttons = visibleChildren
|
|
|
|
var edges = dock.managedLayout.qmlFreeEdges(dock.positioner.currentScreenId);
|
|
|
|
var edges = dock.freeEdges()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (var i = 0; i < buttons.length; i++) {
|
|
|
|
bottomEdgeBtn.edgeIsFree = (edges.indexOf(bottomEdgeBtn.edge)>=0);
|
|
|
|
buttons[i].enabled = buttons[i].checked || freeEdge(buttons[i].edge, edges)
|
|
|
|
topEdgeBtn.edgeIsFree = (edges.indexOf(topEdgeBtn.edge)>=0);
|
|
|
|
}
|
|
|
|
leftEdgeBtn.edgeIsFree = (edges.indexOf(leftEdgeBtn.edge)>=0);
|
|
|
|
}
|
|
|
|
rightEdgeBtn.edgeIsFree = (edges.indexOf(rightEdgeBtn.edge)>=0);
|
|
|
|
|
|
|
|
|
|
|
|
function freeEdge(edge, edges) {
|
|
|
|
|
|
|
|
for (var i = 0; i < edges.length; i++) {
|
|
|
|
|
|
|
|
if (edges[i] === edge)
|
|
|
|
|
|
|
|
return true
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
return false
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
|
|
|
|
id: bottomEdgeBtn
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: i18nc("bottom location", "Bottom")
|
|
|
|
text: i18nc("bottom location", "Bottom")
|
|
|
|
iconSource: "arrow-down"
|
|
|
|
iconSource: "arrow-down"
|
|
|
|
checked: dock.location === edge
|
|
|
|
checked: dock.location === edge
|
|
|
|
checkable: true
|
|
|
|
checkable: true
|
|
|
|
enabled: checked || locationLayout.freeEdge(edge, dock.freeEdges())
|
|
|
|
enabled: checked || edgeIsFree
|
|
|
|
exclusiveGroup: locationGroup
|
|
|
|
exclusiveGroup: locationGroup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property bool edgeIsFree: true
|
|
|
|
readonly property int edge: PlasmaCore.Types.BottomEdge
|
|
|
|
readonly property int edge: PlasmaCore.Types.BottomEdge
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
|
|
|
|
id: leftEdgeBtn
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: i18nc("left location", "Left")
|
|
|
|
text: i18nc("left location", "Left")
|
|
|
|
iconSource: "arrow-left"
|
|
|
|
iconSource: "arrow-left"
|
|
|
|
checked: dock.location === edge
|
|
|
|
checked: dock.location === edge
|
|
|
|
checkable: true
|
|
|
|
checkable: true
|
|
|
|
enabled: checked || locationLayout.freeEdge(edge, dock.freeEdges())
|
|
|
|
enabled: checked || edgeIsFree
|
|
|
|
exclusiveGroup: locationGroup
|
|
|
|
exclusiveGroup: locationGroup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property bool edgeIsFree: true
|
|
|
|
readonly property int edge: PlasmaCore.Types.LeftEdge
|
|
|
|
readonly property int edge: PlasmaCore.Types.LeftEdge
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
|
|
|
|
id: topEdgeBtn
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: i18nc("top location", "Top")
|
|
|
|
text: i18nc("top location", "Top")
|
|
|
|
iconSource: "arrow-up"
|
|
|
|
iconSource: "arrow-up"
|
|
|
|
checked: dock.location === edge
|
|
|
|
checked: dock.location === edge
|
|
|
|
checkable: true
|
|
|
|
checkable: true
|
|
|
|
enabled: checked || locationLayout.freeEdge(edge, dock.freeEdges())
|
|
|
|
enabled: checked || edgeIsFree
|
|
|
|
exclusiveGroup: locationGroup
|
|
|
|
exclusiveGroup: locationGroup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property bool edgeIsFree: true
|
|
|
|
readonly property int edge: PlasmaCore.Types.TopEdge
|
|
|
|
readonly property int edge: PlasmaCore.Types.TopEdge
|
|
|
|
}
|
|
|
|
}
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
PlasmaComponents.Button {
|
|
|
|
|
|
|
|
id: rightEdgeBtn
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.fillWidth: true
|
|
|
|
text: i18nc("right location", "Right")
|
|
|
|
text: i18nc("right location", "Right")
|
|
|
|
iconSource: "arrow-right"
|
|
|
|
iconSource: "arrow-right"
|
|
|
|
checked: dock.location === edge
|
|
|
|
checked: dock.location === edge
|
|
|
|
checkable: true
|
|
|
|
checkable: true
|
|
|
|
enabled: checked || locationLayout.freeEdge(edge, dock.freeEdges())
|
|
|
|
enabled: checked || edgeIsFree
|
|
|
|
exclusiveGroup: locationGroup
|
|
|
|
exclusiveGroup: locationGroup
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
property bool edgeIsFree: true
|
|
|
|
readonly property int edge: PlasmaCore.Types.RightEdge
|
|
|
|
readonly property int edge: PlasmaCore.Types.RightEdge
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|