fix(@desktop/onboarding): Hide current account from accounts list

Fix #7045
This commit is contained in:
Michal Iskierko 2022-08-22 17:35:39 +02:00 committed by Michał Iskierko
parent 7544bd6fb5
commit 61f2bb8a74
2 changed files with 52 additions and 29 deletions

View File

@ -10,7 +10,7 @@ import StatusQ.Popups 0.1
import shared.controls.chat 1.0
import utils 1.0
MenuItem {
Item {
id: root
property string label: ""
@ -25,12 +25,17 @@ MenuItem {
width: parent.width
height: 64
background: Rectangle {
color: root.hovered ? Theme.palette.statusSelect.menuItemHoverBackgroundColor : Theme.palette.statusSelect.menuItemBackgroundColor
Rectangle {
anchors.fill: root
color: sensor.containsMouse ? Theme.palette.statusSelect.menuItemHoverBackgroundColor : Theme.palette.statusSelect.menuItemBackgroundColor
}
MouseArea {
id: sensor
cursorShape: Qt.PointingHandCursor
anchors.fill: root
hoverEnabled: true
onClicked: {
root.clicked()
}

View File

@ -11,6 +11,8 @@ import StatusQ.Controls 0.1
import StatusQ.Controls.Validators 0.1
import StatusQ.Popups 0.1
import SortFilterProxyModel 0.2
import shared.panels 1.0
import shared.popups 1.0
import shared.status 1.0
@ -263,37 +265,53 @@ Item {
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
width: parent.width + Style.current.bigPadding
dim: false
Repeater {
id: accounts
model: root.startupStore.startupModuleInst.loginAccountsModel
delegate: AccountMenuItemPanel {
label: model.username
image: model.thumbnailImage
colorId: model.colorId
colorHash: model.colorHash
keycardCreatedAccount: model.keycardCreatedAccount
onClicked: {
root.startupStore.setSelectedLoginAccountByIndex(index)
d.resetLogin()
accountsPopup.close()
SortFilterProxyModel {
id: proxyModel
sourceModel: root.startupStore.startupModuleInst.loginAccountsModel
filters: ValueFilter {
roleName: "keyUid"
value: root.startupStore.selectedLoginAccount.keyUid
inverted: true
}
}
Column {
width: parent.width
Repeater {
model: proxyModel
delegate: AccountMenuItemPanel {
label: model.username
image: model.thumbnailImage
colorId: model.colorId
colorHash: model.colorHash
keycardCreatedAccount: model.keycardCreatedAccount
onClicked: {
d.resetLogin()
accountsPopup.close()
const realIndex = proxyModel.mapToSource(index)
root.startupStore.setSelectedLoginAccountByIndex(realIndex)
}
}
}
}
AccountMenuItemPanel {
label: qsTr("Add new user")
onClicked: {
accountsPopup.close()
root.startupStore.doSecondaryAction()
AccountMenuItemPanel {
label: qsTr("Add new user")
onClicked: {
accountsPopup.close()
root.startupStore.doSecondaryAction()
}
}
}
AccountMenuItemPanel {
label: qsTr("Add existing Status user")
iconSettings.name: "wallet"
onClicked: {
accountsPopup.close()
root.startupStore.doTertiaryAction()
AccountMenuItemPanel {
label: qsTr("Add existing Status user")
iconSettings.name: "wallet"
onClicked: {
accountsPopup.close()
root.startupStore.doTertiaryAction()
}
}
}
}