2022-03-07 09:33:38 +00:00
|
|
|
|
import QtQuick 2.13
|
2023-07-18 09:10:48 +00:00
|
|
|
|
import QtQuick.Layouts 1.13
|
2022-07-28 20:56:44 +00:00
|
|
|
|
|
2022-03-07 09:33:38 +00:00
|
|
|
|
import StatusQ.Controls 0.1
|
|
|
|
|
import StatusQ.Components 0.1
|
2023-07-18 09:10:48 +00:00
|
|
|
|
import StatusQ.Core 0.1
|
2022-03-07 09:33:38 +00:00
|
|
|
|
import StatusQ.Core.Theme 0.1
|
2023-07-18 09:10:48 +00:00
|
|
|
|
import StatusQ.Core.Utils 0.1 as StatusQUtils
|
|
|
|
|
|
|
|
|
|
import AppLayouts.Wallet 1.0
|
2023-07-21 08:41:24 +00:00
|
|
|
|
import AppLayouts.Wallet.controls 1.0
|
2023-07-28 07:57:58 +00:00
|
|
|
|
import AppLayouts.Profile.popups 1.0
|
2022-07-28 20:56:44 +00:00
|
|
|
|
|
|
|
|
|
import shared.popups 1.0
|
2023-07-18 09:10:48 +00:00
|
|
|
|
import shared.panels 1.0
|
|
|
|
|
import utils 1.0
|
2022-03-07 09:33:38 +00:00
|
|
|
|
|
2023-07-21 08:41:24 +00:00
|
|
|
|
import SortFilterProxyModel 0.2
|
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
import "../../controls"
|
2022-03-07 09:33:38 +00:00
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
ColumnLayout {
|
2022-03-07 09:33:38 +00:00
|
|
|
|
id: root
|
2023-07-14 12:06:41 +00:00
|
|
|
|
|
2022-03-07 09:33:38 +00:00
|
|
|
|
signal goBack
|
2023-07-28 07:57:58 +00:00
|
|
|
|
signal runRenameKeypairFlow()
|
|
|
|
|
signal runRemoveKeypairFlow()
|
2022-03-07 09:33:38 +00:00
|
|
|
|
|
2023-04-17 11:36:40 +00:00
|
|
|
|
property var account
|
2023-07-18 09:10:48 +00:00
|
|
|
|
property var keyPair
|
|
|
|
|
property var walletStore
|
|
|
|
|
property var emojiPopup
|
|
|
|
|
property string userProfilePublicKey
|
2022-03-07 09:33:38 +00:00
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
QtObject {
|
|
|
|
|
id: d
|
2023-08-04 10:29:04 +00:00
|
|
|
|
readonly property bool watchOnlyAccount: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.watchOnly: false
|
|
|
|
|
readonly property bool privateKeyAccount: !!root.keyPair? root.keyPair.pairType === Constants.keypair.type.privateKeyImport: false
|
|
|
|
|
readonly property string preferredSharingNetworks: !!root.account? root.account.preferredSharingChainIds: ""
|
2023-07-21 08:41:24 +00:00
|
|
|
|
property var preferredSharingNetworksArray: preferredSharingNetworks.split(":").filter(Boolean)
|
2023-07-28 07:57:58 +00:00
|
|
|
|
property string preferredSharingNetworkShortNames: walletStore.getNetworkShortNames(preferredSharingNetworks)
|
|
|
|
|
onPreferredSharingNetworksChanged: {
|
|
|
|
|
preferredSharingNetworksArray = preferredSharingNetworks.split(":")
|
|
|
|
|
preferredSharingNetworkShortNames = walletStore.getNetworkShortNames(preferredSharingNetworks)
|
|
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
spacing: 0
|
2022-07-19 13:45:27 +00:00
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
RowLayout {
|
|
|
|
|
Layout.preferredWidth: parent.width
|
|
|
|
|
RowLayout {
|
|
|
|
|
Layout.fillWidth: true
|
2022-03-10 17:01:17 +00:00
|
|
|
|
spacing: Style.current.smallPadding
|
2023-07-18 09:10:48 +00:00
|
|
|
|
StatusBaseText {
|
|
|
|
|
id: accountName
|
|
|
|
|
objectName: "walletAccountViewAccountName"
|
|
|
|
|
Layout.alignment: Qt.AlignLeft
|
2023-08-04 10:29:04 +00:00
|
|
|
|
text: !!root.account? root.account.name : ""
|
2023-07-18 09:10:48 +00:00
|
|
|
|
font.weight: Font.Bold
|
|
|
|
|
font.pixelSize: 28
|
2023-08-04 10:29:04 +00:00
|
|
|
|
color: !!root.account? Utils.getColorForId(root.account.colorId) : Theme.palette.directColor1
|
2023-07-18 09:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
StatusEmoji {
|
2022-03-07 09:33:38 +00:00
|
|
|
|
id: accountImage
|
2022-08-10 09:23:06 +00:00
|
|
|
|
objectName: "walletAccountViewAccountImage"
|
2023-07-18 09:10:48 +00:00
|
|
|
|
Layout.preferredWidth: 28
|
|
|
|
|
Layout.preferredHeight: 28
|
2023-08-04 10:29:04 +00:00
|
|
|
|
emojiId: StatusQUtils.Emoji.iconId(!!root.account && root.account.emoji ? root.account.emoji : "", StatusQUtils.Emoji.size.big) || ""
|
2022-03-10 17:01:17 +00:00
|
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
StatusButton {
|
|
|
|
|
Layout.alignment: Qt.AlignRight
|
|
|
|
|
objectName: "walletAccountViewEditAccountButton"
|
|
|
|
|
text: qsTr("Edit account")
|
|
|
|
|
icon.name: "edit_pencil"
|
|
|
|
|
onClicked: Global.openPopup(renameAccountModalComponent)
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-08-03 12:51:47 +00:00
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
StatusBaseText {
|
|
|
|
|
Layout.topMargin: Style.current.bigPadding
|
|
|
|
|
text: qsTr("Account details")
|
|
|
|
|
font.pixelSize: 15
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
}
|
2022-08-03 12:51:47 +00:00
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
Rectangle {
|
|
|
|
|
Layout.topMargin: Style.current.halfPadding
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: childrenRect.height
|
|
|
|
|
radius: Style.current.radius
|
|
|
|
|
border.width: 1
|
|
|
|
|
border.color: Theme.palette.directColor8
|
|
|
|
|
color: Theme.palette.transparent
|
2022-08-03 12:51:47 +00:00
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
ColumnLayout {
|
|
|
|
|
width: parent.width
|
|
|
|
|
spacing: 0
|
|
|
|
|
WalletAccountDetailsListItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
title: qsTr("Balance")
|
2023-08-04 10:29:04 +00:00
|
|
|
|
subTitle: !!root.account && root.account.balance ? LocaleUtils.currencyAmountToLocaleString(root.account.balance): ""
|
2023-07-18 09:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
Separator {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
|
}
|
|
|
|
|
WalletAccountDetailsListItem {
|
|
|
|
|
Layout.fillWidth: true
|
2023-07-28 07:57:58 +00:00
|
|
|
|
isInteractive: true
|
|
|
|
|
moreButtonEnabled: true
|
2023-07-18 09:10:48 +00:00
|
|
|
|
title: qsTr("Address")
|
|
|
|
|
subTitle: {
|
2023-08-04 10:29:04 +00:00
|
|
|
|
let address = !!root.account && root.account.address ? root.account.address: ""
|
2023-07-28 07:57:58 +00:00
|
|
|
|
return WalletUtils.colorizedChainPrefix(d.preferredSharingNetworkShortNames) + address
|
2022-03-07 09:33:38 +00:00
|
|
|
|
}
|
2023-07-28 07:57:58 +00:00
|
|
|
|
onButtonClicked: addressMenu.openMenu(this)
|
2022-03-07 09:33:38 +00:00
|
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
|
Separator {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
|
}
|
|
|
|
|
StatusBaseText {
|
|
|
|
|
text: qsTr("Keypair")
|
|
|
|
|
Layout.leftMargin: 16
|
|
|
|
|
Layout.topMargin: 12
|
|
|
|
|
font.pixelSize: 13
|
|
|
|
|
color: Theme.palette.baseColor1
|
|
|
|
|
visible: !d.watchOnlyAccount
|
|
|
|
|
}
|
|
|
|
|
WalletAccountDetailsKeypairItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
keyPair: root.keyPair
|
|
|
|
|
visible: !d.watchOnlyAccount
|
2023-07-28 07:57:58 +00:00
|
|
|
|
onButtonClicked: keycardMenu.popup(this, this.width - 40, this.height / 2 + 20)
|
2023-07-18 09:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
Separator {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
|
visible: !d.watchOnlyAccount
|
|
|
|
|
}
|
|
|
|
|
WalletAccountDetailsListItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
title: qsTr("Origin")
|
|
|
|
|
subTitle: {
|
2023-08-04 10:29:04 +00:00
|
|
|
|
if(!!root.keyPair) {
|
|
|
|
|
switch(root.keyPair.pairType) {
|
|
|
|
|
case Constants.keypair.type.profile:
|
2023-07-18 09:10:48 +00:00
|
|
|
|
return qsTr("Derived from your default Status keypair")
|
2023-08-04 10:29:04 +00:00
|
|
|
|
case Constants.keypair.type.seedImport:
|
2023-07-18 09:10:48 +00:00
|
|
|
|
return qsTr("Imported from seed phrase")
|
2023-08-04 10:29:04 +00:00
|
|
|
|
case Constants.keypair.type.privateKeyImport:
|
2023-07-18 09:10:48 +00:00
|
|
|
|
return qsTr("Imported from private key")
|
2023-08-04 10:29:04 +00:00
|
|
|
|
case Constants.keypair.type.watchOnly:
|
2023-07-18 09:10:48 +00:00
|
|
|
|
return qsTr("Watched address")
|
|
|
|
|
default:
|
|
|
|
|
return ""
|
|
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
|
return ""
|
2022-03-07 09:33:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
|
Separator {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
|
}
|
|
|
|
|
WalletAccountDetailsListItem {
|
|
|
|
|
id: derivationPath
|
|
|
|
|
Layout.fillWidth: true
|
2023-07-28 07:57:58 +00:00
|
|
|
|
isInteractive: true
|
|
|
|
|
copyButtonEnabled: true
|
2023-07-18 09:10:48 +00:00
|
|
|
|
title: qsTr("Derivation Path")
|
2023-08-04 10:29:04 +00:00
|
|
|
|
subTitle: !!root.account? Utils.getPathForDisplay(root.account.path) : ""
|
|
|
|
|
onCopyClicked: root.walletStore.copyToClipboard(!!root.account? root.account.path : "")
|
2023-07-21 08:41:24 +00:00
|
|
|
|
visible: !!subTitle && !d.privateKeyAccount && !d.watchOnlyAccount
|
2023-07-18 09:10:48 +00:00
|
|
|
|
}
|
|
|
|
|
Separator {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
|
visible: derivationPath.visible
|
|
|
|
|
}
|
|
|
|
|
WalletAccountDetailsListItem {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
title: qsTr("Stored")
|
2023-08-04 10:29:04 +00:00
|
|
|
|
subTitle: Utils.getKeypairLocation(root.keyPair)
|
|
|
|
|
statusListItemSubTitle.color: Utils.getKeypairLocationColor(root.keyPair)
|
2022-07-19 13:45:27 +00:00
|
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
|
}
|
2023-07-18 09:10:48 +00:00
|
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
|
|
2023-07-18 09:10:48 +00:00
|
|
|
|
Separator {
|
|
|
|
|
Layout.topMargin: 40
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
|
}
|
|
|
|
|
|
2023-07-21 08:41:24 +00:00
|
|
|
|
StatusListItem {
|
2023-07-18 09:10:48 +00:00
|
|
|
|
Layout.fillWidth: true
|
2023-07-21 08:41:24 +00:00
|
|
|
|
title: qsTr("Preferred networks when sharing this address")
|
|
|
|
|
color: Theme.palette.transparent
|
|
|
|
|
components: [
|
|
|
|
|
NetworkFilter {
|
|
|
|
|
layer1Networks: SortFilterProxyModel {
|
|
|
|
|
sourceModel: root.walletStore.networks
|
|
|
|
|
filters: ValueFilter { roleName: "layer"; value: 1; }
|
|
|
|
|
}
|
|
|
|
|
layer2Networks: SortFilterProxyModel {
|
|
|
|
|
sourceModel: root.walletStore.networks
|
|
|
|
|
filters: ValueFilter { roleName: "layer"; value: 2; }
|
|
|
|
|
}
|
|
|
|
|
allNetworks: root.walletStore.networks
|
|
|
|
|
enabledNetworks: SortFilterProxyModel {
|
|
|
|
|
sourceModel: root.walletStore.networks
|
|
|
|
|
filters: ExpressionFilter {
|
|
|
|
|
expression: d.preferredSharingNetworksArray.includes(model.chainId.toString())
|
|
|
|
|
}
|
2022-03-07 09:33:38 +00:00
|
|
|
|
}
|
2023-07-21 08:41:24 +00:00
|
|
|
|
preferredNetworksMode: true
|
|
|
|
|
preferredSharingNetworks: d.preferredSharingNetworksArray
|
|
|
|
|
onToggleNetwork: (network) => {
|
|
|
|
|
d.preferredSharingNetworksArray = root.walletStore.processPreferredSharingNetworkToggle(d.preferredSharingNetworksArray, network)
|
|
|
|
|
}
|
2023-08-04 10:29:04 +00:00
|
|
|
|
control.popup.onClosed: {
|
|
|
|
|
if (!!root.account) {
|
|
|
|
|
root.walletStore.updateWalletAccountPreferredChains(root.account.address, d.preferredSharingNetworksArray.join(":"))
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-21 08:41:24 +00:00
|
|
|
|
}
|
|
|
|
|
]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Separator {
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
Layout.preferredHeight: 1
|
|
|
|
|
color: Theme.palette.baseColor2
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
StatusButton {
|
|
|
|
|
Layout.topMargin: 20
|
|
|
|
|
Layout.fillWidth: true
|
|
|
|
|
objectName: "deleteAccountButton"
|
|
|
|
|
visible: !!root.account && !root.account.isDefaultAccount
|
|
|
|
|
text: qsTr("Remove account")
|
|
|
|
|
icon.name: "delete"
|
|
|
|
|
type: StatusBaseButton.Type.Danger
|
|
|
|
|
onClicked: confirmationPopup.open()
|
|
|
|
|
|
|
|
|
|
ConfirmationDialog {
|
|
|
|
|
id: confirmationPopup
|
|
|
|
|
confirmButtonObjectName: "confirmDeleteAccountButton"
|
2023-08-04 10:29:04 +00:00
|
|
|
|
headerSettings.title: qsTr("Confirm %1 Removal").arg(!!root.account? root.account.name : "")
|
2023-07-21 08:41:24 +00:00
|
|
|
|
confirmationText: qsTr("You will not be able to restore viewing access to this account in the future unless you enter this account’s address again.")
|
|
|
|
|
confirmButtonLabel: qsTr("Remove Account")
|
|
|
|
|
onConfirmButtonClicked: {
|
2023-08-04 10:29:04 +00:00
|
|
|
|
if (!!root.account) {
|
|
|
|
|
root.walletStore.deleteAccount(root.account.address)
|
|
|
|
|
}
|
2023-07-21 08:41:24 +00:00
|
|
|
|
confirmationPopup.close()
|
|
|
|
|
root.goBack()
|
2022-03-07 09:33:38 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-21 08:41:24 +00:00
|
|
|
|
|
2022-03-10 17:01:17 +00:00
|
|
|
|
Component {
|
|
|
|
|
id: renameAccountModalComponent
|
|
|
|
|
RenameAccontModal {
|
2023-04-17 11:36:40 +00:00
|
|
|
|
account: root.account
|
2022-03-10 17:01:17 +00:00
|
|
|
|
anchors.centerIn: parent
|
|
|
|
|
onClosed: destroy()
|
|
|
|
|
walletStore: root.walletStore
|
|
|
|
|
emojiPopup: root.emojiPopup
|
|
|
|
|
}
|
|
|
|
|
}
|
2023-07-28 07:57:58 +00:00
|
|
|
|
|
|
|
|
|
WalletAddressMenu {
|
|
|
|
|
id: addressMenu
|
|
|
|
|
selectedAddress: !!root.account ? root.account.address: ""
|
|
|
|
|
areTestNetworksEnabled: root.walletStore.areTestNetworksEnabled
|
|
|
|
|
preferredSharingNetworks: d.preferredSharingNetworkShortNames
|
|
|
|
|
preferredSharingNetworksArray: d.preferredSharingNetworksArray
|
|
|
|
|
onCopyToClipboard: root.walletStore.copyToClipboard(address)
|
|
|
|
|
}
|
|
|
|
|
|
2023-08-04 10:29:04 +00:00
|
|
|
|
WalletKeypairAccountMenu {
|
2023-07-28 07:57:58 +00:00
|
|
|
|
id: keycardMenu
|
|
|
|
|
keyPair: root.keyPair
|
|
|
|
|
onRunRenameKeypairFlow: root.runRenameKeypairFlow()
|
|
|
|
|
onRunRemoveKeypairFlow: root.runRemoveKeypairFlow()
|
|
|
|
|
}
|
2022-03-10 17:01:17 +00:00
|
|
|
|
}
|