From 5381f59bf4c256f3d10ceb573d792cc344c4c70d Mon Sep 17 00:00:00 2001 From: Julien Wadel Date: Wed, 3 Jul 2024 15:58:34 +0200 Subject: [PATCH] Upgrade confirmation popup to be used as lambda from QML --- Linphone/view/App/AppWindow.qml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Linphone/view/App/AppWindow.qml b/Linphone/view/App/AppWindow.qml index 8ae00c16e..3aaa2dda4 100644 --- a/Linphone/view/App/AppWindow.qml +++ b/Linphone/view/App/AppWindow.qml @@ -18,12 +18,14 @@ ApplicationWindow { Dialog { property var requestDialog property int index + property var callback: requestDialog?.result signal closePopup(int index) onClosed: closePopup(index) text: requestDialog.message details: requestDialog.details - onAccepted: requestDialog.result(1) - onRejected: requestDialog.result(0) + // For C++, requestDialog need to be call directly + onAccepted: requestDialog ? requestDialog.result(1) : callback(1) + onRejected: requestDialog ? requestDialog.result(0) : callback(0) width: 278 * DefaultStyle.dp } } @@ -56,7 +58,16 @@ ApplicationWindow { popup.open() popup.closePopup.connect(removeFromPopupLayout) } - + + function showConfirmationLambdaPopup(title,details,callback){ + console.log("Showing confirmation popup") + var popup = confirmPopupComp.createObject(popupLayout, {"text": title, "details":details,"callback":callback}) + popup.index = popupLayout.popupList.length + popupLayout.popupList.push(popup) + popup.open() + popup.closePopup.connect(removeFromPopupLayout) + } + ColumnLayout { id: popupLayout anchors.fill: parent