parent
67929c8e03
commit
29d78a99be
|
@ -7,6 +7,7 @@ export wallet_account_item
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type AccountItem* = ref object of WalletAccountItem
|
type AccountItem* = ref object of WalletAccountItem
|
||||||
|
position: int
|
||||||
assets: token_model.Model
|
assets: token_model.Model
|
||||||
currencyBalance: CurrencyAmount
|
currencyBalance: CurrencyAmount
|
||||||
|
|
||||||
|
@ -17,8 +18,9 @@ QtObject:
|
||||||
emoji: string,
|
emoji: string,
|
||||||
walletType: string,
|
walletType: string,
|
||||||
assets: token_model.Model,
|
assets: token_model.Model,
|
||||||
currencyBalance: CurrencyAmount
|
currencyBalance: CurrencyAmount,
|
||||||
) =
|
position: int,
|
||||||
|
) =
|
||||||
self.QObject.setup
|
self.QObject.setup
|
||||||
self.WalletAccountItem.setup(name,
|
self.WalletAccountItem.setup(name,
|
||||||
address,
|
address,
|
||||||
|
@ -29,6 +31,7 @@ QtObject:
|
||||||
keyUid = "",
|
keyUid = "",
|
||||||
keycardAccount = false)
|
keycardAccount = false)
|
||||||
self.assets = assets
|
self.assets = assets
|
||||||
|
self.position = position
|
||||||
self.currencyBalance = currencyBalance
|
self.currencyBalance = currencyBalance
|
||||||
|
|
||||||
proc delete*(self: AccountItem) =
|
proc delete*(self: AccountItem) =
|
||||||
|
@ -42,9 +45,10 @@ QtObject:
|
||||||
walletType: string = "",
|
walletType: string = "",
|
||||||
assets: token_model.Model = nil,
|
assets: token_model.Model = nil,
|
||||||
currencyBalance: CurrencyAmount = nil,
|
currencyBalance: CurrencyAmount = nil,
|
||||||
|
position: int = 0,
|
||||||
): AccountItem =
|
): AccountItem =
|
||||||
new(result, delete)
|
new(result, delete)
|
||||||
result.setup(name, address, colorId, emoji, walletType, assets, currencyBalance)
|
result.setup(name, address, colorId, emoji, walletType, assets, currencyBalance, position)
|
||||||
|
|
||||||
proc `$`*(self: AccountItem): string =
|
proc `$`*(self: AccountItem): string =
|
||||||
result = "WalletSection-Send-Item("
|
result = "WalletSection-Send-Item("
|
||||||
|
@ -70,3 +74,6 @@ QtObject:
|
||||||
QtProperty[QVariant] currencyBalance:
|
QtProperty[QVariant] currencyBalance:
|
||||||
read = getCurrencyBalanceAsQVariant
|
read = getCurrencyBalanceAsQVariant
|
||||||
notify = currencyBalanceChanged
|
notify = currencyBalanceChanged
|
||||||
|
|
||||||
|
proc position*(self: AccountItem): int =
|
||||||
|
return self.position
|
|
@ -12,6 +12,7 @@ type
|
||||||
Emoji,
|
Emoji,
|
||||||
Assets,
|
Assets,
|
||||||
CurrencyBalance,
|
CurrencyBalance,
|
||||||
|
Position,
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
|
@ -54,6 +55,7 @@ QtObject:
|
||||||
ModelRole.Emoji.int: "emoji",
|
ModelRole.Emoji.int: "emoji",
|
||||||
ModelRole.Assets.int: "assets",
|
ModelRole.Assets.int: "assets",
|
||||||
ModelRole.CurrencyBalance.int: "currencyBalance",
|
ModelRole.CurrencyBalance.int: "currencyBalance",
|
||||||
|
ModelRole.Position.int: "position",
|
||||||
}.toTable
|
}.toTable
|
||||||
|
|
||||||
proc setItems*(self: AccountsModel, items: seq[AccountItem]) =
|
proc setItems*(self: AccountsModel, items: seq[AccountItem]) =
|
||||||
|
@ -83,6 +85,8 @@ QtObject:
|
||||||
result = newQVariant(item.walletType())
|
result = newQVariant(item.walletType())
|
||||||
of ModelRole.Emoji:
|
of ModelRole.Emoji:
|
||||||
result = newQVariant(item.emoji())
|
result = newQVariant(item.emoji())
|
||||||
|
of ModelRole.Position:
|
||||||
|
result = newQVariant(item.position())
|
||||||
of ModelRole.Assets:
|
of ModelRole.Assets:
|
||||||
result = newQVariant(item.getAssetsAsQVariant())
|
result = newQVariant(item.getAssetsAsQVariant())
|
||||||
of ModelRole.CurrencyBalance:
|
of ModelRole.CurrencyBalance:
|
||||||
|
|
|
@ -2,6 +2,7 @@ import QtQuick 2.13
|
||||||
import QtGraphicalEffects 1.13
|
import QtGraphicalEffects 1.13
|
||||||
import QtQuick.Layouts 1.13
|
import QtQuick.Layouts 1.13
|
||||||
import QtQuick.Controls 2.14
|
import QtQuick.Controls 2.14
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
import StatusQ.Core 0.1
|
import StatusQ.Core 0.1
|
||||||
import StatusQ.Core.Theme 0.1
|
import StatusQ.Core.Theme 0.1
|
||||||
|
@ -42,7 +43,12 @@ StatusModal {
|
||||||
|
|
||||||
hasFloatingButtons: true
|
hasFloatingButtons: true
|
||||||
advancedHeaderComponent: AccountsModalHeader {
|
advancedHeaderComponent: AccountsModalHeader {
|
||||||
model: RootStore.receiveAccounts
|
model: SortFilterProxyModel {
|
||||||
|
sourceModel: RootStore.receiveAccounts
|
||||||
|
|
||||||
|
sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder }
|
||||||
|
}
|
||||||
|
|
||||||
selectedAccount: RootStore.selectedReceiveAccount
|
selectedAccount: RootStore.selectedReceiveAccount
|
||||||
onSelectedIndexChanged: RootStore.switchReceiveAccount(selectedIndex)
|
onSelectedIndexChanged: RootStore.switchReceiveAccount(selectedIndex)
|
||||||
}
|
}
|
||||||
|
|
|
@ -3,6 +3,7 @@ import QtQuick.Controls 2.13
|
||||||
import QtQuick.Layouts 1.13
|
import QtQuick.Layouts 1.13
|
||||||
import QtQuick.Dialogs 1.3
|
import QtQuick.Dialogs 1.3
|
||||||
import QtGraphicalEffects 1.0
|
import QtGraphicalEffects 1.0
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
import shared.stores 1.0
|
import shared.stores 1.0
|
||||||
|
@ -150,7 +151,11 @@ StatusDialog {
|
||||||
header: AccountsModalHeader {
|
header: AccountsModalHeader {
|
||||||
anchors.top: parent.top
|
anchors.top: parent.top
|
||||||
anchors.topMargin: -height - 18
|
anchors.topMargin: -height - 18
|
||||||
model: popup.store.senderAccounts
|
model: SortFilterProxyModel {
|
||||||
|
sourceModel: popup.store.senderAccounts
|
||||||
|
|
||||||
|
sorters: RoleSorter { roleName: "position"; sortOrder: Qt.AscendingOrder }
|
||||||
|
}
|
||||||
selectedAccount: !!popup.selectedAccount ? popup.selectedAccount: {}
|
selectedAccount: !!popup.selectedAccount ? popup.selectedAccount: {}
|
||||||
chainShortNames: store.getAllNetworksSupportedPrefix()
|
chainShortNames: store.getAllNetworksSupportedPrefix()
|
||||||
onSelectedIndexChanged: store.switchSenderAccount(selectedIndex)
|
onSelectedIndexChanged: store.switchSenderAccount(selectedIndex)
|
||||||
|
|
Loading…
Reference in New Issue