Return back to the correct page on closing contact edition.

This commit is contained in:
Julien Wadel 2025-01-16 09:49:50 +01:00
parent 53a6f6768d
commit 7c4d89cd86

View file

@ -27,16 +27,25 @@ AbstractMainPage {
rightPanelStackView.clear() rightPanelStackView.clear()
contactList.resetSelections() contactList.resetSelections()
} }
function updateRightPanel(){ function goToContactDetails(){
if (selectedContact) { if (selectedContact) {
while(rightPanelStackView.depth > 1) rightPanelStackView.pop() var firstItem = rightPanelStackView.get(0)
if (!rightPanelStackView.currentItem || rightPanelStackView.currentItem.objectName != "contactDetail") rightPanelStackView.push(contactDetail) if( firstItem && firstItem.objectName == "contactDetail")// Go directly to detail
rightPanelStackView.popToIndex(0)
else{
if(rightPanelStackView.depth >= 1) {// Replace in background and go back to it
rightPanelStackView.replace(firstItem, contactDetail)
rightPanelStackView.popToIndex(0)
}else{// empty
rightPanelStackView.push(contactDetail)
}
}
} else { } else {
if (rightPanelStackView.currentItem && rightPanelStackView.currentItem.objectName === "contactDetail") rightPanelStackView.clear() rightPanelStackView.clear()
} }
} }
onSelectedContactChanged: { onSelectedContactChanged: {
updateRightPanel() goToContactDetails()
} }
onNoItemButtonPressed: createContact("", "") onNoItemButtonPressed: createContact("", "")
@ -754,7 +763,7 @@ AbstractMainPage {
ContactEdition { ContactEdition {
property string objectName: "contactEdition" property string objectName: "contactEdition"
onCloseEdition: redirectAddress => { onCloseEdition: redirectAddress => {
updateRightPanel() goToContactDetails()
if(redirectAddress){ if(redirectAddress){
initialFriendToDisplay = redirectAddress initialFriendToDisplay = redirectAddress
} }