diff --git a/gui/main.qml b/gui/main.qml index 76b6001..bf0f8b2 100644 --- a/gui/main.qml +++ b/gui/main.qml @@ -90,6 +90,9 @@ ApplicationWindow { onTriggered: chatView.positionViewAtEnd() } + // Session ID to kill — set on right-click, consumed by context menu + property string killTargetSessionId: "" + // Session tree model — flat list with level info ListModel { id: sessionTreeModel @@ -538,6 +541,9 @@ ApplicationWindow { onClicked: function(mouse) { if (mouse.button === Qt.RightButton) { if (type === "session") { + var item = sessionTreeModel.get(parent.modelIndex) + if (item) + root.killTargetSessionId = item.id sessionCtxMenu.popup() } return @@ -561,9 +567,8 @@ ApplicationWindow { text: "Kill" icon.color: "#f44336" onClicked: { - var item = sessionTreeModel.get(parent.parent.parent.modelIndex) - if (item && item.type === "session") - ollie.killSession(item.id) + if (root.killTargetSessionId) + ollie.killSession(root.killTargetSessionId) ollie.refreshSessions() } }