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.implicitWidth: 15
badge.border.color: hovered ? Theme.palette.statusBadge.hoverBorderColor : Theme.palette.statusAppNavBar.backgroundColor
badge.color: {
return profileModule.model.sendUserStatus ? Style.current.green : Style.current.midGrey
//badge.color: 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
switch(profileModel.profile.currentUserStatus){
@ -375,7 +375,6 @@ Item {
default:
return Style.current.midGrey;
}*/
}
badge.border.width: 3
onClicked: {
userStatusContextMenu.opened ?
@ -386,6 +385,7 @@ Item {
UserStatusContextMenu {
id: userStatusContextMenu
y: profileButton.y - userStatusContextMenu.height
store: appMain.rootStore
}
}
}

View File

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