mirror of
https://github.com/moonlight-stream/moonlight-qt
synced 2025-01-10 10:18:46 +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")
|
text: qsTr("Delete PC")
|
||||||
onTriggered: {
|
onTriggered: {
|
||||||
deletePcDialog.pcIndex = index
|
deletePcDialog.pcIndex = index
|
||||||
// get confirmation first, actual closing is called from the dialog
|
deletePcDialog.pcName = model.name
|
||||||
deletePcDialog.open()
|
deletePcDialog.open()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -271,6 +271,12 @@ CenteredGridView {
|
||||||
// the ItemDelegate and not where the mouse cursor is
|
// the ItemDelegate and not where the mouse cursor is
|
||||||
pcContextMenu.open()
|
pcContextMenu.open()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Keys.onDeletePressed: {
|
||||||
|
deletePcDialog.pcIndex = index
|
||||||
|
deletePcDialog.pcName = model.name
|
||||||
|
deletePcDialog.open()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ErrorMessageDialog {
|
ErrorMessageDialog {
|
||||||
|
@ -302,16 +308,14 @@ CenteredGridView {
|
||||||
NavigableMessageDialog {
|
NavigableMessageDialog {
|
||||||
id: deletePcDialog
|
id: deletePcDialog
|
||||||
// don't allow edits to the rest of the window while open
|
// don't allow edits to the rest of the window while open
|
||||||
property int pcIndex : -1;
|
property int pcIndex : -1
|
||||||
text:qsTr("Are you sure you want to remove this PC?")
|
property string pcName : ""
|
||||||
|
text: qsTr("Are you sure you want to remove '%1'?").arg(pcName)
|
||||||
standardButtons: Dialog.Yes | Dialog.No
|
standardButtons: Dialog.Yes | Dialog.No
|
||||||
|
|
||||||
function deletePc() {
|
onAccepted: {
|
||||||
console.log("deleting PC pairing for PC at index: " + pcIndex)
|
computerModel.deleteComputer(pcIndex)
|
||||||
computerModel.deleteComputer(pcIndex);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onAccepted: deletePc()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NavigableMessageDialog {
|
NavigableMessageDialog {
|
||||||
|
|
Loading…
Reference in a new issue