Permission model

Add a model for managing permissions (power levels) in rooms. This gets rid of a whole bunch of boiler plate in NeoChat and as a bonus makes it easy to add a feature to allow setting the permission level for any event.
This commit is contained in:
James Graham
2024-05-25 16:25:39 +00:00
parent 8199653ddd
commit a48151920d
10 changed files with 736 additions and 678 deletions

View File

@@ -28,32 +28,14 @@ Kirigami.Dialog {
}
}
FormCard.FormCard {
ColumnLayout {
FormCard.FormComboBoxDelegate {
id: powerLevelComboBox
text: i18n("New power level")
model: ListModel {
id: powerLevelModel
}
textRole: "text"
valueRole: "powerLevel"
// Done this way so we can have translated strings.
Component.onCompleted: {
powerLevelModel.append({
"text": i18n("Member (0)"),
"powerLevel": 0
});
powerLevelModel.append({
"text": i18n("Moderator (50)"),
"powerLevel": 50
});
powerLevelModel.append({
"text": i18n("Admin (100)"),
"powerLevel": 100
});
}
model: PowerLevelModel {}
textRole: "name"
valueRole: "value"
}
}
customFooterActions: [