Canonical Parent

So the original space parent and child stuff was technically a bit naughty in that it allowed multiple rooms to be set as the canonical parent. Because while a room can have multiple parents only one should be canonical. This adds the following:
- When adding a child or parent there is an extra check to select if the new parent should be canonical
- Any parent can be selected as the canonical one from the room settings
- All functions ensure that there is only ever one canonical parent by ensuring all others are false when a new one is set.
This commit is contained in:
James Graham
2023-10-13 12:00:47 +00:00
parent fe70e2773f
commit e480299563
5 changed files with 137 additions and 31 deletions

View File

@@ -24,7 +24,7 @@ FormCard.FormCardPage {
required property NeoChatConnection connection
signal addChild(string childId, bool setChildParent)
signal addChild(string childId, bool setChildParent, bool canonical)
signal newChild(string childName)
title: isSpace ? i18nc("@title", "Create a Space") : i18nc("@title", "Create a Room")
@@ -214,11 +214,18 @@ FormCard.FormCardPage {
return false;
}
}
FormCard.FormCheckDelegate {
id: makeCanonicalCheck
text: i18n("Make this space the canonical parent")
checked: enabled
enabled: existingOfficialCheck.enabled
}
FormCard.FormButtonDelegate {
text: i18nc("@action:button", "Ok")
enabled: chosenRoomDelegate.visible
onClicked: {
root.addChild(chosenRoomDelegate.roomId, existingOfficialCheck.checked);
root.addChild(chosenRoomDelegate.roomId, existingOfficialCheck.checked, makeCanonicalCheck.checked);
root.closeDialog();
}
}