feat(StatusChatListCategory): introduce flag to show/hide buttons
This commit introduces a `showActionButtons` flag that defaults to `false` and can be used to render the action buttons provided in the chat list category. This is useful for cases where only admin users should have the right to create channels inside categories or mutate a category's state. Settings `showActionButtons: true` will then render the buttons. Closes #150
This commit is contained in:
parent
4f6ff27f90
commit
9982c3df52
|
@ -279,7 +279,7 @@ Rectangle {
|
|||
|
||||
StatusChatListCategory {
|
||||
name: "Public"
|
||||
|
||||
showActionButtons: true
|
||||
chatList.chatListItems.model: demoCommunityChatListItems
|
||||
chatList.selectedChatId: "0"
|
||||
chatList.onChatItemSelected: chatList.selectedChatId = id
|
||||
|
@ -289,6 +289,7 @@ Rectangle {
|
|||
StatusChatListCategory {
|
||||
name: "Development"
|
||||
|
||||
showActionButtons: true
|
||||
chatList.chatListItems.model: demoCommunityChatListItems
|
||||
chatList.onChatItemSelected: chatList.selectedChatId = id
|
||||
popupMenu: categoryPopupCmp
|
||||
|
|
|
@ -40,11 +40,18 @@ GridLayout {
|
|||
StatusChatListCategoryItem {
|
||||
title: "Chat list category"
|
||||
opened: false
|
||||
showActionButtons: true
|
||||
}
|
||||
|
||||
StatusChatListCategoryItem {
|
||||
title: "Chat list category (opened)"
|
||||
opened: true
|
||||
showActionButtons: true
|
||||
}
|
||||
|
||||
StatusChatListCategoryItem {
|
||||
title: "Chat list category (no buttons)"
|
||||
opened: true
|
||||
}
|
||||
|
||||
StatusChatListItem {
|
||||
|
|
|
@ -12,6 +12,7 @@ Column {
|
|||
property string name: ""
|
||||
property bool opened: true
|
||||
|
||||
property alias showActionButtons: statusChatListCategoryItem.showActionButtons
|
||||
property alias addButton: statusChatListCategoryItem.addButton
|
||||
property alias menuButton: statusChatListCategoryItem.menuButton
|
||||
property alias toggleButton: statusChatListCategoryItem.toggleButton
|
||||
|
|
|
@ -16,6 +16,7 @@ StatusListItem {
|
|||
|
||||
property bool opened: true
|
||||
property bool highlighted: false
|
||||
property bool showActionButtons: false
|
||||
property alias addButton: addButton
|
||||
property alias menuButton: menuButton
|
||||
property alias toggleButton: toggleButton
|
||||
|
@ -39,7 +40,9 @@ StatusListItem {
|
|||
id: addButton
|
||||
icon.name: "add"
|
||||
icon.width: 20
|
||||
visible: statusChatListCategoryItem.sensor.containsMouse || statusChatListCategoryItem.highlighted
|
||||
visible: statusChatListCategoryItem.showActionButtons &&
|
||||
(statusChatListCategoryItem.highlighted ||
|
||||
statusChatListCategoryItem.sensor.containsMouse)
|
||||
onClicked: statusChatListCategoryItem.addButtonClicked(mouse)
|
||||
tooltip.text: "Add channel inside category"
|
||||
},
|
||||
|
@ -47,7 +50,9 @@ StatusListItem {
|
|||
id: menuButton
|
||||
icon.name: "more"
|
||||
icon.width: 21
|
||||
visible: statusChatListCategoryItem.sensor.containsMouse || statusChatListCategoryItem.highlighted
|
||||
visible: statusChatListCategoryItem.showActionButtons &&
|
||||
(statusChatListCategoryItem.highlighted ||
|
||||
statusChatListCategoryItem.sensor.containsMouse)
|
||||
onClicked: statusChatListCategoryItem.menuButtonClicked(mouse)
|
||||
tooltip.text: "More"
|
||||
},
|
||||
|
|
Loading…
Reference in New Issue