mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2024-11-13 23:17:09 +00:00
Allow use of the delete key to delete PCs
This commit is contained in:
parent
5e6b60bae0
commit
ca91f9b702
1 changed files with 12 additions and 8 deletions
|
@ -211,7 +211,7 @@ CenteredGridView {
|
|||
text: qsTr("Delete PC")
|
||||
onTriggered: {
|
||||
deletePcDialog.pcIndex = index
|
||||
// get confirmation first, actual closing is called from the dialog
|
||||
deletePcDialog.pcName = model.name
|
||||
deletePcDialog.open()
|
||||
}
|
||||
}
|
||||
|
@ -271,6 +271,12 @@ CenteredGridView {
|
|||
// the ItemDelegate and not where the mouse cursor is
|
||||
pcContextMenu.open()
|
||||
}
|
||||
|
||||
Keys.onDeletePressed: {
|
||||
deletePcDialog.pcIndex = index
|
||||
deletePcDialog.pcName = model.name
|
||||
deletePcDialog.open()
|
||||
}
|
||||
}
|
||||
|
||||
ErrorMessageDialog {
|
||||
|
@ -302,16 +308,14 @@ CenteredGridView {
|
|||
NavigableMessageDialog {
|
||||
id: deletePcDialog
|
||||
// don't allow edits to the rest of the window while open
|
||||
property int pcIndex : -1;
|
||||
text:qsTr("Are you sure you want to remove this PC?")
|
||||
property int pcIndex : -1
|
||||
property string pcName : ""
|
||||
text: qsTr("Are you sure you want to remove '%1'?").arg(pcName)
|
||||
standardButtons: Dialog.Yes | Dialog.No
|
||||
|
||||
function deletePc() {
|
||||
console.log("deleting PC pairing for PC at index: " + pcIndex)
|
||||
computerModel.deleteComputer(pcIndex);
|
||||
onAccepted: {
|
||||
computerModel.deleteComputer(pcIndex)
|
||||
}
|
||||
|
||||
onAccepted: deletePc()
|
||||
}
|
||||
|
||||
NavigableMessageDialog {
|
||||
|
|
Loading…
Reference in a new issue