filter out watch only accounts in account list for sending transactions

This commit is contained in:
Iuri Matias 2020-09-10 17:48:16 -04:00
parent f2a56c70e1
commit 212f33b3c0
2 changed files with 6 additions and 2 deletions

View File

@ -15,6 +15,7 @@ type
Balance = UserRole + 4 Balance = UserRole + 4
FiatBalance = UserRole + 5 FiatBalance = UserRole + 5
Assets = UserRole + 6 Assets = UserRole + 6
WalletType = UserRole + 7
QtObject: QtObject:
type AccountList* = ref object of QAbstractListModel type AccountList* = ref object of QAbstractListModel
@ -92,6 +93,7 @@ QtObject:
of AccountRoles.Balance: result = newQVariant(account.balance) of AccountRoles.Balance: result = newQVariant(account.balance)
of AccountRoles.FiatBalance: result = newQVariant(fmt"{account.realFiatBalance:>.2f}") of AccountRoles.FiatBalance: result = newQVariant(fmt"{account.realFiatBalance:>.2f}")
of AccountRoles.Assets: result = newQVariant(accountView.assets) of AccountRoles.Assets: result = newQVariant(accountView.assets)
of AccountRoles.WalletType: result = newQVariant(account.walletType)
method roleNames(self: AccountList): Table[int, string] = method roleNames(self: AccountList): Table[int, string] =
{ AccountRoles.Name.int:"name", { AccountRoles.Name.int:"name",
@ -99,7 +101,8 @@ QtObject:
AccountRoles.Color.int:"iconColor", AccountRoles.Color.int:"iconColor",
AccountRoles.Balance.int:"balance", AccountRoles.Balance.int:"balance",
AccountRoles.FiatBalance.int:"fiatBalance", AccountRoles.FiatBalance.int:"fiatBalance",
AccountRoles.Assets.int:"assets" }.toTable AccountRoles.Assets.int:"assets",
AccountRoles.WalletType.int:"walletType" }.toTable
proc addAccountToList*(self: AccountList, account: WalletAccount) = proc addAccountToList*(self: AccountList, account: WalletAccount) =
if account.iconColor == "": if account.iconColor == "":

View File

@ -160,6 +160,7 @@ Item {
id: menuItem id: menuItem
MenuItem { MenuItem {
id: itemContainer id: itemContainer
visible: walletType !== 'watch'
property bool isFirstItem: index === 0 property bool isFirstItem: index === 0
property bool isLastItem: index === accounts.rowCount() - 1 property bool isLastItem: index === accounts.rowCount() - 1
@ -169,7 +170,7 @@ Item {
} }
} }
height: accountName.height + 14 + accountAddress.height + 14 height: walletType === 'watch' ? 0 : (accountName.height + 14 + accountAddress.height + 14)
SVGImage { SVGImage {
id: iconImg id: iconImg
anchors.left: parent.left anchors.left: parent.left