feat(ProfileShowcase): Add network prefixes and filter watch only accounts
- Added network prefixes in profile showcase accounts delegate and included them in the searcher. - Added filter to just display own accounts in profile showcase accounts tab. Closes #13899
This commit is contained in:
parent
8f2d023702
commit
66c51ed777
|
@ -13,6 +13,7 @@ type
|
||||||
KeyUid,
|
KeyUid,
|
||||||
Position,
|
Position,
|
||||||
KeycardAccount,
|
KeycardAccount,
|
||||||
|
PreferredSharingChainIds
|
||||||
|
|
||||||
QtObject:
|
QtObject:
|
||||||
type
|
type
|
||||||
|
@ -57,6 +58,7 @@ QtObject:
|
||||||
ModelRole.KeyUid.int: "keyUid",
|
ModelRole.KeyUid.int: "keyUid",
|
||||||
ModelRole.Position.int: "position",
|
ModelRole.Position.int: "position",
|
||||||
ModelRole.KeycardAccount.int: "keycardAccount",
|
ModelRole.KeycardAccount.int: "keycardAccount",
|
||||||
|
ModelRole.PreferredSharingChainIds.int: "preferredSharingChainIds"
|
||||||
}.toTable
|
}.toTable
|
||||||
|
|
||||||
|
|
||||||
|
@ -108,6 +110,8 @@ QtObject:
|
||||||
result = newQVariant(item.getPosition())
|
result = newQVariant(item.getPosition())
|
||||||
of ModelRole.KeycardAccount:
|
of ModelRole.KeycardAccount:
|
||||||
result = newQVariant(item.keycardAccount())
|
result = newQVariant(item.keycardAccount())
|
||||||
|
of ModelRole.PreferredSharingChainIds:
|
||||||
|
result = newQVariant(item.preferredSharingChainIds())
|
||||||
|
|
||||||
proc moveItem*(self: Model, fromRow: int, toRow: int): bool =
|
proc moveItem*(self: Model, fromRow: int, toRow: int): bool =
|
||||||
if toRow < 0 or toRow > self.items.len - 1:
|
if toRow < 0 or toRow > self.items.len - 1:
|
||||||
|
|
|
@ -169,9 +169,10 @@ QObject {
|
||||||
expression: {
|
expression: {
|
||||||
root.accountsSearcherText
|
root.accountsSearcherText
|
||||||
return (address.toLowerCase().includes(root.accountsSearcherText.toLowerCase()) ||
|
return (address.toLowerCase().includes(root.accountsSearcherText.toLowerCase()) ||
|
||||||
name.toLowerCase().includes( root.accountsSearcherText.toLowerCase()))
|
name.toLowerCase().includes(root.accountsSearcherText.toLowerCase()) ||
|
||||||
|
preferredSharingChainShortNames.toLowerCase().includes(root.accountsSearcherText.toLowerCase()))
|
||||||
}
|
}
|
||||||
expectedRoles: ["address", "name"]
|
expectedRoles: ["address", "name", "preferredSharingChainShortNames"]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,10 @@ ProfileShowcasePanel {
|
||||||
searchPlaceholderText: qsTr("Search account name or address")
|
searchPlaceholderText: qsTr("Search account name or address")
|
||||||
delegate: ProfileShowcasePanelDelegate {
|
delegate: ProfileShowcasePanelDelegate {
|
||||||
title: model ? model.name : ""
|
title: model ? model.name : ""
|
||||||
secondaryTitle: WalletUtils.addressToDisplay(model ? model.address ?? "" : "", "", true, containsMouse)
|
secondaryTitle: WalletUtils.addressToDisplay(model ? model.address ?? "" : "",
|
||||||
|
model ? model.preferredSharingChainShortNames ?? "" : "",
|
||||||
|
true,
|
||||||
|
containsMouse)
|
||||||
hasEmoji: model && !!model.emoji
|
hasEmoji: model && !!model.emoji
|
||||||
hasIcon: !hasEmoji
|
hasIcon: !hasEmoji
|
||||||
icon.name: hasEmoji ? model.emoji : "filled-account"
|
icon.name: hasEmoji ? model.emoji : "filled-account"
|
||||||
|
|
|
@ -2,6 +2,10 @@ import QtQuick 2.13
|
||||||
|
|
||||||
import utils 1.0
|
import utils 1.0
|
||||||
|
|
||||||
|
import StatusQ 0.1
|
||||||
|
|
||||||
|
import SortFilterProxyModel 0.2
|
||||||
|
|
||||||
QtObject {
|
QtObject {
|
||||||
id: root
|
id: root
|
||||||
|
|
||||||
|
@ -29,6 +33,21 @@ QtObject {
|
||||||
property var overview: walletSectionOverview
|
property var overview: walletSectionOverview
|
||||||
property var accounts: Global.appIsReady? accountsModule.accounts : null
|
property var accounts: Global.appIsReady? accountsModule.accounts : null
|
||||||
property var originModel: accountsModule.keyPairModel
|
property var originModel: accountsModule.keyPairModel
|
||||||
|
property var ownAccounts: SortFilterProxyModel {
|
||||||
|
sourceModel: root.accounts
|
||||||
|
proxyRoles: FastExpressionRole {
|
||||||
|
name: "preferredSharingChainShortNames"
|
||||||
|
expression: {
|
||||||
|
return root.networksModule.getNetworkShortNames(preferredSharingChainIds)
|
||||||
|
}
|
||||||
|
expectedRoles: ["preferredSharingChainIds"]
|
||||||
|
}
|
||||||
|
filters: ValueFilter {
|
||||||
|
roleName: "walletType"
|
||||||
|
value: Constants.watchWalletType
|
||||||
|
inverted: true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
property string userProfilePublicKey: userProfile.pubKey
|
property string userProfilePublicKey: userProfile.pubKey
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,7 @@ SettingsContentBase {
|
||||||
communitiesShowcaseModel: root.profileStore.showcasePreferencesCommunitiesModel
|
communitiesShowcaseModel: root.profileStore.showcasePreferencesCommunitiesModel
|
||||||
communitiesSearcherText: profileShowcaseCommunitiesPanel.searcherText
|
communitiesSearcherText: profileShowcaseCommunitiesPanel.searcherText
|
||||||
|
|
||||||
accountsSourceModel: root.walletStore.accounts
|
accountsSourceModel: root.walletStore.ownAccounts
|
||||||
accountsShowcaseModel: root.profileStore.showcasePreferencesAccountsModel
|
accountsShowcaseModel: root.profileStore.showcasePreferencesAccountsModel
|
||||||
accountsSearcherText: profileShowcaseAccountsPanel.searcherText
|
accountsSearcherText: profileShowcaseAccountsPanel.searcherText
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue