mirror of
https://github.com/status-im/status-desktop.git
synced 2025-01-10 14:26:34 +00:00
feat: add account selectort
This commit is contained in:
parent
70e01db117
commit
e45409b400
@ -133,31 +133,6 @@ Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
Menu {
|
||||
id: accountsMenu
|
||||
Repeater {
|
||||
model: walletModel.accounts
|
||||
MenuItem {
|
||||
visible: model.isWallet || model.walletType === "generated"
|
||||
height: visible ? 40 : 0
|
||||
text: model.name
|
||||
onTriggered: {
|
||||
web3Provider.dappsAddress = model.address;
|
||||
web3Provider.clearPermissions();
|
||||
for (let i = 0; i < tabs.count; ++i){
|
||||
tabs.getTab(i).item.reload();
|
||||
}
|
||||
}
|
||||
checked: {
|
||||
if(web3Provider.dappsAddress === model.address){
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BrowserWalletMenu {
|
||||
id: browserWalletMenu
|
||||
y: root.height + root.anchors.topMargin
|
||||
|
@ -73,4 +73,66 @@ Popup {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Item {
|
||||
property string currentAddress: ""
|
||||
id: accountSelectorRow
|
||||
width: parent.width
|
||||
height: 44
|
||||
anchors.top: walletHeader.bottom
|
||||
anchors.topMargin: Style.current.bigPadding
|
||||
|
||||
AccountSelector {
|
||||
id: accountRow
|
||||
label: ""
|
||||
anchors.left: parent.left
|
||||
anchors.right: copyBtn.left
|
||||
anchors.rightMargin: Style.current.padding
|
||||
accounts: walletModel.accounts
|
||||
selectedAccount: walletModel.currentAccount
|
||||
currency: walletModel.defaultCurrency
|
||||
reset: function() {
|
||||
accounts = Qt.binding(function() { return walletModel.accounts })
|
||||
selectedAccount = Qt.binding(function() { return walletModel.currentAccount })
|
||||
}
|
||||
onSelectedAccountChanged: {
|
||||
if (!accountSelectorRow.currentAddress) {
|
||||
// We just set the account for the first time. Nothing to do here
|
||||
accountSelectorRow.currentAddress = selectedAccount.address
|
||||
return
|
||||
}
|
||||
if (accountSelectorRow.currentAddress === selectedAccount.address) {
|
||||
return
|
||||
}
|
||||
|
||||
accountSelectorRow.currentAddress = selectedAccount.address
|
||||
web3Provider.dappsAddress = selectedAccount.address;
|
||||
web3Provider.clearPermissions();
|
||||
for (let i = 0; i < tabs.count; ++i){
|
||||
tabs.getTab(i).item.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
CopyToClipBoardButton {
|
||||
id: copyBtn
|
||||
width: 20
|
||||
height: 20
|
||||
anchors.right: sendBtn.left
|
||||
anchors.rightMargin: Style.current.padding
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
textToCopy: accountRow.selectedAccount.address
|
||||
}
|
||||
|
||||
StatusIconButton {
|
||||
id: sendBtn
|
||||
icon.name: "send"
|
||||
width: 20
|
||||
height: 20
|
||||
anchors.right: parent.right
|
||||
anchors.verticalCenter: parent.verticalCenter
|
||||
iconColor: Style.current.primary
|
||||
onClicked: console.log("Send Tx")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user