@@ -157,6 +157,7 @@ Page {
157157 }
158158
159159 CheckBox {
160+ id: deleteCheck
160161 text: qsTr (" Delete download after writing" )
161162 onCheckedChanged: mainWindow .eraseVariant = ! mainWindow .eraseVariant
162163 }
@@ -181,4 +182,83 @@ Page {
181182 PropertyChanges { target: nextButton; enabled: driveCombo .enabled && releases .localFile .iso }
182183 }
183184 ]
185+
186+ Keys .onPressed : (event )=> {
187+ switch (event .key ) {
188+ case (Qt .Key_Right ):
189+ case (Qt .Key_N ):
190+ if (selectedOption == Units .MainSelect .Write ) {
191+ if (drives .length && releases .localFile .iso )
192+ mainWindow .setNextPage ()
193+ } else
194+ mainWindow .setNextPage ()
195+ break
196+ case (Qt .Key_Left ):
197+ case (Qt .Key_P ):
198+ mainWindow .setPreviousPage ()
199+ break
200+ }
201+
202+ if (drivePage .state == " Downloading" ) {
203+ switch (event .key ) {
204+ case (Qt .Key_1 ):
205+ closePopups ()
206+ if (! versionCombo .down )
207+ versionCombo .popup .open ()
208+ break
209+ case (Qt .Key_2 ):
210+ closePopups ()
211+ if (! hwArchCombo .down )
212+ hwArchCombo .popup .open ()
213+ break
214+ case (Qt .Key_3 ):
215+ closePopups ()
216+ if (! driveCombo .down && driveCombo .count )
217+ driveCombo .popup .open ()
218+ break
219+ case (Qt .Key_D ):
220+ case (Qt .Key_4 ):
221+ deleteCheck .checked = ! deleteCheck .checked
222+ break
223+ case (Qt .Key_Return ):
224+ case (Qt .Key_Enter ):
225+ closePopups ()
226+ break
227+ case (Qt .Key_Up ):
228+ if (versionCombo .down && versionCombo .currentIndex > 0 )
229+ versionCombo .currentIndex -= 1
230+ else if (hwArchCombo .down && hwArchCombo .currentIndex > 0 )
231+ hwArchCombo .currentIndex -= 1
232+ else if (driveCombo .down && driveCombo .currentIndex > 0 )
233+ driveCombo .currentIndex -= 1
234+ break
235+ case (Qt .Key_Down ):
236+ if (versionCombo .down && versionCombo .currentIndex < versionCombo .count - 1 )
237+ versionCombo .currentIndex += 1
238+ else if (hwArchCombo .down && hwArchCombo .currentIndex < hwArchCombo .count - 1 )
239+ hwArchCombo .currentIndex += 1
240+ else if (driveCombo .down && driveCombo .currentIndex < driveCombo .count - 1 )
241+ driveCombo .currentIndex += 1
242+ break
243+ }
244+ } else {
245+ switch (event .key ) {
246+ case (Qt .Key_1 ):
247+ if (portalFileDialog .isAvailable )
248+ portalFileDialog .open ()
249+ else
250+ fileDialog .open ()
251+ break
252+ case (Qt .Key_2 ):
253+ driveCombo .focus = true
254+ break
255+ }
256+ }
257+ }
258+
259+ function closePopups () {
260+ versionCombo .popup .close ()
261+ hwArchCombo .popup .close ()
262+ driveCombo .popup .close ()
263+ }
184264}
0 commit comments