mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-10-18 09:14:01 -04:00
settings/bar: move name back to its own pill
This commit is contained in:
@@ -92,7 +92,6 @@ Singleton {
|
||||
{
|
||||
"id": "dankbar_settings",
|
||||
"hidden": true,
|
||||
"titleFrom": "selectedBarGeneralTitle",
|
||||
"aliases": ["dank_island", "island"],
|
||||
"text": I18n.tr("General", "adjective, settings page and section title for general options"),
|
||||
"icon": "tune",
|
||||
@@ -102,7 +101,6 @@ Singleton {
|
||||
{
|
||||
"id": "dankbar_appearance",
|
||||
"hidden": true,
|
||||
"titleFrom": "selectedBarAppearanceTitle",
|
||||
"aliases": ["frame"],
|
||||
"text": I18n.tr("Appearance", "settings page and section title for visual options"),
|
||||
"icon": "palette",
|
||||
|
||||
@@ -8,12 +8,6 @@ Singleton {
|
||||
id: root
|
||||
|
||||
property string selectedBarId: "default"
|
||||
readonly property string selectedBarTitle: {
|
||||
SettingsData.barConfigs;
|
||||
return SettingsData.getBarConfig(selectedBarId)?.name || I18n.tr("Bar", "fallback name for an unnamed bar");
|
||||
}
|
||||
readonly property string selectedBarGeneralTitle: selectedBarTitle + " • " + I18n.tr("General", "adjective, settings page and section title for general options")
|
||||
readonly property string selectedBarAppearanceTitle: selectedBarTitle + " • " + I18n.tr("Appearance", "settings page and section title for visual options")
|
||||
property string selectedWallpaperScreen: ""
|
||||
// Which dock the Dock hub pages are editing.
|
||||
property string dockHubSelection: ""
|
||||
|
||||
@@ -11,7 +11,7 @@ Column {
|
||||
|
||||
property var parentModal: null
|
||||
property string confirmingRemoveId: ""
|
||||
property bool renaming: false
|
||||
property string editingBarId: ""
|
||||
property string renameDraft: ""
|
||||
readonly property bool dotEnabled: SettingsData.dotBarConfig?.enabled ?? false
|
||||
readonly property var barPages: ["dankbar_settings", "dankbar_appearance"].map(id => SettingsTabs.page(id)).filter(page => page)
|
||||
@@ -20,19 +20,14 @@ Column {
|
||||
id: bar
|
||||
|
||||
onSelectedBarIdChanged: {
|
||||
root.renaming = false;
|
||||
root.editingBarId = "";
|
||||
root.confirmingRemoveId = "";
|
||||
}
|
||||
}
|
||||
|
||||
function startRename() {
|
||||
renameDraft = bar.selectedBarName;
|
||||
renaming = true;
|
||||
}
|
||||
|
||||
function finishRename(value) {
|
||||
renaming = false;
|
||||
const id = bar.selectedBarId;
|
||||
const id = editingBarId;
|
||||
editingBarId = "";
|
||||
const name = value.trim();
|
||||
if (!id || !name || SettingsData.barConfigs.some(config => config.id !== id && config.name === name))
|
||||
return;
|
||||
@@ -149,32 +144,33 @@ Column {
|
||||
settingKey: "barLayout"
|
||||
tags: ["layout", "standard", "frame", "island", "mode", "bar", "name", "rename"]
|
||||
visible: !!bar.selectedBarConfig
|
||||
headerActions: [
|
||||
|
||||
SettingsRow {
|
||||
title: I18n.tr("Name")
|
||||
subtitle: root.editingBarId ? "" : bar.selectedBarName
|
||||
|
||||
DankActionButton {
|
||||
iconName: root.renaming ? "check" : "edit"
|
||||
Accessible.name: root.renaming ? I18n.tr("Save") : I18n.tr("Rename")
|
||||
iconName: root.editingBarId ? "check" : "edit"
|
||||
Accessible.name: root.editingBarId ? I18n.tr("Save") : I18n.tr("Rename")
|
||||
onClicked: {
|
||||
if (root.renaming) {
|
||||
if (root.editingBarId) {
|
||||
root.finishRename(root.renameDraft);
|
||||
return;
|
||||
}
|
||||
root.startRename();
|
||||
root.renameDraft = bar.selectedBarName;
|
||||
root.editingBarId = bar.selectedBarId;
|
||||
}
|
||||
},
|
||||
}
|
||||
DankActionButton {
|
||||
visible: root.renaming
|
||||
visible: root.editingBarId !== ""
|
||||
iconName: "close"
|
||||
Accessible.name: I18n.tr("Cancel")
|
||||
onClicked: root.renaming = false
|
||||
onClicked: root.editingBarId = ""
|
||||
}
|
||||
]
|
||||
|
||||
SettingsRow {
|
||||
visible: root.renaming
|
||||
|
||||
body: Loader {
|
||||
width: parent.width
|
||||
active: root.renaming
|
||||
active: root.editingBarId !== ""
|
||||
visible: active
|
||||
sourceComponent: DankTextField {
|
||||
id: renameField
|
||||
@@ -184,7 +180,7 @@ Column {
|
||||
text: root.renameDraft
|
||||
onTextEdited: root.renameDraft = renameField.text
|
||||
onAccepted: root.finishRename(renameField.text)
|
||||
Keys.onEscapePressed: root.renaming = false
|
||||
Keys.onEscapePressed: root.editingBarId = ""
|
||||
Component.onCompleted: {
|
||||
renameField.forceActiveFocus();
|
||||
renameField.selectAll();
|
||||
|
||||
Reference in New Issue
Block a user