fix copy on share config

This commit is contained in:
Cyril Anisimov 2025-05-10 12:09:57 +02:00
parent 111a60d81c
commit cf5ecf1f1a

View file

@ -178,9 +178,21 @@ DrawerType2 {
Connections { Connections {
target: copyNativeConfigStringButton target: copyNativeConfigStringButton
function onClicked() { function onClicked() {
nativeConfigString.selectAll() const headerItem = configListView.headerItem;
nativeConfigString.copy() if (!headerItem) {
nativeConfigString.select(0, 0) console.error("Failed to copy: header item not found in ListView")
return
}
const nativeConfigStringItem = headerItem.children.find(c => c.objectName === "nativeConfigString");
if (!nativeConfigStringItem) {
console.error("Failed to copy: nativeConfigString item not found in ListView")
return
}
nativeConfigStringItem.selectAll()
nativeConfigStringItem.copy()
nativeConfigStringItem.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied")) PageController.showNotificationMessage(qsTr("Copied"))
} }
} }
@ -188,11 +200,22 @@ DrawerType2 {
Connections { Connections {
target: copyConfigTextButton target: copyConfigTextButton
function onClicked() { function onClicked() {
configText.selectAll() const headerItem = configListView.headerItem;
configText.copy() if (!headerItem) {
configText.select(0, 0) console.error("Failed to copy: header item not found in ListView")
return
}
const configTextItem = headerItem.children.find(c => c.objectName === "configText");
if (!configTextItem) {
console.error("Failed to copy: configText item not found in ListView")
return
}
configTextItem.selectAll()
configTextItem.copy()
configTextItem.select(0, 0)
PageController.showNotificationMessage(qsTr("Copied")) PageController.showNotificationMessage(qsTr("Copied"))
header.forceActiveFocus()
} }
} }
@ -232,6 +255,8 @@ DrawerType2 {
TextField { TextField {
id: nativeConfigString id: nativeConfigString
objectName: "nativeConfigString"
visible: false visible: false
text: ExportController.nativeConfigString text: ExportController.nativeConfigString
@ -242,6 +267,7 @@ DrawerType2 {
TextArea { TextArea {
id: configText id: configText
objectName: "configText"
Layout.fillWidth: true Layout.fillWidth: true
Layout.topMargin: 16 Layout.topMargin: 16