Skip to content
Snippets Groups Projects
Commit 83834301 authored by Sébastien Blin's avatar Sébastien Blin
Browse files

swarmdetailspanel: make profile in readonly if not enough authorization

Change-Id: Ia7d17f72d4de82482187d9f0f945af9024d2c242
GitLab: #737
parent 15eb216f
No related branches found
No related tags found
No related merge requests found
......@@ -41,6 +41,7 @@ Item {
property var editIconColor: UtilsAdapter.luma(root.color) ? JamiTheme.editLineColor : "white"
property var cancelIconColor: UtilsAdapter.luma(root.color) ? JamiTheme.buttonTintedBlue : "white"
property bool readOnly: false
property bool editable: false
property bool hovered: false
property string tooltipText: ""
......@@ -71,7 +72,7 @@ Item {
Image {
id: editImg
opacity: editable
opacity: editable && !root.readOnly
Layout.alignment: Qt.AlignVCenter
......@@ -95,7 +96,7 @@ Item {
MaterialLineEdit {
id: lineEdit
readOnly: !editable
readOnly: !editable || root.readOnly
underlined: true
borderColor: root.editIconColor
......@@ -127,9 +128,9 @@ Item {
Layout.alignment: Qt.AlignVCenter
enabled: editable
enabled: editable && !root.readOnly
preferredSize: lineEdit.height * 2 / 3
opacity: editable ? 0.8 : 0
opacity: enabled ? 0.8 : 0
imageColor: root.cancelIconColor
normalColor: "transparent"
hoveredColor: JamiTheme.hoveredButtonColor
......@@ -155,7 +156,7 @@ Item {
anchors.fill: row
radius: JamiTheme.primaryRadius
visible: root.editable || root.hovered
visible: (root.editable || root.hovered) && !root.readOnly
color: root.editIconColor
Rectangle {
......
......@@ -32,7 +32,7 @@ Item {
property alias imageId: avatar.imageId
property bool newConversation: false
property bool editable: true
property bool readOnly: false
property real avatarSize
property real buttonSize: avatarSize
property bool darkTheme: false
......@@ -140,7 +140,7 @@ Item {
HoverHandler {
target: parent
enabled: parent.visible && editable
enabled: parent.visible && !root.readOnly
onHoveredChanged: {
overlayHighlighted.visible = hovered
}
......@@ -148,7 +148,7 @@ Item {
TapHandler {
target: parent
enabled: parent.visible && editable
enabled: parent.visible && !root.readOnly
onTapped: {
imageLayer.visible = false
buttonsRowLayout.visible = true
......
......@@ -32,6 +32,7 @@ Rectangle {
id: root
color: CurrentConversation.color
property var isAdmin: UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri) === Member.Role.ADMIN
ColumnLayout {
id: swarmProfileDetails
......@@ -48,7 +49,7 @@ Rectangle {
PhotoboothView {
id: currentAccountAvatar
darkTheme: UtilsAdapter.luma(root.color)
editable: UtilsAdapter.getParticipantRole(CurrentAccount.id, CurrentConversation.id, CurrentAccount.uri) === Member.Role.ADMIN
readOnly: !root.isAdmin
Layout.alignment: Qt.AlignHCenter
......@@ -68,6 +69,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter
text: CurrentConversation.title
readOnly: !root.isAdmin
placeholderText: JamiStrings.swarmName
placeholderTextColor: {
if (editable) {
......@@ -106,6 +108,7 @@ Rectangle {
verticalAlignment: Text.AlignVCenter
text: CurrentConversation.description
readOnly: !root.isAdmin
placeholderText: JamiStrings.addADescription
placeholderTextColor: {
if (editable) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment