fix(desktop/chat) online/offline selector not changing color/state

Closes #4049
This commit is contained in:
Alexandra Betouni 2021-11-05 01:38:57 +02:00 committed by Iuri Matias
parent 46f9e1fc93
commit d78211972e
2 changed files with 9 additions and 8 deletions

View File

@ -363,8 +363,8 @@ Item {
badge.implicitHeight: 15 badge.implicitHeight: 15
badge.implicitWidth: 15 badge.implicitWidth: 15
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor
badge.color: { //badge.color: profileModule.model.sendUserStatus ? Style.current.green : Style.current.midGrey
return profileModule.model.sendUserStatus ? Style.current.green : Style.current.midGrey badge.color: appMain.rootStore.profileModelInst.profile.sendUserStatus ? Style.current.green : Style.current.midGrey
/* /*
// Use this code once support for custom user status is added // Use this code once support for custom user status is added
switch(profileModel.profile.currentUserStatus){ switch(profileModel.profile.currentUserStatus){
@ -375,7 +375,6 @@ Item {
default: default:
return Style.current.midGrey; return Style.current.midGrey;
}*/ }*/
}
badge.border.width: 3 badge.border.width: 3
onClicked: { onClicked: {
userStatusContextMenu.opened ? userStatusContextMenu.opened ?
@ -386,6 +385,7 @@ Item {
UserStatusContextMenu { UserStatusContextMenu {
id: userStatusContextMenu id: userStatusContextMenu
y: profileButton.y - userStatusContextMenu.height y: profileButton.y - userStatusContextMenu.height
store: appMain.rootStore
} }
} }
} }

View File

@ -12,6 +12,7 @@ import StatusQ.Components 0.1
// TODO: replace with StatusPopupMenu // TODO: replace with StatusPopupMenu
PopupMenu { PopupMenu {
id: root id: root
property var store
width: profileHeader.width width: profileHeader.width
closePolicy: Popup.CloseOnReleaseOutsideParent | Popup.CloseOnEscape closePolicy: Popup.CloseOnReleaseOutsideParent | Popup.CloseOnEscape
@ -34,7 +35,7 @@ PopupMenu {
} }
StyledText { StyledText {
id: username id: username
text: Utils.removeStatusEns(profileModel.ens.preferredUsername || profileModule.model.username) text: Utils.removeStatusEns(root.store.profileModelInst.ens.preferredUsername || profileModule.model.username)
elide: Text.ElideRight elide: Text.ElideRight
maximumLineCount: 3 maximumLineCount: 3
horizontalAlignment: Text.AlignHCenter horizontalAlignment: Text.AlignHCenter
@ -86,8 +87,8 @@ PopupMenu {
Action { Action {
text: qsTr("Online") text: qsTr("Online")
onTriggered: { onTriggered: {
if (profileModule.sendUserStatus != true) { if (root.store.profileModelInst.profile.sendUserStatus != true) {
profileModule.setSendUserStatus(true) root.store.profileModelInst.profile.setSendUserStatus(true)
} }
root.close() root.close()
} }
@ -100,8 +101,8 @@ PopupMenu {
Action { Action {
text: qsTr("Offline") text: qsTr("Offline")
onTriggered: { onTriggered: {
if (profileModule.sendUserStatus != false) { if (root.store.profileModelInst.profile.sendUserStatus != false) {
profileModule.setSendUserStatus(false) root.store.profileModelInst.profile.setSendUserStatus(false)
} }
root.close() root.close()
} }