@@ -39,10 +39,13 @@ Rectangle {
3939 property string beep: " "
4040 property string eject: " "
4141 property bool useSettings: true
42- property string qopenhdConfPath: imageWriter . getValue ( " qopenhdConfPath " )
42+ property string qopenhdConfPath: " "
4343 property bool qopenhdConfPresent: false
4444
45- Component .onCompleted : loadSettingsMap ()
45+ Component .onCompleted : {
46+ qopenhdConfPath = normalizeLocalFilePath (imageWriter .getValue (" qopenhdConfPath" ))
47+ loadSettingsMap ()
48+ }
4649
4750 function navigateBack () {
4851 if (mainWindow && mainWindow .showHome ) {
@@ -130,7 +133,9 @@ ImButton {
130133
131134 ColumnLayout {
132135 anchors .fill : parent
133- anchors .margins : driveSelected ? 16 : 32
136+ anchors .topMargin : - 100
137+ anchors .leftMargin : 50
138+ anchors .rightMargin : 50
134139 spacing: 12
135140
136141 RowLayout {
@@ -142,19 +147,6 @@ ImButton {
142147 spacing: 4
143148 Layout .fillWidth : true
144149
145- Text {
146- id: storageHeader
147- text: qsTr (" Storage" )
148- color: " #fff"
149- Layout .fillWidth : true
150- Layout .preferredHeight : 17
151- Layout .preferredWidth : 100
152- font .pixelSize : 12
153- font .family : robotoBold .name
154- font .bold : true
155- horizontalAlignment: Text .AlignHCenter
156- }
157-
158150 ImButton {
159151 id: dstbutton
160152 text: driveSelected ? selectedDevice : qsTr (" CHOOSE STORAGE" )
@@ -493,6 +485,7 @@ ImButton {
493485 spacing: 10
494486
495487 Text {
488+ // not this
496489 text: qsTr (" Storage" )
497490 horizontalAlignment: Text .AlignHCenter
498491 verticalAlignment: Text .AlignVCenter
@@ -648,8 +641,35 @@ ImButton {
648641 nameFilters: [qsTr (" QOpenHD.conf (*.conf)" ), qsTr (" All files (*)" )]
649642 selectExisting: true
650643 onAccepted: {
651- qopenhdConfPath = qopenhdConfDialog .fileUrl .toLocalFile ()
644+ var selectedUrl = qopenhdConfDialog .fileUrl
645+ if (! selectedUrl || selectedUrl .toString ().length === 0 ) {
646+ if (qopenhdConfDialog .fileUrls && qopenhdConfDialog .fileUrls .length > 0 ) {
647+ selectedUrl = qopenhdConfDialog .fileUrls [0 ]
648+ }
649+ }
650+ if (selectedUrl && selectedUrl .toString ) {
651+ var selectedStr = selectedUrl .toString ()
652+ if (selectedStr .startsWith (" file:" )) {
653+ qopenhdConfPath = normalizeLocalFilePath (selectedUrl .toLocalFile ? selectedUrl .toLocalFile () : selectedStr)
654+ } else {
655+ qopenhdConfPath = normalizeLocalFilePath (selectedStr)
656+ }
657+ }
658+ }
659+ }
660+
661+ function normalizeLocalFilePath (value ) {
662+ if (! value)
663+ return " "
664+ if (typeof value !== " string" && value .toString )
665+ value = value .toString ()
666+ if (value .startsWith (" file:" )) {
667+ value = decodeURIComponent (value .replace (/ ^ file:\/\/ / , " " ))
668+ if (value .startsWith (" /" ) && value .length > 2 && value[2 ] === " :" ) {
669+ value = value .substring (1 )
670+ }
652671 }
672+ return value
653673 }
654674
655675 function selectDstItem (d ) {
@@ -908,6 +928,7 @@ ImButton {
908928 return
909929 }
910930
931+ qopenhdConfPath = normalizeLocalFilePath (qopenhdConfPath)
911932 if (qopenhdConfPath && qopenhdConfPath .length > 0 ) {
912933 var qopenhdTarget = drivePath (qopenhdConfRelativePath ())
913934 if (! imageWriter .copyFile (qopenhdConfPath, qopenhdTarget)) {
0 commit comments