Skip to content

Commit 3365c81

Browse files
committed
Show the warning dialog with erase confirmation everytime (#750)
Make the dialog to appear all the time and not only for drives bigger than 32GB.
1 parent f3529ef commit 3365c81

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

src/app/qml/DeviceWarningDialog.qml

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ ApplicationWindow {
5151

5252
Label {
5353
Layout.fillWidth: true
54-
text: qsTr("The device you have selected appears to be larger than 32GB. Are you sure you want to completely erase all the data on it?")
54+
text: qsTr("The entire device (all of %1) will be erased and the selected image will be written to it. Do you want to continue?").arg(formatSize(drives.selected.size))
5555
wrapMode: Label.Wrap
5656
}
5757

@@ -87,5 +87,21 @@ ApplicationWindow {
8787
}
8888
}
8989
}
90+
91+
function formatSize(bytes) {
92+
const kb = 1024;
93+
const mb = kb * 1024;
94+
const gb = mb * 1024;
95+
96+
if (bytes >= gb) {
97+
return (bytes / gb).toFixed(2) + " " + qsTr("GB");
98+
} else if (bytes >= mb) {
99+
return (bytes / mb).toFixed(2) + " " + qsTr("MB");
100+
} else if (bytes >= kb) {
101+
return (bytes / kb).toFixed(2) + " " + qsTr("KB");
102+
} else {
103+
return bytes + " " + qsTr("Bytes");
104+
}
105+
}
90106
}
91107

src/app/qml/DrivePage.qml

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,6 @@ Page {
190190
return;
191191
}
192192

193-
// Better check for > 33GB as the device size is not exactly 32GB for "32GB" USB drive
194-
if (drives.selected.size > 33000000000) {
195-
deviceWarningDialog.show();
196-
return
197-
}
198-
199-
selectedPage = Units.Page.DownloadPage
200-
drives.selected.setImage(releases.variant)
201-
drives.selected.write(releases.variant)
193+
deviceWarningDialog.show();
202194
}
203195
}

0 commit comments

Comments
 (0)