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

View File

@ -11,6 +11,8 @@ import StatusQ.Controls 0.1
import StatusQ.Controls.Validators 0.1 import StatusQ.Controls.Validators 0.1
import StatusQ.Popups 0.1 import StatusQ.Popups 0.1
import SortFilterProxyModel 0.2
import shared.panels 1.0 import shared.panels 1.0
import shared.popups 1.0 import shared.popups 1.0
import shared.status 1.0 import shared.status 1.0
@ -263,9 +265,23 @@ Item {
closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent closePolicy: Popup.CloseOnEscape | Popup.CloseOnPressOutsideParent
width: parent.width + Style.current.bigPadding width: parent.width + Style.current.bigPadding
dim: false dim: false
SortFilterProxyModel {
id: proxyModel
sourceModel: root.startupStore.startupModuleInst.loginAccountsModel
filters: ValueFilter {
roleName: "keyUid"
value: root.startupStore.selectedLoginAccount.keyUid
inverted: true
}
}
Column {
width: parent.width
Repeater { Repeater {
id: accounts model: proxyModel
model: root.startupStore.startupModuleInst.loginAccountsModel
delegate: AccountMenuItemPanel { delegate: AccountMenuItemPanel {
label: model.username label: model.username
image: model.thumbnailImage image: model.thumbnailImage
@ -273,9 +289,10 @@ Item {
colorHash: model.colorHash colorHash: model.colorHash
keycardCreatedAccount: model.keycardCreatedAccount keycardCreatedAccount: model.keycardCreatedAccount
onClicked: { onClicked: {
root.startupStore.setSelectedLoginAccountByIndex(index)
d.resetLogin() d.resetLogin()
accountsPopup.close() accountsPopup.close()
const realIndex = proxyModel.mapToSource(index)
root.startupStore.setSelectedLoginAccountByIndex(realIndex)
} }
} }
} }
@ -298,6 +315,7 @@ Item {
} }
} }
} }
}
Item { Item {
id: passwordSection id: passwordSection