control center: close the band on a second tile click instead of walking history

fixes #4016
port 2.0

(cherry picked from commit ff62d7618f)
This commit is contained in:
bbedward authored and dux-ci[bot] committed 2026-10-29 23:49:10 +00:00
1 parent 1905f2135b
commit 7e758c935f
1 file changed
+1 -17
@@ -52,7 +52,6 @@ FocusScope {
readonly property real targetImplicitHeight: CcMetrics.sheetPadding * 2 + (widgetGrid.dragging ? heldGridHeight : gridTargetHeight)
readonly property bool contentOverflows: targetImplicitHeight > (host.availableHeight ?? Infinity)
property Item detailReturnFocus: null
property var pageHistory: []
// One string so Discard and undo can compare and restore the whole session state at once.
readonly property string editState: JSON.stringify({
"widgets": SettingsData.controlCenterWidgets || [],
@@ -113,9 +112,7 @@ FocusScope {
function navigateTo(section) {
if (section === host.expandedSection)
return;
if (host.expandedSection)
pageHistory = pageHistory.concat([host.expandedSection]);
else if (detailBand.shownSection === "")
if (!host.expandedSection && detailBand.shownSection === "")
detailReturnFocus = root.Window.window?.activeFocusItem ?? null;
host.expandedSection = section;
}
@@ -123,12 +120,6 @@ FocusScope {
function goBack() {
if (detailBand.dismissTransient())
return;
if (pageHistory.length > 0) {
const previous = pageHistory[pageHistory.length - 1];
pageHistory = pageHistory.slice(0, -1);
host.expandedSection = previous;
return;
}
host.collapseAll();
}
@@ -338,15 +329,8 @@ FocusScope {
onActivated: root.undoEdit()
}
readonly property string expandedSection: host.expandedSection ?? ""
readonly property bool editMode: host.editMode
onExpandedSectionChanged: {
if (expandedSection !== "")
return;
pageHistory = [];
}
onEditModeChanged: {
if (editMode) {
host.collapseAll();