fix: Use prefixes for address copy (#16230)
This commit is contained in:
parent
8dc067e0c4
commit
69605f5965
|
@ -0,0 +1,70 @@
|
|||
import QtQuick 2.15
|
||||
import QtQuick.Controls 2.15
|
||||
import QtQuick.Layouts 1.15
|
||||
|
||||
import StatusQ.Core.Theme 0.1
|
||||
|
||||
import AppLayouts.Wallet.views 1.0
|
||||
|
||||
import utils 1.0
|
||||
|
||||
SplitView {
|
||||
Rectangle {
|
||||
SplitView.fillWidth: true
|
||||
SplitView.fillHeight: true
|
||||
color: Theme.palette.statusAppLayout.rightPanelBackgroundColor
|
||||
clip: true
|
||||
|
||||
Button {
|
||||
anchors.centerIn: parent
|
||||
text: "Show menu"
|
||||
onClicked: {
|
||||
menu.popup()
|
||||
}
|
||||
}
|
||||
|
||||
AccountContextMenu {
|
||||
id: menu
|
||||
anchors.centerIn: parent
|
||||
|
||||
name: walletAccountCheckbox.checked ? "Test name" : ""
|
||||
address: walletAccountCheckbox.checked ? "0x1234567890" : ""
|
||||
canDelete: canDeleteCheckbox.checked
|
||||
walletType: watchOnlyCheckbox.checked ? Constants.watchWalletType : ""
|
||||
canAddWatchOnlyAccount: canAddWatchOnlyAccountCheckbox.checked
|
||||
}
|
||||
}
|
||||
|
||||
Pane {
|
||||
SplitView.minimumWidth: 300
|
||||
SplitView.preferredWidth: 300
|
||||
|
||||
ScrollView {
|
||||
anchors.fill: parent
|
||||
|
||||
ColumnLayout {
|
||||
spacing: 16
|
||||
CheckBox {
|
||||
id: walletAccountCheckbox
|
||||
text: "Wallet account"
|
||||
checked: true
|
||||
}
|
||||
CheckBox {
|
||||
id: canDeleteCheckbox
|
||||
text: "Can delete"
|
||||
checked: true
|
||||
}
|
||||
CheckBox {
|
||||
id: watchOnlyCheckbox
|
||||
text: "Is watch only"
|
||||
checked: true
|
||||
}
|
||||
CheckBox {
|
||||
id: canAddWatchOnlyAccountCheckbox
|
||||
text: "Can add watch only"
|
||||
checked: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -4,40 +4,42 @@ import QtQuick.Controls 2.15
|
|||
import StatusQ 0.1
|
||||
import StatusQ.Popups 0.1
|
||||
|
||||
import "../stores"
|
||||
|
||||
import utils 1.0
|
||||
|
||||
StatusMenu {
|
||||
id: root
|
||||
|
||||
property var account
|
||||
property string address
|
||||
property string name
|
||||
property string walletType
|
||||
property bool canDelete
|
||||
property bool hideFromTotalBalance
|
||||
property bool canAddWatchOnlyAccount: false
|
||||
|
||||
signal editAccountClicked()
|
||||
signal deleteAccountClicked()
|
||||
signal addNewAccountClicked()
|
||||
signal addWatchOnlyAccountClicked()
|
||||
signal hideFromTotalBalanceClicked(string address, bool hideFromTotalBalance)
|
||||
|
||||
signal hideFromTotalBalanceClicked(bool hideFromTotalBalance)
|
||||
|
||||
StatusSuccessAction {
|
||||
id: copyAddressAction
|
||||
objectName: "AccountMenu-CopyAddressAction_" + root.account.name
|
||||
objectName: "AccountMenu-CopyAddressAction_" + root.name
|
||||
successText: qsTr("Address copied")
|
||||
text: qsTr("Copy address")
|
||||
icon.name: "copy"
|
||||
timeout: 1500
|
||||
enabled: !!root.account
|
||||
onTriggered: ClipboardUtils.setText(root.account.address?? "")
|
||||
enabled: !!root.address
|
||||
onTriggered: ClipboardUtils.setText(root.address)
|
||||
}
|
||||
|
||||
StatusMenuSeparator {
|
||||
visible: !!root.account
|
||||
visible: !!root.address
|
||||
}
|
||||
|
||||
StatusAction {
|
||||
objectName: "AccountMenu-EditAction_" + root.account.name
|
||||
enabled: !!root.account
|
||||
objectName: "AccountMenu-EditAction_" + root.name
|
||||
enabled: !!root.address
|
||||
text: qsTr("Edit")
|
||||
icon.name: "pencil-outline"
|
||||
onTriggered: {
|
||||
|
@ -46,17 +48,16 @@ StatusMenu {
|
|||
}
|
||||
|
||||
StatusAction {
|
||||
objectName: "AccountMenu-HideFromTotalBalance_" + root.account.name
|
||||
enabled: !!root.account && root.account.walletType === Constants.watchWalletType
|
||||
text: !!root.account ? root.account.hideFromTotalBalance ? qsTr("Include in balances and activity")
|
||||
: qsTr("Exclude from balances and activity") : ""
|
||||
icon.name: !!root.account ? root.account.hideFromTotalBalance ? "show" : "hide": ""
|
||||
onTriggered: root.hideFromTotalBalanceClicked(root.account.address, !root.account.hideFromTotalBalance)
|
||||
objectName: "AccountMenu-HideFromTotalBalance_" + root.name
|
||||
enabled: !!root.address && root.walletType === Constants.watchWalletType
|
||||
text: root.hideFromTotalBalance ? qsTr("Include in balances and activity") : qsTr("Exclude from balances and activity")
|
||||
icon.name: root.hideFromTotalBalance ? "show" : "hide"
|
||||
onTriggered: root.hideFromTotalBalanceClicked(!root.hideFromTotalBalance)
|
||||
}
|
||||
|
||||
StatusAction {
|
||||
objectName: "AccountMenu-DeleteAction_" + root.account.name
|
||||
enabled: !!root.account && !root.account.isWallet
|
||||
objectName: "AccountMenu-DeleteAction_" + root.name
|
||||
enabled: !!root.address && root.canDelete
|
||||
text: qsTr("Delete")
|
||||
icon.name: "info"
|
||||
type: StatusAction.Type.Danger
|
||||
|
@ -66,28 +67,22 @@ StatusMenu {
|
|||
}
|
||||
|
||||
StatusAction {
|
||||
objectName: "AccountMenu-AddNewAccountAction_" + root.account.name
|
||||
objectName: "AccountMenu-AddNewAccountAction_" + root.name
|
||||
text: qsTr("Add new account")
|
||||
enabled: !root.account
|
||||
enabled: !root.address
|
||||
icon.name: "add"
|
||||
onTriggered: {
|
||||
root.addNewAccountClicked()
|
||||
}
|
||||
}
|
||||
|
||||
Loader {
|
||||
active: !production
|
||||
sourceComponent: StatusAction {
|
||||
objectName: "AccountMenu-AddWatchOnlyAccountAction_" + root.account.name
|
||||
text: qsTr("Add watched address")
|
||||
enabled: !root.account
|
||||
icon.name: "show"
|
||||
onTriggered: {
|
||||
root.addWatchOnlyAccountClicked()
|
||||
}
|
||||
}
|
||||
onLoaded: {
|
||||
root.addAction(item)
|
||||
StatusAction {
|
||||
objectName: "AccountMenu-AddWatchOnlyAccountAction_" + root.name
|
||||
text: qsTr("Add watched address")
|
||||
enabled: root.canAddWatchOnlyAccount && !root.address
|
||||
icon.name: "show"
|
||||
onTriggered: {
|
||||
root.addWatchOnlyAccountClicked()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,6 +19,8 @@ import shared.popups.keycard 1.0
|
|||
import shared.popups.addaccount 1.0
|
||||
import shared.stores 1.0
|
||||
|
||||
import AppLayouts.Wallet 1.0
|
||||
|
||||
import "../controls"
|
||||
import "../popups"
|
||||
import "../stores"
|
||||
|
@ -63,6 +65,23 @@ Rectangle {
|
|||
id: walletAccountContextMenu
|
||||
active: false
|
||||
sourceComponent: AccountContextMenu {
|
||||
property var account: null
|
||||
address: {
|
||||
if (!account)
|
||||
return ""
|
||||
let address = account.address
|
||||
const preferredChains = account.preferredSharingChainIds
|
||||
if (!!preferredChains) {
|
||||
const shortNames = WalletUtils.getNetworkShortNames(preferredChains, root.networkConnectionStore.filteredflatNetworks)
|
||||
address = `${shortNames}${address}`
|
||||
}
|
||||
return address
|
||||
}
|
||||
name: account ? account.name : ""
|
||||
walletType: account ? account.walletType : ""
|
||||
canDelete: account && !account.isWallet
|
||||
hideFromTotalBalance: account && account.hideFromTotalBalance
|
||||
canAddWatchOnlyAccount: !production
|
||||
|
||||
onClosed: {
|
||||
walletAccountContextMenu.active = false
|
||||
|
@ -95,7 +114,11 @@ Rectangle {
|
|||
removeAccountConfirmation.active = true
|
||||
}
|
||||
|
||||
onHideFromTotalBalanceClicked: RootStore.updateWatchAccountHiddenFromTotalBalance(address, hideFromTotalBalance)
|
||||
onHideFromTotalBalanceClicked: {
|
||||
if (!account)
|
||||
return
|
||||
RootStore.updateWatchAccountHiddenFromTotalBalance(account.address, hideFromTotalBalance)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,3 +6,4 @@ SavedAddresses 1.0 SavedAddresses.qml
|
|||
TokenSelectorAssetDelegate 1.0 TokenSelectorAssetDelegate.qml
|
||||
TokenSelectorCollectibleDelegate 1.0 TokenSelectorCollectibleDelegate.qml
|
||||
TokenSelectorView 1.0 TokenSelectorView.qml
|
||||
AccountContextMenu 1.0 AccountContextMenu.qml
|
||||
|
|
|
@ -17,7 +17,7 @@ QtObject {
|
|||
readonly property bool balanceCache: walletSectionAssets.hasBalanceCache
|
||||
readonly property bool marketValuesCache: walletSectionAssets.hasMarketValuesCache
|
||||
|
||||
readonly property SortFilterProxyModel __filteredflatNetworks: SortFilterProxyModel {
|
||||
readonly property SortFilterProxyModel filteredflatNetworks: SortFilterProxyModel {
|
||||
sourceModel: networksModule.flatNetworks
|
||||
filters: ValueFilter { roleName: "isTest"; value: networksModule.areTestNetworksEnabled }
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue