1
0
Fork 0
mirror of https://git.jami.net/savoirfairelinux/jami-client-qt.git synced 2025-07-20 15:35:25 +02:00

view-coordinator: use the view name to destroy dialogs

In the case of a unique view, we need to use the view name used in
the viewmanager to destroy the dialog. This is now provided by the
viewName parameter of the callback used when creating the dialog.

Gitlab: #1938
Change-Id: I3645fc1c7fda44eea9fde8d9d5886647820685ea
This commit is contained in:
Andreas Traczyk 2025-03-06 16:17:04 -05:00
parent b76570b892
commit 83765dcebf
2 changed files with 5 additions and 4 deletions

View file

@ -99,9 +99,9 @@ QtObject {
function presentDialog(parent, path, props = {}, singleInstance = false) {
// Open the dialog once the object is created
let createFunc = singleInstance ? viewManager.createView : viewManager.createUniqueView;
return createFunc(path, parent, function (obj) {
return createFunc(path, parent, function (obj, viewName) {
const doneCb = function () {
viewManager.destroyView(path);
viewManager.destroyView(viewName);
};
if (obj.closed !== undefined) {
obj.closed.connect(doneCb);

View file

@ -59,7 +59,7 @@ QtObject {
if (views.hasOwnProperty(viewName)) {
// an instance of the view already exists
if (cb !== null) {
cb(views[viewName])
cb(views[viewName], viewName)
}
return views[viewName]
}
@ -76,7 +76,7 @@ QtObject {
viewName.replace(/^.*[\\\/]/, '').replace(/\.[^/.]+$/, "")
viewPaths[friendlyName] = viewName
if (cb !== null) {
cb(obj)
cb(obj , viewName)
}
return views[viewName]
}
@ -103,6 +103,7 @@ QtObject {
function destroyView(path) {
// The view may already have been destroyed.
if (!views.hasOwnProperty(path)) {
console.warn("View not found:", path, "Available views:", Object.keys(views))
return false
}
views[path].destroy()