2024-10-15 19:26:12 +00:00
|
|
|
import QtQuick 2.15
|
|
|
|
import QtQuick.Layouts 1.15
|
2023-06-22 10:32:43 +00:00
|
|
|
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
import StatusQ.Components 0.1
|
|
|
|
import StatusQ.Core 0.1
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-07-13 13:58:48 +00:00
|
|
|
import StatusQ.Popups 0.1
|
2023-06-22 10:32:43 +00:00
|
|
|
|
|
|
|
import utils 1.0
|
|
|
|
|
2023-07-28 07:57:58 +00:00
|
|
|
import AppLayouts.Profile.popups 1.0
|
|
|
|
|
2023-06-22 10:32:43 +00:00
|
|
|
Rectangle {
|
|
|
|
id: root
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
property var keyPair
|
2023-08-21 10:58:21 +00:00
|
|
|
property bool hasPairedDevices
|
2023-06-22 10:32:43 +00:00
|
|
|
property string userProfilePublicKey
|
|
|
|
|
|
|
|
signal goToAccountView(var account)
|
2023-08-21 10:58:21 +00:00
|
|
|
signal runExportQrFlow()
|
|
|
|
signal runImportViaQrFlow()
|
2023-08-04 12:41:57 +00:00
|
|
|
signal runImportViaSeedPhraseFlow()
|
|
|
|
signal runImportViaPrivateKeyFlow()
|
2023-07-13 13:58:48 +00:00
|
|
|
signal runRenameKeypairFlow()
|
2023-07-28 13:12:46 +00:00
|
|
|
signal runRemoveKeypairFlow()
|
2023-08-25 09:05:05 +00:00
|
|
|
signal runMoveKeypairToKeycardFlow()
|
2023-08-29 14:22:41 +00:00
|
|
|
signal runStopUsingKeycardFlow()
|
2023-06-22 10:32:43 +00:00
|
|
|
|
|
|
|
QtObject {
|
|
|
|
id: d
|
2023-08-04 10:29:04 +00:00
|
|
|
readonly property var relatedAccounts: !!root.keyPair? root.keyPair.accounts : {}
|
|
|
|
readonly property bool isWatchOnly: !!root.keyPair && root.keyPair.pairType === Constants.keypair.type.watchOnly
|
|
|
|
readonly property bool isProfileKeypair: !!root.keyPair && root.keyPair.pairType === Constants.keypair.type.profile
|
2023-06-22 10:32:43 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
implicitHeight: layout.height
|
|
|
|
color: Theme.palette.baseColor4
|
|
|
|
radius: 8
|
|
|
|
|
|
|
|
ColumnLayout {
|
|
|
|
id: layout
|
|
|
|
anchors.horizontalCenter: parent.horizontalCenter
|
|
|
|
width: parent.width
|
|
|
|
StatusListItem {
|
2023-10-18 12:10:47 +00:00
|
|
|
objectName: "walletKeyPairDelegate"
|
2023-06-22 10:32:43 +00:00
|
|
|
Layout.fillWidth: true
|
2023-08-04 10:29:04 +00:00
|
|
|
title: !!root.keyPair? d.isWatchOnly ? qsTr("Watched addresses") : root.keyPair.name : ""
|
2023-06-22 10:32:43 +00:00
|
|
|
statusListItemSubTitle.textFormat: Qt.RichText
|
2023-08-04 10:29:04 +00:00
|
|
|
titleTextIcon: !!root.keyPair && keyPair.migratedToKeycard ? "keycard": ""
|
2023-10-05 15:16:30 +00:00
|
|
|
subTitle: Utils.getKeypairLocation(root.keyPair, false)
|
2023-08-04 10:29:04 +00:00
|
|
|
statusListItemSubTitle.color: Utils.getKeypairLocationColor(root.keyPair)
|
2023-06-22 10:32:43 +00:00
|
|
|
color: Theme.palette.transparent
|
|
|
|
ringSettings {
|
|
|
|
ringSpecModel: d.isProfileKeypair ? Utils.getColorHashAsJson(root.userProfilePublicKey) : []
|
|
|
|
ringPxSize: Math.max(asset.width / 24.0)
|
|
|
|
}
|
|
|
|
asset {
|
2024-10-15 19:26:12 +00:00
|
|
|
width: !!root.keyPair && keyPair.icon? Theme.bigPadding : 40
|
|
|
|
height: !!root.keyPair && keyPair.icon? Theme.bigPadding : 40
|
2023-08-04 10:29:04 +00:00
|
|
|
name: !!root.keyPair? !!root.keyPair.image? root.keyPair.image : root.keyPair.icon : ""
|
|
|
|
isImage: !!root.keyPair && !!keyPair.image
|
2023-06-22 10:32:43 +00:00
|
|
|
color: d.isProfileKeypair ? Utils.colorForPubkey(root.userProfilePublicKey) : Theme.palette.primaryColor1
|
|
|
|
letterSize: Math.max(4, asset.width / 2.4)
|
|
|
|
charactersLen: 2
|
2023-08-04 10:29:04 +00:00
|
|
|
isLetterIdenticon: !!root.keyPair && !keyPair.icon && !asset.name.toString()
|
2023-06-22 10:32:43 +00:00
|
|
|
}
|
|
|
|
components: [
|
|
|
|
StatusFlatRoundButton {
|
|
|
|
icon.name: "more"
|
|
|
|
icon.color: Theme.palette.directColor1
|
|
|
|
visible: !d.isWatchOnly
|
2023-07-13 13:58:48 +00:00
|
|
|
highlighted: menuLoader.item && menuLoader.item.opened
|
|
|
|
onClicked: {
|
|
|
|
menuLoader.active = true
|
|
|
|
menuLoader.item.popup(0, height)
|
|
|
|
}
|
|
|
|
|
|
|
|
Loader {
|
|
|
|
id: menuLoader
|
|
|
|
active: false
|
2023-08-04 10:29:04 +00:00
|
|
|
sourceComponent: WalletKeypairAccountMenu {
|
2023-07-13 13:58:48 +00:00
|
|
|
onClosed: {
|
|
|
|
menuLoader.active = false
|
|
|
|
}
|
2023-07-28 07:57:58 +00:00
|
|
|
keyPair: root.keyPair
|
2023-08-21 10:58:21 +00:00
|
|
|
hasPairedDevices: root.hasPairedDevices
|
|
|
|
onRunExportQrFlow: root.runExportQrFlow()
|
|
|
|
onRunImportViaQrFlow: root.runImportViaQrFlow()
|
2023-08-04 12:41:57 +00:00
|
|
|
onRunImportViaSeedPhraseFlow: root.runImportViaSeedPhraseFlow()
|
|
|
|
onRunImportViaPrivateKeyFlow: root.runImportViaPrivateKeyFlow()
|
2023-07-28 07:57:58 +00:00
|
|
|
onRunRenameKeypairFlow: root.runRenameKeypairFlow()
|
|
|
|
onRunRemoveKeypairFlow: root.runRemoveKeypairFlow()
|
2023-08-25 09:05:05 +00:00
|
|
|
onRunMoveKeypairToKeycardFlow: root.runMoveKeypairToKeycardFlow()
|
2023-08-29 14:22:41 +00:00
|
|
|
onRunStopUsingKeycardFlow: root.runStopUsingKeycardFlow()
|
2023-07-13 13:58:48 +00:00
|
|
|
}
|
|
|
|
}
|
2023-06-22 10:32:43 +00:00
|
|
|
}
|
|
|
|
]
|
|
|
|
}
|
|
|
|
StatusListView {
|
|
|
|
Layout.fillWidth: true
|
|
|
|
Layout.preferredHeight: childrenRect.height
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
Layout.rightMargin: 16
|
|
|
|
spacing: 1
|
|
|
|
model: d.relatedAccounts
|
|
|
|
delegate: WalletAccountDelegate {
|
2024-04-26 10:14:44 +00:00
|
|
|
id: walletAccountDelegate
|
2023-06-22 10:32:43 +00:00
|
|
|
width: ListView.view.width
|
|
|
|
account: model.account
|
|
|
|
totalCount: ListView.view.count
|
|
|
|
onGoToAccountView: root.goToAccountView(model.account)
|
2024-04-26 10:14:44 +00:00
|
|
|
|
|
|
|
RowLayout {
|
|
|
|
anchors.verticalCenter: parent.verticalCenter
|
|
|
|
anchors.right: parent.right
|
2024-10-15 19:26:12 +00:00
|
|
|
anchors.rightMargin: Theme.padding + walletAccountDelegate.statusListItemComponentsSlot.width
|
2024-04-26 10:14:44 +00:00
|
|
|
visible: keyPair.pairType === Constants.keypair.type.watchOnly
|
|
|
|
|
|
|
|
StatusIcon {
|
|
|
|
icon: "wallet"
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
StatusBaseText {
|
|
|
|
text: model.account.hideFromTotalBalance ? qsTr("Excluded") : qsTr("Included")
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
}
|
|
|
|
}
|
2023-06-22 10:32:43 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|