fix: Use mixcase address when sharing the address

This commit is contained in:
Alex Jbanca 2025-02-17 15:31:52 +02:00 committed by Alex Jbanca
parent 4856a1ab76
commit e4df7d48eb
6 changed files with 27 additions and 4 deletions

View File

@ -15,6 +15,7 @@ QtObject:
proc setup*(self: Item,
name: string,
address: string,
mixedcaseAddress: string,
path: string,
colorId: string,
walletType: string,
@ -33,6 +34,7 @@ QtObject:
self.QObject.setup
self.WalletAccountItem.setup(name,
address,
mixedcaseAddress,
colorId,
emoji,
walletType,
@ -55,6 +57,7 @@ QtObject:
proc newItem*(
name: string = "",
address: string = "",
mixedcaseAddress: string = "",
path: string = "",
colorId: string = "",
walletType: string = "",
@ -73,6 +76,7 @@ QtObject:
new(result, delete)
result.setup(name,
address,
mixedcaseAddress,
path,
colorId,
walletType,

View File

@ -7,6 +7,7 @@ type
ModelRole {.pure.} = enum
Name = UserRole + 1,
Address,
MixedcaseAddress,
Path,
ColorId,
WalletType,
@ -58,6 +59,7 @@ QtObject:
{
ModelRole.Name.int:"name",
ModelRole.Address.int:"address",
ModelRole.MixedcaseAddress.int:"mixedcaseAddress",
ModelRole.Path.int:"path",
ModelRole.ColorId.int:"colorId",
ModelRole.WalletType.int:"walletType",
@ -160,6 +162,8 @@ QtObject:
result = newQVariant(item.name())
of ModelRole.Address:
result = newQVariant(item.address())
of ModelRole.MixedcaseAddress:
result = newQVariant(item.mixedcaseAddress())
of ModelRole.Path:
result = newQVariant(item.path())
of ModelRole.ColorId:

View File

@ -19,6 +19,7 @@ proc walletAccountToWalletAccountItem*(w: WalletAccountDto, keycardAccount: bool
return newWalletAccountItem(
w.name,
w.address,
w.mixedcaseAddress,
w.colorId,
w.emoji,
w.walletType,
@ -37,6 +38,7 @@ proc walletAccountToWalletAccountsItem*(w: WalletAccountDto, isKeycardAccount: b
return wallet_accounts_item.newItem(
w.name,
w.address,
w.mixedcaseAddress,
w.path,
w.colorId,
w.walletType,

View File

@ -7,6 +7,7 @@ QtObject:
type WalletAccountItem* = ref object of QObject
name: string
address: string
mixedcaseAddress: string
colorId: string
emoji: string
walletType: string
@ -21,6 +22,7 @@ QtObject:
proc setup*(self: WalletAccountItem,
name: string = "",
address: string = "",
mixedcaseAddress: string = "",
colorId: string = "",
emoji: string = "",
walletType: string = "",
@ -35,6 +37,7 @@ QtObject:
self.QObject.setup
self.name = name
self.address = address
self.mixedcaseAddress = mixedcaseAddress
self.colorId = colorId
self.emoji = emoji
self.walletType = walletType
@ -52,6 +55,7 @@ QtObject:
proc newWalletAccountItem*(
name: string = "",
address: string = "",
mixedcaseAddress: string = "",
colorId: string = "",
emoji: string = "",
walletType: string = "",
@ -81,6 +85,7 @@ QtObject:
result = fmt"""WalletAccountItem(
name: {self.name},
address: {self.address},
mixedcaseAddress: {self.mixedcaseAddress},
colorId: {self.colorId},
emoji: {self.emoji},
walletType: {self.walletType},
@ -113,6 +118,14 @@ QtObject:
read = address
notify = addressChanged
proc mixedcaseAddressChanged*(self: WalletAccountItem) {.signal.}
proc mixedcaseAddress*(self: WalletAccountItem): string {.slot.} =
return self.mixedcaseAddress
QtProperty[string] mixedcaseAddress:
read = mixedcaseAddress
notify = mixedcaseAddressChanged
proc colorIdChanged*(self: WalletAccountItem) {.signal.}
proc colorId*(self: WalletAccountItem): string {.slot.} =
return self.colorId

View File

@ -33,7 +33,7 @@ StatusModal {
property bool switchingAccounsEnabled: true
property string qrImageSource: root.store.getQrCode(root.selectedAccount.address)
property string qrImageSource: root.store.getQrCode(root.selectedAccount.mixedcaseAddress)
property WalletStores.RootStore store: WalletStores.RootStore
@ -108,7 +108,7 @@ StatusModal {
verticalAlignment: Text.AlignVCenter
textFormat: TextEdit.RichText
wrapMode: Text.WrapAnywhere
text: root.selectedAccount.address
text: root.selectedAccount.mixedcaseAddress
font.pixelSize: 15
color: Theme.palette.directColor1
}
@ -120,7 +120,7 @@ StatusModal {
Layout.preferredWidth: 32
Layout.preferredHeight: 32
Layout.fillWidth: true
textToCopy: root.selectedAccount.address
textToCopy: root.selectedAccount.mixedcaseAddress
successCircleVisible: true
}
}

View File

@ -69,7 +69,7 @@ Rectangle {
address: {
if (!account)
return ""
return account.address
return account.mixedcaseAddress
}
name: account ? account.name : ""
walletType: account ? account.walletType : ""