Fix the browsers context menu positioning
This commit is contained in:
parent
90abc8b200
commit
7406ff3046
@ -36,8 +36,6 @@ import "../delegates"
|
||||
|
||||
MeaDialog {
|
||||
id: root
|
||||
x: (parent.width - width) / 2
|
||||
y: (parent.height - height / 2)
|
||||
|
||||
property Device device
|
||||
property string itemId
|
||||
@ -76,7 +74,12 @@ MeaDialog {
|
||||
|
||||
var params = []
|
||||
root.activated(actionType.id, params)
|
||||
|
||||
root.accept()
|
||||
// In case the action removes the item from the browser, our closed handler might be deleted
|
||||
// before being called and that would keep the popup open
|
||||
// explicitly destroy the popup to make sure it'll always go away
|
||||
root.destroy()
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -110,9 +113,7 @@ MeaDialog {
|
||||
visible: stackView.depth > 1
|
||||
onClicked: {
|
||||
var params = []
|
||||
print("k", stackView.currentItem.count)
|
||||
for (var i = 0; i < stackView.currentItem.count; i++) {
|
||||
print("juhu", i)
|
||||
var param = {}
|
||||
param["paramTypeId"] = stackView.currentItem.itemAt(i).paramType.id
|
||||
param["value"] = stackView.currentItem.itemAt(i).value
|
||||
|
||||
@ -61,7 +61,7 @@ NymeaListItemDelegate {
|
||||
}
|
||||
|
||||
var actionDialogComponent = Qt.createComponent(Qt.resolvedUrl("../components/BrowserContextMenu.qml"));
|
||||
var popup = actionDialogComponent.createObject(root.parent,
|
||||
var popup = actionDialogComponent.createObject(app,
|
||||
{
|
||||
device: root.device,
|
||||
title: model.displayName,
|
||||
|
||||
@ -70,11 +70,9 @@ Page {
|
||||
onExecuteBrowserItemActionReply: actionExecuted(params)
|
||||
}
|
||||
function actionExecuted(params) {
|
||||
print("Execute Action reply:", params, params.id, params["id"], d.pendingBrowserItemId)
|
||||
if (params.id === d.pendingBrowserItemId) {
|
||||
d.pendingBrowserItemId = -1;
|
||||
d.pendingItemId = ""
|
||||
print("yep finished")
|
||||
if (params.status !== "success") {
|
||||
header.showInfo(params.error, true);
|
||||
} else if (params.params.deviceError !== "DeviceErrorNoError") {
|
||||
|
||||
Reference in New Issue
Block a user